New Tab always briefly shows new default page

Hi I am developing a firefox extension that replaces the new tab.

I have it working in XUL, but I want to switch it over to addon sdk.

In XUL I disable the browser.newtab.preload and then listen for tabopen etc events to finally load my replacement.

Unfortunately, if I try to do this with the addon sdk:

require("sdk/preferences/service").set("browser.newtab.preload", false);
var resourceUrl = "myurl"; 
tabs.on('open', function(tab) {
  tab.on('load',function(tab) {
     if(tab.url == "about:newtab") {
       tab.url = resourceUrl;
     }
  })
});

It shows the default new tab page for a fraction of a second. Is there a way to disable that?

I think the way you used to do this was by setting the browser.newtab.url through the preferences sdk module.
But that option is being removed( don’t know if it’s removed in release yet ).
So they created resource:///modules/NewTabURL.jsm for addons.

Wow that was easy. Thank you