diff --git a/components/script/dom/bindings/utils.rs b/components/script/dom/bindings/utils.rs index ba887934798..adc96c45305 100644 --- a/components/script/dom/bindings/utils.rs +++ b/components/script/dom/bindings/utils.rs @@ -395,7 +395,7 @@ pub unsafe extern "C" fn outerize_global(_cx: *mut JSContext, obj: HandleObject) debug!("outerizing"); let win = root_from_handleobject::(obj).unwrap(); let context = win.browsing_context(); - context.as_ref().unwrap().window_proxy() + context.window_proxy() } /// Deletes the property `id` from `object`. diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs index 2082379f708..908d3dffd2c 100644 --- a/components/script/dom/window.rs +++ b/components/script/dom/window.rs @@ -314,8 +314,8 @@ impl Window { &self.compositor } - pub fn browsing_context(&self) -> Option> { - self.browsing_context.get() + pub fn browsing_context(&self) -> Root { + self.browsing_context.get().unwrap() } pub fn page(&self) -> &Page { @@ -426,7 +426,7 @@ impl WindowMethods for Window { // https://html.spec.whatwg.org/multipage/#dom-document-2 fn Document(&self) -> Root { - self.browsing_context().as_ref().unwrap().active_document() + self.browsing_context().active_document() } // https://html.spec.whatwg.org/multipage/#dom-location @@ -456,7 +456,7 @@ impl WindowMethods for Window { // https://html.spec.whatwg.org/multipage/#dom-frameelement fn GetFrameElement(&self) -> Option> { - self.browsing_context().as_ref().unwrap().frame_element().map(Root::from_ref) + self.browsing_context().frame_element().map(Root::from_ref) } // https://html.spec.whatwg.org/multipage/#dom-navigator @@ -1283,12 +1283,12 @@ impl Window { } pub fn parent(&self) -> Option> { - let browsing_context = self.browsing_context().unwrap(); + let browsing_context = self.browsing_context(); browsing_context.frame_element().map(|frame_element| { let window = window_from_node(frame_element); let context = window.browsing_context(); - context.unwrap().active_window() + context.active_window() }) } }