Skip to content

fix(extension): arm inactivity timers for all pending tabs#1443

Merged
yury-s merged 1 commit intomicrosoft:mainfrom
shuofengzhang:fix-extension-timeout-all-pending-tabs
Mar 13, 2026
Merged

fix(extension): arm inactivity timers for all pending tabs#1443
yury-s merged 1 commit intomicrosoft:mainfrom
shuofengzhang:fix-extension-timeout-all-pending-tabs

Conversation

@shuofengzhang
Copy link
Copy Markdown
Contributor

Summary

This patch fixes a control-flow bug in the extension background script where _onTabActivated would stop after scheduling a timeout for the first inactive pending tab.

With multiple entries in _pendingTabSelection, only one tab got timeout handling per activation event.

Changes

  • Remove the early return in TabShareExtension._onTabActivated so the loop evaluates all pending tabs.

Why

Without this, inactive pending tabs can remain pending indefinitely (unless another tab activation happens to process them later), which may leave stale relay connection state around longer than intended.

Validation

  • npm run lint --workspace @playwright/mcp-extension
  • npm run test --workspace @playwright/mcp-extension -- --list

Fixes #1442

When multiple selector tabs have pending relay connections, _onTabActivated returned after scheduling the first timeout. This prevented other inactive pending tabs from timing out and could leave stale relay connections alive indefinitely.
@dgozman dgozman requested a review from yury-s March 6, 2026 15:41
@yury-s yury-s merged commit 81f5084 into microsoft:main Mar 13, 2026
6 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.

Extension: inactivity timeout is only scheduled for the first pending tab

2 participants