Open Bug 1301625 Opened 8 years ago Updated 2 years ago

Fire img "error" and "loadend" event off a single task

Categories

(Core :: DOM: Core & HTML, defect, P3)

defect

Tracking

()

Tracking Status
firefox51 --- affected

People

(Reporter: edgar, Unassigned)

References

Details

+++ This bug was initially created as a follow-up of Bug #599975 comment #31 +++

We're not following the spec for the case when we _do_ fire both error and loadend events: we're firing them off separate runnables, but the spec says to fire them off a single task [1].

[1] See step 11.4. of
https://html.spec.whatwg.org/multipage/embedded-content.html#update-the-image-data
Priority: -- → P2
What do other browsers do here?  It seems in general we should be yielding the main thread more often, not less.
It's hard to black-box test this.  In particular, telling the difference between a single task that fires two event and two back-to-back tasks that fire one event each is only possible if you can get some other task queue to interleave between the two tasks in the latter case...  I don't think there's any other way to tell them apart.
The first event listener could do a postMessage to the current window and then onmessage would be called before the latter event, right?
(though, per spec those might go to different event queues)
> (though, per spec those might go to different event queues)

Indeed.  Different task queues is in fact the only way that the onmessage could happen before the second event; if these tasks and the postMessage tasks used the same task queue then the onmessage would always happen after the second event.
Priority: P2 → P3
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.