mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Update web-platform-tests to revision b'1d9b01e2fad6af3a057d571b1e088e15fa9bc8e6'
This commit is contained in:
parent
cfef75c99b
commit
bb34f95b33
1683 changed files with 37170 additions and 4252 deletions
|
@ -1,4 +1,5 @@
|
|||
// META: script=helpers.js
|
||||
// META: script=/cookies/resources/cookie-helper.sub.js
|
||||
// META: script=/resources/testdriver.js
|
||||
// META: script=/resources/testdriver-vendor.js
|
||||
'use strict';
|
||||
|
@ -19,22 +20,25 @@ if (!topLevelDocument) {
|
|||
}
|
||||
|
||||
// Common tests to run in all frames.
|
||||
test(() => {
|
||||
promise_test(async () => {
|
||||
assert_not_equals(document.requestStorageAccess, undefined);
|
||||
}, "[" + testPrefix + "] document.requestStorageAccess() should exist on the document interface");
|
||||
|
||||
// Promise tests should all start with the feature in "prompt" state.
|
||||
promise_setup(async () => {
|
||||
await test_driver.set_permission(
|
||||
{ name: 'storage-access' }, 'prompt');
|
||||
});
|
||||
// Most tests need to start with the feature in "prompt" state.
|
||||
async function CommonSetup() {
|
||||
await test_driver.set_permission({ name: 'storage-access' }, 'prompt');
|
||||
}
|
||||
|
||||
promise_test(
|
||||
async t => {
|
||||
await CommonSetup();
|
||||
if (topLevelDocument || !testPrefix.includes('cross-site') ||
|
||||
testPrefix.includes('ABA')) {
|
||||
await document.requestStorageAccess().catch(t.unreached_func(
|
||||
'document.requestStorageAccess() call should resolve in top-level frame or same-site iframe.'));
|
||||
|
||||
assert_true(await CanAccessCookiesViaHTTP(), 'After obtaining storage access, subresource requests from the frame should send and set cookies.');
|
||||
assert_true(CanAccessCookiesViaJS(), 'After obtaining storage access, scripts in the frame should be able to access cookies.');
|
||||
} else {
|
||||
return promise_rejects_dom(
|
||||
t, "NotAllowedError", document.requestStorageAccess(),
|
||||
|
@ -46,6 +50,7 @@ promise_test(
|
|||
|
||||
promise_test(
|
||||
async (t) => {
|
||||
await CommonSetup();
|
||||
await MaybeSetStorageAccess("*", "*", "blocked");
|
||||
await test_driver.set_permission({name: 'storage-access'}, 'granted');
|
||||
t.add_cleanup(async () => {
|
||||
|
@ -54,12 +59,8 @@ promise_test(
|
|||
|
||||
await document.requestStorageAccess();
|
||||
|
||||
await fetch(`${window.location.origin}/cookies/resources/set-cookie.py?name=cookie&path=/&samesite=None&secure=`)
|
||||
.then((resp) => resp.text());
|
||||
const httpCookies = await fetch(`${window.location.origin}/storage-access-api/resources/echo-cookie-header.py`)
|
||||
.then((resp) => resp.text());
|
||||
assert_true(httpCookies.includes('cookie=1'),
|
||||
'After obtaining storage access, subresource requests from the frame should send and set cookies.');
|
||||
assert_true(await CanAccessCookiesViaHTTP(), 'After obtaining storage access, subresource requests from the frame should send and set cookies.');
|
||||
assert_true(CanAccessCookiesViaJS(), 'After obtaining storage access, scripts in the frame should be able to access cookies.');
|
||||
},
|
||||
'[' + testPrefix +
|
||||
'] document.requestStorageAccess() should be resolved with no user gesture when a permission grant exists, and ' +
|
||||
|
@ -68,6 +69,7 @@ promise_test(
|
|||
if (testPrefix.includes('cross-site')) {
|
||||
promise_test(
|
||||
async t => {
|
||||
await CommonSetup();
|
||||
await RunCallbackWithGesture(() => {
|
||||
return promise_rejects_dom(t, "NotAllowedError", document.requestStorageAccess(),
|
||||
"document.requestStorageAccess() call without permission");
|
||||
|
@ -91,7 +93,11 @@ if (testPrefix.includes('cross-site')) {
|
|||
} else {
|
||||
promise_test(
|
||||
async () => {
|
||||
await CommonSetup();
|
||||
await document.requestStorageAccess();
|
||||
|
||||
assert_true(await CanAccessCookiesViaHTTP(), 'After obtaining storage access, subresource requests from the frame should send and set cookies.');
|
||||
assert_true(CanAccessCookiesViaJS(), 'After obtaining storage access, scripts in the frame should be able to access cookies.');
|
||||
},
|
||||
`[${testPrefix}] document.requestStorageAccess() should resolve without permission grant or user gesture`);
|
||||
|
||||
|
@ -101,6 +107,9 @@ if (testPrefix.includes('cross-site')) {
|
|||
{name: 'storage-access'}, 'denied');
|
||||
|
||||
await document.requestStorageAccess();
|
||||
|
||||
assert_true(await CanAccessCookiesViaHTTP(), 'After obtaining storage access, subresource requests from the frame should send and set cookies.');
|
||||
assert_true(CanAccessCookiesViaJS(), 'After obtaining storage access, scripts in the frame should be able to access cookies.');
|
||||
},
|
||||
`[${testPrefix}] document.requestStorageAccess() should resolve with denied permission`);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue