1
0
forked from 0ad/0ad

Reduce use of strongly-discouraged JS_ValueToFunction

This was SVN commit r7636.
This commit is contained in:
Ykkrosh 2010-06-27 11:55:49 +00:00
parent 786bd5d11a
commit 97a1b7dc2d

View File

@ -297,7 +297,7 @@ JSBool JSI_IGUIObject::setProperty(JSContext* cx, JSObject* obj, jsval id, jsval
// Use onWhatever to set event handlers
if (propName.Left(2) == "on")
{
if (!JSVAL_IS_OBJECT(*vp) || !JS_ValueToFunction(cx, *vp))
if (!JSVAL_IS_OBJECT(*vp) || !JS_ObjectIsFunction(cx, JSVAL_TO_OBJECT(*vp)))
{
JS_ReportError(cx, "on- event-handlers must be functions");
return JS_FALSE;