tor-browser

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

browser_windowless_troubleshoot_crash.js (1420B)


      1 add_task(async function test_windowlessBrowserTroubleshootCrash() {
      2  let webNav = Services.appShell.createWindowlessBrowser(false);
      3 
      4  let loadURIOptions = {
      5    triggeringPrincipal: Services.scriptSecurityManager.createNullPrincipal({}),
      6  };
      7 
      8  // will synchronously commit to the initial about:blank and finish the load
      9  webNav.loadURI(Services.io.newURI("about:blank"), loadURIOptions);
     10 
     11  is(webNav.document.location.href, "about:blank", "location is about:blank");
     12  is(webNav.document.readyState, "complete", "readyState is complete");
     13 
     14  let winUtils = webNav.document.defaultView.windowUtils;
     15  try {
     16    let layerManager = winUtils.layerManagerType;
     17    ok(
     18      ["WebRender (Software)", "Fallback"].includes(layerManager),
     19      "windowless browser's layerManagerType should be 'WebRender (Software)' or 'Fallback': " +
     20        layerManager
     21    );
     22  } catch (e) {
     23    // The windowless browser may not have a layermanager at all yet, and that's ok.
     24    // The troubleshooting code similarly skips over windows with no layer managers.
     25  }
     26  ok(true, "not crashed");
     27 
     28  var { Troubleshoot } = ChromeUtils.importESModule(
     29    "resource://gre/modules/Troubleshoot.sys.mjs"
     30  );
     31  var data = await Troubleshoot.snapshot();
     32 
     33  Assert.notStrictEqual(
     34    data.graphics.windowLayerManagerType,
     35    "None",
     36    "windowless browser window should not set windowLayerManagerType to 'None'"
     37  );
     38 
     39  webNav.close();
     40 });