-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1950626 Fix mistakes in Element-setAttribute-respects-Elements-no…
…de-documents-globals-CSP-after-adoption-from-non-TT-realm.html. r=smaug See web-platform-tests/wpt#44323 (comment) Also add a more direct test for the TypeError realm. Differential Revision: https://phabricator.services.mozilla.com/D239894
- Loading branch information
Showing
3 changed files
with
58 additions
and
25 deletions.
There are no files selected for viewing
12 changes: 0 additions & 12 deletions
12
...te-respects-Elements-node-documents-globals-CSP-after-adoption-from-non-TT-realm.html.ini
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,13 +1 @@ | ||
# Bug 1950626: frame contentWindow's TypeError expected instead of window's one. | ||
[Element-setAttribute-respects-Elements-node-documents-globals-CSP-after-adoption-from-non-TT-realm.html] | ||
[setAttribute and setAttributeNode respect the element's node document's global's CSP;\n Element=iframe; Parent=div; Attribute=srcdoc] | ||
expected: FAIL | ||
[setAttribute and setAttributeNode respect the element's node document's global's CSP;\n Element=script; Parent=div; Attribute=src] | ||
expected: FAIL | ||
|
||
[setAttribute and setAttributeNode respect the element's node document's global's CSP;\n Element=script; Parent=svg; Attribute=href] | ||
expected: FAIL | ||
[setAttribute and setAttributeNode respect the element's node document's global's CSP;\n Element=script; Parent=svg; Attribute=xlink:href] | ||
expected: FAIL |
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
26 changes: 26 additions & 0 deletions
26
...trusted-types/require-trusted-types-for-TypeError-belongs-to-the-global-object-realm.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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<!DOCTYPE html> | ||
<meta http-equiv="Content-Security-Policy" | ||
content="require-trusted-types-for 'script';"/> | ||
<link rel="help" href="https://github.com/web-platform-tests/wpt/issues/45405"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<div id="divInsertedByParser"></div> | ||
<script> | ||
test( _ => { | ||
assert_throws_js(TypeError, _ => divInsertedByParser.innerHTML = 'unsafe'); | ||
}, "Setting innerHTML on a node inserted by the parser."); | ||
|
||
promise_test(async t => { | ||
const iframe = document.createElement("iframe"); | ||
const passThroughPolicy = | ||
trustedTypes.createPolicy("passThrough", { createHTML: s => s }); | ||
iframe.srcdoc = passThroughPolicy.createHTML("<!DOCTYPE html><div></div>"); | ||
await new Promise(resolve => { | ||
iframe.addEventListener("load", resolve); | ||
document.body.appendChild(iframe); | ||
}); | ||
const divAdoptedFromIframe = | ||
document.adoptNode(iframe.contentDocument.body.firstElementChild); | ||
assert_throws_js(TypeError, _ => divAdoptedFromIframe.innerHTML = 'unsafe'); | ||
}, "Setting innerHTML on a node adopted from a subframe."); | ||
</script> |