Search completed in 2.63 seconds.
JSClass.flags
the
jsclass.flags field allows an application to enable optional
jsclass features on a per-class basis.
...its value is the logical or of zero or more of the following constants: flag meaning
jsclass_has_private this class uses private data.
... mxr id search for
jsclass_has_private
jsclass_private_is_nsisupports mozilla extension.
...And 19 more matches
JSClass
a
jsclass describes a class of javascript objects.
... a c/c++ program can use a
jsclass with the js_initclass and js_newobject apis to create objects that have custom methods and properties implemented in c/c++.
... syntax struct
jsclass { const char *name; uint32_t flags; /* optional since spidermonkey 37 */ jspropertyop addproperty; jsdeletepropertyop delproperty; jspropertyop getproperty; jsstrictpropertyop setproperty; jsenumerateop enumerate; jsresolveop resolve; jsconvertop convert; /* obsolete since spidermonkey 44 */ /* optional since spidermonkey 25 */ jsfinalizeop finalize; /* optional */
jsclassinternal reserved0; /* obsolete since spidermonkey 13 */ jscheckaccessop checkaccess; /* obsolete since spidermonkey 29 */ jsnative call; jshasinstanceop hasinstance; jsnative construct; jsxdrobjectop xdrobject; ...
...And 15 more matches
JSClass.call
the
jsclass.call and
jsclass.construct hooks are called when a custom object is used like a function.
...// suppose this object has
jsclass.call and
jsclass.construct hooks.
... var custom = new specialcustomobject(); custom(); // the
jsclass.call hook receives the global object as the obj parameter.
...And 4 more matches
Index
90
jsclass jsapi reference, spidermonkey use
jsclass to define a custom class of javascript objects.
... a
jsclass has a name, flags, and several callback functions for advanced customization of object behavior.
... 91
jsclass.call jsapi reference, spidermonkey note that when a custom object is called, a this argument is calculated for it just as if it were a function.
...And 22 more matches
JS_InitClass
make a
jsclass accessible to javascript code by creating its prototype, constructor, properties, and functions.
... syntax jsobject * js_initclass(jscontext *cx, js::handleobject obj, js::handleobject parent_proto, const
jsclass *clasp, jsnative constructor, unsigned nargs, const jspropertyspec *ps, const jsfunctionspec *fs, const jspropertyspec *static_ps, const jsfunctionspec *static_fs); name type description cx jscontext * pointer to a js context from which to derive runtime information.
... clasp
jsclass * pointer to the class structure to initialize.
...And 6 more matches
JS_PropertyStub
default implementations of the required callbacks in
jsclass.
...examples at
jsclass illustrate how stub functions can be used.
...it can be used in
jsclass.addproperty, and
jsclass.getproperty.
...And 6 more matches
JSNewResolveOp
jsnewresolveop is the type of the
jsclass.resolve callback when the
jsclass_new_resolve bit is set in the
jsclass.flags field.
...this hook instead of jsresolveop is called via the
jsclass.resolve member if
jsclass_new_resolve is set in
jsclass.flags.
... setting
jsclass_new_resolve and
jsclass_new_resolve_gets_start further extends this hook by passing in the starting object on the prototype chain via *objp.
...And 5 more matches
JSAPI User Guide
the global object: to create this object, you first need a
jsclass with the
jsclass_global_flags option.
... the example below defines a very basic
jsclass (named global_class) with no methods or properties of its own.
...static
jsclass globalclass = { "global",
jsclass_global_flags, js_propertystub, js_deletepropertystub, js_propertystub, js_strictpropertystub, js_enumeratestub, js_resolvestub, js_convertstub, nullptr, nullptr, nullptr, nullptr, js_globalobjecttracehook }; // the error reporter callback.
...And 4 more matches
JSGetObjectOps
jsgetobjectops is the type for
jsclass.getobjectops callback syntax typedef jsobjectops * (* jsgetobjectops)(jscontext *cx,
jsclass *clasp); name type description cx jscontext * the js context in which the new object is being created.
... cls
jsclass * the class of the new object.
...all native objects have a
jsclass, which is stored as a private (int-tagged) pointer in object slots.
...And 4 more matches
JS_NewObject
syntax // added in spidermonkey 45 jsobject * js_newobject(jscontext *cx, const
jsclass *clasp); bool js_newobjectwithgivenproto(jscontext *cx, const
jsclass *clasp, js::handle<jsobject*> proto); // obsolete since spidermonkey 38 jsobject * js_newobject(jscontext *cx, const
jsclass *clasp, js::handle<jsobject*> proto, js::handle<jsobject*> parent); jsobject * js_newobjectwithgivenproto(jscontext *cx, const
jsclass *clasp, js::handle<jsobject*> proto, js::handle<jsobject*> parent); // added in spidermonkey 1.8 name type description cx jscontext * the context in which to create the new object.
... clasp const
jsclass * pointer to the class to use for the new object.
... the
jsclass may be used to override low-level object behavior, including such details as the physical memory layout of the object and how property lookups are done.
...And 4 more matches
How to embed the JavaScript engine
*/ static
jsclass global_class = { "global",
jsclass_global_flags, js_propertystub, js_deletepropertystub, js_propertystub, js_strictpropertystub, js_enumeratestub, js_resolvestub, js_convertstub, }; int main(int argc, const char *argv[]) { jsruntime *rt = js_newruntime(8l * 1024 * 1024, js_use_helper_threads); if (!rt) return 1; jscontext *cx = js_newconte...
...*/ static
jsclass global_class = { "global",
jsclass_global_flags, js_propertystub, js_deletepropertystub, js_propertystub, js_strictpropertystub, js_enumeratestub, js_resolvestub, js_convertstub, nullptr, nullptr, nullptr, nullptr, js_globalobjecttracehook }; int main(int argc, const char *argv[]) { js_init(); jsruntime *rt = js_newruntime(8l * 102...
...*/ static
jsclass global_class = { "global",
jsclass_global_flags, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, js_globalobjecttracehook }; int main(int argc, const char *argv[]) { js_init(); jsruntime *rt = js_newruntime(8l * 1024 * 1024); if (!rt) return 1; jscontext *cx = js_n...
...And 3 more matches
JSExtendedClass
jsextendedclass is an extended version of
jsclass with additional hooks.
... syntax struct jsextendedclass {
jsclass base; jsequalityop equality; jsobjectop outerobject; jsobjectop innerobject; jsiteratorop iteratorobject;// added in spidermonkey 1.8 jsobjectop wrappedobject; // added in spidermonkey 1.8 ...and additional reserved fields.
... }; name type description base
jsclass the basic class information and callbacks for this class.
...And 3 more matches
JSPropertyOp
they are also the types of the
jsclass.addproperty, getproperty, and setproperty callbacks, which are called during object property accesses.
...a jspropertyop may be installed on an individual property as a getter or setter; or it may be installed on a
jsclass to hook property gets, sets, or adds.
...
jsclass hooks
jsclass offers following hooks: jspropertyop
jsclass.addproperty is called just after a new property is added to an object.
...And 3 more matches
Mozilla DOM Hacking Guide
static nsresult initdom
jsclass(jscontext *cx, jsobject *obj);: help me!
... static
jsclass sdom
jsclass;: help me!
...(bug 90757) static
jsclass sdomconstructorprotoclass: xpconnect fu to expose the dom objects constructors to javascript.
...And 2 more matches
JSReserveSlotsOp
jsreserveslotsop is the type of the
jsclass.reserveslots.
...
jsclass hooks
jsclass offers the following hook: the
jsclass.reserveslots callback is called each time a new object is created.
... the optional
jsclass.reserveslots hook allows a class to make computed per-instance object slots reservations, in addition to or instead of using
jsclass_has_reserved_slots(n) in the
jsclass.flags initializer to reserve a constant-per-class number of slots.
...And 2 more matches
JS_NewCompartmentAndGlobalObject
syntax jsobject * js_newcompartmentandglobalobject(jscontext *cx,
jsclass *clasp, jsprincipals *principals); name type description cx jscontext * the context in which to create the new global object.
... clasp
jsclass * the class to use for the new global object.
... clasp->flags must have the
jsclass_global_flags bits set.
...And 2 more matches
JS_NewGlobalObject
syntax jsobject * js_newglobalobject(jscontext *cx, const
jsclass *clasp, jsprincipals *principals, js::onnewglobalhookoption hookoption, const js::compartmentoptions &options = js::compartmentoptions()); name type description cx jscontext * the context in which to create the new global object.
... clasp
jsclass * the class to use for the new global object.
... clasp->flags must have the
jsclass_global_flags bits set.
...And 2 more matches
JSAPI reference
struct
jsclass jsclass.flags
jsclass.call
jsclass.construct struct jsfunctionspec struct jspropertyspec js_initclass js_linkconstructorandprototype added in spidermonkey 17 js::propertyspecnameissymbol added in spidermonkey 38 js::propertyspecnameequalsid added in spidermonkey 38 js::propertyspecnametopermanentid added in spidermonkey 38 js_getreservedslot js_setreservedslot struc...
...dermonkey 38 js_fnspec added in spidermonkey 31 js_fs_end added in spidermonkey 1.8 struct jspropertyspec js_psg added in spidermonkey 17 js_psgs added in spidermonkey 17 js_self_hosted_get added in spidermonkey 31 js_self_hosted_getset added in spidermonkey 31 js_ps_end added in spidermonkey 17 jsfastnative added in spidermonkey 1.8 obsolete since javascript 1.8.5 the behavior of a
jsclass can be customized using these flags:
jsclass.flags
jsclass_has_private
jsclass_private_is_nsisupports
jsclass_is_dom
jsclass added in spidermonkey 17
jsclass_implements_barriers added in spidermonkey 17
jsclass_emulates_undefined added in spidermonkey 24
jsclass_has_reserved_slots(n)
jsclass_global_flags
jsclass_new_enumerate obsolete since jsapi 37
jsclass_new_re...
...solve obsolete since jsapi 36
jsclass_share_all_properties obsolete since javascript 1.8.5
jsclass_new_resolve_gets_start obsolete since jsapi 16
jsclass_construct_prototype obsolete since jsapi 11
jsclass_is_extended obsolete since jsapi 17
jsclass_mark_is_trace obsolete since jsapi 5 the behavior of a
jsclass and its instances can be customized in many ways using callback functions.
...And 2 more matches
JSDeletePropertyOp
this article covers features introduced in spidermonkey 24 the type of the
jsclass.delproperty.
...a jsdeletepropertyop may be installed on a
jsclass to hook property deletes.
...
jsclass hooks
jsclass offers the following hook:
jsclass.delproperty is called during most property deletions, even when obj has no property named id.
... see also mxr id search for jsdeletepropertyop bug 858677
jsclass ...
JS_GetClass
syntax const
jsclass * js_getclass(jsobject *obj); name type description cx jscontext * any context associated with the runtime in which obj exists.
...description js_getclass returns a pointer to the
jsclass associated with a specified js object, obj.
... the application must treat the
jsclass as read-only.
... if obj has no
jsclass, this returns null.
JS_GetInstancePrivate
syntax void * js_getinstanceprivate(jscontext *cx, js::handle<jsobject*> obj, const
jsclass *clasp, js::callargs *args); // added in jsapi 32 void * js_getinstanceprivate(jscontext *cx, js::handle<jsobject*> obj, const
jsclass *clasp, jsval *argv); // obsolete since jsapi 32 name type description cx jscontext * a context.
... clasp
jsclass * class against which to test the object.
... description js_getinstanceprivate determines if a javascript object, obj, is an instance of a given
jsclass, clasp, and if it is, returns a pointer to the object's private data.
...see also mxr id search for js_getinstanceprivate
jsclass_has_private jsval_to_private js_getprivate js_initclass js_instanceof js_reporterror js_setprivate bug 959787 -- added args parameter ...
JS_GetPrivate
syntax void * js_getprivate(jsobject *obj); name type description obj jsobject * an object whose
jsclass has the
jsclass_has_private flag.
...obj must be an instance of a class that has the
jsclass_has_private flag.
... (but consider using js_valuetofunction instead to access it.) warning: it is dangerous to call js_getprivate on a jsobject * unless the object's
jsclass is known.
... if the object is not of the expected
jsclass, the result of js_getprivate would probably be null or a pointer to some unexpected type of data.
JS_InstanceOf
determine if an object is an instance of a specified
jsclass.
... syntax bool js_instanceof(jscontext *cx, js::handle<jsobject*> obj, const
jsclass *clasp, js::callargs *args); // added in spidermonkey 38 bool js_instanceof(jscontext *cx, js::handle<jsobject*> obj, const
jsclass *clasp, jsval *argv); // obsolete since jsapi 32 name type description cx jscontext * pointer to a js context from which to derive runtime information.
... clasp
jsclass * class against which to test the object.
...obsolete since jsapi 32 description js_instanceof can be used to check whether an object obj is of a particular
jsclass.
JS_SetPrivate
description if a
jsclass has the
jsclass_has_private flag, each object of that class has a private field of type void * which the application may use for any purpose.
...obj must be an instance of a class that has the
jsclass_has_private flag.
...in particular: if you allocate memory for private data, you must free it, typically in a
jsclass.finalize callback.
... if your class's private data contains any jsvals or other references to javascript objects, implement the
jsclass.mark callback to ensure they are not prematurely reclaimed by the garbage collector.
SpiderMonkey 1.8.8
the jsresolve_classname and jsresolve_with resolve flags (passed to
jsclass.resolve when
jsclass.flags contains
jsclass_new_resolve) have been removed.
... js_isscriptframe
jsclass_new_resolve_gets_start flag js_newnumbervalue api changes break out and discuss all api changes here...
...
jsclass prototype has changed a number of optional members have been removed from the
jsclass prototype.
...
jsclass callback changes many of the
jsclass callbacks such as jsresolveop, jsenumerateop and jspropertyop, have a type change on their arguments to jshandleobject, jshandleid, jshandlemutableobject etc.
SpiderMonkey 17
the jsresolve_classname and jsresolve_with resolve flags (passed to
jsclass.resolve when
jsclass.flags contains
jsclass_new_resolve) have been removed.
... js_isscriptframe
jsclass_new_resolve_gets_start flag js_newnumbervalue js_finalizestub js_clearnewbornroots
jsclass_mark_is_trace flag js_setscriptstackquota api changes break out and discuss all api changes here...
...
jsclass prototype has changed a number of optional members have been removed from the
jsclass prototype.
...
jsclass callback changes many of the
jsclass callbacks such as jsresolveop, jsenumerateop and jspropertyop, have a type change on their arguments to jshandleobject, jshandleid, jshandlemutableobject etc.
nsIXPConnect
obsolete since gecko 2.0 void getxpcwrappednative
jsclassinfo(out jsequalityop equality); nsixpconnectjsobjectholder holdobject(in jscontextptr ajscontext, in jsobjectptr aobject); void initclasses(in jscontextptr ajscontext, in jsobjectptr aglobaljsobj); nsixpconnectjsobjectholder initclasseswithnewwrappedglobal(in jscontextptr ajscontext, in nsisupports acomobj, in nsiidref aiid, in nsiprincipal aprincipal, in nsisupports ...
... return value missing description exceptions thrown missing exception missing description getxpcwrappednative
jsclassinfo() get the jsequalityop pointer to use for identifying jsobjects that hold a pointer to an nsixpconnectwrappednative or to the native in their private date.
... void getxpcwrappednative
jsclassinfo( out jsequalityop equality ); parameters equality missing description exceptions thrown missing exception missing description holdobject() creates a js object holder around aobject that will hold the object alive for as long as the holder stays alive.
...3) the jsobject is of a
jsclass which supports getting the nsisupports from the jsobject directly.
JSCheckAccessOp
jscheckaccessop is the type for
jsclass.checkaccess.
...
jsclass hooks
jsclass offers the following hook: the
jsclass.checkaccess callback is called when a script attempts to access an object property.
... see also
jsclass bug 957688 ...
JSConvertOp
jsconvertop is the type of
jsclass.convert.
...
jsclass hooks
jsclass offers the following hook: the
jsclass.convert callback implements the [[defaultvalue]] behavior for objects having that class.
... see also mxr id search for jsconvertop
jsclass ...
JSEnumerateOp
jsenumerateop is the type of the
jsclass.enumerate callback.
...
jsclass hooks
jsclass offers following hook: the
jsclass.enumerate hook is for classes that implement lazy properties using
jsclass.resolve.
... see also mxr id search for jsenumerateop jsnewenumerateop
jsclass ...
JSFinalizeOp
jsfinalizeop is the type of
jsclass.finalize.
...
jsclass hooks
jsclass offers the following hook: the
jsclass.finalize callback is a hook for destructor code.
... see also mxr id search for jsfinalizeop
jsclass js_setgccallback ...
JSHasInstanceOp
jshasinstanceop is the type of
jsclass.hasinstance.
...
jsclass hooks
jsclass offers the following hook: the
jsclass.hasinstance callback implements js_hasinstance and the javascript instanceof keyword.
... see also mxr id search for jshasinstanceop
jsclass js_hasinstance ...
JSMarkOp
jsmarkop is the type of the
jsclass.mark callback in spidermonkey 1.7 and earlier.
...
jsclass hooks
jsclass offers the following hook: the javascript engine calls the
jsclass.mark callback during the mark phase of garbage collection.
... see also
jsclass bug 638291 ...
JSNewEnumerateOp
before jsapi 37, jsnewenumerateop was the type of
jsclass.enumerate.
... to use a jsnewenumerateop in a
jsclass, set the
jsclass_new_enumerate bit in the
jsclass.flags field and set the
jsclass.enumerate field to your jsnewenumerateop, casting it to jsenumerateop.
... (spidermonkey, noting the
jsclass_new_enumerate flag, will cast that function pointer back to type jsnewenumerateop before calling it.) the behavior depends on the value of enum_op: jsenumerate_init a new, opaque iterator state should be allocated and stored in *statep.
JSObjectOps.defaultValue
the javascript engine calls the jsobjectops.defaultvalue and
jsclass.convert callbacks to convert objects to primitive values.
... the
jsclass.convert callback should convert obj to the given type, returning js_true with the resulting value in *vp on success, and returning js_false on error or exception.
... js_convertstub implements the default behavior for the
jsclass.convert hook, which is to call obj.valueof() and obj.tostring() in accordance with the algorithm in es5 §8.12.8.
JSObjectOps.enumerate
for native objects, the enumerate callback first checks the
jsclass_new_enumerate flag of the object's class.
... if the flag is present, enumerate simply delegates the call to
jsclass.enumerate.
... otherwise, it invokes the
jsclass.enumerate hook as an old-style jsenumerateop to give the object an opportunity to define any remaining lazy properties.
JSObjectOps.newObjectMap
syntax typedef jsobjectmap * (*jsnewobjectmapop)(jscontext *cx, jsrefcount nrefs, jsobjectops *ops,
jsclass *clasp, jsobject *obj); name type description cx jscontext * pointer to the js context in which the new object is being created.
... clasp
jsclass * the
jsclass of the new object.
...an application that implements jsobjectops must therefore either implement the newobjectmap by including the non-public header jsobj.h, or obtain the default newobjectmapop by calling the
jsclass.getobjectops callback of a standard
jsclass.
JSResolveOp
jsresolveop is the type of the
jsclass.resolve.
...
jsclass hooks
jsclass offers the following hook:
jsclass.resolve callback is called when a property is not found on an object.
... see also mxr id search for jsresolveop
jsclass jsnewresolveop bug 993026 ...
JSTraceOp
jstraceop is the type of the
jsclass.trace.
...
jsclass hooks
jsclass offers the following hook: the
jsclass.trace callback is called to enumerate all traceable things reachable.
... see also mxr id search for jstraceop
jsclass ...
JSXDRObjectOp
jsxdrobjectop is the type for
jsclass.xdrobject.
...
jsclass hooks
jsclass offers the following hook: jsxdr calls the
jsclass.xdrobject callback to serialize and deserialize objects.
... see also
jsclass bug 726944 ...
JS_DefinePropertyWithTinyId
the tiny-id-aware callbacks are: property getters and setters; and
jsclass.addproperty, .delproperty, .getproperty, and .setproperty.
... however, tiny ids can cause confusion when used with
jsclass callbacks.
... for example, if a property named "color" is defined with tiny id 10, then the javascript expressions obj[10] and obj.color will both result in int_to_jsval(10) being passed to
jsclass.getproperty as the id parameter.
JS_SetProperty
ordinarily this function leaves v unchanged, but it is possible for a
jsclass.addproperty hook or a non-default setter to assign to v.
...its getter and setter are the
jsclass.getproperty and setproperty hooks of obj's class, and its property attributes are exactly jsprop_enumerate.
... after the new property is added, the
jsclass.addproperty hook is called with the arguments (cx, obj, id, &v).
SpiderMonkey 1.8.5
global objects must also have the
jsclass_global_flags flag set.
... merely setting
jsclass_is_global is insufficient.
... jsxdrapi changes were missed jsstrictpropertyop for setters (affects
jsclass) - maybe general notes about es5 strict mode changes in jsapi tricks like argv[-2] not guaranteed to work any more; is js_callee or similar instead ...
SpiderMonkey 1.8.7
global objects must also have the
jsclass_global_flags flag set.
... merely setting
jsclass_is_global is insufficient.
... jsxdrapi changes were missed jsstrictpropertyop for setters (affects
jsclass) - maybe general notes about es5 strict mode changes in jsapi tricks like argv[-2] not guaranteed to work any more; is js_callee or similar instead ...
Property cache
shape native objects have a shape, a 24-bit unsigned integer such that: basic layout guarantee — if at time t0 the object x has shape s and at time t1 the object y has shape s, and no shape-regenerating gc occurred, then y at t1 has the same
jsclass, jsobjectops, prototype, and property specs as x had at t0.
... the shape of an object does not cover: anything about the object's prototype other than its identity; anything about the object's parent; obj->freeslot, which can be different for same-shaped objects if they have a
jsclass.reserveslots hook (bug 535416); anything about the values of the object's own properties, beyond what the method guarantee and the branded object guarantee say about functions.
JSObject
every object is associated with a
jsclass and a jsobjectops.
... depending on the
jsclass, an object may have a private data pointer and any number of reserved slots.
JSObjectOps.getProperty
each of these callbacks is responsible for everything involved with an individual property access operation, including: any locking necessary for thread safety; security checks; finding the property, including walking the prototype chain if needed; calling the lower-level
jsclass hooks; calling getters or setters; and actually getting, setting, or deleting the property once it is found.
... contrast
jsclass.getproperty,
jsclass.setproperty, and
jsclass.delproperty, which are hooks called during property accesses and don't have to implement any of that.
JSObjectOps.getRequiredSlot
the native ops (js_objectops, see js/src/jsobj.cpp) access slots reserved by including a call to the
jsclass_has_reserved_slots(n) macro in the
jsclass.flags initializer.
... note: the slot parameter is a zero-based index into obj slots, unlike the index parameter to the js_getreservedslot and js_setreservedslot api entry points, which is a zero-based index into the
jsclass_reserved_slots(clasp) reserved slots that come after the initial well-known slots: proto, parent, class, and optionally, the private data slot.
JS_ConstructObject
syntax jsobject * js_constructobject(jscontext *cx,
jsclass *clasp, jsobject *proto, jsobject *parent); jsobject * js_constructobjectwitharguments(jscontext *cx,
jsclass *clasp, jsobject *proto, jsobject *parent, unsigned int argc, jsval *argv); name type description cx jscontext * the context in which to create the new object.
... clasp
jsclass * pointer to the class to use for the new object.
JS_DefineObject
syntax jsobject * js_defineobject(jscontext *cx, js::handleobject obj, const char *name, const
jsclass *clasp = nullptr, unsigned attrs = 0); name type description cx jscontext * the context in which to create the new object.
... clasp const
jsclass * class to use for the new object.
JS_DefineProperty
it differs from js_setproperty in that: it does not behave like ordinary property assignment in the javascript language; it allows the application to specify additional details (getter, setter, and attrs) governing the new property's behavior; it never calls a setter; it can call the
jsclass.addproperty callback when js_setproperty would not, because it can replace an existing property.
...also note that certain jsapi functions, including js_lookupproperty, js_hasproperty, and property_attributes, can detect or examine a property without calling its getter.) if getter (or setter) is null, the new property will use the
jsclass.getproperty (or
jsclass.setproperty) callback from obj's class.
JS_DeleteProperty
then one of the following cases applies: if obj has no property with the given name or id, or if obj inherits the specified property from its prototype, then obj's
jsclass.delproperty hook is called.
...in this case, obj's
jsclass.delproperty hook is called.
JS_DeleteProperty2
then one of the following cases applies: if obj has no property with the given name or id, or if obj inherits the specified property from its prototype, then *succeeded is set to true and obj's
jsclass.delproperty hook is called (which may change *succeeded).
...in this case, *succeeded is set to true and obj's
jsclass.delproperty hook is called (which may change *succeeded).
JS_GET_CLASS
description js_get_class returns a pointer to the
jsclass associated with a specified js object, obj.
... the application must treat the
jsclass as read-only.
JS_InitStandardClasses
this object must be of a
jsclass that has the
jsclass_global_flags bits set.
... obj must be of a
jsclass that has the
jsclass_global_flags flag.
JS_IsConstructing_PossiblyWithGivenThisObject
vp const jsval * maybethis jsobject ** description in the case of a constructor called from js_constructobject and js_initclass where the class has the
jsclass_construct_prototype flag set, spidermonkey passes the constructor a non-standard this object.
...constructing_possiblywithgiventhisobject(cx, vp, &maybethis)) { // native called as a constructor if (maybethis) // native called as a constructor with maybethis as 'this' } else { // native called as function, maybethis is still uninitialized } } note: a spidermonkey embedding does not need to use this query unless the embedding uses js_constructobject(), js_initclass() and
jsclass_construct_prototype as described above.
JS_NewObjectForConstructor
syntax jsobject * js_newobjectforconstructor(jscontext *cx, const
jsclass *clasp, const js::callargs& args); // added in jsapi 32 jsobject * js_newobjectforconstructor(jscontext *cx,
jsclass *clasp, const jsval *vp); // added in jsapi 14, obsolete since jsapi 32 jsobject * js_newobjectforconstructor(jscontext *cx, const jsval *vp); // obsolete since jsapi 14 name type description cx jscontext * the context in which to create the new object.
... clasp const
jsclass * the class of the object to create.
Split object
the window object's
jsclass.resolve hook ensures that properties of the inner object are visible via the outer object, if the running code has the right principals to access them.
...split objects that need this behavior must implement it in custom
jsclass hooks.
JavaScript-DOM Prototypes in Mozilla
the prototype of a constructor will either be the prototype object that xpconnect creates for a class (if the name is the name of a real class) or simply an empty jsobject of a specific
jsclass that is defined in nsdomclassinfo.cpp (nsdomclassinfo::sdomconstructorprotoclass).
Exact Stack Rooting
class fooclass = { "fooprototype", /* name */
jsclass_has_private |
jsclass_has_reserved_slots(1), /* flags */ js_propertystub, /* addproperty */ js_propertystub, /* delproperty */ ...
JSExtendedClass.wrappedObject
description if a class has the
jsclass_is_extended bit set in its
jsclass.flags and has a non-null jsextendedclass.wrappedobject, then objects of that class may be wrappers.
JSObjectPrincipalsFinder
since it is very common for jsobjectops.checkaccess or
jsclass.checkaccess hooks to call these functions, the object principals finder callback is a key security feature.
JS_CheckAccess
otherwise, if obj's class has a non-null
jsclass.checkaccess callback, then it is called to perform the check.
JS_DefaultValue
objects with a custom
jsclass specified by the embedder will invoke that class's convert hook, which must convert the object to a primitive value, to determine the primitive result of conversion.
JS_GetProperty
then the
jsclass.getproperty hook of obj's class is called with the arguments (cx, obj, id, vp).
JS_GetReservedSlot
description if a
jsclass has
jsclass_has_reserved_slots(n) in its flags, with n > 0, or has a non-null
jsclass.reserveslots callback, then objects of that class have n reserved slots in which the application may store data.
JS_HasInstance
when providing a prototype as obj, the prototype's
jsclass must have its hasinstance method set.
JS_LookupProperty
(the javascript engine simply passes these flags through to the object when it calls the object's
jsclass.resolve callback, so objects of a custom
jsclass may interpret these flags however they like.) if flags is 0, js_lookuppropertywithflags uses the default lookup rules, the ones used by js_lookupproperty.
JS_SetCheckObjectAccessCallback
description js_setcheckobjectaccesscallback sets the runtime-wide check-object-access callback, which is used as the fallback
jsclass.checkaccess method for all classes that leave the checkaccess field null.
JS_SetElement
js_setelement ordinarily leaves *vp unchanged, but a
jsclass.addproperty hook or non-default setter may modify it.
JS_SetGlobalObject
for full ecmascript standard compliance, obj should be of a
jsclass that has the
jsclass_global_flags flag.
JS_ValueToNumber
(this behavior is implemented by v's jsobjectops.defaultvalue hook, so host objects can override it all.) first, the object's
jsclass.convert callback is called.
JS_ValueToString
otherwise, the resulting object's
jsclass.convert callback is called.
SpiderMonkey 1.8
in certain cases, the javascript engine no longer calls
jsclass.resolve callbacks repeatedly, as it did in previous versions.
SpiderMonkey 24
js_getprototype, takes context as first argument js_encodestringtobuffer takes add context as first argument, js_newruntime adds a js_[use|no]_helper_threads flag delete property in
jsclass definitions now use js_deletepropertystub garbage collection functions now take runtime argument most garbage collection functions now take a runtime argument instead of a context.
SpiderMonkey 31
many
jsclass and js::class instances are now explicitly const, and several apis have been updated to use const
jsclass * and const js::class * pointers.
SpiderMonkey 38
07639) js::addobjectroot (bug 1107639) js::addstringroot (bug 1107639) js::addvalueroot (bug 1107639) js::removeobjectroot (bug 1107639) js::removeobjectrootrt (bug 1107639) js::removescriptroot (bug 1107639) js::removescriptrootrt (bug 1107639) js::removestringroot (bug 1107639) js::removestringrootrt (bug 1107639) js::removevalueroot (bug 1107639) js::removevaluerootrt (bug 1107639)
jsclass_new_enumerate (bug 1097267)
jsclass_new_resolve (bug 993026) jsid_is_object (bug 915482) jsnewresolveop (bug 993026) jsval_is_boolean (bug 952650) jsval_is_double (bug 952650) jsval_is_gcthing (bug 952650) jsval_is_int (bug 952650) jsval_is_null (bug 952650) jsval_is_number (bug 952650) jsval_is_primitive (bug 952650) jsval_is_string (bug 952650) jsval_is_void (bug 952650) jsval_to_b...