Changes

Jump to: navigation, search

Dive into Mozilla Modifying Firefox Lab

1,017 bytes added, 12:48, 16 March 2007
Success, and some bugs
==Search 1 - finding a UI string==
We're looking for a unique string--"New Tab"==, --so we'll use [http://lxr.mozilla.org LXR's] '''Text Search''' feature. Here are the results you get when you search for "New Tab":
<blockquote>http://lxr.mozilla.org/seamonkey/search?string=New+Tab</blockquote>
then run the browser to test (NOTE: ''minefield'' is my testing profile):
$ export XPCOM_DEBUG_BREAK=warn
$ ../../dist/bin/firefox.exe -p minefield --no-remote
}
==Success, and some bugs==
After repackaging the toolkit.jar file and running the browser, I'm able to confirm that this last change has been successful. Opening a new tab now works in the way I originally described. I make a few more tests to insure that I haven't broken anything else, for example, what happens if I am on the last tab and not in the middle. This works, which makes me realize that using '''append()''' is probably not necessary at all, and I can safely shorten my code down to the following:
This means that six lines of code become two, and with that reduction in number of lines, hopefully a reduction in new bugs I've added (NOTE: within reason, favour fewer rather than more lines of code).
 
Speaking of bugs, a closer read of '''addTab''' (see [http://lxr.mozilla.org/seamonkey/source/toolkit/content/widgets/tabbrowser.xml#1219 line 1219]) would indicate that we've introduced a few with our new positioning code:
 
// wire up a progress listener for the new browser object.
var position = '''this.mTabContainer.childNodes.length-1;'''
var tabListener = this.mTabProgressListener(t, b, blank);
...
this.mTabListeners[position] = tabListener;
this.mTabFilters[position] = filter;
...
t._tPos = position;
 
This will break tab deletion, among other things, since the positions of newly created tabs will be wrong internally. Where the assumption before was that the newly created tab was at the end of the list, the new code breaks that. Therefore, we also need to update the value of '''position'''
 
// wire up a progress listener for the new browser object.
var position = currentTabIndex + 1
No other obvious defects are visible from our changes.
=Reflections=

Navigation menu