Bug 609785 - Use resource:/// for loading omnijar components, r=bsmedberg a=approval2.0

This commit is contained in:
Michael Wu 2011-01-07 11:04:19 -08:00
Родитель 59b6835169
Коммит c2c8d3894b
1 изменённых файлов: 20 добавлений и 7 удалений

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

@ -91,6 +91,7 @@
#include "mozilla/scache/StartupCache.h" #include "mozilla/scache/StartupCache.h"
#include "mozilla/scache/StartupCacheUtils.h" #include "mozilla/scache/StartupCacheUtils.h"
#endif #endif
#include "mozilla/Omnijar.h"
#if defined(MOZ_SHARK) || defined(MOZ_CALLGRIND) || defined(MOZ_VTUNE) || defined(MOZ_TRACEVIS) #if defined(MOZ_SHARK) || defined(MOZ_CALLGRIND) || defined(MOZ_VTUNE) || defined(MOZ_TRACEVIS)
#include "jsdbgapi.h" #include "jsdbgapi.h"
@ -629,16 +630,28 @@ mozJSComponentLoader::LoadModuleFromJAR(nsILocalFile *aJarFile,
#if !defined(XPCONNECT_STANDALONE) #if !defined(XPCONNECT_STANDALONE)
nsresult rv; nsresult rv;
nsCAutoString fullSpec;
#ifdef MOZ_OMNIJAR
PRBool equal;
rv = aJarFile->Equals(mozilla::OmnijarPath(), &equal);
if (NS_SUCCEEDED(rv) && equal) {
fullSpec = "resource://gre/";
} else {
#endif
nsCAutoString fileSpec; nsCAutoString fileSpec;
NS_GetURLSpecFromActualFile(aJarFile, fileSpec); NS_GetURLSpecFromActualFile(aJarFile, fileSpec);
fullSpec = "jar:";
fullSpec += fileSpec;
fullSpec += "!/";
#ifdef MOZ_OMNIJAR
}
#endif
nsCAutoString jarSpec("jar:"); fullSpec += aComponentPath;
jarSpec += fileSpec;
jarSpec += "!/";
jarSpec += aComponentPath;
nsCOMPtr<nsIURI> uri; nsCOMPtr<nsIURI> uri;
rv = NS_NewURI(getter_AddRefs(uri), jarSpec); rv = NS_NewURI(getter_AddRefs(uri), fullSpec);
if (NS_FAILED(rv)) if (NS_FAILED(rv))
return NULL; return NULL;