From e2f7de8fea002f15c7cc66ea0d3b565919ec4de3 Mon Sep 17 00:00:00 2001 From: hackademix Date: Wed, 25 Dec 2019 23:09:56 +0100 Subject: Added "ping" (beacon/ping) capability control. --- src/bg/main.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src/bg') 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}`; -- cgit v1.2.3