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.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs
index ffa22a48182..4b74d6e20f6 100644
--- a/components/script/dom/document.rs
+++ b/components/script/dom/document.rs
@@ -121,6 +121,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 {
@@ -206,6 +209,7 @@ pub trait DocumentHelpers<'a> {
fn get_nodes_under_mouse(self, point: &Point2D<f32>) -> Vec<UntrustedNodeAddress>;
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);
@@ -430,6 +434,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>> {
@@ -737,6 +746,7 @@ impl Document {
possibly_focused: Default::default(),
focused: Default::default(),
current_script: Default::default(),
+ scripting_enabled: Cell::new(true),
}
}