Search completed in 1.29 seconds.
12 results for "jscompartment":
JS_SetCompartmentNameCallback
Mozilla › Projects › SpiderMonkey › JSAPI reference › JS SetCompartmentNameCallback
This article covers features introduced in SpiderMonkey 17 Set callback function to name each compartment. Syntax void JS_SetCompartmentNameCallback(JSRuntime *rt, JSCompartmentNameCallback callback); Name Type Description cx JSRuntime * The runtime to set the callback function. callback JSCompartmentNameCallback Callback function which will be called to name each compartment (see below). ...
...name each compartment. Syntax void JS_SetCompartmentNameCallback(JSRuntime *rt, JSCompartmentNameCallback callback); Name Type Description cx JSRuntime * The runtime to set the callback function. callback JSCompartmentNameCallback Callback function which will be called to name each compartment (see below). Callback function typedef void (* JSCompartmentNameCallback)(JSRuntime *rt, JSCompartment *compartment, char *buf, size_t bufsize); Name Type Description cx JSRuntime * The runtime of the compartments. compartmentCallback JSCompartment * The pointer to the compartment to be named. buf char * The buffer to store the name of the compartment. bufs...
...ntime of the compartments. compartmentCallback JSCompartment * The pointer to the compartment to be named. buf char * The buffer to store the name of the compartment. bufsize size_t The maximum size of the buffer. Description JS_SetCompartmentNameCallback sets callback function which will be called to name the compartment. If the runtime has no JSCompartmentNameCallback, a compartment will be named "<unknown>"</unknown>. JSCompartmentNameCallback will be called when visiting the compartment, and it should store the name of the compartment into buf with NULL terminated string. ...
...lback function which will be called to name the compartment. If the runtime has no JSCompartmentNameCallback, a compartment will be named "<unknown>"</unknown>. JSCompartmentNameCallback will be called when visiting the compartment, and it should store the name of the compartment into buf with NULL terminated string. ...
SpiderMonkey Internals: Thread Safety
Mozilla › Projects › SpiderMonkey › Internals › Thread Safety
avaScript engine. It is mainly of interest to people working on SpiderMonkey itself. See JS_THREADSAFE for a gentler introduction to using SpiderMonkey in a multi-threaded application. General background SpiderMonkey has a top-level struct, JSRuntime, that acts as a container for everything else. A program typically has only one JSRuntime, even if it has many threads. Each runtime has one or more JSCompartments. The JSCompartment is the universe in which JS objects live. They can't travel to other JSCompartments. Crucially, any given compartment may only be accessed by one thread at a time. This means that objects cannot be shared across compartments. All JS code and most JSAPI calls run within a JSContext. The JSContext can be thought of as a machine that knows how to run JavaScript code, or as an abs...
... of as a machine that knows how to run JavaScript code, or as an abstraction of the notion of a thread. Exception handling, for example, is per-JSContext. Each JSContext must be used by only one thread at a time. A single JSContext can run work with code and objects in multiple compartments as long as no other thread is accessing those compartments. Objects may be shared among JSContexts within a JSCompartment. There's no fixed association between an object and a context. Thread-safety in SpiderMonkey is turned on by compiling with -DJS_THREADSAFE. In a JS_THREADSAFE build, these operations are handled specially: access to JSRuntime data structures garbage collection Accesses to JSRuntime data structures are serialized with a few mutexes. The treatment of GC requires more explanation. Making GC thr...
JS_SetVersionForCompartment
Mozilla › Projects › SpiderMonkey › JSAPI reference › JS SetVersionForCompartment
version JSVersion Version of JavaScript to set compartment to. Description JS_SetVersionForCompartment attempts to set the version of JavaScript to version for a specified compartment, compartment. The version comes from the JSVersion enumerated type. ...
... version JSVersion Version of JavaScript to set compartment to. Description JS_SetVersionForCompartment attempts to set the version of JavaScript to version for a specified compartment, compartment. The version comes from the JSVersion enumerated type. ...
Index
Mozilla › Projects › SpiderMonkey › Index
onkey Set the runtime-wide check-object-access callback. This function is deprecated. In SpiderMonkey 1.8.1 and later, use JS_SetRuntimeSecurityCallbacks instead. 450 JS_SetCompartmentNameCallback JSAPI Reference, Reference, Reference(2), SpiderMonkey JS_SetCompartmentNameCallback sets callback function which will be called to name the compartment. If the runtime has no JSCompartmentNameCallback, a compartment will be named "<unknown>"</unknown>. 451 JS_SetContextCallback JSAPI Reference, SpiderMonkey JS_SetContextCallback specifies a callback function that is automatically called when JSContexts are created or destroyed. Only one callback function may be specified per JS runtime. This function returns the previous context callback, if any, else NULL. ...
JS_EnterCompartment
Mozilla › Projects › SpiderMonkey › JSAPI reference › JS EnterCompartment
This article covers features introduced in SpiderMonkey 24 Note: the preferred way of changing a context's current compartment is using JSAutoCompartment. Enter a different compartment on the given context, so that objects in that compartment can be accessed. Syntax JSCompartment * JS_EnterCompartment(JSContext *cx, JSObject *target); Name Type Description cx JSContext * The context on which a cross-compartment call is needed. target JSObject * The object in a different compartment to be accessed. This implicitly identifies the compartment to be entered. Description Every JSContext has a current compartment. Any access to an object in a different compartment must be bracketed by calling JS_EnterCompartment and JS_Le...
JS_GetCompartmentPrivate
Mozilla › Projects › SpiderMonkey › JSAPI reference › JS GetCompartmentPrivate
This article covers features introduced in SpiderMonkey 1.8.5 Please provide a description for this function. Syntax void JS_SetCompartmentPrivate(JSCompartment *compartment, void *data); void * JS_GetCompartmentPrivate(JSCompartment *compartment); Name Type Description compartment JSCompartment * Any compartment data void * (in JS_SetCompartmentPrivate) Pointer to application-defined data to be associated with the compartment. Description Each JSCompartment has a field of type void * which the application may use for any purpose. It is especially useful for storing data needed by callbacks. JS_GetCompartmentPrivate gets this field and JS_SetCompartmentPrivate sets it. The field is initially NULL. Memory management for this private data...
JS_GetGlobalForCompartmentOrNull
Mozilla › Projects › SpiderMonkey › JSAPI reference › JS GetGlobalForCompartmentOrNull
This article covers features introduced in SpiderMonkey 17 Return the global object for the specified compartment. Syntax JSObject * JS_GetGlobalForCompartmentOrNull(JSContext *cx, JSCompartment *c); Name Type Description cx JSContext * The context for which to return the global object. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. c JSCompartment * The compartment for which to return the global object. Description JS_GetGlobalForCompartmentOrNull() returns the global object for the context and the compartment. This may return NULL if c never had a global (e.g., the atoms compartment), or if c's global has been collected. See also MXR ID Search for JS_GetGlobalForCompartmentO...
JS_IterateCompartments
Mozilla › Projects › SpiderMonkey › JSAPI reference › JS IterateCompartments
Type Description cx JSRuntime * The runtime of the compartments to iterate over. data void * This will be passed as the data parameter of the JSIterateCompartmentCallback. compartmentCallback JSIterateCompartmentCallback Callback function (see below). Callback function typedef void (*JSIterateCompartmentCallback)(JSRuntime *rt, void *data, JSCompartment *compartment); Name Type Description cx JSRuntime * The runtime of the compartments. data void * data parameter passed to JS_IterateCompartments. compartmentCallback JSCompartment * The pointer to the compartment. Description JS_IterateCompartments calls compartmentCallback on every compartment. Beware that there is no guarante...
JS_LeaveCompartment
Mozilla › Projects › SpiderMonkey › JSAPI reference › JS LeaveCompartment
This article covers features introduced in SpiderMonkey 24 Note: the preferred way of changing a context's current compartment is using JSAutoCompartment. Leave a the compartment, returning to the compartment active before the corresponding JS_EnterCompartment. Syntax void JS_LeaveCompartment(JSContext *cx, JSCompartment *oldCompartment); Name Type Description cx JSContext * The context in which to leave the compartment. oldCompartment JSCompartment * Value returned by previous call to JS_EnterCompartment. Description Every JSContext has a current compartment. Any access to an object in a different compartment must be bracketed by calls to JS_EnterCompartment and JS_LeaveCompartment. See Also MXR ID Search for JS_LeaveCo...
JS_NewGlobalObject
Mozilla › Projects › SpiderMonkey › JSAPI reference › JS NewGlobalObject
ction cycle that finally frees it. The usual way to do this is to make JSClasses global or static. principals JSPrincipals * The security information to associate with this compartment. hookOption JS::OnNewGlobalHookOption See Debugger API Hook Added in SpiderMonkey 31 options const JS::CompartmentOptions &amp; The option for new compartment (passed to JScompartment constructor). Added in SpiderMonkey 31 Description JS_NewGlobalObject creates a new global object based on the specified class. The new object has no parent. It initially has no prototype either, since it is typically the first object created; call JS_InitStandardClasses to create all the standard objects, including Object.prototype, and set the global object's prototype. The constructo...
JS_SetDestroyCompartmentCallback
Mozilla › Projects › SpiderMonkey › JSAPI reference › JS SetDestroyCompartmentCallback
back(JSRuntime *rt, JSDestroyCompartmentCallback callback); Name Type Description cx JSRuntime * The runtime to set the callback function. callback JSDestroyCompartmentCallback Callback function which will be called for each compartment being destroyed (see below). Callback function typedef void (* JSDestroyCompartmentCallback)(JSFreeOp *fop, JSCompartment *compartment); Name Type Description cx JSRuntime * The runtime of the compartments. compartmentCallback JSCompartment * The pointer to the compartment which is to be destroyed. Description JS_SetDestroyCompartmentCallback sets callback function which will be called when sweeping each compartment of the runtime, before deleting the compartmen...
JSAPI reference
Mozilla › Projects › SpiderMonkey › JSAPI reference
es Native function types: JSNative JSFastNative Obsolete since JavaScript 1.8.5 Other callback types: JS::LargeAllocationFailureCallback - used by JS::SetLargeAllocationFailureCallback Added in SpiderMonkey 31 JS::OffThreadCompileCallback - used by JS::CompileOffThread Added in SpiderMonkey 26 JS::SetOutOfMemoryCallback - used by JS::OutOfMemoryCallback Added in SpiderMonkey 31 JSCompartmentNameCallback - used by JS_SetCompartmentNameCallback Added in SpiderMonkey 17 JSContextCallback - used by JS_SetContextCallback JSDestroyCompartmentCallback - used by JS_SetDestroyCompartmentCallback Added in SpiderMonkey 17 JSEnumerateDiagnosticMemoryCallback - used by JS_EnumerateDiagnosticMemoryRegions Added in SpiderMonkey 17 JSErrorCallback - used by JS_ReportErrorNumber and fri...