Bug 845341 - Make sure that PrivateBrowsingUtils.permanentPrivateBrowsing does not throw if the autostart pref doesn't have a default value; r=jdm a=bajaj
authorEhsan Akhgari <ehsan@mozilla.com>
Tue, 26 Feb 2013 11:31:35 -0500
changeset 132276 a4ed90fa7682109c5cdf017132aeb001bd84b744
parent 132275 5071df23241386e7d4196fd78aaa24ff30f69153
child 132277 64b4e0e7634ad3fe13cb938021e4a292858306cf
push id2323
push userbbajaj@mozilla.com
push dateMon, 01 Apr 2013 19:47:02 +0000
treeherdermozilla-beta@7712be144d91 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdm, bajaj
bugs845341
milestone21.0a2
Bug 845341 - Make sure that PrivateBrowsingUtils.permanentPrivateBrowsing does not throw if the autostart pref doesn't have a default value; r=jdm a=bajaj
toolkit/content/PrivateBrowsingUtils.jsm
--- 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;