mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +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
|
@ -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