summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/wasm/serialization/arraybuffer/transfer.window.js
blob: 0258581b1eb0ae56bd851e37ef93b1672b91182d (plain)
1
2
3
4
5
6
7
8
9
10
11
test(() => {
  const buffer = new WebAssembly.Memory({initial: 4}).buffer;
  postMessage(buffer, '*');
}, "Serializing a WebAssembly.Memory-backed ArrayBuffer works");

test(() => {
  const buffer = new WebAssembly.Memory({initial: 4}).buffer;
  assert_throws_js(TypeError, () => {
    postMessage('foo', '*', [buffer]);
  });
}, "Transfering a WebAssembly.Memory-backed ArrayBuffer throws");