Search completed in 1.16 seconds.
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...
...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 high byte is simply dropped from each jschar. On success, the return value is a pointer to the char array, which is null-terminated. On failure, JS_
GetStringBytes returns a pointer to a null-terminated empty string; JS_
GetStringBytesZ returns NULL. Note: JS_
GetStringBytes() and JS_
GetStringBytesZ() have both been removed as of JavaScript 1.8.5 (Firefox 4). Instead, you should use JS_EncodeString, JS_
GetStringEncodingLength, JS_EncodeStringToBuffer. ...
...pointer to the char array, which is null-terminated. On failure, JS_
GetStringBytes returns a pointer to a null-terminated empty string; JS_
GetStringBytesZ returns NULL. Note: JS_
GetStringBytes() and JS_
GetStringBytesZ() have both been removed as of JavaScript 1.8.5 (Firefox 4). Instead, you should use JS_EncodeString, JS_
GetStringEncodingLength, JS_EncodeStringToBuffer. The array returned by JS_
GetStringBytes or JS_
GetStringBytesZ is automatically freed when str is finalized by the JavaScript garbage collection mechanism. The application must not modify the contents of the array. Note that for non-ASCII strings, if JS_CStringsAreUTF8 is false, these functions can return a corrupted copy of the contents of the string. ...
...And 3 more matches
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 necessa...
... The program must not modify the array. If it does, the behavior is undefined. The content of a JS string is not guaranteed to be valid UTF-16. It may contain surrogate code units that aren't properly paired. It may also contain zeroes. The array returned by this function remains valid as long as str is valid. ...
...the array. If it does, the behavior is undefined. The content of a JS string is not guaranteed to be valid UTF-16. It may contain surrogate code units that aren't properly paired. It may also contain zeroes. ...
...And 2 more matches
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. ...
...me 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_GetFlatStringCharAt get the specified character from the string str. On successful, JS_
GetStringCharAt returns true and stores the character code into *res, otherwise returns false. JS_GetFlatStringCharAt always succeeds, and returns the character code. index should not be great...
... Description JS_
GetStringCharAt and JS_GetFlatStringCharAt get the specified character from the string str. On successful, JS_
GetStringCharAt returns true and stores the character code into *res, otherwise returns false. JS_GetFlatStringCharAt always succeeds, and returns the character code. index should not be greater than or equal to the length of str. ...
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. ...
...ngCharsAndLength(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. ...
...ption 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. ...
JS_GetStringLength
Return the length, in 16-bit code units, of a JavaScript string. Syntax size_t JS_
GetStringLength(JSString *str); Name Type Description str JSString * The string to examine. 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. ...
...gth, 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. ...
... 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. ...
getString - Archive of obsolete content
getString Retrieves a value from a .ini file. Method of WinProfile object Syntax String
getString ( String section, String key); Parameters The method has the following parameters: section Section in the file, such as "boot" or "drivers". key The key in that section whose value to return. Returns The value of the key or an empty string if none was found. Description The
getString method is similar to the Windows API function getPrivateProfileString. Unlike that function, this method does not support using a null key to return a list of keys in a section. ...
...s found. Description The
getString method is similar to the Windows API function getPrivateProfileString. Unlike that function, this method does not support using a null key to return a list of keys in a section. ...
NPN_GetStringIdentifiers - Archive of obsolete content
<< Gecko Plugin API Reference << Scripting plugins Summary Returns an array of opaque identifiers for the names that are passed in. Syntax #include <npruntime.h> void NPN_
GetStringIdentifiers(const NPUTF8 **names, int32_t nameCount, NPIdentifier *identifiers); Parameters The function has the following parameters: names An array of strings for which opaque identifiers should be returned. nameCount The number of strings in the names array. identifiers A pointer to the first element of an array to fill with the identifiers for the strings specified by names. ...
...s An array of strings for which opaque identifiers should be returned. nameCount The number of strings in the names array. identifiers A pointer to the first element of an array to fill with the identifiers for the strings specified by names. Returns On return, the identifiers array is filled out with the identifiers for each of the strings in the names array. Description As is the case with NPN_
GetStringIdentifier(), all calls for the same strings are guaranteed to return the same exact identifiers. ...
JS_GetStringEncodingLength
This article covers features introduced in SpiderMonkey 1.8.5 Get the length of a JavaScript string in bytes. Syntax size_t JS_
GetStringEncodingLength(JSContext *cx, 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.. str JSString * A string to encode. Description JS_
GetStringEncodingLength returns the length of the specified string in bytes, regardless of its encoding. You can use this value to create a buffer to encode the string into using the JS_EncodeStringToBuffer function. ...
...g * A string to encode. Description JS_
GetStringEncodingLength returns the length of the specified string in bytes, regardless of its encoding. You can use this value to create a buffer to encode the string into using the JS_EncodeStringToBuffer function. To encode to UTF8, use JS::GetDeflatedUTF8StringLength and JS::DeflateStringToUTF8Buffer instead. ...
NPN_GetStringIdentifier - Archive of obsolete content
<< Gecko Plugin API Reference << Scripting plugins Summary Returns an opaque identifier for the string that is passed in. Syntax #include <npruntime.h> NPIdentifier NPN_
GetStringIdentifier(const NPUTF8 *name); Parameters The function has the following parameters: <tt>name</tt> The string for which an opaque identifier should be returned. Returns An NPIdentifier identifying the string. Description All calls for the same string are guaranteed to return the same exact identifier. ...
CSSPrimitiveValue.getStringValue() - Web APIs
The
getStringValue() method of the CSSPrimitiveValue interface is used to get a string value. If this CSS value doesn't contain a string value, a DOMException is raised. Syntax var stringValue = cssPrimitiveValue.
getStringValue(); Return value A string value. Exceptions Type Description DOMException An INVALID_ACCESS_ERR is raised if the CSS value doesn't contain a string value. Example var cs = window.getComputedStyle(document.body); var cssValue = cs.getPropertyCSSValue("display"); console.log(cssValue.
getStringValue()); Specifications Specification Status Comment Document Object Model (DOM) Level 2 Style SpecificationThe definition of 'CSSPrimitiveValue.
getStringValue' in that specification. Obsolete Initial definition ...
nsIAccessibleRetrieval
Create a new accessible of the appro...
...Create a new accessible of the appropriate type if necessary, or use one from the accessibility cache i...
...Create a new accessible of the appropriate type if necessary, or use one from the accessibility cache if it already exists. nsIAccessible getAccessibleFor( in nsIDOMNode aNod...
...And 5 more matches
Index
LSE. (At the moment, JS_AddArgumentFormatter fails only if there is no memory available to record the registration.) 186 JS_AddExternalStringFinalizer JSAPI Reference, Obsolete, SpiderMonkey Add a finalizer for external strings created by JS_NewExternalString using a type-code returned from this function, and that understands how to free or release the memory pointed at by JS_
GetStringChars(str). 187 JS_AddFinalizeCallback JSAPI Reference, Reference, Reference(2), SpiderMonkey JS_AddFinalizeCallback add a callback function which the garbage collector calls at several points during garbage collection. rt is the runtime in which you specify the callback. cb is a pointer to the callback function to add. 188 JS_AliasElement JSAPI Reference, Obsol...
... the given context, cx. 338 JS_GetSecurityCallbacks JSAPI Reference, SpiderMonkey JS_SetSecurityCallbacks sets the runtime's security callbacks to callbacks. It allows the embedding to control certain aspects of JS code execution based on security settings of the global object the code is executed in. If callbacks is NULL, it sets callbacks to default value. 339 JS_
GetStringBytes JSAPI Reference, Obsolete, SpiderMonkey 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 high byte is simply dropped from each jschar. On success, the return value is a pointer to the char arra...
...onkey 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 high byte is simply dropped from each jschar. On success, the return value is a pointer to the char array, which is null-terminated. On failure, JS_
GetStringBytes returns a pointer to a null-terminated empty string; JS_
GetStringBytesZ returns NULL. 340 JS_
GetStringCharAt JSAPI Reference, Reference, Reference(2), SpiderMonkey JS_
GetStringCharAt and JS_GetFlatStringCharAt get the specified character from the string str. ...
...And 3 more matches
The Essentials of an Extension - Archive of obsolete content
ncomfortable at first, but it's worth the cost. We use Javadoc style comments on all namespaces, objects and object members. This is a similar standard to the one used in Mozilla code, and some tools can generate documentation automatically from Javadoc. sayHello : function(aEvent) { let stringBundle = document.getElementById("xulschoolhello-string-bundle"); let message = stringBundle.
getString("xulschoolhello.greeting.label"); window.alert(message); } And, finally, this is our function declaration. Three lines of code are all we need for it to work. The first line in the body of the function declares a variable that will hold the stringbundle element defined in the overlay. The variable is declared using let, which is similar to var but with more restricted scope. Here you can re...
...ead more about let declarations. Just like in regular JS, we can use the DOM (Document Object Model) in order to manipulate the XUL document. First we get a reference of the stringbundle element in the document. This is a special element that allows us to obtain localized strings dynamically, by only providing a "key" that identifies the string. This is what we do on the second line. We call the
getString method of the bundle element and get the localized message to be displayed. We then call the window.alert function with the message, just like we would do in an HTML document. Locale There are two types of locale files: DTD and properties, and in this example we use them both. DTD is the most efficient way of showing text in XUL, so you should use it whenever possible. It is somewhat inflexible...
... key, you have to set the new value directly: let helloItem = document.getElementById("xulschoolhello-hello-menu-item"); // The alert will say "Hello World!" alert(helloItem.getAttribute("label")); // Wrong helloItem.setAttribute("label", "&xulschoolhello.hello2.label;"); // Better helloItem.setAttribute("label", "Alternate message"); // Right! ...
...property and another "words matching..." property. This is not a good idea. It greatly complicates the work of localizers, and grammar rules on different languages may change the ordering of the sentence entirely. For this reason it's better to use parameters in the properties: xulschoolhello.search.label = Found %S words matching the search query! Then you use getFormattedString instead of
getString in order to get the localized string. Thanks to this we don't need to have multiple properties, and life is easier for translators. You can read more about it on the Text Formatting section of the XUL Tutorial. Also have a look at the Plurals and Localization article, that covers a localization feature in Firefox that allows you to further refine this last example to handle different types of plu...
SpiderMonkey 1.8.5
he setter to ignore the value of the argument. The rooting APIs (JS_AddRoot, JS_RemoveRoot, etc.) have been replaced with a family of type-safe functions (JS_AddStringRoot, JS_RemoveStringRoot, etc.) that are easier to use correctly. JS_NewDouble, JS_NewDoubleValue, and JS_NewNumberValue are gone. Instead use DOUBLE_TO_JSVAL, INT_TO_JSVAL, and UINT_TO_JSVAL, which are faster and can't fail. JS_
GetStringBytes and JS_
GetStringChars are gone. There is no longer an infallible way to examine string characters. Applications must use JS_
GetStringCharsAndLength or JS_EncodeString/JS_free and check for errors. These and other changes are explained in detail below. New JavaScript language features JavaScript 1.8.5 adds support for ECMAScript Edition 5, including ES5 strict mode. For details, see New in J...
...ptyString JS_GetFlatStringChars JS_GetGCParameter JS_GetGCParameterForThread JS_GetGlobalForScopeChain JS_GetInternedStringChars JS_GetInternedStringCharsAndLength JS_GetOwnPropertyDescriptor JS_GetPropertyAttrsGetterAndSetterById JS_GetPropertyById JS_GetPropertyByIdDefault JS_GetPropertyDefault JS_GetPropertyDescriptorById JS_GetRuntimeSecurityCallbacks JS_GetSecurityCallbacks JS_
GetStringCharsAndLength JS_
GetStringCharsZ JS_
GetStringCharsZAndLength JS_
GetStringEncodingLength JS_HasPropertyById JS_InitCTypesClass JS_InternJSString JS_IsConstructing_PossiblyWithGivenThisObject JS_IsExtensible JS_IsInRequest JS_LeaveCrossCompartmentCall JS_LookupPropertyById JS_LookupPropertyWithFlagsById JS_New JS_NewCompartmentAndGlobalObject JS_NewDateObject JS_NewDateObjectMsec J...
...t JS_NewGrowableString Deleted APIs JS_AddNamedRoot - use JS_Add*Root JS_AddNamedRootRT - use JS_Add*Root JS_AddRoot - use JS_Add*Root JS_ClearNewbornRoots - no longer needed JS_ClearOperationCallback JS_ClearRegExpRoots JS_DecompileScript JS_DestroyScript JS_EnterLocalRootScope JS_ExecuteScriptPart JS_ForgetLocalRoot JS_GetFunctionName JS_GetOperationLimit JS_GetScriptObject JS_
GetStringBytes JS_
GetStringChars JS_IsAssigning JS_LeaveLocalRootScope JS_LeaveLocalRootScopeWithResult JS_NewDouble JS_NewDoubleValue JS_NewScriptObject JS_NewString JS_PopArguments JS_PushArguments JS_PushArgumentsVA JS_RemoveRoot JS_RemoveRootRT JS_SealObject JS_SetBranchCallback JS_SetCallReturnValue2 JS_SetCheckObjectAccessCallback JS_SetObjectPrincipalsFinder JS_SetOperationLimit ...
...tructors with and without the new keyword, now takes a pointer to the native's vp, along with the native's context pointer, to figure out how the function was called. Strings JS_CompareStrings received a new function signature with bug 609440, allowing us to correctly propagate exceptions when the underlying functions to retrieve the characters in the string failed. Additionally, JS_NewString, JS_
GetStringBytes, and JS_
GetStringChars were removed, replaced by fallible interfaces like JS_
GetStringCharsZAndLength and JS_EncodeStringToBuffer (not an exhaustive list). Numbers SpiderMonkey 1.8.5 now stores integers up to 32-bits in the jsval. This means that the INT_FITS_IN_JSVAL macro is always returns true (be careful to only use this macro with jsints, not 64-bit integers). The jsval now also stores...
nsIINIParser
erits from: nsISupports Last changed in Gecko 1.8 (Firefox 1.5 / Thunderbird 1.5 / SeaMonkey 1.0) Typically, you'll create an nsIINIParser object by calling nsIINIParserFactory.createINIParser(). Also, if you need to write to an INI file, use nsIINIParserWriter. nsIUTF8StringEnumerator getKeys(in AUTF8String aSection); nsIUTF8StringEnumerator getSections(); AUTF8String
getString(in AUTF8String aSection, in AUTF8String aKey); Methods getKeys() Returns an nsIUTF8StringEnumerator providing the keys available within the specified section of the INI file. nsIUTF8StringEnumerator getKeys( in AUTF8String aSection ); Parameters aSection The name of the section whose keys you wish to enumerate. Return value An nsIUTF8StringEnumerator object that can be used to ...
...se keys you wish to enumerate. Return value An nsIUTF8StringEnumerator object that can be used to access the section's keys. getSections() Returns an nsIUTF8StringEnumerator providing a list of the sections available within the INI file. nsIUTF8StringEnumerator getSections(); Parameters None. Return value An nsIUTF8StringEnumerator object that can be used to access the sections in the INI file.
getString() Returns the string value for the specified key within a particular section of the INI file. AUTF8String
getString( in AUTF8String aSection, in AUTF8String aKey ); Parameters aSection The section containing the key whose value is to be returned. aKey The key for which the value should be returned. Return value The string value of the specified key. Examples Getting a value...
...that * section (until the next section). * @param {String} prop * The name of the property to get. */ function getIniValue (iniFile, section, prop) { var iniFact = Components.manager.getClassObjectByContractID( "@mozilla.org/xpcom/ini-parser-factory;1", Components.interfaces.nsIINIParserFactory ); var iniParser = iniFact.createINIParser(iniFile); try { return iniParser.
getString(section,prop); } catch(e) { return undefined; } } // Usage: var lang = getIniValue(file,"Setting","Language"); Enumerating sections This example gets a list of all the sections in the INI file. // get all sections in the ini file var sectEnum = iniParser.getSections(); // save the sections in an array var sections = []; while (sectEnum && sectEnum.hasMore()) { var section = sectEnum...
... keys This example shows how to fetch the values for all the keys in the section named "Setting". ...
nsIMsgDBHdr
to set msgHdr.folder.msgDatabase = null after performing this kind of operations to prevent leaking. Don't even think about using OrFlags and/or AndFlags. ...
...g propertyVal); void markRead(in boolean read); void markFlagged(in boolean flagged); void markHasAttachments(in boolean hasAttachments); void setPriorityString(in string priority); unsigned long OrFlags(in unsigned long flags); unsigned long AndFlags(in unsigned long flags); void setReferences(in string references); ACString
getStringReference(in long refNum); void setRecipientsArray(in string names, in string addresses,in unsigned long numAddresses); void setCCListArray(in string names, in string addresses,in unsigned long numAddresses); void setBCCListArray(in string names, in string addresses,in unsigned long numAddresses);New in Thunderbird 3.1 [noscript] void getAuthorCollationKey(out o...
...in string propertyName, in AString propertyStr); Parameters propertyName The name of the property to set. propertyStr The value of the property. setStringProperty() void setStringProperty(in string propertyName, in string propertyValue); Parameters propertyName The name of the property to set. propertyValue The value of the property.
getStringProperty() string
getStringProperty(in string propertyName); Parameters propertyName The name of the property to retrieve. Return Value The value of the property. getUint32Property() Get an integer property. Usually you would use this to store your own properties. unsigned long getUint32Property(in string propertyName); Parameters propertyName The name of the property to retri...
... unsigned long flags); Parameters flags Flags to be added to the current message flags. AndFlags() unsigned long AndFlags(in unsigned long flags); Parameters flags Flags to be retained on the current message flags. All other flags are cleared. setReferences() void setReferences(in string references); Parameters references Sets the list of references for a news message.
getStringReference() Returns one of the references in the list of references. ACString
getStringReference(in long refNum); Parameters refNum The index of the reference to return. Must be less than the total number of references. setRecipientsArray() Uses the header parser to recreate the recipients header from an array of names and addresses. void setRecipientsArray(in string names, ...
CSSPrimitiveValue - Web APIs
text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Properties Inherits properties from its parent, CSSValue. CSSPrimitiveValue.primitiveType Read only An unsigned short representing the type of the value. Possible values are: Constant Description CSS_ATTR The value is an attr() function. The value can be obtained by using the
getStringValue() method. CSS_CM The value is a <length> in centimeters. The value can be obtained by using the getFloatValue() method. CSS_COUNTER The value is a counter or counters function. The value can be obtained by using the getCounterValue() method. CSS_DEG The value is an <angle> in degrees. The value can be obtained by using the getFloatValue() metho...
... The value can be obtained by using the getFloatValue() method. CSS_GRAD The value is an <angle> in grads. The value can be obtained by using the getFloatValue() method. CSS_HZ The value is a <frequency> in Hertz. The value can be obtained by using the getFloatValue method. CSS_IDENT The value is an identifier. The value can be obtained by using the
getStringValue() method. CSS_IN The value is a <length> in inches. The value can be obtained by using the getFloatValue() method. CSS_KHZ The value is a <frequency> in Kilohertz. The value can be obtained by using the getFloatValue() method. CSS_MM The value is a <length> in millimeters. The value can be obtained by using the getFloatValue() method. ...
...nction. The value can be obtained by using the getRectValue() method. CSS_RGBCOLOR The value is an <color>. The value can be obtained by using the getRGBColorValue() method. CSS_S The value is a <time> in seconds. The value can be obtained by using the getFloatValue() method. CSS_STRING The value is a <string>. The value can be obtained by using the
getStringValue() method. CSS_UNKNOWN The value is not a recognized CSS2 value. The value can only be obtained by using the cssText attribute. CSS_URI The value is a <uri>. The value can be obtained by using the
getStringValue() method. Methods CSSPrimitiveValue.getCounterValue() This method is used to get the counter value. If this CSS value doesn't contain ...
...RGB color value, a DOMException is raised. Modification to the corresponding style property can be achieved using the RGBColor interface. CSSPrimitiveValue.getRectValue() This method is used to get the Rect value. If this CSS value doesn't contain a rect value, a DOMException is raised. Modification to the corresponding style property can be achieved using the Rect interface. CSSPrimitiveValue.
getStringValue() This method is used to get the string value. If the CSS value doesn't contain a string value, a DOMException is raised. CSSPrimitiveValue.setFloatValue() A method to set the float value with a specified unit. If the property attached with this value can not accept the specified unit or the float value, the value will be unchanged and a DOMException will be raised. CSSPrimitiveValue.set...
Miscellaneous - Archive of obsolete content
attempt number %S. ...
...ents.classes["@mozilla.org/intl/stringbundle;1"] .getService(Components.interfaces.nsIStringBundleService) .createBundle("chrome://myext/locale/myext.properties"), getLocalizedMessage: function(msg) { return this._bundle.
GetStringFromName(msg); } }; alert(common.getLocalizedMessage("invalid.url")) Another similar alternative (using both
GetStringFromName and formatStringFromName), is: var fcBundle = Components.classes["@mozilla.org/intl/stringbundle;1"] .getService(Components.interfaces.nsIStringBundleService) .createBundle("chrome://myext/locale/myext.properties"); function getStr(msg, args){ //get localised message if (args){ args = Array.prototype.slice.call(arguments, 1); return fcBundle.forma...
... var Ci = Components.interfaces; var Cc = Components.classes; //assume you can not get the main window object direct...
Localizing an extension - Archive of obsolete content
strings from the string bundle instead of using literal strings. This involves rewriting the refreshInformation() function to load the strings, and its enclosed infoReceived() function to use the loaded, localized, strings instead of string literals. ...
... This involves rewriting the refreshInformation() function to load the strings, and its enclosed infoReceived() function to use the loaded, localized, strings instead of string literals. We add to refreshInformation() the following code: var stringsBundle = document.getElementById("string-bundle"); var changeString = stringsBundle.
getString('changeString') + " "; var openString = stringsBundle.
getString('openString') + " "; var lowString = stringsBundle.
getString('lowString') + " "; var highString = stringsBundle.
getString('highString') + " "; var volumeString = stringsBundle.
getString('volumeString') + " "; This code gets a reference to the string bundle element we added to stockwatcher2.xul by calling document.getElementById(), specifying the ID "string-bundle". Then it fetches all the str...
...In this case, we're also appending a space to the end of each string. That's just how this particular program works, and isn't something that you have to do. ...
Mozilla DOM Hacking Guide
= window->GetLocation(getter_AddRefs(location)); NS_ENSURE_SUCCESS(rv, rv); // Use the DOM to get the Location object of the window object. jsval v; rv = WrapNative(cx, obj, location, NS_GET_IID(nsIDOMLocation), &v); // This XPConnect method creates a wrapper for the Location object on the // Window object. NS_ENSURE_SUCCESS(rv, rv); if (!::JS_DefineUCProperty(cx, obj, ::JS_
GetStringChars(str), ::JS_
GetStringLength(str), v, nsnull, nsnull, 0)) { return NS_ERROR_FAILURE; } // This JS API call defines the "location" 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 get...
..._TRUE(window, NS_ERROR_UNEXPECTED); // QueryInterface to have a nsIDOMWindow pointer to call // GetLocation() on it. nsCOMPtr<nsIDOMLocation> location; nsresult rv = window->GetLocation(getter_AddRefs(location)); NS_ENSURE_SUCCESS(rv, rv); // Get the Location object for this window. ...
...e to have a nsIDOMWindow pointer to call // GetLocation() on it. nsCOMPtr<nsIDOMLocation> location; nsresult rv = window->GetLocation(getter_AddRefs(location)); NS_ENSURE_SUCCESS(rv, rv); // Get the Location object for this window. nsDependentString href(NS_REINTERPRET_CAST(PRUnichar *, ::JS_
GetStringChars(val)), ::JS_
GetStringLength(val)); // Convert the JSString to a string that can be passed to SetHref() rv = location->SetHref(href); NS_ENSURE_SUCCESS(rv, rv); // After this, we effectively mapped .location to .location.href return WrapNative(cx, obj, location, NS_GET_IID(nsIDOMLocation), vp); // Create a wrapper for the location object with vp (the url) as value. } It's that simple. And the possibilities ar...
JS_NewUCString
lloc. On success, the JavaScript engine adopts responsibility for memory management of this region. The application must not read, write, or free the buffer. This allows the JavaScript engine to avoid needless data copying. ...
...he JavaScript engine adopts responsibility for memory management of this region. The application must not read, write, or free the buffer. This allows the JavaScript engine to avoid needless data copying. ...
...e adopts responsibility for memory management of this region. The application must not read, write, or free the buffer. This allows the JavaScript engine to avoid needless data copying. ...
nsIMsgFolder
n dbBatching); boolean isCommandEnabled(in ACString command); boolean matchOrChangeFilterDestination(in nsIMsgFolder folder,in boolean caseInsensitive); boolean confirmFolderDeletionForFilter(in nsIMsgWindow msgWindow); void alertFilterChanged(in nsIMsgWindow msgWindow); void throwAlertMsg(in string msgName, in nsIMsgWindow msgWindow); AString
getStringWithFolderNameFromBundle(in string msgName); void notifyCompactCompleted(); long compareSortKeys(in nsIMsgFolder msgFolder); [noscript] void getSortKey(out octet_ptr key, out unsigned long length); boolean callFilterPlugins(in nsIMsgWindow aMsgWindow); ACString
getStringProperty(in string propertyName); void setStringProperty(in string property...
...FilterDestination(in nsIMsgFolder folder, in boolean caseInsensitive); confirmFolderDeletionForFilter() boolean confirmFolderDeletionForFilter(in nsIMsgWindow msgWindow); alertFilterChanged() void alertFilterChanged(in nsIMsgWindow msgWindow); throwAlertMsg() void throwAlertMsg(in string msgName, in nsIMsgWindow msgWindow);
getStringWithFolderNameFromBundle() AString
getStringWithFolderNameFromBundle(in string msgName); notifyCompactCompleted() void notifyCompactCompleted(); compareSortKeys() long compareSortKeys(in nsIMsgFolder msgFolder); getSortKey() [noscript] void getSortKey(out octet_ptr key, out unsigned long length); callFilterPlugins() boolean callFilterPlugins(in nsIMsgW...
...dle() AString
getStringWithFolderNameFromBundle(in string msgName); notifyCompactCompleted() void notifyCompactCompleted(); compareSortKeys() long compareSortKeys(in nsIMsgFolder msgFolder); getSortKey() [noscript] void getSortKey(out octet_ptr key, out unsigned long length); callFilterPlugins() boolean callFilterPlugins(in nsIMsgWindow aMsgWindow);
getStringProperty() ACString
getStringProperty(in string propertyName); setStringProperty() void setStringProperty(in string propertyName, in ACString propertyValue); isAncestorOf() Determines if this folder is an ancestor of the supplied folder. boolean isAncestorOf(in nsIMsgFolder folder); containsChildNamed() Looks in immediate children of this folder for the given ...
Component; nsIPrefBranch
n, in nsIObserver aObserver, in boolean aHoldWeak); void clearUserPref(in string aPrefName); void deleteBranch(in string aStartingAt); boolean getBoolPref(in string aPrefName, Requires Gecko 54 [optional] in boolean aDefaultValue); string getCharPref(in string aPrefName,Requires Gecko 54 [optional] in string aDefaultValue); Requires Gecko 58 utf8tring
getStringPref(in string aPrefName, [optional] in utf8string aDefaultValue); void getChildList(in string aStartingAt, [optional] out unsigned long aCount, [array, size_is(aCount), retval] out string aChildArray); void getComplexValue(in string aPrefName, in nsIIDRef aType, [iid_is(aType), retval] out nsQIResult aValue); long getIntPref(in string aPrefName,Requires Gecko 54 [option...
... individual string preference. string getCharPref( in string aPrefName, [optional] in string aDefaultValue ); Parameters aPrefName The string preference to retrieve. aDefaultValue Requires Gecko 54 Optional - a default value to use if the preference does not exist (instead of throwing an exception). Return value Returns string - The value of the requested string preference.
getStringPref() Requires Gecko 58 (Firefox 58 / Thunderbird 58 / SeaMonkey 2.55) Called to get the state of an individual UTF-8 string preference. utf8string
getStringPref( in string aPrefName, [optional] in utf8string aDefaultValue ); Parameters aPrefName The string preference to retrieve. aDefaultValue Optional - a default value to use if the preference does not exist (instead of thro...
...teger or string value. void getComplexValue( in string aPrefName, in nsIIDRef aType, [iid_is(aType), retval] out nsQIResult aValue ); Parameters aPrefName The complex preference to get the value of. aType The XPCOM interface that this complex preference represents. Interfaces currently supported are: NsILocalFile NsISupportsString (UniChar) (removed as of Gecko 58 in favor of
getStringPref) NsIPrefLocalizedString (Localized UniChar) NsIFileSpec (deprecated - to be removed eventually) aValue The XPCOM object into which to the complex preference value should be retrieved. getIntPref() Called to get the state of an individual integer preference. long getIntPref( in string aPrefName, [optional] in long aDefaultValue ); Parameters aPrefName The integer prefer...
nsIStringBundle
e created within a javascript context with nsIStringBundleService. Method overview wstring formatStringFromID(in long aID, [array, size_is(length)] in wstring params, in unsigned long length); wstring formatStringFromName(in wstring aName, [array, size_is(length)] in wstring params, in unsigned long length); nsISimpleEnumerator getSimpleEnumeration(); wstring
GetStringFromID(in long aID); wstring
GetStringFromName(in wstring aName); Methods formatStringFromID() Returns a formatted string with the given ID from the string bundle, where each occurrence of %S (uppercase) is replaced by each successive element in the supplied array. You may also use other formatting codes. You can only pass Unicode strings in. The ID should refer to a string in th...
...long length ); Parameters aName The name of the string to retrieve. params Parameters to pass in to the string. length The length of the parameter list. Return value Returns the formatted string. getSimpleEnumeration() nsISimpleEnumerator getSimpleEnumeration(); Parameters None. Return value Returns a nsISimpleEnumerator of all nsIPropertyElement entries in the string bundle. ...
... params Parameters to pass in to the string. length The length of the parameter list. Return value Returns the formatted string. getSimpleEnumeration() nsISimpleEnumerator getSimpleEnumeration(); Parameters None. Return value Returns a nsISimpleEnumerator of all nsIPropertyElement entries in the string bundle.
GetStringFromID() Retrieves a string from the bundle by its ID. wstring
GetStringFromID( in long aID ); Parameters aID The ID of the string to retrieve. String ID's are assigned by the order in which they are stored in the properties file. Return value Returns the requested string.
GetStringFromName() Retrieves a string from the bundle by its name. wstring
GetStringFromName( in wstring aName ); Parameters aName The name of the string to retrieve. String n...
CSSPrimitiveValue.primitiveType - Web APIs
The primitiveType read-only property of the CSSPrimitiveValue interface represents the type of a CSS value. Syntax type = cssPrimitiveValue.primitiveType; Value An unsigned short representing the type of the value. Possible values are: Constant Description CSS_ATTR The value is an attr() function. The value can be obtained by using the
getStringValue() method. CSS_CM The value is a <length> in centimeters. The value can be obtained by using the getFloatValue() method. CSS_COUNTER The value is a counter or counters function. The value can be obtained by using the getCounterValue() method. CSS_DEG The value is an <angle> in degrees. The value can be obtained by using the getFloatValue() method. CSS_DIMENSION The value is a...
...in ex units. The value can be obtained by using the getFloatValue() method. CSS_GRAD The value is an <angle> in grads. The value can be obtained by using the getFloatValue() method. CSS_HZ The value is a <frequency> in Hertz. The value can be obtained by using the getFloatValue method. CSS_IDENT The value is an identifier. The value can be obtained by using the
getStringValue() method. CSS_IN The value is a <length> in inches. The value can be obtained by using the getFloatValue() method. CSS_KHZ The value is a <frequency> in Kilohertz. The value can be obtained by using the getFloatValue() method. CSS_MM The value is a <length> in millimeters. The value can be obtained by using the getFloatValue() method. CSS_MS Th...
... a rect() function. The value can be obtained by using the getRectValue() method. CSS_RGBCOLOR The value is an <color>. The value can be obtained by using the getRGBColorValue() method. CSS_S The value is a <time> in seconds. The value can be obtained by using the getFloatValue() method. CSS_STRING The value is a <string>. The value can be obtained by using the
getStringValue() method. CSS_UNKNOWN The value is not a recognized CSS2 value. The value can only be obtained by using the cssText attribute. CSS_URI The value is a <uri>. The value can be obtained by using the
getStringValue() method. Example var cs = window.getComputedStyle(document.body); var cssValue = cs.getPropertyCSSValue("color"); console.log(cssValue.primitiveType);...
Writing a WebSocket server in C# - Web APIs
irst 3 bytes of a message are available. Alternative solutions should be investigated for production environments. using System.Text; using System.Text.RegularExpressions; while(client.Available < 3) { // wait for enough bytes to be available } Byte[] bytes = new Byte[client.Available]; stream.Read(bytes, 0, bytes.Length); //translate bytes of request to string String data = Encoding.UTF8.
GetString(bytes); if (Regex.IsMatch(data, "^GET")) { } else { } The response is easy to build, but might be a little bit difficult to understand. The full explanation of the Server handshake can be found in RFC 6455, section 4.2.2. For our purposes, we'll just build a simple response. You must: Obtain the value of the "Sec-WebSocket-Key" request header without any leading or trailing whitespace Co...
...Obtain the value of the "Sec-WebSocket-Key" request header without any leading or trailing whitespace // 2. Concatenate it with "258EAFA5-E914-47DA-95CA-C5AB0DC85B11" (a special GUID specified by RFC 64...
...ask) { byte[] decoded = new byte[msglen]; byte[] masks = new byte[4] { bytes[offset], bytes[offset + 1], bytes[offset + 2], bytes[offset + 3] }; offset += 4; for (int i = 0; i < msglen; ++i) decoded[i] = (byte)(bytes[offset + i] ^ masks[i % 4]); string text = Encoding.UTF8.
GetString(decoded); Console.WriteLine("{0}", text); } else Console.WriteLine("mask bit not set"); Console.WriteLine(); } } } } client.html <!doctype html> <style> textarea { vertical-align: bottom; } #output { overflow: auto; } #output > p { overflow-wrap: break-word; } #output span { color: b...
How to convert an overlay extension to restartless - Archive of obsolete content
There is a way that makes constructing of UI a lot similar to the way it was made with XUL overlay. It involves using firebug.sdk. ...
...ter after a '?'. (this random ID is otherwise ignored) The loaded string bundle is still cached on startup and should still be cleared out of the cache on addon shutdown. This just bypasses the built-in cache for repeated loads of the same path so that a newly installed update loads cleanly. */ return Services.strings.createBundle(path + "?" + Math.random()); } Just do strings.
GetStringFromName(stringID) as you normally would. The lazy getter magic will cause the file to be automatically loaded the first time it is needed, after which point a reference to the loaded string bundle will be stored in "strings" for future accesses. You still need to clear the cache on add-on shutdown, however it will now also load cleanly on add-on updates. The old file should still be cleared. Put...
Chapter 5: Let's build a Firefox extension - Archive of obsolete content
Because we've changed the chrome manifest, we need to relaunch Firefox once, as discussed in the part "Operations checks on revised source files". So relaunch Firefox and display the clock window to make sure it is workin...
...Because we've changed the chrome manifest, we need to relaunch Firefox once, as discussed in the part "Operations checks on revised source files". So relaunch Firefox and display the clock window to make sure it is working correctly. Then type about:config into the location bar, and change the value of ge...
User Notifications and Alerts - Archive of obsolete content
t these notifications make the most sense when they are related to the page currently being displayed, such as a page trying to install an add-on, or a site you just entered a password on. Notification boxes are very easy to create, and are very customizable: let nb = gBrowser.getNotificationBox(); let acceptButton = new Object(); let declineButton = new Object(); let message = this._bundle.
getString("xulschoolhello.friendMessage.label"); let that = this; acceptButton.label = this._bundle.
getString("xulschoolhello.acceptButton.label"); acceptButton.accessKey = this._bundle.
getString("xulschoolhello.acceptButton.accesskey"); acceptButton.popup = null; acceptButton.callback = function() { that.acceptRequest(); }; // similarly for decline button. nb.appendNotification( message, "xulschool...
...he alert. Another advantage is that you use an XPCOM service to do this (nsIAlertsService), so you can easily trigger alerts from chrome and non-chrome code. On the other hand, alerts are displayed only temporarily Using the Alerts Service is similar to using notification boxes: let alertsService = Cc["@mozilla.org/alerts-service;1"].getService(Ci.nsIAlertsService); let title = this._bundle.
getString("xulschoolhello.greeting.title"); let message = this._bundle.
getString("xulschoolhello.greeting.label"); alertsService.showAlertNotification( "chrome://xulschoolhello/skin/hello-notification.png", title, message, true, "", this, "XULSchool Hello Message"); We pass this as an argument, assuming that this is an object that implements nsIObserver. We do this when we need to handle clicks on ...
Index - Archive of obsolete content
n XUL Methods, XUL Reference No summary! 1235 getSessionByName XUL Methods, XUL Reference No summary! 1236 getSessionResultAt XUL Methods, XUL Reference No summary! 1237 getSessionStatusAt XUL Methods, XUL Reference No summary! 1238 getSessionValueAt XUL Methods, XUL Reference No summary! 1239
getString XUL Methods, XUL Reference No summary! 1240 getTabForBrowser Method, Mozilla, Reference, Reference(2), XUL, XUL Methods, XUL Reference No summary! 1241 getTabModalPromptBox XUL, XUL Methods, XUL Reference No summary! 1242 goBack XUL Methods, XUL Reference No summary! 1243 goBackGroup XUL Methods, XUL Reference...
... 3637 NPN_GetAuthenticationInfo The function is called by plugins to get HTTP authentication information from the browser. 3638 NPN_GetIntIdentifier NPAPI, Plugins Returns an opaque identifier for the integer that is passed in. 3639 NPN_GetProperty NPAPI, Plugins Gets the value of a property on the specified NPObject. 3640 NPN_
GetStringIdentifier NPAPI, Plugins Returns an opaque identifier for the string that is passed in. 3641 NPN_
GetStringIdentifiers NPAPI, Plugins Returns an array of opaque identifiers for the names that are passed in. 3642 NPN_GetURL API, Gecko, NPAPI, Plugins, Reference Asks the browser to create a stream for the specified URL. 3643 NPN_GetURLNo...
Monitoring downloads - Archive of obsolete content
penDatabase(this.dbFile); var loglist = document.getElementById("loglist"); var statement = dbConn.createStatement("SELECT * FROM items"); // Get all items in table try { while (statement.executeStep()) { var row = document.createElement('listitem'); // Add the cells to the row var cell = document.createElement('listcell'); var sourceStr = statement.
getString(0); row.setAttribute("tooltiptext", sourceStr); sourceStr = sourceStr.slice(sourceStr.lastIndexOf("/")+1); cell.setAttribute("label", sourceStr); // Source row.appendChild(cell); cell = document.createElement('listcell'); cell.setAttribute("label", (statement.getInt64(1) / 1024).toFixed(1) + "KB"); // Size cell.setAttribute("style", "text-ali...
... mozIStorageStatement object's executeStep() method. Each time that method is called, one row of the results is fetched. After that, the list row object is created, and each entry in the search result is fetched and inserted into the appropriate list cell. The interesting bits to take away from this: mozIStorageStatement has several data getter routines for fetching search results, including
getString(), getDouble(), and getInt64(). These methods take as a parameter the zero-based index number of the column whose value you wish to retrieve. Note that the start time is being divided by 1000 before we create a JavaScript Date object from it. That's to adjust the value from the granularity stored in the database to that expected by JavaScript. To right-justify the numeric columns, we set the ap...
String Quick Reference - Archive of obsolete content
nsString& str); HandleString(nsAutoString(foo)); New way: wrap with nsDependentString // foo is a PRUnichar* string // fix caller to be // void HandleString(const nsAString& str); HandleString(nsDependentString(foo)); Stack-based strings What: use of special stack-oriented classes Why: to avoid excess heap allocations and memory leaks Wrong: use nsString/nsCString or raw characters // call
GetStringValue(nsAString& out); nsString value;
GetStringValue(value); // call
GetStringValue(char** out); char *result;
GetStringValue(&result); // don't forget to free result! Right: use nsAutoString/nsCAutoString and nsXPIDLString/nsXPIDLCString // call
GetStringValue(nsAString& out); nsAutoString value; // 64-character buffer on stack
GetStringValue(value); // call
GetStringValue(char** out); nsXPID...
...out); nsString value;
GetStringValue(value); // call
GetStringValue(char** out); char *result;
GetStringValue(&result); // don't forget to free result! Right: use nsAutoString/nsCAutoString and nsXPIDLString/nsXPIDLCString // call
GetStringValue(nsAString& out); nsAutoString value; // 64-character buffer on stack
GetStringValue(value); // call
GetStringValue(char** out); nsXPIDLCString result;
GetStringValue(getter_Copies(result)); // result will free automatically Original Document Information Author: Alec Flett Last Updated Date: April 30, 2003 Copyright Information: Portions of this content are (C) 1998-2007 by individual mozilla.org contributors; content available under a Creative Commons license | Details. ...
Property Files - Archive of obsolete content
rom the locale: <stringbundleset id="stringbundleset"> <stringbundle id="strings" src="chrome://myplugin/locale/strings.properties"/> </stringbundleset> Like other non-displayed elements, you should declare all your stringbundles inside a stringbundleset element so that they are all kept together. Getting a String from the Bundle This stringbundle element has a number of properties. ...
... Like other non-displayed elements, you should declare all your stringbundles inside a stringbundleset element so that they are all kept together. Getting a String from the Bundle This stringbundle element has a number of properties. The first is
getString which can be used in a script to read a string from the bundle. var strbundle = document.getElementById("strings"); var nofilesfound=strbundle.
getString("notFoundAlert"); alert(nofilesfound); This example first gets a reference to the bundle using its id Then, it looks up the string 'notFoundAlert' in the property file. The function
getString() returns the value of the string or null if the string does not exist. Finally, the string is displayed in an alert box. Text Formatting The next method is getFormattedString(). This method also gets...
stringbundle - Archive of obsolete content
erties: message.displayError=An error occured trying to display this message message.nameAlreadyUsed=The name %S is already being used by another account. More information is available in the XUL tutorial. The "src" attribute accepts only absolute chrome:// URLs (see bugs 133698, 26291) Attributes src Properties appLocale , src, stringBundle, strings Methods getFormattedString,
getString Examples (example needed) Attributes src Type: URI The URI of the property file that contains the localized strings. Inherited from XUL element align, allowevents, allownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, m...
... string bundle and returns a formatted copy where each occurrence of %S (uppercase) is replaced by each successive element in the supplied array. Alternatively, numbered indices of the format %n$S (e.g. %1$S, %2$S, etc.) can be used to specify the position of the corresponding parameter explicitly. If you need to handle substitutions involving plurals, take a look at Localization and Plurals.
getString( key ) Return type: string Returns the string with the given key name from the string bundle. Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAtt...
JSAPI User Guide
h 8-bit char to 16 bits--unless JS_C_STRINGS_ARE_UTF8 is defined or JS_SetCStringsAreUTF8 has been called, in which case each char * string is interpreted as UTF-8 Unicode text. The JSAPI provides jschar-based versions of many API functions that operate on strings, object properties, and JavaScript code. ...
... is defined or JS_SetCStringsAreUTF8 has been called, in which case each char * string is interpreted as UTF-8 Unicode text. The JSAPI provides jschar-based versions of many API functions that operate on strings, object properties, and JavaScript code. ...
JS::Value
These confusing semantics led to this method being removed fro...
...These confusing semantics led to this method being removed from the JSAPI in more rece...
JS_AddExternalStringFinalizer
he 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 string that the application previously created by calling JS_NewExternalString. The callback may use JS_
GetStringChars(str) to get a pointer to the character buffer, which is the pointer which the application passed to JS_NewExternalString() when creating the string. It is the callback's responsibility to free the memory. After this callback, the JS engine will not use that memory anymore and will not keep a pointer to it. The callback may not keep a reference to this JSString, as its memory is about to ...
...callback, the JS engine will not use that memory anymore and will not keep a pointer to it. The callback may not keep a reference to this JSString, as its memory is about to be freed. Description Add a finalizer for external strings created by JS_NewExternalString using a type-code returned from this function, and that understands how to free or release the memory pointed at by JS_
GetStringChars(str). Returns a nonnegative type index if there is room for finalizer in the global GC finalizers table, else returns -1. In a JS_THREADSAFE build, this function must be invoked on the primordial thread only, at startup--or else the entire program must single-thread itself while loading a module that calls this function. To remove an external string finalizer, use JS_RemoveExternalStringFi...
JS_CompareStrings
lexicographic ordering on sequences of code point value values. ...
...ring on sequences of code point value values. ...
JS_EncodeCharacters
ed at any time. Try to avoid using it. Convert a 16-bit string to an 8-bit string. Syntax JSBool JS_EncodeCharacters(JSContext *cx, const jschar *src, size_t srclen, char *dst, size_t *dstlen); Name Type Description cx JSContext * A context. src const jschar * The pointer to 16-bit values of JSString. This can be obtained with JS_
GetStringChars. srclen size_t The length of the source string, in 16-bit values. dst const char * The pointer to an array of bytes to be filled with encoded characters; or NULL. The caller is responsible for allocating and freeing this buffer. dstlenp size_t * In/out parameter. On entry, if dst is non-null, *dstlenp must be the length of the destination string i...
...values. The user is responsible for allocating and freeing the memory of the destination string. JS_EncodeCharacters never adds a trailing null character. To obtain a null-terminated string, allocate an extra byte for the null character and set it manually. To convert bytes to jschars, the opposite conversion, use JS_DecodeBytes. To convert a JSString to a C char string, use JS_EncodeString or JS_
GetStringBytes. See Also bug 805080 ...
JSAPI reference
onkey 17 JS_NewStringCopyN JS_NewStringCopyZ JS_NewUCString JS_NewUCStringCopyN JS_NewUCStringCopyZ JS_NewDependentString JS_GetEmptyStringValue JS_GetEmptyString Added in SpiderMonkey 1.8.5 JS_ConcatStrings JS_CompareStrings JS_StringEqualsAscii Added in SpiderMonkey 1.8.5 JS_FlatStringEqualsAscii Added in SpiderMonkey 1.8.5 JS_StringHasLatin1Chars Added in SpiderMonkey 38 JS_
GetStringCharAt Added in SpiderMonkey 38 JS_GetFlatStringCharAt Added in SpiderMonkey 38 JS_
GetStringLength JS_EncodeString Added in SpiderMonkey 1.8 JS_EncodeStringToUTF8 Added in SpiderMonkey 24 JS_EncodeStringToBuffer Added in SpiderMonkey 1.8.5 JS_
GetStringEncodingLength Added in SpiderMonkey 1.8.5 JS_GetLatin1FlatStringChars Added in SpiderMonkey 38 JS_GetTwoByteFlatStringChars Added in Spider...
...Monkey 1.8.5 JS_PutEscapedFlatString Added in SpiderMonkey 1.8.5 JS_FORGET_STRING_FLATNESS Added in SpiderMonkey 1.8.5 JS_StringIsFlat Added in SpiderMonkey 38 JS_ASSERT_STRING_IS_FLAT Added in SpiderMonkey 1.8.5 JS_FlattenString Added in SpiderMonkey 1.8.5 typedef jschar Obsolete since JSAPI 35 JS_NewString Obsolete since JSAPI 1.8.5 JS_NewGrowableString Obsolete since JSAPI 27 JS_
GetStringBytes Obsolete since JSAPI 1.8.5 JS_
GetStringBytesZ Obsolete since JSAPI 1.8.5 JS_
GetStringChars Obsolete since JSAPI 1.8.5 JS_
GetStringCharsZ Obsolete since JSAPI 33 JS_
GetStringCharsAndLength Added in JSAPI 1.8.5 Obsolete since JSAPI 33 JS_
GetStringCharsZ Added in SpiderMonkey 1.8.5 Obsolete since JSAPI 33 JS_
GetStringCharsZAndLength Added in SpiderMonkey 1.8.5 Obsolete since JSAPI 33 JS_...
SpiderMonkey 1.8.7
ptyString JS_GetFlatStringChars JS_GetGCParameter JS_GetGCParameterForThread JS_GetGlobalForScopeChain JS_GetInternedStringChars JS_GetInternedStringCharsAndLength JS_GetOwnPropertyDescriptor JS_GetPropertyAttrsGetterAndSetterById JS_GetPropertyById JS_GetPropertyByIdDefault JS_GetPropertyDefault JS_GetPropertyDescriptorById JS_GetRuntimeSecurityCallbacks JS_GetSecurityCallbacks JS_
GetStringCharsAndLength JS_
GetStringCharsZ JS_
GetStringCharsZAndLength JS_
GetStringEncodingLength JS_HasPropertyById JS_InitCTypesClass JS_InternJSString JS_IsConstructing_PossiblyWithGivenThisObject JS_IsExtensible JS_IsInRequest JS_LeaveCrossCompartmentCall JS_LookupPropertyById JS_LookupPropertyWithFlagsById JS_New JS_NewCompartmentAndGlobalObject JS_NewDateObject JS_NewDateObjectMsec J...
...tructors with and without the new keyword, now takes a pointer to the native's vp, along with the native's context pointer, to figure out how the function was called. Strings JS_CompareStrings received a new function signature with bug 609440, allowing us to correctly propagate exceptions when the underlying functions to retrieve the characters in the string failed. Additionally, JS_NewString, JS_
GetStringBytes, and JS_
GetStringChars were removed, replaced by fallible interfaces like JS_
GetStringCharsZAndLength and JS_EncodeStringToBuffer (not an exhaustive list). Numbers SpiderMonkey 1.8.5 now stores integers up to 32-bits in the jsval. This means that the INT_FITS_IN_JSVAL macro is always returns true (be careful to only use this macro with jsints, not 64-bit integers). The jsval now also store...
SpiderMonkey 38
RE_VALUE (bug 1037770) JSPROP_PROPOP_ACCESSORS (bug 1088002) JSPROP_REDEFINE_NONCONFIGURABLE (bug 1101123) JS_AddFinalizeCallback (bug 996785) JS_DefineConstIntegers (bug 1066020) JS_GetFlatStringCharAt (bug 1034627) JS_GetFunctionScript (bug 1069694) JS_GetLatin1FlatStringChars (bug 1037869) JS_GetLatin1InternedStringChars (bug 1037869) JS_GetLatin1StringCharsAndLength (bug 1032726) JS_
GetStringCharAt (bug 1034627) JS_GetTwoByteExternalStringChars (bug 1034627) JS_GetTwoByteFlatStringChars (bug 1037869) JS_GetTwoByteInternedStringChars (bug 1037869) JS_GetTwoByteStringCharsAndLength (bug 1032726) JS_NewPlainObject (bug 1125356) JS_RemoveFinalizeCallback (bug 996785) JS_SELF_HOSTED_SYM_FN (bug 1082672) JS_SYM_FN (bug 1082672) JS_SYM_FNSPEC (bug 1082672) JS_StringHasLatin1Chars (...
...ropertyStub (bug 1103152) JS_DoubleToInt32 (bug 1112774) JS_DoubleToUint32 (bug 1112774) JS_EnumerateStub (bug 1103152) JS_EvaluateScript (bug 1100579) JS_EvaluateUCScript (bug 1100579) JS_ExecuteScriptVersion (bug 1095660) JS_GetFlatStringChars (bug 1037869) JS_GetFunctionCallback (bug 1103269) JS_GetInternedStringChars (bug 1037869) JS_GetInternedStringCharsAndLength (bug 1037869) JS_
GetStringCharsAndLength (bug 1037869) JS_
GetStringCharsZ (bug 1037869) JS_
GetStringCharsZAndLength (bug 1037869) JS_GetTypeName (bug 1037718) JS_IsAboutToBeFinalized (bug 650161) JS_LookupElement (bug 1094176) JS_LookupProperty (bug 1094176) JS_LookupPropertyById (bug 1094176) JS_LookupUCProperty (bug 1094176) JS_NewPropertyIterator (bug 1081660) JS_NextProperty (bug 1081660) JS_ResolveStub (bug...
Places utilities for JavaScript
cesUtils: can be used in any toolkit application PlacesUIUtils: only in Firefox PlacesUtils This is a gigantic object full of usefulness if you need to do any bookmark work from within browser.xul. As such, it gets its own special section. ...
... Return type Returns a correct nsIURI. getFormattedString() string getFormattedString(string key, array string params) Parameters key The string name to get from the string bundle params Strings to substitute into the bundle at designated points See XUL:stringbundle for more information. Return type Returns a string from the default places stringbundle.
getString() string
getString(string key) Parameters key The name of the string to get. Return type Returns a string from the default places stringbundle. nodeIs() There are a ton of nodeIs(something) functions in here to check properties of a bookmark node. The all take in the same argument and return a boolean true or false, so I'm just going to list them all in one lump: boolean nodeIsFol...
XPCOM array guide
irection, make sure that you call the version of NS_NewStringEnumerator or NS_NewUTF8StringEnumerator that corresponds to the array type, not the enumerator type. For example, if a class has an internal nsTArray<nsCString> of UTF8 strings, but needs to implement an interface which returns an nsIStringEnumerator, it should use NS_NewUTF8StringEnumerator: class nsFoo : nsIFoo { ... ...
...ponds to the array type, not the enumerator type. For example, if a class has an internal nsTArray<nsCString> of UTF8 strings, but needs to implement an interface which returns an nsIStringEnumerator, it should use NS_NewUTF8StringEnumerator: class nsFoo : nsIFoo { ... ...
mozIStorageValueArray
Constants Constant Value Description ...
...etUTF8String() Obtains a UTF8String from the specified index. Note: C++ callers should be aware that a string value for a NULL column has IsVoid set to distinguish it from an empty string. AUTF8String getUTF8String( in unsigned long aIndex ); Parameters aIndex The zero-based numerical index for the column to get the data from. Return value The utf8string for the specified entry.
getString() Obtains a string from the specified index. Note: C++ callers should be aware that a string value for a NULL column has IsVoid set to distinguish it from an empty string. AString
getString( in unsigned long aIndex ); Parameters aIndex The zero-based numerical index for the column to get the data from. Return value The string for the specified entry. getBlob() Obtains a blob fr...
nsIDialogParamBlock
embedding/components/windowwatcher/public/nsIDialogParamBlock.idlScriptable An interface to pass strings, integers and nsISupports to a dialog. Inherits from: nsISupports Last changed in Gecko 1.7 Method overview PRInt32 GetInt( in PRInt32 inIndex ); wstring
GetString( in PRInt32 inIndex ); void SetInt( in PRInt32 inIndex, in PRInt32 inInt ); void SetNumberStrings( in PRInt32 inNumStrings ); void SetString( in PRInt32 inIndex, in wstring inString); Attributes Attribute Type Description objects nsIMutableArray A place where you can store an nsIMutableArray to pass nsISupports. Methods GetInt() Get a previously set integer. PRInt32 GetInt( in PRInt32 inIndex ); Parameters inIndex The ind...
...escription objects nsIMutableArray A place where you can store an nsIMutableArray to pass nsISupports. Methods GetInt() Get a previously set integer. PRInt32 GetInt( in PRInt32 inIndex ); Parameters inIndex The index of the integer to get. Must be in the range 0..7. Return value The previously set integer, or 0 if no integer has been previously set at that index.
GetString() Get a previously set string. wstring
GetString( in PRInt32 inIndex ); Parameters inIndex The index of the string to get. Must be in the range 0..15 unless SetNumberStrings was called. Return value The string at the given index, or the empty string if no string has previously been set at that index. SetInt() void SetInt( in PRInt32 inIndex, in PRInt32 inInt ); Parameters i...
nsIGSettingsCollection
xpcom/system/nsIGSettingsService.idlScriptable Please add a summary to this article. ...
...g key); AUTF8String
getString(in AUTF8String key); void setBoolean(in AUTF8String key, in boolean value); void setInt(in AUTF8String key, in long value); void setString(in AUTF8String key, in AUTF8String value); Methods getBoolean() boolean getBoolean( in AUTF8String key ); Parameters key Return value getInt() long getInt( in AUTF8String key ); Parameters key Return value
getString() AUTF8String
getString( in AUTF8String key ); Parameters key Return value setBoolean() void setBoolean( in AUTF8String key, in boolean value ); Parameters key value setInt() void setInt( in AUTF8String key, in long value ); Parameters key value setString() void setString( in AUTF8String key, in AUTF8String value ); Parameters key value ...
nsIStringBundleOverride
.getService(Components.interfaces.nsIStringBundleOverride); Note: You should never need to use this service directly. Instead, the string bundle service will automatically try to load this service. If there is no custom-strings.txt file then the service will fail to load. Method overview nsISimpleEnumerator enumerateKeysInBundle(in AUTF8String url); AString
getStringFromName(in AUTF8String url, in ACString key); Methods enumerateKeysInBundle() Get all override keys for a given string bundle. nsISimpleEnumerator enumerateKeysInBundle( in AUTF8String url ); Parameters url The URL of the original string bundle whose keys are to be overridden. Return value An enumeration of nsIPropertyElement objects for the keys that are overridden in the given string bu...
...nBundle() Get all override keys for a given string bundle. nsISimpleEnumerator enumerateKeysInBundle( in AUTF8String url ); Parameters url The URL of the original string bundle whose keys are to be overridden. Return value An enumeration of nsIPropertyElement objects for the keys that are overridden in the given string bundle. Note that these keys may not exist in the original string bundle.
getStringFromName() Get the override value for a particular key in a particular string bundle. AString
getStringFromName( in AUTF8String url, in ACString key ); Parameters url The URL of the original string bundle whose keys are to be overridden. key The key to be overridden. Return value The override value. An exception is thrown if the key has not been overridden. However, no exception is thrown i...
customDBHeaders Preference
file for reference. ...
...columnHandler = { getCellText: function(row, col) { //get the messages header so that we can extract the 'X-Superfluous' field var key = gDBView.getKeyAt(row); var hdr = gDBView.db.GetMsgHdrForKey(key); var retval = hdr.
getStringProperty("x-superfluous"); dump("x-superfluous: " + retval + "\n"); return retval; }, getSortStringForRow: function(hdr) { return hdr.
getStringProperty("x-superfluous"); }, isString: function() {return true;}, getCellProperties: function(row, col, props){}, getImageSrc: function(row, col) {return null;}, getSortLongForRow: function(hdr) {return 0;} } function addCustomColumnHandler() { gDBView.addColumnHandler("colSuperfluous",columnHandler); dump("column handler being added: " + columnHandler +...
Gecko Plugin API Reference - Plugins
tion for the Plug-in API. NPN_Write Pushes data into a stream produced by the plug-in and consumed by the browser. ...
...N_Write Pushes data into a stream produced by the plug-in and consumed by the browser. ...
regexp:match() - EXSLT
regExpString The JavaScript style regular expression to evaluate. flagsStringOptional An optional string containing character flags. ...
... regExpString The JavaScript style regular expression to evaluate. flagsStringOptional An optional string containing character flags. ...
JavaScript Object Management - Archive of obsolete content
any of these things. They are bad UI practices anyway and you should avoid them. If you really need to do something like this anyway, one way to do it is to have a timeout execute the code after a delay: init : function(aEvent) { let that = this; this._stringBundle = document.getElementById("xs-hw-string-bundle"); window.setTimeout( function() { window.alert(that._stringBundle.
getString("xulschoolhello.greeting.label")); }, 0); } The setTimeout function executes the function in the first parameter, after a delay in miliseconds specified by the second parameter. In this case we set the delay to 0, which means the function should be executed as soon as possible. Firefox has a minimum delay of 10-15ms (taken from this blog post), so it won't really run instantly. It is more tha...
Getting the page URL in NPAPI plugin - Archive of obsolete content
ou want to contact. So, how do we get at that page URL, i.e. the URL of the HTML which embeds the plugin, i.e. which caused the plugin to load? There are at least 3 solutions (quoting newsgroup posts): Via window location From Robert Platt: // Get the Dom window object. NPN_GetValue( m_pNPInstance, NPNVWindowNPObject, &sWindowObj ); // Create a "location" identifier. NPIdentifier identifier = NPN_
GetStringIdentifier( "location" ); // Declare a local variant value. NPVariant variantValue; // Get the location property from the window object (which is another object). bool b1 = NPN_GetProperty( m_pNPInstance, sWindowObj, identifier, &variantValue ); // Get a pointer to the "location" object. NPObject *locationObj = variantValue.value.objectValue; // Create a "href" identifier. identifier = NPN_GetStri...
Index of archived content - Archive of obsolete content
ss NPEmbedPrint NPEvent NPFullPrint NPIdentifier NPN NewStream NPNVariable NPN_CreateObject NPN_DestroyStream NPN_Enumerate NPN_Evaluate NPN_ForceRedraw NPN_GetAuthenticationInfo NPN_GetIntIdentifier NPN_GetProperty NPN_
GetStringIdentifier NPN_
GetStringIdentifiers NPN_GetURL NPN_GetURLNotify NPN_GetValue NPN_GetValueForURL NPN_HasMethod NPN_HasProperty NPN_IdentifierIsString NPN_IntFromIdentifier NPN_InvalidateRect NPN_InvalidateRegion NPN_Invoke NPN_InvokeDefault ...
Editor Embedding Guide - Archive of obsolete content
gh all the name/value pairs and programatically pull off data. First GetNext (returns the next name in the name/value pair list) HasMoreElements GetValueType (numeric enum type see nsICommandParams for values) If the name/value pair is known or it was obtained using the methods described above, it is possible to call the following methods: GetBooleanValue GetLongValue GetDoubleValue
GetStringValue GetCStringValue GetISupportsValue All of these take pointers to values except for
GetStringValue which demands a reference to an nsAString. commandParam->GetBooleanValue("state_enabled",&boolval); Original Document Information Authors: Michael Judge (mjudge@netscape.com) Contributor: Kathleen Brade (brade@netscape.com) Last Updated Date: March 27, 2003 Original Document: A Guid...
Methods - Archive of obsolete content
Parts of this page show the use of the XPInstall API. The majority of this API is now deprecated and as of Gecko 1.9 no longer available. Extension, Theme, and plug-in developers must switch away from install.js based packages to the new packaging scheme with an install.rdf manifest. In particular plugin developers should see how to package a plugin as an extension. Methods
getString Retrieves a value from a .ini file. writeString Changes a value in a .ini file. ...
WinProfile Object - Archive of obsolete content
articular plugin developers should see how to package a plugin as an extension. WinProfile (Windows only) Windows developers use this object to manipulate the content of a Windows .ini file. Overview This object does not have a public constructor. Instead, you construct an instance of this object by calling the getWinProfile method of the Install object. The two methods of the WinProfile object,
getString and writeString, allow you to read and write the data in the key/value pairs of a Windows .ini file. ...
XPInstall API reference - Archive of obsolete content
tParent dirRemove dirRename diskSpaceAvailable execute exists isDirectory isFile macAlias modDate modDateChanged move remove rename size windowsGetShortName windowsRegisterServer windowsShortcut WinProfile No properties Methods
getString writeString WinReg No properties Methods createKey deleteKey deleteValue enumKeys enumValueNames getValue getValueNumber getValueString isKeyWritable keyExists setRootKey setValue setValueNumber setValueString valueExists WinRegValu...
Index - Archive of obsolete content
ession XUL Methods, XUL Reference No summary! 504 getSessionByName XUL Methods, XUL Reference No summary! 505 getSessionResultAt XUL Methods, XUL Reference No summary! 506 getSessionStatusAt XUL Methods, XUL Reference No summary! 507 getSessionValueAt XUL Methods, XUL Reference No summary! 508
getString XUL Methods, XUL Reference No summary! 509 getTabForBrowser Method, Mozilla, Reference, Reference(2), XUL, XUL Methods, XUL Reference No summary! 510 getTabModalPromptBox XUL, XUL Methods, XUL Reference No summary! 511 goBack XUL Methods, XUL Reference No summary! 512 goBackGroup XUL Methods, XUL Reference ...
Methods - Archive of obsolete content
ttedString getHTMLEditor getIndexOfFirstVisibleRow getIndexOfItem getItemAtIndex getNextItem getNotificationBox getNotificationWithValue getNumberOfVisibleRows getPageById getPreviousItem getResultAt getResultCount getResultValueAt getRowCount getSearchAt getSelectedItem getSession getSessionByName getSessionResultAt getSessionStatusAt getSessionValueAt
getString goBack goBackGroup goDown goForward goForwardGroup goHome goTo gotoIndex goUp hidePopup increase increasePage insertItem insertItemAt invertSelection loadGroup loadOneTab loadTabs loadURI loadURIWithFlags makeEditable moveByOffset moveTo moveToAlertPosition onSearchComplete onTextEntered onTextReverted openPopup openPopupAtScreen openSub...
NPVariant - Archive of obsolete content
NPVariantType undefined NPVariantType_Void null NPVariantType_Null boolean NPVariantType_Bool number NPVariantType_Int32 or NPVariantType_Double string NPVariantType_String All other types NPVariantType_Object Functions NPN_ReleaseVariantValue() NPN_
GetStringIdentifier() NPN_
GetStringIdentifiers() NPN_GetIntIdentifier() NPN_IdentifierIsString() NPN_UTF8FromIdentifier() NPN_IntFromIdentifier() Macros Plugin developers are not expected to directly manipulate or access the members of the NPVariant instance, instead, the function NPN_ReleaseVariantValue(), and the following macros are provided: NPVARIANT_IS_VOID() Evaluates to true if v ...
NPAPI plugin reference - Archive of obsolete content
e specified NPObject. NPN_ForceRedraw Asks the plugin host to immediately (synchronously) repaint invalid areas. NPN_GetAuthenticationInfo The function is called by plugins to get HTTP authentication information from the browser. NPN_GetIntIdentifier Returns an opaque identifier for the integer that is passed in. NPN_GetProperty Gets the value of a property on the specified NPObject. NPN_
GetStringIdentifier Returns an opaque identifier for the string that is passed in. NPN_
GetStringIdentifiers Returns an array of opaque identifiers for the names that are passed in. NPN_GetURL Asks the browser to create a stream for the specified URL. NPN_GetURLNotify Requests creation of a new stream with the contents of the specified URL; gets notification of the result. NPN_GetValue Allows the p...
Localization and Plurals
files - Downloads downloadsTitleFiles=#1 file - Downloads;#1 files - Downloads # LOCALIZATION NOTE (timePair): #1 time number; #2 time unit # example: 1 second; 11 seconds timePair=#1 #2 seconds=second;seconds minutes=minute;minutes hours=hour;hours downloads.js: Components.utils.import("resource://gre/modules/PluralForm.jsm"); let getStr = function(string) document.getElementById("strings").
getString(string); // Get the correct plural form for the title let numDownloads = 3; let title = PluralForm.get(numDownloads, getStr("downloadsTitleFiles")); // Put in the correct number of downloads print(title.replace("#1", numDownloads)); // Get the correct plural form of seconds let timeLeft = 55; let seconds = PluralForm.get(timeLeft, getStr("seconds")); // Print the localized string for "55 second...
Exact Stack Rooting
n out->setObject(foo) will not work as expected. To solve these problems we have the js::MutableHandleT class. js::MutableHandleT is a js::HandleT with a set method. bool ReturnFoo(JSContext *cx, MutableHandleString out) { out.set(JS_NewStringCopyZ(cx, "Foo")); return bool(out); } size_t GetLengthFoo(JSContext *cx) { RootedString s(cx); if (ReturnFoo(cx, &s)) return JS_
GetStringLength(s); return size_t(-1); } All methods in the JS-API that return GCPointers have been changed to this out-param style. This prevents an entire class of bugs where return values are not rooted properly before the next JS-API call. JS::NullPtr NULL (or nullptr) does not implicitly convert to a js::HandleT. For places where you want to pass a NULL value into a function taking a js::Handl...
JSString
A JSString represents a primitive JavaScript string in the JSAPI. Conceptually, a JavaScript string is just an array of char16_t characters and a length. You should not rely on the structure of JSString, because it is subject to change; instead, treat JSString objects as opaque. To get the length of a JSString you can use JS_
GetStringLength. Working with JSString objects (add a list of links to methods here, maybe some text) ...
JSVAL_IS_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. Determines if a given jsval is a string. Syntax JSVAL_IS_STRING(v) Description JSVAL_IS_STRING(v) is true if v is a string. To access the content of a string jsval, use JSVAL_TO_STRING, JS_
GetStringChars, and JS_
GetStringLength. Example The following code snippet illustrates how a JavaScript variable, MyItem, is conditionally tested in an if statement to see if it is a string. if (JSVAL_IS_STRING(MyItem)) { ... } See Also bug 952650 ...
JSVAL_TO_STRING
e 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_CStringsAreUTF8
de character, and there is no way to pass in a string containing characters beyond U+00FF. However, SpiderMonkey can optionally interpret these strings as UTF-8. There are two ways to enable this: at compile time, by building SpiderMonkey with JS_C_STRINGS_ARE_UTF8 defined; or at run time, by calling JS_SetCStringsAreUTF8 before the first call to JS_NewRuntime. Enabling this option also causes JS_
GetStringBytes and JS_EncodeCharacters to produce UTF-8 strings instead of Latin-1. JS_CStringsAreUTF8 returns JS_TRUE if the JavaScript engine is configured (either at compile time or at run time) to interpret char strings as UTF-8. See Also bug 805080 ...
JS_EncodeString
byte is simply dropped from each char16_t. JS_EncodeStringToUTF8 encode the string to UTF-8. The array returned by JS_EncodeString on success is allocated as though by a call to JS_malloc. The caller may modify it and is responsible for freeing it. Note that for non-ASCII strings, if JS_CStringsAreUTF8 is false, these functions can return a corrupted copy of the contents of the string. Use JS_
GetStringChars to access the 16-bit characters of a JavaScript string without conversions or copying. On success, JS_EncodeString and JS_EncodeStringToUTF8 return a pointer to the char array, which is null-terminated. On failure, JS_EncodeString and JS_EncodeStringToUTF8 return NULL See Also MXR ID Search for JS_EncodeString MXR ID Search for JS_EncodeStringToUTF8 JS_EncodeStringToBuffer bug 39721...
JS_EncodeStringToBuffer
ring. It returns the length of the whole string encoding or (size_t)-1 if the string can't be encoded as bytes. ...
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_MakeStringImmutable
ll JS_MakeStringImmutable before sharing a JSString among threads by storing it in a C/C++ variable, field, or array element that another thread can read. (When an application shares a string by storing it in a JavaScript object that another thread can read, the JavaScript engine automatically makes the string thread-safe.) After a successful call to JS_MakeStringImmutable, subsequent calls to JS_
GetStringCharsZ on the same string are guaranteed to succeed, and subsequent calls to JS_
GetStringChars on the same string are guaranteed to return a null-terminated string. See Also bug 1115986 ...
JS_StringHasLatin1Chars
e Description str JSString * String to examine. 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. Some functions like JS_CopyStringChars and JS_
GetStringCharAt accept both Latin1 and TwoByte strings. See Also MXR ID Search for JS_StringHasLatin1Chars bug 1032726 ...
jschar
38. Functions that use jschar will use char16_t directly. Embedder code should use char16_t, too. (See bug 1063962.) As required by the ECMAScript standard, ECMA 262-3 ?4.3.16", JavaScript strings are arbitrary sequences of 16-bit values. A string may contain unmatched surrogates, which are not valid UTF-16. It may also contain zeroes ('\0'). To get the characters of a JavaScript string, use JS_
GetStringChars. See Also bug 1063962 ...
SpiderMonkey 1.8
examining an object without triggering resolve hooks. It was possible to configure SpiderMonkey 1.7 to treat C/C++ char strings as UTF-8 by compiling with a non-default compiler option. In SpiderMonkey 1.8, it is no longer necessary to make a special build to get this behavior. Applications can turn on UTF-8 at run time by calling JS_SetCStringsAreUTF8. JS_EncodeString is a new variation on JS_
GetStringBytes that returns a newly allocated, writable buffer which the application must JS_free. JS_ReportAllocationOverflow can be used (instead of JS_ReportOutOfMemory) to indicate that the script is trying to do something that would require more memory than the implementation is designed to handle. The main difference is that JS_ReportAllocationOverflow throws an exception which the application may c...
Mozilla internal string guide
nst class: void nsFoo::ReverseCharacters(const nsAString& str) { ... str.Assign(reversedStr); } As function parameters For methods which are exposed across modules, use nsAString references to pass strings. For example: // when passing a string to a method, use const nsAString& nsFoo::PrintString(const nsAString &str); // when getting a string from a method, use nsAString& nsFoo::
GetString(nsAString &result); The abstract classes are also sometimes used to store temporary references to objects. You can see both of these uses in Common Patterns, below. The Concrete Classes - which classes to use when The concrete classes are for use in code that actually needs to store string data. The most common uses of the concrete classes are as local variables, and members in classes or str...
mozilla::services namespace
illa::services namespace. For example, to obtain a reference to the IOService: nsCOMPtr<nsIIOService> ioService = mozilla::services::GetIOService(); Provided service getters Service Accessor Service Interface Service Name GetChromeRegistryService nsIChromeRegistryService Chrome Registry service GetIOService nsIIOService IO Service GetObserverService nsIObserverService Observer service
GetStringBundleService nsIStringBundleService String Bundle Service GetToolkitChromeRegistryService nsIToolkitChromeRegistry Toolkit Chrome Registry service GetXULChromeRegistryService nsIXULChromeRegistry XUL Chrome Registry service GetXULOverlayProviderService nsIXULOverlayProvider XUL Overlay Provider service More services will be added as needed. See also Services.jsm nsIServiceManager.getSer...
nsIRegistry
default (530) Profiles/foo (1046) Profiles/bar (1518) The number inside the parenthesis is the "key." You can use this key with the rest of the nsIRegistry API (see MXR). Now, I know from visual inspection that there's a key called "directory" for each profile. I don't know how to get the other keys' names automatically, but I do know how to look up the directory for a particular profile. js> rs.
getStringUTF8(530, "directory") // 530: key corresponding with Profiles/default The output is something like: /home/lion/.mozilla/default/awp83kud.slt Boo-yah! Can we change it? js> rs.setStringUTF8(530, "directory", "/home/lion/somewhere/else") js> rs.
getStringUTF8(530, "directory") /home/lion/somewhere/else Yes! Now, the only puzzle is: how do you save it? js> rs.flush() // this is not enough... Pe...
nsIMimeConverter
The length of the header field including the colon and space (": "). encodedWordSize The maximum line length of the encoded string. decodeMimeHeaderToCharPtr() void setStringProperty(in string propertyName, in string propertyValue); Parameters propertyName The name of the property to set. propertyValue The value of the property. decodeMimeHeader() string
getStringProperty(in string propertyName); Parameters propertyName The name of the property to retrieve. Return Value The value of the property. B64EncoderInit() Get an integer property. Usually you would use this to store you own properties. unsigned long getUint32Property(in string propertyName); Parameters propertyName The name of the property to retrieve. Thunderbird stored Uint32 pr...
nsIStringBundleService
hods createBundle() nsIStringBundle createBundle( in string aURLSpec ); Parameters aURLSpec The URL of the properties file to load. This is typically a locale URL, e.g. chrome://global/locale/global.properties Return value A string bundle corresponding to the properties file. This string bundle has functions available on it. On the return value object on you can call functions like
GetStringFromName and formatStringFromName see nsIStringBundle. createExtensibleBundle() nsIStringBundle createExtensibleBundle( in string aRegistryKey ); Parameters aRegistryKey The name of the category under which the properties file(s) have been registered. Return value An extensible bundle corresponding to the properties file(s). flushBundles() Flushes the string bundle cache - usefu...
nsPIPromptService
embedding/components/windowwatcher/public/nsPIPromptService.idlScriptable This interface is for the dialog implementers, not for other developers. Inherits from: nsISupports Last changed in Gecko 1.9.2 (Firefox 3.6 / Thunderbird 3.1 / Fennec 1.0) Implemented by: The contract ID isn't defined. This interface defines the meaning of each indexes of GetInt(), SetInt(),
GetString() and SetString() of the nsIDialogParamBlock interface but they are defined on in C++. The indexes for
GetString() and SetString() are: eMsg The value is 0. This is the message text of the dialog. eCheckboxMsg The value is 1. This is the label text of a checkbox on the dialog. eIconClass The value is 2. This is the class attribute value of the icon image. eTitleMessage The value is 3. This is the heading of the...
Creating a Custom Column
sed internally when sorting by your column A Simple Implementation Objects in Javascript are just "advanced" variables, so an implementation of the nsIMsgCustomColumnHandler interface looks like: var columnHandler = { getCellText: function(row, col) { //get the message's header so that we can extract the reply to field var hdr = gDBView.getMsgHdrAt(row); return hdr.
getStringProperty("replyTo"); }, getSortStringForRow: function(hdr) {return hdr.
getStringProperty("replyTo");}, isString: function() {return true;}, getCellProperties: function(row, col, props){}, getRowProperties: function(row, props){}, getImageSrc: function(row, col) {return null;}, getSortLongForRow: function(hdr) {return 0;} } Basically, all we are doi...
Access StringBundle from Overlay
ng them to an existing stringbundleset as such: <stringbundleset id="stringbundleset"> <stringbundle src="chrome://your_extension/locale/overlay.properties" id="your-extension-strings" /> </stringbundleset> Now that your stringbundle is attached you can access it from JavaScript as follows: var str = document.getElementById("your-extension-strings"); //get the stringbundle object itself str.
getString("propertyName"); //get a string (and do something with it) Alternative way let stringBundleService = Cc["@mozilla.org/intl/stringbundle;1"].getService(Ci.nsIStringBundleService); let bundle = stringBundleService.createBundle("chrome://your_extension/locale/overlay.properties"); let str = bundle.
GetStringFromName("propertyName"); see nsIStringBundleService ...
WebIDL bindings
of pair at aIndex in iterable storage uint32_t& GetValueAtIndex(uint32_t aIndex); } Stringifiers Named stringifiers operations in WebIDL will just invoke the corresponding C++ method. Anonymous stringifiers in WebIDL will invoke the C++ method called Stringify. So, for example, given this IDL: interface FirstInterface { stringifier; }; interface SecondInterface { stringifier DOMString
getStringRepresentation(); }; the corresponding C++ would be: class FirstInterface { public: void Stringify(nsAString& aResult); }; class SecondInterface { public: void
GetStringRepresentation(nsAString& aResult); }; Legacy Callers Only anonymous legacy callers are supported, and will invoke the C++ method called LegacyCall. This will be passed the JS "this" value as the first argument, then the...
Add to iPhoto
s/iPhoto.app"; var appstrCF = CoreFoundation.CFStringCreateWithCharacters(null, appstr, appstr.length); var appurl = CoreFoundation.CFURLCreateWithString(null, appstrCF, null); CoreFoundation.CFRelease(appstrCF); var b = CoreFoundation.CFURLGetFSRef(appurl, ref.address()); if (!b) { var stringsBundle = document.getElementByID("string-bundle"); alert(stringsBundle.
getString('alert_download_error_string')); } else { var array = ctypes.cast(mutableArray, CoreFoundation.CFArrayRef); AppServices.LSOpenURLsWithRole(array, 0, null, appParams.address(), null, 0); } CoreFoundation.CFRelease(appurl); // Clean up CoreFoundation.CFRelease(array); } AppServices.shutdown(); Carbon.shutdown(); CoreFoundation.shutdown(); } This code beg...
Scripting plugins - Plugins
call plugin native methods The following HTML code will do the job: <embed type="application/plugin-mimetype"> <script> var embed = document.embeds[0]; embed.nativeMethod(); alert(embed.nativeProperty); embed.nativeProperty.anotherNativeMethod(); </script> The API extensions The API extensions are based on four new structs: NPString NPVariant NPN_ReleaseVariantValue NPN_
GetStringIdentifier NPN_
GetStringIdentifiers NPN_GetIntIdentifier NPN_IdentifierIsString NPN_UTF8FromIdentifier NPN_IntFromIdentifier NPObject NPN_Construct (since Firefox 3.0b1) NPN_CreateObject NPN_RetainObject NPN_ReleaseObject NPN_Invoke NPN_InvokeDefault NPN_Enumerate (since Mozilla 1.9a1) NPN_Evaluate NPN_GetProperty NPN_SetProperty NPN_RemoveP...
Index - Web APIs
terface. 443 CSSPrimitiveValue.getRectValue() API, CSSPrimitiveValue, Method, getRectValue The getRectValue() method of the CSSPrimitiveValue interface is used to get a rect value. If this CSS value doesn't contain a rect value, a DOMException is raised. Modification to the corresponding style property can be achieved using the Rect interface. 444 CSSPrimitiveValue.
getStringValue() API, CSSPrimitiveValue, Method,
getStringValue The
getStringValue() method of the CSSPrimitiveValue interface is used to get a string value. If this CSS value doesn't contain a string value, a DOMException is raised. 445 CSSPrimitiveValue.primitiveType API, CSSPrimitiveValue, Property, Read-only, Reference, primitiveValue The primitiveType read-only property ...