mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Auto merge of #16238 - gterzian:implement_update_the_image_data, r=jdm
Implement "update the image data" <!-- Please describe your changes on the following line: --> Spec compliant implementation of the [update the image data algorithm](https://html.spec.whatwg.org/multipage/embedded-content.html#update-the-image-data). Currently still a work in progress, the ['async src complete test`](https://github.com/servo/servo/blob/master/tests/wpt/web-platform-tests/html/semantics/embedded-content/the-img-element/img.complete.html#L33) is still passing as it was before, even though I switched to the new code, so I guess that's something. @jdm I will be picking this up next weekend, I left a bunch of TODO and NOTES in the code, if you or someone else have time this week I would appreciate an initial scan and feedback. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [ ] `./mach build -d` does not report any errors - [ ] `./mach test-tidy` does not report any errors - [ ] These changes fix #11517 (github issue number if applicable). <!-- Either: --> - [x] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- 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. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/16238) <!-- Reviewable:end -->
This commit is contained in:
commit
fe7d039416
6 changed files with 401 additions and 118 deletions
|
@ -571006,7 +571006,7 @@
|
|||
"support"
|
||||
],
|
||||
"html/semantics/embedded-content/the-img-element/img.complete.html": [
|
||||
"723ded8aca956dc1f3cbc60feb0e502c2b943d1d",
|
||||
"be6ea10ac070420948bcef0372c283f275a6b00f",
|
||||
"testharness"
|
||||
],
|
||||
"html/semantics/embedded-content/the-img-element/invalid-src.html": [
|
||||
|
|
|
@ -1,14 +1,5 @@
|
|||
[img.complete.html]
|
||||
type: testharness
|
||||
[img src omitted]
|
||||
expected: FAIL
|
||||
|
||||
[img src empty]
|
||||
expected: FAIL
|
||||
|
||||
[IDL attribute complete returns true when image resource has been fetched but not run yet & image is not in broken state]
|
||||
expected: FAIL
|
||||
|
||||
[async src broken test]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
[update-src-complete.html]
|
||||
type: testharness
|
||||
[Changing the img src should retain the 'complete' property]
|
||||
expected: FAIL
|
||||
|
|
@ -33,16 +33,22 @@
|
|||
var t = async_test("async src complete test");
|
||||
|
||||
t.step(function(){
|
||||
document.getElementById("imgTestTag3").src = '3.jpg?nocache=' + Math.random();
|
||||
var loaded = false;
|
||||
document.getElementById("imgTestTag3").onload = t.step_func_done(function(){
|
||||
assert_false(loaded);
|
||||
loaded = true;
|
||||
assert_true(document.getElementById("imgTestTag3").complete);
|
||||
var currentSrc = document.getElementById("imgTestTag3").currentSrc
|
||||
assert_equals(new URL(window.location.origin + "/" + currentSrc).pathname, "/3.jpg");
|
||||
}, "Only one onload, despite setting the src twice");
|
||||
|
||||
document.getElementById("imgTestTag3").src = 'test' + Math.random();
|
||||
//test if img.complete is set to false if src is changed
|
||||
assert_false(document.getElementById("imgTestTag3").complete, "src changed, should be set to false")
|
||||
//change src again, should make only one request as per 'await stable state'
|
||||
document.getElementById("imgTestTag3").src = '3.jpg?nocache=' + Math.random();
|
||||
});
|
||||
|
||||
document.getElementById("imgTestTag3").onload = t.step_func(function(){
|
||||
assert_true(document.getElementById("imgTestTag3").complete);
|
||||
t.done();
|
||||
});
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/multipage/embedded-content-1.html#update-the-image-data
|
||||
// says to "await a stable state" before fetching so we use a separate <script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue