Fixing bug 100944, making a.search and area.search settable for backwards compatibility. Patch by Fabian Guisset <hidday@geocities.com>, r=bzbarsky@mit.edu, sr=jst@netscape.com

This commit is contained in:
jst%netscape.com 2001-10-26 08:54:45 +00:00
Родитель 09d11385d5
Коммит 61ea5cf938
4 изменённых файлов: 57 добавлений и 2 удалений

Просмотреть файл

@ -632,6 +632,34 @@ nsHTMLAnchorElement::GetSearch(nsAWritableString& aSearch)
return result;
}
NS_IMETHODIMP
nsHTMLAnchorElement::SetSearch(const nsAReadableString& aSearch)
{
nsAutoString href;
nsresult rv = GetHref(href);
if (NS_SUCCEEDED(rv)) {
nsCOMPtr<nsIURI> uri;
rv = NS_NewURI(getter_AddRefs(uri), href);
if (uri) {
nsCOMPtr<nsIURL> url(do_QueryInterface(uri, &rv));
if (url) {
rv = url->SetQuery(NS_ConvertUCS2toUTF8(aSearch).get());
nsXPIDLCString newHref;
uri->GetSpec(getter_Copies(newHref));
SetHref(NS_ConvertUTF8toUCS2(newHref));
}
}
}
return rv;
}
NS_IMETHODIMP
nsHTMLAnchorElement::GetPort(nsAWritableString& aPort)
{

Просмотреть файл

@ -422,6 +422,33 @@ nsHTMLAreaElement::GetSearch(nsAWritableString& aSearch)
return result;
}
NS_IMETHODIMP
nsHTMLAreaElement::SetSearch(const nsAReadableString& aSearch)
{
nsAutoString href;
nsresult rv = GetHref(href);
if (NS_SUCCEEDED(rv)) {
nsCOMPtr<nsIURI> uri;
rv = NS_NewURI(getter_AddRefs(uri), href);
if (uri) {
nsCOMPtr<nsIURL> url(do_QueryInterface(uri, &rv));
if (url) {
rv = url->SetQuery(NS_ConvertUCS2toUTF8(aSearch).get());
nsXPIDLCString newHref;
uri->GetSpec(getter_Copies(newHref));
SetHref(NS_ConvertUTF8toUCS2(newHref));
}
}
}
return rv;
}
NS_IMETHODIMP
nsHTMLAreaElement::GetPort(nsAWritableString& aPort)
{

Просмотреть файл

@ -47,7 +47,7 @@ interface nsIDOMNSHTMLAnchorElement : nsISupports
readonly attribute DOMString host;
readonly attribute DOMString hostname;
readonly attribute DOMString pathname;
readonly attribute DOMString search;
attribute DOMString search;
readonly attribute DOMString port;
readonly attribute DOMString hash;
readonly attribute DOMString text;

Просмотреть файл

@ -47,7 +47,7 @@ interface nsIDOMNSHTMLAreaElement : nsISupports
readonly attribute DOMString host;
readonly attribute DOMString hostname;
readonly attribute DOMString pathname;
readonly attribute DOMString search;
attribute DOMString search;
readonly attribute DOMString port;
readonly attribute DOMString hash;
};