Bug 1706884 [wpt PR 28637] - Make web test for SAB in IndexedDB a WPT, a=testonly

Automatic update from web-platform-tests
Make web test for SAB in IndexedDB a WPT

The web_test checking that a SharedArrayBuffer cannot be serialized
into IndexedDB was failing because it was served inside a
non-cross-origin-isolated page, which could not create a
SharedArrayBuffer.

This CL turns that into a Web Platform Test and adds the appropriate
COOP and COEP header which make the page cross-origin-isolated,
enabling instantiation of SharedArrayBuffer.

Bug: 1194557
Change-Id: I6854a76612d237b82cb020e317459157907e77f6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2846500
Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
Commit-Queue: Antonio Sartori <antoniosartori@chromium.org>
Cr-Commit-Position: refs/heads/master@{#875562}

--

wpt-commits: f1709df56f753c1932c4dd7969643fac1973265f
wpt-pr: 28637
This commit is contained in:
Antonio Sartori 2021-04-24 09:19:25 +00:00 коммит произвёл moz-wptsync-bot
Родитель 4b789cc6d8
Коммит 97c92fd3b5
2 изменённых файлов: 30 добавлений и 0 удалений

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

@ -0,0 +1,28 @@
<!DOCTYPE html>
<title>IndexedDB: Attempting to serialize a SharedArrayBuffer should throw</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support.js"></script>
<script>
async_test(function(t) {
// The SAB constructor throws if the page is not cross-origin-isolated.
assert_true(self.crossOriginIsolated,
"The page is served with COOP and COEP, it should be cross-origin-isolated.");
let open_rq = createdb(t);
open_rq.onupgradeneeded = function(e) {
let db = e.target.result;
let objStore = db.createObjectStore("test", { keyPath:"pKey" });
let sab = new SharedArrayBuffer(256);
let rq;
assert_throws_dom("DataCloneError", () => {
rq = objStore.put({sab: sab}, 'key');
});
assert_equals(rq, undefined);
t.done();
};
});
</script>

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

@ -0,0 +1,2 @@
Cross-Origin-Embedder-Policy: require-corp
Cross-Origin-Opener-Policy: same-origin