aboutsummaryrefslogtreecommitdiff
path: root/ext/js/pages/settings
diff options
context:
space:
mode:
Diffstat (limited to 'ext/js/pages/settings')
-rw-r--r--ext/js/pages/settings/backup-controller.js16
-rw-r--r--ext/js/pages/settings/extension-keyboard-shortcuts-controller.js4
-rw-r--r--ext/js/pages/settings/persistent-storage-controller.js4
-rw-r--r--ext/js/pages/settings/settings-controller.js5
4 files changed, 15 insertions, 14 deletions
diff --git a/ext/js/pages/settings/backup-controller.js b/ext/js/pages/settings/backup-controller.js
index 2a0706e4..dd739d39 100644
--- a/ext/js/pages/settings/backup-controller.js
+++ b/ext/js/pages/settings/backup-controller.js
@@ -19,8 +19,8 @@
import {Dexie} from '../../../lib/dexie.js';
import {parseJson} from '../../core/json.js';
import {log} from '../../core/log.js';
+import {isObjectNotArray} from '../../core/object-utilities.js';
import {toError} from '../../core/to-error.js';
-import {isObject} from '../../core/utilities.js';
import {OptionsUtil} from '../../data/options-util.js';
import {getAllPermissions} from '../../data/permissions-util.js';
import {arrayBufferUtf8Decode} from '../../data/sandbox/array-buffer-util.js';
@@ -354,7 +354,7 @@ export class BackupController {
const warnings = [];
const anki = options.anki;
- if (isObject(anki)) {
+ if (isObjectNotArray(anki)) {
const fieldTemplates = anki.fieldTemplates;
if (typeof fieldTemplates === 'string') {
warnings.push('anki.fieldTemplates contains a non-default value');
@@ -372,12 +372,12 @@ export class BackupController {
}
const audio = options.audio;
- if (isObject(audio)) {
+ if (isObjectNotArray(audio)) {
const sources = audio.sources;
if (Array.isArray(sources)) {
for (let i = 0, ii = sources.length; i < ii; ++i) {
const source = sources[i];
- if (!isObject(source)) { continue; }
+ if (!isObjectNotArray(source)) { continue; }
const {url} = source;
if (typeof url === 'string' && url.length > 0 && !this._isLocalhostUrl(url)) {
warnings.push(`audio.sources[${i}].url uses a non-localhost URL`);
@@ -403,9 +403,9 @@ export class BackupController {
const profiles = optionsFull.profiles;
if (Array.isArray(profiles)) {
for (const profile of profiles) {
- if (!isObject(profile)) { continue; }
+ if (!isObjectNotArray(profile)) { continue; }
const options = profile.options;
- if (!isObject(options)) { continue; }
+ if (!isObjectNotArray(options)) { continue; }
const warnings2 = this._settingsImportSanitizeProfileOptions(options, dryRun);
for (const warning of warnings2) {
@@ -428,7 +428,7 @@ export class BackupController {
const data = parseJson(dataString);
// Type check
- if (!isObject(data)) {
+ if (!isObjectNotArray(data)) {
throw new Error(`Invalid data type: ${typeof data}`);
}
@@ -451,7 +451,7 @@ export class BackupController {
// Verify options exists
let optionsFull = data.options;
- if (!isObject(optionsFull)) {
+ if (!isObjectNotArray(optionsFull)) {
throw new Error(`Invalid options type: ${typeof optionsFull}`);
}
diff --git a/ext/js/pages/settings/extension-keyboard-shortcuts-controller.js b/ext/js/pages/settings/extension-keyboard-shortcuts-controller.js
index 1f55f391..f19a75fa 100644
--- a/ext/js/pages/settings/extension-keyboard-shortcuts-controller.js
+++ b/ext/js/pages/settings/extension-keyboard-shortcuts-controller.js
@@ -17,7 +17,7 @@
*/
import {EventListenerCollection} from '../../core/event-listener-collection.js';
-import {isObject} from '../../core/utilities.js';
+import {isObjectNotArray} from '../../core/object-utilities.js';
import {querySelectorNotNull} from '../../dom/query-selector.js';
import {HotkeyUtil} from '../../input/hotkey-util.js';
import {KeyboardMouseInputField} from './keyboard-mouse-input-field.js';
@@ -149,7 +149,7 @@ export class ExtensionKeyboardShortcutController {
*/
_getCommands() {
return new Promise((resolve, reject) => {
- if (!(isObject(chrome.commands) && typeof chrome.commands.getAll === 'function')) {
+ if (!(isObjectNotArray(chrome.commands) && typeof chrome.commands.getAll === 'function')) {
resolve([]);
return;
}
diff --git a/ext/js/pages/settings/persistent-storage-controller.js b/ext/js/pages/settings/persistent-storage-controller.js
index e0ff75ee..c2508d90 100644
--- a/ext/js/pages/settings/persistent-storage-controller.js
+++ b/ext/js/pages/settings/persistent-storage-controller.js
@@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import {isObject} from '../../core/utilities.js';
+import {isObjectNotArray} from '../../core/object-utilities.js';
import {querySelectorNotNull} from '../../dom/query-selector.js';
export class PersistentStorageController {
@@ -98,7 +98,7 @@ export class PersistentStorageController {
* @returns {boolean}
*/
_isPersistentStorageSupported() {
- return isObject(navigator.storage) && typeof navigator.storage.persist === 'function';
+ return isObjectNotArray(navigator.storage) && typeof navigator.storage.persist === 'function';
}
/**
diff --git a/ext/js/pages/settings/settings-controller.js b/ext/js/pages/settings/settings-controller.js
index a9f3a026..ee44f875 100644
--- a/ext/js/pages/settings/settings-controller.js
+++ b/ext/js/pages/settings/settings-controller.js
@@ -18,7 +18,8 @@
import {EventDispatcher} from '../../core/event-dispatcher.js';
import {EventListenerCollection} from '../../core/event-listener-collection.js';
-import {generateId, isObject} from '../../core/utilities.js';
+import {isObjectNotArray} from '../../core/object-utilities.js';
+import {generateId} from '../../core/utilities.js';
import {OptionsUtil} from '../../data/options-util.js';
import {getAllPermissions} from '../../data/permissions-util.js';
import {HtmlTemplateCollection} from '../../dom/html-template-collection.js';
@@ -353,6 +354,6 @@ export class SettingsController extends EventDispatcher {
* @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);
}
}