Fixing nsbeta2+ bug 41367, area.pathname incorrectly contained the ref and search parts of the URL. r=vidur

git-svn-id: svn://10.0.0.236/trunk@72161 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
jst%netscape.com 2000-06-14 00:48:34 +00:00
parent 3e2763bedf
commit bc3e91849d
2 changed files with 38 additions and 30 deletions

View File

@ -347,22 +347,26 @@ NS_IMETHODIMP
nsHTMLAreaElement::GetPathname(nsString& aPathname)
{
nsAutoString href;
nsIURI *url;
nsCOMPtr<nsIURI> uri;
nsresult result = NS_OK;
aPathname.Truncate();
result = GetHref(href);
if (NS_OK == result) {
result = NS_NewURI(&url, href);
if (NS_OK == result) {
char* file;
result = url->GetPath(&file);
if (result == NS_OK) {
aPathname.AssignWithConversion(file);
nsCRT::free(file);
}
NS_IF_RELEASE(url);
}
}
NS_ENSURE_SUCCESS(result, result);
result = NS_NewURI(getter_AddRefs(uri), href);
NS_ENSURE_SUCCESS(result, result);
nsCOMPtr<nsIURL> url(do_QueryInterface(uri));
NS_ENSURE_TRUE(url, NS_OK);
char* file;
result = url->GetFilePath(&file);
NS_ENSURE_SUCCESS(result, result);
aPathname.AssignWithConversion(file);
nsCRT::free(file);
return result;
}
@ -430,7 +434,7 @@ nsHTMLAreaElement::GetHash(nsString& aHash)
nsAutoString href;
nsIURI *uri;
nsresult result = NS_OK;
result = GetHref(href);
if (NS_OK == result) {
result = NS_NewURI(&uri, href);

View File

@ -347,22 +347,26 @@ NS_IMETHODIMP
nsHTMLAreaElement::GetPathname(nsString& aPathname)
{
nsAutoString href;
nsIURI *url;
nsCOMPtr<nsIURI> uri;
nsresult result = NS_OK;
aPathname.Truncate();
result = GetHref(href);
if (NS_OK == result) {
result = NS_NewURI(&url, href);
if (NS_OK == result) {
char* file;
result = url->GetPath(&file);
if (result == NS_OK) {
aPathname.AssignWithConversion(file);
nsCRT::free(file);
}
NS_IF_RELEASE(url);
}
}
NS_ENSURE_SUCCESS(result, result);
result = NS_NewURI(getter_AddRefs(uri), href);
NS_ENSURE_SUCCESS(result, result);
nsCOMPtr<nsIURL> url(do_QueryInterface(uri));
NS_ENSURE_TRUE(url, NS_OK);
char* file;
result = url->GetFilePath(&file);
NS_ENSURE_SUCCESS(result, result);
aPathname.AssignWithConversion(file);
nsCRT::free(file);
return result;
}
@ -430,7 +434,7 @@ nsHTMLAreaElement::GetHash(nsString& aHash)
nsAutoString href;
nsIURI *uri;
nsresult result = NS_OK;
result = GetHref(href);
if (NS_OK == result) {
result = NS_NewURI(&uri, href);