mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-17 22:32:51 +00:00
Bug 1095660 part 3. Give With objects defineProperty/Element/Generic class hooks. r=luke
This commit is contained in:
parent
8e9f9042cb
commit
3004f99d36
@ -480,6 +480,32 @@ with_LookupElement(JSContext *cx, HandleObject obj, uint32_t index,
|
||||
return with_LookupGeneric(cx, obj, id, objp, propp);
|
||||
}
|
||||
|
||||
static bool
|
||||
with_DefineGeneric(JSContext *cx, HandleObject obj, HandleId id, HandleValue value,
|
||||
JSPropertyOp getter, JSStrictPropertyOp setter, unsigned attrs)
|
||||
{
|
||||
RootedObject actual(cx, &obj->as<DynamicWithObject>().object());
|
||||
return JSObject::defineGeneric(cx, actual, id, value, getter, setter, attrs);
|
||||
}
|
||||
|
||||
static bool
|
||||
with_DefineProperty(JSContext *cx, HandleObject obj, HandlePropertyName name, HandleValue value,
|
||||
JSPropertyOp getter, JSStrictPropertyOp setter, unsigned attrs)
|
||||
{
|
||||
Rooted<jsid> id(cx, NameToId(name));
|
||||
return with_DefineGeneric(cx, obj, id, value, getter, setter, attrs);
|
||||
}
|
||||
|
||||
static bool
|
||||
with_DefineElement(JSContext *cx, HandleObject obj, uint32_t index, HandleValue value,
|
||||
JSPropertyOp getter, JSStrictPropertyOp setter, unsigned attrs)
|
||||
{
|
||||
RootedId id(cx);
|
||||
if (!IndexToId(cx, index, &id))
|
||||
return false;
|
||||
return with_DefineGeneric(cx, obj, id, value, getter, setter, attrs);
|
||||
}
|
||||
|
||||
static bool
|
||||
with_GetGeneric(JSContext *cx, HandleObject obj, HandleObject receiver, HandleId id,
|
||||
MutableHandleValue vp)
|
||||
@ -593,9 +619,9 @@ const Class DynamicWithObject::class_ = {
|
||||
with_LookupGeneric,
|
||||
with_LookupProperty,
|
||||
with_LookupElement,
|
||||
nullptr, /* defineGeneric */
|
||||
nullptr, /* defineProperty */
|
||||
nullptr, /* defineElement */
|
||||
with_DefineGeneric,
|
||||
with_DefineProperty,
|
||||
with_DefineElement,
|
||||
with_GetGeneric,
|
||||
with_GetProperty,
|
||||
with_GetElement,
|
||||
|
Loading…
x
Reference in New Issue
Block a user