cdp-tunnel 3.3.5 → 3.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -107,23 +107,37 @@ var DebuggerManager = (function() {
107
107
  }
108
108
 
109
109
  function doAttach(tabId, state) {
110
- return chrome.debugger.attach({ tabId: tabId }, Config.DEBUGGER_VERSION)
111
- .then(function() {
112
- Logger.info('[Debugger] Attached to tab', tabId);
113
- if (state) {
114
- state.addAttachedTab(tabId);
115
- state.setCurrentTabId(tabId);
116
- state.persist(tabId, true);
117
- }
118
- return injectInternalUrlBlocker(tabId);
119
- })
120
- .then(function() {
121
- return true;
122
- })
123
- .catch(function(error) {
124
- Logger.error('[Debugger] Failed to attach to tab', tabId, ':', error.message);
125
- return false;
126
- });
110
+ var retryCount = 0;
111
+ var maxRetries = 3;
112
+
113
+ function attemptAttach() {
114
+ return chrome.debugger.attach({ tabId: tabId }, Config.DEBUGGER_VERSION)
115
+ .then(function() {
116
+ Logger.info('[Debugger] Attached to tab', tabId);
117
+ if (state) {
118
+ state.addAttachedTab(tabId);
119
+ state.setCurrentTabId(tabId);
120
+ state.persist(tabId, true);
121
+ }
122
+ return injectInternalUrlBlocker(tabId);
123
+ })
124
+ .then(function() {
125
+ return true;
126
+ })
127
+ .catch(function(error) {
128
+ retryCount++;
129
+ if (retryCount <= maxRetries) {
130
+ Logger.warn('[Debugger] Attach retry', retryCount, 'for tab', tabId, ':', error.message);
131
+ return new Promise(function(resolve) {
132
+ setTimeout(function() { resolve(attemptAttach()); }, 100 * retryCount);
133
+ });
134
+ }
135
+ Logger.error('[Debugger] Failed to attach to tab', tabId, 'after', maxRetries, 'retries:', error.message);
136
+ return false;
137
+ });
138
+ }
139
+
140
+ return attemptAttach();
127
141
  }
128
142
 
129
143
  function injectInternalUrlBlocker(tabId) {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "manifest_version": 3,
3
3
  "name": "CDP Bridge",
4
- "version": "3.3.5",
4
+ "version": "3.3.6",
5
5
  "description": "Chrome DevTools Protocol Bridge for Playwright/Puppeteer automation",
6
6
  "permissions": [
7
7
  "debugger",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cdp-tunnel",
3
- "version": "3.3.5",
3
+ "version": "3.3.6",
4
4
  "description": "Bridge Chrome's debugger API to WebSocket — control your existing browser with Playwright/Puppeteer via CDP",
5
5
  "main": "server/proxy-server.js",
6
6
  "bin": "./cli/index.js",