From e7094b35f40f0059ef98ef8fef21472b712159d4 Mon Sep 17 00:00:00 2001 From: Kathy Brade Date: Wed, 3 Feb 2016 15:22:12 -0500 Subject: [PATCH] Bug 18170: After update, only changelog tab shown When in permanent private browsing mode, always return false for isAutomaticRestoreEnabled. This ensures that there will not be any confusion inside nsBrowserContentHandler.defaultArgs as to whether a one time session restore will occur. Also, for consistency and in case someone looks at the pref, avoid setting browser.sessionstore.resume_session = true during browser shutdown. This bug occurred when staging was not used during the update process. On Windows it always occurred because staging is not used even when it should be (see #18292). --- browser/components/nsBrowserGlue.js | 4 +++- browser/components/sessionstore/SessionStore.jsm | 5 ++++- browser/components/sessionstore/nsSessionStartup.js | 4 ++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/browser/components/nsBrowserGlue.js b/browser/components/nsBrowserGlue.js index d69a11f6b06b5..f5108da58b926 100644 --- a/browser/components/nsBrowserGlue.js +++ b/browser/components/nsBrowserGlue.js @@ -146,7 +146,9 @@ BrowserGlue.prototype = { if (!this._saveSession && !aForce) return; - Services.prefs.setBoolPref("browser.sessionstore.resume_session_once", true); + if (!PrivateBrowsingUtils.permanentPrivateBrowsing) { + Services.prefs.setBoolPref("browser.sessionstore.resume_session_once", true); + } // This method can be called via [NSApplication terminate:] on Mac, which // ends up causing prefs not to be flushed to disk, so we need to do that diff --git a/browser/components/sessionstore/SessionStore.jsm b/browser/components/sessionstore/SessionStore.jsm index 2f44b2af3b8a7..136a72642839c 100644 --- a/browser/components/sessionstore/SessionStore.jsm +++ b/browser/components/sessionstore/SessionStore.jsm @@ -1616,7 +1616,10 @@ var SessionStoreInternal = { */ onQuitApplication: function ssi_onQuitApplication(aData) { if (aData == "restart") { - this._prefBranch.setBoolPref("sessionstore.resume_session_once", true); + if (!PrivateBrowsingUtils.permanentPrivateBrowsing) { + this._prefBranch.setBoolPref("sessionstore.resume_session_once", true); + } + // The browser:purge-session-history notification fires after the // quit-application notification so unregister the // browser:purge-session-history notification to prevent clearing diff --git a/browser/components/sessionstore/nsSessionStartup.js b/browser/components/sessionstore/nsSessionStartup.js index 7593c48ece5b9..5648ca813cc2b 100644 --- a/browser/components/sessionstore/nsSessionStartup.js +++ b/browser/components/sessionstore/nsSessionStartup.js @@ -294,6 +294,10 @@ SessionStartup.prototype = { * @returns bool */ isAutomaticRestoreEnabled: function () { + if (PrivateBrowsingUtils.permanentPrivateBrowsing) { + return false; + } + return Services.prefs.getBoolPref("browser.sessionstore.resume_session_once") || Services.prefs.getIntPref("browser.startup.page") == BROWSER_STARTUP_RESUME_SESSION; }, -- GitLab