aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/document.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/dom/document.rs')
-rw-r--r--components/script/dom/document.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs
index 5e29dd60e46..b50d88e96ce 100644
--- a/components/script/dom/document.rs
+++ b/components/script/dom/document.rs
@@ -185,6 +185,7 @@ pub trait DocumentHelpers<'a> {
fn window(self) -> Temporary<Window>;
fn encoding_name(self) -> Ref<'a, DOMString>;
fn is_html_document(self) -> bool;
+ fn is_fully_active(self) -> bool;
fn url(self) -> Url;
fn quirks_mode(self) -> QuirksMode;
fn set_quirks_mode(self, mode: QuirksMode);
@@ -224,6 +225,21 @@ impl<'a> DocumentHelpers<'a> for JSRef<'a, Document> {
self.is_html_document
}
+ // https://html.spec.whatwg.org/multipage/browsers.html#fully-active
+ fn is_fully_active(self) -> bool {
+ let window = self.window.root();
+ let window = window.r();
+ let browser_context = window.browser_context();
+ let browser_context = browser_context.as_ref().unwrap();
+ let active_document = browser_context.active_document().root();
+
+ if self.clone() != active_document.r() {
+ return false;
+ }
+ // FIXME: It should also check whether the browser context is top-level or not
+ true
+ }
+
// http://dom.spec.whatwg.org/#dom-document-url
fn url(self) -> Url {
self.url.clone()