Tests: Import a WPT test that uses HTMLIFrameElement.sandbox.supports()

This commit is contained in:
Andreas Kling 2024-12-03 00:27:37 +01:00 committed by Andreas Kling
commit b1796ebd2c
Notes: github-actions[bot] 2024-12-03 14:31:11 +00:00
5 changed files with 61 additions and 0 deletions

View file

@ -44,9 +44,13 @@ Text/input/wpt-import/html/syntax/parsing/html5lib_tests19.html
Text/input/wpt-import/html/syntax/parsing/html5lib_tests5.html
Text/input/wpt-import/html/syntax/parsing/html5lib_webkit01.html
Text/input/wpt-import/html/syntax/parsing/named-character-references.html
; Support files (not tests themselves)
Text/input/wpt-import/html/syntax/parsing/support/no-doctype-name-eof.html
Text/input/wpt-import/html/syntax/parsing/support/no-doctype-name-line.html
Text/input/wpt-import/html/syntax/parsing/support/no-doctype-name-space.html
Text/input/wpt-import/html/semantics/embedded-content/the-iframe-element/support/sandbox_allow_script.html
Text/input/wpt-import/html/semantics/embedded-content/the-iframe-element/support/blank.htm
; Unknown, imported as skipped in #2148
Text/input/wpt-import/html/infrastructure/safe-passing-of-structured-data/structuredclone_0.html

View file

@ -0,0 +1,7 @@
Harness status: OK
Found 2 tests
2 Fail
Fail iframe 'sandbox' ASCII case insensitive, allow-same-orİgin
Fail iframe 'sandbox' ASCII case insensitive, allow-ſcripts

View file

@ -0,0 +1,41 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>iframe 'sandbox' ASCII case insensitive</title>
<link rel="help" href="https://html.spec.whatwg.org/multipage/#attr-iframe-sandbox">
<script src="../../../../resources/testharness.js"></script>
<script src="../../../../resources/testharnessreport.js"></script>
<body>
<script>
async_test(function(t) {
let iframe = document.createElement('iframe');
iframe.setAttribute('sandbox', 'allow-same-or\u0130gin');
iframe.setAttribute('hidden', '');
assert_true(iframe.sandbox.supports('allow-same-origin'), 'supports the allow-same-origin token');
iframe.src = 'support/blank.htm';
iframe.onload = t.step_func_done(function() {
try {
assert_equals(iframe.contentDocument, null, 'child document not reachable');
} catch (e) {
// The assert_equals throwing is a pass.
}
});
document.body.appendChild(iframe);
}, document.title + ', allow-same-or\u0130gin');
async_test(function(t) {
let iframe = document.createElement('iframe');
iframe.setAttribute('sandbox', 'allow-\u017Fcripts');
iframe.setAttribute('hidden', '');
assert_true(iframe.sandbox.supports('allow-scripts'), 'supports the allow-scripts token');
window.onmessage = t.unreached_func('no scripts should run in the iframe');
iframe.src = 'support/sandbox_allow_script.html';
iframe.onload = t.step_func(function() {
t.step_timeout(t.step_func_done(), 100);
});
document.body.appendChild(iframe);
}, document.title + ', allow-\u017Fcripts');
</script>

View file

@ -0,0 +1,8 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>HTML Test: sandbox_allow_scripts</title>
<link rel="author" title="Intel" href="http://www.intel.com/">
<div id="test">Before change</div>
<script>
parent.window.postMessage("Script executed", "*");
</script>