Bug 1494657 - Wait for SpecialPowers before proceeding with mochitest setup; r=aswan
authorGeoff Brown <gbrown@mozilla.com>
Thu, 18 Oct 2018 10:22:26 -0600
changeset 500425 edaa4f0b9da959b7a0158e35fbb972eb24cbe708
parent 500424 6d6b5c10bba56bc286ae66cf9d72948a6a03d200
child 500426 8b06ecb59a60ef9f7920fa6e9d307c6592f6a477
push id1864
push userffxbld-merge
push dateMon, 03 Dec 2018 15:51:40 +0000
treeherdermozilla-release@f040763d99ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaswan
bugs1494657
milestone64.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 1494657 - Wait for SpecialPowers before proceeding with mochitest setup; r=aswan
testing/mochitest/tests/SimpleTest/setup.js
--- a/testing/mochitest/tests/SimpleTest/setup.js
+++ b/testing/mochitest/tests/SimpleTest/setup.js
@@ -4,16 +4,23 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 TestRunner.logEnabled = true;
 TestRunner.logger = LogController;
 
+if (!("SpecialPowers" in window)) {
+  dump("SimpleTest setup.js found SpecialPowers unavailable: reloading...\n");
+  setTimeout(() => {
+    window.location.reload();
+  }, 1000);
+}
+
 /* Helper function */
 function parseQueryString(encodedString, useArrays) {
   // strip a leading '?' from the encoded string
   var qstr = (encodedString.length > 0 && encodedString[0] == "?")
              ? encodedString.substring(1)
              : encodedString;
   var pairs = qstr.replace(/\+/g, "%20").split(/(\&amp\;|\&\#38\;|\&#x26;|\&)/);
   var o = {};