summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/media-source/dedicated-worker/mediasource-worker-play-terminate-worker.js
blob: b45381819106faf51a0d359d15cb1bf2dfda4042 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// This worker script is intended to be used by the
// mediasource-worker-play-terminate-worker.html test case. The script import
// may itself be terminated by the main thread terminating our context,
// producing a NetworkError, so we catch and ignore a NetworkError here. Note
// that any dependency on globals defined in the imported scripts may result in
// test harness error flakiness if an undefined variable (due to termination
// causing importScripts to fail) is accessed. Hence this script just imports
// and handles import errors, since such nondeterministic worker termination is
// central to the test case.
try {
  importScripts("mediasource-worker-play.js");
} catch(e) {
  if (e.name != "NetworkError")
    throw e;
}