Firefox 3 – XUL Application Runtime

Ryan Paul posted an article on ArsTechnica that describes how Firefox 3 will be able to run XUL-based applications. Since the news is starting to spread, I thought I’d try to put some information out before the guesses and rumors start to fly. Ryan’s article describes the feature rather well.


firefox -app application.ini

Yes, this is different than anything previous versions Firefox could do with XUL. Firefox 2 (and earlier releases) could launch XUL windows using the -chrome command line flag. Firefox 3 will be able to launch full blown XUL applications – running in their own separate processes and separate profiles. Up until now, XULRunner was the only way to deploy XUL-based applications. Some relevant information:

  • XULRunner is not going away. XULRunner is still the preferred way to deploy a XUL-based application. XULRunner gives the application developer full control over the runtime.
  • Firefox and XULRunner share much of the same backend code. When I say much, I mean nearly everything. Firefox is now capable of running XUL-based applications using the same type of bootstrapping mechanism as XULRunner. Since they share so much code, it was fairly trivial to enable this feature. Here is the bug detailing the code.
  • When using Firefox 3 to run XUL-based applications, keep in mind that you are at the mercy of the Firefox 3 runtime. If an upgrade to Firefox happens, it could possibly break your XUL-based application. This is the down-side of sharing runtimes. Therefore, be very careful when using Firefox 3 to run your XUL-based application. Such a problem would not happen when deploying your application with XULRunner.

If it seems like we don’t want to promote running XUL-based applications using Firefox 3 as the runtime – good! This is very experimental and there are down-sides. There are no current plans to expand or extend the feature.

On the other hand, feel free to experiment with it. Just because Mozilla may not have plans to extend the feature doesn’t mean that you can’t. I can visualize a Firefox extension that could be used to download and install small XUL-based applications to a profile folder. The extension could manage the applications like Firefox manages addons.

Hmmm, downloadable desktop applications built using XML and web technologies running on software you already have installed. Sounds kinda cool.

If you have questions about building XUL-based applications and how to use the runtimes, feel free to post to the newsgroup or, better yet, drop by the #xulrunner IRC channel (irc.mozilla.org) and talk to a real live human being.

What’s New on MDC

Here is some recent content additions or changes appearing on the Mozilla Developer Center (MDC).

  • XUL Popup Guide: Great information on using popups (panels, menus and tooltips) in extensions and XUL applications. The popup infrastructure was heavily rewritten in Gecko 1.9 (Firefox 3). Thanks Neil.
  • E4X Tutorial: Joey Minta put together a really good tutorial covering many aspects of using E4X – the ability to use raw XML in JavaScript.
  • Code Snippets for XUL : Some examples of getting the from mouse click and the selected from right-click were added.

WebRunner 0.5 – Linux Install

After much struggle (I was raised on Windows), I put together a Linux installer for WebRunner. I failed to get file associations working automatically, so you will need to manually set those up. I am including a tar.gz file, as well as, a simple installer. No deb/rpm package yet either 🙁

The *.webapp profiles are installed into the application folder. you can copy them to wherever you want. For now, you’ll need to right-click on a *.webapp file to display its properties and configure the “Open with” settings yourself – sorry.

The Linux installer (built using InstallJammer) works very much like the Windows installer, which may be a bad thing for regular Linux users. Let me know what you think. I could use some help building scripts to auto-register the file associations (webrunner -> *.webapp) and thoughts on building packages.

I was looking at BitRock’s InstallBuilder which makes installers (Windows, Mac and Linux) and packages (deb and rpm). They have a free license for open source projects. Maybe that is a good approach.

Install: webrunner-0.5-linux 7MB
Archive: webrunner-0.5.tar.gz 10MB

WebRunner 0.5 – Mac Support

WebRunner now has Mac support. By support I mean we have a DMG for installs and we use CFBundleDocumentTypes to associate *.webapp files with WebRunner. Launching a *.webapp file should launch WebRunner and load the *.webapp profile.

Thanks to Eric Shepherd for the pointers to CFBundleDocumentTypes.

I am interested in feedback on the Mac menu (which I hide). To close the web application, just close the window. I know this is not very Mac-ish, so I am interested in how we could display the menu, but have it say “Google Mail”, instead of “WebRunner”. Yes, I’d like the menu to change based on the web application. Hmmm, maybe we could put something in the webapp profile.

Anyway, have fun…

Install: webrunner-0.5-mac.dmg (18MB)
Profiles: gmail.webapp, gcalendar.webapp, gdocs.webapp & groups.webapp

UPDATE #1: removed the silly debugging alert
UPDATE #2: added a menu for quiting and fixed cozby’s (see comments) bug

WebRunner 0.5 – Now With More Power

I am really impressed by how many people seem to be using WebRunner ([1] & [2]). Personally, I still use it everyday to run GMail and Zimbra. Along the way, I had noticed some small quirks and painful bugs. The download bug (click a download link and get a XUL error message) was the one I hated the most. The window title bug (multiple WebRunner instances would cause the window title to change) was a close second.

I finally got around to fixing those and got ready to make a small release. Then I get an email from Wladimir Palant (of Adblock Plus fame). Seems Wladimir has been using WebRunner too and he also had a list of fixes and features. So I rolled his changes in with mine and the result is WebRunner 0.5:

  • Downloads now work without the XUL error
  • Better window title tracking
  • Context menu enable/disable logic is better
  • Added simple Print support via context menu
  • Added About support via context menu – useful for checking XULRunner runtime version
  • Added web application profile support – parameters for a web app can be saved to an INI-style *.webapp file. Several profiles are included in the distributions. Parameters include:
    • uri – the uri/url of the web app (http://mail.google.com)
    • icon – the icon you want to use for the WebRunner window when running this web app
    • showstatus – turns the statusbar on or off for this web app
    • showlocation – turns the readonly location bar on or off for this web app
    • enablenavigation – turns the hotkey history navigation (ALT+LEFT, ALT+RIGHT and ALT+HOME) on or off for this web app

The installer can configure Windows to associate *.webapp files with WebRunner. This means that when you double-click or launch a *.webapp file, WebRunner is launched and automatically opens the web application. Pretty cool.

I am somewhat excited to see what can be done with WebRunner. I am thinking that we could turn on extension manager in WebRunner and use extensions to provide some web application customization. Also, I see WebRunner becoming more of a desktop platform for running web applications. What’s stopping WebRunner from doing what Adobe AIR does – only better and on Linux and with native code support and with extension support.

I am going to see if we can get WebRunner hosted in a Mozilla SVN repository as well. That would make it easier for people to contribute code.

Install: webrunner-0.5-win32.exe (4.9 MB)
Source: webrunner-0.5-src.zip

New Datasources for XUL Templating

XUL, the XML-based UI language used in Mozilla products, has supported templating for a while now. Unfortunately, the only datasources you could use to drive the templates were RDF-based datasources. This has been a hurdle for some, including me, to really dive into XUL templates.

Recently, Neil Deakin landed support for generic XML datasources, so I no longer have an excuse to not use XUL templates. Here’s an example:

RDF way


// Use a predefined RDF datasource


  

XML way


// Use an inline XML datasource or a URL-based XML datasource


  
  

 

  
 

The results are the same: A list of

What’s New on MDC

Here is some new documentation appearing on the Mozilla Developer Center (MDC):

Tokyo Developer Conference Wrapup

tokyo-dev-conf.jpg

Mozilla-Japan (Chibi, Kaori, Gen and everyone else) did a great job putting together the developer conference. I think we had over 150 attendees and over 25 presenters.

It was the first time I attended a non-English conference. However, the translators did a great job. Even during my own presentations, the translators were doing simultaneous translation during the Q&A. It was incredible.

I really enjoyed the Extension Lightning Talks and the Extension Developer Environment sessions. The Japanese presenters were not only extremely talented developers, but they also did a great job making the presentations very entertaining. They were obviously trying to “one-up” each other during the presentations and did so with great flare, showmanship and the occasional practical joke. The translators could barely keep up! I want to talk more about the kinds of extensions presented and the extension developer community in a future post. Its a very rich and dedicated group of people.

I have had a great time in Tokyo. There has been lots to see and do and eat and drink. It’s a great city and 4 days was too short to explore. Thanks to Kaori and Gen for showing us around the city, it was a lot of fun.

XULRunner Wishlist

XULRunner provides a lot of core functionality, but if you’re writing an application that is not a web browser or email client, you might feel some pieces are missing or not supported as well as they could. You may even have a list. Here’s mine:

  • Interprocess Communication (bug 68702)
  • Window transparency on all platforms (bug 307204)
  • Hiding the main window menu on Macs
  • Adding application to the system tray or appropriate location for other platforms (bug 325353)
  • Allow extensions to be associated with the runtime and not only with applications (bug 299716)
  • XUL Templates based on XML or SQL (bug 321171 and bug 321172)

These features are not critical “must haves” in order to build a good desktop application. Some of them just make it easier. Others are nice to have in the toolkit and not in patches or code that results in a custom build of XULRunner.

While I’m at it, here’s a list of developer “features” I’d like to see:

  • Simple (not perl scripts) tool for MAR file generation so applications can upgrade themselves
  • Tools to generate scaffolding for new application projects
  • Venkman (or other debugger) added to the runtime so applications can be debugged easily (sort of bug 342590)
  • DOM and Event libraries for XUL
  • Packager to “build” applications from XUL & JS

Feel free to share yours. The Mozpad group is working on a list too.

XUL Explorer – 0.4 Finally

We’ve been pretty busy around here with various sorts of things, but we finally got enough time to get XUL Explorer (XE) 0.4 out the door. XE 0.4 has some neat features that we hope will help Mozilla platform developers (extensions and applications) be a little more productive. The highlights include:

  • DOM Inspector and Venkman (JS Debugger) extensions are integrated into XE. You don’t need to mess around trying to install them. They are pre-packaged for your debugging enjoyment.
  • Extension project wizard walks you through the process of creating a Firefox extension. The wizard has options for various types of extension UI’s so you can support toolbar, menu, sidebar and context menu overlays. The extension files are generated using a simple template system, so it should be easy to tweak and add more features.
  • Simple extension testing allows you to pick an extension source folder and quickly run/test the extension in Firefox. No need to manually package and install the extension.
  • A simple XML/XUL formatter helps cleanup your code and there are a few more links to online documentation at the Mozilla Developer Center.

The extension wizard and extension tester are definitely not finished (see roadmap). The extension tester has a few planned usability improvements. The extension wizard has some general improvements coming and many new features. One improvement is support for more targets, including Thunderbird and XUL Explorer. Only Firefox really works now. Another feature is stubbing out handlers for common events, such as when a page loads in the browser.

Once the template based stabilizes for extensions, wizards are planned for XPCOM components and XULRunner applications. We’re very much interested in your feedback as well. So if you can stand using alpha software, give XE a spin and let us know what you think. What’s good, what stinks, what would make a good feature – whatever.

Big thanks to Cesar Oliveria and Paul Medlock for pitching in. Also thanks to Ted Mielczarek for the head start.

Install (Windows): xulexplorer-0.4-win32.exe 5.2MB
Install (Linux): xulexplorer-0.4-linux.tar.gz 9MB
Install (Mac): coming soon
Source: SVN
Bugs: New or View