Skip to content

Commit 37a5fa6

Browse files
committed
fix: simplify getting the hostname
1 parent c0ae208 commit 37a5fa6

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

src/popup/addEditInterface.js

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -285,16 +285,11 @@ function AddEditInterface(settingsModel) {
285285
// view instance should be a Login
286286
loginObj = new Login(settings);
287287

288-
const currentTab = // only one tab should be active and in the current window
289-
(
290-
await browser.tabs.query({
291-
active: true,
292-
lastFocusedWindow: true,
293-
})
294-
)[0];
295-
const host = new URL(currentTab.url).host;
296288
// prefill the host of the current tab
297-
loginObj.login = host;
289+
if (settings.origin !== "null") {
290+
const hostname = new URL(settings.origin).hostname;
291+
loginObj.login = hostname;
292+
}
298293
}
299294

300295
// set the storePath and get tree dirs

0 commit comments

Comments
 (0)