-
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.
[Clear-Site-Data] Ensure Clear-Site-Data overwrites Accept-CH and Cri…
…tical-CH headers Per the spec: w3c/webappsec-clear-site-data#74 We must not store new client hints if we are already clearing them. Bug: 1458394 Change-Id: Ie82e60175784de52b6a3ac7756af31949c89df0c
- Loading branch information
1 parent
13ef5f8
commit 9355dbb
Showing
21 changed files
with
266 additions
and
0 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
24 changes: 24 additions & 0 deletions
24
client-hints/clear-site-data/set-client-hints-after-clear-all.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,24 @@ | ||
<!DOCTYPE html> | ||
<body> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script> | ||
// Here's the set-up for this test: | ||
// Step 1 (first window) Set client hints in the same header that clears them. | ||
// Step 2 (first window) Open second window. | ||
// Step 3 (second window) Message first window about client hints sent. | ||
// Step 4 (first window) Asserts client hints not sent. | ||
async_test(t => { | ||
// Step 4 | ||
window.addEventListener("message", t.step_func(e => { | ||
assert_equals(e.data, "MissingDeviceMemory"); | ||
t.done(); | ||
}), {once: true}); | ||
|
||
// Step 2 | ||
new_window = window.open("/client-hints/clear-site-data/resources/check-client-hints.py"); | ||
t.add_cleanup(new_window.close); | ||
}, "Setting client hints after Clear-Site-Data for all shouldn't allow the client hints to take."); | ||
</script> | ||
</body> | ||
</html> |
2 changes: 2 additions & 0 deletions
2
client-hints/clear-site-data/set-client-hints-after-clear-all.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 @@ | ||
Clear-Site-Data: "*" | ||
Accept-CH: Sec-CH-Device-Memory |
24 changes: 24 additions & 0 deletions
24
client-hints/clear-site-data/set-client-hints-after-clear-cache.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,24 @@ | ||
<!DOCTYPE html> | ||
<body> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script> | ||
// Here's the set-up for this test: | ||
// Step 1 (first window) Set client hints in the same header that clears them. | ||
// Step 2 (first window) Open second window. | ||
// Step 3 (second window) Message first window about client hints sent. | ||
// Step 4 (first window) Asserts client hints not sent. | ||
async_test(t => { | ||
// Step 4 | ||
window.addEventListener("message", t.step_func(e => { | ||
assert_equals(e.data, "MissingDeviceMemory"); | ||
t.done(); | ||
}), {once: true}); | ||
|
||
// Step 2 | ||
new_window = window.open("/client-hints/clear-site-data/resources/check-client-hints.py"); | ||
t.add_cleanup(new_window.close); | ||
}, "Setting client hints after Clear-Site-Data for cache shouldn't allow the client hints to take."); | ||
</script> | ||
</body> | ||
</html> |
2 changes: 2 additions & 0 deletions
2
client-hints/clear-site-data/set-client-hints-after-clear-cache.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 @@ | ||
Clear-Site-Data: "cache" | ||
Accept-CH: Sec-CH-Device-Memory |
24 changes: 24 additions & 0 deletions
24
client-hints/clear-site-data/set-client-hints-after-clear-client-hints.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,24 @@ | ||
<!DOCTYPE html> | ||
<body> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script> | ||
// Here's the set-up for this test: | ||
// Step 1 (first window) Set client hints in the same header that clears them. | ||
// Step 2 (first window) Open second window. | ||
// Step 3 (second window) Message first window about client hints sent. | ||
// Step 4 (first window) Asserts client hints not sent. | ||
async_test(t => { | ||
// Step 4 | ||
window.addEventListener("message", t.step_func(e => { | ||
assert_equals(e.data, "MissingDeviceMemory"); | ||
t.done(); | ||
}), {once: true}); | ||
|
||
// Step 2 | ||
new_window = window.open("/client-hints/clear-site-data/resources/check-client-hints.py"); | ||
t.add_cleanup(new_window.close); | ||
}, "Setting client hints after Clear-Site-Data for client hints shouldn't allow the client hints to take."); | ||
</script> | ||
</body> | ||
</html> |
2 changes: 2 additions & 0 deletions
2
client-hints/clear-site-data/set-client-hints-after-clear-client-hints.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 @@ | ||
Clear-Site-Data: "clientHints" | ||
Accept-CH: Sec-CH-Device-Memory |
24 changes: 24 additions & 0 deletions
24
client-hints/clear-site-data/set-client-hints-after-clear-cookies.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,24 @@ | ||
<!DOCTYPE html> | ||
<body> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script> | ||
// Here's the set-up for this test: | ||
// Step 1 (first window) Set client hints in the same header that clears them. | ||
// Step 2 (first window) Open second window. | ||
// Step 3 (second window) Message first window about client hints sent. | ||
// Step 4 (first window) Asserts client hints not sent. | ||
async_test(t => { | ||
// Step 4 | ||
window.addEventListener("message", t.step_func(e => { | ||
assert_equals(e.data, "MissingDeviceMemory"); | ||
t.done(); | ||
}), {once: true}); | ||
|
||
// Step 2 | ||
new_window = window.open("/client-hints/clear-site-data/resources/check-client-hints.py"); | ||
t.add_cleanup(new_window.close); | ||
}, "Setting client hints after Clear-Site-Data for cookies shouldn't allow the client hints to take."); | ||
</script> | ||
</body> | ||
</html> |
2 changes: 2 additions & 0 deletions
2
client-hints/clear-site-data/set-client-hints-after-clear-cookies.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 @@ | ||
Clear-Site-Data: "cookies" | ||
Accept-CH: Sec-CH-Device-Memory |
24 changes: 24 additions & 0 deletions
24
client-hints/clear-site-data/set-client-hints-after-clear-storage.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,24 @@ | ||
<!DOCTYPE html> | ||
<body> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script> | ||
// Here's the set-up for this test: | ||
// Step 1 (first window) Set client hints in the same header that clears them. | ||
// Step 2 (first window) Open second window. | ||
// Step 3 (second window) Message first window about client hints sent. | ||
// Step 4 (first window) Asserts client hints sent. | ||
async_test(t => { | ||
// Step 4 | ||
window.addEventListener("message", t.step_func(e => { | ||
assert_equals(e.data, "HadDeviceMemory"); | ||
t.done(); | ||
}), {once: true}); | ||
|
||
// Step 2 | ||
new_window = window.open("/client-hints/clear-site-data/resources/check-client-hints.py"); | ||
t.add_cleanup(new_window.close); | ||
}, "Setting client hints after Clear-Site-Data for storage should allow the client hints to take."); | ||
</script> | ||
</body> | ||
</html> |
2 changes: 2 additions & 0 deletions
2
client-hints/clear-site-data/set-client-hints-after-clear-storage.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 @@ | ||
Clear-Site-Data: "storage" | ||
Accept-CH: Sec-CH-Device-Memory |
24 changes: 24 additions & 0 deletions
24
client-hints/clear-site-data/set-critical-client-hints-after-clear-all.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,24 @@ | ||
<!DOCTYPE html> | ||
<body> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script> | ||
// Here's the set-up for this test: | ||
// Step 1 (first window) Set client hints in the same header that clears them. | ||
// Step 2 (first window) Open second window. | ||
// Step 3 (second window) Message first window about client hints sent. | ||
// Step 4 (first window) Asserts client hints not sent. | ||
async_test(t => { | ||
// Step 4 | ||
window.addEventListener("message", t.step_func(e => { | ||
assert_equals(e.data, "MissingDeviceMemory"); | ||
t.done(); | ||
}), {once: true}); | ||
|
||
// Step 2 | ||
new_window = window.open("/client-hints/clear-site-data/resources/check-client-hints.py"); | ||
t.add_cleanup(new_window.close); | ||
}, "Setting critical client hints after Clear-Site-Data for all shouldn't allow the client hints to take."); | ||
</script> | ||
</body> | ||
</html> |
3 changes: 3 additions & 0 deletions
3
client-hints/clear-site-data/set-critical-client-hints-after-clear-all.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,3 @@ | ||
Clear-Site-Data: "*" | ||
Accept-CH: Sec-CH-Device-Memory | ||
Critical-CH: Sec-CH-Device-Memory |
24 changes: 24 additions & 0 deletions
24
client-hints/clear-site-data/set-critical-client-hints-after-clear-cache.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,24 @@ | ||
<!DOCTYPE html> | ||
<body> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script> | ||
// Here's the set-up for this test: | ||
// Step 1 (first window) Set client hints in the same header that clears them. | ||
// Step 2 (first window) Open second window. | ||
// Step 3 (second window) Message first window about client hints sent. | ||
// Step 4 (first window) Asserts client hints not sent. | ||
async_test(t => { | ||
// Step 4 | ||
window.addEventListener("message", t.step_func(e => { | ||
assert_equals(e.data, "MissingDeviceMemory"); | ||
t.done(); | ||
}), {once: true}); | ||
|
||
// Step 2 | ||
new_window = window.open("/client-hints/clear-site-data/resources/check-client-hints.py"); | ||
t.add_cleanup(new_window.close); | ||
}, "Setting critical client hints after Clear-Site-Data for cache shouldn't allow the client hints to take."); | ||
</script> | ||
</body> | ||
</html> |
3 changes: 3 additions & 0 deletions
3
client-hints/clear-site-data/set-critical-client-hints-after-clear-cache.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,3 @@ | ||
Clear-Site-Data: "cache" | ||
Accept-CH: Sec-CH-Device-Memory | ||
Critical-CH: Sec-CH-Device-Memory |
24 changes: 24 additions & 0 deletions
24
client-hints/clear-site-data/set-critical-client-hints-after-clear-client-hints.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,24 @@ | ||
<!DOCTYPE html> | ||
<body> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script> | ||
// Here's the set-up for this test: | ||
// Step 1 (first window) Set client hints in the same header that clears them. | ||
// Step 2 (first window) Open second window. | ||
// Step 3 (second window) Message first window about client hints sent. | ||
// Step 4 (first window) Asserts client hints not sent. | ||
async_test(t => { | ||
// Step 4 | ||
window.addEventListener("message", t.step_func(e => { | ||
assert_equals(e.data, "MissingDeviceMemory"); | ||
t.done(); | ||
}), {once: true}); | ||
|
||
// Step 2 | ||
new_window = window.open("/client-hints/clear-site-data/resources/check-client-hints.py"); | ||
t.add_cleanup(new_window.close); | ||
}, "Setting critical client hints after Clear-Site-Data for client hints shouldn't allow the client hints to take."); | ||
</script> | ||
</body> | ||
</html> |
3 changes: 3 additions & 0 deletions
3
...nts/clear-site-data/set-critical-client-hints-after-clear-client-hints.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,3 @@ | ||
Clear-Site-Data: "clientHints" | ||
Accept-CH: Sec-CH-Device-Memory | ||
Critical-CH: Sec-CH-Device-Memory |
24 changes: 24 additions & 0 deletions
24
client-hints/clear-site-data/set-critical-client-hints-after-clear-cookies.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,24 @@ | ||
<!DOCTYPE html> | ||
<body> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script> | ||
// Here's the set-up for this test: | ||
// Step 1 (first window) Set client hints in the same header that clears them. | ||
// Step 2 (first window) Open second window. | ||
// Step 3 (second window) Message first window about client hints sent. | ||
// Step 4 (first window) Asserts client hints not sent. | ||
async_test(t => { | ||
// Step 4 | ||
window.addEventListener("message", t.step_func(e => { | ||
assert_equals(e.data, "MissingDeviceMemory"); | ||
t.done(); | ||
}), {once: true}); | ||
|
||
// Step 2 | ||
new_window = window.open("/client-hints/clear-site-data/resources/check-client-hints.py"); | ||
t.add_cleanup(new_window.close); | ||
}, "Setting critical client hints after Clear-Site-Data for cookies shouldn't allow the client hints to take."); | ||
</script> | ||
</body> | ||
</html> |
3 changes: 3 additions & 0 deletions
3
...nt-hints/clear-site-data/set-critical-client-hints-after-clear-cookies.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,3 @@ | ||
Clear-Site-Data: "cookies" | ||
Accept-CH: Sec-CH-Device-Memory | ||
Critical-CH: Sec-CH-Device-Memory |
24 changes: 24 additions & 0 deletions
24
client-hints/clear-site-data/set-critical-client-hints-after-clear-storage.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,24 @@ | ||
<!DOCTYPE html> | ||
<body> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script> | ||
// Here's the set-up for this test: | ||
// Step 1 (first window) Set client hints in the same header that clears them. | ||
// Step 2 (first window) Open second window. | ||
// Step 3 (second window) Message first window about client hints sent. | ||
// Step 4 (first window) Asserts client hints sent. | ||
async_test(t => { | ||
// Step 4 | ||
window.addEventListener("message", t.step_func(e => { | ||
assert_equals(e.data, "HadDeviceMemory"); | ||
t.done(); | ||
}), {once: true}); | ||
|
||
// Step 2 | ||
new_window = window.open("/client-hints/clear-site-data/resources/check-client-hints.py"); | ||
t.add_cleanup(new_window.close); | ||
}, "Setting critical client hints after Clear-Site-Data for storage should allow the client hints to take."); | ||
</script> | ||
</body> | ||
</html> |
3 changes: 3 additions & 0 deletions
3
...nt-hints/clear-site-data/set-critical-client-hints-after-clear-storage.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,3 @@ | ||
Clear-Site-Data: "storage" | ||
Accept-CH: Sec-CH-Device-Memory | ||
Critical-CH: Sec-CH-Device-Memory |