Update web-platform-tests to revision 7a7e16ad8d1a1b843340f47101c0a5c24c9bba57

This commit is contained in:
WPT Sync Bot 2019-04-23 21:37:32 -04:00
parent 155fad62b3
commit d4dc41672a
207 changed files with 3287 additions and 1703 deletions

View file

@ -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>

View file

@ -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>