Commit 69e761d6 authored by fsamuel@chromium.org's avatar fsamuel@chromium.org

<webview>: Ensure that createGuest is only called after element attached to DOM

BUG=330264
TBR=fsamuel@chromium.org

Review URL: https://codereview.chromium.org/434523003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@287197 0039d316-1c4b-4281-b951-d872f2087c98
parent 348cf5e6
...@@ -88,6 +88,7 @@ function WebViewInternal(webviewNode) { ...@@ -88,6 +88,7 @@ function WebViewInternal(webviewNode) {
privates(webviewNode).internal = this; privates(webviewNode).internal = this;
this.webviewNode = webviewNode; this.webviewNode = webviewNode;
this.attached = false; this.attached = false;
this.elementAttached = false;
this.beforeFirstNavigation = true; this.beforeFirstNavigation = true;
this.validPartitionId = true; this.validPartitionId = true;
...@@ -626,6 +627,10 @@ WebViewInternal.prototype.parseSrcAttribute = function(result) { ...@@ -626,6 +627,10 @@ WebViewInternal.prototype.parseSrcAttribute = function(result) {
return true; return true;
} }
if (!this.elementAttached) {
return true;
}
if (!this.hasGuestInstanceID()) { if (!this.hasGuestInstanceID()) {
if (this.beforeFirstNavigation) { if (this.beforeFirstNavigation) {
this.beforeFirstNavigation = false; this.beforeFirstNavigation = false;
...@@ -853,8 +858,6 @@ function registerWebViewElement() { ...@@ -853,8 +858,6 @@ function registerWebViewElement() {
new WebViewInternal(this); new WebViewInternal(this);
}; };
proto.customElementDetached = false;
proto.attributeChangedCallback = function(name, oldValue, newValue) { proto.attributeChangedCallback = function(name, oldValue, newValue) {
var internal = privates(this).internal; var internal = privates(this).internal;
if (!internal) { if (!internal) {
...@@ -864,16 +867,23 @@ function registerWebViewElement() { ...@@ -864,16 +867,23 @@ function registerWebViewElement() {
}; };
proto.detachedCallback = function() { proto.detachedCallback = function() {
this.customElementDetached = true; var internal = privates(this).internal;
if (!internal) {
return;
}
internal.elementAttached = false;
}; };
proto.attachedCallback = function() { proto.attachedCallback = function() {
if (this.customElementDetached) { var internal = privates(this).internal;
var webViewInternal = privates(this).internal; if (!internal) {
webViewInternal.resetUponReattachment(); return;
webViewInternal.allocateInstanceId(); }
if (!internal.elementAttached) {
internal.elementAttached = true;
internal.resetUponReattachment();
internal.parseAttributes();
} }
this.customElementDetached = false;
}; };
var methods = [ var methods = [
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment