Fixing rtm++ bug 56529. Necko was unescaping the content of URL's if a segment of the URL is requested (but not if the whole URL is requested), the DOM code used this unescaped string as is and that caused backwards compatibility problems. a=gagan&brendan, r=andreas.otte@primus-online.de

This commit is contained in:
jst%netscape.com 2000-10-24 04:56:10 +00:00
parent 8911ee3487
commit c1ccea8268
8 changed files with 23 additions and 5 deletions

View File

@ -567,7 +567,7 @@ nsHTMLAnchorElement::GetSearch(nsAWritableString& aSearch)
nsIURL* url;
result = uri->QueryInterface(NS_GET_IID(nsIURL), (void**)&url);
if (NS_SUCCEEDED(result)) {
result = url->GetQuery(&search);
result = url->GetEscapedQuery(&search);
NS_RELEASE(url);
}
if (result == NS_OK && (nsnull != search) && ('\0' != *search)) {

View File

@ -410,7 +410,7 @@ nsHTMLAreaElement::GetSearch(nsAWritableString& aSearch)
nsIURL* url;
result = uri->QueryInterface(NS_GET_IID(nsIURL), (void**)&url);
if (NS_SUCCEEDED(result)) {
result = url->GetQuery(&search);
result = url->GetEscapedQuery(&search);
NS_RELEASE(url);
}
if (result == NS_OK && (nsnull != search) && ('\0' != *search)) {

View File

@ -569,7 +569,7 @@ LocationImpl::GetSearch(nsAWritableString& aSearch)
nsIURL* url;
result = uri->QueryInterface(NS_GET_IID(nsIURL), (void**)&url);
if (NS_SUCCEEDED(result)) {
result = url->GetQuery(&search);
result = url->GetEscapedQuery(&search);
NS_RELEASE(url);
}
if (result == NS_OK && (nsnull != search) && ('\0' != *search)) {

View File

@ -567,7 +567,7 @@ nsHTMLAnchorElement::GetSearch(nsAWritableString& aSearch)
nsIURL* url;
result = uri->QueryInterface(NS_GET_IID(nsIURL), (void**)&url);
if (NS_SUCCEEDED(result)) {
result = url->GetQuery(&search);
result = url->GetEscapedQuery(&search);
NS_RELEASE(url);
}
if (result == NS_OK && (nsnull != search) && ('\0' != *search)) {

View File

@ -410,7 +410,7 @@ nsHTMLAreaElement::GetSearch(nsAWritableString& aSearch)
nsIURL* url;
result = uri->QueryInterface(NS_GET_IID(nsIURL), (void**)&url);
if (NS_SUCCEEDED(result)) {
result = url->GetQuery(&search);
result = url->GetEscapedQuery(&search);
NS_RELEASE(url);
}
if (result == NS_OK && (nsnull != search) && ('\0' != *search)) {

View File

@ -546,6 +546,11 @@ NS_IMETHODIMP nsMsgMailNewsUrl::GetQuery(char * *aQuery)
return m_baseURL->GetQuery(aQuery);
}
NS_IMETHODIMP nsMsgMailNewsUrl::GetEscapedQuery(char * *aQuery)
{
return m_baseURL->GetEscapedQuery(aQuery);
}
NS_IMETHODIMP nsMsgMailNewsUrl::SetQuery(const char *aQuery)
{
return m_baseURL->SetQuery(aQuery);

View File

@ -112,6 +112,13 @@ interface nsIURL : nsIURI
* If a file extension does not exist, the empty string is returned.
*/
attribute string fileExtension;
/**
* Returns the query portion (the part after the "?") of the URL
* without unescaping the string.
* If there isn't one, an empty string is returned.
*/
readonly attribute string escapedQuery;
};
////////////////////////////////////////////////////////////////////////////////

View File

@ -168,6 +168,12 @@ nsStdURL::GetQuery(char* *o_Query)
return GetString(o_Query, mQuery, UNESCAPED);
}
inline NS_METHOD
nsStdURL::GetEscapedQuery(char* *o_Query)
{
return GetString(o_Query, mQuery, ESCAPED);
}
inline NS_METHOD
nsStdURL::GetRef(char* *o_Ref)
{