aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/document.rs
diff options
context:
space:
mode:
authorKosov Eugene <claprix@yandex.ru>2016-06-04 23:42:43 +0300
committerKosov Eugene <claprix@yandex.ru>2016-06-08 23:10:20 +0300
commit3bb093cc16875c6fcfe5e7de9c9f6760ff9e18fc (patch)
tree849084e169234cfdc0d40ce79c36dfdb12582b1d /components/script/dom/document.rs
parenta80767993b6b2b885dfac9666f16fb1e1649ac99 (diff)
downloadservo-3bb093cc16875c6fcfe5e7de9c9f6760ff9e18fc.tar.gz
servo-3bb093cc16875c6fcfe5e7de9c9f6760ff9e18fc.zip
Make Document::DefaultView return a null value when there's no browsing context
Diffstat (limited to 'components/script/dom/document.rs')
-rw-r--r--components/script/dom/document.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs
index 2a7466dc2eb..c142945d131 100644
--- a/components/script/dom/document.rs
+++ b/components/script/dom/document.rs
@@ -2551,8 +2551,12 @@ impl DocumentMethods for Document {
}
// https://html.spec.whatwg.org/multipage/#dom-document-defaultview
- fn DefaultView(&self) -> Root<Window> {
- Root::from_ref(&*self.window)
+ fn GetDefaultView(&self) -> Option<Root<Window>> {
+ if self.browsing_context.is_none() {
+ None
+ } else {
+ Some(Root::from_ref(&*self.window))
+ }
}
// https://html.spec.whatwg.org/multipage/#dom-document-cookie