Closed Bug 296275 Opened 20 years ago Closed 19 years ago

forward button history throws error

Categories

(Firefox :: Toolbars and Customization, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
Firefox1.5

People

(Reporter: Peter6, Assigned: tabmix.onemen)

Details

(Keywords: regression)

Attachments

(1 file, 2 obsolete files)

Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8b2) Gecko/20050601
Firefox/1.0+ ID:2005060113

repro:
1.click any link on this page
2.press menu back button
3.press menu forward button

Error: uncaught exception: [Exception... "Component returned failure code:
0x80004005 (NS_ERROR_FAILURE) [nsISHistory.getEntryAtIndex]"  nsresult:
"0x80004005 (NS_ERROR_FAILURE)"  location: "JS frame ::
chrome://browser/content/browser.js :: FillHistoryMenu :: line 2457"  data: no]

regression bug 285647

fix:
        case "forward":
          end  = ((count-index) > MAX_HISTORY_MENU_ITEMS) ? index +
MAX_HISTORY_MENU_ITEMS : count-1;
          if ((index + 1) > end) return false;
          for (j = index + 1; j <= end; j++)
            {
              entry = sessionHistory.getEntryAtIndex(j, false);
              if (entry)
                createMenuItem(aParent, j, entry.title);
            }
          break;

credits: onemen@walla.com
the fix works for me. im nominating blocking1.8b3.
Flags: blocking1.8b3?
Comment on attachment 185065 [details] [diff] [review]
fix uncaught exception in the case end == count

This regresses bug 285647, so it's not acceptable.
Attachment #185065 - Attachment is obsolete: true
Attachment #185065 - Flags: review-
(In reply to comment #3)
> (From update of attachment 185065 [details] [diff] [review] [edit])
> This regresses bug 285647, so it's not acceptable.
> 

no no no
it does not regresses bug 285647, i can still count from 1.... to 15. :)
I've tested it, and it does regress the bug. Are you sure you're testing
correctly? Visit more than fifteen pages, so that the back menu has more than 15
entries, then use the back button to go back to the first page you visited. You
then see only 14 entries in the forward button dropdown.
Component: History → Toolbars
OS: Windows 2000 → All
QA Contact: history → toolbars
Hardware: PC → All
(In reply to comment #6)
> I've tested it, and it does regress the bug. Are you sure you're testing
> correctly? Visit more than fifteen pages, so that the back menu has more than 15
> entries, then use the back button to go back to the first page you visited. You
> then see only 14 entries in the forward button dropdown.

i'm very sure. can you check again..... 
Attachment #185065 - Attachment is obsolete: false
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b2) Gecko/20050607
Firefox/1.0+

Using the steps in comment 0, I see the error message in the JavaScript console,
but clicking an item in the forward menu works anyway.
Flags: blocking1.8b4?
Flags: blocking1.8b3?
Flags: blocking1.8b3-
(In reply to comment #6)
> I've tested it, and it does regress the bug. Are you sure you're testing
> correctly? Visit more than fifteen pages, so that the back menu has more than 15
> entries, then use the back button to go back to the first page you visited. You
> then see only 14 entries in the forward button dropdown.

It does not regress the bug, I've tested it and it makes perfect sense!
(In reply to comment #9)

Let me explain :)

Basically, in the case of having less than 16 items in the history |end| is
being assigned to |count|, and the for loop uses j <= end, which is invalid
because count is one past the last item in the session history.

So by returning count - 1 (once again, this is only for the case of having less
than 16 items) will give us a proper |end| which points to the last item in the
history.
Attached patch Updated (obsolete) — Splinter Review
Sorry, this does appear to work. I must have made a mistake in testing it
earlier. Here's the same patch, but unbitrotted.
Attachment #185065 - Attachment is obsolete: true
Attachment #187996 - Flags: review?(mconnor)
Urgh, forgot the help portion. Sorry for the spam.
Attachment #187996 - Attachment is obsolete: true
Attachment #187997 - Flags: review?(mconnor)
Assignee: nobody → onemen
Attachment #187997 - Flags: review?(mconnor) → review+
Comment on attachment 187997 [details] [diff] [review]
Fix help and browser

Requesting approval for a small/safe patch that deals with an uncaught
exception.
Attachment #187997 - Flags: approval-aviary1.1a2?
Attachment #187997 - Flags: approval-aviary1.1a2? → approval-aviary1.1a2+
Whiteboard: [checkin needed]
Checking in toolkit/components/help/content/help.js;
/cvsroot/mozilla/toolkit/components/help/content/help.js,v  <--  help.js
new revision: 1.33; previous revision: 1.32
done
Checking in browser/base/content/browser.js;
/cvsroot/mozilla/browser/base/content/browser.js,v  <--  browser.js
new revision: 1.453; previous revision: 1.452
done
Assignee: onemen → gavin.sharp
Whiteboard: [checkin needed]
Target Milestone: --- → Firefox1.1
Status: NEW → RESOLVED
Closed: 19 years ago
Flags: blocking1.8b4?
Flags: blocking1.8b3-
Resolution: --- → FIXED
Reopening to reassign. onemen@walla.com fixed this, not me :).
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Assignee: gavin.sharp → onemen
Status: REOPENED → NEW
Status: NEW → RESOLVED
Closed: 19 years ago19 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: