From 1944f7a2157fd63fd04beb374ee5d9fb797e2531 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Sat, 15 Feb 2020 19:46:20 -0500 Subject: [PATCH 01/12] Fix indent --- ext/bg/js/page-exit-prevention.js | 62 +++++++++++++++---------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/ext/bg/js/page-exit-prevention.js b/ext/bg/js/page-exit-prevention.js index 3a320db3..be06c495 100644 --- a/ext/bg/js/page-exit-prevention.js +++ b/ext/bg/js/page-exit-prevention.js @@ -18,43 +18,43 @@ class PageExitPrevention { - constructor() { - } + constructor() { + } - start() { - PageExitPrevention._addInstance(this); - } + start() { + PageExitPrevention._addInstance(this); + } - end() { - PageExitPrevention._removeInstance(this); - } + end() { + PageExitPrevention._removeInstance(this); + } - static _addInstance(instance) { - const size = PageExitPrevention._instances.size; - PageExitPrevention._instances.set(instance, true); - if (size === 0) { - window.addEventListener('beforeunload', PageExitPrevention._onBeforeUnload); - } - } + static _addInstance(instance) { + const size = PageExitPrevention._instances.size; + PageExitPrevention._instances.set(instance, true); + if (size === 0) { + window.addEventListener('beforeunload', PageExitPrevention._onBeforeUnload); + } + } - static _removeInstance(instance) { - if ( - PageExitPrevention._instances.delete(instance) && - PageExitPrevention._instances.size === 0 - ) { - window.removeEventListener('beforeunload', PageExitPrevention._onBeforeUnload); - } - } + static _removeInstance(instance) { + if ( + PageExitPrevention._instances.delete(instance) && + PageExitPrevention._instances.size === 0 + ) { + window.removeEventListener('beforeunload', PageExitPrevention._onBeforeUnload); + } + } - static _onBeforeUnload(e) { - if (PageExitPrevention._instances.size === 0) { - return; - } + static _onBeforeUnload(e) { + if (PageExitPrevention._instances.size === 0) { + return; + } - e.preventDefault(); - e.returnValue = ''; - return ''; - } + e.preventDefault(); + e.returnValue = ''; + return ''; + } } PageExitPrevention._instances = new Map(); From 6d75637ace341b79a6a12c7854b13fb1c279498f Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Sat, 15 Feb 2020 19:48:02 -0500 Subject: [PATCH 02/12] Fix brace style issues --- ext/bg/js/backend.js | 21 +++++++++++++++------ ext/fg/js/document.js | 3 +-- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js index 16dffc85..7c71f82c 100644 --- a/ext/bg/js/backend.js +++ b/ext/bg/js/backend.js @@ -801,8 +801,11 @@ class Backend { await new Promise((resolve, reject) => { chrome.tabs.update(tab.id, {active: true}, () => { const e = chrome.runtime.lastError; - if (e) { reject(e); } - else { resolve(); } + if (e) { + reject(e); + } else { + resolve(); + } }); }); @@ -815,16 +818,22 @@ class Backend { const tabWindow = await new Promise((resolve, reject) => { chrome.windows.get(tab.windowId, {}, (tabWindow) => { const e = chrome.runtime.lastError; - if (e) { reject(e); } - else { resolve(tabWindow); } + if (e) { + reject(e); + } else { + resolve(tabWindow); + } }); }); if (!tabWindow.focused) { await new Promise((resolve, reject) => { chrome.windows.update(tab.windowId, {focused: true}, () => { const e = chrome.runtime.lastError; - if (e) { reject(e); } - else { resolve(); } + if (e) { + reject(e); + } else { + resolve(); + } }); }); } diff --git a/ext/fg/js/document.js b/ext/fg/js/document.js index 7284cdd1..ea9ac965 100644 --- a/ext/fg/js/document.js +++ b/ext/fg/js/document.js @@ -192,8 +192,7 @@ function docSentenceExtract(source, extent) { if (terminators.includes(c)) { endPos = i + 1; break; - } - else if (c in quotesBwd) { + } else if (c in quotesBwd) { endPos = i; break; } From aa76113e756391da64d84d368c3b103c873519cb Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Sat, 15 Feb 2020 19:49:07 -0500 Subject: [PATCH 03/12] Fix block padding --- ext/bg/js/settings/backup.js | 1 - ext/mixed/js/audio.js | 2 -- 2 files changed, 3 deletions(-) diff --git a/ext/bg/js/settings/backup.js b/ext/bg/js/settings/backup.js index 6d1f28e9..f4d622a4 100644 --- a/ext/bg/js/settings/backup.js +++ b/ext/bg/js/settings/backup.js @@ -163,7 +163,6 @@ async function _showSettingsImportWarnings(warnings) { sanitize: e.currentTarget.dataset.importSanitize === 'true' }); modalNode.modal('hide'); - }; const onModalHide = () => { complete({result: false}); diff --git a/ext/mixed/js/audio.js b/ext/mixed/js/audio.js index fe5982dd..b5a025be 100644 --- a/ext/mixed/js/audio.js +++ b/ext/mixed/js/audio.js @@ -54,7 +54,6 @@ class TextToSpeechAudio { speechSynthesis.cancel(); speechSynthesis.speak(this._utterance); - } catch (e) { // NOP } @@ -82,7 +81,6 @@ class TextToSpeechAudio { return new TextToSpeechAudio(text, voice); } - } function audioGetFromUrl(url, willDownload) { From c3e7280365a78f648ab15c8460cabfb276e077d4 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Sat, 15 Feb 2020 19:49:20 -0500 Subject: [PATCH 04/12] Simplify ternary --- ext/bg/js/search-query-parser.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/bg/js/search-query-parser.js b/ext/bg/js/search-query-parser.js index 3d38e6e8..8c434990 100644 --- a/ext/bg/js/search-query-parser.js +++ b/ext/bg/js/search-query-parser.js @@ -59,7 +59,7 @@ class QueryParser extends TextScanner { this.search.setContent('terms', {definitions, context: { focus: false, - disableHistory: cause === 'mouse' ? true : false, + disableHistory: cause === 'mouse', sentence: {text: searchText, offset: 0}, url: window.location.href }}); From 56567903a5935a7e57e7a8134e3c118a2188babb Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Sat, 15 Feb 2020 19:49:56 -0500 Subject: [PATCH 05/12] Fix unnamed functions --- ext/bg/js/settings/popup-preview-frame.js | 4 ++-- ext/bg/js/util.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ext/bg/js/settings/popup-preview-frame.js b/ext/bg/js/settings/popup-preview-frame.js index 890b8c96..aa2b6100 100644 --- a/ext/bg/js/settings/popup-preview-frame.js +++ b/ext/bg/js/settings/popup-preview-frame.js @@ -60,8 +60,8 @@ class SettingsPopupPreview { this.frontend = new Frontend(this.popup); - this.frontend.setEnabled = function () {}; - this.frontend.searchClear = function () {}; + this.frontend.setEnabled = () => {}; + this.frontend.searchClear = () => {}; await this.frontend.prepare(); diff --git a/ext/bg/js/util.js b/ext/bg/js/util.js index 9ebd2ac4..5ce4b08c 100644 --- a/ext/bg/js/util.js +++ b/ext/bg/js/util.js @@ -33,7 +33,7 @@ function utilIsolate(value) { } function utilFunctionIsolate(func) { - return function (...args) { + return function isolatedFunction(...args) { try { args = args.map((v) => utilIsolate(v)); return func.call(this, ...args); From 0c8f567e6db8f87974f472cac6bb065a5dd4d754 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Sat, 15 Feb 2020 19:51:53 -0500 Subject: [PATCH 06/12] Fix indentation --- ext/mixed/js/text-scanner.js | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/ext/mixed/js/text-scanner.js b/ext/mixed/js/text-scanner.js index db3835cf..ff0eac8b 100644 --- a/ext/mixed/js/text-scanner.js +++ b/ext/mixed/js/text-scanner.js @@ -141,18 +141,18 @@ class TextScanner { const textSourceCurrentPrevious = this.textSourceCurrent !== null ? this.textSourceCurrent.clone() : null; this.searchAt(primaryTouch.clientX, primaryTouch.clientY, 'touchStart') - .then(() => { - if ( - this.textSourceCurrent === null || - this.textSourceCurrent.equals(textSourceCurrentPrevious) - ) { - return; - } + .then(() => { + if ( + this.textSourceCurrent === null || + this.textSourceCurrent.equals(textSourceCurrentPrevious) + ) { + return; + } - this.preventScroll = true; - this.preventNextContextMenu = true; - this.preventNextMouseDown = true; - }); + this.preventScroll = true; + this.preventNextContextMenu = true; + this.preventNextMouseDown = true; + }); } onTouchEnd(e) { From b3212d776e3f6d735bc9d67acbebc28b7f061ba8 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Sat, 15 Feb 2020 20:11:29 -0500 Subject: [PATCH 07/12] Stylistic rules --- .eslintrc.json | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/.eslintrc.json b/.eslintrc.json index 9b0754fc..b21c00f4 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -21,11 +21,13 @@ "curly": ["error", "all"], "dot-notation": "error", "eqeqeq": "error", + "func-names": ["error", "always"], "no-case-declarations": "error", "no-const-assign": "error", "no-constant-condition": "off", "no-global-assign": "error", "no-undef": "error", + "no-unneeded-ternary": "error", "no-unused-vars": ["error", {"vars": "local", "args": "after-used", "argsIgnorePattern": "^_", "caughtErrors": "none"}], "no-unused-expressions": "error", "no-var": "error", @@ -34,6 +36,35 @@ "quotes": ["error", "single", "avoid-escape"], "require-atomic-updates": "off", "semi": "error", + + // Whitespace rules + "brace-style": ["error", "1tbs", {"allowSingleLine": true}], + "indent": ["error", 4, {"SwitchCase": 1, "MemberExpression": 1, "flatTernaryExpressions": true, "ignoredNodes": ["ConditionalExpression"]}], + "object-curly-newline": "error", + "padded-blocks": ["error", "never"], + + "array-bracket-spacing": ["error", "never"], + "arrow-spacing": ["error", {"before": true, "after": true}], + "block-spacing": ["error", "always"], + "comma-spacing": ["error", { "before": false, "after": true }], + "computed-property-spacing": ["error", "never"], + "func-call-spacing": ["error", "never"], + "generator-star-spacing": ["error", "before"], + "key-spacing": ["error", {"beforeColon": false, "afterColon": true, "mode": "strict"}], + "keyword-spacing": ["error", {"before": true, "after": true}], + "no-trailing-spaces": "error", + "no-whitespace-before-property": "error", + "object-curly-spacing": ["error", "never"], + "rest-spread-spacing": ["error", "never"], + "semi-spacing": ["error", {"before": false, "after": true}], + "space-in-parens": ["error", "never"], + "space-unary-ops": "error", + "spaced-comment": ["error", "always", {"markers": ["global"]}], + "switch-colon-spacing": ["error", {"after": true, "before": false}], + "template-curly-spacing": ["error", "never"], + "template-tag-spacing": ["error", "never"], + + // Extensions "no-unsanitized/method": "error", "no-unsanitized/property": "error" }, From c0d91bffc461c61af9d35aecb7c92e15648382b2 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Mon, 17 Feb 2020 15:21:30 -0500 Subject: [PATCH 08/12] Add no-shadow --- .eslintrc.json | 1 + ext/bg/js/backend.js | 32 +++++++++++++++--------------- ext/bg/js/database.js | 4 ++-- ext/bg/js/japanese.js | 12 +++++------ ext/bg/js/json-schema.js | 2 +- ext/bg/js/search.js | 4 ++-- ext/bg/js/settings/dictionaries.js | 2 +- ext/mixed/js/core.js | 6 +++--- 8 files changed, 32 insertions(+), 31 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index b21c00f4..cfee7be8 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -26,6 +26,7 @@ "no-const-assign": "error", "no-constant-condition": "off", "no-global-assign": "error", + "no-shadow": ["error", {"builtinGlobals": false}], "no-undef": "error", "no-unneeded-ternary": "error", "no-unused-vars": ["error", {"vars": "local", "args": "after-used", "argsIgnorePattern": "^_", "caughtErrors": "none"}], diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js index 7c71f82c..2691b7d9 100644 --- a/ext/bg/js/backend.js +++ b/ext/bg/js/backend.js @@ -274,18 +274,18 @@ class Backend { const node = nodes.pop(); for (const key of Object.keys(node.obj)) { const path = node.path.concat(key); - const obj = node.obj[key]; - if (obj !== null && typeof obj === 'object') { - nodes.unshift({obj, path}); + const obj2 = node.obj[key]; + if (obj2 !== null && typeof obj2 === 'object') { + nodes.unshift({obj: obj2, path}); } else { - valuePaths.push([obj, path]); + valuePaths.push([obj2, path]); } } } return valuePaths; } - function modifyOption(path, value, options) { + function modifyOption(path, value) { let pivot = options; for (const key of path.slice(0, -1)) { if (!hasOwn(pivot, key)) { @@ -298,7 +298,7 @@ class Backend { } for (const [value, path] of getValuePaths(changedOptions)) { - modifyOption(path, value, options); + modifyOption(path, value); } await this._onApiOptionsSave({source}); @@ -340,9 +340,9 @@ class Backend { dictTermsSort(definitions); const {expression, reading} = definitions[0]; const source = text.substring(0, sourceLength); - for (const {text, furigana} of jpDistributeFuriganaInflected(expression, reading, source)) { - const reading = jpConvertReading(text, furigana, options.parsing.readingMode); - term.push({text, reading}); + for (const {text: text2, furigana} of jpDistributeFuriganaInflected(expression, reading, source)) { + const reading2 = jpConvertReading(text2, furigana, options.parsing.readingMode); + term.push({text: text2, reading: reading2}); } text = text.substring(source.length); } else { @@ -365,17 +365,17 @@ class Backend { for (const {expression, reading, source} of parsedLine) { const term = []; if (expression !== null && reading !== null) { - for (const {text, furigana} of jpDistributeFuriganaInflected( + for (const {text: text2, furigana} of jpDistributeFuriganaInflected( expression, jpKatakanaToHiragana(reading), source )) { - const reading = jpConvertReading(text, furigana, options.parsing.readingMode); - term.push({text, reading}); + const reading2 = jpConvertReading(text2, furigana, options.parsing.readingMode); + term.push({text: text2, reading: reading2}); } } else { - const reading = jpConvertReading(source, null, options.parsing.readingMode); - term.push({text: source, reading}); + const reading2 = jpConvertReading(source, null, options.parsing.readingMode); + term.push({text: source, reading: reading2}); } result.push(term); } @@ -816,12 +816,12 @@ class Backend { try { const tabWindow = await new Promise((resolve, reject) => { - chrome.windows.get(tab.windowId, {}, (tabWindow) => { + chrome.windows.get(tab.windowId, {}, (value) => { const e = chrome.runtime.lastError; if (e) { reject(e); } else { - resolve(tabWindow); + resolve(value); } }); }); diff --git a/ext/bg/js/database.js b/ext/bg/js/database.js index 1f6810cf..558f3ceb 100644 --- a/ext/bg/js/database.js +++ b/ext/bg/js/database.js @@ -809,9 +809,9 @@ class Database { for (const objectStoreName of objectStoreNames) { const {primaryKey, indices} = stores[objectStoreName]; - const objectStoreNames = transaction.objectStoreNames || db.objectStoreNames; + const objectStoreNames2 = transaction.objectStoreNames || db.objectStoreNames; const objectStore = ( - Database._listContains(objectStoreNames, objectStoreName) ? + Database._listContains(objectStoreNames2, objectStoreName) ? transaction.objectStore(objectStoreName) : db.createObjectStore(objectStoreName, primaryKey) ); diff --git a/ext/bg/js/japanese.js b/ext/bg/js/japanese.js index e8a6fa08..abb32da4 100644 --- a/ext/bg/js/japanese.js +++ b/ext/bg/js/japanese.js @@ -224,15 +224,15 @@ function jpDistributeFurigana(expression, reading) { } let isAmbiguous = false; - const segmentize = (reading, groups) => { + const segmentize = (reading2, groups) => { if (groups.length === 0 || isAmbiguous) { return []; } const group = groups[0]; if (group.mode === 'kana') { - if (jpKatakanaToHiragana(reading).startsWith(jpKatakanaToHiragana(group.text))) { - const readingLeft = reading.substring(group.text.length); + if (jpKatakanaToHiragana(reading2).startsWith(jpKatakanaToHiragana(group.text))) { + const readingLeft = reading2.substring(group.text.length); const segs = segmentize(readingLeft, groups.splice(1)); if (segs) { return [{text: group.text}].concat(segs); @@ -240,9 +240,9 @@ function jpDistributeFurigana(expression, reading) { } } else { let foundSegments = null; - for (let i = reading.length; i >= group.text.length; --i) { - const readingUsed = reading.substring(0, i); - const readingLeft = reading.substring(i); + for (let i = reading2.length; i >= group.text.length; --i) { + const readingUsed = reading2.substring(0, i); + const readingLeft = reading2.substring(i); const segs = segmentize(readingLeft, groups.slice(1)); if (segs) { if (foundSegments !== null) { diff --git a/ext/bg/js/json-schema.js b/ext/bg/js/json-schema.js index 3cf24c35..58f804fd 100644 --- a/ext/bg/js/json-schema.js +++ b/ext/bg/js/json-schema.js @@ -401,7 +401,7 @@ class JsonSchemaProxyHandler { info.valuePush(i, propertyValue); JsonSchemaProxyHandler.validate(propertyValue, propertySchema, info); info.valuePop(); - for (let i = 0; i < schemaPath.length; ++i) { info.schemaPop(); } + for (let j = 0, jj = schemaPath.length; j < jj; ++j) { info.schemaPop(); } } } diff --git a/ext/bg/js/search.js b/ext/bg/js/search.js index 76a62b97..98e167ad 100644 --- a/ext/bg/js/search.js +++ b/ext/bg/js/search.js @@ -70,7 +70,7 @@ class DisplaySearch extends Display { this.wanakanaEnable.checked = false; } this.wanakanaEnable.addEventListener('change', (e) => { - const {queryParams: {query=''}} = parseUrl(window.location.href); + const {queryParams: {query: query2=''}} = parseUrl(window.location.href); if (e.target.checked) { window.wanakana.bind(this.query); apiOptionsSet({general: {enableWanakana: true}}, this.getOptionsContext()); @@ -78,7 +78,7 @@ class DisplaySearch extends Display { window.wanakana.unbind(this.query); apiOptionsSet({general: {enableWanakana: false}}, this.getOptionsContext()); } - this.setQuery(query); + this.setQuery(query2); this.onSearchQueryUpdated(this.query.value, false); }); } diff --git a/ext/bg/js/settings/dictionaries.js b/ext/bg/js/settings/dictionaries.js index 427f47f0..70a22a16 100644 --- a/ext/bg/js/settings/dictionaries.js +++ b/ext/bg/js/settings/dictionaries.js @@ -166,7 +166,7 @@ class SettingsDictionaryListUI { delete n.dataset.dict; $(n).modal('hide'); - const index = this.dictionaryEntries.findIndex((e) => e.dictionaryInfo.title === title); + const index = this.dictionaryEntries.findIndex((entry) => entry.dictionaryInfo.title === title); if (index >= 0) { this.dictionaryEntries[index].deleteDictionary(); } diff --git a/ext/mixed/js/core.js b/ext/mixed/js/core.js index 330a30fb..83813796 100644 --- a/ext/mixed/js/core.js +++ b/ext/mixed/js/core.js @@ -160,9 +160,9 @@ function promiseTimeout(delay, resolveValue) { const resolve = (value) => complete(promiseResolve, value); const reject = (value) => complete(promiseReject, value); - const promise = new Promise((resolve, reject) => { - promiseResolve = resolve; - promiseReject = reject; + const promise = new Promise((resolve2, reject2) => { + promiseResolve = resolve2; + promiseReject = reject2; }); timer = window.setTimeout(() => { timer = null; From f1ccd5280635f9528b2cfe4629222c627065781c Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Mon, 17 Feb 2020 15:28:10 -0500 Subject: [PATCH 09/12] Explicitly indicate that "no-param-reassign" is allowed --- .eslintrc.json | 1 + 1 file changed, 1 insertion(+) diff --git a/.eslintrc.json b/.eslintrc.json index cfee7be8..2dc63e80 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -26,6 +26,7 @@ "no-const-assign": "error", "no-constant-condition": "off", "no-global-assign": "error", + "no-param-reassign": "off", "no-shadow": ["error", {"builtinGlobals": false}], "no-undef": "error", "no-unneeded-ternary": "error", From 9dd779836c34c6877c9736d937c3c4109b173b18 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Mon, 17 Feb 2020 15:30:41 -0500 Subject: [PATCH 10/12] Add "no-prototype-builtins" --- .eslintrc.json | 1 + 1 file changed, 1 insertion(+) diff --git a/.eslintrc.json b/.eslintrc.json index 2dc63e80..fcc6995b 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -27,6 +27,7 @@ "no-constant-condition": "off", "no-global-assign": "error", "no-param-reassign": "off", + "no-prototype-builtins": "error", "no-shadow": ["error", {"builtinGlobals": false}], "no-undef": "error", "no-unneeded-ternary": "error", From e3cfb3fbc709285e292fe5e8bb68ca8903e6c86b Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Mon, 17 Feb 2020 15:36:58 -0500 Subject: [PATCH 11/12] Fix test-schema.js --- test/test-schema.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/test-schema.js b/test/test-schema.js index ca4f56dd..8ca63167 100644 --- a/test/test-schema.js +++ b/test/test-schema.js @@ -30,7 +30,7 @@ function testValidate1() { ] }; - const schemaValidate = (value, schema) => { + const schemaValidate = (value) => { try { JsonSchema.validate(value, schema); return true; @@ -48,7 +48,7 @@ function testValidate1() { ) && ( ( - (value % 3 )=== 0 || + (value % 3) === 0 || (value % 5) === 0 ) && (value % 15) !== 0 @@ -81,7 +81,7 @@ function testGetValidValueOrDefault1() { const testData = [ [ - void(0), + void 0, {test: 'default'} ], [ @@ -210,7 +210,7 @@ function testGetValidValueOrDefault3() { {test: 'value', test2: 2, test3: 10} ], [ - {test: 'value', test2: 2, test3: void(0)}, + {test: 'value', test2: 2, test3: void 0}, {test: 'value', test2: 2, test3: 10} ] ]; From 6513a15b3b5fd8586226c8823e2680478b97e132 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Sat, 22 Feb 2020 14:54:57 -0500 Subject: [PATCH 12/12] Fix shadowing --- test/test-database.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/test-database.js b/test/test-database.js index 04ed8100..44f409dd 100644 --- a/test/test-database.js +++ b/test/test-database.js @@ -36,8 +36,8 @@ class XMLHttpRequest { callbacks.push(callback); } - open(action, url) { - this._url = url; + open(action, url2) { + this._url = url2; } send() { @@ -116,10 +116,10 @@ function clearDatabase(timeout) { (async () => { const indexedDB = global.indexedDB; for (const {name} of await indexedDB.databases()) { - await new Promise((resolve, reject) => { + await new Promise((resolve2, reject2) => { const request = indexedDB.deleteDatabase(name); - request.onerror = (e) => reject(e); - request.onsuccess = () => resolve(); + request.onerror = (e) => reject2(e); + request.onsuccess = () => resolve2(); }); } clearTimeout(timer);