LWN.net Logo

Development

Jetpack: Firefox extensions as they should be

June 3, 2009

This article was contributed by Koen Vervloesem

One of the great strengths of Firefox is its extensions ecosystem. Over 12,000 enhancements for the browser are available, varying from additions of simple features to complete applications such as IRC or FTP clients. Many users just keep Firefox as their default browser because they can't live without specific extensions that don't exist in other browsers. This hackable nature of Firefox is something that Mark Surman of the Mozilla Foundation has emphasized countless times, for example in his keynote at FOSDEM 2009 a few months ago: only the ability to extend the web makes it truly the user's web.

Unfortunately, developing a Mozilla Firefox extension is far from easy. It requires a fair bit of knowledge of a strange mix of technologies: RDF (Resource Description Framework), XUL (XML User Interface Language), XPI (Cross-Platform Installer), XPConnect, XPCOM (Cross-Platform Component Object Model), DOM (Document Object Model), JavaScript and CSS (Cascading Style Sheets). Hence, the user willing to enhance his browser has to become well-versed in a long list of arcane languages.

To address this, the Mozilla Add-ons blog posed the question "How can we make the development of extensions easier?" and published an Extension Developer Survey. The top 5 requests were more concerned about the review queue, documentation, tutorials and writing and debugging tools, but several responses suggested some improvements to the add-on platform itself:

  1. not requiring browser restart for installation
  2. better debugging tools
  3. better packaging
  4. easier way to write extensions
  5. code generation/IDE

The Mozilla developers have clearly listened to these suggestions, as last week Mozilla Labs announced Jetpack, a new experimental extensions architecture which abstracts away much of the complexity of the current extensions system. The Jetpack API addresses the five issues mentioned above and at the same time lowers the bar for users by requiring only knowledge of HTML, CSS and JavaScript. This means that everyone with basic web development skills is able to extend their web browser using the same web technologies they already know. The choice for these web standards is also clever because it means that extension developers can re-use existing web development and debugging tools. For example, a Jetpack extension writer is able to use the Firebug extension (a popular extension for debugging, editing and monitoring CSS, HTML, DOM, and JavaScript) to develop his add-on.

Writing a Jetpack extension

To get started, users have to install the Jetpack Extension and restart Firefox. The browser then shows the about:jetpack page, which contains some Jetpacks (extensions created with the Jetpack API). Jetpack community lead Nick Nguyen writes on his blog how easy it was for him to develop a new Jetpack:

I was able to put together a Delicious Notifier Jetpack Feature in less than an hour using simple JQuery, CSS, and html. All I did was install the GMail Notifier widget and pasted it into Bespin, read the 20 lines of code that made it work, and started hacking away to get the information i wanted. Since I didn’t have to restart and could inspect and debug via Firebug, development was painless.

There are some demos one can use for inspiration, as Nguyen showed in his blog. The Jetpack Tutorial is also very helpful to start. Developing a Jetpack extension turns out to be surprisingly simple. It's an iterative process where the developer writes some code right in his browser, refreshes a web page to see the effect of his changes in the Jetpack extension code, then continues rewriting his code, and so on. One especially interesting feature is that Jetpack has automatically included jQuery by default. This popular JavaScript library exposes a lot of functionality, like DOM traversal and modification, events, CSS manipulation and Ajax. The tutorial shows how to write a script of only ten lines that removes embed elements from a page on-demand and at the end of the tutorial, the user learns how to write his own GMail notifier. Jetpack also has a Twitter library and will see more common web APIs in the future, including the ability to import external libraries.

At the moment, the API reference is woefully incomplete, but this should change as people start to experiment with Jetpack. Most of the interesting objects reside in the jetpack namespace. For example, the jetpack.notifications object can be used to display a notification message, and by using jetpack.tabs properties, the developer is able to manipulate the browser's tabs.

Even distributing a Jetpack extension is simple: just drop the code into a JavaScript file. Add a link element to a page:

    <link rel="jetpack" href="js-file">

Subsequently, a visitor to the page will see a notification bar with the option to install the Jetpack. It's also nice to see the developers have thought about security: the user sees the whole Jetpack extension source code before he installs it. In the future, the Jetpack system will work with a "social trust network" to help people make informed decisions about whether to install a Jetpack extension or not.

When using Firefox 3.0 or earlier, any logging messages or errors produced by Jetpacks reference the wrong line numbers, which makes debugging Jetpacks difficult. So anyone planning to experiment with Jetpack should consider using Firefox 3.5 Beta. Moreover, if the user doesn't have the latest version of Firebug installed, all logging messages appear in the JavaScript Error Console. For serious debugging, the Jetpack developers strongly suggest using Firebug 1.4 Alpha.

Conclusion

At the moment Jetpack is still an early prototype (that's why it's in Mozilla Labs), and it is not meant to replace the existing extension system. It is however well-suited for simple addititions to Firefox, analogous to the changes users can make to web pages with Greasemonkey. For this purpose, Jetpack clearly looks like the right choice: it not only makes developing extensions much simpler, but it creates new possibilities, such as installing an extension without the need to restart the browser.

Comments (7 posted)

System Applications

Database Software

cryha 1.0 announced

Version 1.0 of cryha has been announced. "Cryha is a Python toolkit for securing information into a data base; it lets hash passwords, and encrypt/decrypt personal information. It is ready for input of Unicode characters, and the schema is returned as Unicode."

Full Story (comments: none)

MySQL Community Server 5.0.82 released

Version 5.0.82 of MySQL Community Server has been announced. "MySQL Community Server 5.0.82, a new version of the popular Open Source Database Management System, has been released. This and future releases in the MySQL Community Server 5.0 series share version numbers with their MySQL Enterprise Server counterparts."

Full Story (comments: none)

PostgreSQL Weekly News

The May 31, 2009 edition of the PostgreSQL Weekly News is online with the latest PostgreSQL DBMS articles and resources.

Full Story (comments: none)

PowerConsole 0.7 released

Version 0.7 of PowerConsole has been announced. "PowerConsole is an enhanced Python interpreter that can host user defined commands. It uses pyparsing-based grammars for user commands to translate them into python calls, so it has limited support for mixing them with Python code. A basic, ready to use CLI interpreter is included."

Comments (none posted)

Embedded Systems

BusyBox 1.14.1 released

Stable version 1.14.1 of BusyBox, a collection of command line utilities for embedded systems, has been announced. "Bug fix release. Contains fixes in acpid, awk, depmod, dhcp, gzip, mdev, modprobe, sysctl; libbb fixes. hush is significantly updated."

Comments (none posted)

Interoperability

Samba 3.4.0pre2 is available

Version 3.4.0pre2 of Samba has been announced. "This is a preview of the next upgrade production release version of Samba. It is intended for testing purposes only. Please test and report any bugs that you find. The final 3.4.0 release is planned for July 1, 2009."

Comments (none posted)

Web Site Development

TurboGears 2.0 final released

Version 2.0 final of the TurboGears web development framework has been announced. "This release is the product of a lot of work by the whole TurboGears team, and we're very happy to have a final stable release. TurboGears 2.0 final includes all kinds of goodies for those making web applications, from one of the most powerful and flexible Object Relational Mappers available in any language, to a powerful and flexible template system. But just as important as the quality of the parts, is the out-of-the-box integration to help get you started quickly".

Full Story (comments: none)

Desktop Applications

Data Visualization

SUMMON 1.8.7 released

Version 1.8.7 of SUMMON has been announced. "SUMMON is a python extension module that provides rapid prototyping of 2D visualizations. By heavily relying on the python scripting language, SUMMON allows the user to rapidly prototype a custom visualization for their data, without the overhead of a designing a graphical user interface or recompiling native code. By simplifying the task of designing a visualization, users can spend more time on understanding their data."

Full Story (comments: none)

Desktop Environments

GNOME 2.27.2 released

Version 2.27.2 of GNOME has been announced. "This is the second development release towards the wonderful 2.28 release! Various bug fixes and nice improvements in several modules. Fun, fun, fun!"

Full Story (comments: none)

GNOME Software Announcements

The following new GNOME software has been announced this week: You can find more new GNOME software releases at gnomefiles.org.

Comments (none posted)

KDE 4.2.4 released

Version 4.2.4 of KDE has been announced. "KDE Community Ships Fourth Translation and Service Release of the 4.2 Free Desktop, Containing Numerous Bugfixes, Performance Improvements and Translation Updates".

Full Story (comments: none)

KDE Software Announcements

The following new KDE software has been announced this week: You can find more new KDE software releases at kde-apps.org.

Comments (none posted)

Xorg Software Announcements

The following new Xorg software has been announced this week: More information can be found on the X.Org Foundation wiki.

Comments (none posted)

Electronics

Butterfly Platform FPGA Design 1.0 (OpenCollector)

OpenCollector.org has announced version 1.0 of the Butterfly Platform. "The Butterfly Platform is a modular FPGA development platform. All schematics, board files, and utilities are released under a Creative Commons Attribution license. The schematic and board files are available in the popular Eagle PCB design format. The Butterfly Platform is incredibly flexible and can be programmed to be a logic analyzer one minute and then a flash programmer the next. Some possible applications are: -Logic Analyzer -Flash Programmer -Frequency Generator -Frequency Counter -PWM controller (20+ Channels are possible) -8 Bit Microcontroller -32 Bit Microcontroller -Future versions will be able to run ucLinux".

Comments (none posted)

Music Applications

Virtual MIDI Piano Keyboard 0.2.5 released

Version 0.2.5 of Virtual MIDI Piano Keyboard has been announced. "Virtual MIDI Piano Keyboard is a MIDI events generator and receiver. It doesn't produce any sound by itself, but can be used to drive a MIDI synthesizer (either hardware or software, internal or external). You can use the computer's keyboard to play MIDI notes, and also the mouse. You can use the Virtual MIDI Piano Keyboard to display the played MIDI notes from another instrument or MIDI file player."

Full Story (comments: none)

Office Applications

HylaFAX 6.0.2 released

Version 6.0.2 of HylaFAX, a fax modem interface program, has been announced. "This release is a maintenance release, and does not contain any new features or functionality, but only bugfixes".

Comments (none posted)

Office Suites

KOffice 2.0.0 released

The KOffice 2.0.0 release is out. "KOffice 2 is a much more flexible application suite than KOffice 1 ever was. The integration between the components is much stronger, with the revolutionary Flake Shapes as the central concept. A Flake Shape can be as simple as a square or a circle or as complex as a chart or a music score. With Flake, any KOffice application can handle any shape. For instance, KWord can embed bitmap graphics, Krita can embed vector graphics and Karbon can embed charts. This flexibility does not only give KOffice unprecedented integration, but also allows new applications to be created very easily. Such applications can e.g. target special user groups like kids or certain professions." The announcement also compares this release to KDE 4.0, in that not all features are there yet.

Comments (7 posted)

Languages and Tools

Caml

Caml Weekly News

The June 2, 2009 edition of the Caml Weekly News is out with new articles about the Caml language.

Full Story (comments: none)

Java

IcedTea 1.10 released

Version 1.10 of IcedTea, a harness for building source code from OpenJDK, has been announced. A number of new capabilities and bug fixes have been added.

Full Story (comments: none)

IcedTea6 1.5 released

Version 1.5 of IcedTea6, a harness for building source code from OpenJDK6, has been announced. A number of new capabilities and bug fixes have been added.

Full Story (comments: none)

Perl

Rakudo Perl 6 development release #17 (use Perl)

use Perl has announced development release #17 of Rakudo Perl 6, an implementation of Perl 6 on the Parrot Virtual Machine. Changes include: "* Rakudo is now passing 11,342 spectests, an increase of 875 passing tests since the April 2009 release. With this release Rakudo is now passing 68% of the available spectest suite. * We now have an updated docs/ROADMAP . * Errors and stack traces now report the file name and line number in the original source code. * Some custom operators can be defined, and it's possible to refer to operators using &infix:<op> syntax. * We can start to load libraries written in other Parrot languages. * Regexes now produce a Regex sub. * More builtin functions and methods have been rewritten in Perl 6 and placed as part of the setting. * There are many additional improvements and features in this release, see docs/ChangeLog for a more complete list."

Comments (none posted)

Python

Python 3.1 release candidate 1 released

release candidate 1 of Python 3.1 is available. "On behalf of the Python development team, I'm happy to announce the first release candidate of Python 3.1. Python 3.1 focuses on the stabilization and optimization of the features and changes that Python 3.0 introduced. For example, the new I/O system has been rewritten in C for speed. File system APIs that use unicode strings now handle paths with undecodable bytes in them. Other features include an ordered dictionary implementation, a condensed syntax for nested with statements, and support for ttk Tile in Tkinter."

Full Story (comments: none)

itools 0.60.2 released

Version 0.60.2 of itools has been announced, it includes several bug fixes. "itools is a Python library, it groups a number of packages into a single meta-package for easier development and deployment".

Full Story (comments: none)

Numexpr 1.3 released

Version 1.3 of Numexpr has been announced. "Numexpr is a fast numerical expression evaluator for NumPy. With it, expressions that operate on arrays (like "3*a+4*b") are accelerated and use less memory than doing the same calculation in Python. On this release, and due to popular demand, support for single precision floating point types has been added."

Full Story (comments: none)

Python-URL! - weekly Python news and links

The May 29, 2009 edition of the Python-URL! is online with a new collection of Python article links.

Full Story (comments: none)

Tcl/Tk

Tcl-URL! - weekly Tcl news and links

The May 28, 2009 edition of the Tcl-URL! is online with new Tcl/Tk articles and resources.

Full Story (comments: none)

Libraries

SLV2 0.6.6 is available

Version 0.6.6 of SLV2 has been announced. "SLV2 is a library to make the use of LV2 plugins as simple as possible for applications. Changes this release: * Add manual pages for utilities * Reduce plugin load overhead (on-demand querying with finer granularity) * Fix compilation on Mac OS X"

Full Story (comments: none)

Page editor: Forrest Cook
Next page: Linux in the news>>

Copyright © 2009, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds