diff --git a/toolkit/mozapps/installer/packager.mk b/toolkit/mozapps/installer/packager.mk index a7dbadaaaf1..9a577a1e074 100644 --- a/toolkit/mozapps/installer/packager.mk +++ b/toolkit/mozapps/installer/packager.mk @@ -260,9 +260,6 @@ endif #Create an RPM file ifeq ($(MOZ_PKG_FORMAT),APK) -# we have custom stuff for Android -MOZ_OMNIJAR = - JAVA_CLASSPATH = $(ANDROID_SDK)/android.jar include $(topsrcdir)/config/android-common.mk @@ -346,7 +343,8 @@ INNER_MAKE_PACKAGE = \ done && \ unzip -o $(_ABS_DIST)/gecko.ap_ && \ rm $(_ABS_DIST)/gecko.ap_ && \ - $(ZIP) -r9D $(_ABS_DIST)/gecko.ap_ $(DIST_FILES) -x $(NON_DIST_FILES) ) && \ + $(ZIP) -r9D $(_ABS_DIST)/gecko.ap_ $(DIST_FILES) -x $(NON_DIST_FILES) && \ + $(ZIP) -0 $(_ABS_DIST)/gecko.ap_ $(OMNIJAR_NAME)) && \ rm -f $(_ABS_DIST)/gecko.apk && \ $(APKBUILDER) $(_ABS_DIST)/gecko.apk -v $(APKBUILDER_FLAGS) -z $(_ABS_DIST)/gecko.ap_ -f $(STAGEPATH)$(MOZ_PKG_DIR)$(_BINPATH)/classes.dex && \ cp $(_ABS_DIST)/gecko.apk $(_ABS_DIST)/gecko-unsigned-unaligned.apk && \ diff --git a/xpcom/build/Omnijar.cpp b/xpcom/build/Omnijar.cpp index 7c462d4ba83..01b1e762876 100644 --- a/xpcom/build/Omnijar.cpp +++ b/xpcom/build/Omnijar.cpp @@ -51,6 +51,7 @@ nsIFile *Omnijar::sPath[2] = { nsnull, nsnull }; nsZipArchive *Omnijar::sReader[2] = { nsnull, nsnull }; bool Omnijar::sInitialized = false; static bool sIsUnified = false; +static bool sIsNested[2] = { false, false }; static const char *sProp[2] = { NS_GRE_DIR, NS_XPCOM_CURRENT_PROCESS_DIR }; @@ -111,6 +112,14 @@ Omnijar::InitOne(nsIFile *aPath, Type aType) return; } + nsRefPtr handle; + if (NS_SUCCEEDED(nsZipHandle::Init(zipReader, NS_STRINGIFY(OMNIJAR_NAME), getter_AddRefs(handle)))) { + zipReader = new nsZipArchive(); + if (NS_FAILED(zipReader->OpenArchive(handle))) + return; + sIsNested[aType] = true; + } + CleanUpOne(aType); sReader[aType] = zipReader; NS_IF_ADDREF(sReader[aType]); @@ -142,12 +151,12 @@ Omnijar::GetReader(nsIFile *aPath) bool equals; nsresult rv; - if (sPath[GRE]) { + if (sPath[GRE] && !sIsNested[GRE]) { rv = sPath[GRE]->Equals(aPath, &equals); if (NS_SUCCEEDED(rv) && equals) return GetReader(GRE); } - if (sPath[APP]) { + if (sPath[APP] && !sIsNested[APP]) { rv = sPath[APP]->Equals(aPath, &equals); if (NS_SUCCEEDED(rv) && equals) return GetReader(APP); @@ -173,8 +182,12 @@ Omnijar::GetURIString(Type aType, nsACString &result) NS_ENSURE_SUCCESS(rv, rv); result = "jar:"; + if (sIsNested[aType]) + result += "jar:"; result += omniJarSpec; result += "!"; + if (sIsNested[aType]) + result += "/" NS_STRINGIFY(OMNIJAR_NAME) "!"; } else { nsCOMPtr dir; nsDirectoryService::gService->Get(SPROP(aType), NS_GET_IID(nsIFile), getter_AddRefs(dir));