diff --git a/source/gui/scripting/JSInterface_IGUIObject.cpp b/source/gui/scripting/JSInterface_IGUIObject.cpp index 61d5728172..64857fd2ca 100644 --- a/source/gui/scripting/JSInterface_IGUIObject.cpp +++ b/source/gui/scripting/JSInterface_IGUIObject.cpp @@ -433,7 +433,7 @@ JSBool JSI_IGUIObject::setProperty(JSContext* cx, JSObject* obj, jsval id, jsval return JS_FALSE; } } - else if (JSVAL_IS_OBJECT(*vp) && JS_GetClass(cx, JSVAL_TO_OBJECT(*vp)) == &JSI_GUISize::JSI_class) + else if (JSVAL_IS_OBJECT(*vp) && JS_InstanceOf(cx, JSVAL_TO_OBJECT(*vp), &JSI_GUISize::JSI_class, NULL)) { CClientArea area; GUI::GetSetting(e, propName, area); @@ -470,7 +470,7 @@ JSBool JSI_IGUIObject::setProperty(JSContext* cx, JSObject* obj, jsval id, jsval return JS_FALSE; } } - else if (JSVAL_IS_OBJECT(*vp) && JS_GetClass(cx, JSVAL_TO_OBJECT(*vp)) == &JSI_GUIColor::JSI_class) + else if (JSVAL_IS_OBJECT(*vp) && JS_InstanceOf(cx, JSVAL_TO_OBJECT(*vp), &JSI_GUIColor::JSI_class, NULL)) { CColor colour; JSObject* obj = JSVAL_TO_OBJECT(*vp); diff --git a/source/scripting/ScriptGlue.cpp b/source/scripting/ScriptGlue.cpp index 5dc3e1006c..aa0265d7c3 100644 --- a/source/scripting/ScriptGlue.cpp +++ b/source/scripting/ScriptGlue.cpp @@ -250,7 +250,7 @@ JSBool IssueCommand( JSContext* cx, JSObject*, uintN argc, jsval* argv, jsval* r CEntityList entities, msgEntities; - if (JS_GetClass(cx, JSVAL_TO_OBJECT(argv[0])) == &CEntity::JSI_class) + if (JS_InstanceOf(cx, JSVAL_TO_OBJECT(argv[0]), &CEntity::JSI_class, NULL)) entities.push_back( (ToNative(argv[0])) ->me); else entities = *EntityCollection::RetrieveSet(cx, JSVAL_TO_OBJECT(argv[0])); @@ -340,7 +340,7 @@ JSBool RemoveFromFormation( JSContext* cx, JSObject* UNUSED(obj), uintN argc, js JSU_REQUIRE_PARAMS(1); CEntityList entities; - if (JS_GetClass(cx, JSVAL_TO_OBJECT(argv[0])) == &CEntity::JSI_class) + if (JS_InstanceOf(cx, JSVAL_TO_OBJECT(argv[0]), &CEntity::JSI_class, NULL)) entities.push_back( (ToNative(argv[0])) ->me); else entities = *EntityCollection::RetrieveSet(cx, JSVAL_TO_OBJECT(argv[0])); diff --git a/source/scriptinterface/ScriptInterface.cpp b/source/scriptinterface/ScriptInterface.cpp index 1c6e25b16d..b8faf9f95d 100644 --- a/source/scriptinterface/ScriptInterface.cpp +++ b/source/scriptinterface/ScriptInterface.cpp @@ -467,7 +467,9 @@ bool ScriptInterface::IsExceptionPending(JSContext* cx) JSClass* ScriptInterface::GetClass(JSContext* cx, JSObject* obj) { - return JS_GetClass(cx, obj); + UNUSED2(cx); // unused if not JS_THREADSAFE + + return JS_GET_CLASS(cx, obj); } void* ScriptInterface::GetPrivate(JSContext* cx, JSObject* obj) diff --git a/source/tools/atlas/wxJS/common/apiwrap.h b/source/tools/atlas/wxJS/common/apiwrap.h index cd89991cde..3687affb35 100644 --- a/source/tools/atlas/wxJS/common/apiwrap.h +++ b/source/tools/atlas/wxJS/common/apiwrap.h @@ -107,7 +107,7 @@ namespace wxjs } } - JSClass *clazz = JS_GetClass(cx, obj); + JSClass *clazz = JS_GET_CLASS(cx, obj); if ( clazz == NULL ) return NULL; @@ -116,7 +116,7 @@ namespace wxjs obj = JS_GetPrototype(cx, obj); if ( obj == NULL ) return NULL; - clazz = JS_GetClass(cx, obj); + clazz = JS_GET_CLASS(cx, obj); if ( clazz == NULL ) return NULL; }