summaryrefslogtreecommitdiffstats
path: root/layout/tools/reftest/reftest.jsm
diff options
context:
space:
mode:
authorMoonchild <mcwerewolf@wolfbeast.com>2019-04-20 11:17:30 +0200
committerGitHub <noreply@github.com>2019-04-20 11:17:30 +0200
commite0116ac2b78eb4e621a4d0769e01f8358a6d661c (patch)
treefe2898874f0be34a8425281ecba2cb8cb59fb210 /layout/tools/reftest/reftest.jsm
parent32577bdb3d2471c0e5ce4cfd0501a820157230cb (diff)
parent21b4cb27cabecdb5580c01891801c9259689ec87 (diff)
downloadUXP-e0116ac2b78eb4e621a4d0769e01f8358a6d661c.tar
UXP-e0116ac2b78eb4e621a4d0769e01f8358a6d661c.tar.gz
UXP-e0116ac2b78eb4e621a4d0769e01f8358a6d661c.tar.lz
UXP-e0116ac2b78eb4e621a4d0769e01f8358a6d661c.tar.xz
UXP-e0116ac2b78eb4e621a4d0769e01f8358a6d661c.zip
Merge pull request #1041 from Ascrod/default-pref
Clean up try/catch blocks for preferences
Diffstat (limited to 'layout/tools/reftest/reftest.jsm')
-rw-r--r--layout/tools/reftest/reftest.jsm94
1 files changed, 15 insertions, 79 deletions
diff --git a/layout/tools/reftest/reftest.jsm b/layout/tools/reftest/reftest.jsm
index bd9976b0f..c885150a4 100644
--- a/layout/tools/reftest/reftest.jsm
+++ b/layout/tools/reftest/reftest.jsm
@@ -277,29 +277,10 @@ this.OnRefTestLoad = function OnRefTestLoad(win)
var prefs = Components.classes["@mozilla.org/preferences-service;1"].
getService(Components.interfaces.nsIPrefBranch);
- try {
- gBrowserIsRemote = prefs.getBoolPref("browser.tabs.remote.autostart");
- } catch (e) {
- gBrowserIsRemote = false;
- }
-
- try {
- gB2GisMulet = prefs.getBoolPref("b2g.is_mulet");
- } catch (e) {
- gB2GisMulet = false;
- }
-
- try {
- gBrowserIsIframe = prefs.getBoolPref("reftest.browser.iframe.enabled");
- } catch (e) {
- gBrowserIsIframe = false;
- }
-
- try {
- gLogLevel = prefs.getCharPref("reftest.logLevel");
- } catch (e) {
- gLogLevel ='info';
- }
+ gBrowserIsRemote = prefs.getBoolPref("browser.tabs.remote.autostart", false);
+ gB2GisMulet = prefs.getBoolPref("b2g.is_mulet", false);
+ gBrowserIsIframe = prefs.getBoolPref("reftest.browser.iframe.enabled", false);
+ gLogLevel = prefs.getCharPref("reftest.logLevel", "info");
if (win === undefined || win == null) {
win = window;
@@ -366,11 +347,7 @@ function InitAndStartRefTests()
} catch (e) {}
/* set the gLoadTimeout */
- try {
- gLoadTimeout = prefs.getIntPref("reftest.timeout");
- } catch(e) {
- gLoadTimeout = 5 * 60 * 1000; //5 minutes as per bug 479518
- }
+ gLoadTimeout = prefs.getIntPref("reftest.timeout", 5 * 60 * 1000); //5 minutes as per bug 479518
/* Get the logfile for android tests */
try {
@@ -381,27 +358,12 @@ function InitAndStartRefTests()
}
} catch(e) {}
- try {
- gRemote = prefs.getBoolPref("reftest.remote");
- } catch(e) {
- gRemote = false;
- }
-
- try {
- gIgnoreWindowSize = prefs.getBoolPref("reftest.ignoreWindowSize");
- } catch(e) {
- gIgnoreWindowSize = false;
- }
+ gRemote = prefs.getBoolPref("reftest.remote", false);
+ gIgnoreWindowSize = prefs.getBoolPref("reftest.ignoreWindowSize", false);
/* Support for running a chunk (subset) of tests. In separate try as this is optional */
- try {
- gTotalChunks = prefs.getIntPref("reftest.totalChunks");
- gThisChunk = prefs.getIntPref("reftest.thisChunk");
- }
- catch(e) {
- gTotalChunks = 0;
- gThisChunk = 0;
- }
+ gTotalChunks = prefs.getIntPref("reftest.totalChunks", 0);
+ gThisChunk = prefs.getIntPref("reftest.thisChunk", 0);
try {
gFocusFilterMode = prefs.getCharPref("reftest.focusFilterMode");
@@ -468,39 +430,17 @@ function StartTests()
logger.error("EXCEPTION: " + e);
}
- try {
- gNoCanvasCache = prefs.getIntPref("reftest.nocache");
- } catch(e) {
- gNoCanvasCache = false;
- }
-
- try {
- gShuffle = prefs.getBoolPref("reftest.shuffle");
- } catch (e) {
- gShuffle = false;
- }
-
- try {
- gRunUntilFailure = prefs.getBoolPref("reftest.runUntilFailure");
- } catch (e) {
- gRunUntilFailure = false;
- }
+ gNoCanvasCache = prefs.getIntPref("reftest.nocache", false);
+ gShuffle = prefs.getBoolPref("reftest.shuffle", false);
+ gRunUntilFailure = prefs.getBoolPref("reftest.runUntilFailure", false);
// When we repeat this function is called again, so really only want to set
// gRepeat once.
if (gRepeat == null) {
- try {
- gRepeat = prefs.getIntPref("reftest.repeat");
- } catch (e) {
- gRepeat = 0;
- }
+ gRepeat = prefs.getIntPref("reftest.repeat", 0);
}
- try {
- gRunSlowTests = prefs.getIntPref("reftest.skipslowtests");
- } catch(e) {
- gRunSlowTests = false;
- }
+ gRunSlowTests = prefs.getIntPref("reftest.skipslowtests", false);
if (gShuffle) {
gNoCanvasCache = true;
@@ -737,11 +677,7 @@ function BuildConditionSandbox(aURL) {
var prefs = CC["@mozilla.org/preferences-service;1"].
getService(CI.nsIPrefBranch);
- try {
- sandbox.nativeThemePref = !prefs.getBoolPref("mozilla.widget.disable-native-theme");
- } catch (e) {
- sandbox.nativeThemePref = true;
- }
+ sandbox.nativeThemePref = !prefs.getBoolPref("mozilla.widget.disable-native-theme", false);
sandbox.prefs = CU.cloneInto({
getBoolPref: function(p) { return prefs.getBoolPref(p); },