tor-browser

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

run-operation-keep-alive.tentative.https.sub.html (1215B)


      1 <!doctype html>
      2 <script src="/resources/testharness.js"></script>
      3 <script src="/resources/testharnessreport.js"></script>
      4 <script src="/shared-storage/resources/util.js"></script>
      5 
      6 <body>
      7 <script>
      8 'use strict';
      9 
     10 promise_test(async () => {
     11  await addModuleOnce("/shared-storage/resources/simple-module.js");
     12  await sharedStorage.run("operation1", {keepAlive: true});
     13  return sharedStorage.run("operation1", {keepAlive: true});
     14 }, 'run() twice with keepAlive: true');
     15 
     16 promise_test(async () => {
     17  await addModuleOnce("/shared-storage/resources/simple-module.js");
     18  await sharedStorage.run("operation1", {keepAlive: true});
     19  await sharedStorage.run("operation1", {keepAlive: false});
     20  try {
     21    await sharedStorage.run("operation1");
     22  } catch (e) {
     23    assert_equals(e.name, 'OperationError');
     24    assert_equals(e.message, 'The sharedStorage worklet cannot execute' +
     25                             ' further operations because the previous' +
     26                             ' operation did not include the option' +
     27                             ' \'keepAlive: true\'.');
     28    return;
     29  }
     30  assert_unreached("did not reject");
     31 }, 'run() with keepAlive: true, then keepAlive: false, then error');
     32 
     33 </script>
     34 </body>