New APIs for Mozilla's JetPack: tabs, selection and Ajax
Only about a month after releasing JetPack 0.4, Mozilla has issued the next version of its new plug-in technology framework. Its new features include, for example, interfaces for accessing browser tabs and current text selections and support for automatically translating character strings.
One of the core components of version 0.5 is the Request API, which encapsulates
onComplete property, provided the parser recognises correct responses for this format. Unlike classic Ajax functions, these
request objects are not bound by the "same origin" rule which means they can be used with arbitrary URLs.
The Tabs API allows developers to open, close and move browser tabs as well as respond to such events as
onActivate. Properties provide access to information such as the title, the favicon and a preview of the page displayed in the tab. The selection module offers methods for getting and setting current selections, as well as an
onSelect property; JetPack invokes the callbacks stored in this property when a user has completed a selection.
The Localization API is to provide plug-in developers with an easy way of displaying their extensions in a user's selected language. However, very few details on using it have been documented. The JetPack source code reveals that the translated strings are to be provided by a server at mozillalabs.com which receives the current locale and plug-in ID as parameters in a
XMLHttpRequest. Once they are downloaded, the framework stores the translations locally.
More details about JetPack 0.5 can be found in the release notes. JetPack is available to download (direct download) from the project's FTP server. Developers need Python 2.5 and a current version of the Firefox browser to make use of the SDK.