-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Chrome/Edge clears pending error event if img.src changed before it fired #1872
Comments
@zcorpan is our expert here, and I think is on vacation for a week. But are you sure this behavior isn't documented by the spec? It might not happen by "clearing" the error event, but by the queued task checking that the error condition is still present before it fires. There are several places that fire error events, so I might not have this particular scenario right, but at a quick skim, "If the resource type and data corresponds to a supported image format, as described below" might be the section you're talking about, and it specifically says "and image request is pending request" before firing the error event (so it won't be fired if the src has been changed, from what I understand). |
The error event of my example is from step 9:
If we set src to empty string, spec says "Queue a task to fire a simple event named error". |
Stepping carefully though the spec for this testcase:
Note also that the spec's task will munge the current request's current URL, even if a new update has started and there is a new, totally valid, current request. So yes, the spec seems kinda broken here. |
And yes, I think the right fix is for the task queued in https://html.spec.whatwg.org/multipage/embedded-content.html#update-the-image-data step 9.2 to check the "If another instance of this algorithm for this img element was started after this instance" thing.... |
And maybe other steps like 11.4, 5.3.7, and maybe parts of step 14. Step 14 is hard to test reliably, but the other two are trivial to test using a testcase like the one above. Should check what various UAs do currently. |
Chrome/Edge seems clear pending error event if img.src changed before it fired.
Example 1:
Result of Chrome and Edge:
Image2's error event isn't fired.
Example 2:
Result of Chrome and Edge:
Image2's error event is only fired once.
This behavior (clear pending error event) isn't documented in the spec. But some sites seems rely on this behavior, e.g. https://www.bing.com/mapspreview [1]. Does this behavior is what we expect?
[1] Please also see https://bugzilla.mozilla.org/show_bug.cgi?id=1308069
The text was updated successfully, but these errors were encountered: