-
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
img.complete behavior is wrong when a new load is started for the same image #4884
Comments
Once this is fixed, the comment in the img.complete.html WPT referencing this issue should be removed. |
Checking pending request seems not help here, nor does #4476, given that the steps after step 7 of update-image-data is async per spec? Current Gecko returns Another interesting example,
Gecko returns |
At least in Chrome, It would make some sense to return false for |
This comment has been minimized.
This comment has been minimized.
That claims to be resolved by #4934 but this issue is still unresolved, as far as I can tell. See #4934 (comment) |
I think I see now, the problem is that https://html.spec.whatwg.org/#update-the-image-data does not update any state on the image element synchronously when an asynchronous fetch is to be performed and therefore I think this is related to some other problems with the |
…iewers,devtools-reviewers,robwu,nchevobbe This fixes src loads to be consistent with srcset/picture loads, modulo the special synchronous case in the spec (https://html.spec.whatwg.org/#update-the-image-data step 7), which requires src loads to be sync if the image is available. We now avoid triggering the load from the parser consistently for src / srcset / picture, and unify the codepath with BindToTree. That should avoid some useless task allocations. Only the sync load code-path needs a script runner (mostly to deal with anonymous content like the video poster <img> and such, but it also helps not trigger sync loads at unexpected times like on adoption). About the HTMLImageElement::Complete() getter change, we need to also return false if there's an existing load task. That is the proposal in whatwg/html#4884, and prevents some failures in the-img-element/{update-src-complete,img.complete}.html WPTs. It technically changes our behavior on .srcset changes, but it makes it consistent with .src changes and other browsers, so seems fine. There are a couple regressions in CSP tests and the networkEvent stubs, but these are really a pre-existing issue. What happens is that, since the loads are now async, CSP can't figure out the script that triggered the load anymore. I need to look if there's an easy way to propagate that information in the image load tasks, but this is trivially reproducible by changing these tests to use srcset rather than src. The rest of the test changes are as expected: either new passes, or expected test changes from this. Differential Revision: https://phabricator.services.mozilla.com/D215519
…iewers,devtools-reviewers,robwu,nchevobbe This fixes src loads to be consistent with srcset/picture loads, modulo the special synchronous case in the spec (https://html.spec.whatwg.org/#update-the-image-data step 7), which requires src loads to be sync if the image is available. We now avoid triggering the load from the parser consistently for src / srcset / picture, and unify the codepath with BindToTree. That should avoid some useless task allocations. Only the sync load code-path needs a script runner (mostly to deal with anonymous content like the video poster <img> and such, but it also helps not trigger sync loads at unexpected times like on adoption). About the HTMLImageElement::Complete() getter change, we need to also return false if there's an existing load task. That is the proposal in whatwg/html#4884, and prevents some failures in the-img-element/{update-src-complete,img.complete}.html WPTs. It technically changes our behavior on .srcset changes, but it makes it consistent with .src changes and other browsers, so seems fine. There are a couple regressions in CSP tests and the networkEvent stubs, but these are really a pre-existing issue. What happens is that, since the loads are now async, CSP can't figure out the script that triggered the load anymore. I need to look if there's an easy way to propagate that information in the image load tasks, but this is trivially reproducible by changing these tests to use srcset rather than src. The rest of the test changes are as expected: either new passes, or expected test changes from this. Differential Revision: https://phabricator.services.mozilla.com/D215519
…iewers,devtools-reviewers,robwu,nchevobbe This fixes src loads to be consistent with srcset/picture loads, modulo the special synchronous case in the spec (https://html.spec.whatwg.org/#update-the-image-data step 7), which requires src loads to be sync if the image is available. We now avoid triggering the load from the parser consistently for src / srcset / picture, and unify the codepath with BindToTree. That should avoid some useless task allocations. Only the sync load code-path needs a script runner (mostly to deal with anonymous content like the video poster <img> and such, but it also helps not trigger sync loads at unexpected times like on adoption). About the HTMLImageElement::Complete() getter change, we need to also return false if there's an existing load task. That is the proposal in whatwg/html#4884, and prevents some failures in the-img-element/{update-src-complete,img.complete}.html WPTs. It technically changes our behavior on .srcset changes, but it makes it consistent with .src changes and other browsers, so seems fine. There are a couple regressions in CSP tests and the networkEvent stubs, but these are really a pre-existing issue. What happens is that, since the loads are now async, CSP can't figure out the script that triggered the load anymore. I need to look if there's an easy way to propagate that information in the image load tasks, but this is trivially reproducible by changing these tests to use srcset rather than src. The rest of the test changes are as expected: either new passes, or expected test changes from this. Differential Revision: https://phabricator.services.mozilla.com/D215519
Consider this testcase:
Per spec at https://html.spec.whatwg.org/multipage/embedded-content.html#dom-img-complete this should alert true because:
Presumably
complete
should returns false if there is a pending request or something? It consistently returns false in browsers on the above testcase.@EdgarChen @annevk @domenic
The text was updated successfully, but these errors were encountered: