Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1616251 [wpt PR 21853] - nonce attribute: no longer tentative, a=…
…testonly Automatic update from web-platform-tests nonce attribute: no longer tentative For whatwg/html#5300. Supersedes #5423 -- wpt-commits: 2ca72d0f4b39e6007ae10e78d25f352dab56b2d2 wpt-pr: 21853 --HG-- rename : testing/web-platform/tests/content-security-policy/nonce-hiding/script-nonces-hidden.tentative.html.headers => testing/web-platform/tests/content-security-policy/nonce-hiding/script-nonces-hidden.html.headers rename : testing/web-platform/tests/content-security-policy/nonce-hiding/svgscript-nonces-hidden.tentative.html.headers => testing/web-platform/tests/content-security-policy/nonce-hiding/svgscript-nonces-hidden.html.headers
- Loading branch information
1 parent
205bea2
commit 979c583
Showing
8 changed files
with
49 additions
and
50 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
testing/web-platform/tests/content-security-policy/nonce-hiding/nonces.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,32 @@ | ||
<!DOCTYPE html> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<div id=log></div> | ||
<script> | ||
[["meh", ""], | ||
["div", ""], | ||
["script", ""], | ||
["meh", "http://www.w3.org/2000/svg"], | ||
["svg", "http://www.w3.org/2000/svg"], , | ||
["script", "http://www.w3.org/2000/svg"]].forEach(([localName, namespace]) => { | ||
test(t => { | ||
const element = namespace === "" ? document.createElement(localName) : document.createElementNS(namespace, localName); | ||
t.add_cleanup(() => element.remove()); | ||
assert_equals(element.nonce, "", "Initial IDL attribute value"); | ||
element.setAttribute("nonce", "x"); | ||
assert_equals(element.nonce, "x", "IDL attribute is modified after content attribute set"); | ||
assert_equals(element.getAttribute("nonce"), "x", "Content attribute is modified after content attribute set"); | ||
document.body.appendChild(element); | ||
assert_equals(element.nonce, "x", "IDL attribute is unchanged after element insertion"); | ||
assert_equals(element.getAttribute("nonce"), "", "Content attribute is changed after element insertion"); | ||
}, `Basic nonce tests for ${localName} in ${namespace === "" ? "HTML" : "SVG"} namespace`); | ||
|
||
test(t => { | ||
const element = namespace === "" ? document.createElement(localName) : document.createElementNS(namespace, localName); | ||
element.setAttribute("nonce", "x"); | ||
assert_equals(element.nonce, "x", "IDL attribute is modified after content attribute set"); | ||
element.removeAttribute("nonce"); | ||
assert_equals(element.nonce, "", "IDL attribute is empty after content attribute removal"); | ||
}, `Ensure that removal of content attribute does not affect IDL attribute for ${localName} in ${namespace === "" ? "HTML" : "SVG"} namespace`); | ||
}); | ||
</script> |
1 change: 1 addition & 0 deletions
1
testing/web-platform/tests/content-security-policy/nonce-hiding/nonces.html.headers
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 @@ | ||
Content-Security-Policy: img-src 'none' |
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
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
File renamed without changes.
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
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
File renamed without changes.