Browse Source

fix: Error executing a JavaScript block when the Execution Context is "Background" (#1155)(#1134)

Ahmad Kholid 2 years ago
parent
commit
cf19d28431

+ 0 - 1
src/content/services/webService.js

@@ -201,7 +201,6 @@ window.addEventListener('user-logout', () => {
 });
 
 window.addEventListener('app-mounted', async () => {
-  console.log('haha');
   try {
     const STORAGE_KEY = 'supabase.auth.token';
     const session = parseJSON(localStorage.getItem(STORAGE_KEY), null);

+ 2 - 2
src/workflowEngine/blocksHandler/handlerJavascriptCode.js

@@ -165,9 +165,9 @@ export async function javascriptCode({ outputs, data, ...block }, { refData }) {
   }
 
   const inSandbox =
+    (this.engine.isMV2 || this.engine.isPopup) &&
     BROWSER_TYPE !== 'firefox' &&
-    data.context === 'background' &&
-    (this.engine.isMV2 || this.engine.isPopup);
+    data.context === 'background';
   const result = await (inSandbox
     ? messageSandbox('javascriptBlock', {
         instanceId,