Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/src/vs/workbench/services/browserView/electron-browser/playwrightWorkbenchService.ts
13401 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
6
import { mainWindow } from '../../../../base/browser/window.js';
7
import { IChannel, ProxyChannel } from '../../../../base/parts/ipc/common/ipc.js';
8
import { IPlaywrightService } from '../../../../platform/browserView/common/playwrightService.js';
9
import { registerSharedProcessRemoteService } from '../../../../platform/ipc/electron-browser/services.js';
10
import { ILogService } from '../../../../platform/log/common/log.js';
11
12
class PlaywrightChannelClient {
13
constructor(
14
channel: IChannel,
15
@ILogService logService: ILogService
16
) {
17
/**
18
* send the current window's ID once via `__initialize`, so the server-side {@link PlaywrightChannel}
19
* can create a per-window {@link PlaywrightWindowInstance}. All subsequent calls and events are proxied directly.
20
*/
21
void channel.call('__initialize', mainWindow.vscodeWindowId).catch((e) => {
22
logService.error(`Failed to initialize Playwright service`, e);
23
});
24
return ProxyChannel.toService<IPlaywrightService>(channel);
25
}
26
}
27
28
registerSharedProcessRemoteService(IPlaywrightService, 'playwright', { channelClientCtor: PlaywrightChannelClient });
29
30