tor-browser

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

browser_webconsole_reopen_closed_tab.js (1434B)


      1 /* Any copyright is dedicated to the Public Domain.
      2 * http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 // See Bug 597756. Check that errors are still displayed in the console after
      7 // reloading a page.
      8 
      9 const TEST_URI =
     10  "http://example.com/browser/devtools/client/webconsole/" +
     11  "test/browser/test-reopen-closed-tab.html";
     12 
     13 add_task(async function () {
     14  // If we persist log, the test might be successful even if only the first
     15  // error log is shown.
     16  pushPref("devtools.webconsole.persistlog", false);
     17 
     18  info("Open console and refresh tab.");
     19 
     20  expectUncaughtExceptionNoE10s();
     21  let hud = await openNewTabAndConsole(TEST_URI);
     22  await clearOutput(hud);
     23 
     24  expectUncaughtExceptionNoE10s();
     25  await reloadBrowser();
     26  await waitForError(hud);
     27 
     28  // Close and reopen
     29  await closeConsole();
     30 
     31  expectUncaughtExceptionNoE10s();
     32  gBrowser.removeCurrentTab();
     33  hud = await openNewTabAndConsole(TEST_URI);
     34 
     35  expectUncaughtExceptionNoE10s();
     36  await reloadBrowser();
     37  await waitForError(hud);
     38 });
     39 
     40 async function waitForError(hud) {
     41  info("Wait for error message");
     42  await waitFor(() => findErrorMessage(hud, "fooBug597756_error"));
     43  ok(true, "error message displayed");
     44 }
     45 
     46 function expectUncaughtExceptionNoE10s() {
     47  // On e10s, the exception is triggered in child process
     48  // and is ignored by test harness
     49  if (!Services.appinfo.browserTabsRemoteAutostart) {
     50    expectUncaughtException();
     51  }
     52 }