I was breaking the source code of Firefox last night. It was assigned by Dave. All I need to do is changing the code of Firefox, and let it directs to the homepage while it opens a new tab. Since I forgot the exactly filenames of source code for how to create a new tab, I have to search their location again.
Beginning
I targeted on the navigator bar because it has the new tab button and the home button, which creates a new tab and opens the homepage. Then I went to mxr and searched the label of new tab button, "Open a new tab". follow that was searching, searching and searching.
Found the place
I don't remember how long I spent to find the right place. There are two critical files:
\browser\base\content\tabbrowser.xml line 1256
\browser\base\content\browser.js line 1720
the function addTab() inside the first file response open a new tab. the function gHomeButton.getHomePage() in the second file return the url of homepage.
What I changed
What I changed is I put two lines inside tabbrowser.xml
if(!aURI)
aURI = gHomeButton.getHomePage();
before
var blank = !aURI || (aURI == "about:blank");
then, I built the Firefox, and it works.(actually, I built 6 times last night to reach this T_T )
Concision
It is a great experience to modify such a huge open source project. Although it is not much work to do, it still prove I have the ability, possibility and permission to do what I want to do.
BTW, I am read the post from G-Lewis and Scott Downe. They also have a very good post and they remind me I also need to enable the user to optionally set the tab to open homepage or to remain with blank page. Maybe I will try to accomplish that later.
Thursday, February 18, 2010
Subscribe to:
Post Comments (Atom)
I love it! Keep it up, this is awesome.
ReplyDeleteHey.
ReplyDeleteI hope my post helped you as much as yours is about to help me. I actually think you have the last piece of my puzzle.
By the way, in order to add a prompt asking for the users input, I would just use the JavaScript "confirm("load homepage?")" Then check the result before you assign aURI.
Also, I think I need to start putting titles before some of my paragraphs in my blog. Thanks for that idea, it looks cleaner.
Thanks.