diff --git a/mozilla/modules/libjar/nsJARChannel.cpp b/mozilla/modules/libjar/nsJARChannel.cpp index f3f813eb893..ee2244b5e6a 100644 --- a/mozilla/modules/libjar/nsJARChannel.cpp +++ b/mozilla/modules/libjar/nsJARChannel.cpp @@ -534,7 +534,7 @@ nsJARChannel::EnsureJARFileAvailable(OnJARFileAvailableFun onJARFileAvailable, } error: - if (mLoadGroup) { + if (NS_FAILED(rv) && mLoadGroup) { nsresult rv2 = mLoadGroup->RemoveChannel(this, nsnull, rv, nsnull); // XXX fix error message NS_ASSERTION(NS_SUCCEEDED(rv2), "RemoveChannel failed"); } diff --git a/mozilla/modules/libjar/nsJARURI.cpp b/mozilla/modules/libjar/nsJARURI.cpp index 89112c2a091..98e8fb74e41 100644 --- a/mozilla/modules/libjar/nsJARURI.cpp +++ b/mozilla/modules/libjar/nsJARURI.cpp @@ -1,4 +1,4 @@ -/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * The contents of this file are subject to the Netscape Public License * Version 1.0 (the "NPL"); you may not use this file except in @@ -296,9 +296,22 @@ NS_IMETHODIMP nsJARURI::Resolve(const char *relativePath, char **result) { nsresult rv; + + if (!relativePath) return NS_ERROR_NULL_POINTER; + NS_WITH_SERVICE(nsIIOService, serv, kIOServiceCID, &rv); if (NS_FAILED(rv)) return rv; + nsXPIDLCString scheme; + rv = serv->ExtractScheme(relativePath, nsnull, nsnull, getter_Copies(scheme)); + if (NS_SUCCEEDED(rv)) { + // then aSpec is absolute + *result = nsCRT::strdup(relativePath); + if (*result == nsnull) + return NS_ERROR_OUT_OF_MEMORY; + return NS_OK; + } + nsCAutoString path(mJAREntry); PRInt32 pos = path.RFind("/"); if (pos >= 0) diff --git a/mozilla/netwerk/protocol/jar/src/nsJARChannel.cpp b/mozilla/netwerk/protocol/jar/src/nsJARChannel.cpp index f3f813eb893..ee2244b5e6a 100644 --- a/mozilla/netwerk/protocol/jar/src/nsJARChannel.cpp +++ b/mozilla/netwerk/protocol/jar/src/nsJARChannel.cpp @@ -534,7 +534,7 @@ nsJARChannel::EnsureJARFileAvailable(OnJARFileAvailableFun onJARFileAvailable, } error: - if (mLoadGroup) { + if (NS_FAILED(rv) && mLoadGroup) { nsresult rv2 = mLoadGroup->RemoveChannel(this, nsnull, rv, nsnull); // XXX fix error message NS_ASSERTION(NS_SUCCEEDED(rv2), "RemoveChannel failed"); } diff --git a/mozilla/netwerk/protocol/jar/src/nsJARURI.cpp b/mozilla/netwerk/protocol/jar/src/nsJARURI.cpp index 89112c2a091..98e8fb74e41 100644 --- a/mozilla/netwerk/protocol/jar/src/nsJARURI.cpp +++ b/mozilla/netwerk/protocol/jar/src/nsJARURI.cpp @@ -1,4 +1,4 @@ -/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * The contents of this file are subject to the Netscape Public License * Version 1.0 (the "NPL"); you may not use this file except in @@ -296,9 +296,22 @@ NS_IMETHODIMP nsJARURI::Resolve(const char *relativePath, char **result) { nsresult rv; + + if (!relativePath) return NS_ERROR_NULL_POINTER; + NS_WITH_SERVICE(nsIIOService, serv, kIOServiceCID, &rv); if (NS_FAILED(rv)) return rv; + nsXPIDLCString scheme; + rv = serv->ExtractScheme(relativePath, nsnull, nsnull, getter_Copies(scheme)); + if (NS_SUCCEEDED(rv)) { + // then aSpec is absolute + *result = nsCRT::strdup(relativePath); + if (*result == nsnull) + return NS_ERROR_OUT_OF_MEMORY; + return NS_OK; + } + nsCAutoString path(mJAREntry); PRInt32 pos = path.RFind("/"); if (pos >= 0)