tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

mediasource-worker-objecturl.js (1550B)


      1 importScripts("/resources/testharness.js");
      2 
      3 test(t => {
      4  // The Window test html conditionally fetches and runs these tests only if the
      5  // implementation exposes a true-valued static canConstructInDedicatedWorker
      6  // attribute on MediaSource in the Window context. So, the implementation must
      7  // agree on support here in the dedicated worker context.
      8 
      9  // Ensure we're executing in a dedicated worker context.
     10  assert_true(self instanceof DedicatedWorkerGlobalScope, "self instanceof DedicatedWorkerGlobalScope");
     11  assert_true(MediaSource.hasOwnProperty("canConstructInDedicatedWorker", "DedicatedWorker MediaSource hasOwnProperty 'canConstructInDedicatedWorker'"));
     12  assert_true(MediaSource.canConstructInDedicatedWorker, "DedicatedWorker MediaSource.canConstructInDedicatedWorker");
     13 }, "MediaSource in DedicatedWorker context must have true-valued canConstructInDedicatedWorker if Window context had it");
     14 
     15 test(t => {
     16  const ms = new MediaSource();
     17  assert_equals(ms.readyState, "closed");
     18 }, "MediaSource construction succeeds with initial closed readyState in DedicatedWorker");
     19 
     20 test(t => {
     21  const ms = new MediaSource();
     22  const url = URL.createObjectURL(ms);
     23 }, "URL.createObjectURL(mediaSource) in DedicatedWorker does not throw exception");
     24 
     25 test(t => {
     26  const ms = new MediaSource();
     27  const url1 = URL.createObjectURL(ms);
     28  const url2 = URL.createObjectURL(ms);
     29  URL.revokeObjectURL(url1);
     30  URL.revokeObjectURL(url2);
     31 }, "URL.revokeObjectURL(mediaSource) in DedicatedWorker with two url for same MediaSource");
     32 
     33 done();