зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1656261 - Disable StartupCaching of Omnijar zip central r=froydnj
This is a speculative fix for a crash we're seeing due to xul.css ostensibly not existing. The theory is that xul.css does in fact exist and the cached zip central for the omnijar is simply corrupt in some way. If it is corrupt in this way, then there is a bigger issue, and we need to investigate deeper. However, the benefit of this approach is that it is a very small and contained patch which should be simple to uplift. Differential Revision: https://phabricator.services.mozilla.com/D86829
This commit is contained in:
Родитель
9eb0dfc2fa
Коммит
66f210cc61
|
@ -92,41 +92,8 @@ void Omnijar::InitOne(nsIFile* aPath, Type aType) {
|
|||
}
|
||||
|
||||
RefPtr<nsZipArchive> zipReader = new nsZipArchive();
|
||||
auto* cache = scache::StartupCache::GetSingleton();
|
||||
const uint8_t* centralBuf = nullptr;
|
||||
uint32_t centralBufLength = 0;
|
||||
nsCString startupCacheKey =
|
||||
nsPrintfCString("::%s:OmnijarCentral", sCachePrefixes[aType]);
|
||||
if (cache) {
|
||||
nsresult rv = cache->GetBuffer(startupCacheKey.get(),
|
||||
reinterpret_cast<const char**>(¢ralBuf),
|
||||
¢ralBufLength);
|
||||
if (NS_FAILED(rv)) {
|
||||
centralBuf = nullptr;
|
||||
centralBufLength = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!centralBuf) {
|
||||
if (NS_FAILED(zipReader->OpenArchive(file))) {
|
||||
return;
|
||||
}
|
||||
if (cache) {
|
||||
size_t bufSize;
|
||||
// Annoyingly, nsZipArchive and the startupcache use different types to
|
||||
// represent bytes (uint8_t vs char), so we have to do a little dance to
|
||||
// convert the UniquePtr over.
|
||||
UniquePtr<char[]> centralBuf(reinterpret_cast<char*>(
|
||||
zipReader->CopyCentralDirectoryBuffer(&bufSize).release()));
|
||||
if (centralBuf) {
|
||||
cache->PutBuffer(startupCacheKey.get(), std::move(centralBuf), bufSize);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (NS_FAILED(zipReader->LazyOpenArchive(
|
||||
file, Span(centralBuf, centralBufLength)))) {
|
||||
return;
|
||||
}
|
||||
if (NS_FAILED(zipReader->OpenArchive(file))) {
|
||||
return;
|
||||
}
|
||||
|
||||
RefPtr<nsZipArchive> outerReader;
|
||||
|
|
Загрузка…
Ссылка в новой задаче