forked from web-platform-tests/wpt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
We need to verify behavior of critical-ch when it comes to redirects. We need to know that the critical hints are included in the final page except in the case of a same-origin redirect where the intermediate and final page both have critical-hints. Any given load only restarts once per origin so two differing critical hint sets in a single chain won't both be respected (only the first will be). Bug: 1428593 Change-Id: Ic0f3469e26828f1196a6f7066acc5eabaea110d2 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4377410 Reviewed-by: Mike Taylor <[email protected]> Commit-Queue: Ari Chivukula <[email protected]> Auto-Submit: Ari Chivukula <[email protected]> Cr-Commit-Position: refs/heads/main@{#1125414}
- Loading branch information
1 parent
e2a9aa9
commit d3160de
Showing
17 changed files
with
67 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
// META: script=resources/util.js | ||
|
||
async_test((t) => { | ||
window.addEventListener('message', message_listener(t, "FAIL")); | ||
var iframe = document.createElement("iframe"); | ||
iframe.src = ECHO_URL; | ||
document.body.appendChild(iframe); | ||
iframe.contentWindow.addEventListener('message', message_listener(t, "FAIL")); | ||
}, "Critical-CH iframe"); | ||
|
||
async_test((t) => { | ||
window.addEventListener('message', message_listener(t, "FAIL")); | ||
var iframe = document.createElement("iframe"); | ||
iframe.src = ECHO_URL+"?multiple=true"; | ||
document.body.appendChild(iframe); | ||
iframe.contentWindow.addEventListener('message', message_listener(t, "FAIL")); | ||
}, "Critical-CH w/ multiple headers and iframe"); |
4 changes: 4 additions & 0 deletions
4
client-hints/critical-ch/navigation.cross-origin.https.window.js
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,4 @@ | ||
// META: script=resources/util.js | ||
// META: script=/common/get-host-info.sub.js | ||
|
||
async_test(make_message_test(get_host_info().HTTPS_REMOTE_ORIGIN+"/client-hints/critical-ch/"+ECHO_URL, "PASS"), "Critical-CH cross-origin navigation") |
4 changes: 4 additions & 0 deletions
4
client-hints/critical-ch/navigation.cross-origin.multiple.https.window.js
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,4 @@ | ||
// META: script=resources/util.js | ||
// META: script=/common/get-host-info.sub.js | ||
|
||
async_test(make_message_test(get_host_info().HTTPS_REMOTE_ORIGIN+"/client-hints/critical-ch/"+ECHO_URL+"?multiple=true", "PASS"), "Critical-CH w/ multiple headers and cross-origin navigation") |
File renamed without changes.
File renamed without changes.
4 changes: 4 additions & 0 deletions
4
client-hints/critical-ch/redirect.critical.cross-origin.https.window.js
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,4 @@ | ||
// META: script=resources/util.js | ||
// META: script=/common/get-host-info.sub.js | ||
|
||
async_test(make_message_test(REDIRECT_URL+"?critical=true&location="+get_host_info().HTTPS_REMOTE_ORIGIN+"/client-hints/critical-ch/"+ECHO_URL, "PASS"), "Critical-CH cross-origin critical redirect") |
4 changes: 4 additions & 0 deletions
4
client-hints/critical-ch/redirect.critical.cross-origin.multiple.https.window.js
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,4 @@ | ||
// META: script=resources/util.js | ||
// META: script=/common/get-host-info.sub.js | ||
|
||
async_test(make_message_test(REDIRECT_URL+"?critical=true&location="+get_host_info().HTTPS_REMOTE_ORIGIN+"/client-hints/critical-ch/"+ECHO_URL+"?multiple=true", "PASS"), "Critical-CH w/ multiple headers cross-origin critical redirect") |
3 changes: 3 additions & 0 deletions
3
client-hints/critical-ch/redirect.critical.same-origin.https.window.js
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,3 @@ | ||
// META: script=resources/util.js | ||
|
||
async_test(make_message_test(REDIRECT_URL+"?critical=true&location=/client-hints/critical-ch/"+ECHO_URL, "FAIL"), "Critical-CH critical redirect") |
3 changes: 3 additions & 0 deletions
3
client-hints/critical-ch/redirect.critical.same-origin.multiple.https.window.js
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,3 @@ | ||
// META: script=resources/util.js | ||
|
||
async_test(make_message_test(REDIRECT_URL+"?critical=true&location=/client-hints/critical-ch/"+ECHO_URL+"?multiple=true", "FAIL"), "Critical-CH w/ multiple headers and critical redirect") |
4 changes: 4 additions & 0 deletions
4
client-hints/critical-ch/redirect.cross-origin.https.window.js
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,4 @@ | ||
// META: script=resources/util.js | ||
// META: script=/common/get-host-info.sub.js | ||
|
||
async_test(make_message_test(REDIRECT_URL+"?location="+get_host_info().HTTPS_REMOTE_ORIGIN+"/client-hints/critical-ch/"+ECHO_URL, "PASS"), "Critical-CH cross-origin redirect") |
4 changes: 4 additions & 0 deletions
4
client-hints/critical-ch/redirect.cross-origin.multiple.https.window.js
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,4 @@ | ||
// META: script=resources/util.js | ||
// META: script=/common/get-host-info.sub.js | ||
|
||
async_test(make_message_test(REDIRECT_URL+"?location="+get_host_info().HTTPS_REMOTE_ORIGIN+"/client-hints/critical-ch/"+ECHO_URL+"?multiple=true", "PASS"), "Critical-CH w/ multiple headers cross-origin redirect") |
3 changes: 3 additions & 0 deletions
3
client-hints/critical-ch/redirect.same-origin.https.window.js
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,3 @@ | ||
// META: script=resources/util.js | ||
|
||
async_test(make_message_test(REDIRECT_URL+"?location=/client-hints/critical-ch/"+ECHO_URL, "PASS"), "Critical-CH redirect") |
3 changes: 3 additions & 0 deletions
3
client-hints/critical-ch/redirect.same-origin.multiple.https.window.js
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,3 @@ | ||
// META: script=resources/util.js | ||
|
||
async_test(make_message_test(REDIRECT_URL+"?location=/client-hints/critical-ch/"+ECHO_URL+"?multiple=true", "PASS"), "Critical-CH w/ multiple headers and redirect") |
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
14 changes: 14 additions & 0 deletions
14
client-hints/critical-ch/resources/redirect-critical-hint.py
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,14 @@ | ||
def main(request, response): | ||
""" | ||
Simple handler that redirects to echo-critical-hint.py. | ||
""" | ||
|
||
response.status = 302 | ||
location = request.GET.first(b"location") | ||
response.headers.set(b"Location", location) | ||
response.headers.set(b"Access-Control-Allow-Origin", b"*") | ||
if(request.GET.first(b"critical", None) is not None): | ||
hints = b"sec-ch-dpr,dpr" | ||
response.headers.append(b"Accept-CH", hints) | ||
response.headers.append(b"Critical-CH", hints) | ||
|
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