tor-browser

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

browser_noPermanentKey.js (1274B)


      1 "use strict";
      2 
      3 const PAGE =
      4  "data:text/html,<html><body>A%20regular,%20everyday,%20normal%20page.";
      5 
      6 add_setup(async function () {
      7  await setupLocalCrashReportServer();
      8 });
      9 
     10 /**
     11 * Tests tab crash page when a browser that somehow doesn't have a permanentKey
     12 * crashes.
     13 */
     14 add_task(async function test_without_dump() {
     15  return BrowserTestUtils.withNewTab(
     16    {
     17      gBrowser,
     18      url: PAGE,
     19    },
     20    async function (browser) {
     21      delete browser.permanentKey;
     22 
     23      await BrowserTestUtils.crashFrame(browser);
     24 
     25      let submissionBefore = Glean.crashSubmission.success.testGetValue();
     26 
     27      let crashReport = promiseCrashReport();
     28 
     29      await SpecialPowers.spawn(browser, [], async function () {
     30        let doc = content.document;
     31        Assert.ok(
     32          doc.documentElement.classList.contains("crashDumpAvailable"),
     33          "Should be offering to submit a crash report."
     34        );
     35        // With the permanentKey gone, restoring this tab is no longer
     36        // possible. We'll just close it instead.
     37        let closeTab = doc.getElementById("closeTab");
     38        closeTab.click();
     39      });
     40 
     41      await crashReport;
     42 
     43      Assert.equal(
     44        submissionBefore + 1,
     45        Glean.crashSubmission.success.testGetValue()
     46      );
     47    }
     48  );
     49 });