Bug 1460914 - [xpcshell] Stop ignoring failures in head.js when setting prefs, r=ted
authorAndrew Halberstadt <ahalberstadt@mozilla.com>
Tue, 23 Oct 2018 20:46:33 +0000
changeset 491152 ab0947533e9afba5a0a9e2abd09735bfa3c090a4
parent 491151 664384a424edde8a0ab46f33f71c169619ec3eba
child 491153 9688858bc5daf50a48ff789cf8ecf455ec315c3b
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewersted
bugs1460914
milestone65.0a1
Bug 1460914 - [xpcshell] Stop ignoring failures in head.js when setting prefs, r=ted If something goes wrong when setting prefs, that's something we'll want to know about as it likely means some tests will start to fail. Differential Revision: https://phabricator.services.mozilla.com/D9549
testing/xpcshell/head.js
--- a/testing/xpcshell/head.js
+++ b/testing/xpcshell/head.js
@@ -1472,43 +1472,39 @@ function run_next_test() {
 
   if (_gRunningTest !== null) {
     // Close the previous test do_test_pending call.
     do_test_finished(_gRunningTest.name);
   }
 }
 
 try {
+  // Set global preferences
   if (runningInParent) {
     // Always use network provider for geolocation tests
     // so we bypass the OSX dialog raised by the corelocation provider
     _Services.prefs.setBoolPref("geo.provider.testing", true);
-  }
-} catch (e) { }
-// We need to avoid hitting the network with certain components.
-try {
-  if (runningInParent) {
+
+    // We need to avoid hitting the network with certain components.
     _Services.prefs.setCharPref("media.gmp-manager.url.override", "http://%(server)s/dummy-gmp-manager.xml");
     _Services.prefs.setCharPref("media.gmp-manager.updateEnabled", false);
     _Services.prefs.setCharPref("extensions.systemAddon.update.url", "http://%(server)s/dummy-system-addons.xml");
     _Services.prefs.setCharPref("app.normandy.api_url", "https://%(server)s/selfsupport-dummy/");
     _Services.prefs.setCharPref("toolkit.telemetry.server", "https://%(server)s/telemetry-dummy");
     _Services.prefs.setCharPref("browser.search.geoip.url", "https://%(server)s/geoip-dummy");
     _Services.prefs.setCharPref("browser.safebrowsing.downloads.remote.url", "https://%(server)s/safebrowsing-dummy");
-  }
-} catch (e) { }
 
-// Make tests run consistently on DevEdition (which has a lightweight theme
-// selected by default).
-try {
-  if (runningInParent) {
+    // Make tests run consistently on DevEdition (which has a lightweight theme
+    // selected by default).
     _Services.prefs.deleteBranch("lightweightThemes.selectedThemeID");
     _Services.prefs.deleteBranch("browser.devedition.theme.enabled");
   }
-} catch (e) { }
+} catch (e) {
+  do_throw(e);
+}
 
 function _load_mozinfo() {
   let mozinfoFile = Cc["@mozilla.org/file/local;1"]
     .createInstance(Ci.nsIFile);
   mozinfoFile.initWithPath(_MOZINFO_JS_PATH);
   let stream = Cc["@mozilla.org/network/file-input-stream;1"]
     .createInstance(Ci.nsIFileInputStream);
   stream.init(mozinfoFile, -1, 0, 0);