diff options
author | Josh Matthews <josh@joshmatthews.net> | 2018-12-09 23:52:42 -0500 |
---|---|---|
committer | Josh Matthews <josh@joshmatthews.net> | 2018-12-14 13:12:49 -0500 |
commit | fc2d810bce22d4432fd22f30ac4ee06944671612 (patch) | |
tree | 812021d4d34d05ebd0dc7f5a7cb2d7868686fde2 /components/script/dom/htmliframeelement.rs | |
parent | 14b0de30dbf90793c3b6c9017e4c65df9281c5ae (diff) | |
download | servo-fc2d810bce22d4432fd22f30ac4ee06944671612.tar.gz servo-fc2d810bce22d4432fd22f30ac4ee06944671612.zip |
Delay iframe and script element processing until the DOM is stable.
Diffstat (limited to 'components/script/dom/htmliframeelement.rs')
-rw-r--r-- | components/script/dom/htmliframeelement.rs | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/components/script/dom/htmliframeelement.rs b/components/script/dom/htmliframeelement.rs index ae87091e0a3..e471e78aeaf 100644 --- a/components/script/dom/htmliframeelement.rs +++ b/components/script/dom/htmliframeelement.rs @@ -623,18 +623,22 @@ impl VirtualMethods for HTMLIFrameElement { s.bind_to_tree(tree_in_doc); } - // https://html.spec.whatwg.org/multipage/#the-iframe-element - // "When an iframe element is inserted into a document that has - // a browsing context, the user agent must create a new - // browsing context, set the element's nested browsing context - // to the newly-created browsing context, and then process the - // iframe attributes for the "first time"." - if self.upcast::<Node>().is_in_doc_with_browsing_context() { - debug!("iframe bound to browsing context."); - debug_assert!(tree_in_doc, "is_in_doc_with_bc, but not tree_in_doc"); - self.create_nested_browsing_context(); - self.process_the_iframe_attributes(ProcessingMode::FirstTime); - } + let iframe = Trusted::new(self); + document_from_node(self).add_delayed_task(task!(IFrameDelayedInitialize: move || { + let this = iframe.root(); + // https://html.spec.whatwg.org/multipage/#the-iframe-element + // "When an iframe element is inserted into a document that has + // a browsing context, the user agent must create a new + // browsing context, set the element's nested browsing context + // to the newly-created browsing context, and then process the + // iframe attributes for the "first time"." + if this.upcast::<Node>().is_in_doc_with_browsing_context() { + debug!("iframe bound to browsing context."); + debug_assert!(tree_in_doc, "is_in_doc_with_bc, but not tree_in_doc"); + this.create_nested_browsing_context(); + this.process_the_iframe_attributes(ProcessingMode::FirstTime); + } + })); } fn unbind_from_tree(&self, context: &UnbindContext) { |