[Pkg-mozext-commits] [perspectives-extension] 09/72: Hide "report attack" functionality. Fixes #122

David Prévot taffit at moszumanska.debian.org
Thu Dec 11 02:12:45 UTC 2014


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

taffit pushed a commit to branch master
in repository perspectives-extension.

commit c0e475e24bae97c6598c760e45a6fb89e010b8e6
Author: Gerold Meisinger <gerold.meisinger at gmail.com>
Date:   Mon Jun 16 18:05:47 2014 +0100

    Hide "report attack" functionality.
    Fixes #122
---
 plugin/chrome/content/notify.js     | 185 ++++++++++++++++++------------------
 plugin/chrome/content/statusbar.xul |  58 +++++------
 2 files changed, 124 insertions(+), 119 deletions(-)

diff --git a/plugin/chrome/content/notify.js b/plugin/chrome/content/notify.js
index ca49b28..faa81de 100644
--- a/plugin/chrome/content/notify.js
+++ b/plugin/chrome/content/notify.js
@@ -20,39 +20,39 @@
 var Pers_notify = {
 
 	// unique identifier for each notification
-	// this is used to determine whether we need to 
+	// this is used to determine whether we need to
 	// show a notification, or whether it is a duplication
 	// of the last notification we showed the user for that
-	// website.  
-	TYPE_OVERRIDE : 1, 
-	TYPE_OVERRIDE_MIXED : 2, 
-	TYPE_WHITELIST : 3, 
-	TYPE_FAILED : 4, 
-	TYPE_NEEDS_PERMISSION : 5,  
-	TYPE_NO_REPLIES : 6, 
+	// website.
+	TYPE_OVERRIDE : 1,
+	TYPE_OVERRIDE_MIXED : 2,
+	TYPE_WHITELIST : 3,
+	TYPE_FAILED : 4,
+	TYPE_NEEDS_PERMISSION : 5,
+	TYPE_NO_REPLIES : 6,
 
 	do_notify : function(ti, type) {
-		if(ti.last_banner_type == type) { 
-			return; 
+		if(ti.last_banner_type == type) {
+			return;
 		}
-		ti.last_banner_type = type; 
-		switch(type) { 
+		ti.last_banner_type = type;
+		switch(type) {
 			case this.TYPE_OVERRIDE :
-				this.notifyOverride(ti.browser, false); break; 
-			case this.TYPE_OVERRIDE_MIXED :  
-				this.notifyOverride(ti.browser, true); break; 
-			case this.TYPE_WHITELIST : 
-				this.notifyWhitelist(ti.browser); break; 
-			case this.TYPE_FAILED : 
-				this.notifyFailed(ti.browser); break; 
-			case this.TYPE_NEEDS_PERMISSION : 
-				this.notifyNeedsPermission(ti); break; 
-			case this.TYPE_NO_REPLIES : 
-				this.notifyNoReplies(ti.browser); break; 
-			default: 
-				Pers_debug.d_print("error", "Unknown notify type: " + type); 
+				this.notifyOverride(ti.browser, false); break;
+			case this.TYPE_OVERRIDE_MIXED :
+				this.notifyOverride(ti.browser, true); break;
+			case this.TYPE_WHITELIST :
+				this.notifyWhitelist(ti.browser); break;
+			case this.TYPE_FAILED :
+				this.notifyFailed(ti.browser); break;
+			case this.TYPE_NEEDS_PERMISSION :
+				this.notifyNeedsPermission(ti); break;
+			case this.TYPE_NO_REPLIES :
+				this.notifyNoReplies(ti.browser); break;
+			default:
+				Pers_debug.d_print("error", "Unknown notify type: " + type);
 		}
-	}, 
+	},
 
 	// generic notify function used by all other notify functions
 	notifyGeneric: function(b, priority, message, buttons){
@@ -65,7 +65,7 @@ var Pers_notify = {
 			return;
 		}
 		var notificationBox = b.getNotificationBox();
-		this.clear_existing_banner(b, "Perspectives"); 
+		this.clear_existing_banner(b, "Perspectives");
 
 		notificationBox.appendNotification(message, "Perspectives", null, notificationBox[priority], buttons);
 	},
@@ -75,53 +75,55 @@ var Pers_notify = {
 		var priority = "PRIORITY_INFO_LOW";
 		var message = mixed_security ? Perspectives.strbundle.getString("validatedButInsecureEmbedded") :  Perspectives.strbundle.getString("verificationSuccess");
 		var buttons = [{
-			accessKey : "", 
-			label: Perspectives.strbundle.getString("learnMore"), 
-			accessKey : "", 
+			accessKey : "",
+			label: Perspectives.strbundle.getString("learnMore"),
+			accessKey : "",
 			callback: function() {
 				b.loadOneTab("chrome://perspectives/content/help.xhtml", null,
 							 null, null, false);
 			}
 		}];
-   		this.notifyGeneric(b, priority, message, buttons);  
+   		this.notifyGeneric(b, priority, message, buttons);
 	},
-	
+
 	notifyWhitelist: function(b){
 
 		var priority = "PRIORITY_INFO_LOW";
 		var message = Perspectives.strbundle.getString("configuredToWhitelist");
 		var buttons = [
 			{
-			accessKey : "", 
+			accessKey : "",
 			label: Perspectives.strbundle.getString("removeFromWhitelist"),
-			accessKey : "", 
+			accessKey : "",
 			callback: function() {
-				Pers_whitelist_dialog.remove_from_whitelist(b); 
+				Pers_whitelist_dialog.remove_from_whitelist(b);
 			}
 			}
 		];
-   		this.notifyGeneric(b, priority, message, buttons);  
+   		this.notifyGeneric(b, priority, message, buttons);
 	},
 
 	notifyFailed: function(b){
 		var priority = "PRIORITY_CRITICAL_LOW";
-		var message = Perspectives.strbundle.getString("unableToVerify");  
-		var buttons = [{
-		 	label: Perspectives.strbundle.getString("reportThis"), 
-		 	accessKey : "", 
-		 	callback: function() {
-				Pers_report.report_attack(); 
-		 	}
-		  }, 
-		  {
-			label: Perspectives.strbundle.getString("addToWhitelist"),
-		 	accessKey : "", 
-		 	callback: function() {
-				Pers_whitelist_dialog.add_to_whitelist(); 
-		 	}
-		  }
-		]; 
-   		this.notifyGeneric(b, priority, message, buttons);  
+		var message = Perspectives.strbundle.getString("unableToVerify");
+		var buttons = [
+// Report attack always fails at the moment. Hide it until we fix it. issue #122
+//			{
+//				label: Perspectives.strbundle.getString("reportThis"),
+//				accessKey: "",
+//				callback: function () {
+//					Pers_report.report_attack();
+//				}
+//			},
+			{
+				label: Perspectives.strbundle.getString("addToWhitelist"),
+				accessKey: "",
+				callback: function () {
+					Pers_whitelist_dialog.add_to_whitelist();
+				}
+			}
+		];
+   		this.notifyGeneric(b, priority, message, buttons);
 	},
 
 	// this is the drop down which is shown if preferences indicate
@@ -140,7 +142,7 @@ var Pers_notify = {
 					label: Perspectives.strbundle.getString("yesContactNotaries"),
 					accessKey : "",
 					callback: function() {
-						try { 
+						try {
 
 							//Happens on requeryAllTabs
 							try{
@@ -152,7 +154,7 @@ var Pers_notify = {
 
 							var nbox = ti.browser.getNotificationBox();
 							nbox.removeCurrentNotification();
-						} 
+						}
 						catch (err) {
 							// sometimes, this doesn't work.  why?
 							// well, we'll just have to remove them all
@@ -178,7 +180,7 @@ var Pers_notify = {
 							Perspectives.updateStatus(window,false);
 						} catch (e) {
 							Pers_debug.d_print("main", "Error on UpdateStatus: " + e);
-						} 
+						}
 					}
 				},
 				{
@@ -187,7 +189,7 @@ var Pers_notify = {
 					callback: function() {
 						ti.browser.loadOneTab("chrome://perspectives/content/help.xhtml",
 									 null, null, null, false);
-					} 
+					}
 				},
 				{
 					label: Perspectives.strbundle.getString("hideNotificationReminders"),
@@ -202,40 +204,41 @@ var Pers_notify = {
 		}
 	},
 
-	// this is the drop down which is shown if we receive no notary replies.  
+	// this is the drop down which is shown if we receive no notary replies.
 	notifyNoReplies: function(b){
 		var priority = "PRIORITY_CRITICAL_LOW";
-		var message = Perspectives.strbundle.getString("noRepliesReceived");  
+		var message = Perspectives.strbundle.getString("noRepliesReceived");
 		var buttons = [
-		 {
-		 	label: Perspectives.strbundle.getString("reportThis"), 
-		 	accessKey : "", 
-		 	callback: function() {
-				Pers_report.report_attack(); 
-		 	}
-		  }, 
-		  { 
-			label: Perspectives.strbundle.getString("firewallHelp"),
-			accessKey : "", 
-			callback: function() {
-				b.loadOneTab(
-					"chrome://perspectives/content/firewall.xhtml",
-					null, null, null, false);
-			} 
-		  }, 
-		  {
-			label: Perspectives.strbundle.getString("addToWhitelist"),
-		 	accessKey : "", 
-		 	callback: function() {
-				Pers_whitelist_dialog.add_to_whitelist(); 
-		 	}
-		  }
+// Report attack always fails at the moment. Hide it until we fix it. issue #122
+//			{
+//				label: Perspectives.strbundle.getString("reportThis"),
+//				accessKey: "",
+//				callback: function () {
+//					Pers_report.report_attack();
+//				}
+//			},
+			{
+				label: Perspectives.strbundle.getString("firewallHelp"),
+				accessKey: "",
+				callback: function () {
+					b.loadOneTab(
+						"chrome://perspectives/content/firewall.xhtml",
+						null, null, null, false);
+				}
+			},
+			{
+				label: Perspectives.strbundle.getString("addToWhitelist"),
+				accessKey: "",
+				callback: function () {
+					Pers_whitelist_dialog.add_to_whitelist();
+				}
+			}
 		];
-   		this.notifyGeneric(b, priority, message, buttons);  
-	}, 
+   		this.notifyGeneric(b, priority, message, buttons);
+	},
 
-	clear_existing_banner: function(b, value_text) { 
-		try { 
+	clear_existing_banner: function(b, value_text) {
+		try {
 			//Happens on requeryAllTabs
 
 			try{
@@ -244,14 +247,14 @@ var Pers_notify = {
 			catch(e){
 				return;
 			}
-			var oldNotification = 
+			var oldNotification =
 				notificationBox.getNotificationWithValue(value_text);
 			if(oldNotification != null)
 				notificationBox.removeNotification(oldNotification);
-		} catch(err) { 
-			Pers_debug.d_print("error","clear_existing_banner error: " + err); 	
-		} 
-	} 
+		} catch(err) {
+			Pers_debug.d_print("error","clear_existing_banner error: " + err);
+		}
+	}
 
 }
 
diff --git a/plugin/chrome/content/statusbar.xul b/plugin/chrome/content/statusbar.xul
index 4a25e6d..f6149c3 100644
--- a/plugin/chrome/content/statusbar.xul
+++ b/plugin/chrome/content/statusbar.xul
@@ -1,12 +1,12 @@
 <?xml version="1.0"?>
 <!DOCTYPE prefwindow SYSTEM "chrome://perspectives/locale/dialogs.dtd">
 
-<overlay id="persp-statusbar"  
+<overlay id="persp-statusbar"
   xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
 
  <stringbundleset id="stringbundleset">
 	<stringbundle id="notary_strings" src="chrome://perspectives/locale/notaries.properties" insertbefore="1"/>
- </stringbundleset> 
+ </stringbundleset>
 
   <script type="application/x-javascript" src="common.js"/>
   <script type="application/x-javascript" src="base64.js" />
@@ -32,12 +32,13 @@
 				src="chrome://perspectives/content/img/default.png"
 				style="width:16px; height:16px;" />
 		<menupopup id="perspective-contextmenu-button" position="after_start">
-		  <menuitem label="&ViewNotaryResults;"   oncommand="Pers_statusbar.open_results_dialog()"/>
-		  <menuitem label="&ForceNotaryCheck;"   oncommand="Pers_statusbar.force_update()"/>
-		  <menuitem label="&ReportAttack;"   oncommand="Pers_report.report_attack()"/>
-		  <menuitem label="&Addtowhitelist;"   oncommand="Pers_whitelist_dialog.add_to_whitelist()"/>
+		  <menuitem label="&ViewNotaryResults;" oncommand="Pers_statusbar.open_results_dialog()"    />
+		  <menuitem label="&ForceNotaryCheck;"  oncommand="Pers_statusbar.force_update()"           />
+          <!--Report attack always fails at the moment. Hide it until we fix it. issue #122-->
+		  <!--<menuitem label="&ReportAttack;"      oncommand="Pers_report.report_attack()"             />-->
+		  <menuitem label="&Addtowhitelist;"    oncommand="Pers_whitelist_dialog.add_to_whitelist()"/>
 		  <menuseparator/>
-	<!--      <menuitem label="Refresh All Notary Data"   oncommand="requery()"/> --> 
+	<!--      <menuitem label="Refresh All Notary Data"   oncommand="requery()"/> -->
 		  <menuitem label="&Preferences;" oncommand="Pers_statusbar.open_preferences_dialog()"/>
 		  <menuitem label="&ViewCertificateStore;" oncommand="Pers_statusbar.openCertificates()"/>
 		  <menuitem label="&Help;" oncommand="Pers_statusbar.openHelp()"/>
@@ -47,14 +48,15 @@
 		</menupopup>
 	</toolbarbutton>
  </toolbarpalette>
- 
- <menupopup id="menu_ToolsPopup"> 
-	<menu id="menu_pers_tools" label="Perspectives" insertbefore="javascriptConsole"> 
-		<menupopup> 
-      			<menuitem label="&ViewNotaryResults;"   oncommand="Pers_statusbar.open_results_dialog()"/>
-      			<menuitem label="&ForceNotaryCheck;"   oncommand="Pers_statusbar.force_update()"/>
-     			<menuitem label="&ReportAttack;"   oncommand="Pers_report.report_attack()"/>
-      			<menuitem label="&Addtowhitelist;"   oncommand="Pers_whitelist_dialog.add_to_whitelist()"/>
+
+ <menupopup id="menu_ToolsPopup">
+	<menu id="menu_pers_tools" label="Perspectives" insertbefore="javascriptConsole">
+		<menupopup>
+      			<menuitem label="&ViewNotaryResults;" oncommand="Pers_statusbar.open_results_dialog()"    />
+      			<menuitem label="&ForceNotaryCheck;"  oncommand="Pers_statusbar.force_update()"           />
+                <!--Report attack always fails at the moment. Hide it until we fix it. issue #122-->
+                <!--<menuitem label="&ReportAttack;"      oncommand="Pers_report.report_attack()"             />-->
+      			<menuitem label="&Addtowhitelist;"    oncommand="Pers_whitelist_dialog.add_to_whitelist()"/>
       			<menuseparator/>
       			<menuitem label="&Preferences;" oncommand="Pers_statusbar.open_preferences_dialog()"/>
       			<menuitem label="&ViewCertificateStore;" oncommand="Pers_statusbar.openCertificates()"/>
@@ -62,17 +64,18 @@
       			<!-- TODO enable once all strings have been localized
       			<menuitem label="&About;" oncommand="Pers_statusbar.open_about_dialog()"/>
       			-->
-		</menupopup> 
-	</menu> 
- </menupopup> 
+		</menupopup>
+	</menu>
+ </menupopup>
 
- <popup id="contentAreaContextMenu"> 
-	<menu id="menu_pers_context" label="Perspectives"> 
-		<menupopup> 
-      			<menuitem label="&ViewNotaryResults;"   oncommand="Pers_statusbar.open_results_dialog()"/>
-      			<menuitem label="&ForceNotaryCheck;"   oncommand="Pers_statusbar.force_update()"/>
-     			<menuitem label="&ReportAttack;"   oncommand="Pers_report.report_attack()"/>
-      			<menuitem label="&Addtowhitelist;"   oncommand="Pers_whitelist_dialog.add_to_whitelist()"/>
+ <popup id="contentAreaContextMenu">
+	<menu id="menu_pers_context" label="Perspectives">
+		<menupopup>
+      			<menuitem label="&ViewNotaryResults;" oncommand="Pers_statusbar.open_results_dialog()"    />
+      			<menuitem label="&ForceNotaryCheck;"  oncommand="Pers_statusbar.force_update()"           />
+                <!--Report attack always fails at the moment. Hide it until we fix it. issue #122-->
+     			<!--<menuitem label="&ReportAttack;"      oncommand="Pers_report.report_attack()"             />-->
+      			<menuitem label="&Addtowhitelist;"    oncommand="Pers_whitelist_dialog.add_to_whitelist()"/>
       			<menuseparator/>
       			<menuitem label="&Preferences;" oncommand="Pers_statusbar.open_preferences_dialog()"/>
       			<menuitem label="&ViewCertificateStore;" oncommand="Pers_statusbar.openCertificates()"/>
@@ -80,9 +83,8 @@
       			<!-- TODO enable once all strings have been localized
       			<menuitem label="&About;" oncommand="Pers_statusbar.open_about_dialog()"/>
       			-->
-		</menupopup> 
-	</menu> 
-
+		</menupopup>
+	</menu>
  </popup>
 
 </overlay>

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/perspectives-extension.git



More information about the Pkg-mozext-commits mailing list