Open Bug 2090154 Opened 15 days ago Updated 3 days ago

[firefox-devtools-mcp] beforeunload dialogs are disabled

Categories

(Developer Infrastructure :: Firefox MCP, defect)

defect

Tracking

(Not tracked)

People

(Reporter: hbenl, Unassigned)

References

(Depends on 1 open bug)

Details

When the MCP connects to a Firefox instance, beforeunload dialogs get disabled - tabs always close without prompting.
When I start Firefox manually with --marionette --remote-debugging-port, beforeunload dialogs work as expected but as soon as I connect the MCP to it, they are disabled (not only when using the close_page tool but also when closing manually). Once the MCP disconnects, they work again.

Flags: needinfo?(jdescottes)

This is most likely because (checking https://github.com/mozilla/firefox-devtools-mcp/pull/235), we are setting the capability as a string "ignore".
Which triggers the classic-only prompt handling which has no support for beforeUnload.

Instead of caps.setAlertBehavior(UserPromptHandler.IGNORE);, can you use caps.set('unhandledPromptBehavior', { default: 'ignore' });?
It should really handle all prompt types.

Flags: needinfo?(jdescottes) → needinfo?(hbenl)

Yes, that change enabled beforeunload dialogs, I've updated https://github.com/mozilla/firefox-devtools-mcp/pull/235.
But I still see some issues:

  • the (currently skipped) close_page test now fails because the accept_dialog tool hangs. In fact all tools seem to hang in ensureConnected() after that dialog opens, perhaps because it's using classic commands.
  • if I change new_page to navigate_page (and pageIdx: 1 to pageIdx: 0) in that test, it still fails because the beforeunload dialog isn't shown.
Flags: needinfo?(hbenl)

Thanks for checking, we discussed it a bit on Slack. Any leftover classic command will still fail if a prompt is open.
From this chat, we agreed to enable beforeunload dialogs after the migration from classic to bidi is completed.

Blocking this bug on the bidi migration meta.

You need to log in before you can comment on or make changes to this bug.