Skip to content

Commit c7f06e3

Browse files
committed
Fix reconnection issues when watching is unabled
1 parent 01f00bb commit c7f06e3

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/debug-adapter/webKitDebugAdapter.ts

+13-13
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,10 @@ export class WebKitDebugAdapter implements DebugProtocol.IDebugAdapter {
187187
}
188188

189189
private setConnection(connection: INSDebugConnection) : INSDebugConnection {
190+
if (this._webKitConnection) {
191+
this._webKitConnection.close();
192+
}
193+
this._webKitConnection = connection;
190194
connection.on('Debugger.paused', params => this.onDebuggerPaused(params));
191195
connection.on('Debugger.resumed', () => this.onDebuggerResumed());
192196
connection.on('Debugger.scriptParsed', params => this.onScriptParsed(params));
@@ -201,7 +205,6 @@ export class WebKitDebugAdapter implements DebugProtocol.IDebugAdapter {
201205
this.terminateSession();
202206
});
203207
connection.on('connect', () => this.onConnected())
204-
this._webKitConnection = connection;
205208
return connection;
206209
}
207210

@@ -227,18 +230,6 @@ export class WebKitDebugAdapter implements DebugProtocol.IDebugAdapter {
227230
private clearEverything(): void {
228231
this.clearClientContext();
229232
this.clearTargetContext();
230-
231-
if (this._tnsProcess) {
232-
this._tnsProcess.kill('SIGQUIT');
233-
this._tnsProcess = null;
234-
}
235-
236-
if (this._webKitConnection) {
237-
Services.logger().log("Closing debug connection");
238-
239-
this._webKitConnection.close();
240-
this._webKitConnection = null;
241-
}
242233
}
243234

244235
/**
@@ -346,6 +337,15 @@ export class WebKitDebugAdapter implements DebugProtocol.IDebugAdapter {
346337

347338
public disconnect(): Promise<void> {
348339
this.clearEverything();
340+
if (this._tnsProcess) {
341+
this._tnsProcess.kill('SIGQUIT');
342+
this._tnsProcess = null;
343+
}
344+
if (this._webKitConnection) {
345+
Services.logger().log("Closing debug connection");
346+
this._webKitConnection.close();
347+
this._webKitConnection = null;
348+
}
349349

350350
return Promise.resolve<void>();
351351
}

0 commit comments

Comments
 (0)