зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1657231, part 4 - Don't allow using the URL preloader in the child. r=kmag
It never gets initialized there anyways, so assert and clean up a bit of dead code. Differential Revision: https://phabricator.services.mozilla.com/D86032
This commit is contained in:
Родитель
36b266e999
Коммит
953004415b
|
@ -78,6 +78,11 @@ nsresult URLPreloader::CollectReports(nsIHandleReportCallback* aHandleReport,
|
|||
|
||||
// static
|
||||
already_AddRefed<URLPreloader> URLPreloader::Create() {
|
||||
// The static APIs like URLPreloader::Read work in the child process because
|
||||
// they fall back to a synchronous read. The actual preloader must be
|
||||
// explicitly initialized, and this should only be done in the parent.
|
||||
MOZ_RELEASE_ASSERT(XRE_IsParentProcess());
|
||||
|
||||
RefPtr<URLPreloader> preloader = new URLPreloader();
|
||||
if (preloader->InitInternal().isOk()) {
|
||||
RegisterWeakMemoryReporter(preloader);
|
||||
|
@ -131,16 +136,11 @@ Result<Ok, nsresult> URLPreloader::InitInternal() {
|
|||
return Err(NS_ERROR_UNEXPECTED);
|
||||
}
|
||||
|
||||
if (XRE_IsParentProcess()) {
|
||||
nsCOMPtr<nsIObserverService> obs = services::GetObserverService();
|
||||
|
||||
MOZ_TRY(obs->AddObserver(this, DELAYED_STARTUP_TOPIC, false));
|
||||
|
||||
MOZ_TRY(NS_GetSpecialDirectory("ProfLDS", getter_AddRefs(mProfD)));
|
||||
} else {
|
||||
mStartupFinished = true;
|
||||
mReaderInitialized = true;
|
||||
}
|
||||
|
||||
return Ok();
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче