Closed Bug 597071 Opened 15 years ago Closed 15 years ago

Only add last closed window to open windows at shutdown

Categories

(Firefox :: Session Restore, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
Firefox 4.0b7

People

(Reporter: zpao, Assigned: zpao)

References

Details

Attachments

(1 file, 1 obsolete file)

This came out of bug 596592, where entering PB mode with just a popup and then leaving causes the last opened window to reopen. _getCurrentState is actually lying about the current state when there is a single window open and it's a popup (and there was a recently closed non-popup). It shifts a closed window into the open window list http://mxr.mozilla.org/mozilla-central/source/browser/components/sessionstore/src/nsSessionStore.js#1953 This is fine for when quitting and we've been doing such for a long time. But I don't think it's the right thing to do when entering/exiting private browsing mode.
How can we detect whether _getCurrentState is called during shutdown?
if (_this._loadState == STATE_QUITTING) // move last closed non-popup I think we also want to check something about _restoreLastWindow (for the all browser windows are closed, but view-source was left open), since we'll still have STATE_RUNNING.
Blocks: 595236
Attached patch Patch v0.1 (obsolete) — Splinter Review
Fix it all up and it even includes a test (win/linux only). I didn't have a windows machine handy, but Sean has run this and says it passes with the fix, and fails without.
Assignee: nobody → paul
Status: NEW → ASSIGNED
Attachment #476464 - Flags: review?(dolske)
Comment on attachment 476464 [details] [diff] [review] Patch v0.1 Dietrich / Dolske: whoever gets to it first wins! I know the timing is pretty crappy, but Panorama needs this to fix a b7 blocker (it really just makes test behavior for some private browsing tests accurate). It is a bit changy - API consumers will get an accurate state as opposed to the fake state we've been providing.
Attachment #476464 - Flags: review?(dietrich)
Comment on attachment 476464 [details] [diff] [review] Patch v0.1 Alas, I think dietrich should do the review here, I don't know session restore well enough to judge the impact of this. Even though it's a 1-line change. >+++ b/browser/components/sessionstore/test/browser/browser_597071.js ... >+ // Test is Win/Linux only >+ // if ("nsILocalFileMac" in Ci) >+ // return; Really? :)
Attachment #476464 - Flags: review?(dolske)
I pushed a workaround for this in bug 596592: http://hg.mozilla.org/mozilla-central/rev/f1eec85dcfdc It should be backed out when this bug is fixed.
Comment on attachment 476464 [details] [diff] [review] Patch v0.1 This makes sense, makes the API more consistent. To make the test only run for Win/Linux, move the check to the makefile so that it doesn't run at all. r=me w/ that change.
Attachment #476464 - Flags: review?(dietrich) → review+
Sent to try with 595236
Try server failed this bug's test (timeout) on linux, see try build http://hg.mozilla.org/try/rev/617debdc2f5e
Used #ifndef XP_MACOSX in the Makefile to target win/linux. Also moved the listener off the tabContainer to gBrowser, since that's what was most likely causing the timeout (tabContainer doesn't capture page loads, just favicons)
Attachment #476464 - Attachment is obsolete: true
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 4.0b7
Pushed http://hg.mozilla.org/mozilla-central/rev/7b85cdce3ea6 to followup on the bustage. I can't do what I had done in the Makefile (don't know why it worked locally!)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: