Closed Bug 1355147 Opened 8 years ago Closed 7 years ago

Support headless mode on MacOS

Categories

(Firefox :: Headless, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
Firefox 56
Tracking Status
firefox56 --- fixed

People

(Reporter: bdahl, Assigned: bdahl)

References

Details

Attachments

(6 files)

No description provided.
Blocks: 1355047
Blocks: 1359374
Component: General → Headless
Assignee: nobody → bdahl
As for patch "Bug 1355147 - Change Firefox to a background application when headless." There's one downside to going from foreground to background in that the terminal very quickly looses and regains focus while the Firefox is being launched headlessly. I alternatively tried making Firefox a background application by default and changing it to the foreground for non-headless. However, this causes Firefox to not be focused by default. I could also force focus while making it foreground, but I was starting to think making Firefox a background app by default sounds a bit scary. Myk and I talked about potentially making another exe/bundle so that could be used to launch in the background by default, but I was curious to see if you had any other thoughts on this?
Flags: needinfo?(mstange)
Another bundle sounds like the right choice to me. Then you won't have to modify anything at runtime and won't affect regular Firefox.
Flags: needinfo?(mstange)
(In reply to Markus Stange [:mstange] from comment #9) > Another bundle sounds like the right choice to me. Then you won't have to > modify anything at runtime and won't affect regular Firefox. Besides increasing Firefox's download size and Firefox bundle complexity (as the headless bundle would be contained within the Firefox bundle), this would make developers have to invoke a different executable to run Firefox headlessly on Mac. It's critical not to affect regular Firefox, but I'm leery of complicating the developer ergonomics of headless mode. We don't ship a separate executable for headless on Windows and Linux, nor does Chrome do so for headless on Mac (instead, it stays in the foreground). So I'm inclined to prefer the temporary focus change, since it means I can tell developers to invoke the Firefox executable with the --headless flag to enter headless mode on all three platforms.
I see. Have you tried if additionally calling [NSApp setActivationPolicy:NSApplicationActivationPolicyProhibited] avoids the focus change?
Comment on attachment 8885844 [details] Bug 1355147 - Add basic support for headless mode on macOS. https://reviewboard.mozilla.org/r/156618/#review162208
Attachment #8885844 - Flags: review?(jmuizelaar) → review+
Attachment #8885845 - Flags: review?(jmuizelaar) → review+
Attachment #8885849 - Flags: review?(jmuizelaar) → review+
Attachment #8885846 - Flags: review?(dburns) → review?(hskupin)
Attachment #8885848 - Flags: review?(dburns) → review?(hskupin)
Comment on attachment 8885848 [details] Bug 1355147 - Enable macOS headless marionette tests. https://reviewboard.mozilla.org/r/156626/#review164048 ::: taskcluster/ci/test/test-platforms.yml:198 (Diff revision 2) > > macosx64/debug: > build-platform: macosx64/debug > test-sets: > - macosx64-tests > + - headless We are supporting it now for all platforms, right? Can't we move those tests to `common-tests` now? Or don't we want to run it for nightly builds?
Attachment #8885848 - Flags: review?(hskupin) → review+
Comment on attachment 8885846 [details] Bug 1355147 - Fix test moving to negative coordinates in headless mac. https://reviewboard.mozilla.org/r/156622/#review164054
Attachment #8885846 - Flags: review?(hskupin) → review+
Comment on attachment 8885847 [details] Bug 1355147 - Change Firefox to a background application when headless. https://reviewboard.mozilla.org/r/156624/#review166898 ::: toolkit/xre/nsAppRunner.cpp:3178 (Diff revision 2) > Output(true, "Error: headless mode is not currently supported on this platform.\n"); > return 1; > #endif > + > +#ifdef XP_MACOSX > + // To avoid taking focus when running in headless mode immediately This needs to be indented two more spaces.
Attachment #8885847 - Flags: review?(mstange) → review+
Comment on attachment 8885846 [details] Bug 1355147 - Fix test moving to negative coordinates in headless mac. https://reviewboard.mozilla.org/r/156622/#review167606 Carrying r+ forward.
Attachment #8885846 - Flags: review+
Attachment #8885846 - Flags: review?(dburns)
Comment on attachment 8885849 [details] Bug 1355147 - Use headless clipboard on macOS. There were some mac clipboard test failures with the previous way of using a singleton for the clipboard. I've updated the clipboard creation to make it a class that can be an instance. I'll also change the other platforms to do this in another bug.
Attachment #8885849 - Flags: review+ → review?(jmuizelaar)
Comment on attachment 8885848 [details] Bug 1355147 - Enable macOS headless marionette tests. Carrying r+ forward from whimboo.
Attachment #8885848 - Flags: review?(dburns) → review+
Attachment #8885849 - Flags: review?(jmuizelaar) → review+
Pushed by bdahl@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/1a4b6ccab14b Add basic support for headless mode on macOS. r=jrmuizel https://hg.mozilla.org/integration/mozilla-inbound/rev/803e1b08f00f Expose IsHeadless on GfxInfo. r=jrmuizel https://hg.mozilla.org/integration/mozilla-inbound/rev/19854c39011d Fix test moving to negative coordinates in headless mac. r=whimboo https://hg.mozilla.org/integration/mozilla-inbound/rev/a9e070c60d4b Change Firefox to a background application when headless. r=mstange https://hg.mozilla.org/integration/mozilla-inbound/rev/c18686139dbd Enable macOS headless marionette tests. r=whimboo https://hg.mozilla.org/integration/mozilla-inbound/rev/156623409e44 Use headless clipboard on macOS. r=jrmuizel
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: