forked from 0ad/0ad
SpiderMonkey 38 upgrade: 17/35
JS_GetUint*Array now takes an AutoCheckCannotGC parameter. Based on patch by leper. Addresses https://bugzilla.mozilla.org/show_bug.cgi?id=1061288 This was SVN commit r18671.
This commit is contained in:
parent
c06eda0209
commit
8747b1c098
@ -253,7 +253,11 @@ template<> void ScriptInterface::ToJSVal<Grid<u8> >(JSContext* cx, JS::MutableHa
|
||||
u32 length = (u32)(val.m_W * val.m_H);
|
||||
u32 nbytes = (u32)(length * sizeof(u8));
|
||||
JS::RootedObject objArr(cx, JS_NewUint8Array(cx, length));
|
||||
memcpy((void*)JS_GetUint8ArrayData(objArr), val.m_Data, nbytes);
|
||||
// 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);
|
||||
}
|
||||
|
||||
JS::RootedValue data(cx, JS::ObjectValue(*objArr));
|
||||
JS::RootedValue w(cx);
|
||||
@ -275,7 +279,11 @@ template<> void ScriptInterface::ToJSVal<Grid<u16> >(JSContext* cx, JS::MutableH
|
||||
u32 length = (u32)(val.m_W * val.m_H);
|
||||
u32 nbytes = (u32)(length * sizeof(u16));
|
||||
JS::RootedObject objArr(cx, JS_NewUint16Array(cx, length));
|
||||
memcpy((void*)JS_GetUint16ArrayData(objArr), val.m_Data, nbytes);
|
||||
// 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);
|
||||
}
|
||||
|
||||
JS::RootedValue data(cx, JS::ObjectValue(*objArr));
|
||||
JS::RootedValue w(cx);
|
||||
|
Loading…
Reference in New Issue
Block a user