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
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
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) {
|
package/package.json
CHANGED