Skip to content

Bug 2080970 - Migrate dialog tools to BiDi - #234

Merged
hbenl merged 3 commits into
mozilla:mainfrom
hbenl:bug2080970
Nov 4, 2026
Merged

hbenl merged 3 commits into
mozilla:mainfrom
hbenl:bug2080970

Conversation

@hbenl

@hbenl hbenl commented Nov 3, 2026

Copy link
Copy Markdown
Collaborator

This PR also adds mcpTest which reduces the boilerplate in MCP tests and includes the fix for Bug 2081620 from #211 (with the integration tests migrated to the MCP test harness).

@juliandescottes juliandescottes left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks Holger, mostly one question regarding the switch to "ignore" (needed, but maybe too soon?) and a regression with prompt default values.

Comment thread src/firefox/pages.ts
context: contextId,
accept: true,
userText: promptText,
});

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This will cause a regression in one edge case, when prompt is called with a default value, eg prompt("favorite color", "pink"). Previously the default value would be used if promptText was undefined, but here we will default to empty string.

We can workaround by listening to userPromptOpened and storing the defaultValue, but that sounds quite hacky.

To be honest I think this is rather a BiDi spec issue, because there is no easy way to use the default value of a prompt, but maybe we should still work around this here.

Or we can also wait and handle that when we fix Bug 2081600 - [firefox-devtools-mcp] Report open alert/confirm/prompt dialogs and the tools that handle them, which will require to listen to this event anyway.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Let's handle this together with 2081600.

Comment thread src/firefox/core.ts Outdated
if (this.options.acceptInsecureCerts) {
caps.set('acceptInsecureCerts', true);
}
caps.setAlertBehavior(UserPromptHandler.IGNORE);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

In practice, can agents react to dialogs at the moment? We are not notifying them about it (this is Bug 2081600 - [firefox-devtools-mcp] Report open alert/confirm/prompt dialogs and the tools that handle them) so I feel like they might be stuck whenever a dialog shows up?

Dismissing all dialogs is definitely bad, but it is the current behavior. I feel like we should switch to "ignore" only when we implement 2081600? What do you think? Unless you plan to tackle 2081600 right after, in which case I'm fine landing this as is.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

OK, let's defer the switch until 2081600 is fixed. I've taken that part out of the PR.

@juliandescottes juliandescottes left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for the update Holger, works for me!
One nit about the docs, but this looks ready to land.

Comment thread tests/helpers/mcp.ts
};
}

export const mcpTest = test

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Fixture is really nice, we don't have that many mcp/ tests, but that looks a lot better.

Should we update docs/testing.md to mention this instead of startMcpServer?

@hbenl
hbenl merged commit a739850 into mozilla:main Nov 4, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

run-integration Trigger integration tests for a PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants