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. | 
| 
 | Added in SpiderMonkey 17 Correctly implements GC read and write barriers. | 
| 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:  | 
| 
 | Obsolete since JSAPI 37 This class's enumeratehook is actually aJSNewEnumerateOp, not aJSEnumerateOp. | 
| 
 | Obsolete since JSAPI 36 This class's resolvehook is actually aJSNewResolveOp, not aJSResolveOp. | 
| 
 | Obsolete since JavaScript 1.8.5 Instructs SpiderMonkey to automatically give all properties of objects of this class the JSPROP_SHAREDattribute. | 
| 
 | Obsolete since JSAPI 16 The resolvehook expects to receive the starting object in the prototype chain passed in via the*objpin/out parameter. (This is meaningful only if theJSCLASS_NEW_RESOLVEflag is also set.) | 
| 
 | Obsolete since JSAPI 11 Instructs JS_InitClassto invoke the constructor when creating the class prototype. | 
| 
 | Obsolete since JSAPI 17Indicates that this JSClassis really aJSExtendedClass. | 
| 
 | Obsolete since JSAPI 5 Indicates that the markhook implements the newJSTraceOpsignature instead of the oldJSMarkOpsignature. 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, JSCLASS_BACKGROUND_FINALIZE, 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