mirror of
https://github.com/microsoft/playwright-mcp.git
synced 2026-02-04 09:13:10 +00:00
chore(extension): terminate connection on debugger detach (#816)
This commit is contained in:
@@ -59,10 +59,6 @@ export class RelayConnection {
|
|||||||
this._ws.close(1000, message);
|
this._ws.close(1000, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async _detachDebugger(): Promise<void> {
|
|
||||||
await chrome.debugger.detach(this._debuggee);
|
|
||||||
}
|
|
||||||
|
|
||||||
private _onDebuggerEvent(source: chrome.debugger.DebuggerSession, method: string, params: any): void {
|
private _onDebuggerEvent(source: chrome.debugger.DebuggerSession, method: string, params: any): void {
|
||||||
if (source.tabId !== this._debuggee.tabId)
|
if (source.tabId !== this._debuggee.tabId)
|
||||||
return;
|
return;
|
||||||
@@ -81,13 +77,7 @@ export class RelayConnection {
|
|||||||
private _onDebuggerDetach(source: chrome.debugger.Debuggee, reason: string): void {
|
private _onDebuggerDetach(source: chrome.debugger.Debuggee, reason: string): void {
|
||||||
if (source.tabId !== this._debuggee.tabId)
|
if (source.tabId !== this._debuggee.tabId)
|
||||||
return;
|
return;
|
||||||
this._sendMessage({
|
this.close(`Debugger detached: ${reason}`);
|
||||||
method: 'detachedFromTab',
|
|
||||||
params: {
|
|
||||||
tabId: this._debuggee.tabId,
|
|
||||||
reason,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
this._debuggee = { };
|
this._debuggee = { };
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -131,10 +121,6 @@ export class RelayConnection {
|
|||||||
targetInfo: result?.targetInfo,
|
targetInfo: result?.targetInfo,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if (message.method === 'detachFromTab') {
|
|
||||||
debugLog('Detaching debugger from tab:', this._debuggee);
|
|
||||||
return await this._detachDebugger();
|
|
||||||
}
|
|
||||||
if (message.method === 'forwardCDPCommand') {
|
if (message.method === 'forwardCDPCommand') {
|
||||||
const { sessionId, method, params } = message.params;
|
const { sessionId, method, params } = message.params;
|
||||||
debugLog('CDP command:', method, params);
|
debugLog('CDP command:', method, params);
|
||||||
|
|||||||
Reference in New Issue
Block a user