Snippets code from my daily experience

March 23, 2008

Central extensions repositories

Filed under: extension, firefox, flock, komodo, songbird — dafi @ 10:21 pm

I spend my time to created extensions based on Gecko expecially for

  • Firefox, Thunderbird and SeaMonkey (all under Mozilla umbrella)
  • Songbird
  • Flock
  • KomodoEdit/KomodoIDE

Every product has its own developer website where you can upload your extensions (Komodo hasn’t a dedicated upload zone).

From a visitor/user feedback’s point of view Flock is the best.

Flock addons site is cool I love it, extension informations are very complete, you can see also the locales supported by extensions.

Songbird has a cool addons site simple and very quick, extension informations are complete.

Mozilla with AMO is the most important but is also the worst.

The outsider KomodoEdit addons site not yet really exists, registered users can’t upload their extensions.
I hope Komodo guys take a look at Flock addons site if they decide to create a similar place.

From a developer feedback’s point of view Songbird is the best.
After signup you can immediately upload and publish extension on Songbird site, the upload process is easy and publication policy very developer friendly.

AMO upload mechanism is simple but publication mechanism is awful. I don’t like its approval mechanism based on sandbox, my RichFeedButton waits approval for an year.

Flock allows to upload extensions immediately after signup but publication waits approval, after a couple of days I’m yet waiting ;)

The most mature and important addons site AMO, has IMHO the worst user/developer experience.

I don’t like so much Flock but it has a great develope/user website

March 22, 2008

Get HTML code from nsISelection in XUL

Filed under: firefox, flock, nsISelection, selection, xul — dafi @ 9:56 am

Recently after a discussion with my friend bard we realized how it is easy to obtain HTML source code associated to the current browser (eg Firefox, Flock) selection.

It’s too simple to discuss the snippet, leave the code speaks itself

function selectionToHTMLSource()  {
    var sel = document.commandDispatcher.focusedWindow.getSelection();
    if (sel.rangeCount < 1) {
        return "";
    }

    var node = sel.getRangeAt(0).cloneContents();
    var xmlStr = new XMLSerializer().serializeToString(node);
    return xmlStr;
}

The code handles single selection, if you need to work with multiple selections like tables rows/cells take a look at Table2Clipboard


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 (event.target.id == “xxx” && event.attrName == “yyy”) {
...
}


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

I suspect event.target 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” && event.target.id == “xxx”) {
...
}


The javascript short-circuit evaluation ensures me event.target.id 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)

Browsers

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
  • Songbird - THE 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 (event.target.id == "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 :-(

Blog at WordPress.com.