Mobile/Fennec/Extensions/Options
Fennec uses special <setting> XUL tags to create it's list of options (preferences). Add-ons must use the same tags. The options are merged into the Fennec Add-on Manager, not displayed as a popup dialog. Of course, add-ons can support more than one application, so we need to make sure that the options XUL for Fennec can coexist with the options XUL for other applications. Let's take a look at how this all works:
Install Manifest
Add-ons use install.rdf to identify the XUL used for displaying the options. This is optional.
<code> <em:optionsURL>chrome://myaddon/content/options.xul</em:optionsURL> </code>
This is needed for any add-on that wants to use an options dialog.
Chrome Manifest
Add-ons use the chrome manifest to selectively override XUL, and other resources, between different applications using the application flags
<code>
override chrome://myaddon/content/options.xul chrome://myaddon/content/fennec-options.xul application={a23983c0-fd0e-11dc-95ff-0800200c9a66}
</code>
This will tell Mozilla to use fennec-options.xul anytime the options.xul resource is requested.
Options XUL
The XUL allowed for the Fennec options system is limited to a few new tags. Here is an example of a Fennec options dialog:
<code>
<?xml version="1.0"?>
<!DOCTYPE mydialog SYSTEM "chrome://myextension/locale/mydialog.dtd">
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<setting pref="extensions.myaddon.debugging" type="boolint" on="1" off="2" title="Enable debugging"/>
<setting pref="extensions.myaddon.profiling" type="bool" title="Enable profiling">
Profiling can affect the performance of the application
</setting>
<setting pref="extensions.myaddon.logging" type="bool" title="Save logs"/>
<setting pref="extensions.myaddon.logging.path" type="string" title="Log folder"/>
<setting type="button" title="Clear logs">
<button label="Clear" oncommand="MyAddon.clearLogs();"/>
</setting>
</vbox>
</code>
Note that there isn't any <script> support and it's limited to <setting> tags. The root <vbox> just acts as a container, it isn't merged into the main window. Here is how the options look in Fennec: