Update web-platform-tests to revision b'1d9b01e2fad6af3a057d571b1e088e15fa9bc8e6'

This commit is contained in:
WPT Sync Bot 2023-04-07 01:27:34 +00:00
parent cfef75c99b
commit bb34f95b33
1683 changed files with 37170 additions and 4252 deletions

View file

@ -57,18 +57,18 @@ function RunTestsInNestedIFrame(sourceURL) {
}, true);
}
function RunRequestStorageAccessInDetachedFrame() {
function CreateDetachedFrame() {
const frame = document.createElement('iframe');
document.body.append(frame);
const inner_doc = frame.contentDocument;
frame.remove();
return inner_doc.requestStorageAccess();
return inner_doc;
}
function RunRequestStorageAccessViaDomParser() {
function CreateDocumentViaDOMParser() {
const parser = new DOMParser();
const doc = parser.parseFromString('<html></html>', 'text/html');
return doc.requestStorageAccess();
return doc;
}
function RunCallbackWithGesture(callback) {
@ -150,6 +150,35 @@ async function CanFrameWriteCookies(frame, keep_after_writing = false) {
return can_write;
}
// Tests whether the current frame can read and write cookies via HTTP headers.
// This deletes, writes, reads, then deletes a cookie named "cookie".
async function CanAccessCookiesViaHTTP() {
await create_cookie(window.location.origin, "cookie", "1", "samesite=None;Secure");
const http_cookies = await fetch(`${window.location.origin}/storage-access-api/resources/echo-cookie-header.py`)
.then((resp) => resp.text());
const can_access = cookieStringHasCookie("cookie", "1", http_cookies);
erase_cookie_from_js("cookie", "SameSite=None;Secure;Path=/");
return can_access;
}
// Tests whether the current frame can read and write cookies via
// document.cookie. This deletes, writes, reads, then deletes a cookie named
// "cookie".
function CanAccessCookiesViaJS() {
erase_cookie_from_js("cookie", "SameSite=None;Secure;Path=/");
assert_false(cookieStringHasCookie("cookie", "1", document.cookie));
document.cookie = "cookie=1;SameSite=None;Secure;Path=/";
const can_access = cookieStringHasCookie("cookie", "1", document.cookie);
erase_cookie_from_js("cookie", "SameSite=None;Secure;Path=/");
assert_false(cookieStringHasCookie("cookie", "1", document.cookie));
return can_access;
}
// Reads cookies via the `httpCookies` variable in the given frame.
function GetHTTPCookiesFromFrame(frame) {
return PostMessageAndAwaitReply(