diff options
Diffstat (limited to 'components/script/dom/window.rs')
-rw-r--r-- | components/script/dom/window.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs index 4f55942111a..5e933ec6868 100644 --- a/components/script/dom/window.rs +++ b/components/script/dom/window.rs @@ -426,7 +426,7 @@ impl WindowMethods for Window { // https://html.spec.whatwg.org/multipage/#dom-document-2 fn Document(&self) -> Root<Document> { - Root::from_ref(self.browsing_context().as_ref().unwrap().active_document()) + self.browsing_context().as_ref().unwrap().active_document() } // https://html.spec.whatwg.org/multipage/#dom-location @@ -1095,8 +1095,9 @@ impl Window { (element, response.rect) } - pub fn init_browsing_context(&self, doc: &Document, frame_element: Option<&Element>) { - self.browsing_context.set(Some(&BrowsingContext::new(doc, frame_element))); + pub fn init_browsing_context(&self, browsing_context: &BrowsingContext) { + assert!(self.browsing_context.get().is_none()); + self.browsing_context.set(Some(&browsing_context)); } /// Commence a new URL load which will either replace this window or scroll to a fragment. @@ -1283,7 +1284,7 @@ impl Window { browsing_context.frame_element().map(|frame_element| { let window = window_from_node(frame_element); let context = window.browsing_context(); - Root::from_ref(context.unwrap().active_window()) + context.unwrap().active_window() }) } } |