diff --git a/bootstrap.js b/bootstrap.js index c38261b..06a4231 100644 --- a/bootstrap.js +++ b/bootstrap.js @@ -34,9 +34,8 @@ var privateTab = { return; this.initialized = true; - prefs.init(); - Services.scriptloader.loadSubScript("chrome://privatetab/content/log.js"); + prefs.init(); _dbg = prefs.get("debug", false); _dbgv = prefs.get("debug.verbose", false); diff --git a/log.js b/log.js index 3c2f90a..f280efe 100644 --- a/log.js +++ b/log.js @@ -3,19 +3,25 @@ const LOG_PREFIX = "[Private Tab] "; if(!("Services" in this)) Components.utils.import("resource://gre/modules/Services.jsm"); this.__defineGetter__("_dbg", function() { - return Services.prefs.getBoolPref("extensions.privateTab.debug"); + return _boolPref("debug"); }); this.__defineSetter__("_dbg", function(v) { delete this._dbg; return this._dbg = v; }); this.__defineGetter__("_dbgv", function() { - return Services.prefs.getBoolPref("extensions.privateTab.debug.verbose"); + return _boolPref("debug.verbose"); }); this.__defineSetter__("_dbgv", function(v) { delete this._dbgv; return this._dbgv = v; }); +function _boolPref(pref) { + pref = "extensions.privateTab." + pref; + if(Services.prefs.getPrefType(pref) == Services.prefs.PREF_BOOL) + return Services.prefs.getBoolPref(pref); + return true; // Not yet initialized +} function ts() { var d = new Date();