Skip to content

chore(chromium): pass auto attach filter for iframes #36784

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

Merged
merged 2 commits into from
Jul 31, 2025

Conversation

yury-s
Copy link
Member

@yury-s yury-s commented Jul 24, 2025

The filtering has been available in Chromium since https://source.chromium.org/chromium/chromium/src/+/c50f73d494d21482bf2cbefa430ce75fc2ad1963. Pass the filter to avoid having to send Target.detachFromTarget which is problematic if we connect to a page via debugger extension API which will throw on attempt to detach e.g. from a service worker.

@yury-s yury-s requested a review from dgozman July 24, 2025 20:13

This comment has been minimized.

Copy link
Contributor

Test results for "tests 1"

8 flaky ⚠️ [firefox-library] › library/inspector/cli-codegen-1.spec.ts:1079:7 › cli codegen › should not throw csp directive violation errors @firefox-ubuntu-22.04-node18
⚠️ [firefox-page] › page/page-emulate-media.spec.ts:144:3 › should keep reduced motion and color emulation after reload @firefox-ubuntu-22.04-node18
⚠️ [playwright-test] › ui-mode-test-watch.spec.ts:145:5 › should watch all @ubuntu-latest-node18-1
⚠️ [playwright-test] › ui-mode-test-watch.spec.ts:145:5 › should watch all @ubuntu-latest-node20-1
⚠️ [playwright-test] › ui-mode-test-watch.spec.ts:145:5 › should watch all @ubuntu-latest-node22-1
⚠️ [playwright-test] › ui-mode-test-watch.spec.ts:145:5 › should watch all @ubuntu-latest-node24-1
⚠️ [webkit-page] › page/page-screenshot.spec.ts:345:5 › page screenshot › should work while navigating @webkit-ubuntu-22.04-node18
⚠️ [playwright-test] › ui-mode-test-watch.spec.ts:145:5 › should watch all @windows-latest-node18-1

46499 passed, 816 skipped
✔️✔️✔️

Merge workflow run.

filter: [
{ type: 'iframe' },
{ type: 'worker' },
{ type: 'service_worker', exclude: !process.env.PW_EXPERIMENTAL_SERVICE_WORKER_NETWORK_EVENTS }
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we never want service workers under a page, we get them through setAutoAttach on the browser target.

Copy link
Member Author

Choose a reason for hiding this comment

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

The service worker tests fail without this setting, so apparently we rely on the short period when the sw target is enabled.

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 we don't auto-attach to sw in the page, there Network.requestWillBeSent event is missing for the service worker main resource. Notably it is missing in the top level session, not in the page session.

{"method":"Network.requestWillBeSent","params":{"requestId":"B66BDCC8DEB22DC41E120AA63F9610D6","loaderId":"","documentURL":"http://localhost:8907/serviceworkers/fetch/sw.js","request":{"url":"http://localhost:8907/serviceworkers/fetch/sw.js","method":"GET","headers":{"Accept":"*/*","Service-Worker":"script"},"initialPriority":"VeryLow","referrerPolicy":"strict-origin-when-cross-origin"},"timestamp":787594.978643,"wallTime":1753466030.385725,"initiator":{"type":"other","url":"http://localhost:8907/serviceworkers/fetch/sw.html"},"redirectHasExtraInfo":false,"type":"Script","hasUserGesture":false},"sessionId":"45C9C821DA0B480516D191C866250105"}

flatten: true,
filter: [
{ type: 'worker' },
{ type: 'service_worker', exclude: !process.env.PW_EXPERIMENTAL_SERVICE_WORKER_NETWORK_EVENTS }
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here, we only care about workers.

@yury-s yury-s merged commit e95318a into microsoft:main Jul 31, 2025
32 checks passed
@yury-s yury-s deleted the cr-target-type-filter branch July 31, 2025 00:54
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.

2 participants