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:
cbiesinger%web.de 2004-09-14 18:32:13 +00:00
Родитель a7d98f183c
Коммит f502011115
2 изменённых файлов: 21 добавлений и 9 удалений

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

@ -74,4 +74,14 @@ protected:
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__

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

@ -39,13 +39,12 @@
#include "nsJARURI.h"
#include "nsNetUtil.h"
#include "nsIIOService.h"
#include "nsIStandardURL.h"
#include "nsCRT.h"
#include "nsIComponentManager.h"
#include "nsIServiceManager.h"
#include "nsIZipReader.h"
#include "nsReadableUtils.h"
#include "nsURLHelper.h"
#include "nsStandardURL.h"
#include "nsAutoPtr.h"
static NS_DEFINE_CID(kThisImplCID, NS_THIS_JARURI_IMPL_CID);
@ -115,8 +114,8 @@ nsJARURI::CreateEntryURL(const nsACString& entryFilename,
nsIURL** url)
{
*url = nsnull;
nsStandardURL* stdURL = new nsStandardURL();
nsCOMPtr<nsIStandardURL> stdURL(do_CreateInstance(NS_STANDARDURL_CONTRACTID));
if (!stdURL) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -126,12 +125,10 @@ nsJARURI::CreateEntryURL(const nsACString& entryFilename,
nsresult rv = stdURL->Init(nsIStandardURL::URLTYPE_NO_AUTHORITY, -1,
spec, charset, nsnull);
if (NS_FAILED(rv)) {
delete stdURL;
return rv;
}
NS_ADDREF(*url = stdURL);
return NS_OK;
return CallQueryInterface(stdURL, url);
}
////////////////////////////////////////////////////////////////////////////////
@ -170,7 +167,7 @@ nsJARURI::SetSpec(const nsACString &aSpec)
if (NS_FAILED(rv)) return rv;
nsCAutoString scheme;
rv = net_ExtractURLScheme(aSpec, nsnull, nsnull, &scheme);
rv = ioServ->ExtractScheme(aSpec, scheme);
if (NS_FAILED(rv)) return rv;
if (strcmp("jar", scheme.get()) != 0)
@ -402,7 +399,12 @@ nsJARURI::Resolve(const nsACString &relativePath, nsACString &result)
{
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)) {
// then aSpec is absolute
result = relativePath;