@@ -22,21 +22,6 @@ for (r in rs) {
2222}
2323*/
2424
25- // Add the HTTPS Everywhere icon to the URL address bar.
26- // TODO: Switch from pageAction to browserAction?
27- function displayPageAction ( tabId ) {
28- if ( tabId !== - 1 ) {
29- chrome . tabs . get ( tabId , function ( tab ) {
30- if ( typeof ( tab ) === "undefined" ) {
31- log ( DBUG , "Not a real tab. Skipping showing pageAction." ) ;
32- }
33- else {
34- chrome . pageAction . show ( tabId ) ;
35- }
36- } ) ;
37- }
38- }
39-
4025function AppliedRulesets ( ) {
4126 this . active_tab_rules = { } ;
4227
@@ -414,13 +399,21 @@ wr.onResponseStarted.addListener(onResponseStarted,
414399// Note: We can't use any other hook (onCreated, onActivated, etc.) because Chrome resets the
415400// pageActions on URL change. We should strongly consider switching from pageAction to browserAction.
416401chrome . tabs . onUpdated . addListener ( function ( tabId , changeInfo , tab ) {
417- displayPageAction ( tabId ) ;
402+ if ( changeInfo . status === "loading" ) {
403+ chrome . pageAction . show ( tabId ) ;
404+ }
418405} ) ;
419406
420407// Pre-rendered tabs / instant experiments sometimes skip onUpdated.
421408// See http://crbug.com/109557
422409chrome . tabs . onReplaced . addListener ( function ( addedTabId , removedTabId ) {
423- displayPageAction ( addedTabId ) ;
410+ chrome . tabs . get ( addedTabId , function ( tab ) {
411+ if ( typeof ( tab ) === "undefined" ) {
412+ log ( DBUG , "Not a real tab. Skipping showing pageAction." ) ;
413+ } else {
414+ chrome . pageAction . show ( tabId ) ;
415+ }
416+ } ) ;
424417} ) ;
425418
426419// Listen for cookies set/updated and secure them if applicable. This function is async/nonblocking,
0 commit comments