Upgrade SpiderMonkey to version 45.0.2, refs #4893.

- Various build changes, in particular NSPR is not needed on Unix
anymore
- Add js/Initialization.h to source/scriptinterface/ScriptEngine.h
- Use nullptr instead of JS::NullPtr(), see
https://bugzilla.mozilla.org/show_bug.cgi?id=1164602
- Remove `JS::RuntimeOptionsRef.varObjFix`, see
https://bugzilla.mozilla.org/show_bug.cgi?id=1171177
- Remove uses of `AutoIdArray`, see
https://bugzilla.mozilla.org/show_bug.cgi?id=1191529
- `JS_InternUCStringN` has been renamed, see
https://bugzilla.mozilla.org/show_bug.cgi?id=1178581
- `JS::Evaluate` now takes scope chains explicitly, see
https://bugzilla.mozilla.org/show_bug.cgi?id=1097987
- Array functions (such as `JS_IsArrayObject`) are fallible and output
to params, see https://bugzilla.mozilla.org/show_bug.cgi?id=f3d35d8
- Remove `JSCLASS_CACHED_PROTO_WIDTH` workaround in our code, see
https://bugzilla.mozilla.org/show_bug.cgi?id=1236373
- Remove compile'n go (`setCompileAndGo`) and replace it by
`setIsRunOnce` which will become the default in the future, see
https://bugzilla.mozilla.org/show_bug.cgi?id=679939
- Mark shared memory in direct access operations
(`JS_GetUint16ArrayData` and `JS_GetUint8ArrayData`), see
https://bugzilla.mozilla.org/show_bug.cgi?id=1176214
- Use new `JS::ObjectOpResult`, see
https://bugzilla.mozilla.org/show_bug.cgi?id=1113369

Thanks to wraitii, elexis, Krinkle and historic_bruno for contributions
and comments, and to gentz, madpilot, s0600204 and Stan for testing and
indirect contributions.

Differential Revision: https://code.wildfiregames.com/D1510
This was SVN commit r22627.
This commit is contained in:
Itms
2019-08-07 22:37:43 +00:00
parent 7876ca7acb
commit 64b477625d
18 changed files with 99 additions and 135 deletions
@@ -241,7 +241,8 @@ template<> void ScriptInterface::ToJSVal<Grid<u8> >(JSContext* cx, JS::MutableHa
// Copy the array data and then remove the no-GC check to allow further changes to the JS data
{
JS::AutoCheckCannotGC nogc;
memcpy((void*)JS_GetUint8ArrayData(objArr, nogc), val.m_Data, nbytes);
bool sharedMemory;
memcpy((void*)JS_GetUint8ArrayData(objArr, &sharedMemory, nogc), val.m_Data, nbytes);
}
JS::RootedValue data(cx, JS::ObjectValue(*objArr));
@@ -267,7 +268,8 @@ template<> void ScriptInterface::ToJSVal<Grid<u16> >(JSContext* cx, JS::MutableH
// Copy the array data and then remove the no-GC check to allow further changes to the JS data
{
JS::AutoCheckCannotGC nogc;
memcpy((void*)JS_GetUint16ArrayData(objArr, nogc), val.m_Data, nbytes);
bool sharedMemory;
memcpy((void*)JS_GetUint16ArrayData(objArr, &sharedMemory, nogc), val.m_Data, nbytes);
}
JS::RootedValue data(cx, JS::ObjectValue(*objArr));
@@ -291,7 +293,8 @@ template<> bool ScriptInterface::FromJSVal<TNSpline>(JSContext* cx, JS::HandleVa
JSAutoRequest rq(cx);
JS::RootedObject obj(cx, &v.toObject());
if (!JS_IsArrayObject(cx, obj))
bool isArray;
if (!JS_IsArrayObject(cx, obj, &isArray) || !isArray)
FAIL("Argument must be an array");
u32 numberOfNodes = 0;