diff options
author | Jesse Kipp <esbe.v2@gmail.com> | 2016-10-16 00:18:41 -0400 |
---|---|---|
committer | Jesse Kipp <esbe.v2@gmail.com> | 2016-10-20 11:08:44 -0400 |
commit | 4f0ffbd1f6908818e06538797b30f86ffef13602 (patch) | |
tree | f77a65f340e66ead0d89c48ee167749153b9c60f /components/script/dom/eventtarget.rs | |
parent | 759185abe05c31c2851d9ac586ddc2d065aa755f (diff) | |
download | servo-4f0ffbd1f6908818e06538797b30f86ffef13602.tar.gz servo-4f0ffbd1f6908818e06538797b30f86ffef13602.zip |
Issue 13363 - Step 1.2 of compiling event handler
When compiling event handlers, check whether scripting is enabled
and early return None/null if not.
https://html.spec.whatwg.org/multipage/
webappapis.html#getting-the-current-value-of-the-event-handler
Issue 13363 - Fix spec for disabled scripting
The original spec for this PR was bad because it depended on the
DOM without scripting enabled to use Javascript to signal the test's
failure, so it could never fail.
Use an onerror handler on `window` where scripting is enabled, and
use an invalid string of JavaScript for the handler, to detect
whether or not the event handler is *really* being compiled or not.
Condense tests into a single HTML file
Yup, didn't even realize I could do that at the time.
Remove an unnecessary test
Diffstat (limited to 'components/script/dom/eventtarget.rs')
-rw-r--r-- | components/script/dom/eventtarget.rs | 5 |
1 files changed, 4 insertions, 1 deletions
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::<Window>().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<u16> = handler.source.encode_utf16().collect(); |