diff --git a/components/script/dom/eventtarget.rs b/components/script/dom/eventtarget.rs index 6d6ea81c7b6..a17bac4a35c 100644 --- a/components/script/dom/eventtarget.rs +++ b/components/script/dom/eventtarget.rs @@ -373,7 +373,10 @@ impl EventTarget { None => self.downcast::().unwrap().Document(), }; - // TODO step 1.2 (browsing context/scripting enabled) + // Step 1.2 + if !document.is_scripting_enabled() { + return None; + } // Step 1.3 let body: Vec = handler.source.encode_utf16().collect(); diff --git a/tests/wpt/metadata/MANIFEST.json b/tests/wpt/metadata/MANIFEST.json index 59e1863b1ac..a5720317386 100644 --- a/tests/wpt/metadata/MANIFEST.json +++ b/tests/wpt/metadata/MANIFEST.json @@ -37762,6 +37762,12 @@ "path": "html/semantics/forms/the-select-element/common-HTMLOptionsCollection-add.html", "url": "/html/semantics/forms/the-select-element/common-HTMLOptionsCollection-add.html" } + ], + "html/webappapis/scripting/events/uncompiled_event_handler_with_scripting_disabled.html": [ + { + "path": "html/webappapis/scripting/events/uncompiled_event_handler_with_scripting_disabled.html", + "url": "/html/webappapis/scripting/events/uncompiled_event_handler_with_scripting_disabled.html" + } ] } }, diff --git a/tests/wpt/web-platform-tests/html/webappapis/scripting/events/uncompiled_event_handler_with_scripting_disabled.html b/tests/wpt/web-platform-tests/html/webappapis/scripting/events/uncompiled_event_handler_with_scripting_disabled.html new file mode 100644 index 00000000000..a912b32d7fe --- /dev/null +++ b/tests/wpt/web-platform-tests/html/webappapis/scripting/events/uncompiled_event_handler_with_scripting_disabled.html @@ -0,0 +1,21 @@ + + +Uncompiled event handler check that scripting is enabled + + +