Lab 7 – (Modifying Mozilla Firefox’s Tab Behaviour)

This lab, I found to be quite challenging yet unique and interesting at the same time. Utilizing the knowledge learned from previous lectures, I discovered that I became quickly familiar with the Mozilla tree and searching through MXR and the directory structure of the debug build we were using. The specific goal of altering the behaviour of the tabbed browsing functionality was a great choice as it was not too difficult nor too easy.

Following the lab, I wound up digging through the rabbit hole, and landed in mozilla/ browser/ base/ content/ tabbrowser.xml looking at lines: #1165 and #1228

Admitedly, the hands on approach of the lab aided in the specific areas to change. I believe that without the aid, I would have certainly found the specific file, tabbrowser.xml but the code to be changed would require a considerable amount of investigation before editting.

The code that I did change was similar to that in the lab.

// Insert tab after current tab, not at end.
var currentTabIndex = this.mTabContainer.selectedIndex; this.mTabContainer.insertBefore(t, this.mTabContainer.childNodes.item(currentTabIndex + 1));

Having then compiled this code, I discovered the same bug posted in the lab. The functionality works – tabs open after the currently selected tab,  but tabs would not close.

Post compile, I continued to read the lab and mimicked the changes by altering line #1228.

var position = currentTabIndex + 1

Prior to this change, the current position based on the number of tab nodes was used. With this change, this solved the close tab issue, but alas again, more buggers. With two tabs open, when you close one, they both close – interesting.

Anyhow, I learned how fragile some code can be. It reminds me of a deck of cards built into a house, you have to be very careful which cards you wish to remove or add to your masterpiece. Altering a single line changed other lines. Mozilla is right when they name dev/unstable builds, Minefield. You have to observe everything you do and watch where you step.


Aaron (AaronMT)

One response to this post.

  1. Posted by Patrick on October 31, 2008 at 10:55 pm

    Yea, coding has always been so fragile. They’re all like some finely crafted arts. Just one little scratch and it’s ruined – one little error, program breaks down.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: