Access browsing context without panic

Current browsing context accessor in Document unwrap the browsing context option which prevents document to handle correctly the case when there is no browsing context.
This commit is contained in:
Mariot Chauvin 2017-03-10 10:27:58 +00:00
parent 1794c6673a
commit f8c7235f73
2 changed files with 8 additions and 3 deletions

View file

@ -390,7 +390,7 @@ impl Document {
#[inline]
pub fn browsing_context(&self) -> Option<Root<BrowsingContext>> {
if self.has_browsing_context {
Some(self.window.browsing_context())
self.window.maybe_browsing_context()
} else {
None
}