Add microtask checkpoints on </script> and CE construct

This commit is contained in:
Patrick Shaughnessy 2020-01-13 18:32:16 -05:00
parent 2373769e76
commit c725f9e84d
6 changed files with 37 additions and 31 deletions

View file

@ -823,6 +823,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(
@ -840,11 +842,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(),
);
@ -861,6 +858,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?
@ -874,11 +873,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(),
);