Bug 1195496 - Add PROFILE_READY Gecko state; r=snorp
Many Gecko operations depend on the profile being available. This patch adds a PROFILE_READY Gecko state so that we can queue calls until profile is loaded.
This commit is contained in:
@@ -196,8 +196,9 @@ nsAppShell::Init()
|
||||
nsCOMPtr<nsIObserverService> obsServ =
|
||||
mozilla::services::GetObserverService();
|
||||
if (obsServ) {
|
||||
obsServ->AddObserver(this, "xpcom-shutdown", false);
|
||||
obsServ->AddObserver(this, "browser-delayed-startup-finished", false);
|
||||
obsServ->AddObserver(this, "profile-do-change", false);
|
||||
obsServ->AddObserver(this, "xpcom-shutdown", false);
|
||||
}
|
||||
|
||||
if (sPowerManagerService)
|
||||
@@ -226,6 +227,16 @@ nsAppShell::Observe(nsISupports* aSubject,
|
||||
} else if (!strcmp(aTopic, "browser-delayed-startup-finished")) {
|
||||
NS_CreateServicesFromCategory("browser-delayed-startup-finished", nullptr,
|
||||
"browser-delayed-startup-finished");
|
||||
} else if (!strcmp(aTopic, "profile-do-change")) {
|
||||
if (jni::IsAvailable()) {
|
||||
widget::GeckoThread::SetState(
|
||||
widget::GeckoThread::State::PROFILE_READY());
|
||||
}
|
||||
nsCOMPtr<nsIObserverService> obsServ =
|
||||
mozilla::services::GetObserverService();
|
||||
if (obsServ) {
|
||||
obsServ->RemoveObserver(this, "profile-do-change");
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user