Snippets code from my daily experience

June 29, 2008

Open a tab using FUEL on Firefox 3

Filed under: extension, firefox, fuel, mozilla, nsIIOService, xpcom, xul — dafi @ 5:41 pm

I want to migrate to Firefox 3 and stop compatibility with FF2.x so I’m starting to use intensively FUEL.

Today I’ve replaced the old “open new tab” code shown below

newTab : function (url) {
const newTab = getBrowser().addTab(url);
getBrowser().selectedTab = newTab;
}

With the FUEL version

newTab : function (url) {
var uri = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService)
.newURI(url, null, null);
Application.activeWindow.open(uri);
}

Onestly I found so complicated the FUEL approach.

Why I need to create an URI?

Why open doesn’t work with a simple string?

BTW FUEL is great

June 7, 2008

Overload same xul element twice

Filed under: chrome-manifest, overloading, xul — dafi @ 10:26 am

My extension MoreKomodo overloads many elements

  • command set
  • toolbar buttons
  • menu items
  • find results tab

Due to my laziness I’ve added all these overloaded elements in main morekomodoOverlay.xul file.

It contains not-strictly-related code all together, for example the find results tab code is separated from other UI elements.

I’ve found very useful to overload more than once the same element inside chrome.manifest to isolate xul code and also javascript code.

It’s very easy

overlay  chrome://komodo/content/komodo.xul chrome://morekomodo/content/modokomodoOverlay.xul
overlay  chrome://komodo/content/komodo.xul chrome://morekomodo/content/findResultsOverlay.xul

That’s all folks :P

June 6, 2008

Komodo wiki content

Filed under: komodo — dafi @ 4:29 pm
Tags:

I continue to add content to official Komodo wiki page.

I’m not sure ActiveState is boring to read my contributions but I think a centralized place is better than my blog.

The last added page topic treats the Komodo Notifications, a powerful mechanism to be informed about editor activity.

Only the most important notifications are listed but I hope to complete the list

Blog at WordPress.com.