mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Fix for bug 852094 (Support Unforgeable on proxy-based DOM bindings) - add a JS_DefineOwnProperty API that takes a JSPropertyDescriptor. r=Waldo.
--HG-- extra : rebase_source : 1866bae0a324ba952548c375e0c8cc031d8b0954
This commit is contained in:
parent
9d70d3f0d0
commit
6435330f52
@ -1037,3 +1037,20 @@ js::AutoCTypesActivityCallback::AutoCTypesActivityCallback(JSContext *cx,
|
||||
if (callback)
|
||||
callback(cx, beginType);
|
||||
}
|
||||
|
||||
JS_FRIEND_API(JSBool)
|
||||
js_DefineOwnProperty(JSContext *cx, JSObject *objArg, jsid idArg,
|
||||
const js::PropertyDescriptor& descriptor, JSBool *bp)
|
||||
{
|
||||
RootedObject obj(cx, objArg);
|
||||
RootedId id(cx, idArg);
|
||||
JS_ASSERT(cx->runtime->heapState == js::Idle);
|
||||
CHECK_REQUEST(cx);
|
||||
assertSameCompartment(cx, obj, id, descriptor.value);
|
||||
if (descriptor.attrs & JSPROP_GETTER)
|
||||
assertSameCompartment(cx, CastAsObjectJsval(descriptor.getter));
|
||||
if (descriptor.attrs & JSPROP_SETTER)
|
||||
assertSameCompartment(cx, CastAsObjectJsval(descriptor.setter));
|
||||
|
||||
return js_DefineOwnProperty(cx, HandleObject(obj), id, descriptor, bp);
|
||||
}
|
||||
|
@ -1440,4 +1440,8 @@ inline void assertEnteredPolicy(JSContext *cx, JSObject *obj, jsid id) {};
|
||||
|
||||
} /* namespace js */
|
||||
|
||||
extern JS_FRIEND_API(JSBool)
|
||||
js_DefineOwnProperty(JSContext *cx, JSObject *objArg, jsid idArg,
|
||||
const js::PropertyDescriptor& descriptor, JSBool *bp);
|
||||
|
||||
#endif /* jsfriendapi_h___ */
|
||||
|
@ -992,6 +992,24 @@ js_DefineOwnProperty(JSContext *cx, HandleObject obj, HandleId id, const Value &
|
||||
return true;
|
||||
}
|
||||
|
||||
JSBool
|
||||
js_DefineOwnProperty(JSContext *cx, HandleObject obj, HandleId id,
|
||||
const PropertyDescriptor &descriptor, JSBool *bp)
|
||||
{
|
||||
AutoPropDescArrayRooter descs(cx);
|
||||
PropDesc *desc = descs.append();
|
||||
if (!desc)
|
||||
return false;
|
||||
|
||||
desc->initFromPropertyDescriptor(descriptor);
|
||||
|
||||
bool rval;
|
||||
if (!DefineProperty(cx, obj, id, *desc, true, &rval))
|
||||
return false;
|
||||
*bp = !!rval;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
js::ReadPropertyDescriptors(JSContext *cx, HandleObject props, bool checkAccessors,
|
||||
|
@ -1156,6 +1156,10 @@ extern JSBool
|
||||
js_DefineOwnProperty(JSContext *cx, JS::HandleObject obj, JS::HandleId id,
|
||||
const JS::Value &descriptor, JSBool *bp);
|
||||
|
||||
extern JSBool
|
||||
js_DefineOwnProperty(JSContext *cx, JS::HandleObject obj, JS::HandleId id,
|
||||
const js::PropertyDescriptor &descriptor, JSBool *bp);
|
||||
|
||||
namespace js {
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user