mirror of
https://github.com/servo/servo.git
synced 2025-08-15 18:35:33 +01:00
improve spec compliance of update the image data
This commit is contained in:
parent
f05491166f
commit
71b0c10164
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