-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enforce referrer policy restriction for prerendering
A previous CL implemented the list of sufficiently strict speculative navigation referrer policies, but only applied it to prefetch. We now apply it to all speculation rule actions. We also fix some existing prerender referrer policy tests. referrer-policy-mismatch.html incorrectly hyphenated the policy. referrer-policy-origin.html used the origin policy which is not one of the sufficiently-strict referrer policies. We switch to using the strict version. Bug: 1176054, 1355146 Change-Id: I5b3c89d92ce80dc6b37ddb429786cf1d6d4a806b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3957475 Commit-Queue: Kevin McNee <[email protected]> Reviewed-by: Jeremy Roman <[email protected]> Reviewed-by: Hiroki Nakagawa <[email protected]> Cr-Commit-Position: refs/heads/main@{#1060751}
- Loading branch information
1 parent
c733de5
commit bc528db
Showing
5 changed files
with
46 additions
and
12 deletions.
There are no files selected for viewing
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
21 changes: 21 additions & 0 deletions
21
speculation-rules/prerender/referrer-policy-not-accepted.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,21 @@ | ||
<!DOCTYPE html> | ||
<meta name="timeout" content="long"> | ||
<title>Referrer policy must be sufficiently strict to allow prerendering</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="/common/utils.js"></script> | ||
<script src="/common/dispatcher/dispatcher.js"></script> | ||
<script src="/html/browsers/browsing-the-web/remote-context-helper/resources/remote-context-helper.js"></script> | ||
<script src="resources/utils.js"></script> | ||
|
||
<script> | ||
setup(() => assertSpeculationRulesIsSupported()); | ||
|
||
promise_test(async t => { | ||
const {exec, tryToActivate} = | ||
await create_prerendered_page(t, {}, {referrer_policy: 'unsafe-url'}); | ||
const result = await tryToActivate(); | ||
assert_equals(result, 'discarded'); | ||
}, 'do not prerender with "unsafe-url"'); | ||
|
||
</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