diff --git a/source/gui/scripting/GuiScriptConversions.cpp b/source/gui/scripting/GuiScriptConversions.cpp index f92423b0b3..b2a83c1aed 100644 --- a/source/gui/scripting/GuiScriptConversions.cpp +++ b/source/gui/scripting/GuiScriptConversions.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2014 Wildfire Games. +/* Copyright (C) 2016 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -46,7 +46,7 @@ template<> void ScriptInterface::ToJSVal(JSContext* cx, JS::MutableH default: typeName = "(unknown)"; break; } - JS::RootedObject obj(cx, JS_NewObject(cx, nullptr, JS::NullPtr(), JS::NullPtr())); + JS::RootedObject obj(cx, JS_NewPlainObject(cx)); if (!obj) { ret.setUndefined(); @@ -63,7 +63,7 @@ template<> void ScriptInterface::ToJSVal(JSContext* cx, JS::MutableH // SET(obj, "which", (int)val.ev.key.which); // (not in wsdl.h) // SET(obj, "state", (int)val.ev.key.state); // (not in wsdl.h) - JS::RootedObject keysym(cx, JS_NewObject(cx, nullptr, JS::NullPtr(), JS::NullPtr())); + JS::RootedObject keysym(cx, JS_NewPlainObject(cx)); if (!keysym) { ret.setUndefined(); diff --git a/source/gui/scripting/JSInterface_IGUIObject.cpp b/source/gui/scripting/JSInterface_IGUIObject.cpp index 34175f6012..cfee79a069 100644 --- a/source/gui/scripting/JSInterface_IGUIObject.cpp +++ b/source/gui/scripting/JSInterface_IGUIObject.cpp @@ -690,7 +690,7 @@ bool JSI_IGUIObject::getComputedSize(JSContext* cx, uint UNUSED(argc), jsval* vp e->UpdateCachedSize(); CRect size = e->m_CachedActualSize; - JS::RootedValue objVal(cx, JS::ObjectValue(*JS_NewObject(cx, nullptr, JS::NullPtr(), JS::NullPtr()))); + JS::RootedValue objVal(cx, JS::ObjectValue(*JS_NewPlainObject(cx))); try { ScriptInterface* pScriptInterface = ScriptInterface::GetScriptInterfaceAndCBData(cx)->pScriptInterface; diff --git a/source/ps/scripting/JSInterface_Mod.cpp b/source/ps/scripting/JSInterface_Mod.cpp index 1e5aa3160c..874b85b6f5 100644 --- a/source/ps/scripting/JSInterface_Mod.cpp +++ b/source/ps/scripting/JSInterface_Mod.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2014 Wildfire Games. +/* Copyright (C) 2015 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -49,7 +49,7 @@ JS::Value JSI_Mod::GetAvailableMods(ScriptInterface::CxPrivate* pCxPrivate) ScriptInterface* scriptInterface = pCxPrivate->pScriptInterface; JSContext* cx = scriptInterface->GetContext(); JSAutoRequest rq(cx); - JS::RootedObject obj(cx, JS_NewObject(cx, nullptr, JS::NullPtr(), JS::NullPtr())); + JS::RootedObject obj(cx, JS_NewPlainObject(cx)); const Paths paths(g_args); diff --git a/source/scriptinterface/tests/test_ObjectToIDMap.h b/source/scriptinterface/tests/test_ObjectToIDMap.h index e4b5f8a773..397a323b91 100644 --- a/source/scriptinterface/tests/test_ObjectToIDMap.h +++ b/source/scriptinterface/tests/test_ObjectToIDMap.h @@ -30,7 +30,7 @@ public: JSContext* cx = script.GetContext(); JSAutoRequest rq(cx); - JS::RootedObject obj(cx, JS_NewObject(cx, nullptr, JS::NullPtr(), JS::NullPtr())); + JS::RootedObject obj(cx, JS_NewPlainObject(cx)); ObjectIdCache map(g_ScriptRuntime); map.init(); diff --git a/source/simulation2/components/ICmpFootprint.cpp b/source/simulation2/components/ICmpFootprint.cpp index 75e00636c1..2fcfa71ee6 100644 --- a/source/simulation2/components/ICmpFootprint.cpp +++ b/source/simulation2/components/ICmpFootprint.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2010 Wildfire Games. +/* Copyright (C) 2015 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -33,7 +33,7 @@ JS::Value ICmpFootprint::GetShape_wrapper() JSContext* cx = GetSimContext().GetScriptInterface().GetContext(); JSAutoRequest rq(cx); - JS::RootedObject obj(cx, JS_NewObject(cx, nullptr, JS::NullPtr(), JS::NullPtr())); + JS::RootedObject obj(cx, JS_NewPlainObject(cx)); if (!obj) return JS::UndefinedValue(); diff --git a/source/simulation2/scripting/EngineScriptConversions.cpp b/source/simulation2/scripting/EngineScriptConversions.cpp index 1006329441..5389eb68b3 100644 --- a/source/simulation2/scripting/EngineScriptConversions.cpp +++ b/source/simulation2/scripting/EngineScriptConversions.cpp @@ -113,7 +113,7 @@ template<> bool ScriptInterface::FromJSVal(JSContext* cx, JS::HandleValu template<> void ScriptInterface::ToJSVal(JSContext* cx, JS::MutableHandleValue ret, CColor const& val) { JSAutoRequest rq(cx); - JS::RootedObject obj(cx, JS_NewObject(cx, nullptr, JS::NullPtr(), JS::NullPtr())); + JS::RootedObject obj(cx, JS_NewPlainObject(cx)); if (!obj) { ret.setUndefined(); @@ -261,7 +261,7 @@ template<> void ScriptInterface::ToJSVal >(JSContext* cx, JS::MutableHa ScriptInterface::ToJSVal(cx, &w, val.m_W); ScriptInterface::ToJSVal(cx, &h, val.m_H); - JS::RootedObject obj(cx, JS_NewObject(cx, nullptr, JS::NullPtr(), JS::NullPtr())); + JS::RootedObject obj(cx, JS_NewPlainObject(cx)); JS_SetProperty(cx, obj, "width", w); JS_SetProperty(cx, obj, "height", h); JS_SetProperty(cx, obj, "data", data); @@ -283,7 +283,7 @@ template<> void ScriptInterface::ToJSVal >(JSContext* cx, JS::MutableH ScriptInterface::ToJSVal(cx, &w, val.m_W); ScriptInterface::ToJSVal(cx, &h, val.m_H); - JS::RootedObject obj(cx, JS_NewObject(cx, nullptr, JS::NullPtr(), JS::NullPtr())); + JS::RootedObject obj(cx, JS_NewPlainObject(cx)); JS_SetProperty(cx, obj, "width", w); JS_SetProperty(cx, obj, "height", h); JS_SetProperty(cx, obj, "data", data); diff --git a/source/simulation2/scripting/MessageTypeConversions.cpp b/source/simulation2/scripting/MessageTypeConversions.cpp index 01518a4d2c..cb55a17d9a 100644 --- a/source/simulation2/scripting/MessageTypeConversions.cpp +++ b/source/simulation2/scripting/MessageTypeConversions.cpp @@ -24,7 +24,7 @@ #define TOJSVAL_SETUP() \ JSContext* cx = scriptInterface.GetContext(); \ JSAutoRequest rq(cx); \ - JS::RootedObject obj(cx, JS_NewObject(cx, nullptr, JS::NullPtr(), JS::NullPtr())); \ + JS::RootedObject obj(cx, JS_NewPlainObject(cx)); \ if (!obj) \ return JS::UndefinedValue(); diff --git a/source/simulation2/serialization/StdDeserializer.cpp b/source/simulation2/serialization/StdDeserializer.cpp index 83e5b474eb..d86f8c587e 100644 --- a/source/simulation2/serialization/StdDeserializer.cpp +++ b/source/simulation2/serialization/StdDeserializer.cpp @@ -38,7 +38,7 @@ CStdDeserializer::CStdDeserializer(ScriptInterface& scriptInterface, std::istrea // Add a dummy tag because the serializer uses the tag 0 to indicate that a value // needs to be serialized and then tagged - m_dummyObject = JS_NewObject(cx, nullptr, JS::NullPtr(), JS::NullPtr()); + m_dummyObject = JS_NewPlainObject(cx); m_ScriptBackrefs.push_back(JS::Heap(m_dummyObject)); } @@ -172,7 +172,7 @@ jsval CStdDeserializer::ReadScriptVal(const char* UNUSED(name), JS::HandleObject } else if (type == SCRIPT_TYPE_OBJECT) { - obj.set(JS_NewObject(cx, nullptr, JS::NullPtr(), JS::NullPtr())); + obj.set(JS_NewPlainObject(cx)); } else // SCRIPT_TYPE_OBJECT_PROTOTYPE { diff --git a/source/simulation2/system/ParamNode.cpp b/source/simulation2/system/ParamNode.cpp index 173117b856..26f09a1f8d 100644 --- a/source/simulation2/system/ParamNode.cpp +++ b/source/simulation2/system/ParamNode.cpp @@ -376,7 +376,7 @@ void CParamNode::ConstructJSVal(JSContext* cx, JS::MutableHandleValue ret) const // Got child nodes - convert this node into a hash-table-style object: - JS::RootedObject obj(cx, JS_NewObject(cx, nullptr, JS::NullPtr(), JS::NullPtr())); + JS::RootedObject obj(cx, JS_NewPlainObject(cx)); if (!obj) { ret.setUndefined();