mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1155985 - Set FieldInto::mType just before storing to reserved slot. r=jonco, a=abillings
This commit is contained in:
parent
e423aa7681
commit
288adf212a
@ -4963,7 +4963,7 @@ StructType::DefineInternal(JSContext* cx, JSObject* typeObj_, JSObject* fieldsOb
|
||||
|
||||
// Add field name to the hash
|
||||
FieldInfo info;
|
||||
info.mType = fieldType;
|
||||
info.mType = nullptr; // Value of fields are not yet traceable here.
|
||||
info.mIndex = i;
|
||||
info.mOffset = fieldOffset;
|
||||
ASSERT_OK(fields->add(entryPtr, name, info));
|
||||
@ -4996,6 +4996,12 @@ StructType::DefineInternal(JSContext* cx, JSObject* typeObj_, JSObject* fieldsOb
|
||||
if (!SizeTojsval(cx, structSize, &sizeVal))
|
||||
return false;
|
||||
|
||||
for (FieldInfoHash::Range r = fields->all(); !r.empty(); r.popFront()) {
|
||||
FieldInfo& field = r.front().value();
|
||||
MOZ_ASSERT(field.mIndex < fieldRoots.length());
|
||||
field.mType = &fieldRoots[field.mIndex].toObject();
|
||||
}
|
||||
|
||||
JS_SetReservedSlot(typeObj, SLOT_FIELDINFO, PRIVATE_TO_JSVAL(fields.release()));
|
||||
|
||||
JS_SetReservedSlot(typeObj, SLOT_SIZE, sizeVal);
|
||||
|
14
js/src/jit-test/tests/ctypes/bug1155985.js
Normal file
14
js/src/jit-test/tests/ctypes/bug1155985.js
Normal file
@ -0,0 +1,14 @@
|
||||
function test() {
|
||||
for (let i = 0; i < 100; i++) {
|
||||
let test_struct = ctypes.StructType("test_struct", [{ "x": ctypes.int32_t },
|
||||
{ "bar": ctypes.uint32_t }]);
|
||||
|
||||
try {
|
||||
new test_struct("foo", "x");
|
||||
} catch (e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof ctypes === "object")
|
||||
test();
|
Loading…
Reference in New Issue
Block a user