Fixing bug 88933, oriblems with setting event handlers on select elements from JS. r=hidday@geocities.com, sr=brendan@mozilla.org

git-svn-id: svn://10.0.0.236/trunk@98981 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
jst%netscape.com
2001-07-10 07:31:31 +00:00
parent ee8f0d7001
commit 7ba13a2567

View File

@@ -2644,23 +2644,23 @@ nsHTMLSelectElementSH::SetProperty(nsIXPConnectWrappedNative *wrapper,
{
int32 n = GetArrayIndexFromId(cx, id);
if (n < 0) {
return NS_OK;
if (n >= 0) {
nsCOMPtr<nsISupports> native;
wrapper->GetNative(getter_AddRefs(native));
nsCOMPtr<nsIDOMHTMLSelectElement> select(do_QueryInterface(native));
NS_ENSURE_TRUE(select, NS_ERROR_UNEXPECTED);
nsCOMPtr<nsIDOMHTMLCollection> options;
select->GetOptions(getter_AddRefs(options));
nsCOMPtr<nsIDOMNSHTMLOptionCollection> oc(do_QueryInterface(options));
NS_ENSURE_TRUE(oc, NS_ERROR_UNEXPECTED);
return SetOption(cx, vp, n, oc);
}
nsCOMPtr<nsISupports> native;
wrapper->GetNative(getter_AddRefs(native));
nsCOMPtr<nsIDOMHTMLSelectElement> select(do_QueryInterface(native));
NS_ENSURE_TRUE(select, NS_ERROR_UNEXPECTED);
nsCOMPtr<nsIDOMHTMLCollection> options;
select->GetOptions(getter_AddRefs(options));
nsCOMPtr<nsIDOMNSHTMLOptionCollection> oc(do_QueryInterface(options));
NS_ENSURE_TRUE(oc, NS_ERROR_UNEXPECTED);
return SetOption(cx, vp, n, oc);
return nsElementSH::SetProperty(wrapper, cx, obj, id, vp, _retval);
}