mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-19 08:15:31 +00:00
Bug 691992 - Split getAttributes and setAttributes into property and generic forms, and use them throughout the engine. r=bhackett
--HG-- extra : rebase_source : ab383bf621c212424db6c0f358b6dd2c31443b68
This commit is contained in:
parent
56378bd370
commit
ecf1385a3b
@ -3708,7 +3708,7 @@ GetPropertyDescriptorById(JSContext *cx, JSObject *obj, jsid id, uintN flags,
|
|||||||
? Proxy::getOwnPropertyDescriptor(cx, obj2, id, false, desc)
|
? Proxy::getOwnPropertyDescriptor(cx, obj2, id, false, desc)
|
||||||
: Proxy::getPropertyDescriptor(cx, obj2, id, false, desc);
|
: Proxy::getPropertyDescriptor(cx, obj2, id, false, desc);
|
||||||
}
|
}
|
||||||
if (!obj2->getAttributes(cx, id, &desc->attrs))
|
if (!obj2->getGenericAttributes(cx, id, &desc->attrs))
|
||||||
return false;
|
return false;
|
||||||
desc->getter = NULL;
|
desc->getter = NULL;
|
||||||
desc->setter = NULL;
|
desc->setter = NULL;
|
||||||
@ -3802,7 +3802,7 @@ SetPropertyAttributesById(JSContext *cx, JSObject *obj, jsid id, uintN attrs, JS
|
|||||||
}
|
}
|
||||||
JSBool ok = obj->isNative()
|
JSBool ok = obj->isNative()
|
||||||
? js_SetNativeAttributes(cx, obj, (Shape *) prop, attrs)
|
? js_SetNativeAttributes(cx, obj, (Shape *) prop, attrs)
|
||||||
: obj->setAttributes(cx, id, &attrs);
|
: obj->setGenericAttributes(cx, id, &attrs);
|
||||||
if (ok)
|
if (ok)
|
||||||
*foundp = true;
|
*foundp = true;
|
||||||
return ok;
|
return ok;
|
||||||
|
@ -1092,11 +1092,20 @@ array_defineSpecial(JSContext *cx, JSObject *obj, SpecialId sid, const Value *va
|
|||||||
}
|
}
|
||||||
|
|
||||||
static JSBool
|
static JSBool
|
||||||
array_getAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp)
|
array_getGenericAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp)
|
||||||
{
|
{
|
||||||
*attrsp = JSID_IS_ATOM(id, cx->runtime->atomState.lengthAtom)
|
*attrsp = JSID_IS_ATOM(id, cx->runtime->atomState.lengthAtom)
|
||||||
? JSPROP_PERMANENT : JSPROP_ENUMERATE;
|
? JSPROP_PERMANENT : JSPROP_ENUMERATE;
|
||||||
return JS_TRUE;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static JSBool
|
||||||
|
array_getPropertyAttributes(JSContext *cx, JSObject *obj, PropertyName *name, uintN *attrsp)
|
||||||
|
{
|
||||||
|
*attrsp = (name == cx->runtime->atomState.lengthAtom)
|
||||||
|
? JSPROP_PERMANENT
|
||||||
|
: JSPROP_ENUMERATE;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static JSBool
|
static JSBool
|
||||||
@ -1109,11 +1118,19 @@ array_getElementAttributes(JSContext *cx, JSObject *obj, uint32 index, uintN *at
|
|||||||
static JSBool
|
static JSBool
|
||||||
array_getSpecialAttributes(JSContext *cx, JSObject *obj, SpecialId sid, uintN *attrsp)
|
array_getSpecialAttributes(JSContext *cx, JSObject *obj, SpecialId sid, uintN *attrsp)
|
||||||
{
|
{
|
||||||
return array_getAttributes(cx, obj, SPECIALID_TO_JSID(sid), attrsp);
|
*attrsp = JSPROP_ENUMERATE;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static JSBool
|
static JSBool
|
||||||
array_setAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp)
|
array_setGenericAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp)
|
||||||
|
{
|
||||||
|
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_CANT_SET_ARRAY_ATTRS);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
static JSBool
|
||||||
|
array_setPropertyAttributes(JSContext *cx, JSObject *obj, PropertyName *name, uintN *attrsp)
|
||||||
{
|
{
|
||||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_CANT_SET_ARRAY_ATTRS);
|
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_CANT_SET_ARRAY_ATTRS);
|
||||||
return false;
|
return false;
|
||||||
@ -1129,7 +1146,8 @@ array_setElementAttributes(JSContext *cx, JSObject *obj, uint32 index, uintN *at
|
|||||||
static JSBool
|
static JSBool
|
||||||
array_setSpecialAttributes(JSContext *cx, JSObject *obj, SpecialId sid, uintN *attrsp)
|
array_setSpecialAttributes(JSContext *cx, JSObject *obj, SpecialId sid, uintN *attrsp)
|
||||||
{
|
{
|
||||||
return array_setAttributes(cx, obj, SPECIALID_TO_JSID(sid), attrsp);
|
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_CANT_SET_ARRAY_ATTRS);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace js {
|
namespace js {
|
||||||
@ -1249,12 +1267,12 @@ Class js::ArrayClass = {
|
|||||||
array_setProperty,
|
array_setProperty,
|
||||||
array_setElement,
|
array_setElement,
|
||||||
array_setSpecial,
|
array_setSpecial,
|
||||||
array_getAttributes,
|
array_getGenericAttributes,
|
||||||
array_getAttributes,
|
array_getPropertyAttributes,
|
||||||
array_getElementAttributes,
|
array_getElementAttributes,
|
||||||
array_getSpecialAttributes,
|
array_getSpecialAttributes,
|
||||||
array_setAttributes,
|
array_setGenericAttributes,
|
||||||
array_setAttributes,
|
array_setPropertyAttributes,
|
||||||
array_setElementAttributes,
|
array_setElementAttributes,
|
||||||
array_setSpecialAttributes,
|
array_setSpecialAttributes,
|
||||||
array_deleteProperty,
|
array_deleteProperty,
|
||||||
|
@ -220,7 +220,7 @@ typedef JSBool
|
|||||||
typedef JSBool
|
typedef JSBool
|
||||||
(* GenericAttributesOp)(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp);
|
(* GenericAttributesOp)(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp);
|
||||||
typedef JSBool
|
typedef JSBool
|
||||||
(* AttributesOp)(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp);
|
(* PropertyAttributesOp)(JSContext *cx, JSObject *obj, PropertyName *name, uintN *attrsp);
|
||||||
typedef JSBool
|
typedef JSBool
|
||||||
(* ElementAttributesOp)(JSContext *cx, JSObject *obj, uint32 index, uintN *attrsp);
|
(* ElementAttributesOp)(JSContext *cx, JSObject *obj, uint32 index, uintN *attrsp);
|
||||||
typedef JSBool
|
typedef JSBool
|
||||||
@ -319,11 +319,11 @@ struct ObjectOps
|
|||||||
StrictElementIdOp setElement;
|
StrictElementIdOp setElement;
|
||||||
StrictSpecialIdOp setSpecial;
|
StrictSpecialIdOp setSpecial;
|
||||||
GenericAttributesOp getGenericAttributes;
|
GenericAttributesOp getGenericAttributes;
|
||||||
AttributesOp getAttributes;
|
PropertyAttributesOp getPropertyAttributes;
|
||||||
ElementAttributesOp getElementAttributes;
|
ElementAttributesOp getElementAttributes;
|
||||||
SpecialAttributesOp getSpecialAttributes;
|
SpecialAttributesOp getSpecialAttributes;
|
||||||
GenericAttributesOp setGenericAttributes;
|
GenericAttributesOp setGenericAttributes;
|
||||||
AttributesOp setAttributes;
|
PropertyAttributesOp setPropertyAttributes;
|
||||||
ElementAttributesOp setElementAttributes;
|
ElementAttributesOp setElementAttributes;
|
||||||
SpecialAttributesOp setSpecialAttributes;
|
SpecialAttributesOp setSpecialAttributes;
|
||||||
DeleteGenericOp deleteGeneric;
|
DeleteGenericOp deleteGeneric;
|
||||||
|
@ -838,7 +838,7 @@ js::CheckRedeclaration(JSContext *cx, JSObject *obj, jsid id, uintN attrs)
|
|||||||
if (obj2->isNative()) {
|
if (obj2->isNative()) {
|
||||||
oldAttrs = ((Shape *) prop)->attributes();
|
oldAttrs = ((Shape *) prop)->attributes();
|
||||||
} else {
|
} else {
|
||||||
if (!obj2->getAttributes(cx, id, &oldAttrs))
|
if (!obj2->getGenericAttributes(cx, id, &oldAttrs))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -871,7 +871,7 @@ SuppressDeletedPropertyHelper(JSContext *cx, JSObject *obj, IdPredicate predicat
|
|||||||
uintN attrs;
|
uintN attrs;
|
||||||
if (obj2.object()->isNative())
|
if (obj2.object()->isNative())
|
||||||
attrs = ((Shape *) prop)->attributes();
|
attrs = ((Shape *) prop)->attributes();
|
||||||
else if (!obj2.object()->getAttributes(cx, *idp, &attrs))
|
else if (!obj2.object()->getGenericAttributes(cx, *idp, &attrs))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (attrs & JSPROP_ENUMERATE)
|
if (attrs & JSPROP_ENUMERATE)
|
||||||
|
@ -1595,7 +1595,7 @@ js_PropertyIsEnumerable(JSContext *cx, JSObject *obj, jsid id, Value *vp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
uintN attrs;
|
uintN attrs;
|
||||||
if (!pobj->getAttributes(cx, id, &attrs))
|
if (!pobj->getGenericAttributes(cx, id, &attrs))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
vp->setBoolean((attrs & JSPROP_ENUMERATE) != 0);
|
vp->setBoolean((attrs & JSPROP_ENUMERATE) != 0);
|
||||||
@ -1863,7 +1863,7 @@ GetOwnPropertyDescriptor(JSContext *cx, JSObject *obj, jsid id, PropertyDescript
|
|||||||
desc->setter = CastAsStrictPropertyOp(shape->setterObject());
|
desc->setter = CastAsStrictPropertyOp(shape->setterObject());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!pobj->getAttributes(cx, id, &desc->attrs))
|
if (!pobj->getGenericAttributes(cx, id, &desc->attrs))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2750,7 +2750,7 @@ JSObject::sealOrFreeze(JSContext *cx, ImmutabilityType it)
|
|||||||
jsid id = props[i];
|
jsid id = props[i];
|
||||||
|
|
||||||
uintN attrs;
|
uintN attrs;
|
||||||
if (!getAttributes(cx, id, &attrs))
|
if (!getGenericAttributes(cx, id, &attrs))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* Make all attributes permanent; if freezing, make data attributes read-only. */
|
/* Make all attributes permanent; if freezing, make data attributes read-only. */
|
||||||
@ -2765,7 +2765,7 @@ JSObject::sealOrFreeze(JSContext *cx, ImmutabilityType it)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
attrs |= new_attrs;
|
attrs |= new_attrs;
|
||||||
if (!setAttributes(cx, id, &attrs))
|
if (!setGenericAttributes(cx, id, &attrs))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2788,7 +2788,7 @@ JSObject::isSealedOrFrozen(JSContext *cx, ImmutabilityType it, bool *resultp)
|
|||||||
jsid id = props[i];
|
jsid id = props[i];
|
||||||
|
|
||||||
uintN attrs;
|
uintN attrs;
|
||||||
if (!getAttributes(cx, id, &attrs))
|
if (!getGenericAttributes(cx, id, &attrs))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -3337,45 +3337,51 @@ with_SetSpecial(JSContext *cx, JSObject *obj, SpecialId sid, Value *vp, JSBool s
|
|||||||
}
|
}
|
||||||
|
|
||||||
static JSBool
|
static JSBool
|
||||||
with_GetAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp)
|
with_GetGenericAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp)
|
||||||
{
|
{
|
||||||
return obj->getProto()->getAttributes(cx, id, attrsp);
|
return obj->getProto()->getGenericAttributes(cx, id, attrsp);
|
||||||
|
}
|
||||||
|
|
||||||
|
static JSBool
|
||||||
|
with_GetPropertyAttributes(JSContext *cx, JSObject *obj, PropertyName *name, uintN *attrsp)
|
||||||
|
{
|
||||||
|
return obj->getProto()->getPropertyAttributes(cx, name, attrsp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static JSBool
|
static JSBool
|
||||||
with_GetElementAttributes(JSContext *cx, JSObject *obj, uint32 index, uintN *attrsp)
|
with_GetElementAttributes(JSContext *cx, JSObject *obj, uint32 index, uintN *attrsp)
|
||||||
{
|
{
|
||||||
jsid id;
|
return obj->getProto()->getElementAttributes(cx, index, attrsp);
|
||||||
if (!IndexToId(cx, index, &id))
|
|
||||||
return false;
|
|
||||||
return with_GetAttributes(cx, obj, id, attrsp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static JSBool
|
static JSBool
|
||||||
with_GetSpecialAttributes(JSContext *cx, JSObject *obj, SpecialId sid, uintN *attrsp)
|
with_GetSpecialAttributes(JSContext *cx, JSObject *obj, SpecialId sid, uintN *attrsp)
|
||||||
{
|
{
|
||||||
return with_GetAttributes(cx, obj, SPECIALID_TO_JSID(sid), attrsp);
|
return obj->getProto()->getSpecialAttributes(cx, sid, attrsp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static JSBool
|
static JSBool
|
||||||
with_SetAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp)
|
with_SetGenericAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp)
|
||||||
{
|
{
|
||||||
return obj->getProto()->setAttributes(cx, id, attrsp);
|
return obj->getProto()->setGenericAttributes(cx, id, attrsp);
|
||||||
|
}
|
||||||
|
|
||||||
|
static JSBool
|
||||||
|
with_SetPropertyAttributes(JSContext *cx, JSObject *obj, PropertyName *name, uintN *attrsp)
|
||||||
|
{
|
||||||
|
return obj->getProto()->setPropertyAttributes(cx, name, attrsp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static JSBool
|
static JSBool
|
||||||
with_SetElementAttributes(JSContext *cx, JSObject *obj, uint32 index, uintN *attrsp)
|
with_SetElementAttributes(JSContext *cx, JSObject *obj, uint32 index, uintN *attrsp)
|
||||||
{
|
{
|
||||||
jsid id;
|
return obj->getProto()->setElementAttributes(cx, index, attrsp);
|
||||||
if (!IndexToId(cx, index, &id))
|
|
||||||
return false;
|
|
||||||
return with_SetAttributes(cx, obj, id, attrsp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static JSBool
|
static JSBool
|
||||||
with_SetSpecialAttributes(JSContext *cx, JSObject *obj, SpecialId sid, uintN *attrsp)
|
with_SetSpecialAttributes(JSContext *cx, JSObject *obj, SpecialId sid, uintN *attrsp)
|
||||||
{
|
{
|
||||||
return with_SetAttributes(cx, obj, SPECIALID_TO_JSID(sid), attrsp);
|
return obj->getProto()->setSpecialAttributes(cx, sid, attrsp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static JSBool
|
static JSBool
|
||||||
@ -3454,12 +3460,12 @@ Class js::WithClass = {
|
|||||||
with_SetProperty,
|
with_SetProperty,
|
||||||
with_SetElement,
|
with_SetElement,
|
||||||
with_SetSpecial,
|
with_SetSpecial,
|
||||||
with_GetAttributes,
|
with_GetGenericAttributes,
|
||||||
with_GetAttributes,
|
with_GetPropertyAttributes,
|
||||||
with_GetElementAttributes,
|
with_GetElementAttributes,
|
||||||
with_GetSpecialAttributes,
|
with_GetSpecialAttributes,
|
||||||
with_SetAttributes,
|
with_SetGenericAttributes,
|
||||||
with_SetAttributes,
|
with_SetPropertyAttributes,
|
||||||
with_SetElementAttributes,
|
with_SetElementAttributes,
|
||||||
with_SetSpecialAttributes,
|
with_SetSpecialAttributes,
|
||||||
with_DeleteProperty,
|
with_DeleteProperty,
|
||||||
@ -6336,7 +6342,7 @@ js_GetAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!obj->isNative())
|
if (!obj->isNative())
|
||||||
return obj->getAttributes(cx, id, attrsp);
|
return obj->getGenericAttributes(cx, id, attrsp);
|
||||||
|
|
||||||
const Shape *shape = (Shape *)prop;
|
const Shape *shape = (Shape *)prop;
|
||||||
*attrsp = shape->attributes();
|
*attrsp = shape->attributes();
|
||||||
@ -6379,7 +6385,7 @@ js_SetAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp)
|
|||||||
return true;
|
return true;
|
||||||
return obj->isNative()
|
return obj->isNative()
|
||||||
? js_SetNativeAttributes(cx, obj, (Shape *) prop, *attrsp)
|
? js_SetNativeAttributes(cx, obj, (Shape *) prop, *attrsp)
|
||||||
: obj->setAttributes(cx, id, attrsp);
|
: obj->setGenericAttributes(cx, id, attrsp);
|
||||||
}
|
}
|
||||||
|
|
||||||
JSBool
|
JSBool
|
||||||
|
@ -1401,22 +1401,15 @@ struct JSObject : js::gc::Cell {
|
|||||||
|
|
||||||
JSBool nonNativeSetElement(JSContext *cx, uint32 index, js::Value *vp, JSBool strict);
|
JSBool nonNativeSetElement(JSContext *cx, uint32 index, js::Value *vp, JSBool strict);
|
||||||
|
|
||||||
JSBool getAttributes(JSContext *cx, jsid id, uintN *attrsp) {
|
inline JSBool getGenericAttributes(JSContext *cx, jsid id, uintN *attrsp);
|
||||||
js::AttributesOp op = getOps()->getAttributes;
|
inline JSBool getPropertyAttributes(JSContext *cx, js::PropertyName *name, uintN *attrsp);
|
||||||
return (op ? op : js_GetAttributes)(cx, this, id, attrsp);
|
inline JSBool getElementAttributes(JSContext *cx, uint32 index, uintN *attrsp);
|
||||||
}
|
inline JSBool getSpecialAttributes(JSContext *cx, js::SpecialId sid, uintN *attrsp);
|
||||||
|
|
||||||
JSBool getElementAttributes(JSContext *cx, uint32 index, uintN *attrsp) {
|
inline JSBool setGenericAttributes(JSContext *cx, jsid id, uintN *attrsp);
|
||||||
js::ElementAttributesOp op = getOps()->getElementAttributes;
|
inline JSBool setPropertyAttributes(JSContext *cx, js::PropertyName *name, uintN *attrsp);
|
||||||
return (op ? op : js_GetElementAttributes)(cx, this, index, attrsp);
|
inline JSBool setElementAttributes(JSContext *cx, uint32 index, uintN *attrsp);
|
||||||
}
|
inline JSBool setSpecialAttributes(JSContext *cx, js::SpecialId sid, uintN *attrsp);
|
||||||
|
|
||||||
inline JSBool setAttributes(JSContext *cx, jsid id, uintN *attrsp);
|
|
||||||
|
|
||||||
JSBool setElementAttributes(JSContext *cx, uint32 index, uintN *attrsp) {
|
|
||||||
js::ElementAttributesOp op = getOps()->setElementAttributes;
|
|
||||||
return (op ? op : js_SetElementAttributes)(cx, this, index, attrsp);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline JSBool deleteProperty(JSContext *cx, jsid id, js::Value *rval, JSBool strict);
|
inline JSBool deleteProperty(JSContext *cx, jsid id, js::Value *rval, JSBool strict);
|
||||||
|
|
||||||
|
@ -126,13 +126,32 @@ JSObject::unbrand(JSContext *cx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline JSBool
|
inline JSBool
|
||||||
JSObject::setAttributes(JSContext *cx, jsid id, uintN *attrsp)
|
JSObject::setGenericAttributes(JSContext *cx, jsid id, uintN *attrsp)
|
||||||
{
|
{
|
||||||
js::types::MarkTypePropertyConfigured(cx, this, id);
|
js::types::MarkTypePropertyConfigured(cx, this, id);
|
||||||
js::AttributesOp op = getOps()->setAttributes;
|
js::GenericAttributesOp op = getOps()->setGenericAttributes;
|
||||||
return (op ? op : js_SetAttributes)(cx, this, id, attrsp);
|
return (op ? op : js_SetAttributes)(cx, this, id, attrsp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline JSBool
|
||||||
|
JSObject::setPropertyAttributes(JSContext *cx, js::PropertyName *name, uintN *attrsp)
|
||||||
|
{
|
||||||
|
return setGenericAttributes(cx, ATOM_TO_JSID(name), attrsp);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline JSBool
|
||||||
|
JSObject::setElementAttributes(JSContext *cx, uint32 index, uintN *attrsp)
|
||||||
|
{
|
||||||
|
js::ElementAttributesOp op = getOps()->setElementAttributes;
|
||||||
|
return (op ? op : js_SetElementAttributes)(cx, this, index, attrsp);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline JSBool
|
||||||
|
JSObject::setSpecialAttributes(JSContext *cx, js::SpecialId sid, uintN *attrsp)
|
||||||
|
{
|
||||||
|
return setGenericAttributes(cx, SPECIALID_TO_JSID(sid), attrsp);
|
||||||
|
}
|
||||||
|
|
||||||
inline JSBool
|
inline JSBool
|
||||||
JSObject::getGeneric(JSContext *cx, JSObject *receiver, jsid id, js::Value *vp)
|
JSObject::getGeneric(JSContext *cx, JSObject *receiver, jsid id, js::Value *vp)
|
||||||
{
|
{
|
||||||
@ -1162,6 +1181,34 @@ JSObject::getSpecial(JSContext *cx, js::SpecialId sid, js::Value *vp)
|
|||||||
return getGeneric(cx, SPECIALID_TO_JSID(sid), vp);
|
return getGeneric(cx, SPECIALID_TO_JSID(sid), vp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline JSBool
|
||||||
|
JSObject::getGenericAttributes(JSContext *cx, jsid id, uintN *attrsp)
|
||||||
|
{
|
||||||
|
js::GenericAttributesOp op = getOps()->getGenericAttributes;
|
||||||
|
return (op ? op : js_GetAttributes)(cx, this, id, attrsp);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline JSBool
|
||||||
|
JSObject::getPropertyAttributes(JSContext *cx, js::PropertyName *name, uintN *attrsp)
|
||||||
|
{
|
||||||
|
return getGenericAttributes(cx, ATOM_TO_JSID(name), attrsp);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline JSBool
|
||||||
|
JSObject::getElementAttributes(JSContext *cx, uint32 index, uintN *attrsp)
|
||||||
|
{
|
||||||
|
jsid id;
|
||||||
|
if (!js::IndexToId(cx, index, &id))
|
||||||
|
return false;
|
||||||
|
return getGenericAttributes(cx, id, attrsp);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline JSBool
|
||||||
|
JSObject::getSpecialAttributes(JSContext *cx, js::SpecialId sid, uintN *attrsp)
|
||||||
|
{
|
||||||
|
return getGenericAttributes(cx, SPECIALID_TO_JSID(sid), attrsp);
|
||||||
|
}
|
||||||
|
|
||||||
inline bool
|
inline bool
|
||||||
JSObject::isProxy() const
|
JSObject::isProxy() const
|
||||||
{
|
{
|
||||||
|
@ -1040,7 +1040,7 @@ proxy_SetSpecial(JSContext *cx, JSObject *obj, SpecialId sid, Value *vp, JSBool
|
|||||||
}
|
}
|
||||||
|
|
||||||
static JSBool
|
static JSBool
|
||||||
proxy_GetAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp)
|
proxy_GetGenericAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp)
|
||||||
{
|
{
|
||||||
id = js_CheckForStringIndex(id);
|
id = js_CheckForStringIndex(id);
|
||||||
|
|
||||||
@ -1051,23 +1051,29 @@ proxy_GetAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static JSBool
|
||||||
|
proxy_GetPropertyAttributes(JSContext *cx, JSObject *obj, PropertyName *name, uintN *attrsp)
|
||||||
|
{
|
||||||
|
return proxy_GetGenericAttributes(cx, obj, ATOM_TO_JSID(name), attrsp);
|
||||||
|
}
|
||||||
|
|
||||||
static JSBool
|
static JSBool
|
||||||
proxy_GetElementAttributes(JSContext *cx, JSObject *obj, uint32 index, uintN *attrsp)
|
proxy_GetElementAttributes(JSContext *cx, JSObject *obj, uint32 index, uintN *attrsp)
|
||||||
{
|
{
|
||||||
jsid id;
|
jsid id;
|
||||||
if (!IndexToId(cx, index, &id))
|
if (!IndexToId(cx, index, &id))
|
||||||
return false;
|
return false;
|
||||||
return proxy_GetAttributes(cx, obj, id, attrsp);
|
return proxy_GetGenericAttributes(cx, obj, id, attrsp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static JSBool
|
static JSBool
|
||||||
proxy_GetSpecialAttributes(JSContext *cx, JSObject *obj, SpecialId sid, uintN *attrsp)
|
proxy_GetSpecialAttributes(JSContext *cx, JSObject *obj, SpecialId sid, uintN *attrsp)
|
||||||
{
|
{
|
||||||
return proxy_GetAttributes(cx, obj, SPECIALID_TO_JSID(sid), attrsp);
|
return proxy_GetGenericAttributes(cx, obj, SPECIALID_TO_JSID(sid), attrsp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static JSBool
|
static JSBool
|
||||||
proxy_SetAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp)
|
proxy_SetGenericAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp)
|
||||||
{
|
{
|
||||||
id = js_CheckForStringIndex(id);
|
id = js_CheckForStringIndex(id);
|
||||||
|
|
||||||
@ -1079,19 +1085,25 @@ proxy_SetAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp)
|
|||||||
return Proxy::defineProperty(cx, obj, id, &desc);
|
return Proxy::defineProperty(cx, obj, id, &desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static JSBool
|
||||||
|
proxy_SetPropertyAttributes(JSContext *cx, JSObject *obj, PropertyName *name, uintN *attrsp)
|
||||||
|
{
|
||||||
|
return proxy_SetGenericAttributes(cx, obj, ATOM_TO_JSID(name), attrsp);
|
||||||
|
}
|
||||||
|
|
||||||
static JSBool
|
static JSBool
|
||||||
proxy_SetElementAttributes(JSContext *cx, JSObject *obj, uint32 index, uintN *attrsp)
|
proxy_SetElementAttributes(JSContext *cx, JSObject *obj, uint32 index, uintN *attrsp)
|
||||||
{
|
{
|
||||||
jsid id;
|
jsid id;
|
||||||
if (!IndexToId(cx, index, &id))
|
if (!IndexToId(cx, index, &id))
|
||||||
return false;
|
return false;
|
||||||
return proxy_SetAttributes(cx, obj, id, attrsp);
|
return proxy_SetGenericAttributes(cx, obj, id, attrsp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static JSBool
|
static JSBool
|
||||||
proxy_SetSpecialAttributes(JSContext *cx, JSObject *obj, SpecialId sid, uintN *attrsp)
|
proxy_SetSpecialAttributes(JSContext *cx, JSObject *obj, SpecialId sid, uintN *attrsp)
|
||||||
{
|
{
|
||||||
return proxy_SetAttributes(cx, obj, SPECIALID_TO_JSID(sid), attrsp);
|
return proxy_SetGenericAttributes(cx, obj, SPECIALID_TO_JSID(sid), attrsp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static JSBool
|
static JSBool
|
||||||
@ -1225,12 +1237,12 @@ JS_FRIEND_DATA(Class) js::ObjectProxyClass = {
|
|||||||
proxy_SetProperty,
|
proxy_SetProperty,
|
||||||
proxy_SetElement,
|
proxy_SetElement,
|
||||||
proxy_SetSpecial,
|
proxy_SetSpecial,
|
||||||
proxy_GetAttributes,
|
proxy_GetGenericAttributes,
|
||||||
proxy_GetAttributes,
|
proxy_GetPropertyAttributes,
|
||||||
proxy_GetElementAttributes,
|
proxy_GetElementAttributes,
|
||||||
proxy_GetSpecialAttributes,
|
proxy_GetSpecialAttributes,
|
||||||
proxy_SetAttributes,
|
proxy_SetGenericAttributes,
|
||||||
proxy_SetAttributes,
|
proxy_SetPropertyAttributes,
|
||||||
proxy_SetElementAttributes,
|
proxy_SetElementAttributes,
|
||||||
proxy_SetSpecialAttributes,
|
proxy_SetSpecialAttributes,
|
||||||
proxy_DeleteProperty,
|
proxy_DeleteProperty,
|
||||||
@ -1286,12 +1298,12 @@ JS_FRIEND_DATA(Class) js::OuterWindowProxyClass = {
|
|||||||
proxy_SetProperty,
|
proxy_SetProperty,
|
||||||
proxy_SetElement,
|
proxy_SetElement,
|
||||||
proxy_SetSpecial,
|
proxy_SetSpecial,
|
||||||
proxy_GetAttributes,
|
proxy_GetGenericAttributes,
|
||||||
proxy_GetAttributes,
|
proxy_GetPropertyAttributes,
|
||||||
proxy_GetElementAttributes,
|
proxy_GetElementAttributes,
|
||||||
proxy_GetSpecialAttributes,
|
proxy_GetSpecialAttributes,
|
||||||
proxy_SetAttributes,
|
proxy_SetGenericAttributes,
|
||||||
proxy_SetAttributes,
|
proxy_SetPropertyAttributes,
|
||||||
proxy_SetElementAttributes,
|
proxy_SetElementAttributes,
|
||||||
proxy_SetSpecialAttributes,
|
proxy_SetSpecialAttributes,
|
||||||
proxy_DeleteProperty,
|
proxy_DeleteProperty,
|
||||||
@ -1359,12 +1371,12 @@ JS_FRIEND_DATA(Class) js::FunctionProxyClass = {
|
|||||||
proxy_SetProperty,
|
proxy_SetProperty,
|
||||||
proxy_SetElement,
|
proxy_SetElement,
|
||||||
proxy_SetSpecial,
|
proxy_SetSpecial,
|
||||||
proxy_GetAttributes,
|
proxy_GetGenericAttributes,
|
||||||
proxy_GetAttributes,
|
proxy_GetPropertyAttributes,
|
||||||
proxy_GetElementAttributes,
|
proxy_GetElementAttributes,
|
||||||
proxy_GetSpecialAttributes,
|
proxy_GetSpecialAttributes,
|
||||||
proxy_SetAttributes,
|
proxy_SetGenericAttributes,
|
||||||
proxy_SetAttributes,
|
proxy_SetPropertyAttributes,
|
||||||
proxy_SetElementAttributes,
|
proxy_SetElementAttributes,
|
||||||
proxy_SetSpecialAttributes,
|
proxy_SetSpecialAttributes,
|
||||||
proxy_DeleteProperty,
|
proxy_DeleteProperty,
|
||||||
|
@ -462,7 +462,7 @@ ArrayBuffer::obj_setSpecial(JSContext *cx, JSObject *obj, SpecialId sid, Value *
|
|||||||
}
|
}
|
||||||
|
|
||||||
JSBool
|
JSBool
|
||||||
ArrayBuffer::obj_getAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp)
|
ArrayBuffer::obj_getGenericAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp)
|
||||||
{
|
{
|
||||||
if (JSID_IS_ATOM(id, cx->runtime->atomState.byteLengthAtom)) {
|
if (JSID_IS_ATOM(id, cx->runtime->atomState.byteLengthAtom)) {
|
||||||
*attrsp = JSPROP_PERMANENT | JSPROP_READONLY;
|
*attrsp = JSPROP_PERMANENT | JSPROP_READONLY;
|
||||||
@ -475,6 +475,12 @@ ArrayBuffer::obj_getAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *att
|
|||||||
return js_GetAttributes(cx, delegate, id, attrsp);
|
return js_GetAttributes(cx, delegate, id, attrsp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JSBool
|
||||||
|
ArrayBuffer::obj_getPropertyAttributes(JSContext *cx, JSObject *obj, PropertyName *name, uintN *attrsp)
|
||||||
|
{
|
||||||
|
return obj_getGenericAttributes(cx, obj, ATOM_TO_JSID(name), attrsp);
|
||||||
|
}
|
||||||
|
|
||||||
JSBool
|
JSBool
|
||||||
ArrayBuffer::obj_getElementAttributes(JSContext *cx, JSObject *obj, uint32 index, uintN *attrsp)
|
ArrayBuffer::obj_getElementAttributes(JSContext *cx, JSObject *obj, uint32 index, uintN *attrsp)
|
||||||
{
|
{
|
||||||
@ -487,11 +493,11 @@ ArrayBuffer::obj_getElementAttributes(JSContext *cx, JSObject *obj, uint32 index
|
|||||||
JSBool
|
JSBool
|
||||||
ArrayBuffer::obj_getSpecialAttributes(JSContext *cx, JSObject *obj, SpecialId sid, uintN *attrsp)
|
ArrayBuffer::obj_getSpecialAttributes(JSContext *cx, JSObject *obj, SpecialId sid, uintN *attrsp)
|
||||||
{
|
{
|
||||||
return obj_getAttributes(cx, obj, SPECIALID_TO_JSID(sid), attrsp);
|
return obj_getGenericAttributes(cx, obj, SPECIALID_TO_JSID(sid), attrsp);
|
||||||
}
|
}
|
||||||
|
|
||||||
JSBool
|
JSBool
|
||||||
ArrayBuffer::obj_setAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp)
|
ArrayBuffer::obj_setGenericAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp)
|
||||||
{
|
{
|
||||||
if (JSID_IS_ATOM(id, cx->runtime->atomState.byteLengthAtom)) {
|
if (JSID_IS_ATOM(id, cx->runtime->atomState.byteLengthAtom)) {
|
||||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL,
|
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL,
|
||||||
@ -505,6 +511,12 @@ ArrayBuffer::obj_setAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *att
|
|||||||
return js_SetAttributes(cx, delegate, id, attrsp);
|
return js_SetAttributes(cx, delegate, id, attrsp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JSBool
|
||||||
|
ArrayBuffer::obj_setPropertyAttributes(JSContext *cx, JSObject *obj, PropertyName *name, uintN *attrsp)
|
||||||
|
{
|
||||||
|
return obj_setGenericAttributes(cx, obj, ATOM_TO_JSID(name), attrsp);
|
||||||
|
}
|
||||||
|
|
||||||
JSBool
|
JSBool
|
||||||
ArrayBuffer::obj_setElementAttributes(JSContext *cx, JSObject *obj, uint32 index, uintN *attrsp)
|
ArrayBuffer::obj_setElementAttributes(JSContext *cx, JSObject *obj, uint32 index, uintN *attrsp)
|
||||||
{
|
{
|
||||||
@ -517,7 +529,7 @@ ArrayBuffer::obj_setElementAttributes(JSContext *cx, JSObject *obj, uint32 index
|
|||||||
JSBool
|
JSBool
|
||||||
ArrayBuffer::obj_setSpecialAttributes(JSContext *cx, JSObject *obj, SpecialId sid, uintN *attrsp)
|
ArrayBuffer::obj_setSpecialAttributes(JSContext *cx, JSObject *obj, SpecialId sid, uintN *attrsp)
|
||||||
{
|
{
|
||||||
return obj_setAttributes(cx, obj, SPECIALID_TO_JSID(sid), attrsp);
|
return obj_setGenericAttributes(cx, obj, SPECIALID_TO_JSID(sid), attrsp);
|
||||||
}
|
}
|
||||||
|
|
||||||
JSBool
|
JSBool
|
||||||
@ -722,7 +734,7 @@ TypedArray::obj_lookupSpecial(JSContext *cx, JSObject *obj, SpecialId sid,
|
|||||||
}
|
}
|
||||||
|
|
||||||
JSBool
|
JSBool
|
||||||
TypedArray::obj_getAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp)
|
TypedArray::obj_getGenericAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp)
|
||||||
{
|
{
|
||||||
*attrsp = (JSID_IS_ATOM(id, cx->runtime->atomState.lengthAtom))
|
*attrsp = (JSID_IS_ATOM(id, cx->runtime->atomState.lengthAtom))
|
||||||
? JSPROP_PERMANENT | JSPROP_READONLY
|
? JSPROP_PERMANENT | JSPROP_READONLY
|
||||||
@ -730,6 +742,13 @@ TypedArray::obj_getAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *attr
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JSBool
|
||||||
|
TypedArray::obj_getPropertyAttributes(JSContext *cx, JSObject *obj, PropertyName *name, uintN *attrsp)
|
||||||
|
{
|
||||||
|
*attrsp = JSPROP_PERMANENT | JSPROP_ENUMERATE;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
JSBool
|
JSBool
|
||||||
TypedArray::obj_getElementAttributes(JSContext *cx, JSObject *obj, uint32 index, uintN *attrsp)
|
TypedArray::obj_getElementAttributes(JSContext *cx, JSObject *obj, uint32 index, uintN *attrsp)
|
||||||
{
|
{
|
||||||
@ -740,11 +759,18 @@ TypedArray::obj_getElementAttributes(JSContext *cx, JSObject *obj, uint32 index,
|
|||||||
JSBool
|
JSBool
|
||||||
TypedArray::obj_getSpecialAttributes(JSContext *cx, JSObject *obj, SpecialId sid, uintN *attrsp)
|
TypedArray::obj_getSpecialAttributes(JSContext *cx, JSObject *obj, SpecialId sid, uintN *attrsp)
|
||||||
{
|
{
|
||||||
return obj_getAttributes(cx, obj, SPECIALID_TO_JSID(sid), attrsp);
|
return obj_getGenericAttributes(cx, obj, SPECIALID_TO_JSID(sid), attrsp);
|
||||||
}
|
}
|
||||||
|
|
||||||
JSBool
|
JSBool
|
||||||
TypedArray::obj_setAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp)
|
TypedArray::obj_setGenericAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp)
|
||||||
|
{
|
||||||
|
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_CANT_SET_ARRAY_ATTRS);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
JSBool
|
||||||
|
TypedArray::obj_setPropertyAttributes(JSContext *cx, JSObject *obj, PropertyName *name, uintN *attrsp)
|
||||||
{
|
{
|
||||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_CANT_SET_ARRAY_ATTRS);
|
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_CANT_SET_ARRAY_ATTRS);
|
||||||
return false;
|
return false;
|
||||||
@ -760,7 +786,8 @@ TypedArray::obj_setElementAttributes(JSContext *cx, JSObject *obj, uint32 index,
|
|||||||
JSBool
|
JSBool
|
||||||
TypedArray::obj_setSpecialAttributes(JSContext *cx, JSObject *obj, SpecialId sid, uintN *attrsp)
|
TypedArray::obj_setSpecialAttributes(JSContext *cx, JSObject *obj, SpecialId sid, uintN *attrsp)
|
||||||
{
|
{
|
||||||
return obj_setAttributes(cx, obj, SPECIALID_TO_JSID(sid), attrsp);
|
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_CANT_SET_ARRAY_ATTRS);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */ int
|
/* static */ int
|
||||||
@ -2045,12 +2072,12 @@ Class js::ArrayBufferClass = {
|
|||||||
ArrayBuffer::obj_setProperty,
|
ArrayBuffer::obj_setProperty,
|
||||||
ArrayBuffer::obj_setElement,
|
ArrayBuffer::obj_setElement,
|
||||||
ArrayBuffer::obj_setSpecial,
|
ArrayBuffer::obj_setSpecial,
|
||||||
ArrayBuffer::obj_getAttributes,
|
ArrayBuffer::obj_getGenericAttributes,
|
||||||
ArrayBuffer::obj_getAttributes,
|
ArrayBuffer::obj_getPropertyAttributes,
|
||||||
ArrayBuffer::obj_getElementAttributes,
|
ArrayBuffer::obj_getElementAttributes,
|
||||||
ArrayBuffer::obj_getSpecialAttributes,
|
ArrayBuffer::obj_getSpecialAttributes,
|
||||||
ArrayBuffer::obj_setAttributes,
|
ArrayBuffer::obj_setGenericAttributes,
|
||||||
ArrayBuffer::obj_setAttributes,
|
ArrayBuffer::obj_setPropertyAttributes,
|
||||||
ArrayBuffer::obj_setElementAttributes,
|
ArrayBuffer::obj_setElementAttributes,
|
||||||
ArrayBuffer::obj_setSpecialAttributes,
|
ArrayBuffer::obj_setSpecialAttributes,
|
||||||
ArrayBuffer::obj_deleteProperty,
|
ArrayBuffer::obj_deleteProperty,
|
||||||
@ -2149,7 +2176,7 @@ JSFunctionSpec _typedArray::jsfuncs[] = { \
|
|||||||
_typedArray::obj_defineProperty, \
|
_typedArray::obj_defineProperty, \
|
||||||
_typedArray::obj_defineElement, \
|
_typedArray::obj_defineElement, \
|
||||||
_typedArray::obj_defineSpecial, \
|
_typedArray::obj_defineSpecial, \
|
||||||
_typedArray::obj_getGeneric, \
|
_typedArray::obj_getGeneric, \
|
||||||
_typedArray::obj_getProperty, \
|
_typedArray::obj_getProperty, \
|
||||||
_typedArray::obj_getElement, \
|
_typedArray::obj_getElement, \
|
||||||
_typedArray::obj_getSpecial, \
|
_typedArray::obj_getSpecial, \
|
||||||
@ -2157,12 +2184,12 @@ JSFunctionSpec _typedArray::jsfuncs[] = { \
|
|||||||
_typedArray::obj_setProperty, \
|
_typedArray::obj_setProperty, \
|
||||||
_typedArray::obj_setElement, \
|
_typedArray::obj_setElement, \
|
||||||
_typedArray::obj_setSpecial, \
|
_typedArray::obj_setSpecial, \
|
||||||
_typedArray::obj_getAttributes, \
|
_typedArray::obj_getGenericAttributes, \
|
||||||
_typedArray::obj_getAttributes, \
|
_typedArray::obj_getPropertyAttributes, \
|
||||||
_typedArray::obj_getElementAttributes, \
|
_typedArray::obj_getElementAttributes, \
|
||||||
_typedArray::obj_getSpecialAttributes, \
|
_typedArray::obj_getSpecialAttributes, \
|
||||||
_typedArray::obj_setAttributes, \
|
_typedArray::obj_setGenericAttributes, \
|
||||||
_typedArray::obj_setAttributes, \
|
_typedArray::obj_setPropertyAttributes, \
|
||||||
_typedArray::obj_setElementAttributes, \
|
_typedArray::obj_setElementAttributes, \
|
||||||
_typedArray::obj_setSpecialAttributes, \
|
_typedArray::obj_setSpecialAttributes, \
|
||||||
_typedArray::obj_deleteProperty, \
|
_typedArray::obj_deleteProperty, \
|
||||||
|
@ -122,20 +122,20 @@ struct JS_FRIEND_API(ArrayBuffer) {
|
|||||||
obj_setSpecial(JSContext *cx, JSObject *obj, SpecialId sid, Value *vp, JSBool strict);
|
obj_setSpecial(JSContext *cx, JSObject *obj, SpecialId sid, Value *vp, JSBool strict);
|
||||||
|
|
||||||
static JSBool
|
static JSBool
|
||||||
obj_getAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp);
|
obj_getGenericAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp);
|
||||||
|
static JSBool
|
||||||
|
obj_getPropertyAttributes(JSContext *cx, JSObject *obj, PropertyName *name, uintN *attrsp);
|
||||||
static JSBool
|
static JSBool
|
||||||
obj_getElementAttributes(JSContext *cx, JSObject *obj, uint32 index, uintN *attrsp);
|
obj_getElementAttributes(JSContext *cx, JSObject *obj, uint32 index, uintN *attrsp);
|
||||||
|
|
||||||
static JSBool
|
static JSBool
|
||||||
obj_getSpecialAttributes(JSContext *cx, JSObject *obj, SpecialId sid, uintN *attrsp);
|
obj_getSpecialAttributes(JSContext *cx, JSObject *obj, SpecialId sid, uintN *attrsp);
|
||||||
|
|
||||||
static JSBool
|
static JSBool
|
||||||
obj_setAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp);
|
obj_setGenericAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp);
|
||||||
|
static JSBool
|
||||||
|
obj_setPropertyAttributes(JSContext *cx, JSObject *obj, PropertyName *name, uintN *attrsp);
|
||||||
static JSBool
|
static JSBool
|
||||||
obj_setElementAttributes(JSContext *cx, JSObject *obj, uint32 index, uintN *attrsp);
|
obj_setElementAttributes(JSContext *cx, JSObject *obj, uint32 index, uintN *attrsp);
|
||||||
|
|
||||||
static JSBool
|
static JSBool
|
||||||
obj_setSpecialAttributes(JSContext *cx, JSObject *obj, SpecialId sid, uintN *attrsp);
|
obj_setSpecialAttributes(JSContext *cx, JSObject *obj, SpecialId sid, uintN *attrsp);
|
||||||
|
|
||||||
@ -222,11 +222,13 @@ struct JS_FRIEND_API(TypedArray) {
|
|||||||
static JSBool obj_lookupSpecial(JSContext *cx, JSObject *obj, SpecialId sid,
|
static JSBool obj_lookupSpecial(JSContext *cx, JSObject *obj, SpecialId sid,
|
||||||
JSObject **objp, JSProperty **propp);
|
JSObject **objp, JSProperty **propp);
|
||||||
|
|
||||||
static JSBool obj_getAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp);
|
static JSBool obj_getGenericAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp);
|
||||||
|
static JSBool obj_getPropertyAttributes(JSContext *cx, JSObject *obj, PropertyName *name, uintN *attrsp);
|
||||||
static JSBool obj_getElementAttributes(JSContext *cx, JSObject *obj, uint32 index, uintN *attrsp);
|
static JSBool obj_getElementAttributes(JSContext *cx, JSObject *obj, uint32 index, uintN *attrsp);
|
||||||
static JSBool obj_getSpecialAttributes(JSContext *cx, JSObject *obj, SpecialId sid, uintN *attrsp);
|
static JSBool obj_getSpecialAttributes(JSContext *cx, JSObject *obj, SpecialId sid, uintN *attrsp);
|
||||||
|
|
||||||
static JSBool obj_setAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp);
|
static JSBool obj_setGenericAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp);
|
||||||
|
static JSBool obj_setPropertyAttributes(JSContext *cx, JSObject *obj, PropertyName *name, uintN *attrsp);
|
||||||
static JSBool obj_setElementAttributes(JSContext *cx, JSObject *obj, uint32 index, uintN *attrsp);
|
static JSBool obj_setElementAttributes(JSContext *cx, JSObject *obj, uint32 index, uintN *attrsp);
|
||||||
static JSBool obj_setSpecialAttributes(JSContext *cx, JSObject *obj, SpecialId sid, uintN *attrsp);
|
static JSBool obj_setSpecialAttributes(JSContext *cx, JSObject *obj, SpecialId sid, uintN *attrsp);
|
||||||
|
|
||||||
|
@ -4877,7 +4877,7 @@ xml_setSpecial(JSContext *cx, JSObject *obj, SpecialId sid, Value *vp, JSBool st
|
|||||||
}
|
}
|
||||||
|
|
||||||
static JSBool
|
static JSBool
|
||||||
xml_getAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp)
|
xml_getGenericAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp)
|
||||||
{
|
{
|
||||||
JSBool found;
|
JSBool found;
|
||||||
if (!HasProperty(cx, obj, IdToJsval(id), &found))
|
if (!HasProperty(cx, obj, IdToJsval(id), &found))
|
||||||
@ -4887,23 +4887,29 @@ xml_getAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp)
|
|||||||
return JS_TRUE;
|
return JS_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static JSBool
|
||||||
|
xml_getPropertyAttributes(JSContext *cx, JSObject *obj, PropertyName *name, uintN *attrsp)
|
||||||
|
{
|
||||||
|
return xml_getGenericAttributes(cx, obj, ATOM_TO_JSID(name), attrsp);
|
||||||
|
}
|
||||||
|
|
||||||
static JSBool
|
static JSBool
|
||||||
xml_getElementAttributes(JSContext *cx, JSObject *obj, uint32 index, uintN *attrsp)
|
xml_getElementAttributes(JSContext *cx, JSObject *obj, uint32 index, uintN *attrsp)
|
||||||
{
|
{
|
||||||
jsid id;
|
jsid id;
|
||||||
if (!IndexToId(cx, index, &id))
|
if (!IndexToId(cx, index, &id))
|
||||||
return false;
|
return false;
|
||||||
return xml_getAttributes(cx, obj, id, attrsp);
|
return xml_getGenericAttributes(cx, obj, id, attrsp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static JSBool
|
static JSBool
|
||||||
xml_getSpecialAttributes(JSContext *cx, JSObject *obj, SpecialId sid, uintN *attrsp)
|
xml_getSpecialAttributes(JSContext *cx, JSObject *obj, SpecialId sid, uintN *attrsp)
|
||||||
{
|
{
|
||||||
return xml_getAttributes(cx, obj, SPECIALID_TO_JSID(sid), attrsp);
|
return xml_getGenericAttributes(cx, obj, SPECIALID_TO_JSID(sid), attrsp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static JSBool
|
static JSBool
|
||||||
xml_setAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp)
|
xml_setGenericAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp)
|
||||||
{
|
{
|
||||||
JSBool found;
|
JSBool found;
|
||||||
if (!HasProperty(cx, obj, IdToJsval(id), &found))
|
if (!HasProperty(cx, obj, IdToJsval(id), &found))
|
||||||
@ -4917,19 +4923,25 @@ xml_setAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static JSBool
|
||||||
|
xml_setPropertyAttributes(JSContext *cx, JSObject *obj, PropertyName *name, uintN *attrsp)
|
||||||
|
{
|
||||||
|
return xml_setGenericAttributes(cx, obj, ATOM_TO_JSID(name), attrsp);
|
||||||
|
}
|
||||||
|
|
||||||
static JSBool
|
static JSBool
|
||||||
xml_setElementAttributes(JSContext *cx, JSObject *obj, uint32 index, uintN *attrsp)
|
xml_setElementAttributes(JSContext *cx, JSObject *obj, uint32 index, uintN *attrsp)
|
||||||
{
|
{
|
||||||
jsid id;
|
jsid id;
|
||||||
if (!IndexToId(cx, index, &id))
|
if (!IndexToId(cx, index, &id))
|
||||||
return false;
|
return false;
|
||||||
return xml_setAttributes(cx, obj, id, attrsp);
|
return xml_setGenericAttributes(cx, obj, id, attrsp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static JSBool
|
static JSBool
|
||||||
xml_setSpecialAttributes(JSContext *cx, JSObject *obj, SpecialId sid, uintN *attrsp)
|
xml_setSpecialAttributes(JSContext *cx, JSObject *obj, SpecialId sid, uintN *attrsp)
|
||||||
{
|
{
|
||||||
return xml_setAttributes(cx, obj, SPECIALID_TO_JSID(sid), attrsp);
|
return xml_setGenericAttributes(cx, obj, SPECIALID_TO_JSID(sid), attrsp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static JSBool
|
static JSBool
|
||||||
@ -5324,12 +5336,12 @@ JS_FRIEND_DATA(Class) js::XMLClass = {
|
|||||||
xml_setProperty,
|
xml_setProperty,
|
||||||
xml_setElement,
|
xml_setElement,
|
||||||
xml_setSpecial,
|
xml_setSpecial,
|
||||||
xml_getAttributes,
|
xml_getGenericAttributes,
|
||||||
xml_getAttributes,
|
xml_getPropertyAttributes,
|
||||||
xml_getElementAttributes,
|
xml_getElementAttributes,
|
||||||
xml_getSpecialAttributes,
|
xml_getSpecialAttributes,
|
||||||
xml_setAttributes,
|
xml_setGenericAttributes,
|
||||||
xml_setAttributes,
|
xml_setPropertyAttributes,
|
||||||
xml_setElementAttributes,
|
xml_setElementAttributes,
|
||||||
xml_setSpecialAttributes,
|
xml_setSpecialAttributes,
|
||||||
xml_deleteProperty,
|
xml_deleteProperty,
|
||||||
|
@ -3166,7 +3166,7 @@ CopyProperty(JSContext *cx, JSObject *obj, JSObject *referent, jsid id,
|
|||||||
if (*objp != referent)
|
if (*objp != referent)
|
||||||
return true;
|
return true;
|
||||||
if (!referent->getGeneric(cx, id, &desc.value) ||
|
if (!referent->getGeneric(cx, id, &desc.value) ||
|
||||||
!referent->getAttributes(cx, id, &desc.attrs)) {
|
!referent->getGenericAttributes(cx, id, &desc.attrs)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
desc.attrs &= JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT;
|
desc.attrs &= JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT;
|
||||||
|
Loading…
Reference in New Issue
Block a user