|
|
|
Lines 111-120
JS_FRIEND_DATA(const JSObjectMap) JSObje
|
Link Here
|
|---|
|
| 111 |
Class js_ObjectClass = { |
111 |
Class js_ObjectClass = { |
| 112 |
js_Object_str, |
112 |
js_Object_str, |
| 113 |
JSCLASS_HAS_CACHED_PROTO(JSProto_Object), |
113 |
JSCLASS_HAS_CACHED_PROTO(JSProto_Object), |
| 114 |
PropertyStub, /* addProperty */ |
114 |
PropertyStub, /* addProperty */ |
| 115 |
PropertyStub, /* delProperty */ |
115 |
PropertyStub, /* delProperty */ |
| 116 |
PropertyStub, /* getProperty */ |
116 |
PropertyStub, /* getProperty */ |
| 117 |
PropertyStub, /* setProperty */ |
117 |
StrictPropertyStub, /* setProperty */ |
| 118 |
EnumerateStub, |
118 |
EnumerateStub, |
| 119 |
ResolveStub, |
119 |
ResolveStub, |
| 120 |
ConvertStub |
120 |
ConvertStub |
|
|
| 133 |
obj_getProto(JSContext *cx, JSObject *obj, jsid id, Value *vp); |
133 |
obj_getProto(JSContext *cx, JSObject *obj, jsid id, Value *vp); |
| 134 |
|
134 |
|
| 135 |
static JSBool |
135 |
static JSBool |
| 136 |
obj_setProto(JSContext *cx, JSObject *obj, jsid id, Value *vp); |
136 |
obj_setProto(JSContext *cx, JSObject *obj, jsid id, JSBool strict, Value *vp); |
| 137 |
|
137 |
|
| 138 |
static JSPropertySpec object_props[] = { |
138 |
static JSPropertySpec object_props[] = { |
| 139 |
{js_proto_str, 0, JSPROP_PERMANENT|JSPROP_SHARED, Jsvalify(obj_getProto), Jsvalify(obj_setProto)}, |
139 |
{js_proto_str, 0, JSPROP_PERMANENT|JSPROP_SHARED, Jsvalify(obj_getProto), Jsvalify(obj_setProto)}, |
|
Lines 150-156
obj_getProto(JSContext *cx, JSObject *ob
|
Link Here
|
|---|
|
| 150 |
} |
150 |
} |
| 151 |
|
151 |
|
| 152 |
static JSBool |
152 |
static JSBool |
| 153 |
obj_setProto(JSContext *cx, JSObject *obj, jsid id, Value *vp) |
153 |
obj_setProto(JSContext *cx, JSObject *obj, jsid id, JSBool strict, Value *vp) |
| 154 |
{ |
154 |
{ |
| 155 |
/* ECMAScript 5 8.6.2 forbids changing [[Prototype]] if not [[Extensible]]. */ |
155 |
/* ECMAScript 5 8.6.2 forbids changing [[Prototype]] if not [[Extensible]]. */ |
| 156 |
if (!obj->isExtensible()) { |
156 |
if (!obj->isExtensible()) { |
|
Lines 1583-1589
js_obj_defineGetter(JSContext *cx, uintN
|
Link Here
|
|---|
|
| 1583 |
if (!CheckAccess(cx, obj, id, JSACC_WATCH, &junk, &attrs)) |
1583 |
if (!CheckAccess(cx, obj, id, JSACC_WATCH, &junk, &attrs)) |
| 1584 |
return JS_FALSE; |
1584 |
return JS_FALSE; |
| 1585 |
vp->setUndefined(); |
1585 |
vp->setUndefined(); |
| 1586 |
return obj->defineProperty(cx, id, UndefinedValue(), getter, PropertyStub, |
1586 |
return obj->defineProperty(cx, id, UndefinedValue(), getter, StrictPropertyStub, |
| 1587 |
JSPROP_ENUMERATE | JSPROP_GETTER | JSPROP_SHARED); |
1587 |
JSPROP_ENUMERATE | JSPROP_GETTER | JSPROP_SHARED); |
| 1588 |
} |
1588 |
} |
| 1589 |
|
1589 |
|
|
Lines 1596-1602
js_obj_defineSetter(JSContext *cx, uintN
|
Link Here
|
|---|
|
| 1596 |
js_setter_str); |
1596 |
js_setter_str); |
| 1597 |
return JS_FALSE; |
1597 |
return JS_FALSE; |
| 1598 |
} |
1598 |
} |
| 1599 |
PropertyOp setter = CastAsPropertyOp(&vp[3].toObject()); |
1599 |
StrictPropertyOp setter = CastAsStrictPropertyOp(&vp[3].toObject()); |
| 1600 |
|
1600 |
|
| 1601 |
jsid id; |
1601 |
jsid id; |
| 1602 |
if (!ValueToId(cx, vp[2], &id)) |
1602 |
if (!ValueToId(cx, vp[2], &id)) |
|
Lines 1700-1726
js_NewPropertyDescriptorObject(JSContext
|
Link Here
|
|---|
|
| 1700 |
const JSAtomState &atomState = cx->runtime->atomState; |
1700 |
const JSAtomState &atomState = cx->runtime->atomState; |
| 1701 |
if (attrs & (JSPROP_GETTER | JSPROP_SETTER)) { |
1701 |
if (attrs & (JSPROP_GETTER | JSPROP_SETTER)) { |
| 1702 |
if (!desc->defineProperty(cx, ATOM_TO_JSID(atomState.getAtom), getter, |
1702 |
if (!desc->defineProperty(cx, ATOM_TO_JSID(atomState.getAtom), getter, |
| 1703 |
PropertyStub, PropertyStub, JSPROP_ENUMERATE) || |
1703 |
PropertyStub, StrictPropertyStub, JSPROP_ENUMERATE) || |
| 1704 |
!desc->defineProperty(cx, ATOM_TO_JSID(atomState.setAtom), setter, |
1704 |
!desc->defineProperty(cx, ATOM_TO_JSID(atomState.setAtom), setter, |
| 1705 |
PropertyStub, PropertyStub, JSPROP_ENUMERATE)) { |
1705 |
PropertyStub, StrictPropertyStub, JSPROP_ENUMERATE)) { |
| 1706 |
return false; |
1706 |
return false; |
| 1707 |
} |
1707 |
} |
| 1708 |
} else { |
1708 |
} else { |
| 1709 |
if (!desc->defineProperty(cx, ATOM_TO_JSID(atomState.valueAtom), value, |
1709 |
if (!desc->defineProperty(cx, ATOM_TO_JSID(atomState.valueAtom), value, |
| 1710 |
PropertyStub, PropertyStub, JSPROP_ENUMERATE) || |
1710 |
PropertyStub, StrictPropertyStub, JSPROP_ENUMERATE) || |
| 1711 |
!desc->defineProperty(cx, ATOM_TO_JSID(atomState.writableAtom), |
1711 |
!desc->defineProperty(cx, ATOM_TO_JSID(atomState.writableAtom), |
| 1712 |
BooleanValue((attrs & JSPROP_READONLY) == 0), |
1712 |
BooleanValue((attrs & JSPROP_READONLY) == 0), |
| 1713 |
PropertyStub, PropertyStub, JSPROP_ENUMERATE)) { |
1713 |
PropertyStub, StrictPropertyStub, JSPROP_ENUMERATE)) { |
| 1714 |
return false; |
1714 |
return false; |
| 1715 |
} |
1715 |
} |
| 1716 |
} |
1716 |
} |
| 1717 |
|
1717 |
|
| 1718 |
return desc->defineProperty(cx, ATOM_TO_JSID(atomState.enumerableAtom), |
1718 |
return desc->defineProperty(cx, ATOM_TO_JSID(atomState.enumerableAtom), |
| 1719 |
BooleanValue((attrs & JSPROP_ENUMERATE) != 0), |
1719 |
BooleanValue((attrs & JSPROP_ENUMERATE) != 0), |
| 1720 |
PropertyStub, PropertyStub, JSPROP_ENUMERATE) && |
1720 |
PropertyStub, StrictPropertyStub, JSPROP_ENUMERATE) && |
| 1721 |
desc->defineProperty(cx, ATOM_TO_JSID(atomState.configurableAtom), |
1721 |
desc->defineProperty(cx, ATOM_TO_JSID(atomState.configurableAtom), |
| 1722 |
BooleanValue((attrs & JSPROP_PERMANENT) == 0), |
1722 |
BooleanValue((attrs & JSPROP_PERMANENT) == 0), |
| 1723 |
PropertyStub, PropertyStub, JSPROP_ENUMERATE); |
1723 |
PropertyStub, StrictPropertyStub, JSPROP_ENUMERATE); |
| 1724 |
} |
1724 |
} |
| 1725 |
|
1725 |
|
| 1726 |
JSBool |
1726 |
JSBool |
|
Lines 2049-2055
DefinePropertyOnObject(JSContext *cx, JS
|
Link Here
|
|---|
|
| 2049 |
if (desc.isGenericDescriptor() || desc.isDataDescriptor()) { |
2049 |
if (desc.isGenericDescriptor() || desc.isDataDescriptor()) { |
| 2050 |
JS_ASSERT(!obj->getOps()->defineProperty); |
2050 |
JS_ASSERT(!obj->getOps()->defineProperty); |
| 2051 |
return js_DefineProperty(cx, obj, desc.id, &desc.value, |
2051 |
return js_DefineProperty(cx, obj, desc.id, &desc.value, |
| 2052 |
PropertyStub, PropertyStub, desc.attrs); |
2052 |
PropertyStub, StrictPropertyStub, desc.attrs); |
| 2053 |
} |
2053 |
} |
| 2054 |
|
2054 |
|
| 2055 |
JS_ASSERT(desc.isAccessorDescriptor()); |
2055 |
JS_ASSERT(desc.isAccessorDescriptor()); |
|
Lines 2238-2244
DefinePropertyOnObject(JSContext *cx, JS
|
Link Here
|
|---|
|
| 2238 |
|
2238 |
|
| 2239 |
/* 8.12.9 step 12. */ |
2239 |
/* 8.12.9 step 12. */ |
| 2240 |
uintN attrs; |
2240 |
uintN attrs; |
| 2241 |
PropertyOp getter, setter; |
2241 |
PropertyOp getter; |
|
|
2242 |
StrictPropertyOp setter; |
| 2242 |
if (desc.isGenericDescriptor()) { |
2243 |
if (desc.isGenericDescriptor()) { |
| 2243 |
uintN changed = 0; |
2244 |
uintN changed = 0; |
| 2244 |
if (desc.hasConfigurable) |
2245 |
if (desc.hasConfigurable) |
|
Lines 2249-2255
DefinePropertyOnObject(JSContext *cx, JS
|
Link Here
|
|---|
|
| 2249 |
attrs = (shape->attributes() & ~changed) | (desc.attrs & changed); |
2250 |
attrs = (shape->attributes() & ~changed) | (desc.attrs & changed); |
| 2250 |
if (shape->isMethod()) { |
2251 |
if (shape->isMethod()) { |
| 2251 |
JS_ASSERT(!(attrs & (JSPROP_GETTER | JSPROP_SETTER))); |
2252 |
JS_ASSERT(!(attrs & (JSPROP_GETTER | JSPROP_SETTER))); |
| 2252 |
getter = setter = PropertyStub; |
2253 |
getter = PropertyStub; |
|
|
2254 |
setter = StrictPropertyStub; |
| 2253 |
} else { |
2255 |
} else { |
| 2254 |
getter = shape->getter(); |
2256 |
getter = shape->getter(); |
| 2255 |
setter = shape->setter(); |
2257 |
setter = shape->setter(); |
|
Lines 2266-2272
DefinePropertyOnObject(JSContext *cx, JS
|
Link Here
|
|---|
|
| 2266 |
if (desc.hasValue) |
2268 |
if (desc.hasValue) |
| 2267 |
v = desc.value; |
2269 |
v = desc.value; |
| 2268 |
attrs = (desc.attrs & ~unchanged) | (shape->attributes() & unchanged); |
2270 |
attrs = (desc.attrs & ~unchanged) | (shape->attributes() & unchanged); |
| 2269 |
getter = setter = PropertyStub; |
2271 |
getter = PropertyStub; |
|
|
2272 |
setter = StrictPropertyStub; |
| 2270 |
} else { |
2273 |
} else { |
| 2271 |
JS_ASSERT(desc.isAccessorDescriptor()); |
2274 |
JS_ASSERT(desc.isAccessorDescriptor()); |
| 2272 |
|
2275 |
|
|
Lines 2303-2309
DefinePropertyOnObject(JSContext *cx, JS
|
Link Here
|
|---|
|
| 2303 |
setter = desc.setter(); |
2306 |
setter = desc.setter(); |
| 2304 |
} else { |
2307 |
} else { |
| 2305 |
setter = (shape->hasDefaultSetter() && !shape->hasSetterValue()) |
2308 |
setter = (shape->hasDefaultSetter() && !shape->hasSetterValue()) |
| 2306 |
? PropertyStub |
2309 |
? StrictPropertyStub |
| 2307 |
: shape->setter(); |
2310 |
: shape->setter(); |
| 2308 |
} |
2311 |
} |
| 2309 |
} |
2312 |
} |
|
Lines 3168-3192
with_ThisObject(JSContext *cx, JSObject
|
Link Here
|
|---|
|
| 3168 |
Class js_WithClass = { |
3171 |
Class js_WithClass = { |
| 3169 |
"With", |
3172 |
"With", |
| 3170 |
JSCLASS_HAS_PRIVATE | JSCLASS_HAS_RESERVED_SLOTS(2) | JSCLASS_IS_ANONYMOUS, |
3173 |
JSCLASS_HAS_PRIVATE | JSCLASS_HAS_RESERVED_SLOTS(2) | JSCLASS_IS_ANONYMOUS, |
| 3171 |
PropertyStub, /* addProperty */ |
3174 |
PropertyStub, /* addProperty */ |
| 3172 |
PropertyStub, /* delProperty */ |
3175 |
PropertyStub, /* delProperty */ |
| 3173 |
PropertyStub, /* getProperty */ |
3176 |
PropertyStub, /* getProperty */ |
| 3174 |
PropertyStub, /* setProperty */ |
3177 |
StrictPropertyStub, /* setProperty */ |
| 3175 |
EnumerateStub, |
3178 |
EnumerateStub, |
| 3176 |
ResolveStub, |
3179 |
ResolveStub, |
| 3177 |
ConvertStub, |
3180 |
ConvertStub, |
| 3178 |
NULL, /* finalize */ |
3181 |
NULL, /* finalize */ |
| 3179 |
NULL, /* reserved */ |
3182 |
NULL, /* reserved */ |
| 3180 |
NULL, /* checkAccess */ |
3183 |
NULL, /* checkAccess */ |
| 3181 |
NULL, /* call */ |
3184 |
NULL, /* call */ |
| 3182 |
NULL, /* construct */ |
3185 |
NULL, /* construct */ |
| 3183 |
NULL, /* xdrObject */ |
3186 |
NULL, /* xdrObject */ |
| 3184 |
NULL, /* hasInstance */ |
3187 |
NULL, /* hasInstance */ |
| 3185 |
NULL, /* mark */ |
3188 |
NULL, /* mark */ |
| 3186 |
JS_NULL_CLASS_EXT, |
3189 |
JS_NULL_CLASS_EXT, |
| 3187 |
{ |
3190 |
{ |
| 3188 |
with_LookupProperty, |
3191 |
with_LookupProperty, |
| 3189 |
NULL, /* defineProperty */ |
3192 |
NULL, /* defineProperty */ |
| 3190 |
with_GetProperty, |
3193 |
with_GetProperty, |
| 3191 |
with_SetProperty, |
3194 |
with_SetProperty, |
| 3192 |
with_GetAttributes, |
3195 |
with_GetAttributes, |
|
Lines 3194-3203
Class js_WithClass = {
|
Link Here
|
|---|
|
| 3194 |
with_DeleteProperty, |
3197 |
with_DeleteProperty, |
| 3195 |
with_Enumerate, |
3198 |
with_Enumerate, |
| 3196 |
with_TypeOf, |
3199 |
with_TypeOf, |
| 3197 |
NULL, /* trace */ |
3200 |
NULL, /* trace */ |
| 3198 |
NULL, /* fix */ |
3201 |
NULL, /* fix */ |
| 3199 |
with_ThisObject, |
3202 |
with_ThisObject, |
| 3200 |
NULL, /* clear */ |
3203 |
NULL, /* clear */ |
| 3201 |
} |
3204 |
} |
| 3202 |
}; |
3205 |
}; |
| 3203 |
|
3206 |
|
|
Lines 3329-3335
block_getProperty(JSContext *cx, JSObjec
|
Link Here
|
|---|
|
| 3329 |
} |
3332 |
} |
| 3330 |
|
3333 |
|
| 3331 |
static JSBool |
3334 |
static JSBool |
| 3332 |
block_setProperty(JSContext *cx, JSObject *obj, jsid id, Value *vp) |
3335 |
block_setProperty(JSContext *cx, JSObject *obj, jsid id, JSBool strict, Value *vp) |
| 3333 |
{ |
3336 |
{ |
| 3334 |
JS_ASSERT(obj->isClonedBlock()); |
3337 |
JS_ASSERT(obj->isClonedBlock()); |
| 3335 |
uintN index = (uintN) JSID_TO_INT(id); |
3338 |
uintN index = (uintN) JSID_TO_INT(id); |
|
Lines 3398-3404
JSObject::copyPropertiesFrom(JSContext *
|
Link Here
|
|---|
|
| 3398 |
PropertyOp getter = shape->getter(); |
3401 |
PropertyOp getter = shape->getter(); |
| 3399 |
if ((attrs & JSPROP_GETTER) && !cx->compartment->wrap(cx, &getter)) |
3402 |
if ((attrs & JSPROP_GETTER) && !cx->compartment->wrap(cx, &getter)) |
| 3400 |
return false; |
3403 |
return false; |
| 3401 |
PropertyOp setter = shape->setter(); |
3404 |
StrictPropertyOp setter = shape->setter(); |
| 3402 |
if ((attrs & JSPROP_SETTER) && !cx->compartment->wrap(cx, &setter)) |
3405 |
if ((attrs & JSPROP_SETTER) && !cx->compartment->wrap(cx, &setter)) |
| 3403 |
return false; |
3406 |
return false; |
| 3404 |
Value v = shape->hasSlot() ? obj->getSlot(shape->slot) : UndefinedValue(); |
3407 |
Value v = shape->hasSlot() ? obj->getSlot(shape->slot) : UndefinedValue(); |
|
Lines 3720-3729
js_XDRBlockObject(JSXDRState *xdr, JSObj
|
Link Here
|
|---|
|
| 3720 |
Class js_BlockClass = { |
3723 |
Class js_BlockClass = { |
| 3721 |
"Block", |
3724 |
"Block", |
| 3722 |
JSCLASS_HAS_PRIVATE | JSCLASS_HAS_RESERVED_SLOTS(1) | JSCLASS_IS_ANONYMOUS, |
3725 |
JSCLASS_HAS_PRIVATE | JSCLASS_HAS_RESERVED_SLOTS(1) | JSCLASS_IS_ANONYMOUS, |
| 3723 |
PropertyStub, /* addProperty */ |
3726 |
PropertyStub, /* addProperty */ |
| 3724 |
PropertyStub, /* delProperty */ |
3727 |
PropertyStub, /* delProperty */ |
| 3725 |
PropertyStub, /* getProperty */ |
3728 |
PropertyStub, /* getProperty */ |
| 3726 |
PropertyStub, /* setProperty */ |
3729 |
StrictPropertyStub, /* setProperty */ |
| 3727 |
EnumerateStub, |
3730 |
EnumerateStub, |
| 3728 |
ResolveStub, |
3731 |
ResolveStub, |
| 3729 |
ConvertStub |
3732 |
ConvertStub |
|
Lines 3768-3774
DefineStandardSlot(JSContext *cx, JSObje
|
Link Here
|
|---|
|
| 3768 |
uint32 slot = 2 * JSProto_LIMIT + key; |
3771 |
uint32 slot = 2 * JSProto_LIMIT + key; |
| 3769 |
if (!js_SetReservedSlot(cx, obj, slot, v)) |
3772 |
if (!js_SetReservedSlot(cx, obj, slot, v)) |
| 3770 |
return false; |
3773 |
return false; |
| 3771 |
if (!obj->addProperty(cx, id, PropertyStub, PropertyStub, slot, attrs, 0, 0)) |
3774 |
if (!obj->addProperty(cx, id, PropertyStub, StrictPropertyStub, slot, attrs, 0, 0)) |
| 3772 |
return false; |
3775 |
return false; |
| 3773 |
|
3776 |
|
| 3774 |
named = true; |
3777 |
named = true; |
|
Lines 3776-3782
DefineStandardSlot(JSContext *cx, JSObje
|
Link Here
|
|---|
|
| 3776 |
} |
3779 |
} |
| 3777 |
} |
3780 |
} |
| 3778 |
|
3781 |
|
| 3779 |
named = obj->defineProperty(cx, id, v, PropertyStub, PropertyStub, attrs); |
3782 |
named = obj->defineProperty(cx, id, v, PropertyStub, StrictPropertyStub, attrs); |
| 3780 |
return named; |
3783 |
return named; |
| 3781 |
} |
3784 |
} |
| 3782 |
|
3785 |
|
|
Lines 4520-4526
js_PurgeScopeChainHelper(JSContext *cx,
|
Link Here
|
|---|
|
| 4520 |
|
4523 |
|
| 4521 |
const Shape * |
4524 |
const Shape * |
| 4522 |
js_AddNativeProperty(JSContext *cx, JSObject *obj, jsid id, |
4525 |
js_AddNativeProperty(JSContext *cx, JSObject *obj, jsid id, |
| 4523 |
PropertyOp getter, PropertyOp setter, uint32 slot, |
4526 |
PropertyOp getter, StrictPropertyOp setter, uint32 slot, |
| 4524 |
uintN attrs, uintN flags, intN shortid) |
4527 |
uintN attrs, uintN flags, intN shortid) |
| 4525 |
{ |
4528 |
{ |
| 4526 |
JS_ASSERT(!(flags & Shape::METHOD)); |
4529 |
JS_ASSERT(!(flags & Shape::METHOD)); |
|
Lines 4543-4549
js_AddNativeProperty(JSContext *cx, JSOb
|
Link Here
|
|---|
|
| 4543 |
const Shape * |
4546 |
const Shape * |
| 4544 |
js_ChangeNativePropertyAttrs(JSContext *cx, JSObject *obj, |
4547 |
js_ChangeNativePropertyAttrs(JSContext *cx, JSObject *obj, |
| 4545 |
const Shape *shape, uintN attrs, uintN mask, |
4548 |
const Shape *shape, uintN attrs, uintN mask, |
| 4546 |
PropertyOp getter, PropertyOp setter) |
4549 |
PropertyOp getter, StrictPropertyOp setter) |
| 4547 |
{ |
4550 |
{ |
| 4548 |
if (!obj->ensureClassReservedSlots(cx)) |
4551 |
if (!obj->ensureClassReservedSlots(cx)) |
| 4549 |
return NULL; |
4552 |
return NULL; |
|
Lines 4552-4558
js_ChangeNativePropertyAttrs(JSContext *
|
Link Here
|
|---|
|
| 4552 |
|
4555 |
|
| 4553 |
JSBool |
4556 |
JSBool |
| 4554 |
js_DefineProperty(JSContext *cx, JSObject *obj, jsid id, const Value *value, |
4557 |
js_DefineProperty(JSContext *cx, JSObject *obj, jsid id, const Value *value, |
| 4555 |
PropertyOp getter, PropertyOp setter, uintN attrs) |
4558 |
PropertyOp getter, StrictPropertyOp setter, uintN attrs) |
| 4556 |
{ |
4559 |
{ |
| 4557 |
return js_DefineNativeProperty(cx, obj, id, *value, getter, setter, attrs, |
4560 |
return js_DefineNativeProperty(cx, obj, id, *value, getter, setter, attrs, |
| 4558 |
0, 0, NULL); |
4561 |
0, 0, NULL); |
|
Lines 4582-4588
CallAddPropertyHook(JSContext *cx, Class
|
Link Here
|
|---|
|
| 4582 |
|
4585 |
|
| 4583 |
JSBool |
4586 |
JSBool |
| 4584 |
js_DefineNativeProperty(JSContext *cx, JSObject *obj, jsid id, const Value &value, |
4587 |
js_DefineNativeProperty(JSContext *cx, JSObject *obj, jsid id, const Value &value, |
| 4585 |
PropertyOp getter, PropertyOp setter, uintN attrs, |
4588 |
PropertyOp getter, StrictPropertyOp setter, uintN attrs, |
| 4586 |
uintN flags, intN shortid, JSProperty **propp, |
4589 |
uintN flags, intN shortid, JSProperty **propp, |
| 4587 |
uintN defineHow /* = 0 */) |
4590 |
uintN defineHow /* = 0 */) |
| 4588 |
{ |
4591 |
{ |
|
Lines 5174-5180
js_NativeGet(JSContext *cx, JSObject *ob
|
Link Here
|
|---|
|
| 5174 |
} |
5177 |
} |
| 5175 |
|
5178 |
|
| 5176 |
JSBool |
5179 |
JSBool |
| 5177 |
js_NativeSet(JSContext *cx, JSObject *obj, const Shape *shape, bool added, Value *vp) |
5180 |
js_NativeSet(JSContext *cx, JSObject *obj, const Shape *shape, bool added, bool strict, Value *vp) |
| 5178 |
{ |
5181 |
{ |
| 5179 |
LeaveTraceIfGlobalObject(cx, obj); |
5182 |
LeaveTraceIfGlobalObject(cx, obj); |
| 5180 |
|
5183 |
|
|
Lines 5209-5215
js_NativeSet(JSContext *cx, JSObject *ob
|
Link Here
|
|---|
|
| 5209 |
sample = cx->runtime->propertyRemovals; |
5212 |
sample = cx->runtime->propertyRemovals; |
| 5210 |
{ |
5213 |
{ |
| 5211 |
AutoShapeRooter tvr(cx, shape); |
5214 |
AutoShapeRooter tvr(cx, shape); |
| 5212 |
if (!shape->set(cx, obj, vp)) |
5215 |
if (!shape->set(cx, obj, strict, vp)) |
| 5213 |
return false; |
5216 |
return false; |
| 5214 |
|
5217 |
|
| 5215 |
JS_ASSERT_IF(!obj->inDictionaryMode(), shape->slot == slot); |
5218 |
JS_ASSERT_IF(!obj->inDictionaryMode(), shape->slot == slot); |
|
Lines 5460-5466
js_SetPropertyHelper(JSContext *cx, JSOb
|
Link Here
|
|---|
|
| 5460 |
uintN attrs, flags; |
5463 |
uintN attrs, flags; |
| 5461 |
intN shortid; |
5464 |
intN shortid; |
| 5462 |
Class *clasp; |
5465 |
Class *clasp; |
| 5463 |
PropertyOp getter, setter; |
5466 |
PropertyOp getter; |
|
|
5467 |
StrictPropertyOp setter; |
| 5464 |
bool added; |
5468 |
bool added; |
| 5465 |
|
5469 |
|
| 5466 |
JS_ASSERT((defineHow & |
5470 |
JS_ASSERT((defineHow & |
|
Lines 5483-5489
js_SetPropertyHelper(JSContext *cx, JSOb
|
Link Here
|
|---|
|
| 5483 |
return false; |
5487 |
return false; |
| 5484 |
|
5488 |
|
| 5485 |
if (pd.attrs & JSPROP_SHARED) |
5489 |
if (pd.attrs & JSPROP_SHARED) |
| 5486 |
return CallSetter(cx, obj, id, pd.setter, pd.attrs, pd.shortid, vp); |
5490 |
return CallSetter(cx, obj, id, pd.setter, pd.attrs, pd.shortid, strict, vp); |
| 5487 |
|
5491 |
|
| 5488 |
if (pd.attrs & JSPROP_READONLY) { |
5492 |
if (pd.attrs & JSPROP_READONLY) { |
| 5489 |
if (strict) |
5493 |
if (strict) |
|
Lines 5551-5557
js_SetPropertyHelper(JSContext *cx, JSOb
|
Link Here
|
|---|
|
| 5551 |
if (shape->hasDefaultSetter() && !shape->hasGetterValue()) |
5555 |
if (shape->hasDefaultSetter() && !shape->hasGetterValue()) |
| 5552 |
return JS_TRUE; |
5556 |
return JS_TRUE; |
| 5553 |
|
5557 |
|
| 5554 |
return shape->set(cx, obj, vp); |
5558 |
return shape->set(cx, obj, strict, vp); |
| 5555 |
} |
5559 |
} |
| 5556 |
|
5560 |
|
| 5557 |
/* |
5561 |
/* |
|
Lines 5616-5622
js_SetPropertyHelper(JSContext *cx, JSOb
|
Link Here
|
|---|
|
| 5616 |
vp->setObject(*funobj); |
5620 |
vp->setObject(*funobj); |
| 5617 |
} |
5621 |
} |
| 5618 |
} |
5622 |
} |
| 5619 |
return identical || js_NativeSet(cx, obj, shape, false, vp); |
5623 |
return identical || js_NativeSet(cx, obj, shape, false, strict, vp); |
| 5620 |
} |
5624 |
} |
| 5621 |
} |
5625 |
} |
| 5622 |
|
5626 |
|
|
Lines 5684-5690
js_SetPropertyHelper(JSContext *cx, JSOb
|
Link Here
|
|---|
|
| 5684 |
if (defineHow & JSDNP_CACHE_RESULT) |
5688 |
if (defineHow & JSDNP_CACHE_RESULT) |
| 5685 |
JS_PROPERTY_CACHE(cx).fill(cx, obj, 0, 0, obj, shape, added); |
5689 |
JS_PROPERTY_CACHE(cx).fill(cx, obj, 0, 0, obj, shape, added); |
| 5686 |
|
5690 |
|
| 5687 |
return js_NativeSet(cx, obj, shape, added, vp); |
5691 |
return js_NativeSet(cx, obj, shape, added, strict, vp); |
| 5688 |
|
5692 |
|
| 5689 |
#ifdef JS_TRACER |
5693 |
#ifdef JS_TRACER |
| 5690 |
error: // TRACE_1 jumps here in case of error. |
5694 |
error: // TRACE_1 jumps here in case of error. |
|
Lines 6140-6146
js_SetClassPrototype(JSContext *cx, JSOb
|
Link Here
|
|---|
|
| 6140 |
* DontDelete. |
6144 |
* DontDelete. |
| 6141 |
*/ |
6145 |
*/ |
| 6142 |
if (!ctor->defineProperty(cx, ATOM_TO_JSID(cx->runtime->atomState.classPrototypeAtom), |
6146 |
if (!ctor->defineProperty(cx, ATOM_TO_JSID(cx->runtime->atomState.classPrototypeAtom), |
| 6143 |
ObjectOrNullValue(proto), PropertyStub, PropertyStub, attrs)) { |
6147 |
ObjectOrNullValue(proto), PropertyStub, StrictPropertyStub, attrs)) { |
| 6144 |
return JS_FALSE; |
6148 |
return JS_FALSE; |
| 6145 |
} |
6149 |
} |
| 6146 |
|
6150 |
|
|
Lines 6149-6155
js_SetClassPrototype(JSContext *cx, JSOb
|
Link Here
|
|---|
|
| 6149 |
* for a user-defined function f, is DontEnum. |
6153 |
* for a user-defined function f, is DontEnum. |
| 6150 |
*/ |
6154 |
*/ |
| 6151 |
return proto->defineProperty(cx, ATOM_TO_JSID(cx->runtime->atomState.constructorAtom), |
6155 |
return proto->defineProperty(cx, ATOM_TO_JSID(cx->runtime->atomState.constructorAtom), |
| 6152 |
ObjectOrNullValue(ctor), PropertyStub, PropertyStub, 0); |
6156 |
ObjectOrNullValue(ctor), PropertyStub, StrictPropertyStub, 0); |
| 6153 |
} |
6157 |
} |
| 6154 |
|
6158 |
|
| 6155 |
JSBool |
6159 |
JSBool |