Visit Mozilla.org

Extension Etiquette

From MDC

This article describes best practices (and how to be kind to your users) when making extensions. It assumes that you are already familiar with Building an Extension.

This is not an official document. Feel free to discuss it on the talk page.

Contents

[edit] Tools Menu Items

Extension authors have the most choices with this option. Whether extensions should go at the top of the Tools menu, at the bottom, or somewhere in between is a matter of author opinion, although ideally, the location would be below the Add-ons item, grouped with the other extension-related commands (menuitem:insertafter="javascriptConsole,devToolsSeparator"). Sub-menus should be used for single extensions needing multiple menu items, and a Tools menu item should not be created for options and preferences (for options and preferences, see the add-on manager.) If possible, create a menu item in the menu where it is most applicable; for instance, a bookmark sharing extension should be called from the Bookmarks menu. To maintain the default theme, avoid the use of an icon next to the menu items.

[edit] Other UI Elements

In general, toolbar items are very useful to end users, because they can be removed or added to various toolbars as necessary. Status bar items should only be added for extensions that need constant monitoring, such as ad blocking, page ranking, or cookie management. Likewise, use context menu items sparingly — only for tasks that are done frequently or on specific elements of a web page.

[edit] About Dialogs

There is a default popup About dialog that is created from install.rdf data; creating a new XUL About box is usually unnecessary. You can decrease download size by omitting a customized About box; make one only if you have a special feature that needs to be included (such as a custom updater).

[edit] Theming

If you have XUL buttons in your extension that do functions similar to ones that already exist in a browser (for instance, a feed reader that reloads and stops), use icons from the browser's theme. This makes the extension lighter, in addition to providing more consistency (especially for users using different themes).

[edit] Extension Icons

Unique icons are usually worth their download weight. They allow for easy identification among other extensions in the Extensions manager.

[edit] Naming

Be creative! Just don't include "extension," "Mozilla/Firefox/Thunderbird," or the version number in the name — it's redundant.

[edit] Descriptions

Make something that is descriptive, but would fit in the default add-on manager width. The Mozilla extensions (Inspector/Reporter/Talkback) seem to believe that starting with a verb is the best way — something like "Does an action in the browser."

[edit] IDs

Firefox/Thunderbird 1.5 or later are much more strict about the IDs of extensions than their 1.0 counterparts. Make sure they're valid.

[edit] Version Numbering

Please follow the Mozilla pattern — major version dot current incarnation dot security/bugfix release (like 1.0.7).

[edit] Locales

Always use locale DTDs and property files, even if providing your extension in one language. It will make translation of your extension to another language easier (not an uncommon occurrence, in fact).

[edit] Preferences' Internal Names

Internal Firefox preference names (that is, the name of the preference as it appears in the about:config) for extensions should all start with "extensions.", then the name of the extension (with a dot), then the name of the preference. For instance, a boolean for the Reporter extension's option for hiding the privacy statement is "extensions.reporter.hidePrivacyStatement".

[edit] Dependencies

Requiring a user to download another extension in order to use yours isn't nice. jsLib may be an exception, but always try to avoid dependency on other extensions - especially extensions that you don't develop.

[edit] Documentation

Assume that the vast majority of your users don't have the knowledge of the inner workings of Mozilla that you do. Make sure your extension's homepage states the obvious. Also, remember it is appreciated when your extension is shipped with a simple howto.