[Pkg-privacy-commits] [xul-ext-monkeysphere] 202/296: fix formatting in module definition file. NO FUNCTIONAL CHANGE AT ALL.
Ximin Luo
infinity0 at moszumanska.debian.org
Mon Aug 24 07:39:40 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 0bd9a104ddb2168a22c8ef3cf522b2e905764423
Author: Jameson Rollins <jrollins at finestructure.net>
Date: Sun Apr 25 14:14:14 2010 -0400
fix formatting in module definition file. NO FUNCTIONAL CHANGE AT ALL.
---
modules/monkeysphere.jsm | 389 ++++++++++++++++++++++++-----------------------
1 file changed, 195 insertions(+), 194 deletions(-)
diff --git a/modules/monkeysphere.jsm b/modules/monkeysphere.jsm
index cd3b22e..b2ebddb 100644
--- a/modules/monkeysphere.jsm
+++ b/modules/monkeysphere.jsm
@@ -18,211 +18,211 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
var EXPORTED_SYMBOLS = [
- "agent_socket",
- "log",
- "isRelevantURI",
- "createAgentPostData",
- "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";;
+ "agent_socket",
+ "log",
+ "isRelevantURI",
+ "createAgentPostData",
+ "getInvalidCert",
+ "overrides"
+];
+
+// preferences in about:config
+var prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch("extensions.monkeysphere.");
+
+// 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 {
- envvar = prefs.getCharPref("validation_agent_socket_environment_variable");
+ ret = prefs.getCharPref("default_socket");
} catch (e) {
- log("falling back to built-in environment variable: " + envvar);
+ log("falling back to built-in default socket location: " + ret);
}
- 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
- ////////////////////////////////////////////////////////////
-
- //////////////////////////////////////////////////////////
- var log = function(line) {
- var message = "monkeysphere: " + line;
-
- try {
- dump(message + "\n");
- try {
- // this line works in extensions
- Firebug.Console.log(message);
- } catch(e) {
- // ignore, this will blow up if Firebug is not installed
- }
- try {
- console.log(message); // this line works in HTML files
- } catch(e) {
- // ignore, this will blow up if Firebug is not installed
- }
- } catch(e) {
- alert(e);
- }
- };
+ log(envvar + " environment variable not set. Using default of " + ret);
+ }
+ // replace trailing slashes
+ ret = ret.replace(/\/*$/, '');
+ log("agent socket: " + ret);
- var objdump = function(obj) {
- for (var key in obj) {
- log("dump: " + key + " = " + obj[key]);
- }
- };
+ return ret;
+};
////////////////////////////////////////////////////////////
-// SITE URI CHECK FUNCTION
+// LOG FUNCTIONS
////////////////////////////////////////////////////////////
- //////////////////////////////////////////////////////////
- // check uri is relevant to monkeysphere
- var isRelevantURI = function(uri) {
- ////////////////////////////////////////
- // check host
+//////////////////////////////////////////////////////////
+var log = function(line) {
+ var message = "monkeysphere: " + line;
+
+ try {
+ dump(message + "\n");
try {
- var host = uri.host;
+ // this line works in extensions
+ Firebug.Console.log(message);
} catch(e) {
- log("host data empty.");
- return null;
+ // ignore, this will blow up if Firebug is not installed
}
-
- ////////////////////////////////////////
- // check scheme
try {
- var scheme = uri.scheme;
+ console.log(message); // this line works in HTML files
} catch(e) {
- log("scheme data empty.");
- return null;
+ // ignore, this will blow up if Firebug is not installed
}
+ } catch(e) {
+ alert(e);
+ }
+};
- log("url: " + uri.asciiSpec);
+var objdump = function(obj) {
+ for (var key in obj) {
+ log("dump: " + key + " = " + obj[key]);
+ }
+};
- ////////////////////////////////////////
- // check if scheme is https
- if(scheme != "https") {
- log("scheme not https.");
- return null;
- }
+////////////////////////////////////////////////////////////
+// SITE URI CHECK FUNCTION
+////////////////////////////////////////////////////////////
- // if uri is relevant for monkeysphere return true
- return true;
- };
+//////////////////////////////////////////////////////////
+// check uri is relevant to monkeysphere
+var isRelevantURI = function(uri) {
+ ////////////////////////////////////////
+ // check host
+ try {
+ var host = uri.host;
+ } catch(e) {
+ log("host data empty.");
+ return null;
+ }
+
+ ////////////////////////////////////////
+ // check scheme
+ try {
+ var scheme = uri.scheme;
+ } catch(e) {
+ log("scheme data empty.");
+ return null;
+ }
+
+ log("url: " + uri.asciiSpec);
+
+ ////////////////////////////////////////
+ // check if scheme is https
+ if(scheme != "https") {
+ log("scheme not https.");
+ return null;
+ }
+
+ // if uri is relevant for monkeysphere return true
+ return true;
+};
////////////////////////////////////////////////////////////
// AGENT POST DATA FUNCTION
////////////////////////////////////////////////////////////
- var createAgentPostData = function(uri, cert) {
- // get certificate info
- var cert_length = {};
- var dummy = {};
- var cert_data = cert.getRawDER(cert_length, dummy);
-
- // "agent post data"
- var apd = {
- uri: uri,
- cert: cert,
- data: {
- context: uri.scheme,
- peer: uri.hostPort,
- pkc: {
- type: "x509der",
- data: cert_data
- }
- },
- toJSON: function() {
- return JSON.stringify(this.data);
- },
- toOverrideLabel: function() {
- return this.data.context + '|' + this.data.peer + '|' + this.data.pkc.type + '|' + this.data.pkc.data;
- },
- log: function() {
- log("agent post data:");
- log(" context: " + this.data.context);
- log(" peer: " + this.data.peer);
- log(" pkc.type: " + this.data.pkc.type);
- //log(" pkc.data: " + this.data.pkc.data); // this can be big
- //log(" JSON: " + this.toJSON());
+var createAgentPostData = function(uri, cert) {
+ // get certificate info
+ var cert_length = {};
+ var dummy = {};
+ var cert_data = cert.getRawDER(cert_length, dummy);
+
+ // "agent post data"
+ var apd = {
+ uri: uri,
+ cert: cert,
+ data: {
+ context: uri.scheme,
+ peer: uri.hostPort,
+ pkc: {
+ type: "x509der",
+ data: cert_data
}
- };
-
- return apd;
- };
-
- ////////////////////////////////////////////////////////////
- // CERT FUNCTIONS
- ////////////////////////////////////////////////////////////
-
- // certificate override service class
- // http://www.oxymoronical.com/experiments/xpcomref/applications/Firefox/3.5/interfaces/nsICertOverrideService
- var certOverrideService = Components.classes["@mozilla.org/security/certoverride;1"].getService(Components.interfaces.nsICertOverrideService);
-
- //////////////////////////////////////////////////////////
- // FWIW, aWebProgress listener has:
- // securityUI = [xpconnect wrapped (nsISupports, nsISecureBrowserUI, nsISSLStatusProvider)]
- // but i don't think it can be used because it doesn't hold invalid cert info
- // FIXME: is there a better way to get the cert for the actual current connection?
- var getInvalidCert = function(uri) {
- try {
- var cert = getInvalidCertSSLStatus(uri).QueryInterface(Components.interfaces.nsISSLStatus).serverCert;
- printCertInfo(cert);
- return cert;
- } catch(e) {
- return null;
+ },
+ toJSON: function() {
+ return JSON.stringify(this.data);
+ },
+ toOverrideLabel: function() {
+ return this.data.context + '|' + this.data.peer + '|' + this.data.pkc.type + '|' + this.data.pkc.data;
+ },
+ log: function() {
+ log("agent post data:");
+ log(" context: " + this.data.context);
+ log(" peer: " + this.data.peer);
+ log(" pkc.type: " + this.data.pkc.type);
+ //log(" pkc.data: " + this.data.pkc.data); // this can be big
+ //log(" JSON: " + this.toJSON());
}
};
- //////////////////////////////////////////////////////////
- // gets current ssl status info
- // http://www.oxymoronical.com/experiments/apidocs/interface/nsIRecentBadCertsService
- var getInvalidCertSSLStatus = function(uri) {
- var recentCertsService =
- Components.classes["@mozilla.org/security/recentbadcerts;1"].getService(Components.interfaces.nsIRecentBadCertsService);
- if (!recentCertsService)
- return null;
-
- var port = uri.port;
- if(port == -1)
- port = 443;
- var hostWithPort = uri.host + ":" + port;
-
- var SSLStatus = recentCertsService.getRecentBadCert(hostWithPort);
- if (!SSLStatus)
- return null;
-
- return SSLStatus;
- };
+ return apd;
+};
- //////////////////////////////////////////////////////////
- // Print SSL certificate details
- // https://developer.mozilla.org/En/How_to_check_the_security_state_of_an_XMLHTTPRequest_over_SSL
- var printCertInfo = function(cert) {
- const Ci = Components.interfaces;
+////////////////////////////////////////////////////////////
+// CERT FUNCTIONS
+////////////////////////////////////////////////////////////
- log("certificate:");
- switch (cert.verifyForUsage(Ci.nsIX509Cert.CERT_USAGE_SSLServer)) {
+// certificate override service class
+// http://www.oxymoronical.com/experiments/xpcomref/applications/Firefox/3.5/interfaces/nsICertOverrideService
+var certOverrideService = Components.classes["@mozilla.org/security/certoverride;1"].getService(Components.interfaces.nsICertOverrideService);
+
+//////////////////////////////////////////////////////////
+// FWIW, aWebProgress listener has:
+// securityUI = [xpconnect wrapped (nsISupports, nsISecureBrowserUI, nsISSLStatusProvider)]
+// but i don't think it can be used because it doesn't hold invalid cert info
+// FIXME: is there a better way to get the cert for the actual current connection?
+var getInvalidCert = function(uri) {
+ try {
+ var cert = getInvalidCertSSLStatus(uri).QueryInterface(Components.interfaces.nsISSLStatus).serverCert;
+ printCertInfo(cert);
+ return cert;
+ } catch(e) {
+ return null;
+ }
+};
+
+//////////////////////////////////////////////////////////
+// gets current ssl status info
+// http://www.oxymoronical.com/experiments/apidocs/interface/nsIRecentBadCertsService
+var getInvalidCertSSLStatus = function(uri) {
+ var recentCertsService =
+ Components.classes["@mozilla.org/security/recentbadcerts;1"].getService(Components.interfaces.nsIRecentBadCertsService);
+ if (!recentCertsService)
+ return null;
+
+ var port = uri.port;
+ if(port == -1)
+ port = 443;
+ var hostWithPort = uri.host + ":" + port;
+
+ var SSLStatus = recentCertsService.getRecentBadCert(hostWithPort);
+ if (!SSLStatus)
+ return null;
+
+ return SSLStatus;
+};
+
+//////////////////////////////////////////////////////////
+// Print SSL certificate details
+// https://developer.mozilla.org/En/How_to_check_the_security_state_of_an_XMLHTTPRequest_over_SSL
+var printCertInfo = function(cert) {
+ const Ci = Components.interfaces;
+
+ log("certificate:");
+ switch (cert.verifyForUsage(Ci.nsIX509Cert.CERT_USAGE_SSLServer)) {
case Ci.nsIX509Cert.VERIFIED_OK:
log("\tSSL status: OK");
break;
@@ -250,26 +250,26 @@ var EXPORTED_SYMBOLS = [
default:
log("\tSSL status: unexpected failure");
break;
- }
- log("\tCommon Name: " + cert.commonName);
- log("\tOrganisation: " + cert.organization);
- log("\tIssuer: " + cert.issuerOrganization);
- log("\tSHA1 fingerprint: " + cert.sha1Fingerprint);
-
- var validity = cert.validity.QueryInterface(Ci.nsIX509CertValidity);
- log("\tValid from: " + validity.notBeforeGMT);
- log("\tValid until: " + validity.notAfterGMT);
- };
+ }
+ log("\tCommon Name: " + cert.commonName);
+ log("\tOrganisation: " + cert.organization);
+ log("\tIssuer: " + cert.issuerOrganization);
+ log("\tSHA1 fingerprint: " + cert.sha1Fingerprint);
- ////////////////////////////////////////////////////////////
- // OVERRIDE CACHE OBJECT
- ////////////////////////////////////////////////////////////
+ var validity = cert.validity.QueryInterface(Ci.nsIX509CertValidity);
+ log("\tValid from: " + validity.notBeforeGMT);
+ log("\tValid until: " + validity.notAfterGMT);
+};
- //////////////////////////////////////////////////////////
- // object to store and retrieve data about monkeysphere status for sites
- // uses string of apd as key, and agent response as data
- var overrides = (function() {
+////////////////////////////////////////////////////////////
+// OVERRIDE CACHE OBJECT
+////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////
+// object to store and retrieve data about monkeysphere status for sites
+// uses string of apd as key, and agent response as data
+var overrides = (
+ function() {
// response cache object
var responses = {};
@@ -280,6 +280,7 @@ var EXPORTED_SYMBOLS = [
log("**** SET OVERRIDE ****");
var uri = apd.uri;
+
var cert = apd.cert;
var SSLStatus = getInvalidCertSSLStatus(uri);
@@ -343,4 +344,4 @@ var EXPORTED_SYMBOLS = [
delete responses[apd.toOverrideLabel()];
}
};
- })();
+})();
--
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