[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] [https-everywhere/master 2/3] Control log verbosity from about:config



Author: Peter Eckersley <pde@xxxxxxx>
Date: Fri, 8 Oct 2010 12:31:28 -0700
Subject: Control log verbosity from about:config
Commit: 3331a27a77a80d94dd747390f14efde3956366a6

---
 src/components/https-everywhere.js |   31 ++++++++++++++++++++++---------
 1 files changed, 22 insertions(+), 9 deletions(-)

diff --git a/src/components/https-everywhere.js b/src/components/https-everywhere.js
index a20878f..b0e73c7 100644
--- a/src/components/https-everywhere.js
+++ b/src/components/https-everywhere.js
@@ -9,6 +9,11 @@ WARN=5;
 //---------------
 
 https_everywhere_blacklist = {};
+https_domains = {};              // maps domain patterns (with at most one
+                                 // wildcard) to RuleSets
+
+https_everywhere_blacklist = {}; // URLs we've given up on rewriting because
+                                 // of redirection loops
 
 //
 const CI = Components.interfaces;
@@ -112,15 +117,6 @@ function xpcom_checkInterfaces(iid,iids,ex) {
 
 INCLUDE('IOUtil', 'HTTPSRules', 'HTTPS', 'Thread');
 
-function https_everywhereLog(level, str) {
-  if (level >= WARN) {
-    dump(str+"\n");
-    var econsole = Components.classes["@mozilla.org/consoleservice;1"]
-        .getService(Components.interfaces.nsIConsoleService);
-    econsole.logStringMessage("HTTPS Everywhere: " +str);
-  }
-}
-
 Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
 
 function HTTPSEverywhere() {
@@ -326,6 +322,23 @@ HTTPSEverywhere.prototype = {
 
 };
 
+const LLVAR = "LogLevel";
+var prefs = HTTPSEverywhere.instance.get_prefs();
+try {
+  prefs.getBoolPref(LLVAR);
+} catch (e) {
+  prefs.setBoolPref(LLVAR, true);
+}
+
+function https_everywhereLog(level, str) {
+  if (level >= prefs.getBoolPref(LLVAR)) {
+    dump(str+"\n");
+    var econsole = Components.classes["@mozilla.org/consoleservice;1"]
+        .getService(Components.interfaces.nsIConsoleService);
+    econsole.logStringMessage("HTTPS Everywhere: " +str);
+  }
+}
+
 /**
 * XPCOMUtils.generateNSGetFactory was introduced in Mozilla 2 (Firefox 4).
 * XPCOMUtils.generateNSGetModule is for Mozilla 1.9.2 (Firefox 3.6).
-- 
1.7.1