diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2016-06-09 11:33:17 -0500 |
---|---|---|
committer | bors-servo <lbergstrom+bors@mozilla.com> | 2016-06-09 11:33:17 -0500 |
commit | 0ac1ff066107def0781d18e1d76856380a349bef (patch) | |
tree | c2ff23aba2bbd40c0d728bfcdb194d77196ed2a1 /components/script/dom | |
parent | ca58ff607eba8e1ae538b9591f64a6d5c6b75ab8 (diff) | |
parent | 7455dc4a500d96d7d4421682cd2e2929d2cd87a9 (diff) | |
download | servo-0ac1ff066107def0781d18e1d76856380a349bef.tar.gz servo-0ac1ff066107def0781d18e1d76856380a349bef.zip |
Auto merge of #11684 - servo:fix-failsafe, r=jdm
Avoid an index-out-of-bounds error in ScriptMemoryFailsafe.
<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11684)
<!-- Reviewable:end -->
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()) } |