Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(63)

Unified Diff: chrome/renderer/resources/extensions/web_view.js

Issue 434523003: <webview>: Ensure that createGuest is only called after element attached to DOM (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 3bed13beaab9d30d95ea6ed93d57b8a732cbccef..f97867a78a2baf7867273dd1a7c1ffa47850a642 100644
--- a/chrome/renderer/resources/extensions/web_view.js
+++ b/chrome/renderer/resources/extensions/web_view.js
@@ -88,6 +88,7 @@ function WebViewInternal(webviewNode) {
privates(webviewNode).internal = this;
this.webviewNode = webviewNode;
this.attached = false;
+ this.elementAttached = false;
this.beforeFirstNavigation = true;
this.validPartitionId = true;
@@ -626,6 +627,10 @@ WebViewInternal.prototype.parseSrcAttribute = function(result) {
return true;
}
+ if (!this.elementAttached) {
+ return true;
+ }
+
if (!this.hasGuestInstanceID()) {
if (this.beforeFirstNavigation) {
this.beforeFirstNavigation = false;
@@ -853,8 +858,6 @@ function registerWebViewElement() {
new WebViewInternal(this);
};
- proto.customElementDetached = false;
-
proto.attributeChangedCallback = function(name, oldValue, newValue) {
var internal = privates(this).internal;
if (!internal) {
@@ -864,16 +867,23 @@ function registerWebViewElement() {
};
proto.detachedCallback = function() {
- this.customElementDetached = true;
+ var internal = privates(this).internal;
+ if (!internal) {
+ return;
+ }
+ internal.elementAttached = false;
};
proto.attachedCallback = function() {
- if (this.customElementDetached) {
- var webViewInternal = privates(this).internal;
- webViewInternal.resetUponReattachment();
- webViewInternal.allocateInstanceId();
+ var internal = privates(this).internal;
+ if (!internal) {
+ return;
+ }
+ if (!internal.elementAttached) {
+ internal.elementAttached = true;
+ internal.resetUponReattachment();
+ internal.parseAttributes();
}
- this.customElementDetached = false;
};
var methods = [
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698