aboutsummaryrefslogtreecommitdiff
path: root/common/Test.js
diff options
context:
space:
mode:
authorYuchen Pei <hi@ypei.me>2022-07-28 16:54:56 +1000
committerYuchen Pei <hi@ypei.me>2022-07-28 16:54:56 +1000
commita6b8bfef1a92c168d0c541d28c4ea834462bbf64 (patch)
tree06c39d38019613db277c6e345583058f92b3aa6c /common/Test.js
parent136cb7354a7cb3dbc684c2b28c80ed9351c0146c (diff)
clean up common/Test.js
Diffstat (limited to 'common/Test.js')
-rw-r--r--common/Test.js14
1 files changed, 6 insertions, 8 deletions
diff --git a/common/Test.js b/common/Test.js
index d08741e..3e60319 100644
--- a/common/Test.js
+++ b/common/Test.js
@@ -20,7 +20,7 @@
*/
'use strict';
-var Test = (() => {
+const Test = (() => {
const RUNNER_URL = browser.runtime.getURL('/test/SpecRunner.html');
return {
/*
@@ -28,19 +28,17 @@ var Test = (() => {
temporary extension session, null otherwise
*/
async getURL() {
- let url = RUNNER_URL;
try {
- await fetch(url);
+ await fetch(RUNNER_URL);
+ return RUNNER_URL;
} catch (e) {
- url = null;
+ return null;
}
- this.getURL = () => url;
- return url;
},
async getTab(activate = false) {
- let url = await this.getURL();
- let tab = url ? (await browser.tabs.query({ url }))[0] ||
+ const url = await this.getURL();
+ const tab = url ? (await browser.tabs.query({ url }))[0] ||
(await browser.tabs.create({ url }))
: null;
if (tab && activate) {