Search completed in 1.38 seconds.
Component; nsIPrefBranch
Inherits from: nsISupports Last changed in Gecko 58 (Firefox 58 / Thunderbird 58 / SeaMonkey 2.55) This object is created with a "root" value which describes the base point in the preferences "tree" from which this "branch" stems. Preferences are accessed off of this root by using just the final portion of the preference. ...
... Constants Constant Value Description PREF_INVALID 0 long PREF_STRING 32 long data type. PREF_INT 64 long data type. PREF_BOOL 128 long data type. Methods addObserver() Adds a preference change observer. On preference changes, the following arguments will be passed to nsIObserver.observe(): aSubject - The
nsIPrefBranch object (this). aTopic - The string defined by NS_PREFBRANCH_PREFCHANGE_TOPIC_ID aData - The name of the preference which has changed, relative to the "root" of the aSubject branch. aSubject.get*Pref(aData) will get the new value of the modified preference. For example, if your observer is registered with addObserver("bar.", ...) on a branch with root "foo.", modifying the preference "foo...
...eference does not exist (instead of throwing an exception). Return value Returns utf8tring - The value of the requested string preference. getChildList() Returns an array of strings representing the child preferences of the root of this branch. Note: This method can be called on either a default or user branch but, in effect, always operates on both. (To call from javascript use children =
nsIPrefBranch.getChildList("",obj), which will fill in obj.value with the count and return an array of keys! (It is not void in javascript) void getChildList( in string aStartingAt, out unsigned long aCount, [array, size_is(aCount), retval] out string aChildArray ); Parameters aStartingAt The point on the branch at which to start enumerating the child preferences. Pass in "" to enumerate all...
...And 5 more matches
nsIPrefService
modules/libpref/public/
nsIPrefService.idlScriptable This interface is the main entry point into the back end preferences management library. The preference service is directly responsible for the management of the preferences files and also facilitates access to the preference branch object which allows the direct manipulation of the preferences themselves. ...
...able This interface is the main entry point into the back end preferences management library. The preference service is directly responsible for the management of the preferences files and also facilitates access to the preference branch object which allows the direct manipulation of the preferences themselves. Inherits from: nsISupports Last changed in Gecko 1.7 Method overview
nsIPrefBranch getBranch(in string aPrefRoot);
nsIPrefBranch getDefaultBranch(in string aPrefRoot); void readUserPrefs(in nsIFile aFile); void resetPrefs(); void resetUserPrefs(); void savePrefFile(in nsIFile aFile); Methods getBranch() Call to get a Preferences "Branch" which accesses user preference data. Using a Set method on this object will always...
...oid resetPrefs(); void resetUserPrefs(); void savePrefFile(in nsIFile aFile); Methods getBranch() Call to get a Preferences "Branch" which accesses user preference data. Using a Set method on this object will always create or set a user preference value. When using a Get method a user set value will be returned if one exists, otherwise a default value will be returned.
nsIPrefBranch getBranch( in string aPrefRoot ); Parameters aPrefRoot The preference root tree on which to base this branch. For example, if the root browser.startup. is used, the branch will be able to easily access the preferences browser.startup.page, browser.startup.homepage, and browser.startup.homepage_override by simply requesting page, homepage, or homepage_override. nsnull or "" (empty st...
...And 4 more matches
nsIPrefBranch2
aTopic - The string defined by NS_PREFBRANCH_PREFCHANGE_TOPIC_ID aData - The name of the preference which has changed, relative to the "root" of the aSubject branch. aSubject.get*Pref(aData) will get the new value of the modified preference. ...
... aTopic - The string defined by NS_PREFBRANCH_PREFCHANGE_TOPIC_ID aData - The name of the preference which has changed, relative to the "root" of the aSubject branch. aSubject.get*Pref(aData) will get the new value of the modified preference. ...
...hanges to foo.bar.baz and foo.bar.bzip. aObserver The object to be notified if the preference changes. aHoldWeak true holds a weak reference to aObserver. The object must implement the nsISupportsWeakReference interface or this will fail. false holds a strong reference to aObserver. removeObserver() Remove a preference change observer. Note: You must call removeObserver method on the same
nsIPrefBranch2 instance on which you called addObserver() method in order to remove aObserver; otherwise, the observer will not be removed. void removeObserver( in string aDomain, in nsIObserver aObserver ); Parameters aDomain The preference which is being observed for changes. aObserver An observer previously registered with addObserver. Remarks Registering as a preference obse...
nsIPrefLocalizedString
Inherits from: nsISupports Last changed in Gecko 1.8 (Firefox 1.5 / Thunderbird 1.5 / SeaMonkey 1.0) Method overview void setDataWithLength(in unsigned long length, [size_is(length)] in wstring data); wstring toString(); Attributes Attribute Type Description data wstring Provides access to string data stored in this property. ...
Preferences - Archive of obsolete content
or the complete list of methods. The interfaces dealing with preferences are fairly well documented, so using the methods not mentioned here should be straightforward. XPCOM interfaces for preferences system Mozilla exposes its preferences system through a few XPCOM interfaces. Look in the Resources section below for the link to a list of preferences-related interfaces. Two used interfaces are
nsIPrefService and
nsIPrefBranch. The preferences service is instantiated in the same way you instantiate any XPCOM service. To get an
nsIPrefBranch, either QueryInterface() the pref service (that will give you the root branch) or call
nsIPrefService.getBranch() to get a sub-branch. Here are two examples: // Get the root branch var prefs = Components.classes["@mozilla.org/preferences-service;1"] ...
...ce is instantiated in the same way you instantiate any XPCOM service. To get an
nsIPrefBranch, either QueryInterface() the pref service (that will give you the root branch) or call
nsIPrefService.getBranch() to get a sub-branch. Here are two examples: // Get the root branch var prefs = Components.classes["@mozilla.org/preferences-service;1"] .getService(Components.interfaces.
nsIPrefBranch); // Get the "extensions.myext." branch var prefs = Components.classes["@mozilla.org/preferences-service;1"] .getService(Components.interfaces.
nsIPrefService); prefs = prefs.getBranch("extensions.myext."); Simple types There are three types of preferences: string, integer, and boolean. Each entry in the preferences database (prefs.js) has one of those types. There a...
...the "extensions.myext." branch var prefs = Components.classes["@mozilla.org/preferences-service;1"] .getService(Components.interfaces.
nsIPrefService); prefs = prefs.getBranch("extensions.myext."); Simple types There are three types of preferences: string, integer, and boolean. Each entry in the preferences database (prefs.js) has one of those types. There are six methods in
nsIPrefBranch that read and write preferences: getBoolPref(), setBoolPref(), getCharPref(), setCharPref(), getIntPref(), and setIntPref(). Using them is as easy as: // Get the "accessibility." branch var prefs = Components.classes["@mozilla.org/preferences-service;1"] .getService(Components.interfaces.
nsIPrefService).getBranch("accessibility."); // prefs is an
nsIPrefBranch. // Look...
...And 27 more matches
XPCOM Objects - Archive of obsolete content
the top you can see a list of the interfaces it implements, with a link to a documentation page for each one of them. Then you'll see a list of all members of this object, with some documentation about it. It is particularly important to note that, for every member in the component, you'll see in what interface this member is defined. Clicking on the link for the getBranch method takes you to the
nsIPrefService documentation page, where you can see more details on the interface and the method. You can also see a list of what components implement this interface. All of this documentation is generated from the one present in the Firefox source files, so it's in general very complete and well written. It's a shame XUL Planet is no longer with us. Interfaces can be awkward to handle. If you want to ...
...d well written. It's a shame XUL Planet is no longer with us. Interfaces can be awkward to handle. If you want to call a method or use an attribute of interface X in a component, you first need to "cast" the component to interface X. This is done via the QueryInterface method that is included in all XPCOM components. this._prefService = Cc["@mozilla.org/preferences-service;1"].getService(Ci.
nsIPrefBranch); this._prefValue = this._prefService.getBoolPref("somePreferenceName"); this._prefService.QueryInterface(Ci.
nsIPrefBranch2); this._prefService.addObserver("somePreferenceName", this, false); this._prefService.QueryInterface(Ci.
nsIPrefBranch); This is a common piece of code you'll see when initializing components or JSM that rely on preferences. We use the Preferences Service to get an...
...PrefBranch2); this._prefService.addObserver("somePreferenceName", this, false); this._prefService.QueryInterface(Ci.
nsIPrefBranch); This is a common piece of code you'll see when initializing components or JSM that rely on preferences. We use the Preferences Service to get and set preference values, such as the preference value we're getting on the fourth line of code. These methods are in the
nsIPrefBranch interface. The getService and createInstance methods allow you to get the component already set to an interface. In many cases you only need to use one interface, and you won't have to worry about QueryInterface. But in this case we need to change the interface to
nsIPrefBranch2, which is the one that includes the method that adds a preference observer. Then we change it back, because after...
...And 3 more matches
Adding preferences to an extension - Archive of obsolete content
our preferences: pref("extensions.stockwatcher2.symbol", "GOOG"); The standard for third-party preferences, such as those used in extensions, is to use the string "extensions", a period, the name of the extension, another period, then a preference name, as seen in the example above. The JavaScript code In order to monitor changes to our preferences, we need to install an observer using the
nsIPrefBranch2 interface. To do that, we need to reimplement our code into an object. That involves turning each function into a member of the StockWatcher class. Let's take a look at each function in the class. startup() The StockWatcher.startup() function is called when our extension is first loaded. Its job is to start up the observer to watch for changes to our preferences, instantiate an object t...
...e our preferences, and install an interval routine to update the stock information periodically. var StockWatcher = { prefs: null, tickerSymbol: "", // Initialize the extension startup: function() { // Register to receive notifications of preference changes this.prefs = Components.classes["@mozilla.org/preferences-service;1"] .getService(Components.interfaces.
nsIPrefService) .getBranch("extensions.stockwatcher2."); this.prefs.addObserver("", this, false); this.tickerSymbol = this.prefs.getCharPref("symbol").toUpperCase(); this.refreshInformation(); window.setInterval(this.refreshInformation, 10*60*1000); } }, Our object has two member variables. prefs is configured by startup() to reference our extension's preferences, whi...
...s is configured by startup() to reference our extension's preferences, while tickerSymbol indicates the stock symbol to monitor. The first thing the startup() function does is to get a reference to the preferences for our extension. This is done in two steps: First, we get the Preferences service. This component handles preference management for Firefox and any extensions. Second, we call
nsIPrefService.getBranch(). This lets us specify a specific branch of the preference tree to access. By default, we would have access to all preferences, but we only want access to those belonging to our own extension, so we specify that we want to access the "extensions.stockwatcher2" branch. After getting the preference branch for our extension, we call the nsISupports.QueryInterface() method on it t...
...And 3 more matches
Chapter 4: Using XPCOM—Implementing advanced processes - Archive of obsolete content
r eucjp_str = converter.ConvertFromUnicode(unicode_str); Converting from other encodings to Unicode Listing 18 shows how to do the reverse, converting from text saved as ISO-2022-JP to Unicode. Listing 18: Converting text from ISO-2022-JP to Unicode converter.charset = 'ISO-2022-JP'; var unicode_str = converter.ConvertToUnicode(iso2022jp_str); Reading and writing preferences You can use the
nsIPrefBranch function to access Firefox's preferences system. This function can get and set preferences with three types of values: Boolean, integer, and text; there are specific methods for each, as shown in Table 2. Reading preferences Listing 19 shows how to get a text string stored in the preferences. Type about:config into the location bar to confirm that the value has been stored correctly. Not...
... Firefox's preferences system. This function can get and set preferences with three types of values: Boolean, integer, and text; there are specific methods for each, as shown in Table 2. Reading preferences Listing 19 shows how to get a text string stored in the preferences. Type about:config into the location bar to confirm that the value has been stored correctly. ...
...ut:config into the location bar to confirm that the value has been stored correctly. Note: The value returned by
nsIPrefBranch.getCharPref() is a UTF-8 bytestring; here, we are converting it to UTF-16 using escape() and decodeURIComponent(). Listing 19: Reading a text-string setting var pref = Components.classes['@mozilla.org/preferences-service;1'] .getService(Components.interfaces.
nsIPrefBranch); var dir = pref.getCharPref('browser.download.lastDir'); alert(decodeURIComponent(escape(dir))); Writing preferences Listing 20 shows the opposite operation, writing a text string to a unique preference. ...
...e;1'] .getService(Components.interfaces.
nsIPrefBranch); var dir = pref.getCharPref('browser.download.lastDir'); alert(decodeURIComponent(escape(dir))); Writing preferences Listing 20 shows the opposite operation, writing a text string to a unique preference. Again, you can use about:config to check that the value has been stored correctly. Note: The value for the second parameter of
nsIPrefBranch.setCharPref() is a UTF-8 bytestring; here, we are converting a UTF-16 to UTF-8 using unescape() and encodeURIComponent(). Listing 20: Writing a text-string setting var string = 'This is test.'; pref.setCharPref('extensions.myextension.testPref', unescape(encodeURIComponent(string))); Data type Get Set Boolean getBoolPref(prefname) setBoolPref(prefname) ...
Handling Preferences - Archive of obsolete content
ce names with "extensions", followed by some namespacing and finally the actual name of the preference. Name parts are normally separated by dots. Now let's look at how we actually manage the preference values. Managing preferences with XPCOM We use the Preferences Service in order to get and set preference values: this._prefService = Cc["@mozilla.org/preferences-service;1"].getService(Ci.
nsIPrefBranch); // ... get count() { return this._prefService.getIntPref("extensions.xulschoolhello.message.count"); }, increment : function() { let currentCount = this._prefService.getIntPref("extensions.xulschoolhello.message.count"); this._prefService.setIntPref("extensions.xulschoolhello.message.count", currentCount + 1); } One important thing to keep in mind is that the "get" methods o...
...et" methods of the service can throw an exception if the preference is not found. If you are going to use XPCOM, you should always set a default value to your preferences, or use a try / catch block to prevent unhandled errors. Preference listeners The XPCOM way to add a listener was mentioned in the XPCOM section when describing the QueryInterface method: this._prefService.QueryInterface(Ci.
nsIPrefBranch2); this._prefService.addObserver(prefName, this, false); this._prefService.QueryInterface(Ci.
nsIPrefBranch); All the QI'ing is necessary because the addObserver method is in a different interface, and other than for adding and removing observers, we use the
nsIPrefBranch interface for everything related to preferences. Then, create the observer method: observe : function(aSubject, aT...
...Since there are some subtleties related to preference management, there are some facilities provided in XUL and Firefox that make this much easier to deal with. ...
Index
Reference(2), XPCOM The XPCOM Observer Service. 157 nsScriptableInputStream Components, Components:Frozen, XPCOM, XPCOM API Reference A component implementing nsIScriptableInputStream. 158 XPCOM Interface Reference XPCOM, XPCOM Interface Reference This is a reference to the XPCOM interfaces provided by the Mozilla platform. 159 Component;
nsIPrefBranch Interfaces, Interfaces:Scriptable, Web Development, XPCOM, XPCOM API Reference, XPCOM Api article, XPCOM Interface Reference This object is created with a "root" value which describes the base point in the preferences "tree" from which this "branch" stems. Preferences are accessed off of this root by using just the final portion of the preference. For example, if this object is cr...
...acesView Developing Mozilla, Interfaces, Places, XPCOM The nsIPlacesView interface provides a view-agnostic way to access information about a Places view. 829 nsIPluginHost Interfaces, Interfaces:Scriptable, NeedsContent, Reference, Reference(2), XPCOM, XPCOM Interface Reference To create temp file with Content len header in, it will use by http POST. 830
nsIPrefBranch2 Interfaces, Interfaces:Scriptable, XPCOM, XPCOM API Reference, XPCOM Interface Reference Add a preference change observer. On preference changes, the following arguments will be passed to nsIObserver.observe(): 831
nsIPrefLocalizedString Interfaces, Interfaces:Scriptable, Preferences, XPCOM, XPCOM Interface Reference Used to set the contents of this object. ...
...terfaces, Interfaces:Scriptable, XPCOM, XPCOM API Reference, XPCOM Interface Reference Add a preference change observer. On preference changes, the following arguments will be passed to nsIObserver.observe(): 831
nsIPrefLocalizedString Interfaces, Interfaces:Scriptable, Preferences, XPCOM, XPCOM Interface Reference Used to set the contents of this object. 832
nsIPrefService Interfaces, Interfaces:Scriptable, XPCOM, XPCOM API Reference, XPCOM Interface Reference Call to get a Preferences "Branch" which accesses user preference data. Using a Set method on this object will always create or set a user preference value. When using a Get method a user set value will be returned if one exists, otherwise a default value will be returned. 833 nsIP...
JS XPCOM - Archive of obsolete content
.createInstance(Components.interfaces.nsIFile); file.initWithPath(filePath); This creates a new instance of the object with contract ID @mozilla.org/file/local;1 and allows you to call methods from the nsIFile interface on it. Getting an XPCOM service var preferences = Components.classes["@mozilla.org/preferences-service;1"] .getService(Components.interfaces.
nsIPrefService); You can then call any methods in the
nsIPrefService interface on the preferences object. Getting a different interface for a component Some components implement more than one interface. Sometimes JavaScript is clever enough to know all the interfaces available on a component, but in most cases you will have to explicitly check for an interface. With the preferences service from the p...
... a different interface for a component Some components implement more than one interface. Sometimes JavaScript is clever enough to know all the interfaces available on a component, but in most cases you will have to explicitly check for an interface. With the preferences service from the previous example we can do the following: var preferences = preferences.QueryInterface(Components.interfaces.
nsIPrefBranch2); This allows you to use the methods in the
nsIPrefBranch2 interface. Determining which interfaces an XPCOM component supports To display a list of all interfaces that an XPCOM component supports, do the following: // |c| is the XPCOM component instance for each (i in Components.interfaces) { if (c instanceof i) { alert(i); } } In this context, instanceof is the same as QueryInterfa...
Using workers in extensions - Archive of obsolete content
relatively minor, but crucial. The startup() method This method is called when the extension is first loaded, and needs to be updated to start up and configure the worker. ...
...aded, and needs to be updated to start up and configure the worker. Let's take a look: startup: function() { // Register to receive notifications of preference changes this.prefs = Components.classes["@mozilla.org/preferences-service;1"] .getService(Components.interfaces.
nsIPrefService) .getBranch("stockwatcher2."); this.prefs.QueryInterface(Components.interfaces.
nsIPrefBranch2); this.prefs.addObserver("", this, false); this.tickerSymbol = this.prefs.getCharPref("symbol").toUpperCase(); this.worker = new Worker("chrome://stockwatcher2/content/ticker_worker.js"); // Small little dance to get 'this' to refer to StockWatcher, not the // worker, when a message is received. var self = this; this.worker.onmessage = function(event) { ...
Embedding API for Accessibility
s related to accessibility. For the most part, an automatic reframe is performed when one of these prefs is changed. A reframe fixes the appearance of the page to match the new prefs, without reloading the document over the network. ...
... most part, an automatic reframe is performed when one of these prefs is changed. A reframe fixes the appearance of the page to match the new prefs, without reloading the document over the network. ...
Overview of Mozilla embedding APIs
NCONTENTTYPEHANDLER_CONTRACTID Implemented Interfaces: nsIUnknownContentTypeHandler HelperApp Launch Dialog Contract-id: NS_EXTERNALHELPERAPPSERVICE_CONTRACTID Implemented Interfaces: nsIExternalHelperAppService Preferences Service The Preferences service provides access to persistent data stored within a user's profile directory. Contract-id: NS_PREF_CONTRACTID Implemented Interfaces:
nsIPrefService
nsIPrefBranch Related Interfaces:
nsIPrefListener Profile Manager Service Contract-id: Implemented Interfaces: Document Loader Service (WebProgress) Eventually, this service will be replaced by theWebProgress service... Contract-id: NS_DOCUMENT_LOADER_SERVICE_CONTRACTID Implemented Interfaces: nsIWebProgress nsIDocumentLoader Related Interfaces: nsIWebProgressListener Publ...
...tion: nsIWebBrowserFind.idl nsIWebBrowserFocus This interface provides access to the focus information of a nsWebBrowser instance. Interface status... being reviewed Interface definition: nsIWebBrowserFocus.idl nsIWebProgress Interface status... Interface definition: nsIWebProgressListener Interface status... Interface definition: nsIPrompt Interface status... Interface definition:
nsIPrefs Interface status... Interface definition: nsIProfile The Profile Manager creates and manages user profiles; each profile is essentially a complete configuration of the application, including preferences, installed extensions, and so forth. nsIDirectoryServiceProvider Interface status... Interface definition: nsILocalFile Interface status... Interface definition: nsIFile Interface sta...
XPCOM Interface Reference
This is a reference to the XPCOM interfaces provided by the Mozilla platform. ...
...ryResultObservernsINavHistoryResultTreeViewernsINavHistoryResultViewObservernsINavHistoryResultViewernsINavHistoryServicensINavHistoryVisitResultNodensINetworkLinkServicensIObservernsIObserverServicensIOutputStreamnsIOutputStreamCallbacknsIParentalControlsServicensIParserUtilsnsIPasswordnsIPasswordManagernsIPermissionnsIPermissionManagernsIPipensIPlacesImportExportServicensIPlacesViewnsIPluginHost
nsIPrefBranch2
nsIPrefLocalizedString
nsIPrefServicensIPrincipalnsIPrinterEnumeratornsIPrintingPromptnsIPrivateBrowsingServicensIProcessnsIProcess2nsIProcessScriptLoadernsIProfilensIProfileLocknsIProfileUnlockernsIProgrammingLanguagensIProgressEventSinknsIPromptnsIPromptServicensIPropertiesnsIPropertynsIPropertyBagnsIPropertyBag2nsIPropertyElementnsIProtocolHandlernsIProtocolProxyCallbacknsIProtocolProxyFi...
Using nsIXULAppInfo - Archive of obsolete content
getAppID() { var id; if("@mozilla.org/xre/app-info;1" in Components.classes) { // running under Mozilla 1.8 or later id = Components.classes["@mozilla.org/xre/app-info;1"] .getService(Components.interfaces.nsIXULAppInfo).ID; } else { try { id = Components.classes["@mozilla.org/preferences-service;1"] .getService(Components.interfaces.
nsIPrefBranch) .getCharPref("app.id"); } catch(e) { // very old version dump(e); } } return id; } alert(getAppID()); See also MXR: nsIXULAppInfo.idl ...
XUL Questions and Answers - Archive of obsolete content
dd and remove values to/from, set up inside a <prefwindow> container to handle the preference? <prefwindow> can contain any control, just like a regular window. Some of them can be tied to a preference so that the preference is automatically updated as the control is manipulated. Others, like <listbox>, cannot be so tied, but one can always write a script that updates preferences explicitly, via
nsIPrefBranch interface. Can a XUL template be used for RSS? You should be able to use a XUL template to display feeds, although you may have to write the feed data to an RDF datasource first. Specifying window.onload function To specify a function to run when the window is loaded,add the following code between the script tags in the XUL file: window.addEventListener("load", function(e) { startu...
browser - Archive of obsolete content
ko 12.0 (Firefox 12.0 / Thunderbird 12.0 / SeaMonkey 2.9). homePage Type: string home page URL This property holds the value of the user's home page setting. markupDocumentViewer Type: nsIMarkupDocumentViewer This read-only property contains the nsIMarkupDocumentViewer which is responsible for drawing the document. preferences Type:
nsIPrefService This read-only property contains an
nsIPref object for getting and setting user preferences. securityUI Type: nsISecureBrowserUI The read-only property holds an object which may be used to determine the security level of the loaded document. sessionHistory Type: nsISHistory This read-only property contains the nsISHistory object which ...
preference - Archive of obsolete content
erence in the currently open dialog. There's a special case of value === undefined, indicating that the preference does not have a user-set value (hasUserValue == false). In this case the actual value to be displayed in the UI is obtained from the defaultValue property. valueFromPreferences Gets and sets the value stored in the user preference, specified in name. (This always accesses the
nsIPrefBranch APIs regardless of the instantApply mode in effect). Methods reset() Return type: no return value Resets the preference to its default value. For a textbox it also clears the undo transaction list (Gecko 1.9). type getElementValue(in DOMElement element); Retrieves the value that should be written to preferences based on the current state of the supplied ...
preferences - Archive of obsolete content
ts. Note: it's not clear which of the following methods and properties are public. Examples <preferences> <preference id="pref_one" name="extensions.myextension.one" type="bool"/> <preference id="pref_two" name="extensions.myextension.two" type="string"/> ... etc ... </preferences> Attributes These ought to be readonly; three of these could be merged into a single member attribute
nsIPrefService service; The preferences service. attribute
nsIPrefBranch rootBranch; The root prefs branch. attribute
nsIPrefBranch defaultBranch; The root branch of the tree with default values. attribute
nsIPrefBranch2 rootBranchInternal; The root prefs branch (
nsIPrefBranch2). Inherited from XUL element align, allowevents, allownegativeassertions, class, coalesceduplicatearcs, collaps...
Interfacing with the Add-on Repository
Firefox 4, the recommendation API doesn't work because the preference for the URL to query to get recommended add-ons is not included by default; see bug 628785. ...
Services.jsm
anager service metro nsIWinMetroUtils 2 mm nsIMessageBroadcaster nsIFrameScriptLoader Global frame message manager3 obs nsIObserverService Observer service perms nsIPermissionManager Permission manager service ppmm nsIMessageBroadcaster nsIProcessScriptLoader Global parent process message manager3 prefs
nsIPrefBranch
nsIPrefBranch2
nsIPrefService Preferences service prompt nsIPromptService Prompt service scriptloader mozIJSSubScriptLoader JavaScript subscript loader service scriptSecurityManager nsIScriptSecurityManager Script security manager search nsIBrowserSearchService Browser search service startup nsIAppStartup ...
Preferences API
preferences, user overrides via user.js, and locking. You can also create a XUL-based options window easily to allow user modify some preferences. Many applications including Firefox and Thunderbird have an additional tool for power users, about:config, which can be used to tweak the preferences without UI. Interfaces The preferences API is exposed as a set of XPCOM components and interfaces:
nsIPrefService,
nsIPrefBranch. ... See also Code snippets:Preferences (more detailed discussion with multiple examples) ...
nsIContentSniffer
equest where this data came from. May be null. aData Data to check. aLength Length of the data. Return value The content type. Example How to read content from aData. ...
XPCOM Interface Reference by grouping
nsIDNSService nsIFTPChannel nsIFTPEventSink nsIHttpChannel nsIHttpChannelInternal nsIHttpHeaderVisitor nsIIDNService nsIProtocolHandler nsIProtocolProxyCallback nsIProtocolProxyFilter nsIProtocolProxyService nsIProxyInfo Preferences nsIINIParser nsIINIParserFactory
nsIPrefBranch
nsIPrefBranch2
nsIPrefLocalizedString
nsIPrefService nsIStringBundle nsIStringBundleService Security Cookies nsICookie nsICookie2 nsICookieAcceptDialog nsICookieConsent nsICookieManager nsICookieManager2 nsICookiePermis...
Get Thunderbird version
0b4 else // code for < 3.0b4 For versions prior to 3.0b3pre, you can use something like this: var version; if ( "@mozilla.org/xre/app-info;1" in Components.classes ) version = Components.classes["@mozilla.org/xre/app-info; 1"].getService(Components.interfaces.nsIXULAppInfo).version; else version = Components.classes["@mozilla.org/preferences-service; 1"].getService(Components.interfaces.
nsIPrefBranch).getCharPref ("app.version"); var versionChecker = Components.classes["@mozilla.org/xpcom/version- comparator;1"].getService(Components.interfaces.nsIVersionComparator); if ( versionChecker.compare( version, "3.0b3" ) >= 0 ) // code for >= 3.0b3 else // code for < 3.0b3 ...