Bug 1620745 - Bring up fork server launcher at app-startup. r=gsvelto

The fork server is not launched as expected with the
 preference.  This patch fix the issue.

Differential Revision: https://phabricator.services.mozilla.com/D65930

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Thinker Li 2020-03-18 01:01:17 +00:00
parent befd1cb52f
commit 3a60ba6eba
2 changed files with 8 additions and 2 deletions

View File

@ -125,7 +125,13 @@ already_AddRefed<ForkServerLauncher> ForkServerLauncher::Create() {
NS_IMETHODIMP
ForkServerLauncher::Observe(nsISupports* aSubject, const char* aTopic,
const char16_t* aData) {
if (!mHaveStartedClient && strcmp(aTopic, "final-ui-startup") == 0) {
if (strcmp(aTopic, NS_XPCOM_STARTUP_CATEGORY) == 0) {
nsCOMPtr<nsIObserverService> obsSvc =
mozilla::services::GetObserverService();
MOZ_ASSERT(obsSvc != nullptr);
// preferences are not available until final-ui-startup
obsSvc->AddObserver(this, "final-ui-startup", false);
} else if (!mHaveStartedClient && strcmp(aTopic, "final-ui-startup") == 0) {
if (StaticPrefs::dom_ipc_forkserver_enable_AtStartup()) {
mHaveStartedClient = true;
ForkServiceChild::StartForkServer();

View File

@ -17,6 +17,6 @@ Classes = [
'headers': ['mozilla/ipc/ForkServiceChild.h'],
'constructor': 'mozilla::ipc::ForkServerLauncher::Create',
'processes': ProcessSelector.MAIN_PROCESS_ONLY,
'categories': {'final-ui-startup': 'Fork Server Launcher'},
'categories': {'xpcom-startup': 'Fork Server Launcher'},
},
]