Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
https://bugs.webkit.org/show_bug.cgi?id=240817 This reads the nonce from link elements and Link headers. This was implemented by Chromium in 2017 to be consistent with the HTMLPreloader: https://chromium-review.googlesource.com/c/chromium/src/+/676769/ Reviewed by Kate Cheney. * LayoutTests/imported/w3c/web-platform-tests/preload/link-header-preload-nonce-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/preload/link-header-preload-nonce.html: These test changes were already upstream: web-platform-tests/wpt@306dc50 * Source/WebCore/html/HTMLLinkElement.cpp: (WebCore::HTMLLinkElement::process): * Source/WebCore/loader/LinkHeader.cpp: (WebCore::paramterNameFromString): (WebCore::LinkHeader::setValue): * Source/WebCore/loader/LinkHeader.h: (WebCore::LinkHeader::nonce const): * Source/WebCore/loader/LinkLoader.cpp: (WebCore::LinkLoader::loadLinksFromHeader): (WebCore::LinkLoader::preloadIfNeeded): (WebCore::LinkLoader::prefetchIfNeeded): * Source/WebCore/loader/LinkLoader.h: Canonical link: https://commits.webkit.org/250972@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@294819 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
7 changed files
with
15 additions
and
6 deletions.
There are no files selected for viewing
5 changes: 1 addition & 4 deletions
5
LayoutTests/imported/w3c/web-platform-tests/preload/link-header-preload-nonce-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 |
---|---|---|
@@ -1,7 +1,4 @@ | ||
CONSOLE MESSAGE: Refused to load http://localhost:8800/preload/resources/dummy.js?from-header&without-nonce because it does not appear in the script-src directive of the Content Security Policy. | ||
CONSOLE MESSAGE: Refused to load http://localhost:8800/preload/resources/dummy.js?from-header&with-nonce because it does not appear in the script-src directive of the Content Security Policy. | ||
CONSOLE MESSAGE: Error: assert_equals: resources/dummy.js?from-header&with-nonce expected 1 but got 0 | ||
|
||
Harness Error (FAIL), message = Error: assert_equals: resources/dummy.js?from-header&with-nonce expected 1 but got 0 | ||
|
||
PASS Makes sure that Link headers preload resources with CSP nonce | ||
|
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