JS_PropertyStub 编辑
Default implementations of the required callbacks in JSClass
.
Syntax
bool
JS_PropertyStub(JSContext *cx, JS::HandleObject obj, JS::HandleId id,
JS::MutableHandleValue vp);
bool
JS_StrictPropertyStub(JSContext *cx, JS::HandleObject obj, JS::HandleId id,
JS::MutableHandleValue vp, JS::ObjectOpResult &result); // Added in SpiderMonkey 45
bool
JS_StrictPropertyStub(JSContext *cx, JS::HandleObject obj, JS::HandleId id,
bool strict, JS::MutableHandleValue vp); // Obsolete since JSAPI 39
bool
JS_ResolveStub(JSContext *cx, JS::HandleObject obj, JS::HandleId id,
bool *resolvedp); // Obsolete since JSAPI 37
bool
JS_DeletePropertyStub(JSContext *cx, JS::HandleObject obj, JS::HandleId id,
bool *succeeded); // Obsolete since JSAPI 37
bool
JS_EnumerateStub(JSContext *cx, JS::HandleObject obj); // Obsolete since JSAPI 37
bool
JS_ConvertStub(JSContext *cx, JS::HandleObject obj, JSType type,
JS::MutableHandleValue vp); // Obsolete since JSAPI 37
void
JS_FinalizeStub(JSContext *cx, JSObject *obj); // Obsolete since JSAPI 14
Description
The stub functions are not designed to be called directly by a JSAPI application. Rather, they are convenient stand-ins anywhere the JSAPI requires callbacks of certain types. Examples at JSClass
illustrate how stub functions can be used.
JS_PropertyStub
is of type JSPropertyOp
, the type of getter callback. It can be used in JSClass.addProperty
, and JSClass.getProperty
. It behaves exactly like a property callback that accepts the default property behavior: it does nothing and returns true
.
JS_StrictPropertyStub
is of type JSStrictPropertyOp
, the type of setter callback. It can be used in JSClass.setProperty
. It behaves exactly like a property callback that accepts the default property behavior: it does nothing and returns true
.
JS_DeletePropertyStub
is of type JSDeletePropertyOp
, the type of setter callback. It can be used in JSClass.delProperty
. It behaves exactly like a property callback that accepts the default property behavior: it does nothing and returns true
.
JS_EnumerateStub
is a stub for JSClass.enumerate
. It does nothing and returns true
.
JS_ResolveStub
is a stub for JSClass.resolve
. It does nothing and returns true
.
JS_ConvertStub
is a stub for JSClass.convert
. Its behavior is the same as the default conversion behavior for Object
s. It attempts to call the object's valueOf
and toString
functions, in the order determined by the specified type, in accordance with the default DefaultValue
algorithm in ES5 §8.12.8.
JS_FinalizeStub
is a stub for JSClass.finalize
. It does nothing.
See Also
- MXR ID Search for
JS_PropertyStub
- MXR ID Search for
JS_StrictPropertyStub
JSPropertyOp
JSStrictPropertyOp
- bug 1103152 - removed
JS_DeletePropertyStub
,JS_EnumerateStub
,JS_ResolveStub
, andJS_ConvertStub
- bug 736978 - removed
JS_FinalizeStub
- bug 1113369 -- added
result
parameter
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论