Skip to content
This repository was archived by the owner on Nov 16, 2023. It is now read-only.

Commit ea1b17d

Browse files
authored
Merge branch 'master' into patch-1
2 parents a8aa042 + 696d056 commit ea1b17d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/edgeChromiumDebugAdapter.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ export class EdgeChromiumDebugAdapter extends ChromeDebugAdapter {
158158
const pipeName = `VSCode_${crypto.randomBytes(12).toString('base64')}`;
159159
const serverName = `\\\\.\\pipe\\WebView2\\Debugger\\${exeName}\\${pipeName}`;
160160
const targetUrl = this.getWebViewLaunchUrl(args);
161+
let isAttached = false;
161162

162163
// Clean up any previous pipe
163164
await new Promise((resolve) => {
@@ -174,8 +175,9 @@ export class EdgeChromiumDebugAdapter extends ChromeDebugAdapter {
174175
stream.on('data', async (data) => {
175176
const connectionInfo: IWebViewConnectionInfo = JSON.parse(data.toString());
176177
const port = this.getWebViewPort(args, connectionInfo);
177-
if (this.isMatchingWebViewTarget(connectionInfo, targetUrl)) {
178+
if (!isAttached && this.isMatchingWebViewTarget(connectionInfo, targetUrl)) {
178179
webViewCreatedCallback(port);
180+
isAttached = true;
179181
} else {
180182
const address = args.address || '127.0.0.1';
181183
const webSocketUrl = `ws://${address}:${port}/devtools/${connectionInfo.type}/${connectionInfo.id}`
@@ -191,6 +193,7 @@ export class EdgeChromiumDebugAdapter extends ChromeDebugAdapter {
191193
this._webviewPipeServer.on('close', () => {
192194
this._webviewPipeServer = undefined;
193195
webViewCreatedCallback(0);
196+
isAttached = true;
194197
});
195198

196199
this._webviewPipeServer.listen(serverName);

0 commit comments

Comments
 (0)