summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/media-source/dedicated-worker/mediasource-worker-handle-transfer.js
blob: 803da44e23c234cb0847754929cf66ef95c00019 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
importScripts('/resources/testharness.js');

test(t => {
  let handle = new MediaSource().handle;
  assert_true(handle instanceof MediaSourceHandle);
  assert_throws_dom('DataCloneError', function() {
    postMessage(handle);
  }, 'serializing handle without transfer');
}, 'MediaSourceHandle serialization without transfer must fail, tested in worker');

test(t => {
  let handle = new MediaSource().handle;
  assert_true(handle instanceof MediaSourceHandle);
  assert_throws_dom('DataCloneError', function() {
    postMessage(handle, [handle, handle]);
  }, 'transferring same handle more than once in same postMessage');
}, 'Same MediaSourceHandle transferred multiple times in single postMessage must fail, tested in worker');

done();