|
|
@@ -21,7 +21,7 @@
|
|
|
* Source.
|
|
|
*/
|
|
|
|
|
|
-/* global browser */
|
|
|
+/* global browser, navigator */
|
|
|
|
|
|
import { queryTabs } from "./../../core/bg/tabs-util.js";
|
|
|
import * as tabsData from "./../../core/bg/tabs-data.js";
|
|
|
@@ -49,6 +49,8 @@ const AUTOSAVE_DEFAULT_COLOR = [208, 208, 208, 192];
|
|
|
const AUTOSAVE_INITIALIZING_COLOR = [64, 64, 64, 192];
|
|
|
const INJECT_SCRIPTS_STEP = 1;
|
|
|
|
|
|
+const BADGE_COLOR_SUPPORTED = !/Safari/.test(navigator.userAgent) || /Chrome/.test(navigator.userAgent);
|
|
|
+
|
|
|
const BUTTON_STATES = {
|
|
|
default: {
|
|
|
setBadgeBackgroundColor: { color: DEFAULT_COLOR },
|
|
|
@@ -258,7 +260,8 @@ async function refreshAsync(tabId, state) {
|
|
|
}
|
|
|
|
|
|
async function refreshProperty(tabId, browserActionMethod, browserActionParameter) {
|
|
|
- if (browser.browserAction[browserActionMethod]) {
|
|
|
+ const actionMethodSupported = browserActionMethod != "setBadgeBackgroundColor" || BADGE_COLOR_SUPPORTED;
|
|
|
+ if (browser.browserAction[browserActionMethod] && actionMethodSupported) {
|
|
|
const parameter = JSON.parse(JSON.stringify(browserActionParameter));
|
|
|
parameter.tabId = tabId;
|
|
|
await browser.browserAction[browserActionMethod](parameter);
|