mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-07-24 16:55:32 +00:00
Changes FromJSVal to take a JS::HandleValue instead of JS::Value.
JS::HandleValue is basically a wrapper around a JS::Value that is safe for exact stack rooting and moving GC. I've tried to keep this changeset rather small and isolated and therefore create additional JS::Rooted<T> values at some places where the function should eventually directly take a JS::Handle<T>. The functions "CallFunction" and "CallFunctionVoid" put their arguments inside a JS::AutoValueVector because this will be passed directly to "CallFunction_" with ESR31. Refs #2462 Refs #2415 This was SVN commit r15517.
This commit is contained in:
@@ -55,12 +55,13 @@ JSFunctionSpec JSI_IGUIObject::JSI_methods[] =
|
||||
|
||||
JSBool JSI_IGUIObject::getProperty(JSContext* cx, JS::HandleObject obj, JS::HandleId id, JS::MutableHandleValue vp)
|
||||
{
|
||||
JSAutoRequest rq(cx);
|
||||
IGUIObject* e = (IGUIObject*)JS_GetInstancePrivate(cx, obj, &JSI_IGUIObject::JSI_class, NULL);
|
||||
if (!e)
|
||||
return JS_FALSE;
|
||||
|
||||
jsval idval;
|
||||
if (!JS_IdToValue(cx, id, &idval))
|
||||
JS::RootedValue idval(cx);
|
||||
if (!JS_IdToValue(cx, id, idval.address()))
|
||||
return JS_FALSE;
|
||||
|
||||
std::string propName;
|
||||
@@ -304,8 +305,9 @@ JSBool JSI_IGUIObject::setProperty(JSContext* cx, JS::HandleObject obj, JS::Hand
|
||||
if (!e)
|
||||
return JS_FALSE;
|
||||
|
||||
jsval idval;
|
||||
if (!JS_IdToValue(cx, id, &idval))
|
||||
JSAutoRequest rq(cx);
|
||||
JS::RootedValue idval(cx);
|
||||
if (!JS_IdToValue(cx, id, idval.address()))
|
||||
return JS_FALSE;
|
||||
|
||||
std::string propName;
|
||||
|
||||
Reference in New Issue
Block a user