summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--dom/browser-element/BrowserElementChildPreload.js11
-rw-r--r--dom/indexedDB/test/test_globalObjects_other.xul10
-rw-r--r--dom/presentation/PresentationDataChannelSessionTransport.js8
-rw-r--r--dom/tests/mochitest/localstorage/test_localStorageQuotaPrivateBrowsing_perwindowpb.html8
-rw-r--r--layout/tools/reftest/reftest.jsm94
5 files changed, 21 insertions, 110 deletions
diff --git a/dom/browser-element/BrowserElementChildPreload.js b/dom/browser-element/BrowserElementChildPreload.js
index 780dfa80e..5adff2cac 100644
--- a/dom/browser-element/BrowserElementChildPreload.js
+++ b/dom/browser-element/BrowserElementChildPreload.js
@@ -1010,11 +1010,7 @@ BrowserElementChild.prototype = {
self._takeScreenshot(maxWidth, maxHeight, mimeType, domRequestID);
};
- let maxDelayMS = 2000;
- try {
- maxDelayMS = Services.prefs.getIntPref('dom.browserElement.maxScreenshotDelayMS');
- }
- catch(e) {}
+ let maxDelayMS = Services.prefs.getIntPref('dom.browserElement.maxScreenshotDelayMS', 2000);
// Try to wait for the event loop to go idle before we take the screenshot,
// but once we've waited maxDelayMS milliseconds, go ahead and take it
@@ -1720,10 +1716,7 @@ BrowserElementChild.prototype = {
// certerror? If yes, maybe we should add a property to the
// event to to indicate whether there is a custom page. That would
// let the embedder have more control over the desired behavior.
- let errorPage = null;
- try {
- errorPage = Services.prefs.getCharPref(CERTIFICATE_ERROR_PAGE_PREF);
- } catch (e) {}
+ let errorPage = Services.prefs.getCharPref(CERTIFICATE_ERROR_PAGE_PREF, "");
if (errorPage == 'certerror') {
sendAsyncMsg('error', { type: 'certerror' });
diff --git a/dom/indexedDB/test/test_globalObjects_other.xul b/dom/indexedDB/test/test_globalObjects_other.xul
index eb180a9b4..b527d66bd 100644
--- a/dom/indexedDB/test/test_globalObjects_other.xul
+++ b/dom/indexedDB/test/test_globalObjects_other.xul
@@ -31,14 +31,8 @@
Cu.import("resource://gre/modules/Services.jsm");
for (var stage of [ "install", "startup", "shutdown", "uninstall" ]) {
for (var symbol of [ "IDBKeyRange", "indexedDB" ]) {
- let pref;
- try {
- pref = Services.prefs.getBoolPref("indexeddbtest.bootstrap." + stage +
- "." + symbol);
- }
- catch(ex) {
- pref = false;
- }
+ let pref = Services.prefs.getBoolPref("indexeddbtest.bootstrap." + stage +
+ "." + symbol, false);
ok(pref, "Symbol '" + symbol + "' present during '" + stage + "'");
}
}
diff --git a/dom/presentation/PresentationDataChannelSessionTransport.js b/dom/presentation/PresentationDataChannelSessionTransport.js
index 461e4f2cb..9af6213cb 100644
--- a/dom/presentation/PresentationDataChannelSessionTransport.js
+++ b/dom/presentation/PresentationDataChannelSessionTransport.js
@@ -109,13 +109,7 @@ PresentationTransportBuilder.prototype = {
// TODO bug 1228235 we should have a way to let device providers customize
// the time-out duration.
- let timeout;
- try {
- timeout = Services.prefs.getIntPref("presentation.receiver.loading.timeout");
- } catch (e) {
- // This happens if the pref doesn't exist, so we have a default value.
- timeout = 10000;
- }
+ let timeout = Services.prefs.getIntPref("presentation.receiver.loading.timeout", 10000);
// The timer is to check if the negotiation finishes on time.
this._timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
diff --git a/dom/tests/mochitest/localstorage/test_localStorageQuotaPrivateBrowsing_perwindowpb.html b/dom/tests/mochitest/localstorage/test_localStorageQuotaPrivateBrowsing_perwindowpb.html
index 24d3e4ba3..4dcc361c1 100644
--- a/dom/tests/mochitest/localstorage/test_localStorageQuotaPrivateBrowsing_perwindowpb.html
+++ b/dom/tests/mochitest/localstorage/test_localStorageQuotaPrivateBrowsing_perwindowpb.html
@@ -14,13 +14,7 @@ const Ci = Components.interfaces;
const CONTENT_PAGE = "http://mochi.test:8888/chrome/dom/tests/mochitest/localstorage/page_blank.html";
const slavePath = "/chrome/dom/tests/mochitest/localstorage/";
var currentTest = 1;
-var quota;
-
-try {
- quota = Services.prefs.getIntPref("dom.storage.default_quota");
-} catch (ex) {
- quota = 5 * 1024;
-}
+var quota = Services.prefs.getIntPref("dom.storage.default_quota", 5 * 1024);
Services.prefs.setIntPref("browser.startup.page", 0);
Services.prefs.setIntPref("dom.storage.default_quota", 1);
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); },