session restore fails when selectedWindow > number of windows

RESOLVED FIXED in Firefox 10

Status

()

Firefox
Session Restore
--
major
RESOLVED FIXED
6 years ago
5 years ago

People

(Reporter: wsmwk, Assigned: zpao)

Tracking

(Blocks: 1 bug, {regression})

Trunk
Firefox 10
regression
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

+++ This bug was initially created as a clone of Bug #567646 +++

I'm seeing this again - precisely the same steps and symptoms. I had deselected all tabs and windows in the restore list except tab 1 (which was a previous/nested session list)

Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:10.0a1) Gecko/20111006 Firefox/10.0a1

1. killed firefox 
2. started firefox 
3. unselected several windows and tabs from restore:session window
4. clicked Restore
results: restore button dims, and tabs were not restored

5. select all the tabs in "windows 1" 
results: restore works

error console contains ....

Error: uncaught exception: [Exception... "'[JavaScript Error: "winData is undefined" {file: "resource:///components/nsSessionStore.js" line: 2579}]' when calling method: [nsISessionStore::setWindowState]"  nsresult: "0x80570021 (NS_ERROR_XPC_JAVASCRIPT_ERROR_WITH_DETAILS)"  location: "JS frame :: chrome://browser/content/aboutSessionRestore.js :: restoreSession :: line 140"  data: yes]
(Reporter)

Updated

6 years ago
Hardware: x86 → x86_64
This is a regression from bug 669272. This happens when selectedWindow is > windows.length. we then unshift undefined to the front of the windows array and puts us in this case.
Keywords: testcase → regression
OS: Windows 7 → All
Hardware: x86_64 → All
(Reporter)

Updated

6 years ago
Blocks: 669272
Created attachment 566917 [details] [diff] [review]
Patch v0.1

I should probably write a test for this, but this does fix it. Trust me, I'm a doctor (or something)
Assignee: nobody → paul
Attachment #566917 - Flags: review?(dietrich)
Created attachment 567631 [details] [diff] [review]
Patch v0.2

Now with a test.
Attachment #566917 - Attachment is obsolete: true
Attachment #566917 - Flags: review?(dietrich)
Attachment #567631 - Flags: review?(dietrich)
Comment on attachment 567631 [details] [diff] [review]
Patch v0.2

Review of attachment 567631 [details] [diff] [review]:
-----------------------------------------------------------------

r=me

::: browser/components/sessionstore/src/nsSessionStore.js
@@ +2564,5 @@
>      if (root._closedWindows)
>        this._closedWindows = root._closedWindows;
>  
>      var winData;
> +    if (!root.selectedWindow || root.selectedWindow > root.windows.length) {

would dig seeing selectedWindow renamed to selectedWindowIndex or something more self-descriptive like that. but that's a nice-to-have.
Attachment #567631 - Flags: review?(dietrich) → review+
(In reply to Dietrich Ayala (:dietrich) from comment #4)
> would dig seeing selectedWindow renamed to selectedWindowIndex or something
> more self-descriptive like that. but that's a nice-to-have.

I'm going to keep it for now. I've resisted the strong urge to change any of the existing keys for a while. There are other changes to the format I want to make (for example, not have the indexes be 1-based). I think it might make sense to just do all the changes at once (though that's going to be fun for Sync)
Summary: sessions not restored if some tabs deselected in sessionrestore list → session restore fails when selectedWindow > number of windows
pushed to fx-team: https://hg.mozilla.org/integration/fx-team/rev/5d7c2550a61e
Whiteboard: [fixed-in-fx-team]

Comment 7

6 years ago
https://hg.mozilla.org/mozilla-central/rev/5d7c2550a61e
Status: NEW → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
Whiteboard: [fixed-in-fx-team]
Target Milestone: --- → Firefox 10

Updated

6 years ago
Blocks: 698267
Blocks: 729281
You need to log in before you can comment on or make changes to this bug.