diff --git a/js/src/ctypes/CTypes.cpp b/js/src/ctypes/CTypes.cpp index 2fe4187fbfb..640434db8d6 100644 --- a/js/src/ctypes/CTypes.cpp +++ b/js/src/ctypes/CTypes.cpp @@ -4963,7 +4963,7 @@ StructType::DefineInternal(JSContext* cx, JSObject* typeObj_, JSObject* fieldsOb // Add field name to the hash FieldInfo info; - info.mType = nullptr; // Value of fields are not yet traceable here. + info.mType = fieldType; info.mIndex = i; info.mOffset = fieldOffset; ASSERT_OK(fields->add(entryPtr, name, info)); @@ -4996,12 +4996,6 @@ 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); diff --git a/js/src/jit-test/tests/ctypes/bug1155985.js b/js/src/jit-test/tests/ctypes/bug1155985.js deleted file mode 100644 index 54c24d4badf..00000000000 --- a/js/src/jit-test/tests/ctypes/bug1155985.js +++ /dev/null @@ -1,14 +0,0 @@ -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();