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) {
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 = [
......
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