Yearly Archives: 2009

The Mozilla Add-Ons Workshop in Florence

(Note: this post is also available in Italian on xulit.)

Picture a Mozilla geek standing on the shoulders of another to reach an electric outlet in the ceiling, then expecting to be returned to firm floor and instead being shuttled elsewhere to the reason of “one more outlet to gooooo!”.

(Photo credits: William. Complete photoset here.)

Picture the chatty signora who serves drinks and panini at the bar, getting asked tens of chairs first, then an old knife to be used as a screwdriver to assemble fans (no, not the human variety), then rags to clean above said chairs retrieved from the basement from above said geeks. Picture her respond with more lively chatter instead of increasing threats to kick us out.

Picture two guys who never gave a presentation together bantering/negotiating on stage, much to the audience’s amusement, which slides to skip to make time for an unplanned but ubercool presentation. (Of course I was right most of the time but Luca was tougher. :P)

You might think by now that the Mozilla Add-On Workshop had more than a bit of adventure in it, but our men in Florence Giacomo and Iacopo (from Mozilla Italia) as well as the headquarter agents Paul and William (from Mozilla Europe) plowed through every obstacle and got us safely to the heart of the workshop: an introductory talk on Firefox extension development, a hands-on tutorial, and a short finale on the tricks of the trade.

Despite many rough edges and a wealth of non-obvious material to cover (we went from zero to a Twitter-search extension to interactive development in less than three hours), almost fifty people gave us full attention and support, which is a testament to the rising interest on the subject in this country (or to the seldom sung quality of Italian patience (or both)).

Courseware is available: slides, incremental examples on building an extension, samples of “unusual” (if you’ve only done web development so far) JavaScript.

If you were there and your questions went unasked or unanswered because of time or because you couldn’t hang out afterwards; or you want us to keep you in the loop about this Fall’s initiatives; or you just want to say hi, feel free to get in touch with us or leave a comment here or on the Italian version of this post.

Happy extension hacking!

Gecko in Emacs (sort of)

After providing a Lisp-like facility for interactive development to Firefox, it was only fair for the cute panda to return the favor and lend some rendering power to Emacs.

Four lines of Lisp, a little hack and a function theft from w3m.el later, something pops up in an Emacs buffer…

It is, of course, just a proof of concept. No, I don’t have the time to develop it further. Yes, I’ll treat you to several rounds of Belgian beer if you do.

Turning Firefox into a screenshot server with MozRepl

In October I introduced custom interactors and someone asked what can be done with them other than application inspection.

Here‘s a practical application that turns Firefox into a screenshot server. It lets you request e.g. http://localhost:4242/screenshot/ and receive a PNG screenshot of Wikipedia homepage. (Instructions to run it are at the bottom.)

Features and things to note:

  • Every page is loaded in a new tab, meaning that multiple screenshots can be requested concurrently.
  • You can have MozRepl listen to outside requests and thus have the server run on a machine (or machines) other than the one requesting screenshots.
  • Adding .../pdf/, .../postscript/, .../getmail/, and so on, shouldn’t be too hard.

This is no finished product but it should give a hint of the possibilities. Known issues: since it takes the screenshot upon DOM load event, pages that use the same event to build sizeable portions of the document (such as iGoogle) might turn out incomplete or just white. Also, Firefox 3.1 seems to hang when the same browser instance is both the requester and the receiver of the screenshot (ok, not the most useful scenario, but still).

To try it:

  1. Get MozRepl, whether devel or stable branch doesn’t matter.
  2. Copy the source of the screenshot server to a file (e.g. /home/foo/mozrepl-init.js)
  3. In about:config, set extensions.mozrepl.initUrl to the URL of that file, e.g. file:///home/foo/mozrepl-init.js. (This file gets read whenever a new MozRepl session is started.)
  4. In about:config, also set extensions.mozrepl.defaultInteractor to “screenshot”.
  5. Select Tools → MozRepl → Start from the menu to start MozRepl.
  6. Point wget (or curl, or another browser) to Firefox with:
     $ wget http://localhost:4242/screenshot/ 

Update 2009-06-16: Adam has an HTML-to-PNG server with an improved version of the interactor.