[Pkg-privacy-commits] [xul-ext-monkeysphere] 01/296: add monkeysphere mozilla xul extension
Ximin Luo
infinity0 at moszumanska.debian.org
Mon Aug 24 07:39:19 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 edc1f17afba0d76c5464ff851f9a4e8445ba2f8f
Author: Jameson Graef Rollins <jrollins at finestructure.net>
Date: Tue Jan 5 20:41:26 2010 -0500
add monkeysphere mozilla xul extension
This is a basic skeleton, that can determine a site needs to be
validated, and get the cert, but fails after that (doesn't communicate
with the agent yet).
This extension borrows *very* heavily from the Perspectives [0]
firefox extension [1]. A harty thanks to the giants on whose
shoulders we stand...
http://www.cs.cmu.edu/~perspectives/
http://www.cs.cmu.edu/~perspectives/firefox.html
---
chrome.manifest | 5 +
chrome/content/bad.png | Bin 0 -> 4340 bytes
chrome/content/default.png | Bin 0 -> 937 bytes
chrome/content/dialog_prefs.js | 1 +
chrome/content/dialog_prefs.xul | 44 ++++
chrome/content/dialog_status.js | 69 ++++++
chrome/content/dialog_status.xul | 40 ++++
chrome/content/error.png | Bin 0 -> 4567 bytes
chrome/content/good.png | Bin 0 -> 1190 bytes
chrome/content/info.xul | 11 +
chrome/content/initialize.xul | 18 ++
chrome/content/monkeysphere.js | 448 +++++++++++++++++++++++++++++++++++++++
chrome/content/statusbar.js | 32 +++
chrome/content/statusbar.xul | 41 ++++
chrome/locale/en-US/dialogs.dtd | 13 ++
chrome/locale/en-US/help.html | 18 ++
chrome/locale/en-US/messages | 20 ++
defaults/preferences/prefs.js | 3 +
install.rdf | 34 +++
19 files changed, 797 insertions(+)
diff --git a/chrome.manifest b/chrome.manifest
new file mode 100644
index 0000000..d087293
--- /dev/null
+++ b/chrome.manifest
@@ -0,0 +1,5 @@
+content monkeysphere chrome/content/
+locale monkeysphere en-US chrome/locale/en-US/
+
+overlay chrome://browser/content/browser.xul chrome://monkeysphere/content/initialize.xul
+overlay chrome://browser/content/browser.xul chrome://monkeysphere/content/statusbar.xul
diff --git a/chrome/content/bad.png b/chrome/content/bad.png
new file mode 100644
index 0000000..296415e
Binary files /dev/null and b/chrome/content/bad.png differ
diff --git a/chrome/content/default.png b/chrome/content/default.png
new file mode 100644
index 0000000..13b5efc
Binary files /dev/null and b/chrome/content/default.png differ
diff --git a/chrome/content/dialog_prefs.js b/chrome/content/dialog_prefs.js
new file mode 100644
index 0000000..69c5297
--- /dev/null
+++ b/chrome/content/dialog_prefs.js
@@ -0,0 +1 @@
+var root_prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
diff --git a/chrome/content/dialog_prefs.xul b/chrome/content/dialog_prefs.xul
new file mode 100644
index 0000000..0e1203d
--- /dev/null
+++ b/chrome/content/dialog_prefs.xul
@@ -0,0 +1,44 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
+<!DOCTYPE prefwindow SYSTEM "chrome://monkeysphere/locale/dialogs.dtd">
+
+<prefwindow id="monkeysphere-properties"
+ title="Monkeysphere Preferences"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ buttons=",">
+
+<prefpane id="monkeysphere-main-prefpane">
+
+<preferences>
+ <preference id="check-good"
+ name="monkeysphere.check_good_certificates"
+ type="bool" />
+ <preference id="require-user-permission"
+ name="monkeysphere.require_user_permission"
+ type="bool" />
+</preferences>
+
+<dialogheader title="Monkeysphere" />
+
+<groupbox>
+ <caption label="&WhentoConsultMonkeysphere;" style="font-weight: bold" />
+ <radiogroup preference="check-good">
+ <radio label="&ConsultMonkeysphereforallHTTPSsites;"
+ value="true" />
+ <radio label="&ConsultMonkeysphereonlywhenawebsitescertificatecausesasecurityerror;"
+ value="false" />
+ </radiogroup>
+ <checkbox label="&AlwaysasktheuserbeforeconsultingMonkeysphere;"
+ preference="require-user-permission" />
+</groupbox>
+
+<hbox>
+ <spacer flex="1"/>
+ <button label="&OK;" onclick="acceptDialog(); window.close()"/>
+</hbox>
+
+</prefpane>
+
+<script type="application/x-javascript" src="dialog_prefs.js"/>
+
+</prefwindow>
diff --git a/chrome/content/dialog_status.js b/chrome/content/dialog_status.js
new file mode 100644
index 0000000..44ea6ec
--- /dev/null
+++ b/chrome/content/dialog_status.js
@@ -0,0 +1,69 @@
+var root_prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
+
+monkeysphere.status.form = function() {
+ var sel = document.getElementById("info-radio").selectedIndex;
+ document.getElementById("monkeysphere-svg-box").hidden = sel;
+ document.getElementById("monkeysphere-description").hidden = !sel;
+}
+
+// returns a string that describes whether monkeysphere installed a security exception
+monkeysphere.status.actionStr = function(uri,ti) {
+ if(uri.scheme != "https")
+ return "Monkeysphere only queries 'https' sites. This site uses '" + uri.scheme + "'.";
+ if(ti.is_override_cert && ti.already_trusted)
+ return "Monkeysphere has previously installed a security exception for this site.";
+ if(ti.already_trusted)
+ return "The browser trusts this site and requires no security exception.";
+ if(ti.is_override_cert && ti.notary_valid && ti.exceptions_enabled && ti.isTemp)
+ return "Monkeysphere installed a temporary security exception for this site.";
+ if(ti.is_override_cert && ti.notary_valid && ti.exceptions_enabled && !ti.isTemp)
+ return "Monkeysphere installed a permanent security exception for this site.";
+ return "No security exception has been installed.";
+};
+
+monkeysphere.status.load = function() {
+ try {
+ var info = document.getElementById("monkeysphere-description");
+ var host = document.getElementById("monkeysphere-information-caption");
+
+ if(!window.opener) {
+ log("error", "window.opener is null in results dialog");
+ return;
+ }
+ var uri = window.opener.gBrowser.currentURI;
+ if(!uri) {
+ log("error", "null URI in results dialog");
+ return;
+ }
+ try {
+ var ignore = uri.host;
+ } catch(e) {
+ return;
+ }
+
+ var other_cache = window.opener.other_cache;
+ var cert = window.opener.ssl_cache[uri.host];
+ var ti = window.opener.tab_info_cache[uri.spec];
+ host.label = uri.host;
+ if(ti) {
+ host.label += ": " + getActionStr(uri, ti);
+ }
+ if(cert){
+ info.value = cert.summary;
+ liner.value = cert.tooltip;
+ if(cert.svg && cert.svg != ""){
+ info.hidden = true;
+ var radio = document.getElementById("info-radio");
+ radio.hidden=false;
+ radio.selectedIndex = 0;
+ }
+ } else if (other_cache["reason"]) {
+ info.value = other_cache["reason"];
+ }
+ } catch(e) {
+ var text = "error loading results dialog: " + e;
+ log("error", text);
+ alert(text);
+ }
+ return true;
+};
diff --git a/chrome/content/dialog_status.xul b/chrome/content/dialog_status.xul
new file mode 100644
index 0000000..a2beb7c
--- /dev/null
+++ b/chrome/content/dialog_status.xul
@@ -0,0 +1,40 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
+<!DOCTYPE prefwindow SYSTEM "chrome://monkeysphere/locale/dialogs.dtd">
+
+<window id="monkeysphere-results"
+ title="Monkeysphere Results"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ buttons=","
+ onload="monkeysphere.dialog.status()">
+
+<vbox>
+ <groupbox minheight="235">
+ <caption id="monkeysphere-information-caption"
+ label="Detailed Information"
+ style="font-weight: bold"
+ />
+ <textbox id="monkeysphere-description"
+ multiline="true"
+ readonly="true"
+ flex="1"
+ value="&ThereisnoMonkeysphereinformationavailableforthislocation;"
+ />
+ <!-- svg goes into this box -->
+ <scrollbox id="monkeysphere-svg-box"/>
+ </groupbox>
+ <radiogroup id="info-radio"
+ hidden="true"
+ orient="horizontal"
+ onclick="switchResultForm()">
+ </radiogroup>
+</vbox>
+
+<hbox>
+ <spacer flex="1"/>
+ <button label="&Close;" onclick="window.close()"/>
+</hbox>
+
+<script type="application/x-javascript" src="dialog_status.js"/>
+
+</window>
diff --git a/chrome/content/error.png b/chrome/content/error.png
new file mode 100644
index 0000000..1c6b8eb
Binary files /dev/null and b/chrome/content/error.png differ
diff --git a/chrome/content/good.png b/chrome/content/good.png
new file mode 100644
index 0000000..7aab3d1
Binary files /dev/null and b/chrome/content/good.png differ
diff --git a/chrome/content/info.xul b/chrome/content/info.xul
new file mode 100644
index 0000000..ebf39c3
--- /dev/null
+++ b/chrome/content/info.xul
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+
+<window id="monkeysphere-statusbar"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+ <textbox id="bbox" multiline ="true" cols="80" rows="30"/>
+
+ <script>
+ document.getElementById("bbox").value=window.arguments[0];
+ </script>
+</window>
diff --git a/chrome/content/initialize.xul b/chrome/content/initialize.xul
new file mode 100644
index 0000000..908d52d
--- /dev/null
+++ b/chrome/content/initialize.xul
@@ -0,0 +1,18 @@
+<?xml version="1.0"?>
+
+<overlay id="validation-agent-init"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+ <script type="application/x-javascript" src="monkeysphere.js" />
+
+ <script type="text/javascript">
+ window.addEventListener('load',evtLoad,false);
+ function evtLoad(evt) {
+ monkeysphere.init();
+ if(!root_prefs.getBoolPref("monkeysphere.show_label")){
+ document.getElementById("monkeysphere-statusbar-label").hidden = true;
+ }
+ }
+ </script>
+
+</overlay>
diff --git a/chrome/content/monkeysphere.js b/chrome/content/monkeysphere.js
new file mode 100644
index 0000000..dd42c3b
--- /dev/null
+++ b/chrome/content/monkeysphere.js
@@ -0,0 +1,448 @@
+// Monkeysphere global namespace
+var monkeysphere = {
+
+ states: {
+ ERR: -1,
+ SEC: 0,
+ INS: 1,
+ NEU: 2
+ },
+
+ root_prefs: Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranchInternal),
+ override_service: Components.classes["@mozilla.org/security/certoverride;1"].getService(Components.interfaces.nsICertOverrideService),
+
+////////////////////////////////////////////////////////////
+// LOG FUNCTIONS
+////////////////////////////////////////////////////////////
+
+ log: function(flag, line) {
+ var log_all = true;
+
+ var log_flags = {
+ "policy" : false,
+ "query" : false,
+ "main" : false,
+ "error" : false
+ };
+
+ line = "monkeysphere: " + flag + ": " + line;
+ try {
+ if(!log_flags[flag] && !log_all)
+ return;
+ dump(line);
+ try {
+ // this line works in extensions
+ Firebug.Console.log(line);
+ } catch(e) {
+ // ignore, this will blow up if Firebug is not installed
+ }
+ try {
+ console.log(line); // this line works in HTML files
+ } catch(e) {
+ // ignore, this will blow up if Firebug is not installed
+ }
+ } catch(e) {
+ alert(e);
+ }
+ },
+
+////////////////////////////////////////////////////////////
+// INITIALIZATION
+////////////////////////////////////////////////////////////
+
+ // initialization function
+ init: function() {
+ monkeysphere.log("main", "begin initialization");
+ monkeysphere.setStatus(null, monkeysphere.states.NEU, "");
+ monkeysphere.messages = document.getElementById("message_strings");
+ getBrowser().addProgressListener(monkeysphere.listener,
+ Components.interfaces.nsIWebProgress.NOTIFY_STATE_DOCUMENT);
+ // FIXME: do we need this? what is it for?
+ //setTimeout(function (){ requeryAllTabs(gBrowser); }, 4000);
+ monkeysphere.log("main", "initialization complete");
+ },
+
+////////////////////////////////////////////////////////////
+// STATUS FUNCTIONS
+////////////////////////////////////////////////////////////
+
+ // set the status
+ setStatus: function(uri,state, tooltip) {
+ if(uri != null && uri != window.gBrowser.currentURI) {
+ monkeysphere.log("error","setStatus: uri missing");
+ return;
+ }
+ if(!tooltip) {
+ tooltip = "Monkeysphere";
+ }
+
+ var i = document.getElementById("monkeysphere-status-image");
+ var t = document.getElementById("monkeysphere-status");
+
+ // the following happens when called from a dialog
+ if(!t || !i) {
+ i = window.opener.document.getElementById("monkeysphere-status-image");
+ t = window.opener.document.getElementById("monkeysphere-status");
+ }
+
+ t.setAttribute("tooltiptext", tooltip);
+ switch(state){
+ case monkeysphere.states.SEC:
+ monkeysphere.log("main", "set status: secure\n");
+ i.setAttribute("src", "chrome://monkeysphere/content/good.png");
+ break;
+ case monkeysphere.states.INS:
+ monkeysphere.log("main", "set status: unsecure\n");
+ i.setAttribute("src", "chrome://monkeysphere/content/bad.png");
+ break;
+ case monkeysphere.states.NEU:
+ monkeysphere.log("main", "set status: neutral\n");
+ i.setAttribute("src", "chrome://monkeysphere/content/default.png");
+ break;
+ case monkeysphere.states.ERR:
+ monkeysphere.log("main", "set status: error\n");
+ i.setAttribute("src", "chrome://monkeysphere/content/error.png");
+ break;
+ }
+ monkeysphere.log("main", "tooltip: " + tooltip + "\n");
+ },
+
+ // create the event listener object
+ listener: {
+ onLocationChange:
+ function(aWebProgress, aRequest, aURI) {
+ try {
+ monkeysphere.log("main", "listener: location change: " + aURI.spec);
+ monkeysphere.updateStatus(gBrowser, false);
+ } catch(err) {
+ monkeysphere.log("error", "listener: location change: " + err);
+ monkeysphere.setStatus(aURI,
+ monkeysphere.states.ERR,
+ monkeysphere.messages.getFormattedString("internalError",
+ [err]));
+ }
+ },
+ onStateChange:
+ function(aWebProgress, aRequest, aFlag, aStatus) {
+ var uri = gBrowser.currentURI;
+ monkeysphere.log("main", "listener: state change " + uri.spec);
+ if(!aFlag || !Components.interfaces.nsIWebProgressListener.STATE_STOP)
+ return;
+ try {
+ monkeysphere.updateStatus(gBrowser, false);
+ } catch (err) {
+ monkeysphere.log("error", "listener: state change: " + err);
+ monkeysphere.setStatus(uri,
+ monkeysphere.states.ERR,
+ monkeysphere.messages.getFormattedString("internalError",
+ [err]));
+ }
+ },
+ onSecurityChange: function() { }, // FIXME: should we be looking at this too?
+ onStatusChange: function() { },
+ onProgressChange: function() { },
+ onLinkIconAvailable: function() { }
+ },
+
+ // FIXME: what is this functions for? why do we need it?
+ requeryAllTabs: function(b) {
+ var num = b.browsers.length;
+ for (var i = 0; i < num; i++) {
+ var browser = b.getBrowserAtIndex(i);
+ updateStatus(browser, false);
+ }
+ },
+
+ // Updates the status of the current page
+ // 'has_user_permission' indicates whether the user
+ // explicitly pressed a button to launch this query,
+ // by default this is not the case
+ updateStatus: function(browser, has_user_permission) {
+ if(!browser) {
+ monkeysphere.log("error", "no browser!?!");
+ return;
+ }
+ var uri = browser.currentURI;
+ if(!uri) {
+ monkeysphere.setStatus(uri,
+ monkeysphere.states.NEU,
+ monkeysphere.messages.getString("statusNoData"));
+ return;
+ }
+
+ monkeysphere.log("main", "updating status: " + uri.spec);
+
+ // check uri host
+ try {
+ var ignore = uri.host;
+ } catch(err) {
+ monkeysphere.setStatus(uri,
+ monkeysphere.states.NEU,
+ monkeysphere.messages.getFormattedString("statusURLNotValid"));
+ return;
+ }
+ if(!uri.host) {
+ monkeysphere.log("main", "uri host empty");
+ return;
+ }
+
+ // test for https
+ monkeysphere.log("main", "uri scheme: " + uri.scheme);
+ if(uri.scheme != "https") {
+ monkeysphere.log("main", "uri scheme not https. ignoring");
+ monkeysphere.setStatus(uri,
+ monkeysphere.states.NEU,
+ monkeysphere.messages.getFormattedString("statusNonHTTPS",
+ [uri.scheme]));
+ return;
+ }
+
+ monkeysphere.log("main", "retrieving site certificate");
+
+ // create tab info array
+ var tab_info = {};
+ tab_info.broken = false;
+ tab_info.cert = monkeysphere.getCertificate(browser);
+
+ // check site certificate
+ if(!tab_info.cert) {
+ setStatus(uri,
+ monkeysphere.states.ERR,
+ monkeysphere.messages.getFormattedString("statusNoCert",
+ [uri.host]));
+ return;
+ }
+ var sha1 = tab_info.cert.sha1Fingerprint;
+ var state = browser.securityUI.state;
+ monkeysphere.log("main", "cert: md5: " + sha1 + ", state: " + state);
+
+ tab_info.is_override_cert = monkeysphere.override_service.isCertUsedForOverrides(tab_info.cert, true, true);
+ monkeysphere.log("main", "is_override_cert = " + tab_info.is_override_cert);
+ var check_good = monkeysphere.root_prefs.getBoolPref("monkeysphere.check_good_certificates");
+
+ if(state && Components.interfaces.nsIWebProgressListener.STATE_IS_SECURE) {
+ monkeysphere.log("main", "clearing existing permission banners");
+ monkeysphere.notify.clear(browser, "Monkeysphere-Permission");
+ }
+
+ // see if the browser has this cert installed prior to this browser session
+ tab_info.already_trusted =
+ (state & Components.interfaces.nsIWebProgressListener.STATE_IS_SECURE)
+ && !(tab_info.is_override_cert);
+
+ if(tab_info.already_trusted) {
+ monkeysphere.log("main", "site cert already trusted by browser");
+ if(!check_good) {
+ monkeysphere.log("main", "preferences don't require check");
+ monkeysphere.setStatus(uri,
+ monkeysphere.states.NEU,
+ monkeysphere.messages.getString("statusNoQueryRequested"));
+ return;
+ }
+ }
+ if(!tab_info.is_override_cert
+ && state
+ && Components.interfaces.nsIWebProgressListener.STATE_IS_INSECURE) {
+ monkeysphere.log("main", "state is INSECURE, override required");
+ tab_info.broken = true;
+ }
+
+ // check if user permission required
+ var needs_perm = monkeysphere.root_prefs.getBoolPref("monkeysphere.require_user_permission");
+ if(needs_perm && !has_user_permission) {
+ monkeysphere.log("main", "user permission required");
+ // NOTE: this function potentially calls the calling function!
+ monkeysphere.notify.needsPermission(browser);
+ monkeysphere.setStatus(uri,
+ monkeysphere.states.NEU,
+ monkeysphere.messages.getString("statusNeedsPermission"));
+ return;
+ }
+
+ // query the agent
+ monkeysphere.log("main", "querying validation agent");
+ var agent_result = monkeysphere.queryAgent(tab_info.cert, uri, browser);
+ if(!agent_result) {
+ monkeysphere.log("error", "validation agent error");
+ monkeysphere.notify.agentProblem(browser);
+ monkeysphere.setStatus(uri,
+ monkeysphere.states.ERR,
+ monkeysphere.messages.getString("agentError"));
+ return;
+ }
+ },
+
+ // query the validation agent
+ queryAgent: function(cert, uri) {
+ monkeysphere.log("main", "query: " + uri);
+ monkeysphere.log("main", "query: " + cert);
+
+ return null;
+ },
+
+////////////////////////////////////////////////////////////
+// CERT FUNCTIONS
+////////////////////////////////////////////////////////////
+
+ getCertificate: function(browser) {
+ var cert = monkeysphere.getValidCert(browser.securityUI);
+ if(!cert)
+ cert = monkeysphere.getInvalidCert(browser.currentURI);
+ if(!cert)
+ return null;
+ return cert;
+ },
+
+ // gets current certificate, if it PASSED the browser check
+ getValidCert: function(ui) {
+ try {
+ ui.QueryInterface(Components.interfaces.nsISSLStatusProvider);
+ if(!ui.SSLStatus)
+ return null;
+ return ui.SSLStatus.serverCert;
+ } catch (e) {
+ monkeysphere.log("error", e);
+ return null;
+ }
+ },
+
+ // gets current certificat, if it FAILED the security check
+ getInvalidCert: function(uri) {
+ var recentCertsSvc =
+ Components.classes["@mozilla.org/security/recentbadcerts;1"]
+ .getService(Components.interfaces.nsIRecentBadCertsService);
+ if (!recentCertsSvc)
+ return null;
+
+ var port = uri.port;
+ if(port == -1)
+ port = 443;
+
+ var hostWithPort = uri.host + ":" + port;
+ var gSSLStatus = recentCertsSvc.getRecentBadCert(hostWithPort);
+ if (!gSSLStatus)
+ return null;
+
+ return gSSLStatus.QueryInterface(Components.interfaces.nsISSLStatus).serverCert;
+ },
+
+////////////////////////////////////////////////////////////
+// NOTIFICATION FUNCTIONS
+////////////////////////////////////////////////////////////
+
+ notify: {
+ // clear notification
+ clear: function(browser, value) {
+ try {
+ try{
+ var notificationBox = browser.getNotificationBox();
+ } catch(e){
+ return;
+ }
+ var oldNotification =
+ notificationBox.getNotificationWithValue(value);
+ if(oldNotification != null)
+ notificationBox.removeNotification(oldNotification);
+ } catch (err) {
+ monkeysphere.log("error","clearNotification error: " + err);
+ }
+ },
+
+ // this is the drop down which is shown if preferences indicate
+ // that queries require user permission
+ needsPermission: function(browser) {
+ var notificationBox = browser.getNotificationBox();
+
+ monkeysphere.notify.clear(browser, "Monkeysphere");
+
+ var message = monkeysphere.messages.getString("needsPermission");
+ var priority = notificationBox.PRIORITY_WARNING_HIGH;
+ var buttons = [
+ {
+ label: monkeysphere.messages.getString("yesQuery"),
+ accessKey : "",
+ callback: function() {
+ // FIXME: this might be a problem if there are other notifications,
+ // but I can't figure out how to make it go away cleanly at startup
+ notificationBox.removeAllNotifications();
+
+ // update status
+ monkeysphere.log("main", "user gives query permission");
+ var uri = browser.currentURI;
+ monkeysphere.updateStatus(browser,true);
+ }
+ },
+ {
+ label: monkeysphere.messages.getString("learnMore"),
+ accessKey : "",
+ callback: function() {
+ browser.loadOneTab("chrome://monkeysphere/locale/help.html",
+ null, null, null, false);
+ }
+ }
+ ];
+ notificationBox.appendNotification(message, "Monkeysphere",
+ null, priority, buttons);
+ },
+
+ // this is the drop down which is shown if there
+ // is a problem with the validation agent
+ agentProblem: function(browser) {
+ var notificationBox = browser.getNotificationBox();
+
+ monkeysphere.notify.clear(browser, "Monkeysphere");
+
+ var message = monkeysphere.messages.getString("agentError");
+ var priority = notificationBox.PRIORITY_CRITICAL_LOW;
+ var buttons = [
+ {
+ label: "help",
+ accessKey : "",
+ callback: function() {
+ browser.loadOneTab("chrome://monkeysphere/locale/help.html",
+ null, null, null, false);
+ }
+ }
+ ];
+ notificationBox.appendNotification(message, "Monkeysphere", null,
+ priority, buttons);
+ },
+
+ // override a verification success with a monkeyspehre query
+ override: function(browser) {
+ var notificationBox = browser.getNotificationBox();
+
+ monkeysphere.notify.clear(browser, "Monkeysphere");
+
+ var message = monkeysphere.messages.getString("verificationSuccess");
+ var priority = notificationBox.PRIORITY_INFO_LOW;
+ var buttons = [
+ {
+ label: monkeysphere.messages.getString("learnMore"),
+ accessKey : "",
+ callback: function() {
+ browser.loadOneTab("chrome://monkeysphere/locale/help.html",
+ null, null, null, false);
+ }
+ }
+ ];
+ notificationBox.appendNotification(message, "Monkeysphere",
+ null, priority, buttons);
+ },
+
+ // alert to failure to verify host
+ failed: function(browser) {
+ var notificationBox = browser.getNotificationBox();
+
+ monkeysphere.notifiy.clear(browser, "Monkeysphere");
+
+ var message = monkeysphere.messages.getString("unableToVerify");
+ var priority = notificationBox.PRIORITY_CRITICAL_LOW;
+ var buttons = null;
+
+ notificationBox.appendNotification(message, "Monkeysphere",
+ null, priority, buttons);
+ }
+ }
+
+};
diff --git a/chrome/content/statusbar.js b/chrome/content/statusbar.js
new file mode 100644
index 0000000..f21547c
--- /dev/null
+++ b/chrome/content/statusbar.js
@@ -0,0 +1,32 @@
+// note: when debugging, it is useful to open this dialogs as
+// windows for firebug console, etc
+
+monkeysphere.dialog = {
+ status: function() {
+ window.openDialog(
+ //window.open( // for debug
+ "chrome://monkeysphere/content/dialog_status.xul",
+ //"monkeysphereResults", "").focus(); // for debug
+ "monkeysphereResults", "centerscreen, chrome, toolbar").focus();
+ },
+
+ prefs: function() {
+ window.openDialog(
+ //window.open( // for debug
+ "chrome://monkeysphere/content/dialog_prefs.xul",
+ //"monkeysphereResults", "").focus(); // for debug
+ "monkeysphereResults", "centerscreen, chrome, toolbar").focus();
+ },
+
+ certs: function() {
+ openDialog("chrome://pippki/content/certManager.xul", "Certificate Manager");
+ },
+
+ help: function() {
+ gBrowser.loadOneTab("chrome://monkeysphere/locale/help.html",
+ null, null, null, false);
+ // openDialog("chrome://monkeysphere/locale/help.html",
+ // "",
+ // "width=600,height=600,resizable=yes");
+ },
+};
diff --git a/chrome/content/statusbar.xul b/chrome/content/statusbar.xul
new file mode 100644
index 0000000..8c77348
--- /dev/null
+++ b/chrome/content/statusbar.xul
@@ -0,0 +1,41 @@
+<?xml version="1.0"?>
+
+<overlay id="monkeysphere-statusbar"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+<stringbundleset id="stringbundleset">
+ <stringbundle id="message_strings"
+ src="chrome://monkeysphere/locale/messages"
+ insertbefore="1" />
+</stringbundleset>
+
+ <script type="application/x-javascript" src="monkeysphere.js" />
+ <script type="application/x-javascript" src="statusbar.js" />
+
+ <statusbar id="status-bar">
+
+ <statusbarpanel id="monkeysphere-status"
+ ondblclick="monkeysphere.dialog.status();"
+ tooltiptext="Monkeysphere">
+ <image id="monkeysphere-status-image"
+ src="chrome://monkeysphere/content/default.png"
+ style="width:16px; height:16px;"
+ context="monkeysphere-contextmenu" />
+ </statusbarpanel>
+
+ <popupset>
+ <popup id="monkeysphere-contextmenu" position="after_start">
+ <menuitem label="View Monkeysphere Status"
+ oncommand="monkeysphere.dialog.results()" />
+ <menuseparator />
+ <menuitem label="Preferences"
+ oncommand="monkeysphere.dialog.prefs()" />
+ <menuitem label="View Certificate Store"
+ oncommand="monkeysphere.dialog.certs()" />
+ <menuitem label="Help" oncommand="monkeysphere.dialog.help()"/>
+ </popup>
+ </popupset>
+
+ </statusbar>
+
+</overlay>
diff --git a/chrome/locale/en-US/dialogs.dtd b/chrome/locale/en-US/dialogs.dtd
new file mode 100644
index 0000000..281d940
--- /dev/null
+++ b/chrome/locale/en-US/dialogs.dtd
@@ -0,0 +1,13 @@
+<!ENTITY NotaryResults "Notary Results">
+<!ENTITY Preferences "Preferences">
+<!ENTITY ThereisnoMonkeysphereinformationavailableforthislocation "There is no Monkeysphere information available for this location">
+<!ENTITY Timeline "Timeline">
+<!ENTITY ManualConfiguration "Manual Configuration">
+<!ENTITY WhentoConsultMonkeysphere "When to Consult Monkeysphere">
+<!ENTITY ConsultMonkeysphereforallHTTPSsites "Consult Monkeysphere for all HTTPS sites">
+<!ENTITY ConsultMonkeysphereonlywhenawebsitescertificatecausesasecurityerror "Consult Monkeysphere only when a website's certificate causes a security error">
+<!ENTITY AlwaysasktheuserbeforeconsultingMonkeysphere "Always ask the user before consulting Monkeysphere">
+<!ENTITY Certificates "Certificates">
+<!ENTITY Help "Help">
+<!ENTITY OK "OK">
+<!ENTITY Close "Close">
diff --git a/chrome/locale/en-US/help.html b/chrome/locale/en-US/help.html
new file mode 100644
index 0000000..985624d
--- /dev/null
+++ b/chrome/locale/en-US/help.html
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+
+<head>
+<title>Monkeysphere Help</title>
+</head>
+
+<body>
+<h1>Monkeysphere Help</h1>
+
+<h3> What is Monkeysphere?</h3>
+
+<p><a href="http://web.monkeysphere.info/">Monkeysphere!!!</a>
+
+</body>
+</html>
diff --git a/chrome/locale/en-US/messages b/chrome/locale/en-US/messages
new file mode 100644
index 0000000..a78ab0a
--- /dev/null
+++ b/chrome/locale/en-US/messages
@@ -0,0 +1,20 @@
+internalError=Monkeysphere: internal error: %1$S
+
+# notification messages
+needsPermission=Query Monkeysphere validation agent for security information for this site?
+verificationSuccess=Monkeysphere has verified the security of your connection to this website and has bypassed Firefox's security error page.
+unableToVerify=Monkeysphere was unable to verify the security of your connection to this website.
+agentError=Monkeysphere validation agent error!
+
+# notification button messages
+yesQuery=Yes, query validation agent
+learnMore=Learn more
+
+# status messages
+statusURLNotValid=Monkeysphere: URL is not a valid remote server
+statusNoData=Monkeysphere: browser provided an empty URI for this connection. Try hitting refresh.
+statusNonHTTPS=Monkeysphere: non-https website (scheme is '%1$S').
+statusWhitelist=Monkeysphere: %1$S is whitelisted.
+statusNoCert=Monkeysphere: unable to retrieve a certificate for %1$S
+statusNoQueryRequested=Monkeysphere: site already trusted.
+statusNeedsPermission=Monkeysphere: permission required to query validation agent.
diff --git a/defaults/preferences/prefs.js b/defaults/preferences/prefs.js
new file mode 100644
index 0000000..e7b18e1
--- /dev/null
+++ b/defaults/preferences/prefs.js
@@ -0,0 +1,3 @@
+pref("monkeysphere.check_good_certificates", false);
+pref("monkeysphere.require_user_permission", true);
+pref("monkeysphere.show_label", true);
diff --git a/install.rdf b/install.rdf
new file mode 100644
index 0000000..6d2e7df
--- /dev/null
+++ b/install.rdf
@@ -0,0 +1,34 @@
+<?xml version="1.0"?>
+
+<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:em="http://www.mozilla.org/2004/em-rdf#">
+
+ <Description about="urn:mozilla:install-manifest">
+ <em:id>monkeysphere at monkeysphere.info</em:id>
+ <em:name>Monkeysphere</em:name>
+ <em:version>0.1</em:version>
+ <em:type>2</em:type>
+ <em:optionsURL>chrome://monkeysphere/content/dialog_prefs.xul</em:optionsURL>
+
+ <!-- Firefox -->
+ <em:targetApplication>
+ <Description>
+ <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
+ <em:minVersion>3.0</em:minVersion>
+ <em:maxVersion>3.*</em:maxVersion>
+ </Description>
+ </em:targetApplication>
+ <em:localized>
+ <Description>
+ <em:locale>en-US</em:locale>
+ <em:name>Monkeysphere</em:name>
+ <em:description>Consult Monkeysphere validation-agent
+ for validation of x.509 certificates with OpenPGP keys.
+ </em:description>
+ <em:creator>The Monkeysphere Project</em:creator>
+ <em:homepageURL>http://monkeysphere.info/validation-agent/</em:homepageURL>
+ </Description>
+ </em:localized>
+ </Description>
+
+</RDF>
--
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