Skip to content

feat(webview): support page.emulateMedia#41386

Open
dcrousso wants to merge 1 commit into
microsoft:mainfrom
dcrousso:fix-WKWebView-emulateMedia
Open

feat(webview): support page.emulateMedia#41386
dcrousso wants to merge 1 commit into
microsoft:mainfrom
dcrousso:fix-WKWebView-emulateMedia

Conversation

@dcrousso

Copy link
Copy Markdown
Contributor

No description provided.

@dcrousso dcrousso requested review from pavelfeldman and yury-s June 19, 2026 20:30
const contextOptions = this._browserContext._options;
if (contextOptions.userAgent)
promises.push(this.updateUserAgent());
const emulatedMedia = this._page.emulatedMedia();

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.

Why did this part change? I assume it's redundant with the updateEmulateMedia removed below, if so, can we just drop this part or the order matters here?

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.

yeah this was just something i noticed when looking at this file for reference

i thought it looked cleaner to use updateEmulateMedia (which btw does the exact same thing) and to prefer the earlier callsite since that can have more of an effect (e.g. if the developer checks media state in their bootstrap script)

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.

actually there is a difference. this is just dealing with a specific session whereas updateEmulateMedia deals with all of them

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@dcrousso dcrousso added the CQ1 label Jun 19, 2026
@dcrousso dcrousso force-pushed the fix-WKWebView-emulateMedia branch from b5f33ef to df2ed7a Compare June 19, 2026 21:44
@dcrousso dcrousso force-pushed the fix-WKWebView-emulateMedia branch from df2ed7a to e8b722f Compare June 19, 2026 22:02
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@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 2"

5 failed
❌ [firefox-page] › page/workers.spec.ts:40 › should emit created and destroyed events @tracing-firefox
❌ [firefox-library] › library/proxy.spec.ts:235 › should exclude patterns @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

33 flaky ⚠️ [chromium-library] › library/video.spec.ts:456 › screencast › should be 800x600 with null viewport `@msedge-dev-windows-latest`
⚠️ [chromium-library] › library/inspector/cli-codegen-pytest.spec.ts:60 › should work with --save-har `@chrome-ubuntu-22.04`
⚠️ [chromium-library] › library/popup.spec.ts:260 › should not throw when click closes popup `@chrome-ubuntu-22.04`
⚠️ [chromium-library] › library/video.spec.ts:456 › screencast › should be 800x600 with null viewport `@msedge-windows-latest`
⚠️ [chromium-page] › page/workers.spec.ts:63 › should have timestamp on worker console messages `@chromium-windows-latest`
⚠️ [chromium-library] › library/heap.spec.ts:203 › cycle handles `@chromium-macos-15-large`
⚠️ [chromium-library] › library/video.spec.ts:680 › screencast › should capture full viewport on hidpi `@chromium-macos-15-large`
⚠️ [chromium-page] › page/page-set-input-files.spec.ts:146 › should upload large file `@chromium-macos-15-large`
⚠️ [chromium-library] › library/browsertype-connect.spec.ts:189 › launchServer › should ignore page.pause when headed `@chromium-macos-14-xlarge`
⚠️ [chromium-library] › library/screenshot.spec.ts:213 › page screenshot › should not hang when event loop is blocked `@chromium-macos-14-xlarge`
⚠️ [chromium-library] › library/inspector/cli-codegen-2.spec.ts:105 › cli codegen › should upload a single file `@chromium-macos-15-xlarge`
⚠️ [chromium-library] › library/video.spec.ts:645 › screencast › should capture full viewport `@chromium-macos-15-xlarge`
⚠️ [chromium-library] › library/video.spec.ts:717 › screencast › should work with video+trace `@chromium-macos-15-xlarge`
⚠️ [chromium-library] › library/inspector/cli-codegen-3.spec.ts:224 › cli codegen › should generate frame locators (4) `@chrome-windows-latest`
⚠️ [chromium-library] › library/video.spec.ts:456 › screencast › should be 800x600 with null viewport `@chrome-windows-latest`
⚠️ [chromium-page] › page/workers.spec.ts:63 › should have timestamp on worker console messages `@chrome-windows-latest`
⚠️ [chromium-library] › library/chromium/chromium.spec.ts:434 › should produce network events, routing, and annotations for Service Worker (advanced) `@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:189 › launchServer › should ignore page.pause when headed `@chrome-macos-latest`
⚠️ [chromium-library] › library/browsertype-connect.spec.ts:374 › launchServer › should reject navigation when browser closes `@chrome-macos-latest`
⚠️ [chromium-library] › library/browsertype-connect.spec.ts:653 › launchServer › should be able to connect when the wsEndpoint is passed as an option `@chrome-macos-latest`
⚠️ [chromium-library] › library/browsertype-connect.spec.ts:686 › launchServer › should filter launch options `@chrome-macos-latest`
⚠️ [chromium-library] › library/chromium/chromium.spec.ts:177 › serviceWorker(), and fromServiceWorker() work `@chrome-macos-latest`
⚠️ [chromium-library] › library/chromium/chromium.spec.ts:434 › should produce network events, routing, and annotations for Service Worker (advanced) `@chrome-macos-latest`
⚠️ [chromium-library] › library/video.spec.ts:456 › screencast › should be 800x600 with null viewport `@chrome-macos-latest`
⚠️ [firefox-library] › library/defaultbrowsercontext-2.spec.ts:139 › should create userDataDir if it does not exist `@firefox-macos-15-large`
⚠️ [firefox-library] › library/screenshot.spec.ts:213 › page screenshot › should not hang when event loop is blocked `@firefox-macos-15-large`
⚠️ [firefox-page] › page/page-emulate-media.spec.ts:144 › should keep reduced motion and color emulation after reload `@firefox-macos-15-large`
⚠️ [firefox-library] › library/inspector/cli-codegen-3.spec.ts:224 › cli codegen › should generate frame locators (4) `@firefox-windows-latest`
⚠️ [firefox-library] › library/screenshot.spec.ts:213 › page screenshot › should not hang when event loop is blocked `@firefox-macos-15-xlarge`
⚠️ [webkit-library] › library/inspector/cli-codegen-3.spec.ts:224 › cli codegen › should generate frame locators (4) `@webkit-macos-15-large`
⚠️ [android-page] › page/page-autowaiting-no-hang.spec.ts:53 › calling window.open and window.close
⚠️ [android-page] › page/page-request-fulfill.spec.ts:81 › should fulfill with unuassigned status codes

104490 passed, 4400 skipped


Merge workflow run.

@github-actions

Copy link
Copy Markdown
Contributor

Test results for "tests 1"

1 failed
❌ [firefox-page] › page/workers.spec.ts:40 › should emit created and destroyed events @firefox-ubuntu-22.04-node20

6 flaky ⚠️ [chromium-library] › library/chromium/chromium.spec.ts:211 › should intercept service worker requests (main and within) `@chromium-ubuntu-22.04-arm-node20`
⚠️ [chromium-library] › library/video.spec.ts:717 › screencast › should work with video+trace `@chromium-ubuntu-22.04-arm-node20`
⚠️ [chromium-library] › library/popup.spec.ts:260 › should not throw when click closes popup `@chromium-ubuntu-22.04-node24`
⚠️ [chromium-library] › library/video.spec.ts:717 › screencast › should work with video+trace `@chromium-ubuntu-22.04-node24`
⚠️ [chromium-page] › page/page-request-continue.spec.ts:756 › propagate headers cross origin redirect after interception `@chromium-ubuntu-22.04-node20`
⚠️ [firefox-page] › page/page-emulate-media.spec.ts:144 › should keep reduced motion and color emulation after reload `@firefox-ubuntu-22.04-node20`

48905 passed, 1142 skipped


Merge workflow run.

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