Snippets code from my daily experience

July 12, 2007

How to detect and run MacOSX executable files with XUL

Filed under: macosx,xul — dafi @ 8:22 pm

XUL allows to detect if a file is executable (Windows batch, Unix script, regular executable binary file) simply using the nsIFile::isExecutable method.

All seems high portable and platform independent but isExecutable doesn’t work on MacOSX as reported in Bug 307463 and Bug 322865.

I’ve found a workaround in ViewSourceWith since version.

The solution requires a brief technical explanation.

MacOSX uses the so called CFBundle files, these files are stored inside a directory that resides under a standard path:


where LEAD_PATH should be for example /Application and APP_NAME should be for example Firefox

So the Firefox bundle can be found in /Application/

Info.plist is a standard XML file containing many attributes, the CFBundleExecutable points to the executable file name.

The example below shows the content for Firefox Info.plist


So the real executable file is /Application/

ViewSourceWith contains a function that digs inside MacOSX to find the real executale file.

Initially I wrote the code treating Info.plist like a DOM document but at end I used a regular expression as shown below:

var pListText = ... // contains the Info.plist text
var re = /\<key\>CFBundleExecutable\<\/key\>[ \t\n\v\r]*\<string\>[ \t\n\v\r]*(.*)[ \t\n\v\r]*\<\/string\>/

var m = pListText.match(re);
var the_real_exe = m[1];

Apple has many API to access to properties without open manually the Info.plist but to use them I need

– a C compiler for Mac

– write native code to use inside firefox extension

Instead, accessing directly to xml file I simplified the development.
You can find the code written for ViewSourceWith in SVN repository.

Other details about this problem can be found on ViewSourceWith FAQ page.


July 7, 2007

Short-circuits, innocent code and nsIDOMEvent targets

Filed under: firefox,flock,mozilla,xpcom,xul — dafi @ 6:08 pm

An user on AMI tells me that my bonsai RichFeedButton doesn’t work when installed together with another extension.

I install the offended extension and discover that RichFeedButton breaks this little jewel!

The solution was simple but the bug hunting was hard 😦

The problem was into an innocent function associated with a listener that simply checks the nsIDOMEvent‘s target id and attrName as shown below
if ( == "xxx" && event.attrName == "yyy") {

For some motivations the “” expression breaks the other extension.

I suspect at some event stage isn’t valid and generates internally some error corrupting (???) the full event queue or simply I’m a bad programmer 😦

The solution??

Simply swaps first equality test with second one

if (event.attrName == "yyy" && == "xxx") {

The javascript short-circuit evaluation ensures me is parsed only if first condition is true. πŸ™‚

Every day I learn something about XUL and its implementation… πŸ˜‰

How many applications based on XUL exist?

Filed under: firefox,flock,mozilla,xul — dafi @ 11:43 am

Thanks to

Jane Ocean to give me many names to add to this list

marcoos to help me to discover new cool XUL applications

The Mozilla XUL application framework is used to create mainly two types of standalone applications: browsers and email client.

But XUL has all potential to be used to create any complex and cross platform application.

Well, I want to list all applications based on XUL (or XULRunner)


absolutely the most significant XUL target

  • Firefox – no words… the browser changed internet πŸ˜‰
  • Mozilla Suite – All in one, browser+email+HTML composer
  • SeaMonkey – The Mozilla Suite successor, I think is better than Firefox but I love bell and whistle
  • Flock – A step ahead but actually only a Firefox with some extensions already installed (IMHO)
  • Netscape 8.x – No revolution but contains many interesting features, it’s based on Firefox 1.0
  • Netscape 9.x – it’s based on Firefox 2.0
  • Minimo – Browser for mobile devices
  • Camino – Browser for MacOsX It’s based on Mozilla’s Gecko but isn’t a XUL application
  • Swiftweasel and Iceweasel – Binary optimized Firefox. Iceweasel is under GNU license
  • WebRunner

Email clients

anybody has news about the Eudora porting to XUL??

HTML Editors

nothing so innovative but very usable

  • NVU – why this cool project has been abandoned????
  • kompoZer – the NVU successor

Schedulers, calendars and PIM

I’m waiting to completely remove Outlook

  • Sunbird – Cool, easy and enough stable
  • Lightning – Ok Ok I know! 😦 This isn’t a standalone application but sunbird as extension

Developer tools

  • Komodo – Interesting IDE project, cool KomotoEdit full free (added 08 Sep 2007)

Instant Messaging

Other categories

Non stricly web-related XUL applications

  • Celtx – Celtx is a project collaboration tool for people who work in film, TV, theater and New Media
  • SongbirdTHE web media player, I really love it but maybe it’s a bit slow and unstable
  • eMusic DLM – Download manager
  • Etna – XML editor
  • Joost – Internet TV viewer and more
  • Miro – Video player
  • Chatzilla – IRC client
  • Second Life client – The well known artificial world (added 28 Jul 2007)
  • Evergreen – An enterprise-class Integrated Library System (ILS) (added 23 Sep 2007)

At this time I found only these but my search continue πŸ˜‰

Do you know other XUL based applications?

Blog at