mirror of
https://github.com/servo/servo.git
synced 2025-08-07 14:35:33 +01:00
Update web-platform-tests to revision 132d12daea699ce266324e79eecbe59b10e56502
This commit is contained in:
parent
527d874bc1
commit
fe00a63040
1004 changed files with 18598 additions and 92770 deletions
|
@ -0,0 +1,22 @@
|
|||
<!doctype html>
|
||||
<title>beforeunload and unload events fire after window.close() in script-closeable browsing context</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
beforeunload_fired = false;
|
||||
var t = async_test();
|
||||
|
||||
onload = t.step_func(function() {
|
||||
window.close();
|
||||
});
|
||||
|
||||
onbeforeunload = t.step_func(function() {
|
||||
beforeunload_fired = true;
|
||||
});
|
||||
|
||||
onunload = t.step_func(function() {
|
||||
assert_true(beforeunload_fired);
|
||||
t.done()
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,10 @@
|
|||
<!doctype html>
|
||||
script-uncloseable-1
|
||||
<script>
|
||||
onbeforeunload = function() {
|
||||
parent.beforeunload_fired = true;
|
||||
};
|
||||
onunload = function() {
|
||||
parent.unload_fired = true;
|
||||
};
|
||||
</script>
|
|
@ -0,0 +1,24 @@
|
|||
<!doctype html>
|
||||
<title>beforeunload and unload events do not fire after window.close() in script-uncloseable browsing context</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
var beforeunload_fired = false;
|
||||
var unload_fired = false;
|
||||
var t = async_test();
|
||||
|
||||
onload = t.step_func(function() {
|
||||
var iframe = document.getElementsByTagName("iframe")[0]
|
||||
iframe.onload = t.step_func(function() {
|
||||
iframe.contentWindow.close()
|
||||
t.step_timeout(function() {
|
||||
assert_false(beforeunload_fired);
|
||||
assert_false(unload_fired);
|
||||
t.done();
|
||||
}, 1000);
|
||||
});
|
||||
iframe.src = "prompt-and-unload-script-uncloseable-1.html";
|
||||
});
|
||||
</script>
|
||||
<iframe></iframe>
|
|
@ -0,0 +1,28 @@
|
|||
<!doctype html>
|
||||
004-1
|
||||
<script>
|
||||
var handleBeforeUnload = function() {
|
||||
parent.beforeunload_fired = true;
|
||||
removeListener();
|
||||
setTimeout(function() {
|
||||
parent.timeout_fired = true;
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
var removeListener = function() {
|
||||
assert_true(window.removeEventListener('beforeunload', handleBeforeUnload, false));
|
||||
}
|
||||
|
||||
window.addEventListener('beforeunload', handleBeforeUnload, false);
|
||||
|
||||
onload = function() {
|
||||
if (!parent.loaded) {
|
||||
parent.loaded = true;
|
||||
location="004-2.html?" + Math.random();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
// child frame with no onbeforeunload listener. Should leave the parent as unsalvageable.
|
||||
// Adding the iframe prevents potential implementation bugs where the the recursive steps of #prompt-to-unload-a-document
|
||||
// would overwrite the salvageable state of the parent.
|
||||
<iframe></iframe>
|
|
@ -0,0 +1,5 @@
|
|||
<!doctype html>
|
||||
004-2
|
||||
<script>
|
||||
onload = function() {setTimeout(parent.t.step_func(function() {parent.start_test(); history.go(-1)}), 100)}
|
||||
</script>
|
|
@ -0,0 +1,29 @@
|
|||
<!doctype html>
|
||||
<title>salvagable state of document after setting beforeunload listener</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
var t = async_test();
|
||||
|
||||
var loaded = false;
|
||||
var beforeunload_fired = false;
|
||||
var timeout_fired = false;
|
||||
|
||||
function start_test() {
|
||||
step_timeout(
|
||||
t.step_func(function() {
|
||||
assert_true(beforeunload_fired);
|
||||
assert_false(timeout_fired);
|
||||
t.done()
|
||||
}), 1000);
|
||||
}
|
||||
|
||||
onload = function() {
|
||||
var iframe = document.getElementsByTagName("iframe")[0]
|
||||
onload = null;
|
||||
iframe.src="004-1.html?" + Math.random();
|
||||
};
|
||||
|
||||
</script>
|
||||
<iframe></iframe>
|
Loading…
Add table
Add a link
Reference in a new issue