Skip to content

feat(webkit): allow running WebKit via WSL on Windows #36358

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

mxschmitt
Copy link
Member

No description provided.

@mxschmitt mxschmitt force-pushed the webkit-via-wsl-experiment branch from 10a64dd to 34667d2 Compare June 19, 2025 12:30

This comment has been minimized.

Copy link
Contributor

@agg23 agg23 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is very clean. I like it.

socket.on('error', reject);
});

const [executable, ...args] = process.argv.slice(2);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even though this is run by us, this should have proper error handling.

env: {
...this.amendEnvironment(env, userDataDir, executable, browserArguments, options.channel),
"WSLENV": "SOCKET_ADDRESS",
'SOCKET_ADDRESS': (transportServer?.address() as any)?.port?.toString() ?? '',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is our goal here if we don't have a transport?

override amendEnvironment(env: Env, userDataDir: string, executable: string, browserArguments: string[], channel?: string): Env {
return {
...env,
// CURL_COOKIE_JAR_PATH: path.join(channel === 'webkit-wsl' ? translatePathToWSL(userDataDir) : userDataDir, 'cookiejar.db'),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if condition.

}

export type LaunchLifecycleHooks = {
preLaunch(): Promise<void>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be an abstract method on BrowserType.

}

export type LaunchLifecycleHooks = {
preLaunch(): Promise<void>;
onExit(): Promise<void>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably an abstract method as well.

readPipe(): NodeJS.ReadableStream;
writePipe(): NodeJS.WritableStream;
rewriteArgs(args: string[]): string[];
rewriteExecutable(): string;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An abstract method.

Comment on lines 352 to 353
readPipe(): NodeJS.ReadableStream;
writePipe(): NodeJS.WritableStream;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For these, perhaps we can do createTransport() that will combine these pipes and waitForReadyState() together.

Comment on lines 133 to 147
rewriteExecutable: () => 'wsl',
rewriteArgs: (args: string[]) => {
const executablePath = registry.findExecutable('webkit-wsl')!.executablePathOrDie('node');
return [
'-d',
'playwright',
'--cd',
'/home/pwuser',
'/home/pwuser/node/bin/node',
'/home/pwuser/webkit-wsl-pipe-wrapper.mjs',
executablePath,
...args,
];
},
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we replace this with something similar to pw_run.sh?

@mxschmitt mxschmitt force-pushed the webkit-via-wsl-experiment branch from 71966c1 to ba2acea Compare July 3, 2025 14:18

This comment has been minimized.

Copy link
Contributor

github-actions bot commented Jul 4, 2025

Test results for "tests 1"

8 failed
❌ [webkit-library] › library/browsercontext-network-event.spec.ts:107:3 › should not fire events for favicon or favicon redirects @webkit-wsl-headed
❌ [webkit-library] › library/defaultbrowsercontext-2.spec.ts:112:3 › should restore state from userDataDir @webkit-wsl-headed
❌ [webkit-library] › library/favicon.spec.ts:20:3 › should load svg favicon with prefer-color-scheme @webkit-wsl-headed
❌ [webkit-library] › library/inspector/cli-codegen-1.spec.ts:97:7 › cli codegen record › should click twice @webkit-wsl-headed
❌ [webkit-library] › library/inspector/cli-codegen-1.spec.ts:762:7 › cli codegen perform › should await popup @webkit-wsl-headed
❌ [webkit-library] › library/inspector/cli-codegen-2.spec.ts:315:7 › cli codegen perform › should record open in a new tab with url @webkit-wsl-headed
❌ [webkit-library] › library/video.spec.ts:759:5 › screencast › should capture full viewport on hidpi @webkit-wsl-headed
❌ [webkit-page] › page/page-screenshot.spec.ts:283:5 › page screenshot › should work for canvas @webkit-wsl-headed

18 flaky ⚠️ [webkit-library] › library/browsercontext-basic.spec.ts:72:3 › window.open should use parent tab context @webkit-wsl-headed
⚠️ [webkit-library] › library/inspector/cli-codegen-1.spec.ts:123:7 › cli codegen record › should type after clicking twice @webkit-wsl-headed
⚠️ [webkit-library] › library/inspector/cli-codegen-1.spec.ts:152:7 › cli codegen record › should ignore programmatic events @webkit-wsl-headed
⚠️ [webkit-library] › library/inspector/cli-codegen-1.spec.ts:596:7 › cli codegen record › should check a radio button @webkit-wsl-headed
⚠️ [webkit-library] › library/inspector/cli-codegen-1.spec.ts:56:7 › cli codegen perform › should double click @webkit-wsl-headed
⚠️ [webkit-library] › library/inspector/cli-codegen-1.spec.ts:123:7 › cli codegen perform › should type after clicking twice @webkit-wsl-headed
⚠️ [webkit-library] › library/inspector/cli-codegen-1.spec.ts:202:7 › cli codegen perform › should make a positioned click on a canvas @webkit-wsl-headed
⚠️ [webkit-library] › library/inspector/cli-codegen-3.spec.ts:223:7 › cli codegen perform › should generate frame locators (4) @webkit-wsl-headed
⚠️ [webkit-library] › library/inspector/cli-codegen-3.spec.ts:742:7 › cli codegen perform › should assert value @webkit-wsl-headed
⚠️ [webkit-library] › library/inspector/cli-codegen-aria.spec.ts:76:7 › should update aria snapshot highlight @webkit-wsl-headed
⚠️ [webkit-library] › library/inspector/cli-codegen-pick-locator.spec.ts:35:7 › should update locator highlight @webkit-wsl-headed
⚠️ [webkit-library] › library/unroute-behavior.spec.ts:262:3 › route.continue should not throw if page has been closed @webkit-wsl-headed
⚠️ [webkit-page] › page/eval-on-selector.spec.ts:147:3 › should work with spaces in css attributes @webkit-wsl-headed
⚠️ [webkit-page] › page/expect-boolean.spec.ts:508:7 › toBeOK fail with invalid argument @webkit-wsl-headed
⚠️ [webkit-page] › page/page-aria-snapshot.spec.ts:253:3 › should include new line for block pseudo @webkit-wsl-headed
⚠️ [webkit-page] › page/page-click.spec.ts:919:3 › should not hang when frame is detached @webkit-wsl-headed
⚠️ [webkit-page] › page/page-goto.spec.ts:49:3 › should use http for no protocol @webkit-wsl-headed
⚠️ [webkit-page] › page/selectors-css.spec.ts:450:3 › should absolutize relative selectors @webkit-wsl-headed

3753 passed, 430 skipped
✔️✔️✔️

Merge workflow run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants