Bug 342677: select.options.add(null) crashes, patch by Alex Vincent <ajvincent@gmail.com>, r+sr=jst

This commit is contained in:
gavin%gavinsharp.com 2006-06-26 22:06:48 +00:00
parent 76328ca782
commit e93d1088d8

View File

@ -9654,11 +9654,16 @@ nsHTMLOptionsCollectionSH::Add(JSContext *cx, JSObject *obj, uintN argc,
nsCOMPtr<nsIDOMHTMLOptionsCollection> options(do_QueryWrappedNative(wrapper));
NS_ASSERTION(options, "native should have been an options collection");
if (argc < 1 || !JSVAL_IS_OBJECT(argv[0])) {
if (argc < 1) {
nsDOMClassInfo::ThrowJSException(cx, NS_ERROR_XPC_NOT_ENOUGH_ARGS);
return JS_FALSE;
}
if (JSVAL_IS_PRIMITIVE(argv[0])) {
nsDOMClassInfo::ThrowJSException(cx, NS_ERROR_DOM_WRONG_TYPE_ERR);
return JS_FALSE;
}
rv = sXPConnect->GetWrappedNativeOfJSObject(cx, JSVAL_TO_OBJECT(argv[0]),
getter_AddRefs(wrapper));