Bug 1051066 - Fix mochitest-chrome for single test runs. r=ted, a=test-only
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Sat, 09 Aug 2014 09:26:53 +0100
changeset 217478 365caff46c3f4bcc8b25b8bcd83fc73952121a07
parent 217477 7e49a60f84f163f1a4914ffa87d948c51875bba7
child 217479 48047fdbe1265df130fbcc1870cca99c17db72c3
push id515
push userraliiev@mozilla.com
push dateMon, 06 Oct 2014 12:51:51 +0000
treeherdermozilla-release@267c7a481bef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted, test-only
bugs1051066
milestone33.0a2
Bug 1051066 - Fix mochitest-chrome for single test runs. r=ted, a=test-only
testing/mochitest/mach_commands.py
testing/mochitest/tests/SimpleTest/TestRunner.js
--- a/testing/mochitest/mach_commands.py
+++ b/testing/mochitest/mach_commands.py
@@ -343,17 +343,17 @@ class MochitestRunner(MozbuildObject):
                 print('No tests could be found in the path specified. Please '
                     'specify a path that is a test file or is a directory '
                     'containing tests.')
                 return 1
 
             manifest = TestManifest()
             manifest.tests.extend(tests)
 
-            if (len(tests) == 1):
+            if len(tests) == 1:
                 options.closeWhenDone = False
 
             options.manifestFile = manifest
 
         if rerun_failures:
             options.testManifest = failure_file_path
 
         if debugger:
--- a/testing/mochitest/tests/SimpleTest/TestRunner.js
+++ b/testing/mochitest/tests/SimpleTest/TestRunner.js
@@ -453,19 +453,21 @@ TestRunner.runTests = function (/*url...
 
     SpecialPowers.registerProcessCrashObservers();
 
     TestRunner._urls = flattenArguments(arguments);
 
     var singleTestRun = this._urls.length <= 1 && TestRunner.repeat <= 1;
     TestRunner.showTestReport = singleTestRun;
     var frame = $('testframe');
-    frame.src="";
+    frame.src = "";
     if (singleTestRun) {
-        document.body.setAttribute("singletest", singleTestRun);
+        // Can't use document.body because this runs in a XUL doc as well...
+        var body = document.getElementsByTagName("body")[0];
+        body.setAttribute("singletest", "true");
         frame.removeAttribute("scrolling");
     }
     TestRunner._checkForHangs();
     TestRunner.runNextTest();
 };
 
 /**
  * Used for running a set of tests in a loop for debugging purposes