mirror of
https://github.com/servo/servo.git
synced 2025-08-17 11:25:35 +01:00
Update web-platform-tests to revision 9a5d71b326166e12784bdd9d161772e20f87c1fd
This commit is contained in:
parent
f7630dad87
commit
4ae3d09ff3
86 changed files with 2739 additions and 640 deletions
43
tests/wpt/web-platform-tests/xhr/open-after-stop.window.js
Normal file
43
tests/wpt/web-platform-tests/xhr/open-after-stop.window.js
Normal file
|
@ -0,0 +1,43 @@
|
|||
// window.stop() below prevents the load event from firing, so wait until it is
|
||||
// fired to start the test.
|
||||
setup({explicit_done: true });
|
||||
|
||||
onload = () => {
|
||||
async_test(function(t) {
|
||||
const client = new XMLHttpRequest();
|
||||
|
||||
const result = [];
|
||||
const expected = [
|
||||
'readystatechange', 0, 1, // open()
|
||||
];
|
||||
|
||||
let state = 0;
|
||||
|
||||
client.onreadystatechange = t.step_func(() => {
|
||||
result.push('readystatechange', state, client.readyState);
|
||||
});
|
||||
client.onabort = t.unreached_func("abort should not be fired after window.stop() and open()");
|
||||
client.onloadend = t.unreached_func("loadend should not be fired after window.stop() and open()");
|
||||
|
||||
client.open("GET", "resources/well-formed.xml");
|
||||
assert_equals(client.readyState, 1);
|
||||
|
||||
state = 1;
|
||||
client.send(null);
|
||||
state = 2;
|
||||
window.stop();
|
||||
// Unlike client.abort(), window.stop() does not change readyState
|
||||
// immediately, rather through a task...
|
||||
assert_equals(client.readyState, 1);
|
||||
state = 3;
|
||||
// ... which is then canceled when we open a new request anyway.
|
||||
client.open("GET", "resources/well-formed.xml");
|
||||
assert_equals(client.readyState, 1);
|
||||
assert_array_equals(result, expected);
|
||||
|
||||
// Give the abort and loadend events a chance to fire (erroneously) before
|
||||
// calling this a success.
|
||||
t.step_timeout(t.step_func_done(), 1000);
|
||||
}, "open() after window.stop()");
|
||||
done();
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue