Update web-platform-tests to revision 28300a0874230d668f0b02cfddfd994f2a735a56

This commit is contained in:
WPT Sync Bot 2018-03-12 21:18:12 -04:00
parent 087cf21d79
commit aa8de380cc
133 changed files with 1747 additions and 432 deletions

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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");
}