Snippets code from my daily experience

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?

June 30, 2007

Flock is a bug!!!!

Filed under: firefox,flock,mozilla,xpcom — dafi @ 9:34 am

The browser flock is developed starting from Mozilla Gecko code but has many specific features.

Together with many cool features the flock team has added many bugs not present in original Gecko code!

The last I found involves the DOMAttrModified event listener.
The code below works on Firefox 1.5, 2.x and 3.x (thunks) but doesn’t work on flock!!!

onLoad : function() {

var feedButton = document.getElementById("feed-button");

if (feedButton) {

// add the listener for feedButton

document.addEventListener("DOMAttrModified", RichFeed.onAttrModified, false);

// triggers a modification only to test the listener

feedButton.setAttribute("feeds", "true");

// onAttrModified should receive the modification but this doesn't occur on Flock

var v = feedButton.getAttribute("feeds");



onAttrModified : function(event) {

if ( == "feed-button") {

// never called with Flock browser



So my decision is to stop the flock support on my bonzai extensions, I have no time to search workarounds to all flock bugs.

Who cares for my decision? Nobody I know 😦

March 18, 2007

XPCom: download multiple files and block the execution

Filed under: firefox,mozilla,nsIWebProgressListener,xpcom — dafi @ 9:09 am

The problem is simple: you want to download a bunch of http pages and save their content into separated files but you want to wait all downloads finish before to advance to the next line of code.

Using the nsIWebProgressListener this can be accomplished easily using the same progress listener that increments a counter at every download completed.

When the counter reaches the total urls to download a callback function is called.

You can take a look at my implementation (used into ViewSourceWith) here

« Previous Page

Blog at