xref: /third_party/node/test/fixtures/wpt/html/webappapis/structured-clone/structured-clone-battery-of-tests-with-transferables.js (revision 1cb0ef41)
  • Home
  • History
  • Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/node/test/fixtures/wpt/html/webappapis/structured-clone/
1structuredCloneBatteryOfTests.push({
2  description: 'ArrayBuffer',
3  async f(runner) {
4    const buffer = new Uint8Array([1]).buffer;
5    const copy = await runner.structuredClone(buffer, [buffer]);
6    assert_equals(buffer.byteLength, 0);
7    assert_equals(copy.byteLength, 1);
8  }
9});
10
11structuredCloneBatteryOfTests.push({
12  description: 'MessagePort',
13  async f(runner) {
14    const {port1, port2} = new MessageChannel();
15    const copy = await runner.structuredClone(port2, [port2]);
16    const msg = new Promise(resolve => port1.onmessage = resolve);
17    copy.postMessage('ohai');
18    assert_equals((await msg).data, 'ohai');
19  }
20});
21
22// TODO: ImageBitmap
23

Indexes created Thu Nov 07 10:32:03 CST 2024