Bug 1355147 - Change Firefox to a background application when headless. r=mstange

To avoid headless Firefox creating an icon in the dock and taking focus away
from the terminal, it is now changed to a background app on startup.

MozReview-Commit-ID: DyKk0Zxq0Uq
This commit is contained in:
Brendan Dahl 2017-07-06 13:46:33 -07:00
Родитель 465c6d492e
Коммит c518d17f15
1 изменённых файлов: 12 добавлений и 0 удалений

Просмотреть файл

@ -3178,6 +3178,18 @@ XREMain::XRE_mainInit(bool* aExitFlag)
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
// transition Firefox to a background application.
ProcessSerialNumber psn = { 0, kCurrentProcess };
OSStatus transformStatus = TransformProcessType(&psn, kProcessTransformToBackgroundApplication);
if (transformStatus != noErr) {
NS_ERROR("Failed to make process a background application.");
return 1;
}
#endif
}
nsresult rv;