Bug 1558306 - Switch L10nRegistry initialization to happen right before the first content process gets created. r=mconley

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Zibi Braniecki 2019-06-12 17:49:56 +00:00
Родитель d6e5792aff
Коммит 97b22563e5
3 изменённых файлов: 22 добавлений и 4 удалений

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

@ -35,8 +35,6 @@ const startupPhases = {
"resource://gre/modules/MainProcessSingleton.jsm",
"resource://gre/modules/XPCOMUtils.jsm",
"resource://gre/modules/Services.jsm",
"resource://gre/modules/L10nRegistry.jsm",
"resource://gre/modules/Fluent.jsm",
// Bugs to fix: The following components shouldn't be initialized that early.
"resource://gre/modules/PushComponents.jsm", // bug 1369436
]),

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

@ -592,6 +592,9 @@ static bool sCanLaunchSubprocesses;
// set.
static bool sDisableUnsafeCPOWWarnings = false;
// Set to true when the first content process gets created.
static bool sCreatedFirstContentProcess = false;
// The first content child has ID 1, so the chrome process can have ID 0.
static uint64_t gContentChildID = 1;
@ -2145,6 +2148,14 @@ void ContentParent::LaunchSubprocessInternal(
AUTO_PROFILER_LABEL("ContentParent::LaunchSubprocess::resolve", OTHER);
const auto launchResumeTS = TimeStamp::Now();
if (!sCreatedFirstContentProcess) {
nsCOMPtr<nsIObserverService> obs =
mozilla::services::GetObserverService();
obs->NotifyObservers(nullptr, "ipc:first-content-process-created",
nullptr);
sCreatedFirstContentProcess = true;
}
base::ProcessId procId = base::GetProcId(handle);
Open(mSubprocess->GetChannel(), procId);
#ifdef MOZ_CODE_COVERAGE

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

@ -55,10 +55,11 @@ MainProcessSingleton.prototype = {
observe(subject, topic, data) {
switch (topic) {
case "app-startup": {
ChromeUtils.import("resource://gre/modules/CustomElementsListener.jsm", null);
ChromeUtils.import("resource://gre/modules/L10nRegistry.jsm");
Services.obs.addObserver(this, "ipc:first-content-process-created");
Services.obs.addObserver(this, "xpcom-shutdown");
ChromeUtils.import("resource://gre/modules/CustomElementsListener.jsm", null);
// Load this script early so that console.* is initialized
// before other frame scripts.
Services.mm.loadFrameScript("chrome://global/content/browser-content.js", true, true);
@ -68,6 +69,14 @@ MainProcessSingleton.prototype = {
break;
}
case "ipc:first-content-process-created": {
// L10nRegistry needs to be initialized before any content
// process is loaded to populate the registered FileSource
// categories.
ChromeUtils.import("resource://gre/modules/L10nRegistry.jsm");
break;
}
case "xpcom-shutdown":
Services.mm.removeMessageListener("Search:AddEngine", this.addSearchEngine);
break;