tor-browser

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

test_readableStreams.html (2625B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <head>
      4  <meta charset="utf-8">
      5  <title>Test for ReadableStreams and Fetch</title>
      6  <script src="/tests/SimpleTest/SimpleTest.js"></script>
      7  <script type="application/javascript" src="common_readableStreams.js"></script>
      8  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
      9 </head>
     10 <body>
     11  <script type="application/javascript">
     12 
     13 async function tests() {
     14  await SpecialPowers.pushPrefEnv({
     15    "set": [["dom.caches.testing.enabled", true],
     16            ["dom.quotaManager.testing", true]]
     17  });
     18 
     19  await test_nativeStream(SAME_COMPARTMENT);
     20  await test_nativeStream(IFRAME_COMPARTMENT);
     21  await workify('test_nativeStream');
     22 
     23  await test_timeout(SAME_COMPARTMENT);
     24  await test_timeout(IFRAME_COMPARTMENT);
     25  await workify('test_timeout');
     26 
     27  await test_nonNativeStream(SAME_COMPARTMENT);
     28  await test_nonNativeStream(IFRAME_COMPARTMENT);
     29  await workify('test_nonNativeStream');
     30 
     31  await test_pendingStream(SAME_COMPARTMENT);
     32  await test_pendingStream(IFRAME_COMPARTMENT);
     33  await workify('test_pendingStream');
     34 
     35  await test_noUint8Array(SAME_COMPARTMENT);
     36  await test_noUint8Array(IFRAME_COMPARTMENT);
     37  await workify('test_noUint8Array');
     38 
     39  // Bug 1746646: Make mochitests work with TCP enabled (cookieBehavior = 5)
     40  // Acquire storage access permission here so that the cache works in xorigin
     41  // tests. Otherwise, the iframe containing this page is isolated from
     42  // first-party storage access, which isolates the caches object.
     43  if (isXOrigin) {
     44    SpecialPowers.wrap(document).notifyUserGestureActivation();
     45    await SpecialPowers.addPermission(
     46      "storageAccessAPI",
     47      true,
     48      window.location.href
     49    );
     50    await SpecialPowers.wrap(document).requestStorageAccess();
     51  }
     52 
     53  await test_nativeStream_cache(SAME_COMPARTMENT);
     54  await test_nativeStream_cache(IFRAME_COMPARTMENT);
     55  await workify('test_nativeStream_cache');
     56 
     57  await test_nonNativeStream_cache(SAME_COMPARTMENT);
     58  await test_nonNativeStream_cache(IFRAME_COMPARTMENT);
     59  await workify('test_nonNativeStream_cache');
     60 
     61  await test_codeExecution(SAME_COMPARTMENT);
     62  await test_codeExecution(IFRAME_COMPARTMENT);
     63 
     64  await test_global(SAME_COMPARTMENT);
     65  await test_global(IFRAME_COMPARTMENT);
     66  await workify('test_global');
     67 }
     68 
     69 async function runTests() {
     70  try {
     71    await tests();
     72  } catch (exc) {
     73    ok(false, exc.toString());
     74  } finally {
     75    SimpleTest.finish();
     76  }
     77 }
     78 
     79 SimpleTest.waitForExplicitFinish();
     80 // The iframe starts the tests by calling parent.next() when it loads.
     81  </script>
     82  <iframe src="iframe_readableStreams.html" id="iframe"></iframe>
     83 </body>
     84 </html>