not adding the listener if the early exit condition is met

This commit is contained in:
mic 2024-04-11 00:33:02 +02:00
parent 9f71956cd2
commit b80ad8be3f

View file

@ -107,9 +107,10 @@ async function openChatGPT(promptText, action, curr_tabId) {
// Early exit if loaded already // Early exit if loaded already
if (tabIsLoaded(createdTab)) { if (tabIsLoaded(createdTab)) {
resolve(); resolve();
} else {
browser.tabs.onUpdated.addListener(listener);
} }
browser.tabs.onUpdated.addListener(listener); });
})
browser.tabs.executeScript(createdTab.id, { code: mzta_script, matchAboutBlank: false }) browser.tabs.executeScript(createdTab.id, { code: mzta_script, matchAboutBlank: false })
.then(async () => { .then(async () => {