Przeglądaj źródła

fix: throw `net::ERR_BLOCKED_BY_CLIENT` error when executing workflow

Ahmad Kholid 3 lat temu
rodzic
commit
5049208e42
1 zmienionych plików z 7 dodań i 2 usunięć
  1. 7 2
      src/background/workflowEngine/helper.js

+ 7 - 2
src/background/workflowEngine/helper.js

@@ -37,9 +37,14 @@ export function attachDebugger(tabId, prevTab) {
 
 export function waitTabLoaded(tabId, ms = 10000) {
   return new Promise((resolve, reject) => {
-    let timeout = null;
+    const excludeErrors = ['net::ERR_BLOCKED_BY_CLIENT', 'net::ERR_ABORTED'];
+
     const onErrorOccurred = (details) => {
-      if (details.tabId !== tabId || details.error.includes('ERR_ABORTED'))
+      if (
+        details.tabId !== tabId ||
+        details.frameId !== 0 ||
+        !excludeErrors.includes(details.error)
+      )
         return;
 
       browser.webNavigation.onErrorOccurred.removeListener(onErrorOccurred);