summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/media-source/dedicated-worker/mediasource-worker-must-fail-if-unsupported.js
blob: 69c65f6aa24b449cdf056faf42fb3ccc827889a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
importScripts("/resources/testharness.js");

test(t => {
  // The Window test html conditionally fetches and runs these tests only if the
  // implementation does not have a true-valued static
  // canConstructInDedicatedWorker property on MediaSource in the Window
  // context. So, the implementation must agree on lack of support here in the
  // dedicated worker context.

  // Ensure we're executing in a dedicated worker context.
  assert_true(self instanceof DedicatedWorkerGlobalScope, "self instanceof DedicatedWorkerGlobalScope");
  assert_true(self.MediaSource === undefined, "MediaSource is undefined in DedicatedWorker");
  assert_throws_js(ReferenceError,
                   function() { var ms = new MediaSource(); },
                   "MediaSource construction in DedicatedWorker throws exception");
}, "MediaSource construction in DedicatedWorker context must fail if Window context did not claim MSE supported in DedicatedWorker");

done();