Index: ps/trunk/source/scriptinterface/ScriptConversions.h =================================================================== --- ps/trunk/source/scriptinterface/ScriptConversions.h +++ ps/trunk/source/scriptinterface/ScriptConversions.h @@ -86,13 +86,13 @@ return FromJSVal_vector(cx, v, out); \ } -template static bool FromJSProperty(JSContext* cx, JS::HandleValue v, const char* name, T& out) +template bool ScriptInterface::FromJSProperty(JSContext* cx, const JS::HandleValue val, const char* name, T& ret) { - if (!v.isObject()) + if (!val.isObject()) return false; JSAutoRequest rq(cx); - JS::RootedObject obj(cx, &v.toObject()); + JS::RootedObject obj(cx, &val.toObject()); bool hasProperty; if (!JS_HasProperty(cx, obj, name, &hasProperty) || !hasProperty) @@ -102,7 +102,7 @@ if (!JS_GetProperty(cx, obj, name, &value)) return false; - return ScriptInterface::FromJSVal(cx, value, out); + return FromJSVal(cx, value, ret); } #endif //INCLUDED_SCRIPTCONVERSIONS Index: ps/trunk/source/scriptinterface/ScriptInterface.h =================================================================== --- ps/trunk/source/scriptinterface/ScriptInterface.h +++ ps/trunk/source/scriptinterface/ScriptInterface.h @@ -283,6 +283,11 @@ template static void ToJSVal(JSContext* cx, JS::MutableHandleValue ret, T const& val); /** + * Convert a named property of an object to a C++ type. + */ + template static bool FromJSProperty(JSContext* cx, const JS::HandleValue val, const char* name, T& ret); + + /** * MaybeGC tries to determine whether garbage collection in cx's runtime would free up enough memory to be worth the amount of time it would take. * This calls JS_MaybeGC directly, which does not do incremental GC. Usually you should prefer MaybeIncrementalRuntimeGC. */