Auto merge of #25515 - pshaughn:checkpoints, r=jdm

Add microtask checkpoints to script elements and custom elements

Servo had a microtask checkpoint at the end of running a script, but there was also supposed to be one at the end of HTML-parsing a script element before Javascript-parsing the script itself, and there were supposed to be checkpoints immediately after the call to a custom element constructor. This adds those, passing all cases of one WPT test file.

---
<!-- 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 #25016 except for the remaining not-really-about-microtasks case #25514

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

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
This commit is contained in:
bors-servo 2020-01-25 07:30:48 -05:00 committed by GitHub
commit 53879945a9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 37 additions and 31 deletions

View file

@ -826,6 +826,8 @@ impl HTMLImageElement {
// Step 8
Some(data) => data,
None => {
self.abort_request(State::Broken, ImageRequestPhase::Current);
self.abort_request(State::Broken, ImageRequestPhase::Pending);
// Step 9.
// FIXME(nox): Why are errors silenced here?
let _ = task_source.queue(
@ -843,11 +845,6 @@ impl HTMLImageElement {
if src_present || Self::uses_srcset_or_picture(elem) {
this.upcast::<EventTarget>().fire_event(atom!("error"));
}
// FIXME(nox): According to the spec, setting the current
// request to the broken state is done prior to queuing a
// task, why is this here?
this.abort_request(State::Broken, ImageRequestPhase::Current);
this.abort_request(State::Broken, ImageRequestPhase::Pending);
}),
window.upcast(),
);
@ -864,6 +861,8 @@ impl HTMLImageElement {
self.prepare_image_request(&url, &src, pixel_density);
},
Err(_) => {
self.abort_request(State::Broken, ImageRequestPhase::Current);
self.abort_request(State::Broken, ImageRequestPhase::Pending);
// Step 12.1-12.5.
let src = src.0;
// FIXME(nox): Why are errors silenced here?
@ -877,11 +876,6 @@ impl HTMLImageElement {
}
this.upcast::<EventTarget>().fire_event(atom!("error"));
// FIXME(nox): According to the spec, setting the current
// request to the broken state is done prior to queuing a
// task, why is this here?
this.abort_request(State::Broken, ImageRequestPhase::Current);
this.abort_request(State::Broken, ImageRequestPhase::Pending);
}),
window.upcast(),
);