XULRunner tips

  • Revision slug: XULRunner_tips
  • Revision title: XULRunner tips
  • Revision id: 109123
  • Created:
  • Creator: Wladimir_Palant
  • Is current revision? No
  • Comment /* Making Windows display correct application name and icon when buttons are grouped */ icon can be added to xulrunner-stub

Revision Content

XULRunner Frequently Asked Questions. Work in progress.

Extension Manager

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/xpinstallConfirm.xul");
pref("xpinstall.dialog.progress.skin", "chrome://mozapps/content/extensions/extensions.xul?type=themes");
pref("xpinstall.dialog.progress.chrome", "chrome://mozapps/content/extensions/extensions.xul?type=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/extensions.properties");
pref("extensions.getMoreExtensionsURL", "chrome://mozapps/locale/extensions/extensions.properties");
pref("extensions.getMoreThemesURL", "chrome://mozapps/locale/extensions/extensions.properties");

Useful Chrome URLs

Most of these require branding.

WindowURLWindow Type
Extension Manager chrome://mozapps/content/extensions/extensions.xul?type=extensions Extension:Manager-extensions
Theme Manager chrome://mozapps/content/extensions/extensions.xul?type=themes Extension:Manager-themes
JavaScript Console chrome://global/content/console.xul global:console
about:config chrome://global/content/config.xul

Developer Extensions

--Tlaurenzo 17:34, 17 March 2006 (PST)There is another way to go about this. See my blog post for a working method to get Venkman and the Extension Developer's Extension working in XULRunner apps.

Venkman

  • Need a custom build or a compatible extension <is there downloadable venkman/domi for 1.8.0.1?>
  • 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?
  • Anything else?

DOM Inspector

Same as venkman

Component Viewer

Need custom build, first of all. What else?

Extension Developer's Extension

Extension Developer's Extension is a useful tool, featuring Live XUL Editor and JavaScript Shell.

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

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 ''~.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:
    WIN32_MODULE_DESCRIPTION=MyApplication

    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. Note: trunk builds of xulrunner-stub currently fail on Windows due to bug 386152.

Reading command line arguments

See Chrome: Command Line. Command line arguments are handled via nsICommandLineHandler as usual.

= Can i have JavaScript errors / warnings directed to stdout instead of the jsconsole? = See {{mediawiki.external('https://bugzilla.mozilla.org/show_bug.cgi?id=306263 #306263')}} This doesn't do anything (1.8.0.1): xulrunner -app application.ini -console This neither (1.8.0.1) in ''defaults/preferences/«application name».js'': pref("javascript.options.strict", true); pref("javascript.options.showInConsole", true); pref("browser.dom.window.dump.enabled", true);


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/unknownContentType.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");

Troubleshooting

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>.

Revision Source

<p>
XULRunner Frequently Asked Questions. Work in progress.
</p>
<h2 name="Extension_Manager">Extension Manager</h2>
<p>To be able to install any extensions, you first need to enable the Extension Manager in <a href="en/XUL_Application_Packaging#em">application.ini</a>. 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:
</p>
<pre class="eval">pref("xpinstall.dialog.confirm", "chrome://mozapps/content/xpinstall/xpinstallConfirm.xul");
pref("xpinstall.dialog.progress.skin", "chrome://mozapps/content/extensions/extensions.xul?type=themes");
pref("xpinstall.dialog.progress.chrome", "chrome://mozapps/content/extensions/extensions.xul?type=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/extensions.properties");
pref("extensions.getMoreExtensionsURL", "chrome://mozapps/locale/extensions/extensions.properties");
pref("extensions.getMoreThemesURL", "chrome://mozapps/locale/extensions/extensions.properties");
</pre>
<h2 name="Useful_Chrome_URLs">Useful Chrome URLs</h2>
<p>Most of these require branding.
</p>
<table class="standard-table">
<tbody><tr><th>Window</th><th>URL</th><th>Window Type
</th></tr><tr><td>Extension Manager
</td><td>chrome://mozapps/content/extensions/extensions.xul?type=extensions
</td><td>Extension:Manager-extensions
</td></tr><tr><td>Theme Manager
</td><td>chrome://mozapps/content/extensions/extensions.xul?type=themes
</td><td>Extension:Manager-themes
</td></tr><tr><td>JavaScript Console
</td><td>chrome://global/content/console.xul
</td><td>global:console
</td></tr><tr><td>about:config
</td><td>chrome://global/content/config.xul
</td><td>
</td></tr></tbody></table>
<h2 name="Developer_Extensions">Developer Extensions</h2>
<p>--<a href="User:Tlaurenzo">Tlaurenzo</a> 17:34, 17 March 2006 (PST)There is another way to go about this.  See my <a class="external" href="http://tjlaurenzo.blogspot.com/2006/03/getting-dev-tools-working-with.html">blog post</a> for a working method to get Venkman and the Extension Developer's Extension working in XULRunner apps.
</p>
<h3 name="Venkman"> <a href="en/Venkman">Venkman</a> </h3>
<ul><li>Need a custom build or a compatible extension &lt;is there downloadable venkman/domi for 1.8.0.1?&gt;
</li><li>Need to edit compatibility in <i>install.rdf</i> to match the id and versions in application.ini
</li><li>Needs a method to start venkman (usually by overlaying the main XUL file, similar to existing code for Firefox, Suite, etc.)
</li><li>The function toOpenWindowByType() needs to be defined. I found a working stub on <a class="external" href="http://tjlaurenzo.blogspot.com/2006/03/getting-dev-tools-working-with.html">this blog</a>. Any better suggestion?
</li><li>Anything else?
</li></ul>
<h3 name="DOM_Inspector"> <a href="en/DOM_Inspector">DOM Inspector</a> </h3>
<p>Same as venkman
</p>
<h3 name="Component_Viewer"> Component Viewer </h3>
<p>Need custom build, first of all. What else?
</p>
<h3 name="Extension_Developer.27s_Extension"> Extension Developer's Extension </h3>
<p><a class="external" href="http://ted.mielczarek.org/code/mozilla/extensiondev/">Extension Developer's Extension</a> is a useful tool, featuring Live XUL Editor and JavaScript Shell.
</p><p>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.
</p>
<h2 name="Branding"> Branding  </h2>
<p>Branding is a <a href="en/Chrome_Registration">chrome package</a> containing product-specific information (e.g. the product name, vendor, and logo).
</p><p>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>.
</p><p>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 <a href="en/Chrome_Registration#locale">register a locale provider</a> for <tt>branding</tt> by adding the following line to your chrome manifest:
</p>
<pre class="eval">locale branding en-US chrome/locale/branding/
</pre>
<p>The location you put the branding files in doesn't matter, as long as you register it appropriately in the manifest.
</p><p><span class="comment">In ''~.mozconfig'':  ac_add_options --enable-branding=« branding location »</span>
</p>
<h3 name="Making_Windows_display_correct_application_name_and_icon_when_buttons_are_grouped"> Making Windows display correct application name and icon when buttons are grouped </h3>
<p>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:
</p>
<ul>
<li>
When compiling XULRunner yourself: create a file module.ver in the directory mozilla/xulrunner/app with the contents:
<pre>WIN32_MODULE_DESCRIPTION=MyApplication</pre>
<p>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.
</p>
</li>
<li>
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 <a class="external" href="http://www.angusj.com/resourcehacker/">Resource Hacker</a>. Note: trunk builds of xulrunner-stub currently fail on Windows due to <a class="external" href="https://bugzilla.mozilla.org/show_bug.cgi?id=386152">bug 386152</a>.
</li>
</ul>
<h2 name="Reading_command_line_arguments"> Reading command line arguments </h2>
<p>See <a href="en/Chrome/Command_Line">Chrome: Command Line</a>.  Command line arguments are handled via nsICommandLineHandler as usual.
</p><p><span class="comment">= Can i have JavaScript errors / warnings directed to stdout instead of the jsconsole? =  See {{mediawiki.external('https://bugzilla.mozilla.org/show_bug.cgi?id=306263 #306263')}}  This doesn't do anything (1.8.0.1):  xulrunner -app application.ini -console  This neither (1.8.0.1) in ''defaults/preferences/«application name».js'':  pref("javascript.options.strict", true);  pref("javascript.options.showInConsole", true);  pref("browser.dom.window.dump.enabled", true);</span>
</p><p><br>
</p>
<h2 name="Preferences_needed_for_file_download_dialogs"> Preferences needed for file download dialogs </h2>
<p>To use the unknown-content-type and file-downloads dialogs from a &lt;browser&gt; element, you need to add the following prefs:
</p>
<pre class="eval">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);
</pre>
<p>If you are missing preferences that a dialog requires, you will get the following errors:
</p>
<pre class="eval">Component returned failure code: 0x8000ffff (NS_ERROR_UNEXPECTED) [nsIPrefBranch.getBoolPref]

Error: dialog has no properties
Source File: chrome://mozapps/content/downloads/unknownContentType.xul
Line: 1
</pre>
<p><br>
</p>
<h2 name="Enabling_Password_Manager"> Enabling Password Manager </h2>
<p>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.
</p>
<pre class="eval">pref("signon.rememberSignons", true);
pref("signon.expireMasterPassword", false);
pref("signon.SignonFileName", "signons.txt");
</pre>
<h2 name="Troubleshooting"> Troubleshooting </h2>
<h3 name="Window_title_missing"> Window title missing </h3>
<p>If the title of your XUL <code>&lt;<a href="en/XUL/window">window</a>&gt;</code> 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>.
</p>
Revert to this revision