Prechádzať zdrojové kódy

fix: can't attach debugger

Ahmad Kholid 1 rok pred
rodič
commit
3e6972ccc7

+ 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);
     });
   });
 }