mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Update web-platform-tests to revision 28300a0874230d668f0b02cfddfd994f2a735a56
This commit is contained in:
parent
087cf21d79
commit
aa8de380cc
133 changed files with 1747 additions and 432 deletions
|
@ -0,0 +1,13 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>iframe sandbox without allow_modals (alert)</title>
|
||||
<link rel="author" title="Igalia" href="https://www.igalia.com/">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#attr-iframe-sandbox">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#the-iframe-element">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<iframe sandbox="allow-scripts"></iframe>
|
||||
<script src="support/iframe_sandbox_block_modals.js"></script>
|
||||
<script>
|
||||
runTest("alert", undefined);
|
||||
</script>
|
|
@ -0,0 +1,13 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>iframe sandbox without allow_modals (confirm)</title>
|
||||
<link rel="author" title="Igalia" href="https://www.igalia.com/">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#attr-iframe-sandbox">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#the-iframe-element">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<iframe sandbox="allow-scripts"></iframe>
|
||||
<script src="support/iframe_sandbox_block_modals.js"></script>
|
||||
<script>
|
||||
runTest("confirm", false);
|
||||
</script>
|
|
@ -0,0 +1,13 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>iframe sandbox without allow_modals (prompt)</title>
|
||||
<link rel="author" title="Igalia" href="https://www.igalia.com/">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#attr-iframe-sandbox">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#the-iframe-element">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<iframe sandbox="allow-scripts"></iframe>
|
||||
<script src="support/iframe_sandbox_block_modals.js"></script>
|
||||
<script>
|
||||
runTest("prompt", null);
|
||||
</script>
|
|
@ -0,0 +1,13 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>iframe sandbox without allow_modals (print)</title>
|
||||
<link rel="author" title="Igalia" href="https://www.igalia.com/">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#attr-iframe-sandbox">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#the-iframe-element">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<iframe sandbox="allow-scripts"></iframe>
|
||||
<script src="support/iframe_sandbox_block_modals.js"></script>
|
||||
<script>
|
||||
runTest("print", undefined);
|
||||
</script>
|
|
@ -0,0 +1,23 @@
|
|||
<!DOCTYPE html>
|
||||
<script>
|
||||
function openModal(name) {
|
||||
switch (name) {
|
||||
case "alert":
|
||||
return alert("MESSAGE");
|
||||
break;
|
||||
case "confirm":
|
||||
return confirm("MESSAGE?");
|
||||
break;
|
||||
case "prompt":
|
||||
return prompt("MESSAGE:", "DEFAULT VALUE");
|
||||
break;
|
||||
case "print":
|
||||
return print();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
onmessage = function(e) {
|
||||
parent.postMessage(openModal(e.data), "*");
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,18 @@
|
|||
function runTest(modalName, expectedValue) {
|
||||
let timeOutForFailingToOpenModal = 500;
|
||||
let startTime;
|
||||
async_test(t => {
|
||||
let iframe = document.querySelector("iframe");
|
||||
iframe.onload = t.step_func(() => {
|
||||
window.addEventListener("message", t.step_func_done(e => {
|
||||
// This tests work by checking the call to open the modal diaglog will return immediately (or at least within timeOutForFailingToOpenModal).
|
||||
// If the modal dialog is not blocked, then it will wait for user input and the test will time out.
|
||||
assert_less_than(new Date().getTime() - startTime, timeOutForFailingToOpenModal, "Call to open modal dialog did not return immediately");
|
||||
assert_equals(e.data, expectedValue, "Call to open modal dialog did not return expected value");
|
||||
}));
|
||||
startTime = new Date().getTime();
|
||||
iframe.contentWindow.postMessage(modalName, "*");
|
||||
});
|
||||
iframe.src = "support/iframe-that-opens-modals.html";
|
||||
}, "Frames without `allow-modals` should not be able to open modal dialogs");
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue