Skip to content

Commit 3331a27

Browse files
committed
Control log verbosity from about:config
1 parent 1f5e2d0 commit 3331a27

1 file changed

Lines changed: 22 additions & 9 deletions

File tree

src/components/https-everywhere.js

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ WARN=5;
99
//---------------
1010

1111
https_everywhere_blacklist = {};
12+
https_domains = {}; // maps domain patterns (with at most one
13+
// wildcard) to RuleSets
14+
15+
https_everywhere_blacklist = {}; // URLs we've given up on rewriting because
16+
// of redirection loops
1217

1318
//
1419
const CI = Components.interfaces;
@@ -112,15 +117,6 @@ function xpcom_checkInterfaces(iid,iids,ex) {
112117

113118
INCLUDE('IOUtil', 'HTTPSRules', 'HTTPS', 'Thread');
114119

115-
function https_everywhereLog(level, str) {
116-
if (level >= WARN) {
117-
dump(str+"\n");
118-
var econsole = Components.classes["@mozilla.org/consoleservice;1"]
119-
.getService(Components.interfaces.nsIConsoleService);
120-
econsole.logStringMessage("HTTPS Everywhere: " +str);
121-
}
122-
}
123-
124120
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
125121

126122
function HTTPSEverywhere() {
@@ -326,6 +322,23 @@ HTTPSEverywhere.prototype = {
326322

327323
};
328324

325+
const LLVAR = "LogLevel";
326+
var prefs = HTTPSEverywhere.instance.get_prefs();
327+
try {
328+
prefs.getBoolPref(LLVAR);
329+
} catch (e) {
330+
prefs.setBoolPref(LLVAR, true);
331+
}
332+
333+
function https_everywhereLog(level, str) {
334+
if (level >= prefs.getBoolPref(LLVAR)) {
335+
dump(str+"\n");
336+
var econsole = Components.classes["@mozilla.org/consoleservice;1"]
337+
.getService(Components.interfaces.nsIConsoleService);
338+
econsole.logStringMessage("HTTPS Everywhere: " +str);
339+
}
340+
}
341+
329342
/**
330343
* XPCOMUtils.generateNSGetFactory was introduced in Mozilla 2 (Firefox 4).
331344
* XPCOMUtils.generateNSGetModule is for Mozilla 1.9.2 (Firefox 3.6).

0 commit comments

Comments
 (0)