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:
Родитель
09d11385d5
Коммит
61ea5cf938
|
@ -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;
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче