Skip to content

feat(webview): support setUserAgent#41390

Merged
dcrousso merged 1 commit into
microsoft:mainfrom
dcrousso:fix-WKWebView-setUserAgent
Jun 22, 2026
Merged

feat(webview): support setUserAgent#41390
dcrousso merged 1 commit into
microsoft:mainfrom
dcrousso:fix-WKWebView-setUserAgent

Conversation

@dcrousso

Copy link
Copy Markdown
Contributor

No description provided.

@dcrousso dcrousso requested review from pavelfeldman and yury-s June 19, 2026 22:03
@dcrousso dcrousso added the CQ1 label Jun 19, 2026

@yury-s yury-s left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

any new passing tests?


const contextOptions = this._browserContext._options;
if (contextOptions.userAgent)
promises.push(this.updateUserAgent());

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

revert?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

this is a correctness/optimization fix

updateUserAgent iterates all sessions/targets, whereas this method is intended to only modify a specific session/target

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

Copy link
Copy Markdown
Contributor

Test results for "tests 2"

2 fatal errors, not part of any test
10 failed
❌ [firefox-page] › page/workers.spec.ts:40 › should emit created and destroyed events @tracing-firefox
❌ [firefox-library] › library/defaultbrowsercontext-2.spec.ts:139 › should create userDataDir if it does not exist @firefox-macos-15-large
❌ [firefox-library] › library/defaultbrowsercontext-2.spec.ts:180 › should have passed URL when launching with ignoreDefaultArgs: true @firefox-macos-15-large
❌ [firefox-library] › library/defaultbrowsercontext-2.spec.ts:209 › should fire close event for a persistent context @firefox-macos-15-large
❌ [firefox-library] › library/inspector/cli-codegen-java.spec.ts:125 › should print a valid basic program in junit @firefox-macos-15-large
❌ [firefox-library] › library/inspector/cli-codegen-python-async.spec.ts:80 › should save the codegen output to a file if specified @firefox-macos-15-large
❌ [firefox-library] › library/inspector/cli-codegen-python.spec.ts:76 › should save the codegen output to a file if specified @firefox-macos-15-large
❌ [firefox-page] › page/workers.spec.ts:40 › should emit created and destroyed events @firefox-macos-15-large
❌ [firefox-page] › page/workers.spec.ts:40 › should emit created and destroyed events @firefox-windows-latest
❌ [firefox-page] › page/workers.spec.ts:40 › should emit created and destroyed events @firefox-macos-15-xlarge

32 flaky ⚠️ [chromium-library] › library/video.spec.ts:456 › screencast › should be 800x600 with null viewport `@msedge-dev-windows-latest`
⚠️ [chromium-library] › library/video.spec.ts:456 › screencast › should be 800x600 with null viewport `@chrome-ubuntu-22.04`
⚠️ [chromium-library] › library/video.spec.ts:456 › screencast › should be 800x600 with null viewport `@msedge-windows-latest`
⚠️ [chromium-library] › library/video.spec.ts:717 › screencast › should work with video+trace `@chromium-windows-latest`
⚠️ [chromium-library] › library/browsertype-connect.spec.ts:117 › launchServer › should print HTTP error `@chromium-macos-15-large`
⚠️ [chromium-library] › library/heap.spec.ts:203 › cycle handles `@chromium-macos-15-large`
⚠️ [chromium-library] › library/inspector/cli-codegen-2.spec.ts:526 › cli codegen › should generate getByTestId for any of the configured testIdAttributes `@chromium-macos-15-large`
⚠️ [chromium-library] › library/video.spec.ts:645 › screencast › should capture full viewport `@chromium-macos-15-xlarge`
⚠️ [chromium-library] › library/video.spec.ts:680 › screencast › should capture full viewport on hidpi `@chromium-macos-15-xlarge`
⚠️ [chromium-library] › library/video.spec.ts:456 › screencast › should be 800x600 with null viewport `@chrome-windows-latest`
⚠️ [chromium-library] › library/chromium/chromium.spec.ts:177 › serviceWorker(), and fromServiceWorker() work `@chrome-beta-ubuntu-22.04`
⚠️ [chromium-library] › library/video.spec.ts:456 › screencast › should be 800x600 with null viewport `@chrome-beta-ubuntu-22.04`
⚠️ [chromium-library] › library/browsertype-connect.spec.ts:141 › launchServer › should be able to reconnect to a browser `@chrome-macos-latest`
⚠️ [chromium-library] › library/browsertype-connect.spec.ts:189 › launchServer › should ignore page.pause when headed `@chrome-macos-latest`
⚠️ [chromium-library] › library/browsertype-connect.spec.ts:386 › launchServer › should reject waitForSelector when browser closes `@chrome-macos-latest`
⚠️ [chromium-library] › library/browsertype-connect.spec.ts:431 › launchServer › should reject waitForEvent before browser.close finishes `@chrome-macos-latest`
⚠️ [chromium-library] › library/video.spec.ts:456 › screencast › should be 800x600 with null viewport `@chrome-macos-latest`
⚠️ [chromium-library] › library/chromium/chromium.spec.ts:434 › should produce network events, routing, and annotations for Service Worker (advanced) `@driver`
⚠️ [firefox-library] › library/defaultbrowsercontext-2.spec.ts:229 › should respect selectors `@firefox-macos-15-large`
⚠️ [firefox-library] › library/inspector/cli-codegen-csharp.spec.ts:231 › should work with --save-har and --save-har-glob in nunit `@firefox-macos-15-large`
⚠️ [firefox-library] › library/inspector/cli-codegen-csharp.spec.ts:202 › should not print context options method override in mstest if no options were passed `@firefox-macos-15-large`
⚠️ [firefox-library] › library/inspector/cli-codegen-csharp.spec.ts:208 › should print context options method override in mstest if options were passed `@firefox-macos-15-large`
⚠️ [firefox-library] › library/inspector/cli-codegen-python.spec.ts:36 › should print the correct context options for custom settings `@firefox-macos-15-large`
⚠️ [firefox-library] › library/inspector/cli-codegen-test.spec.ts:20 › should print the correct imports and context options `@firefox-macos-15-large`
⚠️ [firefox-library] › library/proxy.spec.ts:316 › should use socks proxy in second page `@firefox-macos-15-large`
⚠️ [firefox-library] › library/screenshot.spec.ts:213 › page screenshot › should not hang when event loop is blocked `@firefox-macos-15-xlarge`
⚠️ [webkit-library] › library/defaultbrowsercontext-2.spec.ts:65 › should support locale option `@tracing-webkit`
⚠️ [webkit-library] › library/proxy.spec.ts:125 › should allow bypassing localhost requests `@tracing-webkit`
⚠️ [webkit-page] › page/page-set-input-files.spec.ts:295 › should detect mime type `@tracing-webkit`
⚠️ [webkit-library] › library/inspector/cli-codegen-python-async.spec.ts:24 › should print the correct imports and context options `@webkit-windows-latest`
⚠️ [android-page] › page/page-autowaiting-no-hang.spec.ts:93 › clicking in the middle of navigation that commits
⚠️ [android-page] › page/page-request-fulfill.spec.ts:81 › should fulfill with unuassigned status codes

104503 passed, 4403 skipped


Merge workflow run.

@dcrousso dcrousso force-pushed the fix-WKWebView-setUserAgent branch from b96a2f6 to cd0cf81 Compare June 22, 2026 15:27
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@dcrousso dcrousso force-pushed the fix-WKWebView-setUserAgent branch from cd0cf81 to f5e611c Compare June 22, 2026 17:56
@github-actions

Copy link
Copy Markdown
Contributor

Test results for "MCP"

7354 passed, 1122 skipped


Merge workflow run.

@github-actions

Copy link
Copy Markdown
Contributor

Test results for "tests 1"

2 failed
❌ [firefox-page] › page/workers.spec.ts:40 › should emit created and destroyed events @firefox-ubuntu-22.04-node20
❌ [playwright-test] › playwright.artifacts.spec.ts:170 › should work with screenshot: only-on-failure @macos-latest-node22

2 flaky ⚠️ [firefox-page] › page/page-emulate-media.spec.ts:144 › should keep reduced motion and color emulation after reload `@firefox-ubuntu-22.04-node20`
⚠️ [playwright-test] › ui-mode-test-update.spec.ts:202 › should update test locations `@ubuntu-latest-node26`

48914 passed, 1142 skipped


Merge workflow run.

@dcrousso

Copy link
Copy Markdown
Contributor Author

@yury-s this doesn't seem to cause any previously failing tests to now pass :(

@dcrousso dcrousso merged commit 9a9d8fc into microsoft:main Jun 22, 2026
50 of 52 checks passed
@dcrousso dcrousso deleted the fix-WKWebView-setUserAgent branch June 22, 2026 19:12
@dcrousso

Copy link
Copy Markdown
Contributor Author

@yury-s i found one test that needed a small tweak in order to pass #41415

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants