XULRunner Frequently Asked Questions. Work in progress.
To be able to install any extensions, you first need to enable the Extension Manager in application.ini. XULRunner 1.8.0 does not load extensions from the application directory; only the XULRunner directory and the user profile directory are checked. The following prefs must also be set to make the XPInstall dialog, extension manager, and theme manager work:
pref("xpinstall.dialog.confirm", "chrome://mozapps/content/xpinstall/x...allConfirm.xul"); pref("xpinstall.dialog.progress.skin", "chrome://mozapps/content/extensions/...ul?type=themes"); pref("xpinstall.dialog.progress.chrome", "chrome://mozapps/content/extensions/...ype=extensions"); pref("xpinstall.dialog.progress.type.skin", "Extension:Manager-themes"); pref("xpinstall.dialog.progress.type.chrome", "Extension:Manager-extensions"); pref("extensions.update.enabled", true); pref("extensions.update.interval", 86400); pref("extensions.dss.enabled", false); pref("extensions.dss.switchPending", false); pref("extensions.ignoreMTimeChanges", false); pref("extensions.logging.enabled", false); pref("general.skins.selectedSkin", "classic/1.0"); // NB these point at AMO pref("extensions.update.url", "chrome://mozapps/locale/extensions/e...ons.properties"); pref("extensions.getMoreExtensionsURL", "chrome://mozapps/locale/extensions/e...ons.properties"); pref("extensions.getMoreThemesURL", "chrome://mozapps/locale/extensions/e...ons.properties");
Useful Chrome URLs
Most of these require branding.
- Need a custom build or a compatible extension
- Need to edit compatibility in install.rdf to match the id and versions in application.ini
- Needs a method to start venkman (usually by overlaying the main XUL file, similar to existing code for Firefox, Suite, etc.)
- The function toOpenWindowByType() needs to be defined. I found a working stub on this blog. Any better suggestion?
- Venkman uses "chrome://communicator/skin/" as an alias for "chrome://global/skin/" and this alias was maintained in the XULRunner toolkit until XULRunner 1.9 was released. When using XULRunner 1.9 or greater, you can create your own alias"
in your chrome manifest add a "skin" line: skin communicator classic/1.0 skin/communicator/ add a skin folder named "communicator" and add a single CSS file named "communicator.css" with this content: @import url("chrome://global/skin/");
Same as venkman
Need custom build, first of all. What else?
Extension Developer's Extension
To install the extension into your application you'll need to hack its install.rdf (see above). You'll probably also want to create menuitems that let you open the JS Shell and other tools provided by the extension.
Branding is a chrome package containing product-specific information (e.g. the product name, vendor, and logo).
Some XULRunner components (in particular, the Extension Manager) depend on branding, in the sense that they expect to find certain strings in <tt>chrome://branding/locale/brand.dtd</tt> and <tt>chrome://branding/locale/brand.properties</tt>.
In order to satisfy these dependencies, you can save Firefox's <tt>brand.dtd</tt>/<tt>brand.properties</tt> to <tt>chrome/locale/branding</tt> folder, modify them appropriately, and register a locale provider for <tt>branding</tt> by adding the following line to your chrome manifest:
locale branding en-US chrome/locale/branding/
The location you put the branding files in doesn't matter, as long as you register it appropriately in the manifest.
In addition, a branding content package must be registered to include the application logo:
content branding chrome/branding
2 icon files must provided in this folder : icon48.png and icon64.png. See Firefox for example.
In ''~.mozconfig'': ac_add_options --enable-branding=« branding location »
Making Windows display correct application name and icon when buttons are grouped
By default, the task bar on Windows might group windows belonging to the same process into one button to save space. This button is usually called "xulrunner.exe" and has XULRunner's icon. There are two approaches to display the branding of your application instead:
When compiling XULRunner yourself: create a file module.ver in the directory mozilla/xulrunner/app with the contents:
MyApplication should be replaced by whatever you want to see as title of the button. You can also replace xulrunner.ico in the same directory to change XULRunner's icon to the icon of your application.
- With a precompiled XULRunner: use xulrunner-stub.exe to start your application but rename it into MyApplication.exe. With XULRunner 1.9 this will make the desired name appear in the task bar (not with XULRunner 1.8 however). Your application's icon can also be added to this executable with a tool like Resource Hacker.
Reading command line arguments
See Chrome: Command Line. Command line arguments are handled via nsICommandLineHandler as usual.
Preferences needed for file download dialogs
To use the unknown-content-type and file-downloads dialogs from a <browser> element, you need to add the following prefs:
pref("browser.download.useDownloadDir", true); pref("browser.download.folderList", 0); pref("browser.download.manager.showAlertOnComplete", true); pref("browser.download.manager.showAlertInterval", 2000); pref("browser.download.manager.retention", 2); pref("browser.download.manager.showWhenStarting", true); pref("browser.download.manager.useWindow", true); pref("browser.download.manager.closeWhenDone", true); pref("browser.download.manager.openDelay", 0); pref("browser.download.manager.focusWhenStarting", false); pref("browser.download.manager.flashCount", 2); // pref("alerts.slideIncrement", 1); pref("alerts.slideIncrementTime", 10); pref("alerts.totalOpenTime", 4000); pref("alerts.height", 50);
If you are missing preferences that a dialog requires, you will get the following errors:
Component returned failure code: 0x8000ffff (NS_ERROR_UNEXPECTED) [nsIPrefBranch.getBoolPref] Error: dialog has no properties Source File: chrome://mozapps/content/downloads/u...ontentType.xul Line: 1
Enabling Password Manager
These preferences seem to be the default in Firefox, however, they are missing in XULRunner. Without these settings Password Manager will not store login details.
pref("signon.rememberSignons", true); pref("signon.expireMasterPassword", false); pref("signon.SignonFileName", "signons.txt");
You also need to get an instance of the login manager service, which internally initializes the system:
Using Firefox 3 to run XULRunner applications
Firefox 3 contains the XULRunner runtime. It has a <tt>-app</tt> command-line switch to run a specified XUL application instead of starting the browser. For example, on Windows:
firefox.exe -app path\to\application.ini
On the Mac:
/Applications/Firefox.app/Contents/MacOS/firefox-bin -app /path/to/application.ini
Note that at least on the Mac, you need to use a full path. Partial paths don't seem to work.
Window title missing
If the title of your XUL
<window> is blank, even though you specified a title attribute, make sure the extension on your XUL file is <tt>.xul</tt> rather than <tt>.xml</tt>.