[Pkg-mozext-commits] [perspectives-extension] 32/44: Pers_util - properly retrieve string value

David Prévot taffit at moszumanska.debian.org
Sun Jun 26 04:59:20 UTC 2016


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

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

commit f361e2ac1e8faa7acb73963e028cdccf357dd6ee
Author: Dave Schaefer <dave.schaefer at gmail.com>
Date:   Tue Jun 14 21:40:07 2016 -0700

    Pers_util - properly retrieve string value
    
    Don't use getElementById(), it might return a null value.
---
 plugin/chrome/content/common.js | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/plugin/chrome/content/common.js b/plugin/chrome/content/common.js
index 5cf5dc7..8ef2aab 100644
--- a/plugin/chrome/content/common.js
+++ b/plugin/chrome/content/common.js
@@ -76,11 +76,6 @@ var Pers_util = {
 		var ret = [];
 		var start_arr = str_data.split("\n");
 		var filtered_arr = [];
-		// the Perspectives object isn't always loaded here, so use our own
-		// to make sure it exists.
-		if(Pers_util.notarystr == null) {
-			Pers_util.notarystr = document.getElementById("notary_strings");
-		}
 
 		for(var i = 0; i < start_arr.length; i++) {
 			if (start_arr[i].length > 0 && start_arr[i][0] != "#") {
@@ -101,8 +96,8 @@ var Pers_util = {
 
 			var begin_string = "BEGIN PUBLIC KEY";
 			if (i >= filtered_arr.length || filtered_arr[i].indexOf(begin_string) === -1) {
-				throw(Pers_util.notarystr.getFormattedString("errorParsingNotaryEntry", [ host ]) +
-					' - ' + Pers_util.notarystr.getFormattedString("couldNotFindLine", [ begin_string ]));
+				throw(Perspectives.getFormattedString("errorParsingNotaryEntry", [ host ]) +
+					' - ' + Perspectives.getFormattedString("couldNotFindLine", [ begin_string ]));
 			}
 			i += 1;
 
@@ -112,8 +107,8 @@ var Pers_util = {
 				key += filtered_arr[i];
 				i += 1;
 				if(i == filtered_arr.length) {
-					throw(Pers_util.notarystr.getFormattedString("errorParsingNotaryEntry", [ host ]) +
-						' - ' +  Pers_util.notarystr.getFormattedString("couldNotFindLine", [ end_string ]));
+					throw(Perspectives.getFormattedString("errorParsingNotaryEntry", [ host ]) +
+						' - ' +  Perspectives.getFormattedString("couldNotFindLine", [ end_string ]));
 				}
 			}
 
@@ -151,7 +146,7 @@ var Pers_util = {
 			if(unmatchedHosts.length === 0) {
 				ret = filteredNotaries;
 			} else {
-				throw Pers_util.notarystr.getFormattedString("duplicateNotariesUnmatchedError", [unmatchedHosts.join(", ")]);
+				throw Perspectives.getFormattedString("duplicateNotariesUnmatchedError", [unmatchedHosts.join(", ")]);
 			}
 		} else {
 			ret = notary_list;

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