Skip to content

Commit ccb7c92

Browse files
committed
rebase
1 parent 09b921d commit ccb7c92

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

packages/playwright-core/src/server/browserType.ts

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -264,17 +264,21 @@ export abstract class BrowserType extends SdkObject {
264264
close: () => closeOrKill((options as any).__testHookBrowserCloseTimeout || DEFAULT_PLAYWRIGHT_TIMEOUT),
265265
kill
266266
};
267-
progress.cleanupWhenAborted(() => closeOrKill(DEFAULT_PLAYWRIGHT_TIMEOUT));
268-
const { wsEndpoint } = await progress.race([
269-
this.waitForReadyState(options, browserLogsCollector),
270-
exitPromise.then(() => ({ wsEndpoint: undefined })),
271-
]);
272-
if (options.cdpPort !== undefined || !this.supportsPipeTransport())
273-
transport = await WebSocketTransport.connect(progress, wsEndpoint!);
274-
else
275-
transport = new PipeTransport(processLifecycleHooks.writePipe(launchedProcess), processLifecycleHooks.readPipe(launchedProcess));
276-
progress.cleanupWhenAborted(() => transport.close());
277-
return { browserProcess, artifactsDir: prepared.artifactsDir, userDataDir: prepared.userDataDir, transport };
267+
try {
268+
const { wsEndpoint } = await progress.race([
269+
this.waitForReadyState(options, browserLogsCollector),
270+
exitPromise.then(() => ({ wsEndpoint: undefined })),
271+
]);
272+
if (options.cdpPort !== undefined || !this.supportsPipeTransport())
273+
transport = await WebSocketTransport.connect(progress, wsEndpoint!);
274+
else
275+
transport = new PipeTransport(processLifecycleHooks.writePipe(launchedProcess), processLifecycleHooks.readPipe(launchedProcess));
276+
return { browserProcess, artifactsDir: prepared.artifactsDir, userDataDir: prepared.userDataDir, transport };
277+
} catch (error) {
278+
transport?.close();
279+
await closeOrKill(DEFAULT_PLAYWRIGHT_TIMEOUT).catch(() => {});
280+
throw error;
281+
}
278282
}
279283

280284
async _createArtifactDirs(options: types.LaunchOptions): Promise<void> {

tests/installation/playwright-cli-install-should-work.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ test('install command should work', async ({ exec, checkInstalledSoftwareOnDisk
6363

6464
test('install command should work with proxy', { annotation: { type: 'issue', description: 'https://github.com/microsoft/playwright/issues/36650' } }, async ({ exec, checkInstalledSoftwareOnDisk }) => {
6565
await exec('npm i playwright');
66-
const proxy = await TestProxy.create(8947 + test.info().workerIndex * 4);
66+
const proxy = await TestProxy.create(8947 + test.info().workerIndex * 4, 'localhost');
6767
proxy.forwardTo(443, { preserveHostname: true });
6868
await test.step('playwright install chromium', async () => {
6969
const result = await exec('npx playwright install chromium', {

0 commit comments

Comments
 (0)