mirror of
https://github.com/servo/servo.git
synced 2025-08-25 07:08:21 +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
|
@ -20,10 +20,6 @@
|
|||
|
||||
// Set the global cookie name.
|
||||
window.HTTP_COOKIE = "cookie_via_http";
|
||||
|
||||
// If we're not on |HOST|, move ourselves there:
|
||||
if (window.location.hostname != HOST)
|
||||
window.location.hostname = HOST;
|
||||
})();
|
||||
|
||||
// A tiny helper which returns the result of fetching |url| with credentials.
|
||||
|
@ -120,27 +116,44 @@ window.SameSiteStatus = {
|
|||
STRICT: "strict"
|
||||
};
|
||||
|
||||
const wait_for_message = (type, origin) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
window.addEventListener('message', e => {
|
||||
if (e.origin != origin) {
|
||||
reject("Message from unexpected origin in wait_for_message:" + e.origin);
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.data.type && e.data.type === type)
|
||||
resolve(e);
|
||||
}, { once: true });
|
||||
});
|
||||
};
|
||||
|
||||
// Reset SameSite test cookies on |origin|. If |origin| matches `self.origin`, assert
|
||||
// (via `document.cookie`) that they were properly removed and reset.
|
||||
function resetSameSiteCookies(origin, value) {
|
||||
return credFetch(origin + "/cookies/resources/dropSameSite.py")
|
||||
.then(_ => {
|
||||
if (origin == self.origin) {
|
||||
assert_dom_cookie("samesite_strict", value, false);
|
||||
assert_dom_cookie("samesite_lax", value, false);
|
||||
assert_dom_cookie("samesite_none", value, false);
|
||||
}
|
||||
})
|
||||
.then(_ => {
|
||||
return credFetch(origin + "/cookies/resources/setSameSite.py?" + value)
|
||||
.then(_ => {
|
||||
if (origin == self.origin) {
|
||||
assert_dom_cookie("samesite_strict", value, true);
|
||||
assert_dom_cookie("samesite_lax", value, true);
|
||||
assert_dom_cookie("samesite_none", value, true);
|
||||
}
|
||||
})
|
||||
})
|
||||
async function resetSameSiteCookies(origin, value) {
|
||||
let w = window.open(origin + "/cookies/samesite/resources/puppet.html");
|
||||
try {
|
||||
await wait_for_message("READY", origin);
|
||||
w.postMessage({type: "drop", useOwnOrigin: true}, "*");
|
||||
await wait_for_message("drop-complete", origin);
|
||||
if (origin == self.origin) {
|
||||
assert_dom_cookie("samesite_strict", value, false);
|
||||
assert_dom_cookie("samesite_lax", value, false);
|
||||
assert_dom_cookie("samesite_none", value, false);
|
||||
}
|
||||
|
||||
w.postMessage({type: "set", value: value, useOwnOrigin: true}, "*");
|
||||
await wait_for_message("set-complete", origin);
|
||||
if (origin == self.origin) {
|
||||
assert_dom_cookie("samesite_strict", value, true);
|
||||
assert_dom_cookie("samesite_lax", value, true);
|
||||
assert_dom_cookie("samesite_none", value, true);
|
||||
}
|
||||
} finally {
|
||||
w.close();
|
||||
}
|
||||
}
|
||||
|
||||
// Given an |expectedStatus| and |expectedValue|, assert the |cookies| contains the
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue