Removed the file fixup and completely rely on docShell fro Creating the uri.

This commit is contained in:
tbogard%aol.net 2000-04-12 09:46:40 +00:00
parent 169ea62357
commit e3719b0e45
2 changed files with 54 additions and 124 deletions

View File

@ -1350,47 +1350,14 @@ nsWebShell::LoadURL(const PRUnichar *aURLSpec,
const char * aWindowTarget)
{
nsresult rv = NS_OK;
PRBool keywordsEnabled = PR_FALSE;
/*
TODO This doesnt belong here... The app should be doing all this
URL play. The webshell should not have a clue about whats "mailto"
If you insist that this should be here, then put in URL parsing
optimizations here. -Gagan
*/
nsAutoString urlStr(aURLSpec);
// first things first. try to create a uri out of the string.
nsCOMPtr<nsIURI> uri;
nsXPIDLCString spec;
if(0==urlStr.Find("file:",0))
{
// if this is file url, we need to convert the URI
// from Unicode to the FS charset
nsCAutoString inFSCharset;
rv = ConvertStringURIToFileCharset(urlStr, inFSCharset);
NS_ASSERTION(NS_SUCCEEDED(rv), "convertURLToFielCharset failed");
if(NS_SUCCEEDED(rv))
rv = NS_NewURI(getter_AddRefs(uri), inFSCharset.GetBuffer(), nsnull);
}
else
rv = NS_NewURI(getter_AddRefs(uri), urlStr, nsnull);
if(NS_FAILED(rv))
{
// no dice.
nsAutoString urlSpec;
urlStr.Trim(" ");
// see if we've got a file url.
ConvertFileToStringURI(urlStr, urlSpec);
nsCAutoString inFSCharset;
rv = ConvertStringURIToFileCharset(urlSpec, inFSCharset);
NS_ASSERTION(NS_SUCCEEDED(rv), "convertURLToFielCharset failed");
if(NS_SUCCEEDED(rv))
rv = NS_NewURI(getter_AddRefs(uri), inFSCharset.GetBuffer(), nsnull);
if(NS_FAILED(rv))
{
nsCOMPtr<nsIURI> uri;
rv = CreateFixupURI(urlStr.GetUnicode(), getter_AddRefs(uri));
if(NS_ERROR_UNKNOWN_PROTOCOL == rv)
@ -1411,7 +1378,7 @@ nsWebShell::LoadURL(const PRUnichar *aURLSpec,
// extract the scheme
nsAutoString scheme;
urlSpec.Left(scheme, colon);
urlStr.Left(scheme, colon);
nsAutoString dnsMsg(scheme);
dnsMsg.Append(' ');
@ -1419,8 +1386,6 @@ nsWebShell::LoadURL(const PRUnichar *aURLSpec,
(void)mPrompter->Alert(dnsMsg.GetUnicode());
} // end unknown protocol
}
}
if(!uri)
return rv;

View File

@ -1350,47 +1350,14 @@ nsWebShell::LoadURL(const PRUnichar *aURLSpec,
const char * aWindowTarget)
{
nsresult rv = NS_OK;
PRBool keywordsEnabled = PR_FALSE;
/*
TODO This doesnt belong here... The app should be doing all this
URL play. The webshell should not have a clue about whats "mailto"
If you insist that this should be here, then put in URL parsing
optimizations here. -Gagan
*/
nsAutoString urlStr(aURLSpec);
// first things first. try to create a uri out of the string.
nsCOMPtr<nsIURI> uri;
nsXPIDLCString spec;
if(0==urlStr.Find("file:",0))
{
// if this is file url, we need to convert the URI
// from Unicode to the FS charset
nsCAutoString inFSCharset;
rv = ConvertStringURIToFileCharset(urlStr, inFSCharset);
NS_ASSERTION(NS_SUCCEEDED(rv), "convertURLToFielCharset failed");
if(NS_SUCCEEDED(rv))
rv = NS_NewURI(getter_AddRefs(uri), inFSCharset.GetBuffer(), nsnull);
}
else
rv = NS_NewURI(getter_AddRefs(uri), urlStr, nsnull);
if(NS_FAILED(rv))
{
// no dice.
nsAutoString urlSpec;
urlStr.Trim(" ");
// see if we've got a file url.
ConvertFileToStringURI(urlStr, urlSpec);
nsCAutoString inFSCharset;
rv = ConvertStringURIToFileCharset(urlSpec, inFSCharset);
NS_ASSERTION(NS_SUCCEEDED(rv), "convertURLToFielCharset failed");
if(NS_SUCCEEDED(rv))
rv = NS_NewURI(getter_AddRefs(uri), inFSCharset.GetBuffer(), nsnull);
if(NS_FAILED(rv))
{
nsCOMPtr<nsIURI> uri;
rv = CreateFixupURI(urlStr.GetUnicode(), getter_AddRefs(uri));
if(NS_ERROR_UNKNOWN_PROTOCOL == rv)
@ -1411,7 +1378,7 @@ nsWebShell::LoadURL(const PRUnichar *aURLSpec,
// extract the scheme
nsAutoString scheme;
urlSpec.Left(scheme, colon);
urlStr.Left(scheme, colon);
nsAutoString dnsMsg(scheme);
dnsMsg.Append(' ');
@ -1419,8 +1386,6 @@ nsWebShell::LoadURL(const PRUnichar *aURLSpec,
(void)mPrompter->Alert(dnsMsg.GetUnicode());
} // end unknown protocol
}
}
if(!uri)
return rv;