Index: chrome/renderer/resources/extensions/web_view.js |
diff --git a/chrome/renderer/resources/extensions/web_view.js b/chrome/renderer/resources/extensions/web_view.js |
index 5f0cb6e5890750dd02b98e6c8e56e03c63127b90..02cf8a46ba59e4cd26626bd6b94e0776d1e2f8f9 100644 |
--- a/chrome/renderer/resources/extensions/web_view.js |
+++ b/chrome/renderer/resources/extensions/web_view.js |
@@ -106,7 +106,7 @@ function WebViewInternal(webviewNode) { |
this.browserPluginNode = this.createBrowserPluginNode(); |
var shadowRoot = this.webviewNode.createShadowRoot(); |
- shadowRoot.appendChild(this.browserPluginNode); |
+ this.partition = new Partition(); |
this.setupWebviewNodeAttributes(); |
this.setupFocusPropagation(); |
@@ -114,10 +114,9 @@ function WebViewInternal(webviewNode) { |
this.viewInstanceId = IdGenerator.GetNextId(); |
- this.partition = new Partition(); |
- this.parseAttributes(); |
- |
new WebViewEvents(this, this.viewInstanceId); |
+ |
+ shadowRoot.appendChild(this.browserPluginNode); |
lazyboy
2014/08/22 22:49:27
This reshuffle is needed, otherwise "internalinsta
|
} |
/** |
@@ -563,17 +562,20 @@ WebViewInternal.prototype.handleBrowserPluginAttributeMutation = |
if (name == 'internalinstanceid' && !oldValue && !!newValue) { |
this.browserPluginNode.removeAttribute('internalinstanceid'); |
this.internalInstanceId = parseInt(newValue); |
- if (this.deferredAttachState && !!this.guestInstanceId && |
- this.guestInstanceId != 0) { |
- window.setTimeout(function() { |
- var isNewWindow = this.deferredAttachState ? |
- this.deferredAttachState.isNewWindow : false; |
- var params = this.buildAttachParams(isNewWindow); |
- guestViewInternalNatives.AttachGuest( |
- this.internalInstanceId, |
- this.guestInstanceId, |
- params); |
- }.bind(this), 0); |
+ if (this.deferredAttachState) |
+ if (!!this.guestInstanceId && this.guestInstanceId != 0) { |
+ window.setTimeout(function() { |
+ var isNewWindow = this.deferredAttachState ? |
+ this.deferredAttachState.isNewWindow : false; |
+ var params = this.buildAttachParams(isNewWindow); |
+ guestViewInternalNatives.AttachGuest( |
+ this.internalInstanceId, |
+ this.guestInstanceId, |
+ params); |
+ }.bind(this), 0); |
+ } |
+ } else { |
+ this.parseAttributes(); |
} |
return; |
} |
@@ -737,6 +739,10 @@ WebViewInternal.prototype.onFrameNameChanged = function(name) { |
} |
}; |
+WebViewInternal.prototype.onPluginDestroyed = function() { |
+ this.reset(); |
+}; |
+ |
WebViewInternal.prototype.dispatchEvent = function(webViewEvent) { |
return this.webviewNode.dispatchEvent(webViewEvent); |
}; |
@@ -866,7 +872,7 @@ WebViewInternal.prototype.attachWindow = function(guestInstanceId, |
if (!this.isPluginInRenderTree()) { |
this.deferredAttachState = {isNewWindow: isNewWindow}; |
- return false; |
+ return true; |
} |
this.deferredAttachState = null; |