Auto merge of #13784 - TooManyBees:13363-check-script-enabled, r=Ms2ger

Issue 13363 - Step 1.2 of compiling event handler

<!-- Please describe your changes on the following line: -->
Adds the conditional to test that scripting is enabled in `EventTarget#get_compiled_event_handler`, and return `None` early if not.

Adds tests for "scripting enabled" and "scripting disabled" cases.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #13363 (github issue number if applicable).

<!-- Either: -->
- [x] There are tests for these changes

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/13784)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-10-21 09:24:05 -05:00 committed by GitHub
commit 776a1d9cac
3 changed files with 31 additions and 1 deletions

View file

@ -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();