Skip to content

Commit

Permalink
HTML: ensure serializing SharedArrayBuffer throws without COOP+COEP
Browse files Browse the repository at this point in the history
  • Loading branch information
annevk committed Jul 12, 2019
1 parent 9919d0f commit 69de2b9
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
test(() => {
const sab = new SharedArrayBuffer();
const channel = new MessageChannel();
assert_throws("DataCloneError", () => channel.port1.postMessage(sab));
}, "SharedArrayBuffer over MessageChannel without COOP+COEP");

test(() => {
const sab = new SharedArrayBuffer();
const channel = new BroadcastChannel("Is mir egal");
assert_throws("DataCloneError", () => channel.postMessage(sab));
}, "SharedArrayBuffer over BroadcastChannel without COOP+COEP");

if (self.GLOBAL.isWindow()) {
test(() => {
const sab = new SharedArrayBuffer();
assert_throws("DataCloneError", () => self.postMessage(sab));
}, "SharedArrayBuffer over postMessage() without COOP+COEP");
}

0 comments on commit 69de2b9

Please sign in to comment.