mirror of
https://github.com/servo/servo.git
synced 2025-08-11 16:35:33 +01:00
Update web-platform-tests to revision b'c9f81de4242294a0d694ecd5a63155acfe6bf49a'
This commit is contained in:
parent
8c1703219d
commit
632afc64ae
403 changed files with 7449 additions and 5597 deletions
|
@ -12,7 +12,7 @@
|
|||
// don't want to recurse forever.
|
||||
const {testPrefix, topLevelDocument} = processQueryParams();
|
||||
|
||||
if (window !== window.top) {
|
||||
if (!topLevelDocument) {
|
||||
// WPT synthesizes a top-level HTML test for this JS file, and in that case we
|
||||
// don't want to, or need to, call set_test_context.
|
||||
test_driver.set_test_context(window.top);
|
||||
|
@ -30,26 +30,37 @@ promise_setup(async () => {
|
|||
});
|
||||
|
||||
promise_test(async t => {
|
||||
if (topLevelDocument) {
|
||||
if (topLevelDocument || testPrefix.includes('same-origin')) {
|
||||
await document.requestStorageAccess()
|
||||
.catch(t.unreached_func("document.requestStorageAccess() call should resolve in top-level frame"));
|
||||
.catch(t.unreached_func("document.requestStorageAccess() call should resolve in top-level frame or same-origin iframe."));
|
||||
} else {
|
||||
return promise_rejects_dom(t, "NotAllowedError", document.requestStorageAccess(),
|
||||
"document.requestStorageAccess() call without user gesture");
|
||||
"document.requestStorageAccess() call without user gesture.");
|
||||
}
|
||||
}, "[" + testPrefix + "] document.requestStorageAccess() should resolve in top-level frame or otherwise reject with a NotAllowedError with no user gesture");
|
||||
}, "[" + testPrefix + "] document.requestStorageAccess() should resolve in top-level frame or same-origin iframe, otherwise reject with a NotAllowedError with no user gesture.");
|
||||
|
||||
promise_test(
|
||||
async () => {
|
||||
await test_driver.set_permission(
|
||||
{name: 'storage-access'}, 'granted');
|
||||
async (t) => {
|
||||
await MaybeSetStorageAccess("*", "*", "blocked");
|
||||
await test_driver.set_permission({name: 'storage-access'}, 'granted');
|
||||
t.add_cleanup(async () => {
|
||||
await test_driver.delete_all_cookies();
|
||||
});
|
||||
|
||||
await RunCallbackWithGesture(() => document.requestStorageAccess());
|
||||
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.');
|
||||
},
|
||||
'[' + testPrefix +
|
||||
'] document.requestStorageAccess() should be resolved when called properly with a user gesture');
|
||||
'] document.requestStorageAccess() should be resolved with no user gesture when a permission grant exists, and ' +
|
||||
'should allow cookie access');
|
||||
|
||||
if (testPrefix == 'cross-origin-frame' || testPrefix == 'nested-cross-origin-frame') {
|
||||
if (!topLevelDocument && !testPrefix.includes('same-origin')) {
|
||||
promise_test(
|
||||
async t => {
|
||||
await RunCallbackWithGesture(() => {
|
||||
|
@ -72,4 +83,19 @@ if (testPrefix == 'cross-origin-frame' || testPrefix == 'nested-cross-origin-fra
|
|||
},
|
||||
'[' + testPrefix +
|
||||
'] document.requestStorageAccess() should be rejected with a NotAllowedError with denied permission');
|
||||
} else {
|
||||
promise_test(
|
||||
async () => {
|
||||
await document.requestStorageAccess();
|
||||
},
|
||||
`[${testPrefix}] document.requestStorageAccess() should resolve without permission grant or user gesture`);
|
||||
|
||||
promise_test(
|
||||
async () => {
|
||||
await test_driver.set_permission(
|
||||
{name: 'storage-access'}, 'denied');
|
||||
|
||||
await document.requestStorageAccess();
|
||||
},
|
||||
`[${testPrefix}] document.requestStorageAccess() should resolve with denied permission`);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue