author | James Willcox <snorp@snorp.net> |
Fri, 14 Aug 2020 18:51:13 +0000 | |
changeset 544730 | 9a94d0040d2f9b0bf93fa02a624d5805e563e920 |
parent 544729 | 71a6d628bf09d8b3da26510d75b16b07ca7cdee2 |
child 544731 | 565097a8dd7db08d82151d40b7c3fcfdb6288c48 |
push id | 124228 |
push user | jwillcox@mozilla.com |
push date | Fri, 14 Aug 2020 20:42:30 +0000 |
treeherder | autoland@9a94d0040d2f [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | dthayer |
bugs | 1656515 |
milestone | 81.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/intl/locale/LocaleService.cpp +++ b/intl/locale/LocaleService.cpp @@ -292,22 +292,34 @@ bool LocaleService::LanguagesMatch(const } bool LocaleService::IsServer() { return mIsServer; } static bool GetGREFileContents(const char* aFilePath, nsCString* aOutString) { // Look for the requested file in omnijar. RefPtr<CacheAwareZipReader> zip = Omnijar::GetReader(Omnijar::GRE); if (zip) { - uint32_t length; - const uint8_t* data = zip->GetData(aFilePath, &length); - if (!data) { + const auto item = zip->GetItem(aFilePath); + if (!item) { return false; } - aOutString->Assign(reinterpret_cast<const char*>(data), length); + + MOZ_ASSERT(item->RealSize()); + + auto buf = MakeUnique<uint8_t[]>(item->RealSize()); + CacheAwareZipCursor cursor(item, zip, buf.get(), item->RealSize()); + + uint32_t count; + uint8_t* data = cursor.Read(&count); + + if (count != item->RealSize()) { + return false; + } + + aOutString->Assign(reinterpret_cast<const char*>(data), count); return true; } // If we didn't have an omnijar (i.e. we're running a non-packaged // build), then look in the GRE directory. nsCOMPtr<nsIFile> path; if (NS_FAILED(nsDirectoryService::gService->Get( NS_GRE_DIR, NS_GET_IID(nsIFile), getter_AddRefs(path)))) {