Dive into Mozilla Fixing a Bug Lab
- Read the description of the following bug, and make sure you can reproduce the behaviour in your browser. Use Firefox 2 and not your trunk build to test, since trunk has it fixed:
Deleting first item in History Sidebar causes no item have focus. Deleting any other item sets focus on the next item after the deleted one (and that is correct). Reproducible: Always Steps to Reproduce: 1. Open history sidebar (View > Sidebar > History or CTRL+H) 2. Sort items by date 3. Delete category Today (which is certainly the first one) You can alternatively use history search and delete fist item found. Actual Results: None of items or categories have focus. Expected Results: Focus should be set on the next item after deleted one.
- Since the bug has already been fixed, we need to roll-back to an earlier version of the file from CVS. NOTE: at the time of writing (February 28, 2007), the most recent version of nsTreeController.js was 1.5, and we need 1.4:
$ cd mozilla/toolkit/obsolete/content $ cvs update -j1.5 -j1.4 nsTreeController.js RCS file: /cvsroot/mozilla/toolkit/obsolete/content/nsTreeController.js,v retrieving revision 1.5 retrieving revision 1.4 Merging differences between 1.5 and 1.4 into nsTreeController.js
- You can then update your browser to include this new file by doing the following:
$ cd ../../../objdir/toolkit/obsolete $ make
- This will take the various .js files in that directory and create a new .jar file (i.e., a zip file suitable for distribution).
- Now, using the debugging tools and techniques we learned earlier, see if you can isolate and fix this bug in nsTreeController.js.
Try to avoid the temptation to look at the patch until you have finished!