Closed
Bug 819510
Opened 12 years ago
Closed 12 years ago
Quitting from a Private Browsing window makes Restore Previous Session fail once
Categories
(Firefox :: Private Browsing, defect)
Tracking
()
RESOLVED
FIXED
Firefox 20
People
(Reporter: mozbz, Assigned: bellindira)
References
Details
(Whiteboard: [appcoast])
Attachments
(1 file, 6 obsolete files)
(deleted),
patch
|
Details | Diff | Splinter Review |
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:20.0) Gecko/20121204 Firefox/20.0
Build ID: 20121204030754
Steps to reproduce:
(Per-Window Private Browsing testday)
1. In Options -> General, have Firefox start with a homepage or a blank page.
2. Visit a few sites in tabs.
3. Go to the File menu and select "New Private Window" and visit some different sites.
4. In the Private Window, go to the File menu and select "Exit". Both windows close.
5. Start Firefox.
6. From the History menu, choose "Restore Previous Session".
Actual results:
At Step 6, no tabs are restored. However, repeating Step 6 will correctly restore the tabs from the non-Private session.
Expected results:
The tabs should be restored first time.
There is also a problem when you restore previous session by default. If you close a private window after closing all normal ones and you restart the browser, the session is forgotten (even pinned tabs).
Comment 2•12 years ago
|
||
This is what I get in the console:
JavaScript error: chrome://browser/content/browser.js, line 9727: NS_ERROR_XPC_JS_THREW_JS_OBJECT: 'TypeError: winState is undefined' when calling method: [nsISessionStore::restoreLastSession]
Andres, can you please look into this? Thanks!
Updated•12 years ago
|
Assignee: nobody → bellindira
Assignee | ||
Updated•12 years ago
|
Status: NEW → ASSIGNED
Assignee | ||
Comment 3•12 years ago
|
||
This issue was caused because the selectedWindow was not updated when the browser state is saved and private windows are removed.
Attachment #691114 -
Flags: review?(ehsan)
Comment 4•12 years ago
|
||
Comment on attachment 691114 [details] [diff] [review]
Patch
> // Restore into windows or open new ones as needed.
> for (let i = 0; i < lastSessionState.windows.length; i++) {
> let winState = lastSessionState.windows[i];
>+ // Make sure the window exist
>+ if (winState) {
make this:
if (!winState)
continue;
Comment 5•12 years ago
|
||
Comment on attachment 691114 [details] [diff] [review]
Patch
Review of attachment 691114 [details] [diff] [review]:
-----------------------------------------------------------------
Looks good to me, but I'd prefer Tim to review it.
Attachment #691114 -
Flags: review?(ehsan) → review?(ttaubert)
Comment 6•12 years ago
|
||
Comment on attachment 691114 [details] [diff] [review]
Patch
Review of attachment 691114 [details] [diff] [review]:
-----------------------------------------------------------------
Looks good to me but please update the patch and follow Dão's advice. It's always preferable to not lose too many blame information for small changes like this.
Attachment #691114 -
Flags: review?(ttaubert) → review+
Comment 7•12 years ago
|
||
Comment on attachment 691114 [details] [diff] [review]
Patch
Review of attachment 691114 [details] [diff] [review]:
-----------------------------------------------------------------
Wait, if the core issue is that .selectedWindow isn't updated properly we should do exactly that on line http://mxr.mozilla.org/mozilla-central/source/browser/components/sessionstore/src/SessionStore.jsm#3713
Something like:
if (oState.selectedWindow >= i) {
oState.selectedWindow--;
}
Also, I'd really like to have a test for this.
Attachment #691114 -
Flags: review+ → review-
Assignee | ||
Comment 8•12 years ago
|
||
- Updated the patch according to the suggestions.
- I'll post a new patch for the test case later.
Attachment #691114 -
Attachment is obsolete: true
Attachment #691407 -
Flags: review?(ttaubert)
Assignee | ||
Comment 9•12 years ago
|
||
Removed all white spaces changes from previous patch
Attachment #691407 -
Attachment is obsolete: true
Attachment #691407 -
Flags: review?(ttaubert)
Attachment #691412 -
Flags: review?(ttaubert)
Comment 10•12 years ago
|
||
Comment on attachment 691412 [details] [diff] [review]
Patch v2
Review of attachment 691412 [details] [diff] [review]:
-----------------------------------------------------------------
Waiting for the test to make sure this works. I just assume you tested this manually? Thanks!
::: browser/components/sessionstore/src/SessionStore.jsm
@@ +1757,5 @@
> for (let i = 0; i < lastSessionState.windows.length; i++) {
> let winState = lastSessionState.windows[i];
> + // Make sure the window exist
> + if (!winState)
> + continue;
We don't really need this anymore, do we? I'd rather have this fail than silently swallowing errors.
Attachment #691412 -
Flags: review?(ttaubert) → review+
Comment 11•12 years ago
|
||
Bellindira, are you going to provide an updated patch here with tests? Just want to make sure this does not fall off the radar. Thanks!
Assignee | ||
Comment 12•12 years ago
|
||
Yes, I'm going to update the patch with the test. I'm working on it. Thanks
Assignee | ||
Comment 13•12 years ago
|
||
Attachment #691412 -
Attachment is obsolete: true
Attachment #692152 -
Flags: review?(ttaubert)
Comment 14•12 years ago
|
||
Comment on attachment 692152 [details] [diff] [review]
Patch + testcase
Review of attachment 692152 [details] [diff] [review]:
-----------------------------------------------------------------
LGTM in general but the test fails when run in single-mode (as do browser_394759_perwindowpb.js and browser_354894_perwindowpb.js). I'd be fine with fixing those three in a follow-up.
r=me with a follow-up filed.
Please push to try before marking as checkin-needed.
::: browser/components/sessionstore/test/browser_819510_perwindowpb.js
@@ +1,3 @@
> +/* This Source Code Form is subject to the terms of the Mozilla Public
> + * License, v. 2.0. If a copy of the MPL was not distributed with this
> + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
Tests should have a public domain header:
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
@@ +40,5 @@
> + let currentTest = tests.shift();
> + waitForBrowserState(testState, currentTest);
> + }
> + else {
> + Services.prefs.clearUserPref("browser.sessionstore.interval");
Please put this in the test() function and wrap it in a registerCleanupFunction() call. So we're sure this is called when we time out.
@@ +65,5 @@
> + is (curState.windows[4].isPrivate, true, "Last window is private");
> + is (curState.selectedWindow, 5, "Last window opened is the one selected");
> +
> + Services.obs.addObserver(function (aSubject, aTopic, aData) {
> + Services.obs.removeObserver(arguments.callee, aTopic);
Please assign a function name and use that instead of arguments.callee, that's deprecated.
@@ +101,5 @@
> + is (curState.windows[2].isPrivate, true, "Window 2 is private");
> + is (curState.selectedWindow, 3, "Last window opened is the one selected");
> +
> + Services.obs.addObserver(function (aSubject, aTopic, aData) {
> + Services.obs.removeObserver(arguments.callee, aTopic);
Please assign a function name and use that instead of arguments.callee.
@@ +133,5 @@
> + is (curState.selectedWindow, 4, "Last window opened is the one selected");
> +
> + normalWindow.close();
> + Services.obs.addObserver(function (aSubject, aTopic, aData) {
> + Services.obs.removeObserver(arguments.callee, aTopic);
Please assign a function name and use that instead of arguments.callee.
Attachment #692152 -
Flags: review?(ttaubert) → review+
Assignee | ||
Comment 15•12 years ago
|
||
- Fixed nits.
- Pushed to try: https://tbpl.mozilla.org/?tree=Try&rev=51639e8772df
- Follow up Bug 821847
Attachment #692152 -
Attachment is obsolete: true
Attachment #692422 -
Flags: review?(ttaubert)
Comment 16•12 years ago
|
||
The try job was based on an older m-c which did not have MOZ_PER_WINDOW_PRIVATE_BROWSING set by default, so it was actually not testing anything useful. I'll push this to try again.
Comment 17•12 years ago
|
||
Comment on attachment 692422 [details] [diff] [review]
Patch + testcase
(r+ usually means that you don't need to ask for another review after addressing the nits...)
Attachment #692422 -
Flags: review?(ttaubert)
Updated•12 years ago
|
Keywords: checkin-needed
Comment 19•12 years ago
|
||
Keywords: checkin-needed
Comment 20•12 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → Firefox 20
Updated•12 years ago
|
Comment 21•12 years ago
|
||
Backed out for intermittent test failures (bug 822093). Before this relands the test either needs fixing, or the reviewer would need to approve landing without tests.
https://hg.mozilla.org/integration/mozilla-inbound/rev/10cb0e3aac02
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Target Milestone: Firefox 20 → ---
Comment 22•12 years ago
|
||
Please may we also s/writted/written/ when this relands?
Comment 23•12 years ago
|
||
(In reply to Ed Morley [UTC+0; email:edmorley@moco] from comment #21)
> Backed out for intermittent test failures (bug 822093). Before this relands
> the test either needs fixing, or the reviewer would need to approve landing
> without tests.
>
> https://hg.mozilla.org/integration/mozilla-inbound/rev/10cb0e3aac02
https://hg.mozilla.org/mozilla-central/rev/10cb0e3aac02
Comment 24•12 years ago
|
||
I added the test fix in Bug 822093 comment 16 and is all green on try.
See: https://tbpl.mozilla.org/?tree=Try&rev=17c1e98fec0f
Let me know if the whole patch fixed is needed.
Comment 25•12 years ago
|
||
(In reply to Andres Hernandez [:andreshm] from comment #24)
> I added the test fix in Bug 822093 comment 16 and is all green on try.
> See: https://tbpl.mozilla.org/?tree=Try&rev=17c1e98fec0f
>
> Let me know if the whole patch fixed is needed.
The failure was intermittent (rather than permanently orange), so one green run may not be sufficient to tell if this is fixed. I've retriggered some of the runs on https://tbpl.mozilla.org/?tree=Try&rev=17c1e98fec0f to help prove either way.
Thank you for looking at this :-)
Comment 26•12 years ago
|
||
Rebased patch with latest fixes in Bug 822093.
Attachment #692422 -
Attachment is obsolete: true
Comment 28•12 years ago
|
||
Added a new check to ensure the window is closed.
Pushed to try: https://tbpl.mozilla.org/?tree=Try&rev=a70b8f394033
Attachment #693940 -
Attachment is obsolete: true
Comment 29•12 years ago
|
||
All green on try: https://tbpl.mozilla.org/?tree=Try&rev=a70b8f394033
Updated•12 years ago
|
Keywords: checkin-needed
Comment 30•12 years ago
|
||
Keywords: checkin-needed
Comment 31•12 years ago
|
||
Status: REOPENED → RESOLVED
Closed: 12 years ago → 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 20
You need to log in
before you can comment on or make changes to this bug.
Description
•