tor-browser

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

browser_showForm.js (1399B)


      1 "use strict";
      2 
      3 const PAGE =
      4  "data:text/html,<html><body>A%20regular,%20everyday,%20normal%20page.";
      5 
      6 // On debug builds, crashing tabs results in much thinking, which
      7 // slows down the test and results in intermittent test timeouts,
      8 // so we'll pump up the expected timeout for this test.
      9 requestLongerTimeout(2);
     10 
     11 /**
     12 * Tests that we show the about:tabcrashed additional details form
     13 * if the "submit a crash report" checkbox was checked by default.
     14 */
     15 add_task(async function test_show_form() {
     16  return BrowserTestUtils.withNewTab(
     17    {
     18      gBrowser,
     19      url: PAGE,
     20    },
     21    async function (browser) {
     22      // Flip the pref so that the checkbox should be checked
     23      // by default.
     24      let pref = TabCrashHandler.prefs.root + "sendReport";
     25      await SpecialPowers.pushPrefEnv({
     26        set: [[pref, true]],
     27      });
     28 
     29      // Now crash the browser.
     30      await BrowserTestUtils.crashFrame(browser);
     31 
     32      let doc = browser.contentDocument;
     33 
     34      // Ensure the checkbox is checked. We can safely reach into
     35      // the content since about:tabcrashed is an in-process URL.
     36      let checkbox = doc.getElementById("sendReport");
     37      ok(checkbox.checked, "Send report checkbox is checked.");
     38 
     39      // Ensure the options form is displayed.
     40      let options = doc.getElementById("options");
     41      ok(!options.hidden, "Showing the crash report options form.");
     42    }
     43  );
     44 });