diff options
author | Prabhjyot Singh Sodhi <prabhjyotsingh95@gmail.com> | 2015-02-23 00:46:09 +0530 |
---|---|---|
committer | Prabhjyot Singh Sodhi <prabhjyotsingh95@gmail.com> | 2015-03-06 03:16:59 +0530 |
commit | 64ba4a914ed838fd3a556f07bd287fa92e5767a3 (patch) | |
tree | 59833ac9c543665756e42356493b066fd42891d9 /components/script/dom/document.rs | |
parent | 65454e51c806c7d91c869a7b4afce872b4eeea57 (diff) | |
download | servo-64ba4a914ed838fd3a556f07bd287fa92e5767a3.tar.gz servo-64ba4a914ed838fd3a556f07bd287fa92e5767a3.zip |
implement missing steps from "prepare a script" algorithm
Fixes #4089
Diffstat (limited to 'components/script/dom/document.rs')
-rw-r--r-- | components/script/dom/document.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index 6e5413ebdc8..9abb356345e 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -120,6 +120,9 @@ pub struct Document { focused: MutNullableJS<Element>, /// The script element that is currently executing. current_script: MutNullableJS<HTMLScriptElement>, + /// https://html.spec.whatwg.org/multipage/webappapis.html#concept-n-noscript + /// True if scripting is enabled for all scripts in this document + scripting_enabled: Cell<bool>, } impl DocumentDerived for EventTarget { @@ -203,6 +206,7 @@ pub trait DocumentHelpers<'a> { fn find_fragment_node(self, fragid: DOMString) -> Option<Temporary<Element>>; fn set_ready_state(self, state: DocumentReadyState); fn get_focused_element(self) -> Option<Temporary<Element>>; + fn is_scripting_enabled(self) -> bool; fn begin_focus_transaction(self); fn request_focus(self, elem: JSRef<Element>); fn commit_focus_transaction(self); @@ -389,6 +393,11 @@ impl<'a> DocumentHelpers<'a> for JSRef<'a, Document> { let _ = event.r().fire(target); } + /// Return whether scripting is enabled or not + fn is_scripting_enabled(self) -> bool { + self.scripting_enabled.get() + } + /// Return the element that currently has focus. // https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#events-focusevent-doc-focus fn get_focused_element(self) -> Option<Temporary<Element>> { @@ -710,6 +719,7 @@ impl Document { possibly_focused: Default::default(), focused: Default::default(), current_script: Default::default(), + scripting_enabled: Cell::new(true), } } |