-
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.
[Delegate-CH] (1) Add support to chromium
This adds support for the delegate-ch meta tag. It works like the accept-ch meta tag, except it uses the same syntax as the allow iframe attribute. WICG/client-hints-infrastructure#108 This CL is part of a series: (1) Add support to chromium (2) Add tests to devtools Commit: false Bug: 1334152 Change-Id: I19ce426da8a0aa158aad1fde24f3bd4f19581c52
- Loading branch information
1 parent
6ce3bac
commit bf6d638
Showing
24 changed files
with
321 additions
and
18 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
...accept-ch-stickiness/meta-equiv-delegate-ch-cross-origin-iframe-with-hints.https.sub.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,18 @@ | ||
<!doctype html> | ||
<meta name="timeout" content="long"> | ||
<meta http-equiv="Delegate-CH" content="sec-ch-device-memory https://www1.{{host}}:{{ports[https][0]}}/; device-memory https://www1.{{host}}:{{ports[https][0]}}/"> | ||
<title>Meta-equiv Delegate-CH cross origin iframe with hints</title> | ||
<body> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="/common/get-host-info.sub.js"></script> | ||
<script src="resources/accept-ch-test.js"></script> | ||
|
||
<script> | ||
verify_iframe_state( | ||
host_info.HTTPS_REMOTE_ORIGIN + "/client-hints/accept-ch-stickiness/resources/do-expect-received.py", | ||
"meta-equiv cross origin iframe with hints"); | ||
</script> | ||
</body> | ||
</html> | ||
|
18 changes: 18 additions & 0 deletions
18
...ept-ch-stickiness/meta-equiv-delegate-ch-cross-origin-iframe-without-hints.https.sub.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,18 @@ | ||
<!doctype html> | ||
<meta name="timeout" content="long"> | ||
<meta http-equiv="Delegate-CH" content="sec-ch-device-memory https://{{host}}:{{ports[https][0]}}/; device-memory https://{{host}}:{{ports[https][0]}}/"> | ||
<title>Meta-equiv Delegate-CH cross origin iframe without hints</title> | ||
<body> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="/common/get-host-info.sub.js"></script> | ||
<script src="resources/accept-ch-test.js"></script> | ||
|
||
<script> | ||
verify_iframe_state( | ||
host_info.HTTPS_REMOTE_ORIGIN + "/client-hints/accept-ch-stickiness/resources/do-not-expect-received.py", | ||
"meta-equiv cross origin iframe without hints"); | ||
</script> | ||
</body> | ||
</html> | ||
|
18 changes: 18 additions & 0 deletions
18
...t-ch-stickiness/meta-equiv-delegate-ch-cross-origin-subresource-with-hints.https.sub.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,18 @@ | ||
<!doctype html> | ||
<meta name="timeout" content="long"> | ||
<meta http-equiv="Delegate-CH" content="sec-ch-device-memory https://www1.{{host}}:{{ports[https][0]}}/; device-memory https://www1.{{host}}:{{ports[https][0]}}/"> | ||
<title>Meta-equiv Delegate-CH cross origin subresource with hints</title> | ||
<body> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="/common/get-host-info.sub.js"></script> | ||
<script src="resources/accept-ch-test.js"></script> | ||
|
||
<script> | ||
verify_subresource_state( | ||
host_info.HTTPS_REMOTE_ORIGIN + "/client-hints/accept-ch-stickiness/resources/do-expect-received.py", | ||
"meta-equiv cross origin subresource with hints"); | ||
</script> | ||
</body> | ||
</html> | ||
|
18 changes: 18 additions & 0 deletions
18
...h-stickiness/meta-equiv-delegate-ch-cross-origin-subresource-without-hints.https.sub.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,18 @@ | ||
<!doctype html> | ||
<meta name="timeout" content="long"> | ||
<meta http-equiv="Delegate-CH" content="sec-ch-device-memory https://{{host}}:{{ports[https][0]}}/; device-memory https://{{host}}:{{ports[https][0]}}/"> | ||
<title>Meta-equiv Delegate-CH cross origin subresource without hints</title> | ||
<body> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="/common/get-host-info.sub.js"></script> | ||
<script src="resources/accept-ch-test.js"></script> | ||
|
||
<script> | ||
verify_subresource_state( | ||
host_info.HTTPS_REMOTE_ORIGIN + "/client-hints/accept-ch-stickiness/resources/do-not-expect-received.py", | ||
"meta-equiv cross origin subresource without hints"); | ||
</script> | ||
</body> | ||
</html> | ||
|
2 changes: 1 addition & 1 deletion
2
...s-origin-iframe-with-hints.https.sub.html → ...s-origin-iframe-with-hints.https.sub.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
2 changes: 1 addition & 1 deletion
2
...rigin-iframe-without-hints.https.sub.html → ...rigin-iframe-without-hints.https.sub.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
2 changes: 1 addition & 1 deletion
2
...gin-subresource-with-hints.https.sub.html → ...gin-subresource-with-hints.https.sub.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
2 changes: 1 addition & 1 deletion
2
...-subresource-without-hints.https.sub.html → ...-subresource-without-hints.https.sub.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
9 changes: 7 additions & 2 deletions
9
...s/accept-ch-stickiness/meta-name-cross-origin-iframe-not-setting-other-origins.https.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
9 changes: 7 additions & 2 deletions
9
...ints/accept-ch-stickiness/meta-name-cross-origin-iframe-not-setting-own-origin.https.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
9 changes: 7 additions & 2 deletions
9
client-hints/accept-ch-stickiness/meta-name-cross-origin-navigation.https.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
9 changes: 7 additions & 2 deletions
9
client-hints/accept-ch-stickiness/meta-name-cross-origin-subresource.https.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
9 changes: 7 additions & 2 deletions
9
client-hints/accept-ch-stickiness/meta-name-same-origin-iframe.https.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
9 changes: 7 additions & 2 deletions
9
client-hints/accept-ch-stickiness/meta-name-same-origin-navigation.https.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
9 changes: 7 additions & 2 deletions
9
client-hints/accept-ch-stickiness/meta-name-same-origin-subresource.https.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
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
8 changes: 8 additions & 0 deletions
8
client-hints/accept-ch-stickiness/resources/meta-equiv-delegate-ch.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,8 @@ | ||
<html> | ||
<meta http-equiv="Delegate-CH" content="sec-ch-device-memory;device-memory"> | ||
<body> | ||
<script> | ||
window.top.opener.postMessage('Loaded', '*'); | ||
</script> | ||
</body> | ||
</html> |
2 changes: 2 additions & 0 deletions
2
client-hints/accept-ch-stickiness/resources/meta-equiv-delegate-ch.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,2 @@ | ||
Access-Control-Allow-Origin: * | ||
|
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,25 @@ | ||
<html> | ||
<meta http-equiv="Delegate-CH" content="Sec-CH-Device-Memory; Device-Memory; Sec-CH-DPR; DPR; Sec-CH-Viewport-Width; Viewport-Width"> | ||
<title>Delegate-CH meta-equiv iframe test</title> | ||
<body> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="/common/get-host-info.sub.js"></script> | ||
<script src="/client-hints/resources/export.js"></script> | ||
<script src="resources/feature-policy-navigation.js"></script> | ||
<script> | ||
(async () => { | ||
await test_frame( | ||
"HTTPS_ORIGIN", | ||
meta_name_client_hints, | ||
"", | ||
"Client hints loaded on same-origin iframe include hints with a default permissions policy of self and *."); | ||
await test_frame( | ||
"HTTPS_REMOTE_ORIGIN", | ||
expect_iframe_no_hints, | ||
"", | ||
"Client hints loaded on cross-origin iframe only include hints with a default permissions policy of *."); | ||
})(); | ||
</script> | ||
</body> | ||
</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,41 @@ | ||
<html> | ||
<head> | ||
<title>Delegate-CH meta-equiv injection test</title> | ||
<meta http-equiv="Delegate-CH" content=""> | ||
</head> | ||
<body> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
|
||
<script> | ||
// Even though the next line injects an "Delegate-CH" meta-equiv header, the | ||
// browser should NOT attach the specified client hints in the request headers | ||
// because javascript injected delegate-ch meta-equiv headers are not trusted. | ||
document.getElementsByTagName('meta')[0].setAttribute("content", "dpr;sec-ch-dpr;device-memory;sec-ch-device-memory;viewport-width;sec-ch-viewport-width;rtt;downlink;ect"); | ||
document.head.outerHTML += '<meta http-equiv="Delegate-CH" content="sec-ch-ua-arch;sec-ch-ua-platform;sec-ch-ua-model">'; | ||
document.head.innerHTML += '<meta http-equiv="Delegate-CH" content="sec-ch-ua-full-version;sec-ch-ua-bitness;sec-ch-ua-full-version-list">'; | ||
document.write('<meta http-equiv="Delegate-CH" content="sec-ch-ua-platform-version;sec-ch-prefers-color-scheme;sec-ch-viewport-height">'); | ||
|
||
// resources/echo-client-hints-received.py sets the response headers depending on the set | ||
// of client hints it receives in the request headers. | ||
promise_test(t => { | ||
return fetch("/client-hints/resources/echo-client-hints-received.py").then(r => { | ||
assert_equals(r.status, 200) | ||
// Verify that the browser does not include client hints for javascript | ||
// injected headers on the XHR. | ||
assert_false(r.headers.has("device-memory-received"), "device-memory-received"); | ||
assert_false(r.headers.has("device-memory-deprecated-received"), "device-memory-deprecated-received"); | ||
assert_false(r.headers.has("dpr-received"), "dpr-received"); | ||
assert_false(r.headers.has("dpr-deprecated-received"), "dpr-deprecated-received"); | ||
assert_false(r.headers.has("viewport-width-received"), "viewport-width-received"); | ||
assert_false(r.headers.has("viewport-width-deprecated-received"), "viewport-width-deprecated-received"); | ||
assert_false(r.headers.has("rtt-received"), "rtt-received"); | ||
assert_false(r.headers.has("downlink-received"), "downlink-received"); | ||
assert_false(r.headers.has("ect-received"), "ect-received"); | ||
assert_false(r.headers.has("prefers-color-scheme-received"), "prefers-color-scheme-received"); | ||
}); | ||
}, "Delegate-CH meta-equiv injection test"); | ||
|
||
</script> | ||
</body> | ||
</html> |
Oops, something went wrong.