diff options
Diffstat (limited to 'ext/js/background')
| -rw-r--r-- | ext/js/background/backend.js | 15 | ||||
| -rw-r--r-- | ext/js/background/offscreen-proxy.js | 4 | 
2 files changed, 10 insertions, 9 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);      }      /** diff --git a/ext/js/background/offscreen-proxy.js b/ext/js/background/offscreen-proxy.js index 102a9eed..59d1291e 100644 --- a/ext/js/background/offscreen-proxy.js +++ b/ext/js/background/offscreen-proxy.js @@ -17,7 +17,7 @@   */  import {ExtensionError} from '../core/extension-error.js'; -import {isObject} from '../core/utilities.js'; +import {isObjectNotArray} from '../core/object-utilities.js';  import {base64ToArrayBuffer} from '../data/sandbox/array-buffer-util.js';  /** @@ -123,7 +123,7 @@ export class OffscreenProxy {          if (typeof runtimeError !== 'undefined') {              throw new Error(runtimeError.message);          } -        if (!isObject(response)) { +        if (!isObjectNotArray(response)) {              throw new Error('Offscreen document did not respond');          }          const responseError = response.error; |