Report Overview

Build Your Own Firefox Extension

Corrections & Typos

Found a mistake that’s not listed here? Contact us to let us know!

  • No known errors at this time

July 2009 Edition: Further Notes from the Author

Disabling the XUL cache

Even if you choose to develop by disabling the XUL cache and then opening new windows to see the changes, there are still some changes that require a restart before they take effect. Those which are known to the author are:

  • changes to data in .properties files
  • changes to default preferences (in the /defaults/preferences/myextension.js file)

On a related note, Firefox leaks memory like the proverbial sieve. The testing I did revealed that it leaks about 7MB of real memory for every single window that's created then closed again. So to avoid cumulative excessive memory use, if you're constantly closing and re-opening windows, you should still think about restarting every 20 times or thereabouts.

Property Values versus Attribute Values

Regarding the advice to use property values instead of attribute values when retrieving data from XUL elements—although this general advice stands, an exception to it is attributes which have boolean-esque values like checked="true" or selected="true". In these cases, reading back the property value will often give unexpected (and inexplicable!) results. For example, the .selected property of a <radio> element is always boolean true, irrespective of whether it's selected or not.

The rule of thumb for this kind of attribute then is to use getAttribute after all; the value will return "true" (a string, rather than a boolean) if it's checked, selected, or whatever, and "" (the empty string) if unchecked.



Disabled Purchase button

SitePoint Books

  • advocate best practice techniques
  • lead you through practical examples
  • provide working code for your web site
  • make learning easy and fun

100% Money Back Guarantee