Fixed page action display confusion

Fixes #149
This commit is contained in:
kkapsner 2017-11-14 23:57:44 +01:00
parent d35ffe0b70
commit dd3620cd08
3 changed files with 9 additions and 8 deletions

View File

@ -45,6 +45,10 @@
message("open port to background script");
var port = browser.runtime.connect();
if (window === window.top){
message("Is top level window -> tab had navigation -> clear page action");
port.postMessage({"canvasBlocker-clear-page-action": true});
}
var tabId;
port.onMessage.addListener(function(data){
message("Got data from port", data);

View File

@ -64,6 +64,10 @@
browser.pageAction.show(port.sender.tab.id);
}
}
if (data.hasOwnProperty("canvasBlocker-clear-page-action")){
notice("Hide page action for tab", port.sender.tab.id);
browser.pageAction.hide(port.sender.tab.id);
}
verbose("got data", data, "from port", port);
});
});
@ -80,13 +84,6 @@
});
}
});
// hide page action when a tab is refreshed
browser.tabs.onUpdated.addListener(function(tabId, data){
if (data.status && data.status === "loading"){
browser.pageAction.hide(tabId);
}
});
});
browser.runtime.onInstalled.addListener(function(){

View File

@ -9,7 +9,7 @@ Version 0.4.3:
-
fixes:
-
- page action was not always showing
Version 0.4.2
new features: