소스 검색

fix: can't attach debugger

Ahmad Kholid 1 년 전
부모
커밋
3e6972ccc7
2개의 변경된 파일4개의 추가작업 그리고 11개의 파일을 삭제
  1. 2 0
      src/content/blocksHandler/handlerForms.js
  2. 2 11
      src/workflowEngine/helper.js

+ 2 - 0
src/content/blocksHandler/handlerForms.js

@@ -24,6 +24,8 @@ async function forms(block) {
 
   async function typeText(element) {
     if (block.debugMode && data.type === 'text-field') {
+      element.focus?.();
+
       const commands = data.value.split('').map((char) => ({
         type: 'keyDown',
         text: char === '\n' ? '\r' : char,

+ 2 - 11
src/workflowEngine/helper.js

@@ -65,17 +65,8 @@ export function attachDebugger(tabId, prevTab) {
     if (prevTab && tabId !== prevTab)
       chrome.debugger.detach({ tabId: prevTab });
 
-    chrome.debugger.getTargets((targets) => {
-      targets.forEach((target) => {
-        if (target.attached || target.tabId !== tabId) {
-          resolve();
-          return;
-        }
-
-        chrome.debugger.attach({ tabId }, '1.3', () => {
-          chrome.debugger.sendCommand({ tabId }, 'Page.enable', resolve);
-        });
-      });
+    chrome.debugger.attach({ tabId }, '1.3', () => {
+      chrome.debugger.sendCommand({ tabId }, 'Page.enable', resolve);
     });
   });
 }