mirror of
https://github.com/servo/servo.git
synced 2025-08-31 01:58:23 +01:00
Update web-platform-tests to revision 7a7e16ad8d1a1b843340f47101c0a5c24c9bba57
This commit is contained in:
parent
155fad62b3
commit
d4dc41672a
207 changed files with 3287 additions and 1703 deletions
|
@ -0,0 +1,32 @@
|
|||
<!DOCTYPE html>
|
||||
<script src="/cookies/resources/cookie-helper.sub.js"></script>
|
||||
<script>
|
||||
// Helper to either set or clear some cookies on its own origin, or
|
||||
// (potentially) cross-site on ORIGIN.
|
||||
window.onmessage = e => {
|
||||
var originToUse = ORIGIN;
|
||||
if (e.data.useOwnOrigin)
|
||||
originToUse = self.origin;
|
||||
|
||||
if (e.data.type === "set") {
|
||||
credFetch(originToUse + "/cookies/resources/setSameSite.py?" + e.data.value)
|
||||
.then(_ => {
|
||||
e.source.postMessage({
|
||||
type: "set-complete",
|
||||
value: e.data.value
|
||||
}, "*");
|
||||
});
|
||||
}
|
||||
|
||||
if (e.data.type === "drop") {
|
||||
credFetch(originToUse + "/cookies/resources/dropSameSite.py")
|
||||
.then(_ => {
|
||||
e.source.postMessage({type: "drop-complete"}, "*");
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
window.opener.postMessage({
|
||||
type: "READY"
|
||||
}, "*");
|
||||
</script>
|
|
@ -0,0 +1,30 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8"/>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/cookies/resources/cookie-helper.sub.js"></script>
|
||||
<script>
|
||||
promise_test(async function(t) {
|
||||
let w = window.open(ORIGIN + "/cookies/samesite/resources/puppet.html");
|
||||
await wait_for_message("READY", ORIGIN);
|
||||
let random = "" + Math.random();
|
||||
w.postMessage({type: "set", value: random}, "*");
|
||||
let e = await wait_for_message("set-complete", ORIGIN)
|
||||
assert_dom_cookie("samesite_strict", e.data.value, true);
|
||||
assert_dom_cookie("samesite_lax", e.data.value, true);
|
||||
assert_dom_cookie("samesite_none", e.data.value, true);
|
||||
w.close();
|
||||
}, "Same-site window should be able to set `SameSite=Lax` or `SameSite=Strict` cookies.");
|
||||
|
||||
promise_test(async function(t) {
|
||||
let w = window.open(CROSS_SITE_ORIGIN + "/cookies/samesite/resources/puppet.html");
|
||||
await wait_for_message("READY", CROSS_SITE_ORIGIN);
|
||||
let random = "" + Math.random();
|
||||
w.postMessage({type: "set", value: random}, "*");
|
||||
let e = await wait_for_message("set-complete", CROSS_SITE_ORIGIN);
|
||||
assert_dom_cookie("samesite_strict", e.data.value, false);
|
||||
assert_dom_cookie("samesite_lax", e.data.value, false);
|
||||
assert_dom_cookie("samesite_none", e.data.value, true);
|
||||
w.close();
|
||||
}, "Cross-site window shouldn't be able to set `SameSite=Lax` or `SameSite=Strict` cookies.");
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue