Skip to content

Commit

Permalink
Fix debug logger on new profile:
Browse files Browse the repository at this point in the history
prefs.init() -> missing "extensions.privateTab.prefsVersion" -> _log("Migrate prefs …")
(fix #240)
  • Loading branch information
Infocatcher committed Jan 21, 2017
1 parent 741b185 commit 2e9f84d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
3 changes: 1 addition & 2 deletions bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
10 changes: 8 additions & 2 deletions log.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 2e9f84d

Please sign in to comment.