-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cherry-pick 9ea5482. rdar://118676659
Safari blocking JS reading nonce for <style> and <link> https://bugs.webkit.org/show_bug.cgi?id=265173 rdar://118676659 Reviewed by Antti Koivisto. Some leftover nonce IDL included [Reflect] and therefore those elements had the older-but-now-bogus nonce semantics. Tests have been synchronized and new tests in nonces.html are upstreamed here: web-platform-tests/wpt#43280 The new test failures in WPT html/dom/reflection-metadata.html are expected and match all other browsers. I filed an upstream issue on that test here: web-platform-tests/wpt#43286 * LayoutTests/imported/w3c/web-platform-tests/content-security-policy/nonce-hiding/nonce-hiding-move-document-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/content-security-policy/nonce-hiding/nonce-hiding-move-document.html: Added. * LayoutTests/imported/w3c/web-platform-tests/content-security-policy/nonce-hiding/nonces-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/content-security-policy/nonce-hiding/nonces.html: * LayoutTests/imported/w3c/web-platform-tests/content-security-policy/nonce-hiding/w3c-import.log: * LayoutTests/imported/w3c/web-platform-tests/html/dom/reflection-metadata-expected.txt: * Source/WebCore/html/HTMLLinkElement.idl: * Source/WebCore/html/HTMLStyleElement.idl: Canonical link: https://commits.webkit.org/271046@main Identifier: 267815.580@safari-7617-branch
- Loading branch information
Showing
8 changed files
with
74 additions
and
37 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
...atform-tests/content-security-policy/nonce-hiding/nonce-hiding-move-document-expected.txt
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,5 @@ | ||
What color is this? | ||
|
||
|
||
PASS Nonce isn't lost on document move | ||
|
26 changes: 26 additions & 0 deletions
26
...c/web-platform-tests/content-security-policy/nonce-hiding/nonce-hiding-move-document.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 charset="utf-8"> | ||
<meta http-equiv="Content-Security-Policy" content="style-src 'self' 'nonce-allowme';"> | ||
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1831328"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<title>Nonce isn't lost on document move</title> | ||
<style type="text/css" nonce="allowme"> | ||
p { | ||
color: red; | ||
} | ||
</style> | ||
<p>What color is this?</p> | ||
<script> | ||
test(function() { | ||
const doc = document.implementation.createDocument("http://www.w3.org/1999/xhtml","html"); | ||
const style = document.createElement("style"); | ||
style.setAttribute("nonce", "allowme"); | ||
style.textContent = "p { color: lime }"; | ||
|
||
doc.documentElement.appendChild(style); | ||
document.body.appendChild(style); | ||
assert_equals(style.nonce, "allowme", "Nonce should not have been lost"); | ||
assert_equals(getComputedStyle(document.querySelector("p")).color, "rgb(0, 255, 0)", "Style should apply"); | ||
}) | ||
</script> |
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
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
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