Skip to content

refactor: move waitForEventsAfterAction to McpPage#1780

Merged
OrKoN merged 12 commits intoChromeDevTools:mainfrom
bcfmtolgahan:feat/waitforeventsafteraction-to-mcppage
Apr 1, 2026
Merged

refactor: move waitForEventsAfterAction to McpPage#1780
OrKoN merged 12 commits intoChromeDevTools:mainfrom
bcfmtolgahan:feat/waitforeventsafteraction-to-mcppage

Conversation

@bcfmtolgahan
Copy link
Copy Markdown
Contributor

Splits out from #1244 per review feedback.

'waitForEventsAfterAction' previously lived in 'McpContext' and always used the selected page's CPU/network throttling settings. With pageId routing, a tool can target a different page than the selected one, meaning wrong throttling multipliers were applied.

Moving the method to 'McpPage' fixes this: each tool now calls 'page.waitForEventsAfterAction(...)' and gets the correct page's emulation settings.

'getNetworkMultiplierFromString' is extracted to 'WaitForHelper.ts' to avoid a circular import (McpContext → McpPage already exists).

Unblocks #1777.

bcfmtolgahan and others added 6 commits April 1, 2026 10:47
Service worker evaluation should not trigger DOM stability wait since
service workers don't interact with the page DOM. Move the
waitForEventsAfterAction call to the normal page evaluation path only,
removing the page parameter from performEvaluation.
…erAction

Service worker evaluation was incorrectly skipping waitForEventsAfterAction
entirely. It should use the selected page's waitForEventsAfterAction helper
so that throttling settings are respected, while still being called via the
page-based McpPage method rather than the removed McpContext method.
executeInPageTool is a definePageTool handler and should use request.page
to target the correct page, not context.getSelectedMcpPage() which would
apply the wrong throttling settings in multi-page scenarios.
- Remove unused context parameter from navigatePage handler
- Use import type for PredefinedNetworkConditions in WaitForHelper
Copy link
Copy Markdown
Collaborator

@OrKoN OrKoN left a comment

Choose a reason for hiding this comment

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

Thanks!

@OrKoN OrKoN enabled auto-merge April 1, 2026 11:55
@OrKoN OrKoN added this pull request to the merge queue Apr 1, 2026
Merged via the queue into ChromeDevTools:main with commit c7c8f50 Apr 1, 2026
17 checks passed
wolfib pushed a commit that referenced this pull request Apr 1, 2026
Splits out from #1244 per review feedback.

'waitForEventsAfterAction' previously lived in 'McpContext' and always
used the selected page's CPU/network throttling settings. With pageId
routing, a tool can target a different page than the selected one,
meaning wrong throttling multipliers were applied.

Moving the method to 'McpPage' fixes this: each tool now calls
'page.waitForEventsAfterAction(...)' and gets the correct page's
emulation settings.

'getNetworkMultiplierFromString' is extracted to 'WaitForHelper.ts' to
avoid a circular import (McpContext → McpPage already exists).

Unblocks #1777.
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