summaryrefslogtreecommitdiffstats
path: root/platform/chromium/webext.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 05:50:18 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 05:50:18 +0000
commit55a5d29a66503248916f249ad2a1d8b37cde5a03 (patch)
treea3beb6a90dd3bdaaf67ecb05d42152a494aff946 /platform/chromium/webext.js
parentAdding upstream version 1.55.0+dfsg. (diff)
downloadublock-origin-upstream/1.57.0+dfsg.tar.xz
ublock-origin-upstream/1.57.0+dfsg.zip
Adding upstream version 1.57.0+dfsg.upstream/1.57.0+dfsgupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'platform/chromium/webext.js')
-rw-r--r--platform/chromium/webext.js12
1 files changed, 10 insertions, 2 deletions
diff --git a/platform/chromium/webext.js b/platform/chromium/webext.js
index 851b653..f044649 100644
--- a/platform/chromium/webext.js
+++ b/platform/chromium/webext.js
@@ -19,8 +19,6 @@
Home: https://github.com/gorhill/uBlock
*/
-'use strict';
-
// `webext` is a promisified api of `chrome`. Entries are added as
// the promisification of uBO progress.
@@ -54,6 +52,15 @@ const promisify = function(thisArg, fnName) {
};
const webext = {
+ // https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/alarms
+ alarms: {
+ clear: promisifyNoFail(chrome.alarms, 'clear'),
+ clearAll: promisifyNoFail(chrome.alarms, 'clearAll'),
+ create: promisifyNoFail(chrome.alarms, 'create'),
+ get: promisifyNoFail(chrome.alarms, 'get'),
+ getAll: promisifyNoFail(chrome.alarms, 'getAll'),
+ onAlarm: chrome.alarms.onAlarm,
+ },
// https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/browserAction
browserAction: {
setBadgeBackgroundColor: promisifyNoFail(chrome.browserAction, 'setBadgeBackgroundColor'),
@@ -95,6 +102,7 @@ const webext = {
query: promisifyNoFail(chrome.tabs, 'query', tabs => Array.isArray(tabs) ? tabs : []),
reload: promisifyNoFail(chrome.tabs, 'reload'),
remove: promisifyNoFail(chrome.tabs, 'remove'),
+ sendMessage: promisifyNoFail(chrome.tabs, 'sendMessage'),
update: promisifyNoFail(chrome.tabs, 'update', tab => tab instanceof Object ? tab : null),
},
// https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/webNavigation