fixed tab loading for 115. to be fixed also for later versions
This commit is contained in:
parent
580410c4b3
commit
874429e341
1 changed files with 18 additions and 18 deletions
|
|
@ -210,24 +210,24 @@ async function openChatGPT(promptText, action, curr_tabId, prompt_name = '', do_
|
||||||
createdWindowID = newWindow.id;
|
createdWindowID = newWindow.id;
|
||||||
let createdTab = newWindow.tabs[0];
|
let createdTab = newWindow.tabs[0];
|
||||||
|
|
||||||
// Wait for tab loaded.
|
// Wait for tab loaded. // TODO This is needed in 128+, but doesn't work in 115
|
||||||
await new Promise(resolve => {
|
// await new Promise(resolve => {
|
||||||
const tabIsLoaded = tab => {
|
// const tabIsLoaded = tab => {
|
||||||
return tab.status == "complete" && tab.url != "about:blank";
|
// return tab.status == "complete" && tab.url != "about:blank";
|
||||||
};
|
// };
|
||||||
const listener = (tabId, changeInfo, updatedTab) => {
|
// const listener = (tabId, changeInfo, updatedTab) => {
|
||||||
if (tabIsLoaded(updatedTab)) {
|
// if (tabIsLoaded(updatedTab)) {
|
||||||
browser.tabs.onUpdated.removeListener(listener);
|
// browser.tabs.onUpdated.removeListener(listener);
|
||||||
resolve();
|
// resolve();
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
// Early exit if loaded already
|
// // Early exit if loaded already
|
||||||
if (tabIsLoaded(createdTab)) {
|
// if (tabIsLoaded(createdTab)) {
|
||||||
resolve();
|
// resolve();
|
||||||
} else {
|
// } else {
|
||||||
browser.tabs.onUpdated.addListener(listener);
|
// browser.tabs.onUpdated.addListener(listener);
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
|
|
||||||
let mailMessage = await browser.messageDisplay.getDisplayedMessage(curr_tabId);
|
let mailMessage = await browser.messageDisplay.getDisplayedMessage(curr_tabId);
|
||||||
let mailMessageId = -1;
|
let mailMessageId = -1;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue