diff options
author | hackademix | 2019-12-25 23:09:56 +0100 |
---|---|---|
committer | hackademix | 2019-12-25 23:09:56 +0100 |
commit | e2f7de8fea002f15c7cc66ea0d3b565919ec4de3 (patch) | |
tree | 1a949668ac20d81e8aca3281a78bdbcc06a845a9 /src/bg | |
parent | 98aff587716024deff8ba5a6de6247ac44063611 (diff) | |
download | noscript-e2f7de8fea002f15c7cc66ea0d3b565919ec4de3.tar.gz noscript-e2f7de8fea002f15c7cc66ea0d3b565919ec4de3.tar.xz noscript-e2f7de8fea002f15c7cc66ea0d3b565919ec4de3.zip |
Added "ping" (beacon/ping) capability control.
Diffstat (limited to 'src/bg')
-rw-r--r-- | src/bg/main.js | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/bg/main.js b/src/bg/main.js index fa58b3a..b1874f4 100644 --- a/src/bg/main.js +++ b/src/bg/main.js @@ -1,6 +1,19 @@ { 'use strict'; - + { + let onInstalled = async details => { + browser.runtime.onInstalled.removeListener(onInstalled); + let {reason, previousVersion} = details; + if (reason !== "update") return; + let v = previousVersion.split(".").map(n => parseInt(n)); + if (v[0] > 11 || v[1] > 0 || v[2] > 10) return; + log(`Upgrading from 11.0.10 or below (${previousVersion}): configure the "ping" capability.`); + await ns.initializing; + ns.policy.TRUSTED.capabilities.add("ping") + await ns.savePolicy(); + }; + browser.runtime.onInstalled.addListener(onInstalled); + } let popupURL = browser.extension.getURL("/ui/popup.html"); let popupFor = tabId => `${popupURL}#tab${tabId}`; |