Well. I am jazzed up while I sit in BTB right now because I MADE A PATCH!
Yessir. The lab for today’s class asked us to try and modify our browsers so that opening a new tab makes it appear to the right of the current tab, instead of the way it currently opens the new tab at the far right end of all tabs.
We all jumped on to MXR and … it froze. So for a bit, I stared at the screen and wondered – “How hard is this going to be?”.
Well, not too bad actually. I searched for “New Tab” and found /browser/base/content/tabbrowser.xml which has a comment:
// We’re adding a new tab here.
Looks like I’m in the right place.
Turns out tabbrowser.xml is the best place to go because that’s where my changes will be made and it also happens to be where all the methods regarding tabs are located.
Now I’m staring at some javascript. Immediate guilt sets in for not being more competent in this language. When did we take javascript? Back in third term. It’s now buried beneath a tiny bit of perl, a pinch of php and attempts at ruby.
loadOneTab() is called when a new tab is added, loadOneTab() calls on addTab(). These are all in the same file. I’m focusing on addTab(). This is my target for adding some lines.
addTab() creates a tab object with the variable name t and then appendChild(t) to mTabContainer. Let’s look at mTabContainer…
What do you know – it has a method called moveTabTo(). Cool, that’s what I want to do. I want to moveTabTo() the index next to the one that’s calling the addTab().
See tabPatch to get the rest of the story I’ve got to go do a victory lap.