From fef344c1470764243d06e9d8230c88966ee447d5 Mon Sep 17 00:00:00 2001 From: Austin Siew <17107540+Aquafina-water-bottle@users.noreply.github.com> Date: Thu, 23 Mar 2023 19:32:49 -0600 Subject: fix: renamed action -> browserAction, to support manifest v3 --- ext/js/background/backend.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'ext/js/background') diff --git a/ext/js/background/backend.js b/ext/js/background/backend.js index c8eb47b9..5f42b4c9 100644 --- a/ext/js/background/backend.js +++ b/ext/js/background/backend.js @@ -1379,16 +1379,16 @@ class Backend { _getBrowserIconTitle() { return ( - isObject(chrome.browserAction) && - typeof chrome.browserAction.getTitle === 'function' ? - new Promise((resolve) => chrome.browserAction.getTitle({}, resolve)) : + isObject(chrome.action) && + typeof chrome.action.getTitle === 'function' ? + new Promise((resolve) => chrome.action.getTitle({}, resolve)) : Promise.resolve('') ); } _updateBadge() { let title = this._defaultBrowserActionTitle; - if (title === null || !isObject(chrome.browserAction)) { + if (title === null || !isObject(chrome.action)) { // Not ready or invalid return; } @@ -1437,17 +1437,17 @@ class Backend { } } - if (color !== null && typeof chrome.browserAction.setBadgeBackgroundColor === 'function') { - chrome.browserAction.setBadgeBackgroundColor({color}); + if (color !== null && typeof chrome.action.setBadgeBackgroundColor === 'function') { + chrome.action.setBadgeBackgroundColor({color}); } - if (text !== null && typeof chrome.browserAction.setBadgeText === 'function') { - chrome.browserAction.setBadgeText({text}); + if (text !== null && typeof chrome.action.setBadgeText === 'function') { + chrome.action.setBadgeText({text}); } - if (typeof chrome.browserAction.setTitle === 'function') { + if (typeof chrome.action.setTitle === 'function') { if (status !== null) { title = `${title} - ${status}`; } - chrome.browserAction.setTitle({title}); + chrome.action.setTitle({title}); } } -- cgit v1.2.3