Modifying the Browser Lab
Contents
Introduction
In this lab you will combine the skills that you have gained in the previous weeks in order to make a real modification to the browser. Remember to use all the things you've learned about building and compiling, navigating the source tree, searching for code, debugging, etc. When you're done you will have gone from an idea for a top-level UI feature change, to searching and studying the code, to making and testing this change. It is hoped that by doing this you'll gain confidence to do similar things on your own.
Details
Currently, when you create a new tab in Firefox, it is appended to the end of the list of currently opened tabs. However, often one opens a tab in order to work on something associated with the current tab, that is, if I'm working in tab 6, I'd like the new tab to be placed at position 7 and not 21 (assuming there are 20 tabs open).
Here are the steps to reproduce this (commonly shortened to STR, especially in bugzilla):
- Start Firefox and open a series of tabs (i.e., CTRL+T)
- Move to the first tab
- Open another new tab and notice its placement in the list (i.e., it should be last)
Modify the browser so that opening a new tab creates it next to the currently selected tab, no matter where that tab is in the list. When you are done, post a patch to your blog, including a description of your experience creating the patch.
Hints
A complete walk-through of this lab has been done, and is posted here. DO NOT read this before trying to make the change on your own. If you get stuck, you are encouraged to consult with your classmates, use IRC, etc. Only use this information as a last resort, and read as little as possible. You'll gain most if you do it on your own and stretch yourself.
Answer
if(!(this.mCurrentTab._tPos == this.browsers.length - 1)) this.moveTabTo(t,this.mCurrentTab._tPos + 1);