[Pkg-mozext-commits] [perspectives-extension] 15/22: Perspectives - Use uri.asciiHost; Fix spinning query icon

David Prévot taffit at moszumanska.debian.org
Mon May 12 17:17:44 UTC 2014


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

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

commit 7d457d1780b12d633effd4ddc0c7836a0ef97959
Author: Dave Schaefer <dave.schaefer at gmail.com>
Date:   Tue May 6 21:49:36 2014 -0600

    Perspectives - Use uri.asciiHost; Fix spinning query icon
    
    When opening a new tab in Firefox, the uri.host is 'about:blank',
    and contains some character that makes getFormattedString() unhappy.
    It throws an exception.
    This causes the Perspectives icon to briefly flicker to the yellow
    'error' exclamation icon, which we don't want.
    
    Simply using a string that contains a ":" doesn't trigger the exception.
    Not sure what character is causing the issue, but this patch fixes it.
    
    Also, don't start the spinning query icon unless we're actually
    going to send a query (i.e. for https sites)
---
 plugin/chrome/content/notaries.js | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/plugin/chrome/content/notaries.js b/plugin/chrome/content/notaries.js
index 4f493f2..3b1410f 100644
--- a/plugin/chrome/content/notaries.js
+++ b/plugin/chrome/content/notaries.js
@@ -847,8 +847,20 @@ var Perspectives = {
 			}
       			try{
         			Pers_debug.d_print("main", "Location change " + aURI.spec);
-        			Pers_statusbar.setStatus(aURI, Pers_statusbar.STATE_QUERY, 
-        				Perspectives.strbundle.getFormattedString("contactingNotariesAbout", [ aURI.host ]));
+        			var state = Pers_statusbar.STATE_NEUT;
+        			var tooltip = "Perspectives";
+
+        			if (aURI !== null && aURI.scheme === 'https') {
+        				// we'll actually send a query for https connections, so update the UI.
+        				state = Pers_statusbar.STATE_QUERY;
+        				// use the asciiHost: sometimes the host contains invalid characters, or is unset.
+        				// in those cases getFormattedString() will throw an exception,
+        				// which causes the error icon to be displayed.
+        				tooltip = Perspectives.strbundle.getFormattedString("contactingNotariesAbout",
+        					[ aURI.asciiHost ])
+        				// TODO: can we start sending the query from right here, to begin sooner?
+        			}
+        			Pers_statusbar.setStatus(aURI, state, tooltip);
       			} catch(err){
         			Pers_debug.d_print("error", "Perspectives had an internal exception: " + err);
         			Pers_statusbar.setStatus(aURI, Pers_statusbar.STATE_ERROR, 

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