My first patch, a true story

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.

Source Indexing – setting up for CVS

Included with WinDBG’s debugging tools is an sdk that has some scripts to use for making a Source Server.

From what I have gathered so far, I needed to configure the srcsrv.ini file to point to my CVS repository – check, i pointed it to MYSERVER=:pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot

Then I ran ssindex.cmd –server=cvs –source=c:source –symbols=c:outputdir with the appropriate locations.

First error:
ssindex.cmd [ERROR ] : A source control system must be specified using either the
"-SYSTEM=" option or by defining SRCSRV_SYSTEM in your environment.

Okay, so I realized that I should have been calling cvsindex.cmd NOT ssindex.cmd. Re-do the call…

Second error:
ssindex.cmd [ERROR ] CVS: CVS_LABEL or CVS_DATE not defined. Can't continue.

Gotta love that “can’t continue”, how dramatic. I remembered reading about the Label and Date setting when looking at the documentation for cvsindex.cmd -?? and thanks to Dave for noticing that it says “OR” not “AND” – so I set the CVS_DATE to today’s date and go for third.

Third results:
--------------------------------------------------------------------------------
ssindex.cmd [STATUS] : Server ini file: C:Program FilesDebugging Tools for Windowssdksrcsrvsrcsrv.ini
ssindex.cmd [STATUS] : Source root : c:ffmozilla
ssindex.cmd [STATUS] : Symbols root : c:ffmozillaobjdirdistcrashreporter-symbols2007092823
ssindex.cmd [STATUS] : Control system : CVS
ssindex.cmd [STATUS] : CVS Root : :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot
ssindex.cmd [STATUS] : CVS program name: cvs.exe
ssindex.cmd [STATUS] : CVS Label :
ssindex.cmd [STATUS] : CVS Date : 10/09/07
ssindex.cmd [STATUS] : Old path root :
ssindex.cmd [STATUS] : New path root :
--------------------------------------------------------------------------------
ssindex.cmd [STATUS] : Running... this will take some time...

And it did take time…but after all was said and done – nothing seems to be indexed. Minor success anyway, I learned how to run the indexing command.

Back to the drawing board.

Thanks to everyone on #seneca who reassured me that I wouldn’t break the CVS repository by messing around with this.

When doubt creeps in…

Oh boy, what have I taken on?

Going deeper and deeper into any documentation I can find about how one goes about source indexing. I have no idea what I’ve signed up for.

In my C:Program FilesDebugging Tools for Windowssdksrcsrv directory there is an excellent source server document that walks through the steps and for the moment all I know is that I’ll be needing Perl.

So I’m downloading ActivePerl as I write this and hopefully once it’s installed I can chip away at setting up some indexing scripts.