Closed
Bug 515006
Opened 15 years ago
Closed 15 years ago
Port Bug 354894 [Session restore doesn't work if process hasn't exited (Downloads window open)] to SeaMonkey. (browser_bug515006.js)
Categories
(SeaMonkey :: Session Restore, defect)
SeaMonkey
Session Restore
Tracking
(Not tracked)
RESOLVED
FIXED
seamonkey2.0
People
(Reporter: misak.bugzilla, Assigned: misak.bugzilla)
References
(Depends on 3 open bugs)
Details
(Keywords: fixed-seamonkey2.0)
Attachments
(2 files, 6 obsolete files)
(deleted),
patch
|
neil
:
review+
neil
:
superreview+
kairo
:
approval-seamonkey2.0+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
neil
:
review+
|
Details | Diff | Splinter Review |
From parent bug:
Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8.1) Gecko/20060929
BonEcho/2.0 ID:2006092903
From mirp @ http://forums.mozillazine.org/viewtopic.php?p=2515163#2515163
1. New profile, start firefox
2. Tools > Options > Main > Startup, set 'When Bon Echo Starts' to 'Show my
tabs and windows from last time'
3. Open some tabs.
4. Open downloads window from Tools > Downloads
5. Close the browser window (so only the download window remains open)
6. Whilst the download window is still open, relaunch firefox
Expected:
Firefox window starts up with previous session's tabs present
Actual:
Firefox starts up, but not with the session-you-just-closed's tabs
I guess this is because when you shut down the last browser window but with the
downloads window still active, firefox doesn't consider this to be closing
firefox down, so no session data is saved.
Perhaps instead of firefox saving session date only when the firefox.exe
process is closing, it should do it when the last browser window is closing?
Also i changed some logic in nsSuiteGlue.js, and in windowsisclosing function in navigator.js
Attachment #399035 -
Flags: superreview?(neil)
Attachment #399035 -
Flags: review?(neil)
Attachment #399035 -
Flags: approval-seamonkey2.0?
Flags: wanted-seamonkey2.0?
Comment 1•15 years ago
|
||
I'm a bit worried about what to do with mailnews (in the longer term), but this sounds like nice polish to current behavior at least, so wanted+ (I'll cancel the approval request as it can go in with just the wanted+ and I don't feel like approving a patch that doesn't have any review yet).
Flags: wanted-seamonkey2.0? → wanted-seamonkey2.0+
Updated•15 years ago
|
Attachment #399035 -
Flags: approval-seamonkey2.0?
Assignee | ||
Comment 2•15 years ago
|
||
Fixes some wrong string usage, also contains fix for bug 514388
Attachment #399035 -
Attachment is obsolete: true
Attachment #399261 -
Flags: superreview?(neil)
Attachment #399261 -
Flags: review?(neil)
Attachment #399035 -
Flags: superreview?(neil)
Attachment #399035 -
Flags: review?(neil)
Comment 3•15 years ago
|
||
+#ifdef XP_MACOSX
+ // OS X doesn't quit the application when the last window is closed, but keeps
+ // the session alive. Hence don't prompt users to save tabs, but warn about
+ // closing multiple tabs.
+ return getBrowser().warnAboutClosingTabs(true);
+#else
Mostly Suite code tries to avoid preprocessing files by using code such as:
if (/Mac/.test(navigator.platform))
of course nsSessionStore.js etc are already preprocessed.
Comment 4•15 years ago
|
||
Comment on attachment 399261 [details] [diff] [review]
better fix
>- content/navigator/navigator.js
>+* content/navigator/navigator.js
What Ratty said.
>@@ -2357,34 +2355,11 @@ function WindowIsClosing()
> var browser = getBrowser();
> var cn = browser.tabContainer.childNodes;
> var numtabs = cn.length;
>- var reallyClose = true;
>+ var reallyClose = closeWindow(false, warnAboutClosingWindow);
I don't think closeWindow makes sense here, because it triggers a quit request. I also don't see the need to move the prompt to tabbrowser.xml. The code here should look something like this:
if (!/Mac/.test(navigator.platform) && isClosingLastBrowser()) {
// trigger the last browser close request in nsSuiteGlue
} else if (numtabs > 1) {
// existing warn on close tabs code
And since you won't be triggering the last browser close request on the Mac, you don't need to #ifdef the code in the other files either.
>+ !this._inPrivateBrowsing) {
No such variable.
Attachment #399261 -
Flags: superreview?(neil)
Attachment #399261 -
Flags: superreview-
Attachment #399261 -
Flags: review?(neil)
Assignee | ||
Comment 5•15 years ago
|
||
If i understand correctly what you said ...
Attachment #399261 -
Attachment is obsolete: true
Attachment #399426 -
Flags: superreview?(neil)
Attachment #399426 -
Flags: review?(neil)
Comment 6•15 years ago
|
||
> + !this._inPrivateBrowsing) {
Ahem! We *still* don't have Private Browsing.
Assignee | ||
Comment 7•15 years ago
|
||
I know, saw it after submitting, just waiting for Neil comments to update patch :(
Assignee | ||
Comment 8•15 years ago
|
||
previous patch misses some vital observer logic, plus i added test. Test passes with two exceptions:
TEST-UNEXPECTED-FAIL | chrome://mochikit/content/browser/suite/common/tests/browser/browser_bug515006.js | Restored window in-session with otherpopup windows around - Got 4, expected 3
TEST-UNEXPECTED-FAIL | chrome://mochikit/content/browser/suite/common/tests/browser/browser_bug515006.js | Restored window in-session with otherpopup windows around - Got 4, expected 3
IMHO there is something other than wrong patch, i need suggestion here. I removed private browsing part from test, so i adjusted const NOTIFICATIONS_EXPECTED to 4 from 6, maybe something similar should be done with these errors too.
Attachment #399426 -
Attachment is obsolete: true
Attachment #399459 -
Flags: superreview?(neil)
Attachment #399459 -
Flags: review?(neil)
Attachment #399426 -
Flags: superreview?(neil)
Attachment #399426 -
Flags: review?(neil)
Comment 9•15 years ago
|
||
Comment on attachment 399426 [details] [diff] [review]
v2, with mac detectiong suggestions
>+ if (!/Mac/.test(navigator.platform) && isClosingLastBrowser()) {
The browser-lastwindow-close-requested/granted code belongs here.
>+ return reallyClose;
>+ } else if (numtabs > 1) {
This is my fault; you always return here, so no else needed.
>+ let foundOtherBrowserWindow = false;
You don't need this, see below.
>+ let wm = Components.classes["@mozilla.org/appshell/window-mediator;1"].getService(Components.interfaces.nsIWindowMediator);
Nit: wrap long line
Components.classes
.getService
>+ foundOtherBrowserWindow = true;
Just return false; immediately.
>+ os.notifyObservers(null, "browser-lastwindow-close-granted", null);
As above, this doesn't belong here.
>+ var sessionWillBeSaved = prefBranch.getIntPref("browser.startup.page") == 3 ||
>+ prefBranch.getBoolPref("browser.sessionstore.resume_session_once");
>+ if (sessionWillBeSaved || !prefBranch.getBoolPref("browser.warnOnQuit"))
Not sure why you have a separate variable for this, you only use it once.
Assignee | ||
Comment 10•15 years ago
|
||
Well, we are a bit out of sync, here is patch with nits fixed. Previous comment about test still apply.
Attachment #399459 -
Attachment is obsolete: true
Attachment #399474 -
Flags: superreview?(neil)
Attachment #399474 -
Flags: review?(neil)
Attachment #399459 -
Flags: superreview?(neil)
Attachment #399459 -
Flags: review?(neil)
Comment 11•15 years ago
|
||
Comment on attachment 399474 [details] [diff] [review]
v 2.1 with test, nits fixed
OK, so I tried this out, and it mostly works, but there is a problem when you have a home page, and that is when you close the browser window and then reopen it you get the home page as well as the restored tabs. I think this is also the problem that is causing your tests to fail, but for a different reason; in that case, you're triggering the new window preference, which is also to open the home page.
>+ let os = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
Nit: needs wrapping
>+ return true;
>+ } else if (numtabs > 1) {
Nit: no else. In fact, please leave a blank line, i.e.
return true;
}
if (numtabs > 1) {
>+ * Checks if this is the last full *browser* window around.
Nit: trailing space. Also, grammar nit: Checks whether this
>+ if (win != window && win.toolbar.visible)
>+ foundOtherBrowserWindow = true;
As mentioned, just return false immediately.
> }
>
>+ else if (this._restoreLastWindow && aWindow.toolbar.visible &&
>+ this._closedWindows.length && this._doResumeSession()) {
>+
>+ // default to the most-recently closed window
Nit: remove these blank lines.
>+ var sessionWillBeSaved = prefBranch.getIntPref("browser.startup.page") == 3 ||
>+ prefBranch.getBoolPref("browser.sessionstore.resume_session_once");
>+ if (sessionWillBeSaved || !prefBranch.getBoolPref("browser.warnOnQuit"))
Nit: as mentioned, eliminate this variable.
Attachment #399474 -
Flags: superreview?(neil)
Attachment #399474 -
Flags: review?(neil)
Attachment #399474 -
Flags: review-
Assignee | ||
Comment 12•15 years ago
|
||
(In reply to comment #11)
> (From update of attachment 399474 [details] [diff] [review])
> OK, so I tried this out, and it mostly works, but there is a problem when you
> have a home page, and that is when you close the browser window and then reopen
> it you get the home page as well as the restored tabs. I think this is also the
> problem that is causing your tests to fail, but for a different reason; in that
> case, you're triggering the new window preference, which is also to open the
> home page.
>
Well, when i modify line this.restoreWindow(aWindow, state, true); which means to overwrite tabs, tests passing. But then another issue arrives. when you call seamonkey someURL, session restores and last tab in restored session loads someURL.
Assignee | ||
Comment 13•15 years ago
|
||
I modified code by stealing some logic from navigator.js, not sure You will like it. Nothing else not coming to my head. Test is passing.
Attachment #399474 -
Attachment is obsolete: true
Attachment #401825 -
Flags: superreview?(neil)
Attachment #401825 -
Flags: review?(neil)
Comment 14•15 years ago
|
||
Comment on attachment 401825 [details] [diff] [review]
v 2.5, fix new window pref behavior
>+ let foundOtherBrowserWindow = false;
Nit: variable no longer used.
>+ // open a new window the previously closed window should be restored to
>+ newWin = openDialog(location, "_blank", CHROME_FEATURES);
Unfortunately this isn't actually how the UI opens a browser window, so although your workaround passes for the test, it might not work for real.
Comment 15•15 years ago
|
||
Comment on attachment 401825 [details] [diff] [review]
v 2.5, fix new window pref behavior
>+ //workaround "browser.windows.loadOnNewWindow" behavior
In fact this is a dead giveaway, because if there are no browser windows open, then we actually trigger the "browser.startup.page" behaviour.
Comment 16•15 years ago
|
||
Comment on attachment 401825 [details] [diff] [review]
v 2.5, fix new window pref behavior
So, can you try to a) restore this version of the code
>+ if (state) {
>+ delete state.hidden;
>+ state = { windows: [state] };
>+ this._restoreCount = 1;
>+ this.restoreWindow(aWindow, state, this._isCmdLineEmpty(aWindow));
>+ }
b) change the tests to always pass about:blank as the argument.
>+ let newWin = openDialog(location, "_blank", CHROME_FEATURES, "about:blank");
c) leave the problem in comment 11 for a followup bug.
Assignee | ||
Comment 17•15 years ago
|
||
OK, done as You suggest, filed Bug 517998, but no idea how to properly fix it :( .
Attachment #401825 -
Attachment is obsolete: true
Attachment #401957 -
Flags: superreview?(neil)
Attachment #401957 -
Flags: review?(neil)
Attachment #401825 -
Flags: superreview?(neil)
Attachment #401825 -
Flags: review?(neil)
Updated•15 years ago
|
Attachment #401957 -
Flags: superreview?(neil)
Attachment #401957 -
Flags: superreview+
Attachment #401957 -
Flags: review?(neil)
Attachment #401957 -
Flags: review+
Assignee | ||
Updated•15 years ago
|
Attachment #401957 -
Flags: approval-seamonkey2.0?
Comment 18•15 years ago
|
||
Comment on attachment 401957 [details] [diff] [review]
nits fixed, Neil suggestions done
[Checkin: Comment 19]
wanted+ so wouldn't even need a+ ;-)
Attachment #401957 -
Flags: approval-seamonkey2.0? → approval-seamonkey2.0+
Assignee | ||
Updated•15 years ago
|
Keywords: checkin-needed
Comment 19•15 years ago
|
||
http://hg.mozilla.org/comm-central/rev/b9f6a5af7814
http://hg.mozilla.org/comm-central/rev/631b2247f293 (forgot to "hg add" the test file)
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Keywords: checkin-needed → fixed-seamonkey2.0
Resolution: --- → FIXED
Target Milestone: --- → seamonkey2.0
Comment 20•15 years ago
|
||
(In reply to comment #19)
> http://hg.mozilla.org/comm-central/rev/631b2247f293 (forgot to "hg add" the
> test file)
http://mxr.mozilla.org/comm-central/source/suite/common/tests/browser/browser_bug515006.js
fails on MacOSX since it was pushed:
{
TEST-UNEXPECTED-FAIL | chrome://mochikit/content/browser/suite/common/tests/browser/browser_bug515006.js | First close attempt denied
TEST-UNEXPECTED-FAIL | chrome://mochikit/content/browser/suite/common/tests/browser/browser_bug515006.js | browser-lastwindow-close-requested notifications observed - Got 0, expected 4
TEST-UNEXPECTED-FAIL | chrome://mochikit/content/browser/suite/common/tests/browser/browser_bug515006.js | Notification count for -request and -grant matches - Got 0, expected 1
}
Status: RESOLVED → REOPENED
Flags: in-testsuite+
Resolution: FIXED → ---
Comment 21•15 years ago
|
||
I havent looked at the failures and the code, but can this be related to the fact that on mac you're not quitting the application when you close all windows?
Comment 22•15 years ago
|
||
(In reply to comment #21)
That's the idea I had too.
Misak, please at least disable the test (on MacOSX) ftb to workaround the permanent orange.
Summary: Port Bug 354894 [Session restore doesn't work if process hasn't exited (Downloads window open)] to SeaMonkey → Port Bug 354894 [Session restore doesn't work if process hasn't exited (Downloads window open)] to SeaMonkey. (browser_bug515006.js)
Assignee | ||
Comment 23•15 years ago
|
||
(In reply to comment #21)
> I havent looked at the failures and the code, but can this be related to the
> fact that on mac you're not quitting the application when you close all
> windows?
I don't thinks so, because this is a port from Firefox bug and same test don't fail there.
(In reply to comment #22)
> (In reply to comment #21)
>
> That's the idea I had too.
>
> Misak, please at least disable the test (on MacOSX) ftb to workaround the
> permanent orange.
Sorry, i don't know how to do that. Help needed.
Comment 24•15 years ago
|
||
Workaround the permanent orange until someone with a Mac can investigate...
Attachment #404735 -
Flags: review?(neil)
Updated•15 years ago
|
Attachment #404735 -
Flags: review?(neil) → review+
Comment 25•15 years ago
|
||
Comment on attachment 404735 [details] [diff] [review]
(Bv1) Disable test on MacOSX until it passes
[Checkin: See comment 25]
http://hg.mozilla.org/comm-central/rev/0de962bec599
Bv1, with new bug number.
Attachment #404735 -
Attachment description: (Bv1) Disable test on MacOSX until it passes. → (Bv1) Disable test on MacOSX until it passes
[Checkin: See comment 25]
Comment 26•15 years ago
|
||
I filed bug 520787 to re-enable the test on MacOSX.
No longer blocks: FF2SM
Status: REOPENED → RESOLVED
Closed: 15 years ago → 15 years ago
Resolution: --- → FIXED
Updated•15 years ago
|
Attachment #401957 -
Attachment description: nits fixed, Neil suggestions done → nits fixed, Neil suggestions done
[Checkin: Comment 19]
You need to log in
before you can comment on or make changes to this bug.
Description
•