Search completed in 1.33 seconds.
63 results for "jsstring *":
Your results are loading. Please wait...
How to embed the JavaScript engine
*/ static JSClass global_class = { "global", JSCLA...
...*/ static JSClass global_class = { "global", JSCLA...
...*/ static JSClass global_cl...
...And 2 more matches
Index
SVAL_TO_OBJECT casts the argument, v, to type JSObject *. As a precondition, JSVAL_IS_OBJECT(v) must be true. That is, v must be either a reference to an object or JSVAL_NULL. This function is not type-safe: if v is not an object or JSVAL_NULL, the behavior is undefined. 176 JSVAL_TO_STRING JSAPI Reference, Obsolete, SpiderMonkey JSVAL_TO_STRING casts the argument, v, to type JSString *. As a precondition, JSVAL_IS_STRING(v) must be true. This function is not type-safe: if v is not a string, the behavior is undefined. 177 JSVAL_TRUE JSAPI Reference, Obsolete, SpiderMonkey JSVAL_TRUE and JSVAL_FALSE are jsval constants that represent the JavaScript boolean values, true and false. They are equivalent to BOOLEAN_TO_JSVAL(true) and BOOLEAN_TO_JSVAL(false), respe...
... to execute the script prolog or JSEXEC_MAIN to execute the main section of the script. 266 JS_ExecuteScriptVersion JSAPI Reference, Obsolete, SpiderMonkey JS_ExecuteScript executes a previously-compiled script, script. 267 JS_FORGET_STRING_FLATNESS JSAPI Reference, Reference, Reference(2), SpiderMonkey JS_FORGET_STRING_FLATNESS converts JSFlatString * to JSString *. 268 JS_FS JSAPI Reference, SpiderMonkey Use these macros to define an array of JSFunctionSpecs to pass to JS_DefineFunctions or JS_InitClass. 269 JS_FileEscapedString JSAPI Reference, Reference, Reference(2), SpiderMonkey JS_FileEscapedString writes str into file fp escaping any non-printable or non-ASCII character. If quote is not 0, it must be a single...
...j is of a particular JSClass. To use it this way, pass NULL for argv. JS_InstanceOf returns true if obj is of the given class and false otherwise. That is, it returns JS_GetClass(obj) == clasp. 362 JS_InternJSString JSAPI Reference, Reference, Reference(2), SpiderMonkey JS_InternJSString converts a string str to interned string (interned atom) and returns the result string as JSString *. 363 JS_InternString JSAPI Reference, SpiderMonkey No summary! 364 JS_IsArrayObject JSAPI Reference, SpiderMonkey JS_IsArrayObject determines if a specified object, obj or value, is an Array object. 365 JS_IsAssigning JSAPI Reference, Obsolete, Reference, Reference(2), SpiderMonkey JS_IsAssigning returns true if a script is executing ...
...eserved slots. 510 Property attributes Attribute, JSAPI Reference, Reference, Reference(2), SpiderMonkey Some property attributes are defined in the ECMAScript standard, in ECMA 262-3 ?8.6.1. SpiderMonkey additionally defines several non-standard property attributes. 511 STRING_TO_JSVAL JSAPI Reference, Obsolete, SpiderMonkey STRING_TO_JSVAL casts a given JSString * to jsval. str must be a non-null pointer of type JSString *. The conversion always succeeds. 512 Stored value JSAPI Reference, JavaScript, SpiderMonkey In the JSAPI, the stored value of an object property is its last known value. For a data property, this is exactly the same thing as the property's current value. 513 jschar JSAPI Reference, Obsolete, SpiderMonk...
JS::Add*Root
id using it. This article covers features introduced in SpiderMonkey 31 Register a variable as a member of the garbage collector's root set, to protect anything the root points at from garbage collection. These functions are obsoleted, use JS::PersistentRooted instead. ...
...Requires request...
...char *name); Name Type Description cx JSContext * The context in which to add the new 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 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 s...
... 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 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 o...
JS::CompileOptions
). Source belongs to a DOM element if it was assigned to one of the element's event handler IDL attributes as a string. (Note that one may assign both strings and functions to DOM elements' event handler IDL attributes. If one assigns a function, that 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 ReadOnlyCompileOp...
... to duplicate. bool setIntroducerFilename(JSContext *cx, 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. ...
..._t offset) Duplicate null-terminated string introducerFn for introducerFilename and set introductionType, introductionLineno, introductionScriptRoot, introductionOffset, and hasIntroductionInfo properties. Returns false if it failed to duplicate. Methods of JS::CompileOptions Method Description JSObject *element() const Same as JS::OwningCompileOptions. JSString *elementAttributeName() const JSScript *introductionScript() const CompileOptions &setFile(const char *f) Sets each property and returns the instance itself. CompileOptions &setLine(unsigned l) CompileOptions &setFileAndLine(const char *f, unsigned l) CompileOptions &setSourceMapURL(const char16_t *s) CompileOptions &setElement(JSObject *e) ...
...introductionScript() const CompileOptions &setFile(const char *f) Sets each property and returns the instance itself. ...
JS_Add*Root
some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it. Register a variable as a member of the garbage collector's root set, to protect anything the root points at from garbage collection. These functions are obsoleted, use JS::PersistentRooted instead. ...
...functions are obsoleted, use JS::PersistentRooted instead. Syntax JSBool JS_AddValueRoot(JSContext *cx, jsval *vp); JSBool JS_AddStringRoot(JSContext *cx, JSString **spp); JSBool JS_AddObjectRoot(JSContext *cx, JSObject **opp); JSBool JS_AddGCThingRoot(JSContext *cx, void **rp); JSBool JS_AddNamedValueRoot(JSContext *cx, jsval *vp, const char *name); JSBool JS_AddNamedStringRoot(JSContext *cx, JSString **spp, const char *name); JSBool JS_AddNamedObjectRoot(JSContext *cx, JSObject **opp, const char *name); JSBool JS_AddNamedGCThingRoot(JSContext *cx, void **rp, const char *name); Name Type Description cx JSContext * The context in which to add the new root. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. vp ...
...ddNamedGCThingRoot(JSContext *cx, void **rp, const char *name); Name Type Description cx JSContext * The context in which to add the new root. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. ...
...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 memory that it deems unreachable, so roots are often necessary to protect data from being prematurely collected. vp/spp/opp/rp is the address of a C/C++ variable (or field, or array element) of type JSString *, JSObject *, or jsval. 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_RemoveRoot. Note that this means that if the root is meant to live past the end of a function, the address of a loc...
JS_InternString
Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. ...
...Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. ...
...Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. ...
...Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. ...
JS::Remove*Root
at any time. Try to avoid using it. This article covers features introduced in SpiderMonkey 31 Unregister a pointer to a 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. ...
...llected 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 request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. rt JSRuntime * The runtime from whic...
.... Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. rt JSRuntime * The runtime from which to remove the root. vp JS::Heap<JS::Value> Address of the JS::Value variable to remove from the root set. This must have been passed to one of JS::AddValueRoot, JS::AddNamedValueRoot or JS::AddNamedValueRootRT. 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 *...
JSAutoByteString
This article covers features introduced in SpiderMonkey 17 Take ownership of a string and free it later. Syntax JSAutoByteString str; JSAutoByteString(JSContext *cx, JSString *str); Name Type Description cx JSContext * The context in which to add the root. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. str JSString * A pointer to JSString to get initial content by calling JS_EncodeString(cx, str). Methods Method Description void initBytes(char *bytes) Take ownership of the given byte array. char *encodeLatin1(JSContext *cx, JSString *str) Call JS_EncodeString and take ownership of the returned string, and return the string. char *encodeLatin...
...o JSString to get initial content by calling JS_EncodeString(cx, str). Methods Method Description void initBytes(char *bytes) Take ownership of the given byte array. char *encodeLatin1(JSContext *cx, JSString *str) Call JS_EncodeString and take ownership of the returned string, and return the string. char *encodeLatin1(js::ExclusiveContext *cx, JSString *str) Call JS::LossyTwoByteCharsToNewLatin1CharsZ, or allocate string and copy the content of JSLinearString::latin1Chars, and take the ownership of the string. This may fail if str is not linear. char *encodeUtf8(JSContext *cx, JS::HandleString str) Call JS_EncodeStringToUTF8 and take ownership of the returned string, and return the string. void clear() Free the owned st...
...ke ownership. If JSAutoByteString instance is initialized with JSAutoByteString bytes; style, it does not own any string. You can call some methods to take ownership of other string. Note that the JS_EncodeString call in constructor and some encode* methods may fail and get NULL. So ensure the string is returned by operator!() before using ptr() method. Examples Use constructor arguments { JSString *str = JS::ToString(cx, strVal); if (!str) return false; JSAutoByteString bytes(cx, str); /* calls JS_EncodeString internally */ if (!bytes) return false; /* ...do something with bytes... */ /* when leaving this scope, the string returned by JS_EncodeString is freed. */ } Use method to encode string { JS::RootedString str(cx, JS::ToString(cx, strVal)); if (!str) retu...
JSAPI Cookbook
line of code that called your native function, so it's usually what you want. ...
...your native function, so it's usually what you want. ...
JSAPI User Guide
/* class constructor properties and methods */ my_static_props, my_static_methods); Running scripts /* These should indicate source location for diagnostics. */ char *filename; unsigned int lineno; /* * The return value comes back here -- if it could be a GC thing, you must * add it to the GC's "root set" with JS_Add*Root(cx, &thing) where thing * is a JSString *, JSObject *, or jsdouble *, and remove the root before * rval goes out of scope, or when rval is no longer needed. */ jsval rval; JSBool ok; /* * Some example source in a C string. Larger, non-null-terminated buffers * can be used, if you pass the buffer length to JS_EvaluateScript. */ char *source = "x * f(y)"; ok = JS_EvaluateScript(cx, globalObj, source, strlen(source), ...
...able-trace-jscalls, you can use JS_SetFunctionCallback() to set up a C function to be called whenever a JavaScript function is about to be called, or has finished executing: void funcTransition(const JSFunction *func, const JSScript *scr, const JSContext *const_cx, JSBool entering) { JSContext *cx = const_cast<JSContext*>(const_cx); JSString *name = JS_GetFunctionId((JSFunction*)func); const char *entExit; const char *nameStr; /* build a C string for the function's name */ if (!name) { nameStr = "Unnamed function"; } else { nameStr = JS_EncodeString(cx, name); } /* build a string for whether we're entering or exiting */ if (entering) { entExit = "Entering"; } else { entExit = "Exiting"; } /* o...
JSID_IS_STRING
Testing and conversion functions between a JS ID and a JS string. Syntax bool JSID_IS_STRING(jsid id); JSString * JSID_TO_STRING(jsid id); jsid INTERNED_STRING_TO_JSID(JSContext *cx, JSString *str); // Added in SpiderMonkey 38 JSFlatString * JSID_TO_FLAT_STRING(jsid id); // Added in SpiderMonkey 17 Name Type Description cx 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. id jsid The property identifier to test or convert. str JSString * An interned string to convert to an id. Description JSID_IS_STRING tests whether a specified JS ID, id, is a string, and returns true if it's a string. JSID_TO_STRING...
... INTERNED_STRING_TO_JSID converts a specified interned string, str to a jsid. JSID_TO_FLAT_STRING converts a specified JS ID, id to a JSFlatString *. ...
JSVAL_TO_STRING
Obsolete since JSAPI 32This 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. Cast a jsval to type JSString * without a type check. Syntax JSString * JSVAL_TO_STRING(jsval v); Description JSVAL_TO_STRING casts the argument, v, to type JSString *. As a precondition, JSVAL_IS_STRING(v) must be true. This function is not type-safe: if v is not a string, the behavior is undefined. To coerce any value to a string, use the JS_ValueToString function instead. ...
...recondition, JSVAL_IS_STRING(v) must be true. This function is not type-safe: if v is not a string, the behavior is undefined. To coerce any value to a string, use the JS_ValueToString function instead. (The difference is that the latter will convert an object, array, number, or other value to a string in a type-safe way, creating a new string if needed.) To convert the return type of this macro (JSString *) to a char pointer, use JS_GetStringBytes. See Also bug 952650 ...
JS_EncodeStringToBuffer
buffer char * A character buffer to receive encoded string. length size_t The size of buffer in bytes. ...
... buffer char * A character buffer to receive encoded string. length size_t The size of buffer in bytes. ...
JS_FileEscapedString
quote char One of 0, single quote, and double quote. Description JS_FileEscapedString writes str into file fp escaping any non-printable or non-ASCII character. ...
... quote char One of 0, single quote, and double quote. Description JS_FileEscapedString writes str into file fp escaping any non-printable or non-ASCII character. ...
JS_FlattenString
Description JS_FlattenString flattens a string str and returns a pointer to JSFlatString. ...
... Description JS_FlattenString flattens a string str and returns a pointer to JSFlatString. To catch errors, an opaque JSFlatString type is returned. ...
JS_GetStringEncodingLength
Description JS_GetStringEncodingLength returns the length of the specified string in bytes, regardless of its encoding. ...
... Description JS_GetStringEncodingLength returns the length of the specified string in bytes, regardless of its encoding. ...
JS_GetTwoByteExternalStringChars
Description JS_GetTwoByteExternalStringChars gets the characters of the string, str. JS_GetTwoByteExternalStringChars always succeeds, and returns a pointer to the string. ...
... Description JS_GetTwoByteExternalStringChars gets the characters of the string, str. JS_GetTwoByteExternalStringChars always succeeds, and returns a pointer to the string. ...
JS_MakeStringImmutable
s must not be null. ...
...s must not be null. ...
JS_NewExternalString
Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. chars const char16_t * or const jschar * Pointer to the first element of an array of char16_ts. ...
...Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. chars const char16_t * or const jschar * Pointer to the first element of an array of char16_ts. ...
JS_Remove*Root
ay still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it. Unregisters a pointer to a 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 JSBool JS_RemoveValueRoot(JSContext *cx, jsval *vp); JSBool JS_RemoveStringRoot(JSContext *cx, JSString **spp); JSBool JS_RemoveObjectRoot(JSContext *cx, JSObject **opp); JSBool JS_RemoveGCThingRoot(JSContext *cx, void **rp); Name Type Description cx JSContext * A context. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. vp jsval * Address of the jsval variable to remove from the root set. This must have been...
..._RemoveGCThingRoot(JSContext *cx, void **rp); Name Type Description cx JSContext * A context. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. vp jsval * Address of the jsval variable to remove from the root set. This must have been passed to either JS_AddValueRoot or JS_AddNamedValueRoot. spp JSString * Address of the JSString* variable to remove from the root set. This must have been passed to either JS_AddStringRoot or JS_AddNamedStringRoot. opp 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 void ** Address of the pointer variable to remove from the r...
Mozilla DOM Hacking Guide
" property on the window object, its // value being the XPConnect wrapper for the Location object. *objp = obj; return NS_OK; } This is the first step. It is required to have the getter for .location work as well, but that's another story. The second step is to map .location to .location.href in nsWindowSH::SetProperty() if (str == sLocation_id) { // Setting the location property JSString *val = ::JS_ValueToString(cx, *vp); NS_ENSURE_TRUE(val, NS_ERROR_UNEXPECTED); // Convert the value assigned to location (i.e. the url) to a JSString. nsCOMPtr<nsISupports> native; wrapper->GetNative(getter_AddRefs(native)); // Get the pointer to the content object that was wrapped. nsCOMPtr<nsIDOMWindow> window(do_QueryInterface(native)); NS_ENSURE_TRUE(window, NS_ERROR_UNEXPECTED); // ...
Exact Stack Rooting
Z_STACK_CLASS. Returning a js::HandleT from a function. If you do this, a handle may outlive its root. Definitions GC - Acronym for Garbage Collection: specifically SpiderMonkey's method of automatically managing JavaScript program memory. GCThing - Storage allocated by SpiderMonkey's allocator. GCPointer - A raw pointer type or tagged pointer type that may refer to a GCThing (JSObject *, JSString *, Value, jsid, etc.) GCHeap - The graph of GCThings allocated by SpiderMonkey's allocator. The goal of SpiderMonkey's GC is to partition this heap into regions reachable from the RootSet and not. Root - A GCPointer held live because it is a member of the RootSet. RootSet - This is a set of GCPointers that are de-facto alive, regardless of the GCThing's reachability. GCPointers must be explicitl...
JS::Value
The different representations are visible using the sepa...
JS_ASSERT_STRING_IS_FLAT
This article covers features introduced in SpiderMonkey 1.8.5 Assert a string is flattened. Syntax static MOZ_ALWAYS_INLINE JSFlatString * JS_ASSERT_STRING_IS_FLAT(JSString *str) { MOZ_ASSERT(JS_StringIsFlat(str)); return (JSFlatString *)str; } Name Type Description str JSString * String to examine. Description JS_ASSERT_STRING_IS_FLAT asserts the string is flattened, and returns a pointer to JSFlatString. See Also MXR ID Search for JS_ASSERT_STRING_IS_FLAT JS_StringIsFlat bug 609440 ...
JS_AddExternalStringFinalizer
ax int JS_AddExternalStringFinalizer(JSStringFinalizeOp finalizer); Name Type Description finalizer JSStringFinalizeOp Pointer to a callback function, described below. The JS engine will automatically call this function each time a string created by JS_NewExternalString is garbage-collected. Callback syntax typedef void (*JSStringFinalizeOp)(JSContext *cx, JSString *str); Name Type Description cx JSContext * Pointer to a JSContext which the finalizer may use for certain very limited operations (not documented). Since the JSStringFinalizeOp callback is called during garbage collection, it must avoid most JSAPI functions. (Is cx guaranteed to be non-NULL?) str JSString * The string being finalized. This is always a...
JS_CompareStrings
result int32_t * The out parameter. See description for value of *result. Description JS_CompareStrings compares two JS strings, str1 and str2. If the strings are identical in content and length, JS_CompareStrings stores 0 in *result. If str1 is less than str2, *result is less than 0. If str1 is greater than str2, *result is greater than 0. ...
JS_ConcatStrings
left JS::HandleString First string to concatenate. right JS::HandleString Second string to concatenate. Description JS_ConcatStrings concatenates two JS strings, str1 and str2, and returns the result. The result could be the same as one of the input strings, if the other string is zero length. When the string concatenation fails NULL is returned. ...
JS_ConvertArguments
This conversion is dangerous and almost entirely useless, because the resulting JSFunction is not a real...
JS_DecompileFunction
Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. fun JS::Handle&lt;JSFunction*&gt; Function to decompile. Description JS_DecompileFunction generates the complete source code of a function declaration from a function's compiled form, fun. If successful, JS_DecompileFunction returns a string containing the text of the function. ...
JS_DecompileFunctionBody
Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. fun JS::Handle&lt;JSFunction*&gt; The function to decompile. indent unsigned If it's not JS_DONT_PRETTY_PRINT, JS_DecompileFunction returns pretty printed source code of the function. ...
JS_DecompileScript
Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. script JS::Handle<JSScript*> Script or function to decompile. 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. If the script is not cached, it tries to load the source from file, and returns nullptr if an error happened while loading. ...
JS_DecompileScriptObject
Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. ...
JS_DumpNamedRoots
lication. When JS_DumpNamedRoots calls it, it passes three arguments: Argument Type Description name const char * The name of the named root. rp void * A pointer to the rooted variable, array element, or field. This is the pointer that the application passed to JS_AddNamedRoot. It points to a variable, array element, or field of type jsval, JSObject *, JSString *, or jsdouble *. data void * The data argument that the application passed to JS_DumpNamedRoots. Example static void dumpRoot(const char *name, void *addr, void *data) { /* The application may use `data` for anything. In this example, we use it to pass the desired output file. */ FILE *f = (FILE *) data; fprintf(f, "There is a root named '%s' at %p\n", nam...
JS_EncodeString
This article covers features introduced in SpiderMonkey 1.8 Convert a JavaScript string to a C string. Syntax char * JS_EncodeString(JSContext *cx, JSString *str); char * JS_EncodeStringToUTF8(JSContext *cx, JS::HandleString str); // Added in SpiderMonkey 24 Name Type Description cx JSContext * A context. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext.. str JSString * / JS::HandleString A string to encode. Description JS_EncodeString and JS_EncodeStringToUTF8 convert the specified JavaScript str to a C string (an array of 8-bit chars). If JS_CStringsAreUTF8 is true, then the returned string of JS_EncodeString is UTF-8, and the conversion is lossless. Otherwise the high byte is simply d...
JS_FORGET_STRING_FLATNESS
This article covers features introduced in SpiderMonkey 1.8.5 Convert JSFlatString to JSString. Syntax static MOZ_ALWAYS_INLINE JSString * JS_FORGET_STRING_FLATNESS(JSFlatString *fstr) { return (JSString *)fstr; } Name Type Description fstr JSFlatString * A string to convert Description JS_FORGET_STRING_FLATNESS converts JSFlatString * to JSString *. See Also MXR ID Search for JS_FORGET_STRING_FLATNESS JSFlatString JSString bug 609440 ...
JS_GetEmptyString
This article covers features introduced in SpiderMonkey 1.8.5 Returns the empty string as a JSString object. Syntax JSString * JS_GetEmptyString(JSRuntime *rt); Name Type Description rt JSRuntime * The runtime for which to return the empty string. Description The returned empty string has the length 0. See Also MXR ID Search for JS_GetEmptyString JS_GetStringLength JS_GetEmptyStringValue bug 612150 ...
JS_GetExternalStringClosure
solete since JSAPI 13This 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. This article covers features introduced in SpiderMonkey 6 Returns the string closure stored in a JSString created by calling JS_NewExternalStringWithClosure. Syntax void * JS_GetExternalStringClosure(JSContext *cx, JSString *str); Name Type Description cx JSContext * The context from which to retrieve the closure for a string. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. str JSString * The string for which to return the closure. The result is NULL if the external string was created without one (that is, by calling JS_NewExt...
JS_GetExternalStringFinalizer
This article covers features introduced in SpiderMonkey 17 Get the string finalizer of an external string. Syntax const JSStringFinalizer * JS_GetExternalStringFinalizer(JSString *str); Name Type Description str JSString * A string to get finalizer. Description JS_GetExternalStringFinalizer returns the fin parameter passed to JS_NewExternalString. See Also MXR ID Search for JS_ JS_NewExternalString bug 724810 ...
JS_GetFunctionId
Description JS_GetFunctionId returns the name of a function, fun, as a JSString, or NULL if fun is unnamed. The returned string lives as long as fun, so you don't need to root a saved reference to it if fun is well-connected or rooted, and provided you bound the use of the saved reference by fun's lifetime. JS_GetFunctionDisplayId returns the display name of a function, fun. ...
JS_GetInternedStringChars
Obsolete since JSAPI 33This 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. This article covers features introduced in SpiderMonkey 1.8.5 Get the chars of an interned string. Syntax const jschar * JS_GetInternedStringChars(JSString *str); const jschar * JS_GetInternedStringCharsAndLength(JSString *str, size_t *length); Name Type Description str JSString * The interned string. length size_t * Out parameter. Receives the length of the string. Description JS_GetInternedStringChars returns a pointer to the interned string. JS_GetInternedStringCharsAndLength returns a pointer to the interned string and stores the length of it to ...
JS_GetLatin1InternedStringChars
This article covers features introduced in SpiderMonkey 38 Get the chars of an interned string. Syntax const JS::Latin1Char * JS_GetLatin1InternedStringChars(const JS::AutoCheckCannotGC &nogc, JSString *str); const char16_t * JS_GetTwoByteInternedStringChars(const JS::AutoCheckCannotGC &nogc, JSString *str); Name Type Description cx JSContext * A context. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext.. nogc JS::AutoCheckCannotGC &amp; A reference to JS::AutoCheckCannotGC. str JSString * A string to get characters. Description JS_GetLatin1InternedStringChars and JS_GetTwoByteInternedStringChars gets the char...
JS_GetLatin1StringCharsAndLength
This article covers features introduced in SpiderMonkey 38 Get the chars and the length of a string. Syntax const JS::Latin1Char * JS_GetLatin1StringCharsAndLength(JSContext *cx, const JS::AutoCheckCannotGC &nogc, JSString *str, size_t *length); const char16_t * JS_GetTwoByteStringCharsAndLength(JSContext *cx, const JS::AutoCheckCannotGC &nogc, JSString *str, size_t *length); Name Type Description cx JSContext * A context. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext.. nogc JS::AutoCheckCannotGC &amp; A reference to JS::AutoCheckCannotGC. str JSString * A string to get characters. length size_t * ...
JS_GetRegExpSource
obj JS::HandleObject The object to get the source string. Description JS_GetRegExpSource returns a source string of the specified object, obj. If successful, JS_GetRegExpSource returns a pointer to the source string, otherwise returns NULL. ...
JS_GetStringBytes
Obsolete since JSAPI 1.8.5This 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. Convert a JavaScript string to a C string. Syntax char * JS_GetStringBytes(JSString *str); const char * JS_GetStringBytesZ(JSContext *cx, JSString *str); // Added in JSAPI 1.8.2 Name Type Description cx JSContext * (JS_GetStringBytesZ and JS_EncodeString only) A context. str JSString * String to retrieve bytes from. Description JS_GetStringBytes and JS_GetStringBytesZ convert the specified JavaScript string, str, to a C string (an array of 8-bit chars). If JS_CStringsAreUTF8 is true, then the returned string is UTF-8, and the conversion is lossless. Otherwise the ...
JS_GetStringCharAt
This article covers features introduced in SpiderMonkey 38 Return a specified character from a string. Syntax bool JS_GetStringCharAt(JSContext *cx, JSString *str, size_t index, char16_t *res); char16_t JS_GetFlatStringCharAt(JSFlatString *str, size_t index); Name Type Description cx JSContext * The context in which to create the new string. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. str JSString * or JSFlatString * The string to get character. index size_t An integer between 0 and 1-less-than the length of the string. res char16_t * (JS_GetStringCharAt only) Out parameter. On successful, receives the character code. Description JS_GetStringCharAt and ...
JS_GetStringChars
Obsolete since JSAPI 33This 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. Retrieve a pointer to the 16-bit values that make up a given string. Syntax jschar * JS_GetStringChars(JSString *str); // Obsolete since JSAPI 1.8.5 const jschar * JS_GetStringCharsZ(JSContext *cx, JSString *str); // Added in SpiderMonkey 1.8.2, Obsolete since JSAPI 33 Name Type Description cx JSContext * (in JS_GetStringCharsZ only) A context. str JSString * The string to obtain characters from. Description JS_GetStringChars Obsolete since JavaScript 1.8.5 returns a pointer to the first element of an array of jschars. Warnings: The array is not necessar...
JS_GetStringCharsAndLength
Obsolete since JSAPI 33This 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. This article covers features introduced in SpiderMonkey 1.8.5 Get the characters and the length of a string. Syntax const jschar * JS_GetStringCharsAndLength(JSContext *cx, JSString *str, size_t *length); Name Type Description cx JSContext * The context. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. str JSString * A string to get characters. length size_t * Out parameter. Receives the length of the string. Description JS_GetStringCharsAndLength gets the characters and the length of the string, str...
JS_GetStringLength
Description JS_GetStringLength reports the length, in 16-bit code units, of the string str. This is the same as the length property of the string. This is the same as the length of the array returned by JS_GetStringChars, in char16_ts (not bytes). Because some Unicode characters are represented using two 16-bit code units, the result is not necessarily the same as the number of Unicode characters in the string. ...
JS_InternJSString
This article covers features introduced in SpiderMonkey 1.8.5 Make a string to interned string. Syntax JSString * JS_InternJSString(JSContext *cx, JS::HandleString str); Name Type Description cx JSContext * The context. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. str JS::HandleString A string to be interned. Description JS_InternJSString converts a string str to interned string (interned atom) and returns the result string as JSString *. On failure, JS_InternJSString returns nullptr. See Also MXR ID Search for JS_InternJSString bug 609440 ...
JS_IsExternalString
This article covers features introduced in SpiderMonkey 17 Determines whether or not the specified JSString is an external string (that is, a string created by calling JS_NewExternalString rather than JS_NewExternalStringWithClosure). Syntax bool JS_IsExternalString(JSString *str); Name Type Description str JSString * The string to check. Description JS_IsExternalString returns true if the string is an external string; otherwise it's false. See Also MXR ID Search for JS_IsExternalString bug 651041 ...
JS_NewDependentString
Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. str JS::HandleString The string containing the characters for the new string. start size_t The start index of the substring. length size_t Length of the substring, in characters. ...
JS_NewUCString
Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. buf char * or char16_t * Pointer to a character array, allocated with JS_malloc, containing the characters for the JS string to create. ...
JS_NewStringCopyN
Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. s const char* or const char16_t * Pointer to the array of characters containing the text for the JS string to create. n size_t Number of characters to copy from s into the new string. ...
JS_NewStringCopyZ
Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. s const char * or const char16_t * Pointer to the character array containing the text for the JS string to create; or NULL. ...
JS_PushArguments
Any asterisks (*) in format are ignored. This function also takes in consideration any additional custom types defined in cx using JS_AddArgumentFormatter. For example, if format is "bIob", then there must be four arguments after format. Their type...
JS_PutEscapedString
This article covers features introduced in SpiderMonkey 1.8.5 Write a string into buffer with escaping. Syntax size_t JS_PutEscapedString(JSContext *cx, char *buffer, size_t size, JSString *str, char quote); size_t JS_PutEscapedFlatString(char *buffer, size_t size, JSFlatString *str, char quote); Name Type Description cx JSContext * A context. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. buffer char * A pointer to char buffer to write into. size size_t The size of buffer in bytes. str JSString * or JSFlatString * A string to write into the file. quote char One of 0, single quote, and double quote. ...
JS_StringEqualsAscii
Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. str JSFlatString * String to compare. asciiBytes const char * ASCII string to compare with. ...
JS_StringHasBeenInterned
This article covers features introduced in SpiderMonkey 17 Determine if string is interned. Syntax bool JS_StringHasBeenInterned(JSContext *cx, JSString *str); Name Type Description str JSString * A string to examine. Description JS_StringHasBeenInterned returns true if the string str is interned. See Also MXR ID Search for JS_StringHasBeenInterned bug 724810 ...
JS_StringHasLatin1Chars
Description JS_StringHasLatin1Chars returns true iff the string's characters are stored as Latin1. String characters are stored as either Latin1Char (8-bit) or char16_t (16-bit). Clients can use JS_StringHasLatin1Chars and can then call either the Latin1* or TwoByte* functions. ...
JS_StringIsFlat
This article covers features introduced in SpiderMonkey 38 Determine if a string is flattened. Syntax bool JS_StringIsFlat(JSString *str); Name Type Description str JSString * String to examine. Description JS_StringIsFlat returns true if the string is flattened. See Also MXR ID Search for JS_StringIsFlat bug 1037869 ...
JS_ValueToSource
Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. v JS::Handle&lt;JS::Value&gt; The value to convert. Description JS_ValueToSource converts a specified JavaScript value, v, to a JavaScript source. On success, JS_ValueToSource returns a pointer to a string. On error or exception, it returns NULL. ...
JS_ValueToString
Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. v jsval The value to convert. ...
STRING_TO_JSVAL
Obsolete since JSAPI 42This 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. Casts a specified JS string to a JS value. Please use JS::StringValue instead in SpiderMonkey 45 or later. Syntax jsval STRING_TO_JSVAL(JSString *str) Name Type Description obj JSString * A pointer to a JS string to convert to a jsval. Description STRING_TO_JSVAL casts a given JSString * to jsval. str must be a non-null pointer of type JSString *. The conversion always succeeds. See Also MXR ID Search for STRING_TO_JSVAL JS::StringValue bug 1177892 -- removed ...