From ecda9c5f0c5bc6b4e9bf786f33816f07af710322 Mon Sep 17 00:00:00 2001 From: "cbiesinger%web.de" Date: Tue, 14 Sep 2004 18:32:13 +0000 Subject: [PATCH] Bug 248044 move jar protocol handler into libjar. these are the changes to the moved files r=bsmedberg sr=darin git-svn-id: svn://10.0.0.236/trunk@162316 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/modules/libjar/nsJARProtocolHandler.h | 10 ++++++++++ mozilla/modules/libjar/nsJARURI.cpp | 20 ++++++++++--------- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/mozilla/modules/libjar/nsJARProtocolHandler.h b/mozilla/modules/libjar/nsJARProtocolHandler.h index 868824bd35e..3eef0abd473 100644 --- a/mozilla/modules/libjar/nsJARProtocolHandler.h +++ b/mozilla/modules/libjar/nsJARProtocolHandler.h @@ -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__ diff --git a/mozilla/modules/libjar/nsJARURI.cpp b/mozilla/modules/libjar/nsJARURI.cpp index 6adea541ebb..646361c5653 100644 --- a/mozilla/modules/libjar/nsJARURI.cpp +++ b/mozilla/modules/libjar/nsJARURI.cpp @@ -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 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 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;