Open Bug 1235231 Opened 4 years ago Updated 2 months ago

Sessions restore windows in random order

Categories

(Firefox :: Session Restore, defect)

42 Branch
defect
Not set

Tracking

()

REOPENED

People

(Reporter: racecarlock, Unassigned)

References

(Depends on 1 open bug, Blocks 4 open bugs)

Details

(Keywords: regression)

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0
Build ID: 20151221130713

Steps to reproduce:

Restore any session.


Actual results:

Session restores windows in random order like this: http://i.imgur.com/VJCV9VT.png


Expected results:

When the actual order of the windows should look like this: http://i.imgur.com/3N2FNKT.png

It happens whether I'm using session manager or tab mix plus.
Component: Untriaged → Session Restore
Duplicate of this bug: 1238526
Depends on: 1034534
Duplicate of this bug: 1239394
It's interesting that in Firefox 39 and 41, Firefox seemed to reliably restore windows correctly, but in 40 and 42+ we observe this issue. Bug 1034534 has existed prior to Firefox 39, so what made Firefox restore windows in the correct order in those aforementioned versions?
You all seem to suffer from a subset of https://bugzilla.mozilla.org/show_bug.cgi?id=372650 that nags Firefox power users since nearly a decade! 

I'm not kidding, this issue will celebrate its 9th birthday on the 5th of March this year (2016).
Oh great, fantastic. Does that mean we get a few more people working on it, then? Seriously, I've memorized my favorite session now and almost don't even need to use my screenshot anymore. This bug needs more attention.
Version: 43 Branch → 45 Branch
(In reply to Hans-Peter Jansen from comment #4)
> You all seem to suffer from a subset of bug 372650 that nags Firefox power
> users since nearly a decade! 

Are virtual desktops supported in Windows?
The two bugs may be related, but I don't think they are dupes.
Blocks: ss-feature
Status: UNCONFIRMED → NEW
Ever confirmed: true
I forget that Firefox upgrades without asking, when I click "Check for updates", so I unintentionally upgraded from 41.0.2 to 43.0.1 and I discovered this bug. (After exit Firefox and start it again, windows are i different order, only the 1st window is always 1st. Tabs in windows stays in its order.)
 Next "Check for updates" upgraded to 47.0.2, the same bug.
 Next "Check for updates" upgraded to 50.0.1, the same bug.
 At last I downgraded back to 41.0.2 .
Platform is Windows XP.
Hi Bill, I'm working on this bug. Mike said you can help me on this.

I want to add a new function allow us to reorder the windows in taskbar. The function can be called in Javascript, but its implementation is OS dependent. Where can I put the new function?
Flags: needinfo?(wmccloskey)
Assignee: nobody → nnn_bikiu0707
Status: NEW → ASSIGNED
I think this should go somewhere in the widget code. I'm not sure what interface we would expose it on. Maybe nsIWindowMediator.idl or nsIXULWindow.idl? Anyway, I'm going to needinfo some widget peers.

It would also help if you describe in more detail what you want to do. What OS function do you expect to call on Windows, for example?
Flags: needinfo?(wmccloskey)
Flags: needinfo?(mstange)
Flags: needinfo?(jmathies)
(In reply to Bill McCloskey (:billm) from comment #9)
> I think this should go somewhere in the widget code. I'm not sure what
> interface we would expose it on. Maybe nsIWindowMediator.idl or
> nsIXULWindow.idl? Anyway, I'm going to needinfo some widget peers.
> 
> It would also help if you describe in more detail what you want to do. What
> OS function do you expect to call on Windows, for example?

I'm thinking of a function that receives:
+ An array of windows
+ An array that describe the expected order of windows on the taskbar.

In comment 6 of bug 1034036, David said that function ShowWindow can re-order the windows in taskbar. I tested and it worked.
While working on this, please note, that some desktop environments also have the concept of multiple screens (on multiple displays), that bug 372650 is suffering from, and plays in the same league like this one...
(In reply to Bao Quan [:beekill] from comment #8)
> Hi Bill, I'm working on this bug. Mike said you can help me on this.
> 
> I want to add a new function allow us to reorder the windows in taskbar. The
> function can be called in Javascript, but its implementation is OS
> dependent. Where can I put the new function?

nsITaskbarPreview would work. I think OSX has a similar interface for the doc.
Flags: needinfo?(jmathies)
I tested the interface ITaskbarList [1] to reorder windows in the taskbar. It works better than function ShowWindow - it doesn't hide and show window, therefore, doesn't make flickering effect.

It would be great to see if similar function exists on OSX. If it doesn't, then I'm afraid we have to find another way to maintain the creation order of windows, like comment [2].

[1]: https://msdn.microsoft.com/en-us/library/windows/desktop/bb774652(v=vs.85).aspx
[2]: https://bugzilla.mozilla.org/show_bug.cgi?id=1034036#c5
(In reply to Bao Quan [:beekill] from comment #13)
> It would be great to see if similar function exists on OSX.

I don't know if there is an API for this. I think there are two places where the order is relevant: the Window menu, which lists all open windows, and if there are minimized windows, the order of those minimized windows in the right part of the Dock.

I don't know what determines the order in the Window menu. It's possible that calling -[NSApplication removeWindowsItem:] and -[NSApplication addWindowsItem:title:filename] will move a window's entry to the end of the list, but I haven't tested that.

I would be really surprised if there was a way to reorder minimized windows in the Dock.
Flags: needinfo?(mstange)
Quan hasn't been able to work on Firefox bugs for a while now. Unassigning to allow others to finish this up.
Assignee: nnn_bikiu0707 → nobody
Status: ASSIGNED → NEW
I have noticed that Firefox has the problem during session restoration with more than 2 windows (always as I remember, at least since FF3.6; Windows 7 x64). Windows (2nd, 3rd,..) after session restoration are usually in different order then in the oryginal session before browser restart; first window remains always as first one even after multiple restarts. Fortunately, the order of tabs is maintained. This problem is independent of Session Manager (exist with and w/o this extension).

(On the contrary, Chrome during session restoration will have windows in the correct order, but most tabs in the window will be in the reverse order.)
No longer blocks: Session_managers
Regression window: https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=c26dbd63604d&tochange=f5e3bacfb60e

It's a regression since bug 346301 but in worse: it used to restore the active window first and the rest in the correct order. Now everything is random.
Keywords: regression
Version: 45 Branch → 42 Branch
I think bug 1034036 fixed this is as well.
Status: NEW → RESOLVED
Closed: Last year
Resolution: --- → DUPLICATE
Duplicate of bug: 1034036
Unfortunately, bug 1034036 didn't fix this.

Note that this bug is linked to the speed of windows opening. If the windows open fast enough, it's not reproducible.
So extensions and a session file that slow down enough the browser are needed to reproduce it.
Status: RESOLVED → REOPENED
Resolution: DUPLICATE → ---
Test profile to reproduce

To reproduce:
- Replace the content of an existing Firefox profile with the content of the archive in the link below.
- Open Firefox
- Open History menu and click Restore previous session

Expected result: windows are restored with titles from 1 to 5, with windows 4 active

Actual result: windows are restored with titles in random order, with windows 4 active

Note that after each test you have to copy sessionstore.jsonlz4.copy and rename it to sessionstore.jsonlz4 to run a new test.
Or you can use mozregression(-gui) and choose the clone option for profile persistence.

Because of bug 1449742 I couldn't attach the test profile (size greater than 10 MB), so I uploaded it to https://www88.zippyshare.com/v/Ru3VLD4a/file.html (available for 30 days after the last download).
Observed behavior; I see a pattern (clue?)

Restoring last session seems to put last focused tab first, then all others follow in reverse order (i.e. tab 2 now last tab and right-most is now tab 2).
Seems to do it to only one window (of 2 windows restored), I forget if it ever mixed more than one window when I had 3+ windows restored.  (IIRC, one window would be normal, others mixed.)
'1' focused B4 restart: 1,2,3,4,5,6 => 1,6,5,4,3,2
'2' focused B4 restart: 1,2,3,4,5,6 => 2,6,5,4,3,1 IIRC

My current routine:
I focus the 1st tab of each window B4 closing FF. (to make manual re-ordering of tabs [after restart] easier for me)
On restart, last session restore will usually rearrange just one[?] window as above.  Occasionally it opens all windows correctly (but not lately).

First-time poster, non-technical, hope this is acceptable.
(In reply to Mr Kim Lindstrom from comment #21)
> Observed behavior; I see a pattern (clue?)
> 
> Restoring last session seems to put last focused tab first, then all others
> follow in reverse order (i.e. tab 2 now last tab and right-most is now tab
> 2).
> Seems to do it to only one window (of 2 windows restored), I forget if it
> ever mixed more than one window when I had 3+ windows restored.  (IIRC, one
> window would be normal, others mixed.)
> '1' focused B4 restart: 1,2,3,4,5,6 => 1,6,5,4,3,2
> '2' focused B4 restart: 1,2,3,4,5,6 => 2,6,5,4,3,1 IIRC
> 
> My current routine:
> I focus the 1st tab of each window B4 closing FF. (to make manual
> re-ordering of tabs [after restart] easier for me)
> On restart, last session restore will usually rearrange just one[?] window
> as above.  Occasionally it opens all windows correctly (but not lately).

This bug is for the order of windows, rather than tabs within a window. If your tabs change order within windows, that would be a different bug. However, can you confirm that is with only Firefox's native session restore feature, and not an extension that might use a different order?
This bug is very annoying. You have prepared fix for similar Bug 1034036, so maybe it will be possible also to solve Bug 1235231? Thank you.
Flags: needinfo?(mikedeboer.mozbugs)
Flags: needinfo?(mdeboer)
Flags: needinfo?(mikedeboer.mozbugs)
This bug has come for me in Firefox 61.0. Before this it had been solved for several versions going back a year or so. Please fix - super annoying! I also tried 62.0b3 and it has the same issue.

Windows 10. I tried repeatedly closing and re-opening my prefered set of 9 windows into the right order. Exiting Firefox 61.0, then when I reopen it they are in random order except the first window is still first. Exact same bug that used to exist, somewhere back in the 5X.0 series it got fixed.
I think this may be caused by the same issue as bug 1435077, which I added as a dependency here. Somehow, sessionstore flush on application exit is not working as it should anymore.
Depends on: 1435077
Flags: needinfo?(mdeboer)
Blocks: ss-reliability
No longer blocks: ss-feature
(In reply to Mike de Boer [:mikedeboer] from comment #25)
> I think this may be caused by the same issue as bug 1435077, which I added
> as a dependency here. Somehow, sessionstore flush on application exit is not
> working as it should anymore.

This problem (Sessions restore windows in random order) was also way before Quantum. At least since FF3.6.
I have also always experienced this issue (wrong order of windows after restore), at least for as long as I can remember.
Very annoying bug! It started for me after upgrade to version 61 (Firefox 64-bit, Windows 10 Pro 64-bit).
I have 4 Firefox windows. After exiting Firefox and reopening it they are in random order except the first window.
Please fix as soon as possible.
Blocks: ss-SM
Can you look into bug 1235231?
This bug is very annoying and it is present in Firefox at least since version 3.6. Please, see comment 16 for details.
Flags: needinfo?(dharvey)
Yeh was able to reproduce this, however I am fairly busy and I do not expect it to be a trivial fix, if you want any help fixing it then please feel free to ping me
Flags: needinfo?(dharvey)
The reason why fixing this bug is important:
https://bugzilla.mozilla.org/show_bug.cgi?id=1460423#c17
See Also: → 1253129

Chrome works correctly.

New Profile
Set FF to restore session on startup
FF 67, Win10
FF 66. Win7

STR:

Do a google search for, one
Open a new Window
Do a google search for, two
Open a new Window
Do a google search for, tree
Open a new Window
Do a google search for, four

At this point, 4 Windows are open
Note their ordering along the [Windows] taskbar
one, two, three, four

Quit, saving the session, Ctrl+Shift+Q.

Open FF, restoring the session.

Note the ordering along the [Windows] taskbar

Whatever ordering it may be, it will almost assuredly not be; one, two, three four.

12 runs, doing nothing more then closing, reopening, noting, ...:
1 2 3 4
1 4 2 3
1 3 4 2
1 2 4 3
1 3 4 2
1 3 4 2
1 3 4 2
1 2 4 3
1 2 3 4 <-back in order
1 3 2 4 (nothing changed, except close & reopen)
1 4 2 3
1 2 4 3

Utterly ridiculous that this ugly bug exists.

Over time, various browsers & browser versions have been afflicted with this bug.
Over time, various extensions has exacerbated the situation.
FF "Legacy" has been affected, FF Quantum is affected.
There have been times where FF Quantum, natively (i.e. no extensions or anything like that) worked as expected (or at least it was very difficult to duplicate the bug).
There have been times where FF Quantum - with the addition of an extension (at the least a particular extension, NoScript 10 as it happened to be) caused this situation to occur.
There have been times where FF Quantum (currently, at the least 66 & 67) have this bug - needing no additional interactions from extensions (like NoScript) or anything else.

(In reply to Robert Ab from comment #16)

I have noticed that Firefox has the problem during session restoration with more than 2 windows (always as I remember,
at least since FF3.6; Windows 7 x64). Windows (2nd, 3rd,..) after session restoration are usually in different order then in
the oryginal session before browser restart; first window remains always as first one even after multiple restarts.
Fortunately, the order of tabs is maintained. This problem is independent of Session Manager (exist with and w/o this extension).

(On the contrary, Chrome during session restoration will have windows in the correct order, but most tabs in the window will be in the reverse order.)

I got similar conclusion, as presented in Bug 1235231 comment 32. Bug still exists in Firefox 66.0.5.

[10] Taskbar Icons r Reordered on open from Session Restore
https://forums.informaction.com/viewtopic.php?f=10&t=25142

See Also: → 1034036

therube:

There have been times where FF Quantum (currently, at the least 66 & 67) have this bug - needing no additional interactions from extensions (like NoScript) or anything else.

I cannot resist, but confirm and further note, that neither window position nor size nor content nor screen is kept with 66.0.5's session restore. In short, it is in company of the worst states of this bug in Firefox history.

BTW, this bug celebrated its 12th birthday two month ago in the form of https://bugzilla.mozilla.org/show_bug.cgi?id=372650.

Oh, going out on a limb - where is that piece of wood; knock, knock...

FF 69, 20190603160429, looks to be better behaved - both on its own, & also in conjunction with NoScript.

It will still mess up - but less like to do so.

Was on 67 before, & that screwed up - immediately.

69 is more consistent - though still not "right".

Now, you're more apt to see something like:

1-2-3-4
1-2-3-4
1-2-3-4
1-2-3-4
1-2-3-4
1-2-3-4
1-2-3-4
1-2-4-3 -> broke
1-2-4-3
1-2-4-3
1-2-4-3 ... & then it remains consistent like that - for a period of time... until it changes again.

Now this is with a very simple, very basic test; just 4 windows, either 0 or 1 extension (NoScript).

Much improved - compared to FF 67 - for whatever reason.
But still not "right", still not to where things should be - as in always working correctly - period.

Now that's exceptionally good news.

Tumbleweed usually picks up new releases a couple of days after, well, release.

My setup consists from about 25 windows, with a few hundred tabs.

Let's see, how it behaves cross platform..

You need to log in before you can comment on or make changes to this bug.