[firefox-devtools-mcp] Tools silently run in another tab when the selected tab was closed
Categories
(Developer Infrastructure :: Firefox MCP, defect, P3)
Tracking
(Not tracked)
People
(Reporter: jdescottes, Assigned: bugzilla)
References
(Depends on 2 open bugs)
Details
(Whiteboard: [webdriver:m22] [webdriver:external])
Attachments
(1 external file)
If the tab the agent works in gets closed, the next tool call runs in another tab without any warning.
FirefoxCore.ensureConnected runs before every tool. When the current window handle is gone, it switches to the first handle (with focus, so that tab becomes active in the browser) and the tool runs there. If no tab is left, it opens a new one. closeTab also jumps to the first remaining tab.
The agent does not know that the page changed, and the user sees their first tab become active.
Expected: the next tool call fails with a clear error saying that the selected page was closed. Nothing should run in another tab, and no tab should be focused.
Bug 2081599 would report the page change, but the tool would still run in the wrong tab.
Comment 1•1 month ago
|
||
The severity field is not set for this bug.
:jdescottes, could you have a look please?
For more information, please visit BugBot documentation.
Comment 2•1 month ago
|
||
(via GitHub webhook, authenticated as firefox-devtools-mcp@bots.tld)
I put up a patch for this: https://github.com/mozilla/firefox-devtools-mcp/pull/217. It is stacked on the draft PR #214, which it needs so that new_page still works once the selected tab is gone.
When the selected tab is gone, ensureConnected() no longer switches to another tab. No page is selected, page tools fail with "No page is selected: the selected page was closed. Use list_pages, then select_page or new_page.", and list_pages reports "selected: none". close_page now closes with browsingContext.close, keeps the selection when another tab is closed, and returns to the previously selected tab when the selected one is closed.
A tab that an extension reopens with a new handle (Multi-Account Containers does this) is treated as closed too; following it automatically is left for bug 2081622.
| Reporter | ||
Comment 4•1 month ago
|
||
Thanks for the PR! As commented on GitHub I would really prefer to wait until BiDi migration is completed before we take this, but I'm assigning this to you in the meantime. The migration is our main priority, I'm hoping we can get it done before the end of the month.
Comment 5•27 days ago
|
||
The severity field is not set for this bug.
:jdescottes, could you have a look please?
For more information, please visit BugBot documentation.
| Reporter | ||
Updated•7 days ago
|
Description
•