Search completed in 1.26 seconds.
34 results for "jsscript":
Your results are loading. Please wait...
JSScript
JSScript is a type in the JSAPI. TODO: documentation on this gigantic class. For now, I'll just say that this class represents a section of compiled JavaScript code, and the functions to create, run, and analyize it. ...
... JSScript is a type in the JSAPI. TODO: documentation on this gigantic class. For now, I'll just say that this class represents a section of compiled JavaScript code, and the functions to create, run, and analyize it. ...
... JSScript is a type in the JSAPI. TODO: documentation on this gigantic class. For now, I'll just say that this class represents a section of compiled JavaScript code, and the functions to create, run, and analyize it. ...
Debugger.Script - Firefox Developer Tools
Debugger.Script A Debugger.Script instance may refer to a sequence of bytecode in the debuggee or to a block of WebAssembly code. For the former, it is the Debugger API's presentation of a JSAPI JSScript object. The two cases are distinguished by their format property being "js" or "wasm". Debugger.Script for JSScripts For Debugger.Script instances referring to a JSScript, they are distinguished by their format property being "js". Each of the following is represented by a single JSScript object: The body of a function--that is, all the code in the function that is not contained within some nested function. The code passed to a single call to eval, excluding the bodies of any functions that code defines. The contents of a <script> element. A DOM event handler, w...
... same script, and so on. (If more than one Debugger instance is debugging the same code, each Debugger gets a separate Debugger.Script instance for a given script. This allows the code using each Debugger instance to place whatever properties it likes on its Debugger.Script instances, without worrying about interfering with other debuggers.) A Debugger.Script instance is a strong reference to a JSScript object; it protects the script it refers to from being garbage collected. Note that SpiderMonkey may use the same Debugger.Script instances for equivalent functions or evaluated code--that is, scripts representing the same source code, at the same position in the same source file, evaluated in the same lexical environment. Debugger.Script for WebAssembly For Debugger.Script instances referring...
...a strong reference to the underlying WebAssembly module; it protects the module it refers to from being garbage collected. Please note at the time of this writing, support for WebAssembly is very preliminary. Many properties and methods below throw. Convention For descriptions of properties and methods below, if the behavior of the property or method differs between the instance referring to a JSScript or to a block of WebAssembly code, the text will be split into two sections, headed by "if the instance refers to a JSScript" and "if the instance refers to WebAssembly code", respectively. If the behavior does not differ, no such emphasized headings will appear. Accessor Properties of the Debugger.Script Prototype Object A Debugger.Script instance inherits the following accessor properties fro...
...And 15 more matches
JSAPI User Guide
gument, usually with a separate argument specifying the length of the string in jschars. Compiled scripts The easiest way to run a script is to use JS_EvaluateScript, which compiles and executes the script in one go. But sometimes an application needs to run a script many times. In this case, it may be faster to compile the script once and execute it multiple times. ...
... the string in jschars. Compiled scripts The easiest way to run a script is to use JS_EvaluateScript, which compiles and executes the script in one go. But sometimes an application needs to run a script many times. In this case, it may be faster to compile the script once and execute it multiple times. The JSAPI provides a type, JSScript, that represents a compiled script. ...
...eds to run a script many times. In this case, it may be faster to compile the script once and execute it multiple times. The JSAPI provides a type, JSScript, that represents a compiled script. The life cycle of a JSScript looks like this: The application compiles some JavaScript code using JS_CompileScript, JS_CompileUTF8File, or JS_CompileFileHandle. These functions return a pointer to a new JSScript. The application calls JS_ExecuteScript (or JS_ExecuteScriptPart) any number of times. It is safe to use a JSScript in multiple different contexts, but only within the JSRuntime and global in which it was created. Here is some example code using a compiled script: /* * Compile a script and execute it repeatedly until an * error occurs. (If this ever returns, it returns false. * If ther...
...And 3 more matches
JS::CompileOptions
function's script's source does not belong to the DOM element; the function's definition must appear elsewhere.) JSString *elementAttributeName() const If this source belongs to a DOM element because it is an event handler content attribute or an event handler IDL attribute, this returns the name of that attribute, a string. Otherwise, this returns NULL. JSScript *introductionScript() const Returns a pointer to JSScript which introduces the file. bool copy(JSContext *cx, const ReadOnlyCompileOptions &rhs) Copy compile options from rhs. Returns false if it failed to duplicate owning properties. bool setFile(JSContext *cx, const char *f) Duplicate null-terminated string f for filename(). Returns false if it failed to duplicate. ...
...const char *s) Duplicate null-terminated string s for introducerFilename. Returns false if it failed to duplicate. OwningCompileOptions &setLine(unsigned l) Sets each property and returns the instance itself. ...
...Returns false if it failed to duplicate. Methods of JS::CompileOptions Method Description JSObject *element() const Same as JS::OwningCompileOp...
...And 3 more matches
GC Rooting Guide
has a moving GC, it is very important that it knows about each and every pointer to a GC thing in the system. SpiderMonkey's rooting API tries to make this task as simple as possible. What is a GC thing pointer? "GC thing" is the term used to refer to memory allocated and managed by the SpiderMonkey garbage collector. The main types of GC thing pointer are: JS::Value JSObject* JSString* JSScript* jsid Note that JS::Value and jsid can contain pointers internally even though they are not a normal pointer type, hence their inclusion in this list. If you use these types directly, or create classes, structs or arrays that contain them, you must follow the rules set out in this guide. If you do not your program will not work correctly - if it works at all. GC things on the stack JS::Roo...
...l value. There are typedefs available for the main types. ...
... a reference, a JS::Handle is immutable: it can only ever refer to the JS::Rooted<T> that it was created for. Similarly to JS::Rooted<T>, there are typedefs available for the main types: Template class Typedef JS::Handle<JS::Value> JS::HandleValue JS::Handle<JSObject*> JS::HandleObject JS::Handle<JSString*> JS::HandleString JS::Handle<JSScript*> JS::HandleScript JS::Handle<jsid> JS::HandleId You should use JS::Handle<T> for all function parameters taking GC thing pointers (except out-parameters, which are described below). For example, instead of: JSObject * someFunction(JSContext *cx, JSObject* obj) { // ... } You should write: JSObject * someFunction(JSContext *cx, JS::HandleObject obj) { // ... } ...
...And 2 more matches
Hacking Tips
venient for debugging. Printing the JS stack (from gdb) In jsobj.cpp, a function named js::DumpBacktrace prints a backtrace a la gdb for the JS stack. The backtrace contains in the following order, the stack depth, the interpreter frame pointer (see js/src/vm/Stack.h, StackFrame class) or (nil) if compiled with IonMonkey, the file and line number of the call location and under parentheses, the JSScript pointer and the jsbytecode pointer (pc) executed. $ gdb --args js [...] (gdb) b js::ReportOverRecursed (gdb) r js> function f(i) { if (i % 2) f(i + 1); else f(i + 3); } js> f(0) Breakpoint 1, js::ReportOverRecursed (maybecx=0xfdca70) at /home/nicolas/mozilla/ionmonkey/js/src/jscntxt.cpp:495 495 if (maybecx) (gdb) call js::DumpBacktrace(maybecx) #0 (nil) typein:2 (0x7fffef...
...s corefile The gdb unwinder is supposed to be loaded by dist/bin/js-gdb.py and load python scripts which are located in js/src/gdb/mozilla under gdb. If gdb does not load the unwinder by default, you can force it to, by using the source command with the js-gdb.py file. Setting a breakpoint in the generated code (from gdb, x86 / x86-64, arm) To set a breakpoint the generated code of a specific JSScript compiled with IonMonkey. Set a breakpoint on the instruction you are interested in. If you have no precise idea which function you are looking at, you can set a breakpoint on the js::ion::CodeGenerator::visitStart function. Optionally, a condition on the ins->id() of the LIR instruction can be added to select precisely the instruction you are looking for. Once the breakpoint is on CodeGenerator ...
...If you want to know at which LIR the code is failing at, the js::ion::CodeGenerator::generateBody function can be intrumented to dump the LIR id before each instruction. for (; iter != current->end(); iter++) { IonSpew(IonSpew_Codegen, "instruction %s", iter->o...
...e corresponding source. Note that if you reverse-continue over a SIGSEGV and you're using the standard .gdbinit that sets a catchpoint for that signal, you'll get an additional stop at the catchpoint. Just reverse-continue again to continue to your breakpoints or whatever. [Hack] Replacing one instruction To replace one specific instruction, you can use in visit function of each instruction the JSScript filename in lineno fields as well as the id() of the LIR / MIR instructions. The JSScript can be obtained from info().script(). bool CodeGeneratorX86Shared::visitGuardShape(LGuardShape *guard) { if (info().script()->lineno == 16934 && guard->id() == 522) { [... another impl only for this one ...] return true; } [... old impl ...] [Hack] Spewing all compiled code I...
JS_NewScriptObject
Obsolete since JSAPI 8This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it. Return the JavaScript script object that wraps a compiled script. The compiled script and its parts live until the script object is garbage collected. Syntax JSObject * JS_NewScriptObject(JSContext *cx, JSScript *script); Name Type Description cx JSContext * The context in which to create the new script object. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. script JSScript * The compiled script for which to create a new script object. Description JS_NewScriptObject returns the script object associated with the giv...
... Name Type Description cx JSContext * The context in which to create the new script object. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. script JSScript * The compiled script for which to create a new script object. Description JS_NewScriptObject returns the script object associated with the given JSScript. Every JSScript object has an associated JSObject script object. As long as the script object is reachable, the JSScript and its components are protected from garbage collection; when the script object is collected, the JSScript and its contents are freed. Once you have created a script, you should immediately ensure that its script object is reachable (perhaps by using JS_AddRoot or JS_EnterLoc...
...omponents are protected from garbage collection; when the script object is collected, the JSScript and its contents are freed. Once you have created a script, you should immediately ensure that its script object is reachable (perhaps by using JS_AddRoot or JS_EnterLocalRootScope). A script object has no properties, and its prototype is Object.prototype. So a script object can be used to expose a JSScript to JavaScript code, but the code can't do much of anything with it. On success, JS_NewScriptObject returns a pointer to the script's object. Otherwise it returns NULL. ...
...pt object can be used to expose a JSScript to JavaScript code, but the code can't do much of anything with it. On success, JS_NewScriptObject returns a pointer to the script's object. Otherwise it returns NULL. (The name "JS_NewScriptObject" suggests that the script object is freshly allocated; this was the case in older versions of the API, but now the script object is allocated along with the JSScript itself.) (Some temporary scripts used internally by SpiderMonkey do not have script objects allocated for them; such scripts are not accessible via JSAPI.) See Also The JSAPI User Guide contains example code using compiled scripts. MXR ID Search for JS_NewScriptObject bug 630209 ...
Index
ject for a specified function pointer, fun. 301 JS_GetFunctionPrototype JSAPI Reference, SpiderMonkey JS_GetFunctionPrototype() retrieves the original Function.prototype of a specified object, obj. If an error occurs, it returns NULL. 302 JS_GetFunctionScript JSAPI Reference, Reference, Reference(2), SpiderMonkey JS_GetFunctionScript returns a pointer to JSScript for the specified function, fun. If fun is a native function, it returns NULL. 303 JS_GetGCParameter JSAPI Reference, SpiderMonkey JS_GetGCParameter returns the current parameter of the garbage collection. 304 JS_GetGlobalForCompartmentOrNull JSAPI Reference, Reference, Reference(2), SpiderMonkey JS_GetGlobalForCompartmentOrNull() returns the global objec...
...run. If parentRuntime is specified, the resulting runtime shares significant amounts of read-only state (the self-hosting and initial atoms compartments). It is recommended to make use of this for every runtime in a process after the first one. 413 JS_NewScriptObject JSAPI Reference, Obsolete, SpiderMonkey JS_NewScriptObject returns the script object associated with the given JSScript. 414 JS_NewStringCopyN JSAPI Reference, SpiderMonkey JS_NewStringCopyN allocates space for a JavaScript string and its underlying storage, and copies n characters from a C character array, s, into the new JSString. JS_NewUCStringCopyN is the Unicode version of the function. The two functions differ only in the type of the character array s; both functions create ordinary Java...
... Descriptions SpiderMonkey This document is automatically generated from Opcodes.h by make_opcode_doc.py. 530 Bytecodes SpiderMonkey SpiderMonkey bytecodes are the canonical form of code representation that is used in the JavaScript engine. The JavaScript frontend constructs an AST from the source text, then emits stack-based bytecodes from that AST as a part of the JSScript data structure. Bytecodes can reference atoms and objects (typically by array index) which are also contained in the JSScript data structure. 531 Functions SpiderMonkey There are several flavors of JavaScript function. All are JSObjects of the same class, js_FunctionClass. 532 Garbage collection Guide, NeedsContent, SpiderMonkey SpiderMonkey has a mark-sw...
SpiderMonkey Internals
I. Provided so far: Traps, with which breakpoints, single-stepping, step over, step out, and so on can be implemented. The debugger will have to consult jsopcode.def on its own to figure out where to plant trap instructions to implement functions like step out, but a future jsdbgapi.h will provide convenience interfaces to do these things. At most one trap per bytecode can be set. When a script (JSScript) is destroyed, all traps set in its bytecode are cleared. Watchpoints, for intercepting set operations on properties and running a debugger-supplied function that receives the old value and a pointer to the new one, which it can use to modify the new value being set. Line number to PC and back mapping functions. The line-to-PC direction "rounds" toward the next bytecode generated from a line gr...
...e in jsinterp.cpp. The JSContext constructor and destructor are factored out into jscntxt.cpp for minimal linking when the compiler part of JS is split from the interpreter part into a separate program. jsinvoke.cpp is a build hack used on some platforms to build js_Interpret under different compiler options from the rest of jsinterp.cpp. jsemit.*, jsopcode.tbl, jsopcode.*, jsparse.*, jsscan.*, jsscript.* Compiler and decompiler modules. The jsopcode.tbl file is a C preprocessor source that defines almost everything there is to know about JS bytecodes. See its major comment for how to use it. For now, a debugger will use it and its dependents such as jsopcode.h directly, but over time we intend to extend jsdbgapi.h to hide uninteresting details and provide conveniences. The code generator is sp...
... to use it. For now, a debugger will use it and its dependents such as jsopcode.h directly, but over time we intend to extend jsdbgapi.h to hide uninteresting details and provide conveniences. The code generator is split across paragraphs of code in jsparse.cpp, and the utility methods called on JSCodeGenerator appear in jsemit.cpp. Source notes generated by jsparse.cpp and jsemit.cpp are used in jsscript.cpp to map line number to program counter and back. jstypes.h Fundamental representation types and utility macros. This file alone among all .h files in SpiderMonkey must be included first by .cpp files. It is not nested in .h files, as other prerequisite .h files generally are, since it is also a direct dependency of most .cpp files and would be over-included if nested in addition to being dir...
JS::Add*Root
Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. rt JSRuntime * The runtime in which to add the new root. vp JS::Heap<JS::Value> The address of the JS::Value vari...
...ller must be in a request on this JSContext. rt JSRuntime * The runtime in which to add the new root. vp JS::Heap<JS::Value> The address of the JS::Value variable to root. rp JS::Heap<JSString *> The address of the JSString * variable to root. rp JS::Heap<JSObject *> The address of the JSObject * variable to root. rp JS::Heap<JSScript *> The address of the JSScript * variable to root. name const char * The name of the new root, or NULL. Description The JS::Add*Root and functions add a C/C++ variable to the garbage collector's root set, the set of variables used as starting points each time the collector checks to see what memory is reachable. The garbage collector aggressively collects and recycles me...
...et, the set of variables used as starting points each time the collector checks to see what memory is reachable. The garbage collector aggressively collects and recycles memory that it deems unreachable, so roots are often necessary to protect data from being prematurely collected. vp/rp is the address of a C/C++ variable (or field, or array element) of type JS::Value, JSString *, JSObject *, or JSScript *. This variable must already be initialized. (For example, it must not be an uninitialized local variable. That could cause sporadic crashes during garbage collection, which can be hard to debug.) The variable must remain in memory until the balancing call to JS::Remove*Root. Note that this means that if the root is meant to live past the end of a function, the address of a local (stack-based) v...
JS_GetFunctionScript
If fun is a native function, it returns NULL. ...
...If fun is a native function, it returns NULL. ...
...If fun is a native function, it returns NULL. See Also MXR ID Search for JS_GetFunctionScript bug 1069694 ...
Bytecode Descriptions
. (The spec refers to an "Iterator object" with a next method, but notes that it "is never directly accessible" to scripts. The object we use for this has no public methods.) If val is null or undefined, this pushes an empty iterator. The iter object pushed by this instruction must not be used or removed from the stack except by JSOp::MoreIter and JSOp::EndIter, or by error handling. The script's JSScript::trynotes() must mark the body of the for-in loop, i.e. exactly those instructions that begin executing with iter on the stack, starting with the next instruction (always JSOp::LoopHead). Code must not jump into or out of this region: control can enter only by executing JSOp::Iter and can exit only by executing a JSOp::EndIter or by exception unwinding. (A JSOp::EndIter is always emitted at the e...
...ome set of instructions in the script. Code must not jump into or out of this region: control can enter only by executing PushLexicalEnv and can exit only by executing a PopLexicalEnv or by exception unwinding. (A JSOp::PopLexicalEnv is always emitted at the end of the block, and extra copies are emitted on "exit slides", where a break, continue, or return statement exits the scope.) The script's JSScript::scopeNotes() must identify exactly which instructions begin executing in this scope. Typically this means a single entry marking the contiguous chunk of bytecode from the instruction after JSOp::PushLexicalEnv to JSOp::PopLexicalEnv (inclusive); but if that range contains any instructions on exit slides, after a JSOp::PopLexicalEnv, then those must be correctly noted as outside the scope. Format...
Bytecodes
Within the engine, all bytecode execute within a stack frame -- even global (top-level) and eval code has a stack frame associated with it. ...
...Within the engine, all bytecode execute within a stack frame -- even global (top-level) and eval code has a stack frame associated with it. ...
JS::Remove*Root
GC thing so that it is no longer a member of the garbage collector's root set. This enables any pointed-at GC thing to be garbage collected as needed. Syntax void RemoveValueRoot(JSContext *cx, JS::Heap<JS::Value> *vp); void RemoveStringRoot(JSContext *cx, JS::Heap<JSString *> *rp); void RemoveObjectRoot(JSContext *cx, JS::Heap<JSObject *> *rp); void RemoveScriptRoot(JSContext *cx, JS::Heap<JSScript *> *rp); void RemoveValueRootRT(JSRuntime *rt, JS::Heap<JS::Value> *vp); void RemoveStringRootRT(JSRuntime *rt, JS::Heap<JSString *> *rp); void RemoveObjectRootRT(JSRuntime *rt, JS::Heap<JSObject *> *rp); void RemoveScriptRootRT(JSRuntime *rt, JS::Heap<JSScript *> *rp); Name Type Description cx JSContext * The context from which to remove the root. Requires req...
...otRT. rp JS::Heap<JSString *> Address of the JSString * variable to remove from the root set. This must have been passed to either JS::AddStringRoot or JS::AddNamedStringRoot. rp JS::Heap<JSObject *> Address of the JSObject * variable to remove from the root set. This must have been passed to either JS::AddObjectRoot or JS::AddNamedObjectRoot. rp JS::Heap<JSScript *> Address of the JSScript * variable to remove from the root set. This must have been passed to JS::AddNamedScriptRoot. Description JS::Remove*Root removes the variable that rp points to from the garbage collector's root set. The entry for vp/rp is removed from the root set for the JSRuntime associated with the context cx. See Also MXR ID Search for JS::RemoveValueRoot MXR ID Se...
JS_CompileScriptForPrincipals
Obsolete since JSAPI 28This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it. Compile a security-enabled script for execution. ...
...8This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it. Compile a security-enabled script for execution. ...
JS_DecompileScript
Description JS_DecompileScript returns the source code of script. If script is a function, it calls JS_DecompileFunction. Otherwise, it returns the original source code of the script. ...
... Description JS_DecompileScript returns the source code of script. If script is a function, it calls JS_DecompileFunction. Otherwise, it returns the original source code of the script. ...
JS_ExecuteScript
Requires request. In a JS_THREADSAFE build, the caller must be...
...Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. obj JS::HandleObject The scope in which to execute the script. In the simplest cases, this should just be ...
JS_ExecuteScriptPart
ete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it. JS_ExecuteScriptPart has been removed in bug 555104. Use JS_ExecuteScript instead. Executes a part of a compiled script. Syntax typedef enum JSExecPart { JSEXEC_PROLOG, JSEXEC_MAIN } JSExecPart; JSBool JS_ExecuteScriptPart( JSContext *cx, JSObject *obj, JSScript *script, JSExecPart part, jsval *rval); Name Type Description cx JSContext * The context in which to execute the script. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. obj JSObject * The scope in which to execute the script. This parameter is documented in detail at JS_ExecuteScript. script ...
...cript, JSExecPart part, jsval *rval); Name Type Description cx JSContext * The context in which to execute the script. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. obj JSObject * The scope in which to execute the script. This parameter is documented in detail at JS_ExecuteScript. script JSScript * The compiled script to execute. part JSExecPart The part of script to execute. rval jsval * Out parameter. On success, *rval receives the value from the last executed expression statement in the script. Description JS_ExecuteScriptPart executes part of a previously compiled script, script. The part parameter must be either JSEXEC_PROLOG to execute the scri...
JS_SetBranchCallback
a function returns, and at the end of the script. Replaced with JS_SetOperationCallback. Syntax JSBranchCallback JS_SetBranchCallback(JSContext *cx, JSBranchCallback cb); Name Type Description cx JSContext * The context to hook. cb JSBranchCallback Pointer to the callback function. Callback syntax JSBool (*JSBranchCallback)(JSContext *cx, JSScript *script); Name Type Description cx JSContext * Pointer to a JSContext which the callback may use to call into JSAPI functions. For example, the callback my call JS_MaybeGC(cx). This is the context that is currently executing the code that triggered the callback. Provides request. In JS_THREADSAFE builds, the JavaScript engine calls this callback only from within an...
...text which the callback may use to call into JSAPI functions. For example, the callback my call JS_MaybeGC(cx). This is the context that is currently executing the code that triggered the callback. Provides request. In JS_THREADSAFE builds, the JavaScript engine calls this callback only from within an active request on cx. The callback does not need to call JS_BeginRequest()). script JSScript The script that is running. This is guaranteed to be non-null, unless the JSOPTION_NATIVE_BRANCH_CALLBACK option has been enabled for the context cx using JS_SetOptions(). If the callback returns JS_TRUE, the JS engine continues to execute the script. If the callback raises an exception using JS_SetPendingException() and returns JS_FALSE, then the JavaScript engine propagates the excep...
Shell global objects
orted on the current device. wasmTextToBinary(str) Translates the given text wasm module into its binary encoding. wasmBinaryToText(bin) Translates binary encoding to text format wasmExtractCode(module) Extracts generated machine code from WebAssembly.Module. isLazyFunction(fun) True if fun is a lazy JSFunction. isRelazifiableFunction(fun) Ture if fun is a JSFunction with a relazifiable JSScript. enableShellAllocationMetadataBuilder() Use ShellAllocationMetadataBuilder to supply metadata for all newly created objects. getAllocationMetadata(obj) Get the metadata for an object. bailout() Force a bailout out of ionmonkey (if running in ionmonkey). bailAfter(number) Start a counter to bail once after passing the given amount of possible bailout positions in ionmonkey. inJit() Retur...
...in any or all of the boolean properties options.args - show arguments to each function options.locals - show local variables in each frame options.thisprops - show the properties of the this object of each frame byteSize(value) Return the size in bytes occupied by value, or undefined if value is not allocated in memory. byteSizeOfScript(f) Return the size in bytes occupied by the function f's JSScript. setImmutablePrototype(obj) Try to make obj's [[Prototype]] immutable, such that subsequent attempts to change it will fail. Return true if obj's [[Prototype]] was successfully made immutable (or if it already was immutable), false otherwise. Throws in case of internal error, or if the operation doesn't even make sense (for example, because the object is a revoked proxy). setLazyParsingDisable...
JS::AutoVectorRooter
ved classes for the main types: Class Parent class JS::AutoValueVector AutoVectorRooter<Value> JS::AutoIdVector AutoVectorRooter<jsid> JS::AutoObjectVector Added in SpiderMonkey 24 AutoVectorRooter<JSObject *> JS::AutoFunctionVector Added in SpiderMonkey 31 AutoVectorRooter<JSFunction *> JS::AutoScriptVector AutoVectorRooter<JSScript *> See Also MXR ID Search for JS::AutoVectorRooter MXR ID Search for JS::AutoValueVector MXR ID Search for JS::AutoIdVector MXR ID Search for JS::AutoObjectVector MXR ID Search for JS::AutoFunctionVector MXR ID Search for JS::AutoScriptVector JS::AutoValueArray&lt;N&gt; - fixed-size array of JS::Value bug 677079 bug 868580 - expose JS::AutoObjectVector bug 848592 - added JS::Au...
JS::CompileOffThread
e a script off thread for execution. Syntax bool JS::CanCompileOffThread(JSContext *cx, const JS::ReadOnlyCompileOptions &options, size_t length); bool JS::CompileOffThread(JSContext *cx, const JS::ReadOnlyCompileOptions &options, const char16_t *chars, size_t length, JS::OffThreadCompileCallback callback, void *callbackData); JSScript * JS::FinishOffThreadScript(JSContext *maybecx, JSRuntime *rt, void *token); typedef void (*JS::OffThreadCompileCallback)(void *token, void *callbackData); Name Type Description cx / maybe JSContext * Pointer to a JS context from which to derive runtime information. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. ...
JS::Handle
x than when relying on a separate rooting analysis. If you want to add additional methods to JS::Handle for a specific specialization, define a js::HandleBase<T> specialization containing them. ...
JS::MutableHandle
t to add additional methods to JS::MutableHandle for a specific specialization, define a js::MutableHandleBase<T> specialization containing them. ...
JS::PersistentRooted
e, but from SpiderMonkey38, it can be declared as a global variable, and initialized later with init() method (bug 1107639). There are typedefs available for the main types: namespace JS { typedef PersistentRooted<JSFunction*> PersistentRootedFunction; typedef PersistentRooted<jsid> PersistentRootedId; typedef PersistentRooted<JSObject*> PersistentRootedObject; typedef PersistentRooted<JSScript*> PersistentRootedScript; typedef PersistentRooted<JSString*> PersistentRootedString; typedef PersistentRooted<JS::Symbol*> PersistentRootedSymbol; // Added in SpiderMonkey 38 typedef PersistentRooted<Value> PersistentRootedValue; } Example Following example allocates PersistentRootedValue, and provides two functions for setting and getting it from JavaScript. // To use Maybe. #incl...
JS::Rooted
never a local variable's value may be held live across a call which can trigger a GC. If you want to add additional methods to Rooted for a specific specialization, define a js::RootedBase<T> specialization containing them. ...
JSAutoCompartment
This article covers features introduced in SpiderMonkey 24 RAII helper to enter a different compartment on the given context and automatically leave it once the JSAutoCompartment instance gets out of scope. Syntax JSAutoCompartment(JSContext *cx, JSObject *target); JSAutoCompartment(JSContext *cx, JSScript *target); Name Type Description cx JSContext * The context on which a cross-compartment call is needed. target JSObject * / JSScript * The object in a different compartment to be accessed. This implicitly identifies the compartment to be entered. Description Every JSContext has a current compartment. Only objects in the current compartment can be accessed, so to access an object in a different compartment, this c...
JS_DestroyScript
Free a compiled script that is no longer needed. Syntax void JS_DestroyScript(JSContext *cx, JSScript *script); Name Type Description cx JSContext * The context in which to destroy the script. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. script JSScript * The script to destroy. Description JS_DestroyScript destroys the given compiled script, freeing the memory allocated to it. The script must not be currently executing (in any context, at any level of the stack) and must not be used again afterwards. At present, this function has no effect; the JSScript lives for as long as its script object lives. See JS_NewScriptObject for details. See Also MXR ID Search for JS_DestroyScript bug ...
JS_SetFunctionCallback
r to the C function to call. Note that debuggers should probably use JS_SetCallHook in preference to this function, because it is invoked when the Javascript stack is guaranteed to be in a consistent state (and therefore it is valid to inspect and modify local variables, generate stack traces, and set breakpoints.) Callback syntax typedef void (* JSFunctionCallback)(const JSFunction *fun,const JSScript *scr, const JSContext *cx, int entering); Name Type Description fun const JSFunction * The JavaScript function being invoked or exited. scr const JSScript * The script being executed. cx JSContext * The JavaScript context in which the script is being run. entering int true if the callback is being ...
JSAPI reference
n SpiderMonkey 17 JS_EvaluateScript Obsolete since JSAPI 36 JS_EvaluateUCScript Obsolete since JSAPI 36 JS_EvaluateScriptForPrincipals Obsolete since JSAPI 30 JS_EvaluateUCScriptForPrincipals Obsolete since JSAPI 30 JS_EvaluateScriptForPrincipalsVersion Obsolete since JSAPI 30 JS_EvaluateUCScriptForPrincipalsVersion Obsolete since JSAPI 30 You can instead compile JavaScript code into a JSScript which you can then execute multiple times. class JSScript JS::Compile Added in SpiderMonkey 17 JS::CompileOffThread Added in SpiderMonkey 31 JS::CanCompileOffThread Added in SpiderMonkey 31 JS::FinishOffThreadScript Added in SpiderMonkey 31 JS_CompileScript JS_CompileUCScript JS_BufferIsCompilableUnit JS_ExecuteScript JS::CloneAndExecuteScript Added in SpiderMonkey 31 JS_DecompileScr...
SpiderMonkey 1.8.5
stack/register roots (such as when we access the jschars in a JSString). A C analogue, JS_AnchorPtr, was introduced with bug 630209. bug 630209 also removed the need for JS_NewScriptObject, by modifying the script compilation interfaces to handle the creation and management of the object wrapper directly; similarly, the script execution interfaces now accept a JSObject pointer than a pointer to JSScript. Affected interfaces are: JS_CompileScript JS_CompileScriptForPrincipals JS_CompileScriptForPrincipalsVersion JS_CompileUCScript JS_CompileUCScriptForPrincipals JS_CompileUCScriptForPrincipalsVersion JS_CompileFile JS_CompileFileHandle JS_CompileFileHandleForPrincipals JS_CompileFileHandleForPrincipalsVersion JS_CompileFunction JS_CompileFunctionForPrincipals JS_CompileUCFunctionFor...
SpiderMonkey 1.8.7
stack/register roots (such as when we access the jschars in a JSString). A C analogue, JS_AnchorPtr, was introduced with bug 630209. Bug 630209 also removed the need for JS_NewScriptObject, by modifying the script compilation interfaces to handle the creation and management of the object wrapper directly; similarly, the script execution interfaces now accept a JSObject pointer than a pointer to JSScript. Affected interfaces are: JS_CompileScript JS_CompileScriptForPrincipals JS_CompileScriptForPrincipalsVersion JS_CompileUCScript JS_CompileUCScriptForPrincipals JS_CompileUCScriptForPrincipalsVersion JS_CompileFile JS_CompileFileHandle JS_CompileFileHandleForPrincipals JS_CompileFileHandleForPrincipalsVersion JS_CompileFunction JS_CompileFunctionForPrincipals JS_CompileUCFunctionFor...
Index - Firefox Developer Tools
bject.prototype.getOwnPropertyDescriptor and Debugger.Object.prototype.defineProperty, ensuring that the debugger will not inadvertently invoke the referent's getters and setters. 23 Debugger.Script A Debugger.Script instance may refer to a sequence of bytecode in the debuggee or to a block of WebAssembly code. For the former, it is the Debugger API's presentation of a JSAPI JSScript object. The two cases are distinguished by their format property being "js" or "wasm". 24 Debugger.Source A Debugger.Source instance represents either a piece of JavaScript source code or the serialized text of a block of WebAssembly code. The two cases are distinguished by the latter having its introductionType property always being "wasm" and the former having its introduc...
Aggregate view - Firefox Developer Tools
shot that are displayed, so you can quickly see, for example, how many objects of a specific class were allocated. Type This is the default view, which looks something like this: It groups the things on the heap into types, including: JavaScript objects: such as Function or Array DOM elements: such as HTMLSpanElement or Window Strings: listed as "strings" JavaScript sources: listed as "JSScript" Internal objects: such as "js::Shape". These are prefixed with "js::". Each type gets a row in the table, and rows are ordered by the amount of memory occupied by objects of that type. For example, in the screenshot above you can see that JavaScript Objects account for most memory, followed by strings. The "Total Count" column shows you the number of objects of each category that are curre...