зеркало из https://github.com/mozilla/pjs.git
Bug 248044 move jar protocol handler into libjar. these are the changes to the
moved files r=bsmedberg sr=darin
This commit is contained in:
Родитель
a7d98f183c
Коммит
f502011115
|
@ -74,4 +74,14 @@ protected:
|
||||||
|
|
||||||
extern nsJARProtocolHandler *gJarHandler;
|
extern nsJARProtocolHandler *gJarHandler;
|
||||||
|
|
||||||
|
#define NS_JARPROTOCOLHANDLER_CLASSNAME \
|
||||||
|
"nsJarProtocolHandler"
|
||||||
|
#define NS_JARPROTOCOLHANDLER_CID \
|
||||||
|
{ /* 0xc7e410d4-0x85f2-11d3-9f63-006008a6efe9 */ \
|
||||||
|
0xc7e410d4, \
|
||||||
|
0x85f2, \
|
||||||
|
0x11d3, \
|
||||||
|
{0x9f, 0x63, 0x00, 0x60, 0x08, 0xa6, 0xef, 0xe9} \
|
||||||
|
}
|
||||||
|
|
||||||
#endif // !nsJARProtocolHandler_h__
|
#endif // !nsJARProtocolHandler_h__
|
||||||
|
|
|
@ -39,13 +39,12 @@
|
||||||
#include "nsJARURI.h"
|
#include "nsJARURI.h"
|
||||||
#include "nsNetUtil.h"
|
#include "nsNetUtil.h"
|
||||||
#include "nsIIOService.h"
|
#include "nsIIOService.h"
|
||||||
|
#include "nsIStandardURL.h"
|
||||||
#include "nsCRT.h"
|
#include "nsCRT.h"
|
||||||
#include "nsIComponentManager.h"
|
#include "nsIComponentManager.h"
|
||||||
#include "nsIServiceManager.h"
|
#include "nsIServiceManager.h"
|
||||||
#include "nsIZipReader.h"
|
#include "nsIZipReader.h"
|
||||||
#include "nsReadableUtils.h"
|
#include "nsReadableUtils.h"
|
||||||
#include "nsURLHelper.h"
|
|
||||||
#include "nsStandardURL.h"
|
|
||||||
#include "nsAutoPtr.h"
|
#include "nsAutoPtr.h"
|
||||||
|
|
||||||
static NS_DEFINE_CID(kThisImplCID, NS_THIS_JARURI_IMPL_CID);
|
static NS_DEFINE_CID(kThisImplCID, NS_THIS_JARURI_IMPL_CID);
|
||||||
|
@ -115,8 +114,8 @@ nsJARURI::CreateEntryURL(const nsACString& entryFilename,
|
||||||
nsIURL** url)
|
nsIURL** url)
|
||||||
{
|
{
|
||||||
*url = nsnull;
|
*url = nsnull;
|
||||||
|
|
||||||
nsStandardURL* stdURL = new nsStandardURL();
|
nsCOMPtr<nsIStandardURL> stdURL(do_CreateInstance(NS_STANDARDURL_CONTRACTID));
|
||||||
if (!stdURL) {
|
if (!stdURL) {
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
@ -126,12 +125,10 @@ nsJARURI::CreateEntryURL(const nsACString& entryFilename,
|
||||||
nsresult rv = stdURL->Init(nsIStandardURL::URLTYPE_NO_AUTHORITY, -1,
|
nsresult rv = stdURL->Init(nsIStandardURL::URLTYPE_NO_AUTHORITY, -1,
|
||||||
spec, charset, nsnull);
|
spec, charset, nsnull);
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
delete stdURL;
|
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_ADDREF(*url = stdURL);
|
return CallQueryInterface(stdURL, url);
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -170,7 +167,7 @@ nsJARURI::SetSpec(const nsACString &aSpec)
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
nsCAutoString scheme;
|
nsCAutoString scheme;
|
||||||
rv = net_ExtractURLScheme(aSpec, nsnull, nsnull, &scheme);
|
rv = ioServ->ExtractScheme(aSpec, scheme);
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
if (strcmp("jar", scheme.get()) != 0)
|
if (strcmp("jar", scheme.get()) != 0)
|
||||||
|
@ -402,7 +399,12 @@ nsJARURI::Resolve(const nsACString &relativePath, nsACString &result)
|
||||||
{
|
{
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
|
|
||||||
rv = net_ExtractURLScheme(relativePath, nsnull, nsnull, nsnull);
|
nsCOMPtr<nsIIOService> ioServ(do_GetIOService(&rv));
|
||||||
|
if (NS_FAILED(rv))
|
||||||
|
return rv;
|
||||||
|
|
||||||
|
nsCAutoString scheme;
|
||||||
|
rv = ioServ->ExtractScheme(relativePath, scheme);
|
||||||
if (NS_SUCCEEDED(rv)) {
|
if (NS_SUCCEEDED(rv)) {
|
||||||
// then aSpec is absolute
|
// then aSpec is absolute
|
||||||
result = relativePath;
|
result = relativePath;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче