Browse Source

Merge pull request #1156 from AprildreamMI/v2-bg

feat: Under v2 background running and creating a separate window should be the same
Ahmad Kholid 2 years ago
parent
commit
40ccdc3d50
1 changed files with 7 additions and 1 deletions
  1. 7 1
      src/background/BackgroundWorkflowUtils.js

+ 7 - 1
src/background/BackgroundWorkflowUtils.js

@@ -42,7 +42,13 @@ class BackgroundWorkflowUtils {
   static async executeWorkflow(workflowData, options) {
   static async executeWorkflow(workflowData, options) {
     if (workflowData.isDisabled) return;
     if (workflowData.isDisabled) return;
 
 
-    startWorkflowExec(workflowData, options, false);
+    /**
+     * Under v2, the background runtime environment is a real browser window. It has DOM, URL...
+      But these don't exist under v3. v3 uses service_worker (https://developer.mozilla.org/zh-CN/docs/Web/API/Service_Worker_API), so a dashboard page is created to run the workflow
+      So v2 and isPopup are actually the same
+     */
+    const isMV2 = browser.runtime.getManifest().manifest_version === 2;
+    startWorkflowExec(workflowData, options, isMV2);
   }
   }
 }
 }