Exact stack rooting for GetClass and GetPrivate.
Refs #2415 This was SVN commit r15606.
This commit is contained in:
parent
169174824f
commit
f4d62152e7
@ -113,8 +113,9 @@ BOOST_PP_REPEAT(SCRIPT_INTERFACE_MAX_ARGS, OVERLOADS, ~)
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp); \
|
||||
JSAutoRequest rq(cx); \
|
||||
SCRIPT_PROFILE \
|
||||
if (ScriptInterface::GetClass(JS_THIS_OBJECT(cx, vp)) != CLS) return false; \
|
||||
TC* c = static_cast<TC*>(ScriptInterface::GetPrivate(JS_THIS_OBJECT(cx, vp))); \
|
||||
JS::RootedObject thisObj(cx, JS_THIS_OBJECT(cx, vp)); \
|
||||
if (ScriptInterface::GetClass(thisObj) != CLS) return false; \
|
||||
TC* c = static_cast<TC*>(ScriptInterface::GetPrivate(thisObj)); \
|
||||
if (! c) return false; \
|
||||
BOOST_PP_REPEAT_##z (i, CONVERT_ARG, ~) \
|
||||
JS::RootedValue rval(cx); \
|
||||
|
@ -1375,12 +1375,12 @@ bool ScriptInterface::IsExceptionPending(JSContext* cx)
|
||||
return JS_IsExceptionPending(cx) ? true : false;
|
||||
}
|
||||
|
||||
JSClass* ScriptInterface::GetClass(JSObject* obj)
|
||||
JSClass* ScriptInterface::GetClass(JS::HandleObject obj)
|
||||
{
|
||||
return JS_GetClass(obj);
|
||||
}
|
||||
|
||||
void* ScriptInterface::GetPrivate(JSObject* obj)
|
||||
void* ScriptInterface::GetPrivate(JS::HandleObject obj)
|
||||
{
|
||||
// TODO: use JS_GetInstancePrivate
|
||||
return JS_GetPrivate(obj);
|
||||
|
@ -414,8 +414,8 @@ private:
|
||||
bool GetProperty_(JS::HandleValue obj, const char* name, JS::MutableHandleValue out);
|
||||
bool GetPropertyInt_(JS::HandleValue obj, int name, JS::MutableHandleValue value);
|
||||
static bool IsExceptionPending(JSContext* cx);
|
||||
static JSClass* GetClass(JSObject* obj);
|
||||
static void* GetPrivate(JSObject* obj);
|
||||
static JSClass* GetClass(JS::HandleObject obj);
|
||||
static void* GetPrivate(JS::HandleObject obj);
|
||||
|
||||
class CustomType
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user