tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

no-coop-coep.https.any.js (1515B)


      1 // META: global=window,worker
      2 
      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");
      8 
      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");
     15 
     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");
     22 
     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");
     29 }
     30 
     31 test(() => {
     32  assert_false(self.crossOriginIsolated);
     33 }, "Bonus: self.crossOriginIsolated");