Bug 1918268 - updated libwebrtc patch stack
[gecko.git] / testing / web-platform / tests / html / infrastructure / safe-passing-of-structured-data / shared-array-buffers / no-coop-coep.https.any.js
blob0db16fd6f703acf82d5ea54b73a1e83aa24665a0
1 // META: global=window,worker
3 test(() => {
4   // See https://github.com/whatwg/html/issues/5380 for why not `new SharedArrayBuffer()`
5   assert_equals(globalThis.SharedArrayBuffer, undefined);
6   assert_false("SharedArrayBuffer" in globalThis);
7 }, "SharedArrayBuffer constructor does not exist without COOP+COEP");
9 test(() => {
10   // See https://github.com/whatwg/html/issues/5380 for why not `new SharedArrayBuffer()`
11   const sab = new WebAssembly.Memory({ shared:true, initial:1, maximum:1 }).buffer;
12   const channel = new MessageChannel();
13   assert_throws_dom("DataCloneError", () => channel.port1.postMessage(sab));
14 }, "SharedArrayBuffer over MessageChannel without COOP+COEP");
16 test(() => {
17   // See https://github.com/whatwg/html/issues/5380 for why not `new SharedArrayBuffer()`
18   const sab = new WebAssembly.Memory({ shared:true, initial:1, maximum:1 }).buffer;
19   const channel = new BroadcastChannel("Is mir egal");
20   assert_throws_dom("DataCloneError", () => channel.postMessage(sab));
21 }, "SharedArrayBuffer over BroadcastChannel without COOP+COEP");
23 if (self.GLOBAL.isWindow()) {
24   test(() => {
25     // See https://github.com/whatwg/html/issues/5380 for why not `new SharedArrayBuffer()`
26     const sab = new WebAssembly.Memory({ shared:true, initial:1, maximum:1 }).buffer;
27     assert_throws_dom("DataCloneError", () => self.postMessage(sab));
28   }, "SharedArrayBuffer over postMessage() without COOP+COEP");
31 test(() => {
32   assert_false(self.crossOriginIsolated);
33 }, "Bonus: self.crossOriginIsolated");