Firefox addon. I'm porting an existing addon to a restartless one. I have a panel with a lot of UI elements (mostly boxes/description and images) in it, and it is very convenient for me to define the panel elements in an XUL overlay file. I will have lots of bloated js code if I don't.
The panel element (parent) itself is created in code dynamically, and then I use loadOverlay
, wait for the 'merged' event and then append the panel element's children from the overlayed document. I also make sure that the elements are cleaned up upon a remove.
However, using overlays will most probably won't pass an AMO review. And some of the reasons I think are :
- In most cases overlay elements will cause problems while removing (eg: toolbar buttons remembering their positions etc.)
- There are problems with attaching js/css files in an overlay file.
- loadOverlay is buggy (496320, 330458)
And here are my inferences :
- loadOverlay() API itself is not deprecated - in fact it is 'not frozen and may change later' - which means possibly it will be use-able in future.
- The bug that a second overlay load fails, is not applicable in my case, as I don't initialize without an overlay merge.
- Using static overlay for preference windows etc. is perfectly acceptable as of now.
- The panel in my case behaves a lot like a preference window (which is brought up on demand and cleaned up upon addon removal)
- I don't have any js/css attached to the overlay, nor any event listeners for the elements. The overlay is only used to define boxes and description text - nothing more.
So considering these, is it acceptable to use overlays and loadOverlay() for a restartless addon ? If not, is there an alternative ?