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

Create a free website or blog at WordPress.com.

%d bloggers like this: