On MDN, the phrase "Add-on Manager-enabled XUL application" is introduced.
By dragging a XPI file containing an add-on and dropping it onto a FireFox window, the addon's widgets will be installed in FireFox's add-on bar.
I can also use Firefox to run a XUL application by specifying the commandline option "-app application.ini".
Since MDN makes me think that the two are not mutually exclusive, I'm looking for a simple 4 step process where steps 1 and 2 are create a XUL application and XPI independently, step 3 describes how to change either the XUL application or the XPI in preparation for step 4, and step 4 is final integration.
I'll start you off with steps 1 and 2, and then suggest some things that need to be done in steps 3 or 4.
Step 1: Build the XPI by following the tutorial at https://addons.mozilla.org/en-US/developers/docs/sdk/1.3/dev-guide/addon-development/implementing-simple-addon.html
Step 2: Build the XUL application by following the tutorial at https://developer.mozilla.org/en/Getting_started_with_XULRunner
Now for Steps 3 and 4. They should include modifying the application.ini built in step 2 by adding the code:
[XRE]
EnableExtensionManager=1
They should also include adding lines to prefs.js to support the extension manager. And they may require adding addon bar window element to XUL by adding code similar to:
<toolbarpalette id="BrowserToolbarPalette">
<toolbarbutton
id="xfox-statusbarpanel" class="toolbarbutton-1 chromeclass-toolbar-additional"
label="&name;"
tooltiptext="&name;"
oncommand="toggleSidebar('xfox-sidebar');"
context="xfox-contextmenu">
</toolbarbutton>
</toolbarpalette>
I've succeeded in making the "Add-on Manager-enabled XUL application" (aka <TestApp
>) accept the XPI (aka <wikipanel
>) and attempt to install it, but it fails with the error message: "<wikipanel
> could not be installed because it is not compatible with <TestApp version 1.0
>"
[edit] I editted INSTALL.RDF (for my XPI) and added the following:
<em:targetApplication>
<Description>
<em:id>testapp@sample.xul</em:id>
<em:minVersion>0.0</em:minVersion>
<em:maxVersion>9.*</em:maxVersion>
</Description>
</em:targetApplication>.
The extension now installs, but I am getting the following error in jsconsole:
Error: The widget module currently supports only Firefox. In the future it will support other applications. Please see https://bugzilla.mozilla.org/show_bug.cgi?id=560716 for more information.
I've found the answer but it is a bit of a hack and requires removing the following lines of code from the addon-kit javascript source:
if (!require("api-utils/xul-app").is("Firefox")) {
throw new Error([
"The widget module currently supports only Firefox. In the future ",
"it will support other applications. Please see ",
"https://bugzilla.mozilla.org/show_bug.cgi?id=560716 for more information."
].join(""));
}
Since the above code is specifically designed to prevent using the addon kit in anything other than bonafide Firefox, this avenue is not worth pursuing further. However, if there is a way to build a xul-app in such a way that it conforms to Firefox, then I will revisit the issue.
Firefox is chrome://browser/content/browser.xul after all.