Bug 789812 - Change immutability behavior to match that of frozen Objects (r=jwalden)

This commit is contained in:
Shu-yu Guo 2012-09-21 21:06:12 -07:00
parent 050398a519
commit 41a64b55c5
8 changed files with 202 additions and 90 deletions

View File

@ -226,6 +226,13 @@ ArrayLikeToIndexVector(JSContext *cx, HandleObject obj, IndexVector &indices)
return true;
}
static inline bool
IdIsInBoundsIndex(JSContext *cx, HandleObject obj, HandleId id)
{
uint32_t i;
return js_IdIsIndex(id, &i) && i < ParallelArrayObject::as(obj)->outermostDimension();
}
template <bool impl(JSContext *, CallArgs)>
static inline
JSBool NonGenericMethod(JSContext *cx, unsigned argc, Value *vp)
@ -820,7 +827,7 @@ Class ParallelArrayObject::class_ = {
getGeneric,
getProperty,
getElement,
NULL, // getElementIfPresent
getElementIfPresent,
getSpecial,
setGeneric,
setProperty,
@ -1034,6 +1041,15 @@ ParallelArrayObject::create(JSContext *cx, HandleObject buffer, uint32_t offset,
result->setSlot(SLOT_BUFFER, ObjectValue(*buffer));
result->setSlot(SLOT_BUFFER_OFFSET, Int32Value(static_cast<int32_t>(offset)));
// ParallelArray objects are frozen, so mark it as non-extensible here.
Shape *empty = EmptyShape::getInitialShape(cx, &class_,
result->getProto(), result->getParent(),
result->getAllocKind(),
BaseShape::NOT_EXTENSIBLE);
if (!empty)
return false;
result->setLastPropertyInfallible(empty);
// This is usually args.rval() from build or construct.
vp.setObject(*result);
@ -1430,7 +1446,14 @@ ParallelArrayObject::get(JSContext *cx, CallArgs args)
bool
ParallelArrayObject::dimensionsGetter(JSContext *cx, CallArgs args)
{
args.rval().setObject(*(as(&args.thisv().toObject())->dimensionArray()));
RootedObject dimArray(cx, as(&args.thisv().toObject())->dimensionArray());
RootedObject copy(cx, NewDenseCopiedArray(cx, dimArray->getDenseArrayInitializedLength(),
dimArray->getDenseArrayElements()));
if (!copy)
return false;
// Reuse the existing dimension array's type.
copy->setType(dimArray->type());
args.rval().setObject(*copy);
return true;
}
@ -1507,7 +1530,7 @@ ParallelArrayObject::toStringBufferImpl(JSContext *cx, IndexInfo &iv, bool useLo
if (!elem->isNullOrUndefined()) {
if (useLocale) {
tmp = *elem;
JSObject *robj = ToObject(cx, tmp);
RootedObject robj(cx, ToObject(cx, tmp));
if (!robj)
return false;
@ -1589,12 +1612,6 @@ ParallelArrayObject::lookupGeneric(JSContext *cx, HandleObject obj, HandleId id,
if (js_IdIsIndex(id, &i))
return lookupElement(cx, obj, i, objp, propp);
if (JSID_IS_ATOM(id, cx->names().length)) {
MarkNonNativePropertyFound(obj, propp);
objp.set(obj);
return true;
}
RootedObject proto(cx, obj->getProto());
if (proto)
return JSObject::lookupGeneric(cx, proto, id, objp, propp);
@ -1637,11 +1654,27 @@ ParallelArrayObject::lookupSpecial(JSContext *cx, HandleObject obj, HandleSpecia
}
JSBool
ParallelArrayObject::defineGeneric(JSContext *cx, HandleObject obj, HandleId id, HandleValue Value,
ParallelArrayObject::defineGeneric(JSContext *cx, HandleObject obj, HandleId id, HandleValue value,
JSPropertyOp getter, StrictPropertyOp setter, unsigned attrs)
{
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_PAR_ARRAY_IMMUTABLE);
return false;
uint32_t i;
if (js_IdIsIndex(id, &i) && i < as(obj)->outermostDimension()) {
RootedValue existingValue(cx);
if (!as(obj)->getParallelArrayElement(cx, i, &existingValue))
return false;
bool same;
if (!SameValue(cx, value, existingValue, &same))
return false;
if (!same)
return Throw(cx, id, JSMSG_CANT_REDEFINE_PROP);
} else {
RootedValue tmp(cx, value);
if (!setGeneric(cx, obj, id, &tmp, true))
return false;
}
return setGenericAttributes(cx, obj, id, &attrs);
}
JSBool
@ -1649,8 +1682,8 @@ ParallelArrayObject::defineProperty(JSContext *cx, HandleObject obj,
HandlePropertyName name, HandleValue value,
JSPropertyOp getter, StrictPropertyOp setter, unsigned attrs)
{
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_PAR_ARRAY_IMMUTABLE);
return false;
RootedId id(cx, NameToId(name));
return defineGeneric(cx, obj, id, value, getter, setter, attrs);
}
JSBool
@ -1658,8 +1691,10 @@ ParallelArrayObject::defineElement(JSContext *cx, HandleObject obj,
uint32_t index, HandleValue value,
PropertyOp getter, StrictPropertyOp setter, unsigned attrs)
{
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_PAR_ARRAY_IMMUTABLE);
return false;
RootedId id(cx);
if (!IndexToId(cx, index, id.address()))
return false;
return defineGeneric(cx, obj, id, value, getter, setter, attrs);
}
JSBool
@ -1667,20 +1702,24 @@ ParallelArrayObject::defineSpecial(JSContext *cx, HandleObject obj,
HandleSpecialId sid, HandleValue value,
PropertyOp getter, StrictPropertyOp setter, unsigned attrs)
{
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_PAR_ARRAY_IMMUTABLE);
return false;
RootedId id(cx, SPECIALID_TO_JSID(sid));
return defineGeneric(cx, obj, id, value, getter, setter, attrs);
}
JSBool
ParallelArrayObject::getGeneric(JSContext *cx, HandleObject obj, HandleObject receiver,
HandleId id, MutableHandleValue vp)
{
Value idval = IdToValue(id);
RootedValue idval(cx, IdToValue(id));
uint32_t index;
if (IsDefinitelyIndex(idval, &index))
return getElement(cx, obj, receiver, index, vp);
Rooted<SpecialId> sid(cx);
if (ValueIsSpecial(obj, &idval, sid.address(), cx))
return getSpecial(cx, obj, receiver, sid, vp);
JSAtom *atom = ToAtom(cx, idval);
if (!atom)
return false;
@ -1696,11 +1735,6 @@ JSBool
ParallelArrayObject::getProperty(JSContext *cx, HandleObject obj, HandleObject receiver,
HandlePropertyName name, MutableHandleValue vp)
{
if (name == cx->names().length) {
vp.setNumber(as(obj)->outermostDimension());
return true;
}
RootedObject proto(cx, obj->getProto());
if (proto)
return JSObject::getProperty(cx, proto, receiver, name, vp);
@ -1718,6 +1752,23 @@ ParallelArrayObject::getElement(JSContext *cx, HandleObject obj, HandleObject re
return as(obj)->getParallelArrayElement(cx, index, vp);
}
JSBool
ParallelArrayObject::getElementIfPresent(JSContext *cx, HandleObject obj, HandleObject receiver,
uint32_t index, MutableHandleValue vp, bool *present)
{
RootedParallelArrayObject source(cx, as(obj));
if (index < source->outermostDimension()) {
if (!source->getParallelArrayElement(cx, index, vp))
return false;
*present = true;
return true;
}
*present = false;
vp.setUndefined();
return true;
}
JSBool
ParallelArrayObject::getSpecial(JSContext *cx, HandleObject obj, HandleObject receiver,
HandleSpecialId sid, MutableHandleValue vp)
@ -1735,43 +1786,57 @@ JSBool
ParallelArrayObject::setGeneric(JSContext *cx, HandleObject obj, HandleId id,
MutableHandleValue vp, JSBool strict)
{
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_PAR_ARRAY_IMMUTABLE);
return false;
JS_ASSERT(!obj->isExtensible());
if (IdIsInBoundsIndex(cx, obj, id)) {
if (strict)
return JSObject::reportReadOnly(cx, id);
if (cx->hasStrictOption())
return JSObject::reportReadOnly(cx, id, JSREPORT_STRICT | JSREPORT_WARNING);
} else {
if (strict)
return obj->reportNotExtensible(cx);
if (cx->hasStrictOption())
return obj->reportNotExtensible(cx, JSREPORT_STRICT | JSREPORT_WARNING);
}
return true;
}
JSBool
ParallelArrayObject::setProperty(JSContext *cx, HandleObject obj, HandlePropertyName name,
MutableHandleValue vp, JSBool strict)
{
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_PAR_ARRAY_IMMUTABLE);
return false;
RootedId id(cx, NameToId(name));
return setGeneric(cx, obj, id, vp, strict);
}
JSBool
ParallelArrayObject::setElement(JSContext *cx, HandleObject obj, uint32_t index,
MutableHandleValue vp, JSBool strict)
{
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_PAR_ARRAY_IMMUTABLE);
return false;
RootedId id(cx);
if (!IndexToId(cx, index, id.address()))
return false;
return setGeneric(cx, obj, id, vp, strict);
}
JSBool
ParallelArrayObject::setSpecial(JSContext *cx, HandleObject obj, HandleSpecialId sid,
MutableHandleValue vp, JSBool strict)
{
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_PAR_ARRAY_IMMUTABLE);
return false;
RootedId id(cx, SPECIALID_TO_JSID(sid));
return setGeneric(cx, obj, id, vp, strict);
}
JSBool
ParallelArrayObject::getGenericAttributes(JSContext *cx, HandleObject obj, HandleId id,
unsigned *attrsp)
{
if (JSID_IS_ATOM(id, cx->names().length))
*attrsp = JSPROP_PERMANENT | JSPROP_READONLY;
else
*attrsp = JSPROP_PERMANENT | JSPROP_READONLY | JSPROP_ENUMERATE;
*attrsp = JSPROP_PERMANENT | JSPROP_READONLY;
uint32_t i;
if (js_IdIsIndex(id, &i))
*attrsp |= JSPROP_ENUMERATE;
return true;
}
@ -1779,8 +1844,7 @@ JSBool
ParallelArrayObject::getPropertyAttributes(JSContext *cx, HandleObject obj, HandlePropertyName name,
unsigned *attrsp)
{
if (name == cx->names().length)
*attrsp = JSPROP_PERMANENT | JSPROP_READONLY;
*attrsp = JSPROP_PERMANENT | JSPROP_READONLY;
return true;
}
@ -1804,64 +1868,87 @@ JSBool
ParallelArrayObject::setGenericAttributes(JSContext *cx, HandleObject obj, HandleId id,
unsigned *attrsp)
{
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_PAR_ARRAY_IMMUTABLE);
return false;
if (IdIsInBoundsIndex(cx, obj, id)) {
unsigned attrs;
if (!getGenericAttributes(cx, obj, id, &attrs))
return false;
if (*attrsp != attrs)
return Throw(cx, id, JSMSG_CANT_REDEFINE_PROP);
}
return obj->reportNotExtensible(cx);
}
JSBool
ParallelArrayObject::setPropertyAttributes(JSContext *cx, HandleObject obj, HandlePropertyName name,
unsigned *attrsp)
{
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_PAR_ARRAY_IMMUTABLE);
return false;
RootedId id(cx, NameToId(name));
return setGenericAttributes(cx, obj, id, attrsp);
}
JSBool
ParallelArrayObject::setElementAttributes(JSContext *cx, HandleObject obj, uint32_t index,
unsigned *attrsp)
{
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_PAR_ARRAY_IMMUTABLE);
return false;
RootedId id(cx);
if (!IndexToId(cx, index, id.address()))
return false;
return setGenericAttributes(cx, obj, id, attrsp);
}
JSBool
ParallelArrayObject::setSpecialAttributes(JSContext *cx, HandleObject obj, HandleSpecialId sid,
unsigned *attrsp)
{
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_PAR_ARRAY_IMMUTABLE);
return false;
RootedId id(cx, SPECIALID_TO_JSID(sid));
return setGenericAttributes(cx, obj, id, attrsp);
}
JSBool
ParallelArrayObject::deleteGeneric(JSContext *cx, HandleObject obj, HandleId id,
MutableHandleValue rval, JSBool strict)
{
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_PAR_ARRAY_IMMUTABLE);
return false;
if (IdIsInBoundsIndex(cx, obj, id)) {
if (strict)
return obj->reportNotConfigurable(cx, id);
if (cx->hasStrictOption()) {
if (!obj->reportNotConfigurable(cx, id, JSREPORT_STRICT | JSREPORT_WARNING))
return false;
}
rval.setBoolean(false);
return true;
}
rval.setBoolean(true);
return true;
}
JSBool
ParallelArrayObject::deleteProperty(JSContext *cx, HandleObject obj, HandlePropertyName name,
MutableHandleValue rval, JSBool strict)
{
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_PAR_ARRAY_IMMUTABLE);
return false;
RootedId id(cx, NameToId(name));
return deleteGeneric(cx, obj, id, rval, strict);
}
JSBool
ParallelArrayObject::deleteElement(JSContext *cx, HandleObject obj, uint32_t index,
MutableHandleValue rval, JSBool strict)
{
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_PAR_ARRAY_IMMUTABLE);
return false;
RootedId id(cx);
if (!IndexToId(cx, index, id.address()))
return false;
return deleteGeneric(cx, obj, id, rval, strict);
}
JSBool
ParallelArrayObject::deleteSpecial(JSContext *cx, HandleObject obj, HandleSpecialId sid,
MutableHandleValue rval, JSBool strict)
{
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_PAR_ARRAY_IMMUTABLE);
return false;
RootedId id(cx, SPECIALID_TO_JSID(sid));
return deleteGeneric(cx, obj, id, rval, strict);
}
bool
@ -1870,13 +1957,12 @@ ParallelArrayObject::enumerate(JSContext *cx, HandleObject obj, unsigned flags,
{
RootedParallelArrayObject source(cx, as(obj));
if (flags & JSITER_HIDDEN && !props->append(NameToId(cx->names().length)))
return false;
// ParallelArray objects have no holes.
if (source->outermostDimension() > 0) {
for (uint32_t i = 0; i < source->outermostDimension(); i++)
props->append(INT_TO_JSID(i));
for (uint32_t i = 0; i < source->outermostDimension(); i++) {
if (!props->append(INT_TO_JSID(i)))
return false;
}
}
if (flags & JSITER_OWNONLY)

View File

@ -379,6 +379,8 @@ class ParallelArrayObject : public JSObject {
MutableHandleValue vp, JSBool strict);
static JSBool setElement(JSContext *cx, HandleObject obj, uint32_t index,
MutableHandleValue vp, JSBool strict);
static JSBool getElementIfPresent(JSContext *cx, HandleObject obj, HandleObject receiver,
uint32_t index, MutableHandleValue vp, bool *present);
static JSBool setSpecial(JSContext *cx, HandleObject obj, HandleSpecialId sid,
MutableHandleValue vp, JSBool strict);
static JSBool getGenericAttributes(JSContext *cx, HandleObject obj, HandleId id,

View File

@ -1,11 +1,9 @@
function testLength() {
// Test length attributes
// Test length immutability.
var p = new ParallelArray([1,2,3,4]);
var desc = Object.getOwnPropertyDescriptor(p, "length");
assertEq(desc.enumerable, false);
assertEq(desc.configurable, false);
assertEq(desc.writable, false);
assertEq(desc.value, 4);
p.length = 0;
assertEq(p[0], 1);
assertEq(p.length, 4);
}
testLength();

View File

@ -7,9 +7,8 @@ function testShape() {
shape.push(i+1);
var p = new ParallelArray(shape, function () { return 0; });
// Test shape identity and shape
assertEq(p.shape, p.shape);
assertEq(p.shape !== shape, true);
assertEqArray(p.shape, shape);
assertEq(p.shape !== shape, true);
}
}

View File

@ -0,0 +1,12 @@
load(libdir + "eqArrayHelper.js");
function testShape() {
// Test shape immutability.
var p = new ParallelArray([1,2,3,4]);
p.shape[0] = 0;
p.shape[1] = 42;
assertEq(p[0], 1);
assertEqArray(p.shape, [4]);
}
testShape();

View File

@ -1,3 +1,5 @@
load(libdir + "eqArrayHelper.js");
// ParallelArray surfaces
var desc = Object.getOwnPropertyDescriptor(this, "ParallelArray");
@ -35,3 +37,14 @@ checkMethod("filter", 1);
checkMethod("flatten", 0);
checkMethod("partition", 1);
checkMethod("get", 1);
function checkAccessor(name) {
var desc = Object.getOwnPropertyDescriptor(ParallelArray.prototype, name);
assertEq(desc.enumerable, false);
assertEq(desc.configurable, false);
assertEq(typeof desc.get, 'function');
assertEq(desc.set, undefined);
}
checkAccessor("length");
checkAccessor("shape");

View File

@ -0,0 +1,3 @@
// ParallelArray objects are frozen.
assertEq(Object.isFrozen(new ParallelArray), true);

View File

@ -354,25 +354,24 @@ MSG_DEF(JSMSG_NONDEFAULT_FORMAL_AFTER_DEFAULT, 300, 0, JSEXN_SYNTAXERR, "paramet
MSG_DEF(JSMSG_YIELD_IN_DEFAULT, 301, 0, JSEXN_SYNTAXERR, "yield in default expression")
MSG_DEF(JSMSG_INTRINSIC_NOT_DEFINED, 302, 1, JSEXN_REFERENCEERR, "no intrinsic function {0}")
MSG_DEF(JSMSG_ALREADY_HAS_SOURCEMAP, 303, 1, JSEXN_ERR, "{0} is being assigned a source map, yet already has one")
MSG_DEF(JSMSG_PAR_ARRAY_IMMUTABLE, 304, 0, JSEXN_TYPEERR, "ParallelArray objects are immutable")
MSG_DEF(JSMSG_PAR_ARRAY_BAD_ARG, 305, 1, JSEXN_TYPEERR, "invalid ParallelArray{0} argument")
MSG_DEF(JSMSG_PAR_ARRAY_BAD_PARTITION, 306, 0, JSEXN_ERR, "argument must be divisible by outermost dimension")
MSG_DEF(JSMSG_PAR_ARRAY_REDUCE_EMPTY, 307, 0, JSEXN_ERR, "cannot reduce empty ParallelArray object")
MSG_DEF(JSMSG_PAR_ARRAY_ALREADY_FLAT, 308, 0, JSEXN_ERR, "cannot flatten 1-dimensional ParallelArray object")
MSG_DEF(JSMSG_PAR_ARRAY_SCATTER_CONFLICT, 309, 0, JSEXN_ERR, "no conflict resolution function provided")
MSG_DEF(JSMSG_PAR_ARRAY_SCATTER_BOUNDS, 310, 0, JSEXN_ERR, "index in scatter vector out of bounds")
MSG_DEF(JSMSG_CANT_REPORT_NC_AS_NE, 311, 0, JSEXN_TYPEERR, "proxy can't report a non-configurable own property as non-existent")
MSG_DEF(JSMSG_CANT_REPORT_E_AS_NE, 312, 0, JSEXN_TYPEERR, "proxy can't report an existing own property as non-existent on a non-extensible object")
MSG_DEF(JSMSG_CANT_REPORT_NEW, 313, 0, JSEXN_TYPEERR, "proxy can't report a new property on a non-extensible object")
MSG_DEF(JSMSG_CANT_REPORT_INVALID, 314, 0, JSEXN_TYPEERR, "proxy can't report an incompatible property descriptor")
MSG_DEF(JSMSG_CANT_REPORT_NE_AS_NC, 315, 0, JSEXN_TYPEERR, "proxy can't report a non-existent property as non-configurable")
MSG_DEF(JSMSG_CANT_DEFINE_NEW, 316, 0, JSEXN_TYPEERR, "proxy can't define a new property on a non-extensible object")
MSG_DEF(JSMSG_CANT_DEFINE_INVALID, 317, 0, JSEXN_TYPEERR, "proxy can't define an incompatible property descriptor")
MSG_DEF(JSMSG_CANT_DEFINE_NE_AS_NC, 318, 0, JSEXN_TYPEERR, "proxy can't define a non-existent property as non-configurable")
MSG_DEF(JSMSG_INVALID_TRAP_RESULT, 319, 2, JSEXN_TYPEERR, "trap {1} for {0} returned an invalid result")
MSG_DEF(JSMSG_CANT_SKIP_NC, 320, 0, JSEXN_TYPEERR, "proxy can't skip a non-configurable property")
MSG_DEF(JSMSG_MUST_REPORT_SAME_VALUE, 321, 0, JSEXN_TYPEERR, "proxy must report the same value for a non-writable, non-configurable property")
MSG_DEF(JSMSG_MUST_REPORT_UNDEFINED, 322, 0, JSEXN_TYPEERR, "proxy must report undefined for a non-configurable accessor property without a getter")
MSG_DEF(JSMSG_CANT_SET_NW_NC, 323, 0, JSEXN_TYPEERR, "proxy can't successfully set a non-writable, non-configurable property")
MSG_DEF(JSMSG_CANT_SET_WO_SETTER, 324, 0, JSEXN_TYPEERR, "proxy can't succesfully set an accessor property without a setter")
MSG_DEF(JSMSG_DEBUG_BAD_REFERENT, 325, 2, JSEXN_TYPEERR, "{0} does not refer to {1}")
MSG_DEF(JSMSG_PAR_ARRAY_BAD_ARG, 304, 1, JSEXN_TYPEERR, "invalid ParallelArray{0} argument")
MSG_DEF(JSMSG_PAR_ARRAY_BAD_PARTITION, 305, 0, JSEXN_ERR, "argument must be divisible by outermost dimension")
MSG_DEF(JSMSG_PAR_ARRAY_REDUCE_EMPTY, 306, 0, JSEXN_ERR, "cannot reduce empty ParallelArray object")
MSG_DEF(JSMSG_PAR_ARRAY_ALREADY_FLAT, 307, 0, JSEXN_ERR, "cannot flatten 1-dimensional ParallelArray object")
MSG_DEF(JSMSG_PAR_ARRAY_SCATTER_CONFLICT, 308, 0, JSEXN_ERR, "no conflict resolution function provided")
MSG_DEF(JSMSG_PAR_ARRAY_SCATTER_BOUNDS, 309, 0, JSEXN_ERR, "index in scatter vector out of bounds")
MSG_DEF(JSMSG_CANT_REPORT_NC_AS_NE, 310, 0, JSEXN_TYPEERR, "proxy can't report a non-configurable own property as non-existent")
MSG_DEF(JSMSG_CANT_REPORT_E_AS_NE, 311, 0, JSEXN_TYPEERR, "proxy can't report an existing own property as non-existent on a non-extensible object")
MSG_DEF(JSMSG_CANT_REPORT_NEW, 312, 0, JSEXN_TYPEERR, "proxy can't report a new property on a non-extensible object")
MSG_DEF(JSMSG_CANT_REPORT_INVALID, 313, 0, JSEXN_TYPEERR, "proxy can't report an incompatible property descriptor")
MSG_DEF(JSMSG_CANT_REPORT_NE_AS_NC, 314, 0, JSEXN_TYPEERR, "proxy can't report a non-existent property as non-configurable")
MSG_DEF(JSMSG_CANT_DEFINE_NEW, 315, 0, JSEXN_TYPEERR, "proxy can't define a new property on a non-extensible object")
MSG_DEF(JSMSG_CANT_DEFINE_INVALID, 316, 0, JSEXN_TYPEERR, "proxy can't define an incompatible property descriptor")
MSG_DEF(JSMSG_CANT_DEFINE_NE_AS_NC, 317, 0, JSEXN_TYPEERR, "proxy can't define a non-existent property as non-configurable")
MSG_DEF(JSMSG_INVALID_TRAP_RESULT, 318, 2, JSEXN_TYPEERR, "trap {1} for {0} returned an invalid result")
MSG_DEF(JSMSG_CANT_SKIP_NC, 319, 0, JSEXN_TYPEERR, "proxy can't skip a non-configurable property")
MSG_DEF(JSMSG_MUST_REPORT_SAME_VALUE, 320, 0, JSEXN_TYPEERR, "proxy must report the same value for a non-writable, non-configurable property")
MSG_DEF(JSMSG_MUST_REPORT_UNDEFINED, 321, 0, JSEXN_TYPEERR, "proxy must report undefined for a non-configurable accessor property without a getter")
MSG_DEF(JSMSG_CANT_SET_NW_NC, 322, 0, JSEXN_TYPEERR, "proxy can't successfully set a non-writable, non-configurable property")
MSG_DEF(JSMSG_CANT_SET_WO_SETTER, 323, 0, JSEXN_TYPEERR, "proxy can't succesfully set an accessor property without a setter")
MSG_DEF(JSMSG_DEBUG_BAD_REFERENT, 324, 2, JSEXN_TYPEERR, "{0} does not refer to {1}")