Changes

Jump to: navigation, search

Mobile/Fennec/Extensions/BestPractices

2,434 bytes added, 16:24, 22 May 2009
Created page with 'Fennec is designed to run on mobile devices with small screens, touch interfaces, small batteries and low-power CPUs. When building extensions for Fennec, you need to keep in min...'
Fennec is designed to run on mobile devices with small screens, touch interfaces, small batteries and low-power CPUs. When building extensions for Fennec, you need to keep in mind that actions or designs which have no consequence in desktop Firefox might be very bad in Fennec. This page describes practices or conventions that can help you make a Fennec extension that doesn't degrade the user experience.

== Delay Everything ==
It's very common for extensions to listener for the <code>window load</code> event and execute some initialization code. The problem with this is it can negatively affect startup time.
* Try to do a few things as possible in the <code>window load</code> event handler
* Delay any time-consuming code as much as possible.
** Wait until the user activates the extension's UI
** Wait for an explicit notification or event

== Screen Space is Valuable ==
Fennec is designed to maximize the available screen space. This is especially so for the content area. Remember that devices have landscape and portrait modes. Adding simple buttons to the URLbar or the sidebars could cause some primary buttons to get pushed offscreen. We also want to minimize clutter in the primary UI.
* Do not add buttons to the URLbar
* Minimize your extension's UI to the point of making it almost invisible

== Use Less Dialogs and Popups ==
Consider not using any dialogs. They are slow to load and can grow larger than the screen. Switching between portrait and landscape also makes it hard to find the right size.
* Don't use dialogs. Try to make good assumptions about situations and don't bother users. This is especially true for mobile user experience.
* If you really need user input - keep it extremely simple. Do not make elaborate dialogs.
** If your dialog uses <code><tabbox></code>, you lose.
** If your dialog has more than one label, one form control and three buttons, you lose.
* Use Alerts to notify the user that some event has happened.

== Assume Nothing is Safe ==
When creating or porting an extension for Fennec, you really can't assume anything you have done or learned about desktop extensions is safe (or fast) in Fennec. Even simple things like checking to see if a file exists or access DOM attributes can affect performance.

So, if your extension seems to affect overall performance, don't assume parts of your code are fast just because it's simple, written in C++ or works great on the desktop.
Canmove, confirm, emeritus
2,798
edits

Navigation menu