From 8083e06b30ff3d8cb893ce5c122f187e15030b6b Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Tue, 11 Apr 2023 18:06:57 -0400 Subject: [PATCH] Revert 09b36952056a (re. `browser.alarms`) Relates issue: - https://github.com/uBlockOrigin/uBlock-issues/issues/2591 THe issue was simply that I had forgotten to add the `alarms` permission to the manifest. --- platform/common/vapi-background.js | 39 ------------------------------ platform/thunderbird/manifest.json | 1 + 2 files changed, 1 insertion(+), 39 deletions(-) diff --git a/platform/common/vapi-background.js b/platform/common/vapi-background.js index 47f549686..6bbfd075d 100644 --- a/platform/common/vapi-background.js +++ b/platform/common/vapi-background.js @@ -95,45 +95,6 @@ vAPI.storage = webext.storage.local; /******************************************************************************/ /******************************************************************************/ -// https://github.com/uBlockOrigin/uBlock-issues/issues/2591 -// Report of alarms API not being supported on Thunderbird -if ( browser.alarms === undefined ) { - browser.alarms = { - alarmsMap: new Map(), - listenerSet: new Set(), - create(name, delayInfo) { - let alarm = this.alarmsMap.get(name); - if ( alarm !== undefined ) { - alarm.off(); - } else { - alarm = vAPI.defer.create(( ) => { - this.alarmsMap.delete(name); - for ( const listener of this.listenerSet ) { - listener({ name }); - } - }); - } - this.alarmsMap.set(name, alarm); - alarm.on({ min: delayInfo.delayInMinutes }); - }, - clear(name) { - const alarm = this.alarmsMap.get(name); - if ( alarm === undefined ) { return; } - alarm.off(); - this.alarmsMap.delete(name); - }, - get: function(name, callback) { - callback(this.alarmsMap.has(name) && { name } || undefined); - }, - onAlarm: { - addListener(callback) { - browser.alarms.listenerSet.add(callback); - }, - }, - }; -} - - vAPI.alarms = { create(callback) { this.uniqueIdGenerator += 1; diff --git a/platform/thunderbird/manifest.json b/platform/thunderbird/manifest.json index 69950a027..917f99588 100644 --- a/platform/thunderbird/manifest.json +++ b/platform/thunderbird/manifest.json @@ -66,6 +66,7 @@ "open_in_tab": true }, "permissions": [ + "alarms", "privacy", "storage", "tabs",