summaryrefslogtreecommitdiff
path: root/src/bg
diff options
context:
space:
mode:
Diffstat (limited to 'src/bg')
-rw-r--r--src/bg/main.js15
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}`;