@@ -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
@@ -407,13 +392,21 @@ wr.onResponseStarted.addListener(onResponseStarted,
407392// Note: We can't use any other hook (onCreated, onActivated, etc.) because Chrome resets the
408393// pageActions on URL change. We should strongly consider switching from pageAction to browserAction.
409394chrome . tabs . onUpdated . addListener ( function ( tabId , changeInfo , tab ) {
410- displayPageAction ( tabId ) ;
395+ if ( changeInfo . status === "loading" ) {
396+ chrome . pageAction . show ( tabId ) ;
397+ }
411398} ) ;
412399
413400// Pre-rendered tabs / instant experiments sometimes skip onUpdated.
414401// See http://crbug.com/109557
415402chrome . tabs . onReplaced . addListener ( function ( addedTabId , removedTabId ) {
416- displayPageAction ( addedTabId ) ;
403+ chrome . tabs . get ( addedTabId , function ( tab ) {
404+ if ( typeof ( tab ) === "undefined" ) {
405+ log ( DBUG , "Not a real tab. Skipping showing pageAction." ) ;
406+ } else {
407+ chrome . pageAction . show ( tabId ) ;
408+ }
409+ } ) ;
417410} ) ;
418411
419412// Listen for cookies set/updated and secure them if applicable. This function is async/nonblocking,
0 commit comments