diff options
author | hackademix | 2018-07-28 12:50:30 +0200 |
---|---|---|
committer | hackademix | 2018-07-28 12:50:30 +0200 |
commit | f82b1e376cf99154e7ecbeaa1b5837a59e3a6098 (patch) | |
tree | c2573429ba8becda41e4665b0533070df115b224 /src/content | |
parent | ce9644bed39e02e204edd930c12fd09048ee0a27 (diff) | |
download | noscript-f82b1e376cf99154e7ecbeaa1b5837a59e3a6098.tar.gz noscript-f82b1e376cf99154e7ecbeaa1b5837a59e3a6098.tar.xz noscript-f82b1e376cf99154e7ecbeaa1b5837a59e3a6098.zip |
Fixed browser action icon not being updated on BF cache navigation.
Diffstat (limited to 'src/content')
-rw-r--r-- | src/content/content.js | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/content/content.js b/src/content/content.js index 3560e57..9f89a65 100644 --- a/src/content/content.js +++ b/src/content/content.js @@ -78,10 +78,15 @@ if (document.readyState !== "complete") { } else { init(true); } -let notifyPage = () => { +let notifyPage = async () => { + debug("Page %s shown, %s", document.URL, document.readyState); if (document.readyState === "complete") { - browser.runtime.sendMessage({type: "pageshow", seen, canScript}); - return true; + try { + await browser.runtime.sendMessage({type: "pageshow", seen: seen.list, canScript}); + return true; + } catch (e) { + debug(e); + } } return false; } @@ -166,5 +171,6 @@ async function init(oldPage = false) { }, true); // document.write("<plaintext>"); } - notifyPage() || addEventListener("pageshow", notifyPage); + notifyPage(); + addEventListener("pageshow", notifyPage); } |