JSClass.flags 编辑
The JSClass.flags
field allows an application to enable optional JSClass
features on a per-class basis.
The flags
field is of type uint32_t
. Its value is the logical OR of zero or more of the following constants:
Flag | Meaning |
---|---|
| This class uses private data. If this flag is set, each instance of the class has a field for private data. The field can be accessed using |
| Mozilla extension. The private field of each object of this class points to an XPCOM object (see |
| Added in SpiderMonkey 17 Objects are DOM. |
JSCLASS_EMULATES_UNDEFINED | Added in SpiderMonkey 24 Causes objects which have this class to emulate
|
| Indicates that instances of this class have (The |
| This flag is only relevant for the class of an object that is used as a global object. (ECMAScript specifies a single global object, but in SpiderMonkey the global object is the last object in the scope chain, which can be different objects at different times. This is actually quite subtle. Enable standard ECMAScript behavior for setting the prototype of certain objects, such as Objects that can end up with the wrong prototype object, if this flag is not present, include: |
JSCLASS_FOREGROUND_FINALIZE | Objects of this class must be finalized on the main thread. If this class has a finalizer that makes use of state shared with the main thread then this option must be specified. It is always safe to specify this option. One of |
JSCLASS_BACKGROUND_FINALIZE | It is safe to finalize objects of this class on a background thread. If this class has a finalizer that can be safely run concurrently with the main thread then this option can be specified. It results in finalization work being offloaded to another thread which improves performance. One of |
JSCLASS_IMPLEMENTS_BARRIERS | Obsolete since JSAPI 43 Correctly implements GC read and write barriers. |
| Obsolete since JSAPI 37 This class's enumerate hook is actually a JSNewEnumerateOp , not a JSEnumerateOp . |
| Obsolete since JSAPI 36 This class's resolve hook is actually a JSNewResolveOp , not a JSResolveOp . |
| Obsolete since JavaScript 1.8.5 Instructs SpiderMonkey to automatically give all properties of objects of this class the JSPROP_SHARED attribute. |
| Obsolete since JSAPI 16 The resolve hook expects to receive the starting object in the prototype chain passed in via the *objp in/out parameter. (This is meaningful only if the JSCLASS_NEW_RESOLVE flag is also set.) |
| Obsolete since JSAPI 11 Instructs JS_InitClass to invoke the constructor when creating the class prototype. |
| Obsolete since JSAPI 17Indicates that this JSClass is really a JSExtendedClass . |
| Obsolete since JSAPI 5 Indicates that the mark hook implements the new JSTraceOp signature instead of the old JSMarkOp signature. This is recommended for all new code that needs custom marking. |
SpiderMonkey reserves a few other flags for its internal use. They are JSCLASS_IS_ANONYMOUS
, JSCLASS_IS_GLOBAL
, JSCLASS_IS_PROXY
, and JSCLASS_HAS_CACHED_PROTO
. JSAPI applications should not use these flags.
See Also
- bug 527805 - removed
JSCLASS_SHARE_ALL_PROPERTIES
- bug 571789 - removed
JSCLASS_IS_EXTENDED
- bug 638291 - removed
JSCLASS_MARK_IS_TRACE
- bug 641025 - added
JSCLASS_IMPLEMENTS_BARRIERS
- bug 702507 - removed
JSCLASS_CONSTRUCT_PROTOTYPE
- bug 758913 - removed
JSCLASS_NEW_RESOLVE_GETS_START
- bug 766447 - added
JSCLASS_IS_DOMJSCLASS
- bug 792108 - added
JSCLASS_EMULATES_UNDEFINED
- bug 993026 - removed
JSCLASS_NEW_RESOLVE
- bug 1097267 - removed
JSCLASS_NEW_ENUMERATE
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论