]> git.r.bdr.sh - rbdr/junction/blobdiff - extension/junction.js
Add a contributing guide
[rbdr/junction] / extension / junction.js
index c3cb4e9db5d221846e6ecbad41dcda2855d088e5..1d5f8a50b26c5ef8546f43245ba771862fac0aa2 100644 (file)
@@ -1,6 +1,6 @@
 const internals = {
   promisesSupported: !!window.browser,
-  injectedScript: false,
+  injectedScript: {},
   port: null,
   currentUrl: null,
 
@@ -62,14 +62,15 @@ const internals = {
     const activeTabs = await internals.getActiveTabs();
 
     internals.currentUrl = activeTabs[0].url;
-    if (!internals.injectedScript) {
+    const id = activeTabs[0].id;
+    if (!internals.injectedScript[id]) {
       const execution = await internals.getRoot().tabs.executeScript(
         activeTabs[0].id,
         {
           file: "/build/content_script.js",
         },
         () => {
-          internals.injectedScript = true;
+          internals.injectedScript[id] = true;
         },
       );