From 8df5bdf2fd624b4743527cc3e0719b3c98301c27 Mon Sep 17 00:00:00 2001 From: "Brian R. Bondy" <netzen@gmail.com> Date: Wed, 1 Jun 2016 12:08:04 -0400 Subject: [PATCH] Revert "better handling of guestInstanceId" This reverts commit ffd1a41a0d87ca27c7a775654ae4776be93244cf. --- js/components/frame.js | 15 ++++++++++----- js/state/frameStateUtil.js | 1 + js/stores/windowStore.js | 3 +-- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/js/components/frame.js b/js/components/frame.js index 091189c11f8..72c1ec89303 100644 --- a/js/components/frame.js +++ b/js/components/frame.js @@ -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) @@ -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) diff --git a/js/state/frameStateUtil.js b/js/state/frameStateUtil.js index e0ab8869741..00774d3e250 100644 --- a/js/state/frameStateUtil.js +++ b/js/state/frameStateUtil.js @@ -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') } diff --git a/js/stores/windowStore.js b/js/stores/windowStore.js index b68b2934831..9fa5c229b19 100644 --- a/js/stores/windowStore.js +++ b/js/stores/windowStore.js @@ -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), {