Open Bug 1963810 Opened 21 days ago Updated 15 days ago

Should widget.macos.native-context-menus default to false when running with --headless (MOZ_HEADLESS=1)

Categories

(Core :: Widget: Cocoa, defect, P3)

defect

Tracking

()

People

(Reporter: robwu, Unassigned, NeedInfo)

Details

The expectation when tests are running in headless mode is that there is no UI and such that could interfere.

When a test opens a context menu on macOS, a native context menu however appears on the screen.

I currently pass --setpref=widget.macos.native-context-menus=false to ./mach test to get the expected behavior, and wonder whether this should be the expected behavior by default.

Do you mean the default for tests? Or for regular users as well? If the latter, the answer is a confident no since we put a lot of effort into moving to native context menus (see bug 1700679 and related).

Flags: needinfo?(rob)

Not the default for all tests, just when --headless or MOZ_HEADLESS=1 is used. In CI, there are separate jobs for both of them.

An example of documentation for headless mode is at https://firefox-source-docs.mozilla.org/remote/Testing.html#browser-chrome-mochitests

The purpose of headless mode is that no UI is visible, and popping up context menus on the screen goes against it.

An example of a scenario is, as a Firefox developer I want to run unit tests in the background while editing source code. If a context menu pops up, it takes away focus from my editor, which defeats the point of running with --headless.

If you want to try it out locally, here is an example:

./mach test --headless browser/components/extensions/test/browser/browser_ext_menus_activeTab.js

If you run it, you will briefly see a native context menu flickering on the screen. That UI is not shown when run with:

./mach test --headless browser/components/extensions/test/browser/browser_ext_menus_activeTab.js --setpref=widget.macos.native-context-menus=false

Flags: needinfo?(rob)

Thanks! I think the one question that we should answer on the widget side is whether or not we would like to add a check before displaying native context menus to see if we're running in headless mode, and suppress them if that's the case. If not, we could move this bug to the Testing product and add this flag by default for headless tests. Markus, do you have any thoughts here?

Flags: needinfo?(mstange.moz)
Severity: -- → S3
Priority: -- → P3
You need to log in before you can comment on or make changes to this bug.