Fix getOptions function
getOptions didn't correctly check whether the |options| parameter was an
array. This CL fixes this.
Change-Id: I6751d1ece9b8f8e9e6dadaeec9706240398618b3
diff --git a/src/common/optionsUtils.js b/src/common/optionsUtils.js
index bfcb92c..9ead0b2 100644
--- a/src/common/optionsUtils.js
+++ b/src/common/optionsUtils.js
@@ -34,10 +34,12 @@
return new Promise((resolve, reject) => {
if (typeof options === 'string')
options = [options, '_forceDisabledFeatures'];
- else if (typeof options === 'array')
+ else if (Array.isArray(options))
options = [...options, '_forceDisabledFeatures'];
else if (options !== null)
- console.error('Unexpected |options| parameter (expected: string, array, or null).');
+ console.error(
+ 'Unexpected |options| parameter of type ' + (typeof options) +
+ ' (expected: string, array, or null).');
chrome.storage.sync.get(options, items => {
if (chrome.runtime.lastError) return reject(chrome.runtime.lastError);