I am developing (yet another) password manager add-on for Firefox. My add-on needs to:开发者_运维问答
- Add two context menu items to each password field.
- Open a dialog box or floating panel when the menu item is selected.
- Access a specific method of a specific XPCOM component.
- Fill the password field.
- Include a preferences window.
- Be compatible with Firefox 4.0.
Preferably, also:
- Run on Firefox 3.5 and 3.6.
- Some users don't update to the latest version.
- Firefox 4.0 won't run on a PowerPC Mac.
- Install without a restart on Firefox 4.0.
- Allow for localization.
I have tried the Add-on SDK (formerly known as Jetpack), and it makes it very easy to start developing. However, I find that HTML cannot easily create "native looking" dialog boxes and that the SDK is rather heavyweight. (It takes many kilobytes to build a simple extension; that includes an XPCOM component!)
What are the advantages and disadvantages of using the Add-on SDK to develop my Firefox extension? Is it ready for "serious" extension development?
Advantages:
Jetpack API exposes high level APIs for most of the things you mentioned:
- Add two context menu items
- floating panel
- API for password manager
Jetpack based add-ons are restart-less.
Jetpack based add-ons are future proof in a sense that high level APIs will remain unchanged for the coming versions of FF.
You may be able to use some community developed modules for APIs that are not exposed by SDK.
If this is not the last extension you're planning to build there is a potential for code reuse, by building third party modules as ones mentioned in 4 (see docs for details)
Support for mobile FF is coming in post 1.0 version of Addon-SDK which may mean that your extension can be made compatible with mobile version of FF with minimal to zero effort.
Jetpack comes with build-in unit testing framework.
Has a better security model, which will ease add-on review process.
Jetpack support commonjs modules / packages that which means that some of the code can be borrowed from other projects like nodejs for example.
Disadvantages:
- Jetpack no longer supports FF<4.
- Does not yet have support for localization.
- Has no API for building preference panels, but can be developed as third party module and shared with rest of the community.
- Add-on will contain code with layers of abstractions, that will increase size of add-on (there is ongoing work that will reduce xpi size by excluding files that are not used by add-on).
精彩评论