tor-browser

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

browser_browser_toolbox_shouldprocessupdates.js (1553B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 // There are shutdown issues for which multiple rejections are left uncaught.
      5 // See bug 1018184 for resolving these issues.
      6 const { PromiseTestUtils } = ChromeUtils.importESModule(
      7  "resource://testing-common/PromiseTestUtils.sys.mjs"
      8 );
      9 PromiseTestUtils.allowMatchingRejectionsGlobally(/File closed/);
     10 
     11 // On debug test machine, it takes about 50s to run the test.
     12 requestLongerTimeout(4);
     13 
     14 add_task(async function () {
     15  // Running devtools should prevent processing updates.  By setting this
     16  // environment variable and then inspecting it from the launched devtools
     17  // process, we can witness update processing being skipped.
     18  Services.env.set("MOZ_TEST_SHOULD_NOT_PROCESS_UPDATES", "1");
     19 
     20  const ToolboxTask = await initBrowserToolboxTask();
     21  await ToolboxTask.importFunctions({});
     22 
     23  let result = await ToolboxTask.spawn(null, async () => {
     24    const result = {
     25      exists: Services.env.exists("MOZ_TEST_SHOULD_NOT_PROCESS_UPDATES"),
     26      get: Services.env.get("MOZ_TEST_SHOULD_NOT_PROCESS_UPDATES"),
     27    };
     28    // Log so that we have a hope of debugging.
     29    console.log("result", result);
     30    return JSON.stringify(result);
     31  });
     32 
     33  result = JSON.parse(result);
     34  ok(result.exists, "MOZ_TEST_SHOULD_NOT_PROCESS_UPDATES exists in subprocess");
     35  is(
     36    result.get,
     37    "ShouldNotProcessUpdates(): DevToolsLaunching",
     38    "MOZ_TEST_SHOULD_NOT_PROCESS_UPDATES is correct in subprocess"
     39  );
     40 
     41  await ToolboxTask.destroy();
     42 });