[firefox-mcp] new_page fails after select_privileged_context
Categories
(Developer Infrastructure :: Firefox MCP, defect, P3)
Tracking
(Not tracked)
People
(Reporter: jdescottes, Assigned: jdescottes)
References
(Blocks 1 open bug)
Details
Attachments
(1 external file)
In the Mozilla-internal package, with MOZ_REMOTE_ALLOW_SYSTEM_ACCESS=1:
navigate_pageto any pagelist_privileged_contexts, thenselect_privileged_contextwith thechrome://browser/content/browser.xhtmlcontextselect_pagewithpageIdx: 0(works)new_pagewith any URL
Result: new_page fails with BiDi error: "unknown error": TypeError: can't access property "browsingContext", webProgress is null. The new tab stays on about:blank, and the next evaluate_script runs in chrome://browser/content/browser.xhtml instead of a page.
Cause: select_privileged_context calls driver.setContext('chrome'), and nothing switches back to content:
https://github.com/mozilla/firefox-mcp/blob/main/src/tools/privileged-context.ts#L154-L165
new_page still uses WebDriver Classic to open the tab: switchTo().newWindow('tab'), then getWindowHandle() (src/firefox/pages.ts). In chrome scope, getWindowHandle() returns the chrome window, so the server selects it and navigates it with BiDi.
Confirmed locally: with the setContext('chrome') call removed, the same steps work. new_page opens and selects the new tab, and select_page and close_page still work.
The call is a leftover from before the WebDriver BiDi migration, when privileged scripts ran through Classic executeScript. No tool needs the Classic chrome context anymore: evaluate_privileged_script sends BiDi script.callFunction with an explicit target, and the prefs tools evaluate in the chrome context with BiDi.
Suggested fix:
- Remove the
setContext('chrome')call, and probably the ClassicswitchTo().window()call in the same handler. KeepsetCurrentContextId(). - Add an MCP harness test:
select_privileged_context, thennew_page, thenevaluate_scriptreturns the page URL.
| Assignee | ||
Updated•2 days ago
|
| Assignee | ||
Updated•2 days ago
|
Comment 1•2 days ago
|
||
(via GitHub webhook, authenticated as firefox-devtools-mcp@bots.tld)
| Assignee | ||
Updated•1 day ago
|
Description
•