Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix encoding name ; factor out common code into a separate support file.
- Loading branch information
Showing
5 changed files
with
29 additions
and
76 deletions.
There are no files selected for viewing
22 changes: 3 additions & 19 deletions
22
html/semantics/embedded-content/the-iframe-element/iframe_sandbox_block_modals-1.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,13 @@ | ||
<!DOCTYPE html> | ||
<meta charset="uft-8"> | ||
<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> | ||
let modalName = "alert"; | ||
let expectedValue = undefined; | ||
|
||
let timeOutForFailingToOpenModal = 500; | ||
let startTime; | ||
async_test(t => { | ||
let iframe = document.querySelector("iframe"); | ||
iframe.onload = function() { | ||
window.addEventListener("message", t.step_func_done(e => { | ||
e.source.close(); | ||
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"); | ||
runTest("alert", undefined); | ||
</script> |
22 changes: 3 additions & 19 deletions
22
html/semantics/embedded-content/the-iframe-element/iframe_sandbox_block_modals-2.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,13 @@ | ||
<!DOCTYPE html> | ||
<meta charset="uft-8"> | ||
<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> | ||
let modalName = "confirm"; | ||
let expectedValue = false; | ||
|
||
let timeOutForFailingToOpenModal = 500; | ||
let startTime; | ||
async_test(t => { | ||
let iframe = document.querySelector("iframe"); | ||
iframe.onload = function() { | ||
window.addEventListener("message", t.step_func_done(e => { | ||
e.source.close(); | ||
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"); | ||
runTest("confirm", false); | ||
</script> |
22 changes: 3 additions & 19 deletions
22
html/semantics/embedded-content/the-iframe-element/iframe_sandbox_block_modals-3.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,13 @@ | ||
<!DOCTYPE html> | ||
<meta charset="uft-8"> | ||
<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> | ||
let modalName = "prompt"; | ||
let expectedValue = null; | ||
|
||
let timeOutForFailingToOpenModal = 500; | ||
let startTime; | ||
async_test(t => { | ||
let iframe = document.querySelector("iframe"); | ||
iframe.onload = function() { | ||
window.addEventListener("message", t.step_func_done(e => { | ||
e.source.close(); | ||
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"); | ||
runTest("prompt", null); | ||
</script> |
22 changes: 3 additions & 19 deletions
22
html/semantics/embedded-content/the-iframe-element/iframe_sandbox_block_modals-4.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,13 @@ | ||
<!DOCTYPE html> | ||
<meta charset="uft-8"> | ||
<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> | ||
let modalName = "print"; | ||
let expectedValue = undefined; | ||
|
||
let timeOutForFailingToOpenModal = 500; | ||
let startTime; | ||
async_test(t => { | ||
let iframe = document.querySelector("iframe"); | ||
iframe.onload = function() { | ||
window.addEventListener("message", t.step_func_done(e => { | ||
e.source.close(); | ||
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"); | ||
runTest("print", undefined); | ||
</script> |
17 changes: 17 additions & 0 deletions
17
html/semantics/embedded-content/the-iframe-element/support/iframe_sandbox_block_modals.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
function runTest(modalName, expectedValue) { | ||
let timeOutForFailingToOpenModal = 500; | ||
let startTime; | ||
async_test(t => { | ||
let iframe = document.querySelector("iframe"); | ||
iframe.onload = function() { | ||
window.addEventListener("message", t.step_func_done(e => { | ||
e.source.close(); | ||
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"); | ||
} |