Bug 845341 - Make sure that PrivateBrowsingUtils.permanentPrivateBrowsing does not throw if the autostart pref doesn't have a default value; r=jdm a=bajaj
--- a/toolkit/content/PrivateBrowsingUtils.jsm
+++ b/toolkit/content/PrivateBrowsingUtils.jsm
@@ -22,18 +22,23 @@ this.PrivateBrowsingUtils = {
privacyContextFromWindow: function pbu_privacyContextFromWindow(aWindow) {
return aWindow.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsILoadContext);
},
get permanentPrivateBrowsing() {
- return gTemporaryAutoStartMode ||
- Services.prefs.getBoolPref(kAutoStartPref, false);
+ try {
+ return gTemporaryAutoStartMode ||
+ Services.prefs.getBoolPref(kAutoStartPref);
+ } catch (e) {
+ // The pref does not exist
+ return false;
+ }
},
// These should only be used from internal code
enterTemporaryAutoStartMode: function pbu_enterTemporaryAutoStartMode() {
gTemporaryAutoStartMode = true;
},
get isInTemporaryAutoStartMode() {
return gTemporaryAutoStartMode;