Parcourir la source

fix(step8): stop debugger click cleanly

QLHazyCoder il y a 4 mois
Parent
commit
55c90dd8f7
1 fichiers modifiés avec 5 ajouts et 0 suppressions
  1. 5 0
      background.js

+ 5 - 0
background.js

@@ -2211,6 +2211,7 @@ async function humanStepDelay(min = HUMAN_STEP_DELAY_MIN, max = HUMAN_STEP_DELAY
 }
 }
 
 
 async function clickWithDebugger(tabId, rect) {
 async function clickWithDebugger(tabId, rect) {
+  throwIfStopped();
   if (!tabId) {
   if (!tabId) {
     throw new Error('未找到用于调试点击的认证页面标签页。');
     throw new Error('未找到用于调试点击的认证页面标签页。');
   }
   }
@@ -2229,10 +2230,12 @@ async function clickWithDebugger(tabId, rect) {
   }
   }
 
 
   try {
   try {
+    throwIfStopped();
     const x = Math.round(rect.centerX);
     const x = Math.round(rect.centerX);
     const y = Math.round(rect.centerY);
     const y = Math.round(rect.centerY);
 
 
     await chrome.debugger.sendCommand(target, 'Page.bringToFront');
     await chrome.debugger.sendCommand(target, 'Page.bringToFront');
+    throwIfStopped();
     await chrome.debugger.sendCommand(target, 'Input.dispatchMouseEvent', {
     await chrome.debugger.sendCommand(target, 'Input.dispatchMouseEvent', {
       type: 'mouseMoved',
       type: 'mouseMoved',
       x,
       x,
@@ -2241,6 +2244,7 @@ async function clickWithDebugger(tabId, rect) {
       buttons: 0,
       buttons: 0,
       clickCount: 0,
       clickCount: 0,
     });
     });
+    throwIfStopped();
     await chrome.debugger.sendCommand(target, 'Input.dispatchMouseEvent', {
     await chrome.debugger.sendCommand(target, 'Input.dispatchMouseEvent', {
       type: 'mousePressed',
       type: 'mousePressed',
       x,
       x,
@@ -2249,6 +2253,7 @@ async function clickWithDebugger(tabId, rect) {
       buttons: 1,
       buttons: 1,
       clickCount: 1,
       clickCount: 1,
     });
     });
+    throwIfStopped();
     await chrome.debugger.sendCommand(target, 'Input.dispatchMouseEvent', {
     await chrome.debugger.sendCommand(target, 'Input.dispatchMouseEvent', {
       type: 'mouseReleased',
       type: 'mouseReleased',
       x,
       x,