tor-browser

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

browser_child_hang.js (1300B)


      1 /* Any copyright is dedicated to the Public Domain.
      2 * http://creativecommons.org/publicdomain/zero/1.0/ */
      3 "use strict";
      4 
      5 //
      6 // Try to open a tab.  This provides code coverage for a few things,
      7 // although currently there's no automated functional test of correctness:
      8 //
      9 // * On opt builds, when the tab is closed and the process exits, it
     10 //   will hang for 3s and the parent will kill it after 2s.
     11 //
     12 // * On debug[*] builds, the parent process will wait until the
     13 //   process exits normally; but also, on browser shutdown, the
     14 //   preallocated content processes will block parent shutdown in
     15 //   WillDestroyCurrentMessageLoop.
     16 //
     17 // [*] Also sanitizer and code coverage builds.
     18 //
     19 
     20 add_task(async function () {
     21  await BrowserTestUtils.withNewTab(
     22    {
     23      gBrowser,
     24      url: "https://example.com/",
     25      forceNewProcess: true,
     26    },
     27    async function () {
     28      // browser.frameLoader.remoteTab.osPid is the child pid; once we
     29      // have a way to get notifications about child process termination
     30      // events, that could be useful.
     31      ok(true, "Browser isn't broken");
     32    }
     33  );
     34  // eslint-disable-next-line mozilla/no-arbitrary-setTimeout
     35  await new Promise(resolve => setTimeout(resolve, 4000));
     36  ok(true, "Still running after child process (hopefully) exited");
     37 });