[Pkg-mozext-commits] [perspectives-extension] 07/30: Perspectives - Remove globally exposed variables

David Prévot taffit at alioth.debian.org
Thu Sep 26 22:31:38 UTC 2013


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

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

commit 590ffb746e60128ab050c4952e3d3920eeac3467
Author: Dave Schaefer <dave.schaefer at gmail.com>
Date:   Sat Sep 14 22:18:59 2013 -0600

    Perspectives - Remove globally exposed variables
    
    Declare with 'var' to change these to local variables.
    We should only expose one global variable, the 'Perspectives' object,
    to make sure we don't have any harmful or unexpected interactions
    with other extensions or browser code.
    
    Thanks to the AMO validator for catching these.
---
 plugin/chrome/content/base64.js            |    6 +++++-
 plugin/chrome/content/common.js            |    2 +-
 plugin/chrome/content/notaries.js          |    6 +++---
 plugin/chrome/content/xml_notary_client.js |    6 +++---
 4 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/plugin/chrome/content/base64.js b/plugin/chrome/content/base64.js
index c72bb84..a4baab3 100644
--- a/plugin/chrome/content/base64.js
+++ b/plugin/chrome/content/base64.js
@@ -134,7 +134,11 @@ var Pers_Base64 = {
     _utf8_decode : function (utftext) {
         var string = "";
         var i = 0;
-        var c = c1 = c2 = 0;
+        var c;
+        var c1;
+        var c2;
+        var c3;
+        c = c1 = c2 = c3 = 0;
 
         while ( i < utftext.length ) {
 
diff --git a/plugin/chrome/content/common.js b/plugin/chrome/content/common.js
index b69b484..340e4d7 100644
--- a/plugin/chrome/content/common.js
+++ b/plugin/chrome/content/common.js
@@ -178,7 +178,7 @@ var Pers_util = {
 							"0x0d", "0x01", "0x01", "0x04", "0x05", "0x00", 
 							"0x03", "0x81", "0xad", "0x00"];
 		var header_str = '';
-		for (i = 0; i < der_header_md5.length; i++) { 
+		for (var i = 0; i < der_header_md5.length; i++) {
 			header_str += String.fromCharCode(parseInt(der_header_md5[i],16));
 		}
 		return Pers_Base64.encode(header_str + base_str) ; 
diff --git a/plugin/chrome/content/notaries.js b/plugin/chrome/content/notaries.js
index b065620..7f77245 100644
--- a/plugin/chrome/content/notaries.js
+++ b/plugin/chrome/content/notaries.js
@@ -227,7 +227,7 @@ var Perspectives = {
 		var all_notaries = []; 
 		try {
 			var list_txt = Perspectives.root_prefs.getCharPref("perspectives.additional_notary_list");
-			additional_notaries = Pers_util.loadNotaryListFromString(list_txt); 
+			var additional_notaries = Pers_util.loadNotaryListFromString(list_txt);
 			all_notaries = all_notaries.concat(additional_notaries); 
 		} catch(e) { 
 			Pers_debug.d_print("error", "Error parsing additional notaries: " + e); 
@@ -235,7 +235,7 @@ var Perspectives = {
 		var use_default_notaries = Perspectives.root_prefs.getBoolPref("perspectives.use_default_notary_list"); 
 		if(use_default_notaries) {
  
-			default_notaries = Pers_util.loadNotaryListFromString(
+			var default_notaries = Pers_util.loadNotaryListFromString(
 						this.root_prefs.getCharPref("perspectives.default_notary_list")); 
 			all_notaries = all_notaries.concat(default_notaries); 
 		} 
@@ -257,7 +257,7 @@ var Perspectives = {
  
 		// send a request to each notary
 		ti.partial_query_results = []; 
-		for(i = 0; i < Perspectives.all_notaries.length; i++) {
+		for(var i = 0; i < Perspectives.all_notaries.length; i++) {
 			Pers_debug.d_print("main", "Sending query to notary " + Perspectives.all_notaries[i].host);  
 			this.querySingleNotary(Perspectives.all_notaries[i],ti); 
 		}
diff --git a/plugin/chrome/content/xml_notary_client.js b/plugin/chrome/content/xml_notary_client.js
index 43867b6..73795a9 100644
--- a/plugin/chrome/content/xml_notary_client.js
+++ b/plugin/chrome/content/xml_notary_client.js
@@ -130,17 +130,17 @@ var Pers_xml = {
 		var bin_str = service_id;
 		bin_str += String.fromCharCode(0); // NULL-terminate
 	 
-		for (i = server_res.obs.length - 1; i >= 0; i--) { 
+		for (var i = server_res.obs.length - 1; i >= 0; i--) {
 			var o = server_res.obs[i];
 			var num_timespans = o.timestamps.length; 
 			bin_str += String.fromCharCode((num_timespans >> 8) & 255, 
 											num_timespans & 255); 
 			bin_str += String.fromCharCode(0,16,3); // key length is 16, type 3
 			var hex_array = o.key.split(":"); 
-			for(k = 0; k < hex_array.length; k++) { 
+			for(var k = 0; k < hex_array.length; k++) {
 				bin_str += String.fromCharCode((parseInt(hex_array[k],16))); 
 			}
-			for (j = 0; j < o.timestamps.length; j++) { 
+			for (var j = 0; j < o.timestamps.length; j++) {
 				var t = o.timestamps[j]; 
 				bin_str += String.fromCharCode((t.start >> 24) & 255, 
 							(t.start >> 16) & 255, 

-- 
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