Don't code everything from scratch: reuse bits and pieces of Firefox.
In the install area, inside the chrome directory, lies the toolkit.jar archive. This is the starting point for all XUL pages and therefore for all extensions and chrome applications. It consists of a number of pieces.
This toolkit.jar file changed a small amount when it was updated from the Mozilla Application Suite (1.x) to Firefox. Because that change involved renaming and was advertised in a number of influential places, some people assumed that there would be significant compatibility issues. This is not the case. The most important files in toolkit.jar have changed very little, so there is substantial and extensive compatibility with other Mozilla-based products. There is 100 percent compatibility with Thunderbird and Nvu, at least. Furthermore, the toolkit.jar file is just a file, and it is easy for extensions to specialize or override portions of it with their own tailored files. There is therefore no reason to consider this file an immovable requirement. It is just a well-tested and convenient starting point.
global package has special status in the chrome. ...