summaryrefslogtreecommitdiff
path: root/ext/js/background/backend.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/js/background/backend.js')
-rw-r--r--ext/js/background/backend.js15
1 files changed, 8 insertions, 7 deletions
diff --git a/ext/js/background/backend.js b/ext/js/background/backend.js
index dbcbdd62..d19c3b45 100644
--- a/ext/js/background/backend.js
+++ b/ext/js/background/backend.js
@@ -26,7 +26,8 @@ import {ExtensionError} from '../core/extension-error.js';
import {fetchJson, fetchText} from '../core/fetch-utilities.js';
import {logErrorLevelToNumber} from '../core/log-utilities.js';
import {log} from '../core/log.js';
-import {clone, deferPromise, isObject, promiseTimeout} from '../core/utilities.js';
+import {isObjectNotArray} from '../core/object-utilities.js';
+import {clone, deferPromise, promiseTimeout} from '../core/utilities.js';
import {isNoteDataValid} from '../data/anki-util.js';
import {OptionsUtil} from '../data/options-util.js';
import {getAllPermissions, hasPermissions, hasRequiredPermissionsForOptions} from '../data/permissions-util.js';
@@ -222,12 +223,12 @@ export class Backend {
* @returns {void}
*/
_prepareInternalSync() {
- if (isObject(chrome.commands) && isObject(chrome.commands.onCommand)) {
+ if (isObjectNotArray(chrome.commands) && isObjectNotArray(chrome.commands.onCommand)) {
const onCommand = this._onWebExtensionEventWrapper(this._onCommand.bind(this));
chrome.commands.onCommand.addListener(onCommand);
}
- if (isObject(chrome.tabs) && isObject(chrome.tabs.onZoomChange)) {
+ if (isObjectNotArray(chrome.tabs) && isObjectNotArray(chrome.tabs.onZoomChange)) {
const onZoomChange = this._onWebExtensionEventWrapper(this._onZoomChange.bind(this));
chrome.tabs.onZoomChange.addListener(onZoomChange);
}
@@ -1094,7 +1095,7 @@ export class Backend {
}
// chrome.windows not supported (e.g. on Firefox mobile)
- if (!isObject(chrome.windows)) {
+ if (!isObjectNotArray(chrome.windows)) {
throw new Error('Window creation not supported');
}
@@ -1561,7 +1562,7 @@ export class Backend {
*/
_getBrowserIconTitle() {
return (
- isObject(chrome.action) &&
+ isObjectNotArray(chrome.action) &&
typeof chrome.action.getTitle === 'function' ?
new Promise((resolve) => { chrome.action.getTitle({}, resolve); }) :
Promise.resolve('')
@@ -1573,7 +1574,7 @@ export class Backend {
*/
_updateBadge() {
let title = this._defaultBrowserActionTitle;
- if (title === null || !isObject(chrome.action)) {
+ if (title === null || !isObjectNotArray(chrome.action)) {
// Not ready or invalid
return;
}
@@ -2580,7 +2581,7 @@ export class Backend {
* @returns {boolean}
*/
_canObservePermissionsChanges() {
- return isObject(chrome.permissions) && isObject(chrome.permissions.onAdded) && isObject(chrome.permissions.onRemoved);
+ return isObjectNotArray(chrome.permissions) && isObjectNotArray(chrome.permissions.onAdded) && isObjectNotArray(chrome.permissions.onRemoved);
}
/**