diff options
Diffstat (limited to 'components/script/dom/htmliframeelement.rs')
-rw-r--r-- | components/script/dom/htmliframeelement.rs | 37 |
1 files changed, 14 insertions, 23 deletions
diff --git a/components/script/dom/htmliframeelement.rs b/components/script/dom/htmliframeelement.rs index 9b4ad049c6e..c0b43296f22 100644 --- a/components/script/dom/htmliframeelement.rs +++ b/components/script/dom/htmliframeelement.rs @@ -26,7 +26,6 @@ use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::HTMLIFrameElementBinding::HTMLIFrameElementMethods; use crate::dom::bindings::codegen::Bindings::WindowBinding::Window_Binding::WindowMethods; use crate::dom::bindings::inheritance::Castable; -use crate::dom::bindings::refcounted::Trusted; use crate::dom::bindings::reflector::DomObject; use crate::dom::bindings::root::{DomRoot, LayoutDom, MutNullableDom}; use crate::dom::bindings::str::{DOMString, USVString}; @@ -38,9 +37,7 @@ use crate::dom::element::{ use crate::dom::eventtarget::EventTarget; use crate::dom::globalscope::GlobalScope; use crate::dom::htmlelement::HTMLElement; -use crate::dom::node::{ - document_from_node, window_from_node, BindContext, Node, NodeDamage, UnbindContext, -}; +use crate::dom::node::{document_from_node, window_from_node, Node, NodeDamage, UnbindContext}; use crate::dom::virtualmethods::VirtualMethods; use crate::dom::windowproxy::WindowProxy; use crate::script_runtime::CanGc; @@ -741,28 +738,22 @@ impl VirtualMethods for HTMLIFrameElement { } } - fn bind_to_tree(&self, context: &BindContext) { + fn post_connection_steps(&self) { if let Some(s) = self.super_type() { - s.bind_to_tree(context); + s.post_connection_steps(); } - let tree_connected = context.tree_connected; - 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_connected_with_browsing_context() { - debug!("iframe bound to browsing context."); - debug_assert!(tree_connected, "is_connected_with_bc, but not tree_connected"); - this.create_nested_browsing_context(CanGc::note()); - this.process_the_iframe_attributes(ProcessingMode::FirstTime, CanGc::note()); - } - })); + // 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_connected_with_browsing_context() { + debug!("iframe bound to browsing context."); + self.create_nested_browsing_context(CanGc::note()); + self.process_the_iframe_attributes(ProcessingMode::FirstTime, CanGc::note()); + } } fn unbind_from_tree(&self, context: &UnbindContext) { |