Browse Source

fix: switch tab block not working on multiple windows

Ahmad Kholid 2 years ago
parent
commit
fd9b07d698
1 changed files with 2 additions and 9 deletions
  1. 2 9
      src/workflowEngine/blocksHandler/handlerSwitchTab.js

+ 2 - 9
src/workflowEngine/blocksHandler/handlerSwitchTab.js

@@ -22,18 +22,11 @@ export default async function ({ data, id }) {
     throw new Error('no-tab');
     throw new Error('no-tab');
   }
   }
 
 
-  const currentWindow = await browser.windows.getCurrent();
-  if (currentWindow.focused)
-    await browser.windows.update(currentWindow.id, { focused: false });
-
   const isTabsQuery = ['match-patterns', 'tab-title'];
   const isTabsQuery = ['match-patterns', 'tab-title'];
-  const tabs =
-    findTabBy !== 'match-patterns'
-      ? await browser.tabs.query({ lastFocusedWindow: true })
-      : [];
+  const tabs = findTabBy !== 'match-patterns' ? await browser.tabs.query() : [];
 
 
   if (isTabsQuery.includes(findTabBy)) {
   if (isTabsQuery.includes(findTabBy)) {
-    const query = { lastFocusedWindow: true };
+    const query = {};
 
 
     if (data.findTabBy === 'match-patterns') query.url = data.matchPattern;
     if (data.findTabBy === 'match-patterns') query.url = data.matchPattern;
     else if (data.findTabBy === 'tab-title') query.title = data.tabTitle;
     else if (data.findTabBy === 'tab-title') query.title = data.tabTitle;