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 f36662b81327925ad0cb063b4a188fbae295d967..30278f0f4fd5105bbba48bd9b3ff6f264b78d725 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); |
} |
/** |
@@ -563,8 +562,13 @@ WebViewInternal.prototype.handleBrowserPluginAttributeMutation = |
if (name == 'internalinstanceid' && !oldValue && !!newValue) { |
this.browserPluginNode.removeAttribute('internalinstanceid'); |
this.internalInstanceId = parseInt(newValue); |
- if (this.deferredAttachState && !!this.guestInstanceId && |
- this.guestInstanceId != 0) { |
+ |
+ if (!this.deferredAttachState) { |
+ this.parseAttributes(); |
+ return; |
+ } |
+ |
+ if (!!this.guestInstanceId && this.guestInstanceId != 0) { |
window.setTimeout(function() { |
var isNewWindow = this.deferredAttachState ? |
this.deferredAttachState.isNewWindow : false; |
@@ -575,6 +579,7 @@ WebViewInternal.prototype.handleBrowserPluginAttributeMutation = |
params); |
}.bind(this), 0); |
} |
+ |
return; |
} |
@@ -737,6 +742,10 @@ WebViewInternal.prototype.onFrameNameChanged = function(name) { |
} |
}; |
+WebViewInternal.prototype.onPluginDestroyed = function() { |
+ this.reset(); |
+}; |
+ |
WebViewInternal.prototype.dispatchEvent = function(webViewEvent) { |
return this.webviewNode.dispatchEvent(webViewEvent); |
}; |