Skip to content
Snippets Groups Projects
Commit 342a7f93 authored by Lucie Bader's avatar Lucie Bader
Browse files

Correction beug onglets

parent 1ee1f88b
No related branches found
No related tags found
2 merge requests!8Test final,!6Améliorations du menu de l'extension
......@@ -132,12 +132,28 @@ worker.onmessage = (event) => {
if (event.data.type === "pyodide-simplemma" && event.data.status === "success") {
browser.tabs.query({}).then((tabs) => {
tabs.forEach((tab) => {
browser.tabs.sendMessage(tab.id, { command: "pyodide-simplemma-ready" })
.catch((error) => console.warn(`[Background] Impossible d'envoyer un message à l'onglet ${tab.id} : ${error}`));
if (!tab.url || (!tab.url.startsWith("https://") && (!tab.url.startsWith("https://")))) {
return;
}
if (tab.url.includes("sidebar.html")) {
return;
}
try {
let response = browser.tabs.sendMessage(tab.id, { command: "pyodide-simplemma-ready" })
if (response && typeof response.then === "function") {
response.then(() => {
}).catch((error) => {
log("[Background] Impossible d'envoyer un message à l'onglet ${tab.id} : ${error}");
});
}
} catch (error) {
log("[Background] Erreur lors de l'envoi d'un message à l'onglet ${tab.id} : ${error}");
}
});
});
})
}
};
}
// ─────────────────────────────────────────────────────────────────────────────
// Fonctions d'authentification & de redirection
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment