Extensions, Firefox 3 & T-Shirts

As part of our drive to get as many add-ons updated to work in Firefox 3 as possible, AMO has a new T-Shirt promotion. Get your extension or theme updated to at least Firefox 3.0b3 and you can claim a t-shirt. AMO editors can also claim a t-shirt (lucky dogs). Sign into AMO and go to the developer tools panel to see the “T-Shirt Request” link. Sign up by March 18th to be able to get your t-shirt.

There’s more! If your add-on is in the top 50 most used by Firefox 3 users when Firefox 3 is released, Mozilla will sponsor a party to help you celebrate your success. Polvi has more details.

Stop by #extdev on Mozilla IRC if you need help or just want to talk extensions. We’ll be waiting…

FOSDEM 2008 Wrapup

I had a great time at FOSDEM. Simply an amazing gathering of people who love working on Open Source projects. I could not believe the energy these people have. I, on the other hand, am exhausted! It seems like a blur, but here are some of the bits I remember:

  • The Mozilla devroom was packed with people and extremely hot. Dubbed “sauna.fosdem.org”, we were lucky to get a bigger room on Day 2 (sorry OpenSUSE).
  • Steve Lau of Songbird gave a great demo! Web site integration was very cool.
  • The phenomenal turnout from the Mozilla localizers. I had not yet seen, with my eyes, such a display of Mozilla “Community” until FOSDEM.
  • Getting to meet contributors that I got to “know” on IRC: bkinger, jwatt, gandalf, laurentj and alex fritze to name a few.
  • Dan Mills’ devroom talk on Mozilla Weave generated a lot of discussion. Dan got people thinking of ways to build on Weave.
  • Even with technical computer/projector difficulties, Holmes Wilson’s devroom talk on Miro also generated good discussion.
  • Taverne du Passage – this restaruant was so good, I ate there twice.
  • The Grand’Place (Grote Markt) in Brussels is a beautiful area. I was amazed by the buildings.

2290253090_7e33f156be_m.jpg

Unfortunately, due to heat, eating and meetings, I missed some other devroom talks that I wanted to hear. The Mozilla devroom talks were darn good. Thanks to Brian King and Anne-Julie Ligneau for getting the devroom talks scheduled.

My Prism talk went pretty well. There was some good questions and discussion afterwards. The presentation is here if you’re interested. Here are some FOSDEM/Brussels pictures too.

Zimbra on Prism & Other New Stuff

Zimbra Desktop

Matt Asay has a post about Zimbra’s newest desktop client. It’s a great, full featured email/calendar client and it’s using Prism to give it a standalone, desktop application feel.

That’s right, they are shipping Prism along with the client code and offline support system.

This version of Zimbra is pretty fast too, especially on Firefox. Even more so on Firefox 3. Of course, Prism uses the same Firefox 3 rendering engine, so we’ve got you covered 🙂

Prism Status

The current version of Prism can handle the basics of desktop-enabling fairly well, but there is support for more features coming soon. We have been listening to feedback from users and watching what other ideas are happening in the site specific browser space. Projects like Fluid and Bubbles are pushing the envelope forward. Not to be left behind, the in-development (trunk) version of Prism has some pretty nice features:

  • WebApp icon support – When installing a webapp, Prism will use the favicon of the webapp, if you want it to. You can also use a custom image too.
  • Dock badging support – Support has been added to allow Prism webapp.js code to add a textual badge to the OS X Dock icon. This has not been exposed to the web content, only the Prism webapp script. We want to explore ways of allowing web content to more directly access this feature.
  • Minimize to tray – A new webapp.ini setting will allow the Prism window to be minimized to the Windows system tray. We want to explore ways of allowing web content to more directly access this feature, such as, adding context menus and custom tooltips to the system tray icon.
  • Separate profiles – Prism now places each webapp into its own process/profile. The user can group webapps together when installing, if they want webapps to share a profile.
  • Bug fixes – Thanks to everyone who has been filing bugs and feature requests.

We also have a Firefox extension version of Prism coming out. The extension contains the full Prism runtime, but allows users to create Prism-webapps from Firefox – and uses Firefox as the runtime (no XULRunner needed). Prism Firefox extension features include:

  • Simple install – User can manually choose to install the current website as a Prism webapp.
  • support – The extension will scan any tags found on a web page for webapp bundles and ask the user if they’d like to install the webapps.
  • One-click bundle install – Clicking on a hyperlink that points to a webapp bundle, should prompt the user if they’d like to install it.

We’ll post more as we get closer to a new release.

You’ll notice that we want to create ways for webapps to manipulate some of the desktop-enabling features (dock badging and systray support for example). We don’t want to create custom, Prism-only APIs to access these features. We’re looking for feedback and discussions on how webapps can support these kinds of features without breaking when running in traditional browsers.

I can haz WHATWG spec plz? A site specific browser meetup sounds like a good idea.

Mozilla 2 – The Future of the Mozilla Platform

Firefox 3 is not even out the door, but work has started on the next refactoring of the Mozilla platform. Dubbed Mozilla 2 (FF3 is built on Mozilla 1.9), it is a chance to make lots of interesting, even scary, changes to the platform. For some background on Mozilla 2 go back and read Brendan’s post. Also, read the Mozilla 2 wiki pages.

Actually, lots of work has already been completed and lots more work is underway. Checkout the notes from the status meetings. You can call in every Wednesday to hear what’s happening. The work on ActionMonkey and XPCOMGC is pretty exciting stuff (for geeks, I know).

Another of the more exciting goals of Mozilla 2 is the move to use more JavaScript and less C++. Yes, C++ is great for those times you really need it (performance & native APIs), but JavaScript can handle many things better, easier and without a compiler. Mozilla 2 is adding a lot of improvements to JavaScript as well, making it faster too.

Less C++ is really part of the “Less Binary Code” theme of Mozilla 2. Another part of that theme is reducing our XPCOM footprint. Benjamin Smedberg recently posted some information about goals for XPCOM in Mozilla 2 to the Wiki and Newsgroup. See Benjamin’s older post on XPCOM changes too. I encourage any extension, embedders and XUL application developers who use binary code to go and read the information.

Extension Developers – Native JSON Parsing

Firefox 3 is using JSON to store data in several places – such as bookmark backups, session restore, and offline manifests. Originally, JSON parsing was scattered through the code. Then it was consolidated to JSON.jsm, a JavaScript code module. Eventually, it was converted into nsIJSON.idl, a C++ XPCOM Component. What does this mean to extension and application developers? Well, you now have access to JSON encoding and decoding routines that can be a lot faster (more in a bit) than the JavaScript counterparts.

var testObj - { name: "Jimmy", age: 25, loves: ["XULRunner", "sunrises", "Mt Dew"] };

// encode to string using javascript implementation
Components.utils.import("resource://gre/modules/json.jsm");
var testJS = JSON.toString(testObj);

// encode to string using native implementation
var Ci = Components.interfaces;
var Cc = Components.classes;

var nativeJSON = Cc["@mozilla.org/dom/json;1"].createInstance(Ci.nsIJSON);
var testNative = nativeJSON.encode(testObj);

Of course, you can also encode to a string using the json2.js code at json.org

I put together a little benchmark (on bug 410890) to get a feel for the speed improvements that could be obtained using native JSON parsing. The code iterates over a fixed chunk of JSON (taken from Robert Sayre’s unit tests) multiple times. The number of iterations are on the x-axis while the milliseconds required are on the y-axis:

Encoding
json-object-encode.png

Decoding
json-object-decode.png

I found that John Resig did some JSON benchmarking last year, so I made a second benchmark script (same bug) that used his 1600 item array as the JSON source. This code takes the 1600 item array and breaks it into variable sized chunks, then sends those different sized chunks into the JSON parsers. The chunk size is on the x-axis while the milliseconds required are on the y-axis:

Encoding
json-array-encode.png

Decoding
json-array-decode.png

The tests show a very nice performance improvement for encoding JavaScript objects to JSON data. The performance improvements for decoding JSON data into JavaScript objects is smaller, but still very worthwhile. For the curious, the original native JSON code was further optimized to increase the improvements.

Note: Currently, native JSON is only available to privileged code with access to XPCOM. This means that web content JavaScript is not yet able to access the feature. Working is moving ahead in this bug to get these APIs exposed to web content as well. Exposing APIs to web content is something that needs to be thought out and perhaps standardized. There was a proposal to add JSON encoding/decoding to ES4, which seems to have been dropped. Maybe the WHAT WG will draft something.

Check out John Resig’s post on the State of JSON for lots more information on JSON, web content and standards.

Extension Developers – Win Some / Lose Some

Good News

The extension breaking changes made to the Firefox 3 toolbar IDs has been reverted and patched to get the same result in a different way. Any extensions that broke in a nightly version of Firefox 3 should be working correctly now. We also made sure to get the fix into Firefox 3 beta 3. Big “thank you” goes out to Dave, Dão and Gavin for helping me get the patch right and to Connor and Beltzner for making this a critical enough to get into Beta 3.

Bad News

Scriptable IO is a new extension convenience library added to Firefox 3 (bug 380813). It has a lot of nice methods for doing IO without doing much XPCOM. Unfortunately, we found a problem which is related to Scriptable IO, but I haven’t figured out exactly how yet. To fix the problem, we had to backout Scriptable IO for now. We also had some other issues with the API that need to be worked through.

I know of at least one Firefox 3 compatible extension has been affected by this backout. The workarounds are to use the more verbose XPCOM versions of the features. Hopefully, we can take a look getting Scriptable IO back in the future.

Extension Developers – Unbreaking News

Just an update on the breaking changes I mentioned. We are working on a different fix for the original bug, so hopefully, we won’t need to change the XUL element ID’s. You can follow the progress of this alternate fix here.

It looks like we can revert the element ID’s back to their previous values, not break extensions and get the intended visual changes in Firefox 3. I would suggest extension developers hold off on making any changes to overlays.