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 authored Aug 6, 2019
1 parent 7a669f4 commit aecedb5
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 aecedb5

Please sign in to comment.