mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 06:11:37 +00:00
Bug 968866 -- Freeze user-visible offset/type vectors r=till
This commit is contained in:
parent
1be87bc295
commit
8f90f4e630
@ -911,6 +911,12 @@ StructMetaTypeDescr::layout(JSContext *cx,
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!JSObject::freeze(cx, fieldOffsets))
|
||||
return false;
|
||||
|
||||
if (!JSObject::freeze(cx, fieldTypes))
|
||||
return false;
|
||||
|
||||
RootedValue fieldOffsetsValue(cx, ObjectValue(*fieldOffsets));
|
||||
if (!JSObject::defineProperty(cx, structType, cx->names().fieldOffsets,
|
||||
fieldOffsetsValue, nullptr, nullptr,
|
||||
|
@ -36,6 +36,10 @@ function runTests() {
|
||||
assertEq(S.fieldOffsets.y, 4);
|
||||
assertEq(S.fieldOffsets.z, 8);
|
||||
|
||||
// fieldTypes and fieldOffsets should be frozen
|
||||
assertEq(Object.isFrozen(S.fieldTypes), true);
|
||||
assertEq(Object.isFrozen(S.fieldOffsets), true);
|
||||
|
||||
if (typeof reportCompare === "function")
|
||||
reportCompare(true, true);
|
||||
print("Tests complete");
|
||||
|
Loading…
Reference in New Issue
Block a user