[Pkg-privacy-commits] [xul-ext-monkeysphere] 198/296: move agent_socket function to module

Ximin Luo infinity0 at moszumanska.debian.org
Mon Aug 24 07:39:39 UTC 2015


This is an automated email from the git hooks/post-receive script.

infinity0 pushed a commit to branch debian
in repository xul-ext-monkeysphere.

commit 5247a1ce6ea21b53e6b861edc9674f3091211311
Author: Jameson Rollins <jrollins at finestructure.net>
Date:   Sun Apr 25 13:58:19 2010 -0400

    move agent_socket function to module
---
 chrome/content/monkeysphere.js | 38 ++------------------------------------
 modules/monkeysphere.jsm       | 40 ++++++++++++++++++++++++++++++++++++++--
 2 files changed, 40 insertions(+), 38 deletions(-)

diff --git a/chrome/content/monkeysphere.js b/chrome/content/monkeysphere.js
index b26e5e6..4b68a76 100644
--- a/chrome/content/monkeysphere.js
+++ b/chrome/content/monkeysphere.js
@@ -27,40 +27,6 @@ var monkeysphere = (function() {
   // VALID      : processed and validated
   // NOTVALID   : processed and not validated
 
-  // select agent URL from environment variable or explicitly-set preference.
-  // "http://localhost:8901" <-- NO TRAILING SLASH
-  var agent_socket = function() {
-    var envvar = "MONKEYSPHERE_VALIDATION_AGENT_SOCKET";;
-    try {
-      envvar = prefs.getCharPref("validation_agent_socket_environment_variable");
-    } catch (e) {
-      ms.log("falling back to built-in environment variable: " + envvar);
-    }
-    ms.log("using environment variable " + envvar);
-    // get the agent URL from the environment
-    // https://developer.mozilla.org/en/XPCOM_Interface_Reference/nsIEnvironment
-    var ret = Components.classes["@mozilla.org/process/environment;1"].getService(Components.interfaces.nsIEnvironment).get(envvar);
-    // return error if agent URL not set
-    if(!ret) {
-      ret = "http://localhost:8901";;
-      try {
-        ret = prefs.getCharPref("default_socket");
-      } catch (e) {
-        ms.log("falling back to built-in default socket location: " + ret);
-      }
-
-      ms.log(envvar + " environment variable not set.  Using default of " + ret);
-    }
-    // replace trailing slashes
-    ret = ret.replace(/\/*$/, '');
-    ms.log("agent socket: " + ret);
-
-    return ret;
-  };
-
-  // preferences in about:config
-  var prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch("extensions.monkeysphere.");
-
 ////////////////////////////////////////////////////////////
 // SITE URI CHECK FUNCTION
 ////////////////////////////////////////////////////////////
@@ -219,7 +185,7 @@ var monkeysphere = (function() {
   // query the validation agent
   var queryAgent = function(browser, cert) {
     ms.log("#### querying validation agent ####");
-    var socket = agent_socket();
+    var socket = ms.agent_socket();
 
     var uri = browser.currentURI;
 
@@ -312,7 +278,7 @@ var monkeysphere = (function() {
 
   var ms = {};
   Components.utils.import("resource://monkeysphere/monkeysphere.jsm", ms);
-                      
+
 ////////////////////////////////////////////////////////////
 // EXTERNAL INTERFACE
 ////////////////////////////////////////////////////////////
diff --git a/modules/monkeysphere.jsm b/modules/monkeysphere.jsm
index 252d2cd..4b49b2a 100644
--- a/modules/monkeysphere.jsm
+++ b/modules/monkeysphere.jsm
@@ -17,11 +17,47 @@
 // You should have received a copy of the GNU General Public License
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-var EXPORTED_SYMBOLS = ["log",
-                        "getInvalidCert", 
+var EXPORTED_SYMBOLS = [
+                        "agent_socket",
+                        "log",
+                        "getInvalidCert",
                         "overrides"
                        ];
 
+  // select agent URL from environment variable or explicitly-set preference.
+  // "http://localhost:8901" <-- NO TRAILING SLASH
+  var agent_socket = function() {
+    var envvar = "MONKEYSPHERE_VALIDATION_AGENT_SOCKET";;
+    try {
+      envvar = prefs.getCharPref("validation_agent_socket_environment_variable");
+    } catch (e) {
+      log("falling back to built-in environment variable: " + envvar);
+    }
+    log("using environment variable " + envvar);
+    // get the agent URL from the environment
+    // https://developer.mozilla.org/en/XPCOM_Interface_Reference/nsIEnvironment
+    var ret = Components.classes["@mozilla.org/process/environment;1"].getService(Components.interfaces.nsIEnvironment).get(envvar);
+    // return error if agent URL not set
+    if(!ret) {
+      ret = "http://localhost:8901";;
+      try {
+        ret = prefs.getCharPref("default_socket");
+      } catch (e) {
+        log("falling back to built-in default socket location: " + ret);
+      }
+
+      log(envvar + " environment variable not set.  Using default of " + ret);
+    }
+    // replace trailing slashes
+    ret = ret.replace(/\/*$/, '');
+    log("agent socket: " + ret);
+
+    return ret;
+  };
+
+  // preferences in about:config
+  var prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch("extensions.monkeysphere.");
+
   ////////////////////////////////////////////////////////////
   // LOG FUNCTIONS
   ////////////////////////////////////////////////////////////

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/xul-ext-monkeysphere.git



More information about the Pkg-privacy-commits mailing list