Bug 1522916 - Add --jsconsole argument to `mochitest` r=ahal
authorBrian Grinstead <bgrinstead@mozilla.com>
Mon, 28 Jan 2019 21:31:18 +0000
changeset 455729 c7b3aae27ca1b61c66bf11d843ed210514686def
parent 455728 5206746db39306b58f37c7351c5f78ca685f6817
child 455730 008b78c1e2b2ba4e20f6f49c90d4dfac6aca0e95
push id35457
push usercsabou@mozilla.com
push dateTue, 29 Jan 2019 09:20:40 +0000
treeherdermozilla-central@84104c5031c3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersahal
bugs1522916
milestone66.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1522916 - Add --jsconsole argument to `mochitest` r=ahal Differential Revision: https://phabricator.services.mozilla.com/D17669
testing/mochitest/browser-test.js
testing/mochitest/mochitest_options.py
testing/mochitest/runtests.py
--- a/testing/mochitest/browser-test.js
+++ b/testing/mochitest/browser-test.js
@@ -580,19 +580,20 @@ Tester.prototype = {
       });
       gBrowser.removeTab(gBrowser.selectedTab, { skipPermitUnload: true });
       gBrowser.stop();
     }
 
     // Remove stale windows
     this.structuredLogger.info("checking window state");
     for (let win of Services.wm.getEnumerator(null)) {
+      let type = win.document.documentElement.getAttribute("windowtype");
       if (win != window && !win.closed &&
-          win.document.documentElement.getAttribute("id") != "browserTestHarness") {
-        let type = win.document.documentElement.getAttribute("windowtype");
+          win.document.documentElement.getAttribute("id") != "browserTestHarness" &&
+          type != "devtools:webconsole") {
         switch (type) {
         case "navigator:browser":
           type = "browser window";
           break;
         case "mail:3pane":
           type = "mail window";
           break;
         case null:
--- a/testing/mochitest/mochitest_options.py
+++ b/testing/mochitest/mochitest_options.py
@@ -378,16 +378,21 @@ class MochitestArguments(ArgumentContain
           }],
         [["--setpref"],
          {"action": "append",
           "metavar": "PREF=VALUE",
           "default": [],
           "dest": "extraPrefs",
           "help": "Defines an extra user preference.",
           }],
+        [["--jsconsole"],
+         {"action": "store_true",
+          "default": False,
+          "help": "Open the Browser Console.",
+          }],
         [["--jsdebugger"],
          {"action": "store_true",
           "default": False,
           "help": "Start the browser JS debugger before running the test. Implies --no-autorun.",
           }],
         [["--debug-on-failure"],
          {"action": "store_true",
           "default": False,
--- a/testing/mochitest/runtests.py
+++ b/testing/mochitest/runtests.py
@@ -2680,16 +2680,19 @@ toolbar#nav-bar {
         if self.mozLogs:
             self.browserEnv["MOZ_LOG_FILE"] = "{}/moz-pid=%PID-uid={}.log".format(
                 self.browserEnv["MOZ_UPLOAD_DIR"], str(uuid.uuid4()))
 
         status = 0
         try:
             self.startServers(options, debuggerInfo)
 
+            if options.jsconsole:
+                options.browserArgs.extend(['--jsconsole'])
+
             if options.jsdebugger:
                 options.browserArgs.extend(['-jsdebugger', '-wait-for-jsdebugger'])
 
             if options.recordingPath:
                 options.browserArgs.extend(['--save-recordings', options.recordingPath])
 
             # Remove the leak detection file so it can't "leak" to the tests run.
             # The file is not there if leak logging was not enabled in the