Bug 1705236 [wpt PR 28492] - NativeIO: Enable 3rd party cookie block on capacity allocation, a=testonly

Automatic update from web-platform-tests
NativeIO: Enable 3rd party cookie block on capacity allocation

This change adds a check to all filesystem-like methods
(requestCapacity, releaseCapacity, getRemainingCapacity) that makes them
throw when 3rd party cookies are blocked and the call came from a 3rd
party context (e.g. from within an iframe).

This CL also adds a test that NativeIO does not crash the renderer when
accessed from destroyed execution contexts.

Bug: 1137788
Change-Id: Ifb0fcdae0dad0fc2eae5e061a6800520dffcef14
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2821323
Reviewed-by: Marijn Kruisselbrink <mek@chromium.org>
Reviewed-by: Christian Dullweber <dullweber@chromium.org>
Commit-Queue: Richard Stotz <rstz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#872768}

--

wpt-commits: 1441bb6cc4af8eb81a614873456a7a9c8d885854
wpt-pr: 28492
This commit is contained in:
Richard Stotz 2021-04-23 10:17:59 +00:00 коммит произвёл moz-wptsync-bot
Родитель c682a1f554
Коммит e052f8a735
1 изменённых файлов: 37 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,37 @@
// META: title=NativeIO API: Do not crash in detached iframes.
// META: global=window
function add_iframe(test, src, sandbox) {
const iframe = document.createElement("iframe");
document.body.appendChild(iframe);
return iframe;
}
promise_test(async testCase => {
const iframe = add_iframe();
const iframe_sfa = iframe.contentWindow.storageFoundation;
const frameDOMException = iframe.contentWindow.DOMException;
iframe.remove();
await promise_rejects_dom(
testCase, 'InvalidStateError', frameDOMException,
iframe_sfa.getAll());
await promise_rejects_dom(
testCase, 'InvalidStateError', frameDOMException,
iframe_sfa.open('test_file'));
await promise_rejects_dom(
testCase, 'InvalidStateError', frameDOMException,
iframe_sfa.rename('test_file', 'test'));
await promise_rejects_dom(
testCase, 'InvalidStateError', frameDOMException,
iframe_sfa.delete('test'));
await promise_rejects_dom(
testCase, 'InvalidStateError', frameDOMException,
iframe_sfa.requestCapacity(10));
await promise_rejects_dom(
testCase, 'InvalidStateError', frameDOMException,
iframe_sfa.releaseCapacity(10));
await promise_rejects_dom(
testCase, 'InvalidStateError', frameDOMException,
iframe_sfa.getRemainingCapacity());
}, 'storageFoundation must return an error when called from detached iframes.');