[Pkg-privacy-commits] [xul-ext-monkeysphere] 143/296: moved agent socket location config into standard preferences system
Ximin Luo
infinity0 at moszumanska.debian.org
Mon Aug 24 07:39:34 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 9a242097c410d90457d9f7d9657c1ee1ae65f564
Author: Daniel Kahn Gillmor <dkg at fifthhorseman.net>
Date: Mon Mar 8 01:46:43 2010 -0500
moved agent socket location config into standard preferences system
---
chrome/content/monkeysphere.js | 29 ++++++++++++++++++++---------
defaults/preferences/monkeysphere.js | 2 ++
2 files changed, 22 insertions(+), 9 deletions(-)
diff --git a/chrome/content/monkeysphere.js b/chrome/content/monkeysphere.js
index 4fb4450..09ca503 100644
--- a/chrome/content/monkeysphere.js
+++ b/chrome/content/monkeysphere.js
@@ -31,14 +31,12 @@ var monkeysphere = {
// "http://localhost:8901" <-- NO TRAILING SLASH
agent_socket: [],
- // default socket
- // FIXME: should be configurable via prefs.js
- default_socket: "http://localhost:8901",
-
// override service class
// http://www.oxymoronical.com/experiments/xpcomref/applications/Firefox/3.5/interfaces/nsICertOverrideService
override: Components.classes["@mozilla.org/security/certoverride;1"].getService(Components.interfaces.nsICertOverrideService),
+ prefs: Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch("extensions.monkeysphere."),
+
////////////////////////////////////////////////////////////
// LOG FUNCTIONS
////////////////////////////////////////////////////////////
@@ -82,15 +80,28 @@ var monkeysphere = {
// get localization messages
monkeysphere.messages = document.getElementById("message_strings");
-
+
+ var envvar = "MONKEYSPHERE_VALIDATION_AGENT_SOCKET";;
+ try {
+ envvar = monkeysphere.prefs.getCharPref("validation_agent_socket_environment_variable");
+ } catch (e) {
+ monkeysphere.log("falling back to built-in environment variable: " + envvar);
+ }
+ monkeysphere.log("using environment variable " + envvar);
// get the agent URL from the environment
// https://developer.mozilla.org/en/XPCOM_Interface_Reference/nsIEnvironment
- monkeysphere.agent_socket = Components.classes["@mozilla.org/process/environment;1"].getService(Components.interfaces.nsIEnvironment).get("MONKEYSPHERE_VALIDATION_AGENT_SOCKET");
+ monkeysphere.agent_socket = Components.classes["@mozilla.org/process/environment;1"].getService(Components.interfaces.nsIEnvironment).get(envvar);
// return error if agent URL not set
if(!monkeysphere.agent_socket) {
- var message = "MONKEYSPHERE_VALIDATION_AGENT_SOCKET environment variable not set. Using default of " + monkeysphere.default_socket;
- alert(message);
- monkeysphere.agent_socket = monkeysphere.default_socket;
+ var default_socket = "http://localhost:8901";;
+ try {
+ default_socket = monkeysphere.prefs.getCharPref("default_socket");
+ } catch (e) {
+ monkeysphere.log("falling back to built-in default socket location: " + default_socket);
+ }
+
+ monkeysphere.log(envvar + " environment variable not set. Using default of " + default_socket);
+ monkeysphere.agent_socket = default_socket;
}
// replace trailing slashes
monkeysphere.agent_socket = monkeysphere.agent_socket.replace(/\/*$/, '');
diff --git a/defaults/preferences/monkeysphere.js b/defaults/preferences/monkeysphere.js
new file mode 100644
index 0000000..1ae2a45
--- /dev/null
+++ b/defaults/preferences/monkeysphere.js
@@ -0,0 +1,2 @@
+pref("extensions.monkeysphere.validation_agent_socket_environment_variable", "MONKEYSPHERE_VALIDATION_AGENT_SOCKET");
+pref("extensions.monkeysphere.default_socket", "http://localhost:8901");
--
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