Thursday, February 18, 2010

Enabling Firefox Tabs to load Homepage

For the past week I've been quietly working on enabling Firefox tabs to load a home page. By working on this task its shown me how important it is to be able to skim through huge amounts of code in order to find that small portion that affects or does what you are looking to change. So I'll get right into it!

The task was to achieve two things:

1) Enable a homepage to load whenever a new tab is created
2) Enable the user to optionally set the tab to open this homepage on creation or to
remain with the standard blank page

Surprisingly enough the second objective came along pretty easy! So if you've ever changed your homepage in firefox you would be familiar with the this:


If you look carefully you can see that my home page is set to "http://www.xbox.com", so whenever I open a browser window it will automatically open up to that website. Now in order to proceed further I will need to know where the homepage string is stored and for this I took up a torch and ventured into the "den of dragons":



This tool is real nifty in the fact that I can use it to search for different components of the Firefox browser. Since we are trying to customize a homepage load up for a tab I figured I'd search up browser.startup, lo and behold I got the following:


Notice anything familiar in those results? Check out the highlighted function and look at the value...it should look familiar now. This variable "browser.startup.homepage" holds a string variable for the home page's URL! Now I know I'm getting somewhere. Now I know where the homepage is actually stored. With this information I searched the Mozilla repository for it and I got the following results:


Weaving through all of these results was both tedious and time consuming but I eventually came across a file that contained the use of browser.startup.homepage. Looking at lines 199 - 203 you can see how an integer value is used to determine the action of the browser's startup, if you look again at the earlier screenshots showing the browser variable search from the "dragon's den" you'd notice that browser.startup.page has a value of '1' which then asks it to call "browser.startup.page" function which uses that string value in the browser.startup.homepage variable. Whew! I've done some testing and by changing the integer variable I can manipulate the actual action taken when the browser starts up.


Even though I now know how to manipulate a browsers homepage it still leaves out the tab function which is what I really want to manipulate. This is where my progress had temporarily come to a halt....until I happened across a colleagues blog in my OSD600 class. Scott Downe has also been working on the Firefox tab tweak and has made progress in the area in which I'm having trouble with. For now I will take a break from actual testing and contact Scott to better understand how Firefox tabs are called in the code and also share what I've come to understand thus far. (There's that Open Source collaboration coming into play :P )

Hopefully in the near future I will be able to post a success story but for now I gotta get back to work on my Release 0.1 which I should be releasing a status post for later today!

No comments:

Post a Comment