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.
[Client Hints] Verify hint availability
We want to check whether hints are available in embedded contexts. Bug: 1399788 Change-Id: Idc4a4f0a7e3266c2cbc57a89fc90df8923f97232 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4089490 Reviewed-by: Ian Clelland <[email protected]> Auto-Submit: Ari Chivukula <[email protected]> Commit-Queue: Ari Chivukula <[email protected]> Cr-Commit-Position: refs/heads/main@{#1084701}
- Loading branch information
1 parent
830af40
commit e9baa05
Showing
23 changed files
with
483 additions
and
0 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
client-hints/inner-delegation/accept_ch_delegation_to_all.sub.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<!doctype html> | ||
<meta charset=utf-8> | ||
<title>Client Hints: Delegation of hints to cross-origin frames and resources for *</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<body> | ||
<script> | ||
// Here's the set-up for this test: | ||
// Step 1. (Site 1 Window) verify ch-device-memory availability. | ||
// Step 2. (Site 1 Window) set up listener and embed Site 2 Frame. | ||
// Step 3. (Site 2 Frame) verify ch-device-memory availability. | ||
// Step 4. (Site 2 Frame) embeds Site 1 Frame. | ||
// Step 5. (Site 3 Frame) verify ch-device-memory availability. | ||
// Step 6. (Site 1 Window) exit. | ||
|
||
promise_test(async (t) => { | ||
// Step 1 | ||
let r = await fetch("/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py"); | ||
assert_equals(r.status, 200, "Site 1 fetching Site 1 didn't recieve sec-ch-device-memory"); | ||
r = await fetch("https://{{hosts[alt][]}}:{{ports[https][0]}}/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py"); | ||
assert_equals(r.status, 200, "Site 1 fetching Site 2 didn't recieve sec-ch-device-memory"); | ||
r = await fetch("https://{{domains[www2]}}:{{ports[https][0]}}/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py"); | ||
assert_equals(r.status, 200, "Site 1 fetching Site 3 didn't recieve sec-ch-device-memory"); | ||
// Step 2 | ||
const site2Frame = document.createElement("iframe"); | ||
site2Frame.src = "https://{{hosts[alt][]}}:{{ports[https][0]}}/client-hints/inner-delegation/resources/accept_ch_delegation_to_all_iframe.sub.https.html"; | ||
site2Frame.allow = "ch-device-memory *" | ||
document.body.appendChild(site2Frame); | ||
// Step 6 | ||
return new Promise(resolve => { | ||
window.addEventListener("message", resolve); | ||
}).then(e => { | ||
assert_equals(e.data, "ch-device-memory is available as expected for all"); | ||
}); | ||
}, "postMessage: First-Party to Third-Party, Cross-Partition, Same-Origin"); | ||
</script> | ||
</body> |
2 changes: 2 additions & 0 deletions
2
client-hints/inner-delegation/accept_ch_delegation_to_all.sub.https.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 @@ | ||
Permissions-Policy: ch-device-memory=(*) | ||
Accept-CH: Sec-CH-Device-Memory |
36 changes: 36 additions & 0 deletions
36
client-hints/inner-delegation/accept_ch_delegation_to_none.sub.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<!doctype html> | ||
<meta charset=utf-8> | ||
<title>Client Hints: Delegation of hints to cross-origin frames and resources for none</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<body> | ||
<script> | ||
// Here's the set-up for this test: | ||
// Step 1. (Site 1 Window) verify ch-device-memory availability. | ||
// Step 2. (Site 1 Window) set up listener and embed Site 2 Frame. | ||
// Step 3. (Site 2 Frame) verify ch-device-memory availability. | ||
// Step 4. (Site 2 Frame) embeds Site 1 Frame. | ||
// Step 5. (Site 3 Frame) verify ch-device-memory availability. | ||
// Step 6. (Site 1 Window) exit. | ||
|
||
promise_test(async (t) => { | ||
// Step 1 | ||
let r = await fetch("/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py"); | ||
assert_equals(r.status, 400, "Site 1 fetching Site 1 did recieve sec-ch-device-memory"); | ||
r = await fetch("https://{{hosts[alt][]}}:{{ports[https][0]}}/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py"); | ||
assert_equals(r.status, 400, "Site 1 fetching Site 2 did recieve sec-ch-device-memory"); | ||
r = await fetch("https://{{domains[www2]}}:{{ports[https][0]}}/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py"); | ||
assert_equals(r.status, 400, "Site 1 fetching Site 3 did recieve sec-ch-device-memory"); | ||
// Step 2 | ||
const site2Frame = document.createElement("iframe"); | ||
site2Frame.src = "https://{{hosts[alt][]}}:{{ports[https][0]}}/client-hints/inner-delegation/resources/accept_ch_delegation_to_none_iframe.sub.https.html"; | ||
document.body.appendChild(site2Frame); | ||
// Step 6 | ||
return new Promise(resolve => { | ||
window.addEventListener("message", resolve); | ||
}).then(e => { | ||
assert_equals(e.data, "ch-device-memory is available as expected for none"); | ||
}); | ||
}, "postMessage: First-Party to Third-Party, Cross-Partition, Same-Origin"); | ||
</script> | ||
</body> |
2 changes: 2 additions & 0 deletions
2
client-hints/inner-delegation/accept_ch_delegation_to_none.sub.https.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 @@ | ||
Permissions-Policy: ch-device-memory=() | ||
Accept-CH: Sec-CH-Device-Memory |
37 changes: 37 additions & 0 deletions
37
client-hints/inner-delegation/accept_ch_delegation_to_self.sub.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<!doctype html> | ||
<meta charset=utf-8> | ||
<title>Client Hints: Delegation of hints to cross-origin frames and resources for self</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<body> | ||
<script> | ||
// Here's the set-up for this test: | ||
// Step 1. (Site 1 Window) verify ch-device-memory availability. | ||
// Step 2. (Site 1 Window) set up listener and embed Site 2 Frame. | ||
// Step 3. (Site 2 Frame) verify ch-device-memory availability. | ||
// Step 4. (Site 2 Frame) embeds Site 1 Frame. | ||
// Step 5. (Site 3 Frame) verify ch-device-memory availability. | ||
// Step 6. (Site 1 Window) exit. | ||
|
||
promise_test(async (t) => { | ||
// Step 1 | ||
let r = await fetch("/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py"); | ||
assert_equals(r.status, 200, "Site 1 fetching Site 1 didn't recieve sec-ch-device-memory"); | ||
r = await fetch("https://{{hosts[alt][]}}:{{ports[https][0]}}/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py"); | ||
assert_equals(r.status, 400, "Site 1 fetching Site 2 did recieve sec-ch-device-memory"); | ||
r = await fetch("https://{{domains[www2]}}:{{ports[https][0]}}/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py"); | ||
assert_equals(r.status, 400, "Site 1 fetching Site 3 did recieve sec-ch-device-memory"); | ||
// Step 2 | ||
const site2Frame = document.createElement("iframe"); | ||
site2Frame.src = "https://{{hosts[alt][]}}:{{ports[https][0]}}/client-hints/inner-delegation/resources/accept_ch_delegation_to_self_iframe.sub.https.html"; | ||
site2Frame.allow = "ch-device-memory self" | ||
document.body.appendChild(site2Frame); | ||
// Step 6 | ||
return new Promise(resolve => { | ||
window.addEventListener("message", resolve); | ||
}).then(e => { | ||
assert_equals(e.data, "ch-device-memory is available as expected for self"); | ||
}); | ||
}, "postMessage: First-Party to Third-Party, Cross-Partition, Same-Origin"); | ||
</script> | ||
</body> |
2 changes: 2 additions & 0 deletions
2
client-hints/inner-delegation/accept_ch_delegation_to_self.sub.https.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 @@ | ||
Permissions-Policy: ch-device-memory=(self) | ||
Accept-CH: Sec-CH-Device-Memory |
37 changes: 37 additions & 0 deletions
37
client-hints/inner-delegation/accept_ch_delegation_to_some.sub.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<!doctype html> | ||
<meta charset=utf-8> | ||
<title>Client Hints: Delegation of hints to cross-origin frames and resources for some</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<body> | ||
<script> | ||
// Here's the set-up for this test: | ||
// Step 1. (Site 1 Window) verify ch-device-memory availability. | ||
// Step 2. (Site 1 Window) set up listener and embed Site 2 Frame. | ||
// Step 3. (Site 2 Frame) verify ch-device-memory availability. | ||
// Step 4. (Site 2 Frame) embeds Site 1 Frame. | ||
// Step 5. (Site 3 Frame) verify ch-device-memory availability. | ||
// Step 6. (Site 1 Window) exit. | ||
|
||
promise_test(async (t) => { | ||
// Step 1 | ||
let r = await fetch("/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py"); | ||
assert_equals(r.status, 200, "Site 1 fetching Site 1 didn't recieve sec-ch-device-memory"); | ||
r = await fetch("https://{{hosts[alt][]}}:{{ports[https][0]}}/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py"); | ||
assert_equals(r.status, 200, "Site 1 fetching Site 2 didn't recieve sec-ch-device-memory"); | ||
r = await fetch("https://{{domains[www2]}}:{{ports[https][0]}}/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py"); | ||
assert_equals(r.status, 400, "Site 1 fetching Site 3 did recieve sec-ch-device-memory"); | ||
// Step 2 | ||
const site2Frame = document.createElement("iframe"); | ||
site2Frame.src = "https://{{hosts[alt][]}}:{{ports[https][0]}}/client-hints/inner-delegation/resources/accept_ch_delegation_to_some_iframe.sub.https.html"; | ||
site2Frame.allow = "ch-device-memory https://{{hosts[alt][]}}:{{ports[https][0]}}" | ||
document.body.appendChild(site2Frame); | ||
// Step 6 | ||
return new Promise(resolve => { | ||
window.addEventListener("message", resolve); | ||
}).then(e => { | ||
assert_equals(e.data, "ch-device-memory is available as expected for some"); | ||
}); | ||
}, "postMessage: First-Party to Third-Party, Cross-Partition, Same-Origin"); | ||
</script> | ||
</body> |
2 changes: 2 additions & 0 deletions
2
client-hints/inner-delegation/accept_ch_delegation_to_some.sub.https.html.sub.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 @@ | ||
Permissions-Policy: ch-device-memory=("https://{{host}}:{{ports[https][0]}}" "https://{{hosts[alt][]}}:{{ports[https][0]}}") | ||
Accept-CH: Sec-CH-Device-Memory |
37 changes: 37 additions & 0 deletions
37
client-hints/inner-delegation/accept_ch_delegation_to_src.sub.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<!doctype html> | ||
<meta charset=utf-8> | ||
<title>Client Hints: Delegation of hints to cross-origin frames and resources for src</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<body> | ||
<script> | ||
// Here's the set-up for this test: | ||
// Step 1. (Site 1 Window) verify ch-device-memory availability. | ||
// Step 2. (Site 1 Window) set up listener and embed Site 2 Frame. | ||
// Step 3. (Site 2 Frame) verify ch-device-memory availability. | ||
// Step 4. (Site 2 Frame) embeds Site 1 Frame. | ||
// Step 5. (Site 3 Frame) verify ch-device-memory availability. | ||
// Step 6. (Site 1 Window) exit. | ||
|
||
promise_test(async (t) => { | ||
// Step 1 | ||
let r = await fetch("/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py"); | ||
assert_equals(r.status, 200, "Site 1 fetching Site 1 didn't recieve sec-ch-device-memory"); | ||
r = await fetch("https://{{hosts[alt][]}}:{{ports[https][0]}}/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py"); | ||
assert_equals(r.status, 400, "Site 1 fetching Site 2 did recieve sec-ch-device-memory"); | ||
r = await fetch("https://{{domains[www2]}}:{{ports[https][0]}}/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py"); | ||
assert_equals(r.status, 400, "Site 1 fetching Site 3 did recieve sec-ch-device-memory"); | ||
// Step 2 | ||
const site2Frame = document.createElement("iframe"); | ||
site2Frame.src = "https://{{hosts[alt][]}}:{{ports[https][0]}}/client-hints/inner-delegation/resources/accept_ch_delegation_to_src_iframe.sub.https.html"; | ||
site2Frame.allow = "ch-device-memory src" | ||
document.body.appendChild(site2Frame); | ||
// Step 6 | ||
return new Promise(resolve => { | ||
window.addEventListener("message", resolve); | ||
}).then(e => { | ||
assert_equals(e.data, "ch-device-memory is available as expected for src"); | ||
}); | ||
}, "postMessage: First-Party to Third-Party, Cross-Partition, Same-Origin"); | ||
</script> | ||
</body> |
2 changes: 2 additions & 0 deletions
2
client-hints/inner-delegation/accept_ch_delegation_to_src.sub.https.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 @@ | ||
Permissions-Policy: ch-device-memory=(self) | ||
Accept-CH: Sec-CH-Device-Memory |
32 changes: 32 additions & 0 deletions
32
client-hints/inner-delegation/resources/accept_ch_delegation_to_all_iframe.sub.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<!doctype html> | ||
<meta charset=utf-8> | ||
<body> | ||
<script> | ||
async function test() { | ||
// Step 3 (client-hints/inner-delegation/accept_ch_delegation_to_all.sub.https.html) | ||
let r = await fetch("https://{{host}}:{{ports[https][0]}}/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py"); | ||
if (r.status == 200) { | ||
return "Site 2 fetching Site 1 did recieve sec-ch-device-memory"; | ||
} | ||
r = await fetch("/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py"); | ||
if (r.status != 200) { | ||
return "Site 2 fetching Site 2 didn't recieve sec-ch-device-memory"; | ||
} | ||
r = await fetch("https://{{domains[www2]}}:{{ports[https][0]}}/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py"); | ||
if (r.status == 200) { | ||
return "Site 2 fetching Site 3 did recieve sec-ch-device-memory"; | ||
} | ||
// Step 4 (client-hints/inner-delegation/accept_ch_delegation_to_all.sub.https.html) | ||
const site3Frame = document.createElement("iframe"); | ||
site3Frame.src = "https://{{domains[www2]}}:{{ports[https][0]}}/client-hints/inner-delegation/resources/accept_ch_delegation_to_all_iframe_iframe.sub.https.html"; | ||
site3Frame.allow = "ch-device-memory *" | ||
document.body.appendChild(site3Frame); | ||
return "" | ||
} | ||
test().then((message) => { | ||
if (message) { | ||
window.top.postMessage(message, "*"); | ||
} | ||
}); | ||
</script> | ||
</body> |
23 changes: 23 additions & 0 deletions
23
...hints/inner-delegation/resources/accept_ch_delegation_to_all_iframe_iframe.sub.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<!doctype html> | ||
<meta charset=utf-8> | ||
<body> | ||
<script> | ||
async function test() { | ||
// Step 5 (client-hints/inner-delegation/accept_ch_delegation_to_all.sub.https.html) | ||
let r = await fetch("https://{{host}}:{{ports[https][0]}}/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py"); | ||
if (r.status == 200) { | ||
return "Site 3 fetching Site 1 did recieve sec-ch-device-memory"; | ||
} | ||
r = await fetch("https://{{hosts[alt][]}}:{{ports[https][0]}}/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py"); | ||
if (r.status == 200) { | ||
return "Site 3 fetching Site 2 did recieve sec-ch-device-memory"; | ||
} | ||
r = await fetch("/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py"); | ||
if (r.status != 200) { | ||
return "Site 3 fetching Site 3 didn't recieve sec-ch-device-memory"; | ||
} | ||
return "ch-device-memory is available as expected for all" | ||
} | ||
test().then((message) => window.top.postMessage(message, "*")); | ||
</script> | ||
</body> |
32 changes: 32 additions & 0 deletions
32
client-hints/inner-delegation/resources/accept_ch_delegation_to_none_iframe.sub.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<!doctype html> | ||
<meta charset=utf-8> | ||
<body> | ||
<script> | ||
async function test() { | ||
// Step 3 (client-hints/inner-delegation/accept_ch_delegation_to_none.sub.https.html) | ||
let r = await fetch("https://{{host}}:{{ports[https][0]}}/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py"); | ||
if (r.status == 200) { | ||
return "Site 2 fetching Site 1 did recieve sec-ch-device-memory"; | ||
} | ||
r = await fetch("/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py"); | ||
if (r.status == 200) { | ||
return "Site 2 fetching Site 2 did recieve sec-ch-device-memory"; | ||
} | ||
r = await fetch("https://{{domains[www2]}}:{{ports[https][0]}}/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py"); | ||
if (r.status == 200) { | ||
return "Site 2 fetching Site 3 did recieve sec-ch-device-memory"; | ||
} | ||
// Step 4 (client-hints/inner-delegation/accept_ch_delegation_to_none.sub.https.html) | ||
const site3Frame = document.createElement("iframe"); | ||
site3Frame.src = "https://{{domains[www2]}}:{{ports[https][0]}}/client-hints/inner-delegation/resources/accept_ch_delegation_to_none_iframe_iframe.sub.https.html"; | ||
site3Frame.allow = "ch-device-memory none" | ||
document.body.appendChild(site3Frame); | ||
return "" | ||
} | ||
test().then((message) => { | ||
if (message) { | ||
window.top.postMessage(message, "*"); | ||
} | ||
}); | ||
</script> | ||
</body> |
23 changes: 23 additions & 0 deletions
23
...ints/inner-delegation/resources/accept_ch_delegation_to_none_iframe_iframe.sub.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<!doctype html> | ||
<meta charset=utf-8> | ||
<body> | ||
<script> | ||
async function test() { | ||
// Step 5 (client-hints/inner-delegation/accept_ch_delegation_to_none.sub.https.html) | ||
let r = await fetch("https://{{host}}:{{ports[https][0]}}/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py"); | ||
if (r.status == 200) { | ||
return "Site 3 fetching Site 1 did recieve sec-ch-device-memory"; | ||
} | ||
r = await fetch("https://{{hosts[alt][]}}:{{ports[https][0]}}/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py"); | ||
if (r.status == 200) { | ||
return "Site 3 fetching Site 2 did recieve sec-ch-device-memory"; | ||
} | ||
r = await fetch("/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py"); | ||
if (r.status == 200) { | ||
return "Site 3 fetching Site 3 did recieve sec-ch-device-memory"; | ||
} | ||
return "ch-device-memory is available as expected for none" | ||
} | ||
test().then((message) => window.top.postMessage(message, "*")); | ||
</script> | ||
</body> |
32 changes: 32 additions & 0 deletions
32
client-hints/inner-delegation/resources/accept_ch_delegation_to_self_iframe.sub.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<!doctype html> | ||
<meta charset=utf-8> | ||
<body> | ||
<script> | ||
async function test() { | ||
// Step 3 (client-hints/inner-delegation/accept_ch_delegation_to_self.sub.https.html) | ||
let r = await fetch("https://{{host}}:{{ports[https][0]}}/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py"); | ||
if (r.status == 200) { | ||
return "Site 2 fetching Site 1 did recieve sec-ch-device-memory"; | ||
} | ||
r = await fetch("/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py"); | ||
if (r.status == 200) { | ||
return "Site 2 fetching Site 2 did recieve sec-ch-device-memory"; | ||
} | ||
r = await fetch("https://{{domains[www2]}}:{{ports[https][0]}}/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py"); | ||
if (r.status == 200) { | ||
return "Site 2 fetching Site 3 did recieve sec-ch-device-memory"; | ||
} | ||
// Step 4 (client-hints/inner-delegation/accept_ch_delegation_to_self.sub.https.html) | ||
const site3Frame = document.createElement("iframe"); | ||
site3Frame.src = "https://{{domains[www2]}}:{{ports[https][0]}}/client-hints/inner-delegation/resources/accept_ch_delegation_to_self_iframe_iframe.sub.https.html"; | ||
site3Frame.allow = "ch-device-memory self" | ||
document.body.appendChild(site3Frame); | ||
return "" | ||
} | ||
test().then((message) => { | ||
if (message) { | ||
window.top.postMessage(message, "*"); | ||
} | ||
}); | ||
</script> | ||
</body> |
23 changes: 23 additions & 0 deletions
23
...ints/inner-delegation/resources/accept_ch_delegation_to_self_iframe_iframe.sub.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<!doctype html> | ||
<meta charset=utf-8> | ||
<body> | ||
<script> | ||
async function test() { | ||
// Step 5 (client-hints/inner-delegation/accept_ch_delegation_to_self.sub.https.html) | ||
let r = await fetch("https://{{host}}:{{ports[https][0]}}/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py"); | ||
if (r.status == 200) { | ||
return "Site 3 fetching Site 1 did recieve sec-ch-device-memory"; | ||
} | ||
r = await fetch("https://{{hosts[alt][]}}:{{ports[https][0]}}/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py"); | ||
if (r.status == 200) { | ||
return "Site 3 fetching Site 2 did recieve sec-ch-device-memory"; | ||
} | ||
r = await fetch("/client-hints/inner-delegation/resources/was-sec-ch-device-memory-received.py"); | ||
if (r.status == 200) { | ||
return "Site 3 fetching Site 3 did recieve sec-ch-device-memory"; | ||
} | ||
return "ch-device-memory is available as expected for self" | ||
} | ||
test().then((message) => window.top.postMessage(message, "*")); | ||
</script> | ||
</body> |
Oops, something went wrong.