[SM78 2/2] Update to Spidermonkey 78 APIs

This ugprades 0 A.D. to the latest ESR at the moment of writing.

Mostly straighforward API changes (see meta-Bug 1633145)
- js::Class is merged with JSClass
- JSNewArrayObject becomes JS::NewArrayObject
- ArrayObject-functions are moved to a new public header Array.h
- JSMSG error messages have again been changed, requiring some tweaks.
- AutoValueArray becomes RootedBalueArray (Bug 1634435)
- 'uneval' is behind a Realm flag (Bug 1565170), but no removal is
planned in the short-term future.
- Some minor GC API changes (Bugs 1569564 and 1633405)
- Error reporting has had some tweaks, and error flags have been removed
(Bug 1620583)
- StructuredClone are now always thread-safe, simplifying an API change
introduced in SM52 (Bug 1607791)

Tested by: Stan, Freagarach, mammadori
Closes #5861

Differential Revision: https://code.wildfiregames.com/D3168
This was SVN commit r24333.
This commit is contained in:
wraitii
2020-12-06 14:03:02 +00:00
parent 6da64bf354
commit d92a2118b0
30 changed files with 91 additions and 100 deletions
@@ -163,7 +163,7 @@ template<> void ScriptInterface::ToJSVal<CFixedVector3D>(const ScriptRequest& rq
if (!JS_GetProperty(rq.cx, global, "Vector3D", &valueVector3D))
FAIL_VOID("Failed to get Vector3D constructor");
JS::AutoValueArray<3> args(rq.cx);
JS::RootedValueArray<3> args(rq.cx);
args[0].setNumber(val.X.ToDouble());
args[1].setNumber(val.Y.ToDouble());
args[2].setNumber(val.Z.ToDouble());
@@ -199,7 +199,7 @@ template<> void ScriptInterface::ToJSVal<CFixedVector2D>(const ScriptRequest& rq
if (!JS_GetProperty(rq.cx, global, "Vector2D", &valueVector2D))
FAIL_VOID("Failed to get Vector2D constructor");
JS::AutoValueArray<2> args(rq.cx);
JS::RootedValueArray<2> args(rq.cx);
args[0].setNumber(val.X.ToDouble());
args[1].setNumber(val.Y.ToDouble());
@@ -259,11 +259,11 @@ template<> bool ScriptInterface::FromJSVal<TNSpline>(const ScriptRequest& rq, J
JS::RootedObject obj(rq.cx, &v.toObject());
bool isArray;
if (!JS_IsArrayObject(rq.cx, obj, &isArray) || !isArray)
if (!JS::IsArrayObject(rq.cx, obj, &isArray) || !isArray)
FAIL("Argument must be an array");
u32 numberOfNodes = 0;
if (!JS_GetArrayLength(rq.cx, obj, &numberOfNodes))
if (!JS::GetArrayLength(rq.cx, obj, &numberOfNodes))
FAIL("Failed to get array length");
for (u32 i = 0; i < numberOfNodes; ++i)