Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Commit

Permalink
Revert "better handling of guestInstanceId"
Browse files Browse the repository at this point in the history
This reverts commit ffd1a41.
  • Loading branch information
bbondy committed Jun 1, 2016
1 parent 80e90c7 commit 8df5bdf
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
15 changes: 10 additions & 5 deletions js/components/frame.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,19 @@ class Frame extends ImmutableComponent {
// Create the webview dynamically because React doesn't whitelist all
// of the attributes we need
let webviewAdded = false
let guestInstanceId = null
if (this.shouldCreateWebview()) {
// only set the guestInstanceId if this is a new frame
if (this.webview == null) {
guestInstanceId = this.props.frame.get('guestInstanceId')
}
while (this.webviewContainer.firstChild) {
this.webviewContainer.removeChild(this.webviewContainer.firstChild)
}
this.webview = document.createElement('webview')
if (guestInstanceId) {
this.webview.setAttribute('data-guest-instance-id', guestInstanceId)
}
webviewAdded = true
}
this.webview.setAttribute('allowDisplayingInsecureContent', true)
Expand All @@ -131,16 +139,13 @@ class Frame extends ImmutableComponent {
this.webview.allowRunningInsecureContent = true
}

if (this.props.frame.get('guestInstanceId')) {
this.webview.setAttribute('data-guest-instance-id', this.props.frame.get('guestInstanceId'))
} else {
src = location
if (!guestInstanceId) {
this.webview.setAttribute('src', isSourceAboutUrl(src) ? getTargetAboutUrl(src) : src)
}

if (webviewAdded) {
let runOnDomReady = (e) => {
this.webview.removeEventListener(e.type, runOnDomReady)
delete this.webview.dataset.guestInstanceId
cb && cb()
}
this.webview.addEventListener('did-attach', runOnDomReady)
Expand Down
1 change: 1 addition & 0 deletions js/state/frameStateUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ function undoCloseFrame (windowState, closedFrames) {
closedFrames: closedFrames.pop(),
frames: windowState.get('frames').splice(insertIndex, 0,
closedFrame
.delete('guestInstanceId')
.set('src', closedFrame.get('location'))),
activeFrameKey: closedFrame.get('key')
}
Expand Down
3 changes: 1 addition & 2 deletions js/stores/windowStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,7 @@ const doAction = (action) => {

const key = action.key || windowState.get('activeFrameKey')
windowState = windowState.mergeIn(frameStatePath(key), {
location: action.location,
guestInstanceId: undefined
location: action.location
})
if (!action.isNavigatedInPage) {
windowState = windowState.mergeIn(frameStatePath(key), {
Expand Down

0 comments on commit 8df5bdf

Please sign in to comment.