tor-browser

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

browser_webconsole_closing_after_completion.js (1187B)


      1 /* Any copyright is dedicated to the Public Domain.
      2 * http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 // Tests to ensure that errors don't appear when the console is closed while a
      5 // completion is being performed. See Bug 580001.
      6 
      7 "use strict";
      8 
      9 const TEST_URI =
     10  "http://example.com/browser/devtools/client/webconsole/" +
     11  "test/browser/test-console.html";
     12 
     13 add_task(async function () {
     14  const tab = await addTab(TEST_URI);
     15  const browser = tab.linkedBrowser;
     16  const hud = await openConsole();
     17 
     18  // Fire a completion.
     19  await setInputValueForAutocompletion(hud, "doc");
     20 
     21  let errorWhileClosing = false;
     22  function errorListener() {
     23    errorWhileClosing = true;
     24  }
     25 
     26  browser.addEventListener("error", errorListener);
     27  const onToolboxDestroyed = gDevTools.once("toolbox-destroyed");
     28 
     29  // Focus the jsterm and perform the keycombo to close the WebConsole.
     30  hud.jsterm.focus();
     31  EventUtils.synthesizeKey("i", {
     32    accelKey: true,
     33    [Services.appinfo.OS == "Darwin" ? "altKey" : "shiftKey"]: true,
     34  });
     35 
     36  await onToolboxDestroyed;
     37 
     38  browser.removeEventListener("error", errorListener);
     39  is(errorWhileClosing, false, "no error while closing the WebConsole");
     40 });