Fix bug 181472 -- uri fixup should do the PossiblyHostPortUrl check before

calling NS_NewURI if the protocol handler is the external protocol handler.
r=adamlock, sr=darin


git-svn-id: svn://10.0.0.236/trunk@134424 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
bzbarsky%mit.edu
2002-11-25 23:36:37 +00:00
parent 138f8ebfcf
commit acc91df5aa

View File

@@ -191,13 +191,23 @@ nsDefaultURIFixup::CreateFixupURI(const nsAString& aStringURI, PRUint32 aFixupFl
uriString.EqualsIgnoreCase("ftp:", 4) ||
uriString.EqualsIgnoreCase("file:", 5));
// Just try to create an URL out of it
rv = NS_NewURI(aURI, uriString, bUseNonDefaultCharsetForURI ? GetCharsetForUrlBar() : nsnull);
if (rv == NS_ERROR_UNKNOWN_PROTOCOL)
{
if (!PossiblyHostPortUrl(uriString))
return NS_ERROR_UNKNOWN_PROTOCOL;
// Check the scheme...
NS_LossyConvertUCS2toASCII asciiURI(uriString);
nsCOMPtr<nsIIOService> ioService = do_GetService(NS_IOSERVICE_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
nsCAutoString scheme;
ioService->ExtractScheme(asciiURI, scheme);
nsCOMPtr<nsIProtocolHandler> ourHandler, extHandler;
ioService->GetProtocolHandler(scheme.get(), getter_AddRefs(ourHandler));
extHandler = do_GetService(NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX"default");
if (ourHandler != extHandler || !PossiblyHostPortUrl(uriString)) {
// Just try to create an URL out of it
rv = NS_NewURI(aURI, uriString,
bUseNonDefaultCharsetForURI ? GetCharsetForUrlBar() : nsnull);
}
if (*aURI) {
if (aFixupFlags & FIXUP_FLAGS_MAKE_ALTERNATE_URI)
MakeAlternateURI(*aURI);