diff --git a/dom/base/nsDOMClassInfo.cpp b/dom/base/nsDOMClassInfo.cpp index a17522cec51..b95942868a1 100644 --- a/dom/base/nsDOMClassInfo.cpp +++ b/dom/base/nsDOMClassInfo.cpp @@ -9824,12 +9824,7 @@ nsHTMLPluginObjElementSH::GetProperty(nsIXPConnectWrappedNative *wrapper, JSBool found = PR_FALSE; if (!ObjectIsNativeWrapper(cx, obj)) { - if (JSID_IS_STRING(id)) { - *_retval = ::JS_HasPropertyById(cx, pi_obj, id, &found); - } else { - *_retval = ::JS_HasElement(cx, pi_obj, JSID_TO_INT(id), &found); - } - + *_retval = ::JS_HasPropertyById(cx, pi_obj, id, &found); if (!*_retval) { return NS_ERROR_UNEXPECTED; } @@ -9863,12 +9858,7 @@ nsHTMLPluginObjElementSH::SetProperty(nsIXPConnectWrappedNative *wrapper, JSBool found = PR_FALSE; if (!ObjectIsNativeWrapper(cx, obj)) { - if (JSID_IS_STRING(id)) { - *_retval = ::JS_HasPropertyById(cx, pi_obj, id, &found); - } else { - *_retval = ::JS_HasElement(cx, pi_obj, JSID_TO_INT(id), &found); - } - + *_retval = ::JS_HasPropertyById(cx, pi_obj, id, &found); if (!*_retval) { return NS_ERROR_UNEXPECTED; } diff --git a/js/src/jsapi.cpp b/js/src/jsapi.cpp index 699bbd134bd..5ca4f2b6c49 100644 --- a/js/src/jsapi.cpp +++ b/js/src/jsapi.cpp @@ -3294,9 +3294,13 @@ JS_HasPropertyById(JSContext *cx, JSObject *obj, jsid id, JSBool *foundp) } JS_PUBLIC_API(JSBool) -JS_HasElement(JSContext *cx, JSObject *obj, jsint index, JSBool *foundp) +JS_HasElement(JSContext *cx, JSObject *obj, uint32 index, JSBool *foundp) { - return JS_HasPropertyById(cx, obj, INT_TO_JSID(index), foundp); + CHECK_REQUEST(cx); + jsid id; + if (!IndexToId(cx, index, &id)) + return false; + return JS_HasPropertyById(cx, obj, id, foundp); } JS_PUBLIC_API(JSBool) diff --git a/js/src/jsapi.h b/js/src/jsapi.h index c16137debdc..1371b9968de 100644 --- a/js/src/jsapi.h +++ b/js/src/jsapi.h @@ -2493,7 +2493,7 @@ extern JS_PUBLIC_API(JSBool) JS_AlreadyHasOwnElement(JSContext *cx, JSObject *obj, uint32 index, JSBool *foundp); extern JS_PUBLIC_API(JSBool) -JS_HasElement(JSContext *cx, JSObject *obj, jsint index, JSBool *foundp); +JS_HasElement(JSContext *cx, JSObject *obj, uint32 index, JSBool *foundp); extern JS_PUBLIC_API(JSBool) JS_LookupElement(JSContext *cx, JSObject *obj, jsint index, jsval *vp);