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

Commit 7cda976

Browse files
authored
Merge branch 'master' into ningli/webview2
2 parents 91176e4 + ad91f5b commit 7cda976

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"version": "1.0.14",
55
"icon": "images/icon.png",
66
"description": "%extension.description%",
7-
"extensionKind": "ui",
7+
"extensionKind": ["ui"],
88
"author": {
99
"name": "Microsoft Corporation"
1010
},

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);

tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"removeComments": false,
66
"target": "ES6",
77
"sourceMap": true,
8+
"rootDir": ".",
89
"outDir": "out",
910
"noImplicitThis": true
1011
},

0 commit comments

Comments
 (0)