Bug 687621 - Introduce js::SpecialId, encapsulating the non-index, non-string bizarro property names. r=luke

This commit is contained in:
Jeff Walden 2011-09-20 14:34:11 -07:00
Родитель d2691104bb
Коммит 5d8ce748d2
8 изменённых файлов: 228 добавлений и 101 удалений

Просмотреть файл

@ -241,7 +241,7 @@ class Value
* constructor prevents Value from being stored in a union.
*/
/*** Mutatators ***/
/*** Mutators ***/
JS_ALWAYS_INLINE
void setNull() {

Просмотреть файл

@ -754,10 +754,10 @@ array_lookupElement(JSContext *cx, JSObject *obj, uint32 index, JSObject **objp,
}
static JSBool
array_lookupSpecial(JSContext *cx, JSObject *obj, jsid id, JSObject **objp,
array_lookupSpecial(JSContext *cx, JSObject *obj, SpecialId sid, JSObject **objp,
JSProperty **propp)
{
return array_lookupProperty(cx, obj, id, objp, propp);
return array_lookupProperty(cx, obj, SPECIALID_TO_JSID(sid), objp, propp);
}
JSBool
@ -864,9 +864,9 @@ array_getElement(JSContext *cx, JSObject *obj, JSObject *receiver, uint32 index,
}
static JSBool
array_getSpecial(JSContext *cx, JSObject *obj, JSObject *receiver, jsid id, Value *vp)
array_getSpecial(JSContext *cx, JSObject *obj, JSObject *receiver, SpecialId sid, Value *vp)
{
return array_getProperty(cx, obj, receiver, id, vp);
return array_getProperty(cx, obj, receiver, SPECIALID_TO_JSID(sid), vp);
}
static JSBool
@ -964,9 +964,9 @@ array_setElement(JSContext *cx, JSObject *obj, uint32 index, Value *vp, JSBool s
}
static JSBool
array_setSpecial(JSContext *cx, JSObject *obj, jsid id, Value *vp, JSBool strict)
array_setSpecial(JSContext *cx, JSObject *obj, SpecialId sid, Value *vp, JSBool strict)
{
return array_setProperty(cx, obj, id, vp, strict);
return array_setProperty(cx, obj, SPECIALID_TO_JSID(sid), vp, strict);
}
JSBool
@ -1071,10 +1071,10 @@ array_defineElement(JSContext *cx, JSObject *obj, uint32 index, const Value *val
} // namespace js
static JSBool
array_defineSpecial(JSContext *cx, JSObject *obj, jsid id, const Value *value,
array_defineSpecial(JSContext *cx, JSObject *obj, SpecialId sid, const Value *value,
PropertyOp getter, StrictPropertyOp setter, uintN attrs)
{
return array_defineProperty(cx, obj, id, value, getter, setter, attrs);
return array_defineProperty(cx, obj, SPECIALID_TO_JSID(sid), value, getter, setter, attrs);
}
static JSBool
@ -1093,9 +1093,9 @@ array_getElementAttributes(JSContext *cx, JSObject *obj, uint32 index, uintN *at
}
static JSBool
array_getSpecialAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp)
array_getSpecialAttributes(JSContext *cx, JSObject *obj, SpecialId sid, uintN *attrsp)
{
return array_getAttributes(cx, obj, id, attrsp);
return array_getAttributes(cx, obj, SPECIALID_TO_JSID(sid), attrsp);
}
static JSBool
@ -1113,9 +1113,9 @@ array_setElementAttributes(JSContext *cx, JSObject *obj, uint32 index, uintN *at
}
static JSBool
array_setSpecialAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp)
array_setSpecialAttributes(JSContext *cx, JSObject *obj, SpecialId sid, uintN *attrsp)
{
return array_setAttributes(cx, obj, id, attrsp);
return array_setAttributes(cx, obj, SPECIALID_TO_JSID(sid), attrsp);
}
namespace js {
@ -1168,9 +1168,9 @@ array_deleteElement(JSContext *cx, JSObject *obj, uint32 index, Value *rval, JSB
} // namespace js
static JSBool
array_deleteSpecial(JSContext *cx, JSObject *obj, jsid id, Value *rval, JSBool strict)
array_deleteSpecial(JSContext *cx, JSObject *obj, SpecialId sid, Value *rval, JSBool strict)
{
return array_deleteProperty(cx, obj, id, rval, strict);
return array_deleteProperty(cx, obj, SPECIALID_TO_JSID(sid), rval, strict);
}
static void

Просмотреть файл

@ -51,6 +51,126 @@
namespace js {
class AutoIdVector;
class SpecialId;
static JS_ALWAYS_INLINE jsid
SPECIALID_TO_JSID(const SpecialId &sid);
/*
* We partition the ways to refer to a property into three: by an index
* (uint32); by a string whose characters do not represent an index
* (PropertyName, see vm/String.h); and by various special values.
*
* Special values are encoded using SpecialId, which is layout-compatible but
* non-interconvertible with jsid. A SpecialId may be: an object (used by E4X
* and perhaps eventually by Harmony-proposed private names); JSID_VOID, which
* does not occur in JS scripts but may be used to indicate the absence of a
* valid identifier; or JS_DEFAULT_XML_NAMESPACE_ID, if E4X is enabled.
*/
class SpecialId {
uintptr_t bits;
/* Needs access to raw bits. */
friend JS_ALWAYS_INLINE jsid SPECIALID_TO_JSID(const SpecialId &sid);
static const uintptr_t TYPE_VOID = JSID_TYPE_VOID;
static const uintptr_t TYPE_OBJECT = JSID_TYPE_OBJECT;
static const uintptr_t TYPE_DEFAULT_XML_NAMESPACE = JSID_TYPE_DEFAULT_XML_NAMESPACE;
static const uintptr_t TYPE_MASK = JSID_TYPE_MASK;
SpecialId(uintptr_t bits) : bits(bits) { }
public:
SpecialId() : bits(TYPE_VOID) { }
/* Object-valued */
SpecialId(JSObject &obj)
: bits(uintptr_t(&obj) | TYPE_OBJECT)
{
JS_ASSERT(&obj != NULL);
JS_ASSERT((uintptr_t(&obj) & TYPE_MASK) == 0);
}
bool isObject() const {
return (bits & TYPE_MASK) == TYPE_OBJECT && bits != TYPE_OBJECT;
}
JSObject *toObject() const {
JS_ASSERT(isObject());
return reinterpret_cast<JSObject *>(bits & ~TYPE_MASK);
}
/* Empty */
static SpecialId empty() {
SpecialId sid(TYPE_OBJECT);
JS_ASSERT(sid.isEmpty());
return sid;
}
bool isEmpty() const {
return bits == TYPE_OBJECT;
}
/* Void */
static SpecialId voidId() {
SpecialId sid(TYPE_VOID);
JS_ASSERT(sid.isVoid());
return sid;
}
bool isVoid() const {
return bits == TYPE_VOID;
}
/* Default XML namespace */
static SpecialId defaultXMLNamespace() {
SpecialId sid(TYPE_DEFAULT_XML_NAMESPACE);
JS_ASSERT(sid.isDefaultXMLNamespace());
return sid;
}
bool isDefaultXMLNamespace() const {
return bits == TYPE_DEFAULT_XML_NAMESPACE;
}
};
static JS_ALWAYS_INLINE jsid
SPECIALID_TO_JSID(const SpecialId &sid)
{
jsid id;
JSID_BITS(id) = sid.bits;
JS_ASSERT_IF(sid.isObject(), JSID_IS_OBJECT(id) && JSID_TO_OBJECT(id) == sid.toObject());
JS_ASSERT_IF(sid.isVoid(), JSID_IS_VOID(id));
JS_ASSERT_IF(sid.isEmpty(), JSID_IS_EMPTY(id));
JS_ASSERT_IF(sid.isDefaultXMLNamespace(), JSID_IS_DEFAULT_XML_NAMESPACE(id));
return id;
}
static JS_ALWAYS_INLINE bool
JSID_IS_SPECIAL(jsid id)
{
return JSID_IS_OBJECT(id) || JSID_IS_EMPTY(id) || JSID_IS_VOID(id) ||
JSID_IS_DEFAULT_XML_NAMESPACE(id);
}
static JS_ALWAYS_INLINE SpecialId
JSID_TO_SPECIALID(jsid id)
{
JS_ASSERT(JSID_IS_SPECIAL(id));
if (JSID_IS_OBJECT(id))
return SpecialId(*JSID_TO_OBJECT(id));
if (JSID_IS_EMPTY(id))
return SpecialId::empty();
if (JSID_IS_VOID(id))
return SpecialId::voidId();
JS_ASSERT(JSID_IS_DEFAULT_XML_NAMESPACE(id));
return SpecialId::defaultXMLNamespace();
}
/* js::Class operation signatures. */
@ -64,7 +184,7 @@ typedef JSBool
(* LookupElementOp)(JSContext *cx, JSObject *obj, uint32 index, JSObject **objp,
JSProperty **propp);
typedef JSBool
(* LookupSpecialOp)(JSContext *cx, JSObject *obj, jsid id, JSObject **objp,
(* LookupSpecialOp)(JSContext *cx, JSObject *obj, SpecialId sid, JSObject **objp,
JSProperty **propp);
typedef JSBool
(* DefineGenericOp)(JSContext *cx, JSObject *obj, jsid id, const Value *value,
@ -76,7 +196,7 @@ typedef JSBool
(* DefineElementOp)(JSContext *cx, JSObject *obj, uint32 index, const Value *value,
PropertyOp getter, StrictPropertyOp setter, uintN attrs);
typedef JSBool
(* DefineSpecialOp)(JSContext *cx, JSObject *obj, jsid id, const Value *value,
(* DefineSpecialOp)(JSContext *cx, JSObject *obj, SpecialId sid, const Value *value,
PropertyOp getter, StrictPropertyOp setter, uintN attrs);
typedef JSBool
(* GenericIdOp)(JSContext *cx, JSObject *obj, JSObject *receiver, jsid id, Value *vp);
@ -85,7 +205,7 @@ typedef JSBool
typedef JSBool
(* ElementIdOp)(JSContext *cx, JSObject *obj, JSObject *receiver, uint32 index, Value *vp);
typedef JSBool
(* SpecialIdOp)(JSContext *cx, JSObject *obj, JSObject *receiver, jsid id, Value *vp);
(* SpecialIdOp)(JSContext *cx, JSObject *obj, JSObject *receiver, SpecialId sid, Value *vp);
typedef JSBool
(* StrictGenericIdOp)(JSContext *cx, JSObject *obj, jsid id, Value *vp, JSBool strict);
typedef JSBool
@ -93,7 +213,7 @@ typedef JSBool
typedef JSBool
(* StrictElementIdOp)(JSContext *cx, JSObject *obj, uint32 index, Value *vp, JSBool strict);
typedef JSBool
(* StrictSpecialIdOp)(JSContext *cx, JSObject *obj, jsid id, Value *vp, JSBool strict);
(* StrictSpecialIdOp)(JSContext *cx, JSObject *obj, SpecialId sid, Value *vp, JSBool strict);
typedef JSBool
(* GenericAttributesOp)(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp);
typedef JSBool
@ -101,7 +221,7 @@ typedef JSBool
typedef JSBool
(* ElementAttributesOp)(JSContext *cx, JSObject *obj, uint32 index, uintN *attrsp);
typedef JSBool
(* SpecialAttributesOp)(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp);
(* SpecialAttributesOp)(JSContext *cx, JSObject *obj, SpecialId sid, uintN *attrsp);
typedef JSBool
(* DeleteGenericOp)(JSContext *cx, JSObject *obj, jsid id, Value *vp, JSBool strict);
typedef JSBool
@ -109,7 +229,7 @@ typedef JSBool
typedef JSBool
(* DeleteElementOp)(JSContext *cx, JSObject *obj, uint32 index, Value *vp, JSBool strict);
typedef JSBool
(* DeleteSpecialOp)(JSContext *cx, JSObject *obj, jsid id, Value *vp, JSBool strict);
(* DeleteSpecialOp)(JSContext *cx, JSObject *obj, SpecialId sid, Value *vp, JSBool strict);
typedef JSType
(* TypeOfOp)(JSContext *cx, JSObject *obj);

Просмотреть файл

@ -3278,9 +3278,9 @@ with_LookupElement(JSContext *cx, JSObject *obj, uint32 index, JSObject **objp,
}
static JSBool
with_LookupSpecial(JSContext *cx, JSObject *obj, jsid id, JSObject **objp, JSProperty **propp)
with_LookupSpecial(JSContext *cx, JSObject *obj, SpecialId sid, JSObject **objp, JSProperty **propp)
{
return with_LookupProperty(cx, obj, id, objp, propp);
return with_LookupProperty(cx, obj, SPECIALID_TO_JSID(sid), objp, propp);
}
static JSBool
@ -3299,9 +3299,9 @@ with_GetElement(JSContext *cx, JSObject *obj, JSObject *receiver, uint32 index,
}
static JSBool
with_GetSpecial(JSContext *cx, JSObject *obj, JSObject *receiver, jsid id, Value *vp)
with_GetSpecial(JSContext *cx, JSObject *obj, JSObject *receiver, SpecialId sid, Value *vp)
{
return with_GetProperty(cx, obj, receiver, id, vp);
return with_GetProperty(cx, obj, receiver, SPECIALID_TO_JSID(sid), vp);
}
static JSBool
@ -3320,9 +3320,9 @@ with_SetElement(JSContext *cx, JSObject *obj, uint32 index, Value *vp, JSBool st
}
static JSBool
with_SetSpecial(JSContext *cx, JSObject *obj, jsid id, Value *vp, JSBool strict)
with_SetSpecial(JSContext *cx, JSObject *obj, SpecialId sid, Value *vp, JSBool strict)
{
return with_SetProperty(cx, obj, id, vp, strict);
return with_SetProperty(cx, obj, SPECIALID_TO_JSID(sid), vp, strict);
}
static JSBool
@ -3341,9 +3341,9 @@ with_GetElementAttributes(JSContext *cx, JSObject *obj, uint32 index, uintN *att
}
static JSBool
with_GetSpecialAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp)
with_GetSpecialAttributes(JSContext *cx, JSObject *obj, SpecialId sid, uintN *attrsp)
{
return with_GetAttributes(cx, obj, id, attrsp);
return with_GetAttributes(cx, obj, SPECIALID_TO_JSID(sid), attrsp);
}
static JSBool
@ -3362,9 +3362,9 @@ with_SetElementAttributes(JSContext *cx, JSObject *obj, uint32 index, uintN *att
}
static JSBool
with_SetSpecialAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp)
with_SetSpecialAttributes(JSContext *cx, JSObject *obj, SpecialId sid, uintN *attrsp)
{
return with_SetAttributes(cx, obj, id, attrsp);
return with_SetAttributes(cx, obj, SPECIALID_TO_JSID(sid), attrsp);
}
static JSBool
@ -3383,9 +3383,9 @@ with_DeleteElement(JSContext *cx, JSObject *obj, uint32 index, Value *rval, JSBo
}
static JSBool
with_DeleteSpecial(JSContext *cx, JSObject *obj, jsid id, Value *rval, JSBool strict)
with_DeleteSpecial(JSContext *cx, JSObject *obj, SpecialId sid, Value *rval, JSBool strict)
{
return with_DeleteProperty(cx, obj, id, rval, strict);
return with_DeleteProperty(cx, obj, SPECIALID_TO_JSID(sid), rval, strict);
}
static JSBool

Просмотреть файл

@ -912,9 +912,9 @@ proxy_LookupElement(JSContext *cx, JSObject *obj, uint32 index, JSObject **objp,
}
static JSBool
proxy_LookupSpecial(JSContext *cx, JSObject *obj, jsid id, JSObject **objp, JSProperty **propp)
proxy_LookupSpecial(JSContext *cx, JSObject *obj, SpecialId sid, JSObject **objp, JSProperty **propp)
{
return proxy_LookupProperty(cx, obj, id, objp, propp);
return proxy_LookupProperty(cx, obj, SPECIALID_TO_JSID(sid), objp, propp);
}
static JSBool
@ -944,10 +944,10 @@ proxy_DefineElement(JSContext *cx, JSObject *obj, uint32 index, const Value *val
}
static JSBool
proxy_DefineSpecial(JSContext *cx, JSObject *obj, jsid id, const Value *value,
proxy_DefineSpecial(JSContext *cx, JSObject *obj, SpecialId sid, const Value *value,
PropertyOp getter, StrictPropertyOp setter, uintN attrs)
{
return proxy_DefineProperty(cx, obj, id, value, getter, setter, attrs);
return proxy_DefineProperty(cx, obj, SPECIALID_TO_JSID(sid), value, getter, setter, attrs);
}
static JSBool
@ -968,9 +968,9 @@ proxy_GetElement(JSContext *cx, JSObject *obj, JSObject *receiver, uint32 index,
}
static JSBool
proxy_GetSpecial(JSContext *cx, JSObject *obj, JSObject *receiver, jsid id, Value *vp)
proxy_GetSpecial(JSContext *cx, JSObject *obj, JSObject *receiver, SpecialId sid, Value *vp)
{
return proxy_GetProperty(cx, obj, receiver, id, vp);
return proxy_GetProperty(cx, obj, receiver, SPECIALID_TO_JSID(sid), vp);
}
static JSBool
@ -991,9 +991,9 @@ proxy_SetElement(JSContext *cx, JSObject *obj, uint32 index, Value *vp, JSBool s
}
static JSBool
proxy_SetSpecial(JSContext *cx, JSObject *obj, jsid id, Value *vp, JSBool strict)
proxy_SetSpecial(JSContext *cx, JSObject *obj, SpecialId sid, Value *vp, JSBool strict)
{
return proxy_SetProperty(cx, obj, id, vp, strict);
return proxy_SetProperty(cx, obj, SPECIALID_TO_JSID(sid), vp, strict);
}
static JSBool
@ -1018,9 +1018,9 @@ proxy_GetElementAttributes(JSContext *cx, JSObject *obj, uint32 index, uintN *at
}
static JSBool
proxy_GetSpecialAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp)
proxy_GetSpecialAttributes(JSContext *cx, JSObject *obj, SpecialId sid, uintN *attrsp)
{
return proxy_GetAttributes(cx, obj, id, attrsp);
return proxy_GetAttributes(cx, obj, SPECIALID_TO_JSID(sid), attrsp);
}
static JSBool
@ -1046,9 +1046,9 @@ proxy_SetElementAttributes(JSContext *cx, JSObject *obj, uint32 index, uintN *at
}
static JSBool
proxy_SetSpecialAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp)
proxy_SetSpecialAttributes(JSContext *cx, JSObject *obj, SpecialId sid, uintN *attrsp)
{
return proxy_SetAttributes(cx, obj, id, attrsp);
return proxy_SetAttributes(cx, obj, SPECIALID_TO_JSID(sid), attrsp);
}
static JSBool
@ -1074,9 +1074,9 @@ proxy_DeleteElement(JSContext *cx, JSObject *obj, uint32 index, Value *rval, JSB
}
static JSBool
proxy_DeleteSpecial(JSContext *cx, JSObject *obj, jsid id, Value *rval, JSBool strict)
proxy_DeleteSpecial(JSContext *cx, JSObject *obj, SpecialId sid, Value *rval, JSBool strict)
{
return proxy_DeleteProperty(cx, obj, id, rval, strict);
return proxy_DeleteProperty(cx, obj, SPECIALID_TO_JSID(sid), rval, strict);
}
static void

Просмотреть файл

@ -311,10 +311,10 @@ ArrayBuffer::obj_lookupElement(JSContext *cx, JSObject *obj, uint32 index,
}
JSBool
ArrayBuffer::obj_lookupSpecial(JSContext *cx, JSObject *obj, jsid id,
ArrayBuffer::obj_lookupSpecial(JSContext *cx, JSObject *obj, SpecialId sid,
JSObject **objp, JSProperty **propp)
{
return obj_lookupProperty(cx, obj, id, objp, propp);
return obj_lookupProperty(cx, obj, SPECIALID_TO_JSID(sid), objp, propp);
}
JSBool
@ -341,10 +341,10 @@ ArrayBuffer::obj_defineElement(JSContext *cx, JSObject *obj, uint32 index, const
}
JSBool
ArrayBuffer::obj_defineSpecial(JSContext *cx, JSObject *obj, jsid id, const Value *v,
ArrayBuffer::obj_defineSpecial(JSContext *cx, JSObject *obj, SpecialId sid, const Value *v,
PropertyOp getter, StrictPropertyOp setter, uintN attrs)
{
return obj_defineProperty(cx, obj, id, v, getter, setter, attrs);
return obj_defineProperty(cx, obj, SPECIALID_TO_JSID(sid), v, getter, setter, attrs);
}
JSBool
@ -372,9 +372,9 @@ ArrayBuffer::obj_getElement(JSContext *cx, JSObject *obj, JSObject *receiver, ui
}
JSBool
ArrayBuffer::obj_getSpecial(JSContext *cx, JSObject *obj, JSObject *receiver, jsid id, Value *vp)
ArrayBuffer::obj_getSpecial(JSContext *cx, JSObject *obj, JSObject *receiver, SpecialId sid, Value *vp)
{
return obj_getProperty(cx, obj, receiver, id, vp);
return obj_getProperty(cx, obj, receiver, SPECIALID_TO_JSID(sid), vp);
}
JSBool
@ -442,9 +442,9 @@ ArrayBuffer::obj_setElement(JSContext *cx, JSObject *obj, uint32 index, Value *v
}
JSBool
ArrayBuffer::obj_setSpecial(JSContext *cx, JSObject *obj, jsid id, Value *vp, JSBool strict)
ArrayBuffer::obj_setSpecial(JSContext *cx, JSObject *obj, SpecialId sid, Value *vp, JSBool strict)
{
return obj_setProperty(cx, obj, id, vp, strict);
return obj_setProperty(cx, obj, SPECIALID_TO_JSID(sid), vp, strict);
}
JSBool
@ -471,9 +471,9 @@ ArrayBuffer::obj_getElementAttributes(JSContext *cx, JSObject *obj, uint32 index
}
JSBool
ArrayBuffer::obj_getSpecialAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp)
ArrayBuffer::obj_getSpecialAttributes(JSContext *cx, JSObject *obj, SpecialId sid, uintN *attrsp)
{
return obj_getAttributes(cx, obj, id, attrsp);
return obj_getAttributes(cx, obj, SPECIALID_TO_JSID(sid), attrsp);
}
JSBool
@ -501,9 +501,9 @@ ArrayBuffer::obj_setElementAttributes(JSContext *cx, JSObject *obj, uint32 index
}
JSBool
ArrayBuffer::obj_setSpecialAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp)
ArrayBuffer::obj_setSpecialAttributes(JSContext *cx, JSObject *obj, SpecialId sid, uintN *attrsp)
{
return obj_setSpecialAttributes(cx, obj, id, attrsp);
return obj_setAttributes(cx, obj, SPECIALID_TO_JSID(sid), attrsp);
}
JSBool
@ -530,9 +530,9 @@ ArrayBuffer::obj_deleteElement(JSContext *cx, JSObject *obj, uint32 index, Value
}
JSBool
ArrayBuffer::obj_deleteSpecial(JSContext *cx, JSObject *obj, jsid id, Value *rval, JSBool strict)
ArrayBuffer::obj_deleteSpecial(JSContext *cx, JSObject *obj, SpecialId sid, Value *rval, JSBool strict)
{
return obj_deleteProperty(cx, obj, id, rval, strict);
return obj_deleteProperty(cx, obj, SPECIALID_TO_JSID(sid), rval, strict);
}
JSBool
@ -694,10 +694,10 @@ TypedArray::obj_lookupElement(JSContext *cx, JSObject *obj, uint32 index,
}
JSBool
TypedArray::obj_lookupSpecial(JSContext *cx, JSObject *obj, jsid id,
TypedArray::obj_lookupSpecial(JSContext *cx, JSObject *obj, SpecialId sid,
JSObject **objp, JSProperty **propp)
{
return obj_lookupProperty(cx, obj, id, objp, propp);
return obj_lookupProperty(cx, obj, SPECIALID_TO_JSID(sid), objp, propp);
}
JSBool
@ -717,9 +717,9 @@ TypedArray::obj_getElementAttributes(JSContext *cx, JSObject *obj, uint32 index,
}
JSBool
TypedArray::obj_getSpecialAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp)
TypedArray::obj_getSpecialAttributes(JSContext *cx, JSObject *obj, SpecialId sid, uintN *attrsp)
{
return obj_getAttributes(cx, obj, id, attrsp);
return obj_getAttributes(cx, obj, SPECIALID_TO_JSID(sid), attrsp);
}
JSBool
@ -737,9 +737,9 @@ TypedArray::obj_setElementAttributes(JSContext *cx, JSObject *obj, uint32 index,
}
JSBool
TypedArray::obj_setSpecialAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp)
TypedArray::obj_setSpecialAttributes(JSContext *cx, JSObject *obj, SpecialId sid, uintN *attrsp)
{
return obj_setAttributes(cx, obj, id, attrsp);
return obj_setAttributes(cx, obj, SPECIALID_TO_JSID(sid), attrsp);
}
/* static */ int
@ -1000,9 +1000,9 @@ class TypedArrayTemplate
}
static JSBool
obj_getSpecial(JSContext *cx, JSObject *obj, JSObject *receiver, jsid id, Value *vp)
obj_getSpecial(JSContext *cx, JSObject *obj, JSObject *receiver, SpecialId sid, Value *vp)
{
return obj_getProperty(cx, obj, receiver, id, vp);
return obj_getProperty(cx, obj, receiver, SPECIALID_TO_JSID(sid), vp);
}
static bool
@ -1105,9 +1105,9 @@ class TypedArrayTemplate
}
static JSBool
obj_setSpecial(JSContext *cx, JSObject *obj, jsid id, Value *vp, JSBool strict)
obj_setSpecial(JSContext *cx, JSObject *obj, SpecialId sid, Value *vp, JSBool strict)
{
return obj_setProperty(cx, obj, id, vp, strict);
return obj_setProperty(cx, obj, SPECIALID_TO_JSID(sid), vp, strict);
}
static JSBool
@ -1130,10 +1130,10 @@ class TypedArrayTemplate
}
static JSBool
obj_defineSpecial(JSContext *cx, JSObject *obj, jsid id, const Value *v,
obj_defineSpecial(JSContext *cx, JSObject *obj, SpecialId sid, const Value *v,
PropertyOp getter, StrictPropertyOp setter, uintN attrs)
{
return obj_defineProperty(cx, obj, id, v, getter, setter, attrs);
return obj_defineProperty(cx, obj, SPECIALID_TO_JSID(sid), v, getter, setter, attrs);
}
static JSBool
@ -1172,9 +1172,9 @@ class TypedArrayTemplate
}
static JSBool
obj_deleteSpecial(JSContext *cx, JSObject *obj, jsid id, Value *rval, JSBool strict)
obj_deleteSpecial(JSContext *cx, JSObject *obj, SpecialId sid, Value *rval, JSBool strict)
{
return obj_deleteProperty(cx, obj, id, rval, strict);
return obj_deleteProperty(cx, obj, SPECIALID_TO_JSID(sid), rval, strict);
}
static JSBool

Просмотреть файл

@ -83,7 +83,8 @@ struct JS_FRIEND_API(ArrayBuffer) {
JSObject **objp, JSProperty **propp);
static JSBool
obj_lookupSpecial(JSContext *cx, JSObject *obj, jsid id, JSObject **objp, JSProperty **propp);
obj_lookupSpecial(JSContext *cx, JSObject *obj, SpecialId sid, JSObject **objp,
JSProperty **propp);
static JSBool
obj_defineProperty(JSContext *cx, JSObject *obj, jsid id, const Value *v,
@ -94,7 +95,7 @@ struct JS_FRIEND_API(ArrayBuffer) {
PropertyOp getter, StrictPropertyOp setter, uintN attrs);
static JSBool
obj_defineSpecial(JSContext *cx, JSObject *obj, jsid id, const Value *v,
obj_defineSpecial(JSContext *cx, JSObject *obj, SpecialId sid, const Value *v,
PropertyOp getter, StrictPropertyOp setter, uintN attrs);
static JSBool
@ -104,7 +105,7 @@ struct JS_FRIEND_API(ArrayBuffer) {
obj_getElement(JSContext *cx, JSObject *obj, JSObject *receiver, uint32 index, Value *vp);
static JSBool
obj_getSpecial(JSContext *cx, JSObject *obj, JSObject *receiver, jsid id, Value *vp);
obj_getSpecial(JSContext *cx, JSObject *obj, JSObject *receiver, SpecialId sid, Value *vp);
static JSBool
obj_setProperty(JSContext *cx, JSObject *obj, jsid id, Value *vp, JSBool strict);
@ -113,7 +114,7 @@ struct JS_FRIEND_API(ArrayBuffer) {
obj_setElement(JSContext *cx, JSObject *obj, uint32 index, Value *vp, JSBool strict);
static JSBool
obj_setSpecial(JSContext *cx, JSObject *obj, jsid id, Value *vp, JSBool strict);
obj_setSpecial(JSContext *cx, JSObject *obj, SpecialId sid, Value *vp, JSBool strict);
static JSBool
obj_getAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp);
@ -122,7 +123,7 @@ struct JS_FRIEND_API(ArrayBuffer) {
obj_getElementAttributes(JSContext *cx, JSObject *obj, uint32 index, uintN *attrsp);
static JSBool
obj_getSpecialAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp);
obj_getSpecialAttributes(JSContext *cx, JSObject *obj, SpecialId sid, uintN *attrsp);
static JSBool
obj_setAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp);
@ -131,7 +132,7 @@ struct JS_FRIEND_API(ArrayBuffer) {
obj_setElementAttributes(JSContext *cx, JSObject *obj, uint32 index, uintN *attrsp);
static JSBool
obj_setSpecialAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp);
obj_setSpecialAttributes(JSContext *cx, JSObject *obj, SpecialId sid, uintN *attrsp);
static JSBool
obj_deleteProperty(JSContext *cx, JSObject *obj, jsid id, Value *rval, JSBool strict);
@ -140,7 +141,7 @@ struct JS_FRIEND_API(ArrayBuffer) {
obj_deleteElement(JSContext *cx, JSObject *obj, uint32 index, Value *rval, JSBool strict);
static JSBool
obj_deleteSpecial(JSContext *cx, JSObject *obj, jsid id, Value *rval, JSBool strict);
obj_deleteSpecial(JSContext *cx, JSObject *obj, SpecialId sid, Value *rval, JSBool strict);
static JSBool
obj_enumerate(JSContext *cx, JSObject *obj, JSIterateOp enum_op,
@ -211,16 +212,16 @@ struct JS_FRIEND_API(TypedArray) {
JSObject **objp, JSProperty **propp);
static JSBool obj_lookupElement(JSContext *cx, JSObject *obj, uint32 index,
JSObject **objp, JSProperty **propp);
static JSBool obj_lookupSpecial(JSContext *cx, JSObject *obj, jsid id,
static JSBool obj_lookupSpecial(JSContext *cx, JSObject *obj, SpecialId sid,
JSObject **objp, JSProperty **propp);
static JSBool obj_getAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp);
static JSBool obj_getElementAttributes(JSContext *cx, JSObject *obj, uint32 index, uintN *attrsp);
static JSBool obj_getSpecialAttributes(JSContext *cx, JSObject *obj, jsid id, 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_setElementAttributes(JSContext *cx, JSObject *obj, uint32 index, uintN *attrsp);
static JSBool obj_setSpecialAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp);
static JSBool obj_setSpecialAttributes(JSContext *cx, JSObject *obj, SpecialId sid, uintN *attrsp);
static JSUint32 getLength(JSObject *obj);
static JSUint32 getByteOffset(JSObject *obj);

Просмотреть файл

@ -4754,9 +4754,9 @@ xml_lookupElement(JSContext *cx, JSObject *obj, uint32 index, JSObject **objp,
}
static JSBool
xml_lookupSpecial(JSContext *cx, JSObject *obj, jsid id, JSObject **objp, JSProperty **propp)
xml_lookupSpecial(JSContext *cx, JSObject *obj, SpecialId sid, JSObject **objp, JSProperty **propp)
{
return xml_lookupProperty(cx, obj, id, objp, propp);
return xml_lookupProperty(cx, obj, SPECIALID_TO_JSID(sid), objp, propp);
}
static JSBool
@ -4784,10 +4784,10 @@ xml_defineElement(JSContext *cx, JSObject *obj, uint32 index, const Value *v,
}
static JSBool
xml_defineSpecial(JSContext *cx, JSObject *obj, jsid id, const Value *v,
xml_defineSpecial(JSContext *cx, JSObject *obj, SpecialId sid, const Value *v,
PropertyOp getter, StrictPropertyOp setter, uintN attrs)
{
return xml_defineProperty(cx, obj, id, v, getter, setter, attrs);
return xml_defineProperty(cx, obj, SPECIALID_TO_JSID(sid), v, getter, setter, attrs);
}
static JSBool
@ -4811,15 +4811,21 @@ xml_getElement(JSContext *cx, JSObject *obj, JSObject *receiver, uint32 index, V
}
static JSBool
xml_getSpecial(JSContext *cx, JSObject *obj, JSObject *receiver, jsid id, Value *vp)
xml_getSpecial(JSContext *cx, JSObject *obj, JSObject *receiver, SpecialId sid, Value *vp)
{
return xml_getProperty(cx, obj, receiver, id, vp);
return xml_getProperty(cx, obj, receiver, SPECIALID_TO_JSID(sid), vp);
}
static JSBool
xml_setGeneric(JSContext *cx, JSObject *obj, jsid id, Value *vp, JSBool strict)
{
return PutProperty(cx, obj, id, strict, vp);
}
static JSBool
xml_setProperty(JSContext *cx, JSObject *obj, jsid id, Value *vp, JSBool strict)
{
return PutProperty(cx, obj, id, strict, vp);
return xml_setGeneric(cx, obj, id, vp, strict);
}
static JSBool
@ -4828,13 +4834,13 @@ xml_setElement(JSContext *cx, JSObject *obj, uint32 index, Value *vp, JSBool str
jsid id;
if (!IndexToId(cx, index, &id))
return false;
return xml_setProperty(cx, obj, id, vp, strict);
return xml_setGeneric(cx, obj, id, vp, strict);
}
static JSBool
xml_setSpecial(JSContext *cx, JSObject *obj, jsid id, Value *vp, JSBool strict)
xml_setSpecial(JSContext *cx, JSObject *obj, SpecialId sid, Value *vp, JSBool strict)
{
return xml_setProperty(cx, obj, id, vp, strict);
return xml_setGeneric(cx, obj, SPECIALID_TO_JSID(sid), vp, strict);
}
static JSBool
@ -4858,9 +4864,9 @@ xml_getElementAttributes(JSContext *cx, JSObject *obj, uint32 index, uintN *attr
}
static JSBool
xml_getSpecialAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp)
xml_getSpecialAttributes(JSContext *cx, JSObject *obj, SpecialId sid, uintN *attrsp)
{
return xml_getAttributes(cx, obj, id, attrsp);
return xml_getAttributes(cx, obj, SPECIALID_TO_JSID(sid), attrsp);
}
static JSBool
@ -4888,9 +4894,9 @@ xml_setElementAttributes(JSContext *cx, JSObject *obj, uint32 index, uintN *attr
}
static JSBool
xml_setSpecialAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp)
xml_setSpecialAttributes(JSContext *cx, JSObject *obj, SpecialId sid, uintN *attrsp)
{
return xml_setAttributes(cx, obj, id, attrsp);
return xml_setAttributes(cx, obj, SPECIALID_TO_JSID(sid), attrsp);
}
static JSBool
@ -4966,9 +4972,9 @@ xml_deleteElement(JSContext *cx, JSObject *obj, uint32 index, Value *rval, JSBoo
}
static JSBool
xml_deleteSpecial(JSContext *cx, JSObject *obj, jsid id, Value *rval, JSBool strict)
xml_deleteSpecial(JSContext *cx, JSObject *obj, SpecialId sid, Value *rval, JSBool strict)
{
return xml_deleteProperty(cx, obj, id, rval, strict);
return xml_deleteProperty(cx, obj, SPECIALID_TO_JSID(sid), rval, strict);
}
static JSString *