From e13add5c1efe78686ed4440b8450ea4be23d4c1b Mon Sep 17 00:00:00 2001 From: "hyatt%netscape.com" Date: Mon, 15 May 2000 01:40:52 +0000 Subject: [PATCH] Changing convertChromeURL git-svn-id: svn://10.0.0.236/trunk@69716 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/chrome/public/nsIChromeRegistry.idl | 2 +- mozilla/chrome/src/nsChromeProtocolHandler.cpp | 9 +++++++-- mozilla/chrome/src/nsChromeRegistry.cpp | 5 +++-- mozilla/rdf/chrome/public/nsIChromeRegistry.idl | 2 +- mozilla/rdf/chrome/src/nsChromeProtocolHandler.cpp | 9 +++++++-- mozilla/rdf/chrome/src/nsChromeRegistry.cpp | 5 +++-- 6 files changed, 22 insertions(+), 10 deletions(-) diff --git a/mozilla/chrome/public/nsIChromeRegistry.idl b/mozilla/chrome/public/nsIChromeRegistry.idl index 35da85892ee..79387ab2c5a 100644 --- a/mozilla/chrome/public/nsIChromeRegistry.idl +++ b/mozilla/chrome/public/nsIChromeRegistry.idl @@ -55,7 +55,7 @@ interface nsIChromeRegistry : nsISupports * * @param aChromeURL the URL that is to be converted. */ - void convertChromeURL(in nsIURI aChromeURL); + string convertChromeURL(in nsIURI aChromeURL); nsISimpleEnumerator getOverlays(in nsIURI aChromeURL); diff --git a/mozilla/chrome/src/nsChromeProtocolHandler.cpp b/mozilla/chrome/src/nsChromeProtocolHandler.cpp index b9088a64dcb..47860678b78 100644 --- a/mozilla/chrome/src/nsChromeProtocolHandler.cpp +++ b/mozilla/chrome/src/nsChromeProtocolHandler.cpp @@ -684,11 +684,16 @@ nsChromeProtocolHandler::NewChannel(nsIURI* aURI, rv = aURI->Clone(getter_AddRefs(chromeURI)); // don't mangle the original if (NS_FAILED(rv)) return rv; - rv = reg->ConvertChromeURL(chromeURI); + char* spec; + rv = reg->ConvertChromeURL(chromeURI, &spec); if (NS_FAILED(rv)) return rv; - // now fetch the converted URI NS_WITH_SERVICE(nsIIOService, serv, kIOServiceCID, &rv); + nsCOMPtr protocolHandler; + serv->NewURI(spec, nsnull, getter_AddRefs(chromeURI)); + nsAllocator::Free(spec); + + // now fetch the converted URI if (NS_FAILED(rv)) return rv; rv = serv->NewChannelFromURI(chromeURI, getter_AddRefs(result)); diff --git a/mozilla/chrome/src/nsChromeRegistry.cpp b/mozilla/chrome/src/nsChromeRegistry.cpp index 461381136e8..b8d52938196 100644 --- a/mozilla/chrome/src/nsChromeRegistry.cpp +++ b/mozilla/chrome/src/nsChromeRegistry.cpp @@ -367,7 +367,7 @@ nsChromeRegistry::Canonify(nsIURI* aChromeURI) } NS_IMETHODIMP -nsChromeRegistry::ConvertChromeURL(nsIURI* aChromeURL) +nsChromeRegistry::ConvertChromeURL(nsIURI* aChromeURL, char** aResult) { nsresult rv = NS_OK; NS_ASSERTION(aChromeURL, "null url!"); @@ -450,7 +450,8 @@ nsChromeRegistry::ConvertChromeURL(nsIURI* aChromeURL) finalURL += "/"; finalURL += remaining; - aChromeURL->SetSpec(finalURL); + *aResult = nsXPIDLCString::Copy(finalURL); + return NS_OK; } diff --git a/mozilla/rdf/chrome/public/nsIChromeRegistry.idl b/mozilla/rdf/chrome/public/nsIChromeRegistry.idl index 35da85892ee..79387ab2c5a 100644 --- a/mozilla/rdf/chrome/public/nsIChromeRegistry.idl +++ b/mozilla/rdf/chrome/public/nsIChromeRegistry.idl @@ -55,7 +55,7 @@ interface nsIChromeRegistry : nsISupports * * @param aChromeURL the URL that is to be converted. */ - void convertChromeURL(in nsIURI aChromeURL); + string convertChromeURL(in nsIURI aChromeURL); nsISimpleEnumerator getOverlays(in nsIURI aChromeURL); diff --git a/mozilla/rdf/chrome/src/nsChromeProtocolHandler.cpp b/mozilla/rdf/chrome/src/nsChromeProtocolHandler.cpp index b9088a64dcb..47860678b78 100644 --- a/mozilla/rdf/chrome/src/nsChromeProtocolHandler.cpp +++ b/mozilla/rdf/chrome/src/nsChromeProtocolHandler.cpp @@ -684,11 +684,16 @@ nsChromeProtocolHandler::NewChannel(nsIURI* aURI, rv = aURI->Clone(getter_AddRefs(chromeURI)); // don't mangle the original if (NS_FAILED(rv)) return rv; - rv = reg->ConvertChromeURL(chromeURI); + char* spec; + rv = reg->ConvertChromeURL(chromeURI, &spec); if (NS_FAILED(rv)) return rv; - // now fetch the converted URI NS_WITH_SERVICE(nsIIOService, serv, kIOServiceCID, &rv); + nsCOMPtr protocolHandler; + serv->NewURI(spec, nsnull, getter_AddRefs(chromeURI)); + nsAllocator::Free(spec); + + // now fetch the converted URI if (NS_FAILED(rv)) return rv; rv = serv->NewChannelFromURI(chromeURI, getter_AddRefs(result)); diff --git a/mozilla/rdf/chrome/src/nsChromeRegistry.cpp b/mozilla/rdf/chrome/src/nsChromeRegistry.cpp index 461381136e8..b8d52938196 100644 --- a/mozilla/rdf/chrome/src/nsChromeRegistry.cpp +++ b/mozilla/rdf/chrome/src/nsChromeRegistry.cpp @@ -367,7 +367,7 @@ nsChromeRegistry::Canonify(nsIURI* aChromeURI) } NS_IMETHODIMP -nsChromeRegistry::ConvertChromeURL(nsIURI* aChromeURL) +nsChromeRegistry::ConvertChromeURL(nsIURI* aChromeURL, char** aResult) { nsresult rv = NS_OK; NS_ASSERTION(aChromeURL, "null url!"); @@ -450,7 +450,8 @@ nsChromeRegistry::ConvertChromeURL(nsIURI* aChromeURL) finalURL += "/"; finalURL += remaining; - aChromeURL->SetSpec(finalURL); + *aResult = nsXPIDLCString::Copy(finalURL); + return NS_OK; }