diff options
Diffstat (limited to 'components/script/dom')
-rw-r--r-- | components/script/dom/browsingcontext.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/components/script/dom/browsingcontext.rs b/components/script/dom/browsingcontext.rs index 99c72e1e4be..1b78fb7572d 100644 --- a/components/script/dom/browsingcontext.rs +++ b/components/script/dom/browsingcontext.rs @@ -108,6 +108,12 @@ impl BrowsingContext { Root::from_ref(&self.history.borrow()[self.active_index.get()].document) } + pub fn maybe_active_document(&self) -> Option<Root<Document>> { + self.history.borrow().get(self.active_index.get()).map(|entry| { + Root::from_ref(&*entry.document) + }) + } + pub fn active_window(&self) -> Root<Window> { Root::from_ref(self.active_document().window()) } |