Skip to content

fix(chromium): detach page-side service worker session without resuming it - #43566

Merged
Pavel Feldman (pavelfeldman) merged 1 commit into
microsoft:mainfrom
pavelfeldman:fix-43562
Oct 22, 2026
Merged

Pavel Feldman (pavelfeldman) merged 1 commit into
microsoft:mainfrom
pavelfeldman:fix-43562

Conversation

@pavelfeldman

Copy link
Copy Markdown
Member

Summary

  • When a page registers a new service worker, both the browser-level session and the page session auto-attach to it. The page session was detached with Runtime.runIfWaitingForDebugger followed by Target.detachFromTarget.
  • That resume races with the browser-level session's Network.enable. The worker could start loading its main script before Network was enabled on the browser-level session, so Chromium dropped the main script's Network.responseReceived, and request.response() never resolved.
  • The page-side service worker session is now detached without resuming. Detaching releases the main script fetch throttle on its own, and only the browser-level session resumes the worker, after its own Network.enable.

Fixes #43562

…ng it

The page session also auto-attaches to a new service worker. Resuming that
session before detaching races with the browser-level session's Network.enable,
and the main script's Network.responseReceived is lost. Detaching alone releases
the main script fetch throttle.

Fixes: microsoft#43562

@yury-s Yury Semikhatsky (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.

add a test

@github-actions

Copy link
Copy Markdown
Contributor

Test results for "MCP"

5189 passed, 614 skipped


Merge workflow run.

@github-actions

Copy link
Copy Markdown
Contributor

Test results for "tests 1"

1 flaky ⚠️ [chromium-library] › library/video.spec.ts:762 › screencast › VI-030 should work with video+trace `@chromium-playwright-x64-ubuntu24-64-core-node22`

23587 passed, 713 skipped


Merge workflow run.

@pavelfeldman

Copy link
Copy Markdown
Member Author

add a test

This is a fix to a flaky test.

@pavelfeldman
Pavel Feldman (pavelfeldman) merged commit ca7ca36 into microsoft:main Oct 22, 2026
26 checks passed
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.

[Bug]: request.response() never resolves for a service worker's own script when many contexts register service workers at once

2 participants