зеркало из https://github.com/mozilla/gecko-dev.git
Bug 743662 - Restore session once when addons require a restart. r=sebastian
MozReview-Commit-ID: C5Q9cYnxnhj --HG-- extra : rebase_source : 3f50c6a4a207e7950dd9eeaaf089fbeac078d627
This commit is contained in:
Родитель
e3e94d68c5
Коммит
53cf8e265c
|
@ -137,7 +137,6 @@ pref("browser.sessionhistory.contentViewerTimeout", 360);
|
|||
pref("browser.sessionhistory.bfcacheIgnoreMemoryPressure", false);
|
||||
|
||||
/* session store */
|
||||
pref("browser.sessionstore.resume_session_once", false);
|
||||
pref("browser.sessionstore.resume_from_crash", true);
|
||||
pref("browser.sessionstore.interval", 10000); // milliseconds
|
||||
pref("browser.sessionstore.backupInterval", 120000); // milliseconds -> 2 minutes
|
||||
|
|
|
@ -1891,7 +1891,9 @@ public abstract class GeckoApp
|
|||
boolean shouldRestore = false;
|
||||
|
||||
final int versionCode = getVersionCode();
|
||||
if (mLastSessionCrashed) {
|
||||
if (getSessionRestoreResumeOnce(prefs)) {
|
||||
shouldRestore = true;
|
||||
} else if (mLastSessionCrashed) {
|
||||
if (incrementCrashCount(prefs) <= getSessionStoreMaxCrashResumes(prefs) &&
|
||||
getSessionRestoreAfterCrashPreference(prefs)) {
|
||||
shouldRestore = true;
|
||||
|
@ -1914,6 +1916,14 @@ public abstract class GeckoApp
|
|||
return shouldRestore;
|
||||
}
|
||||
|
||||
private boolean getSessionRestoreResumeOnce(SharedPreferences prefs) {
|
||||
boolean resumeOnce = prefs.getBoolean(GeckoPreferences.PREFS_RESTORE_SESSION_ONCE, false);
|
||||
if (resumeOnce) {
|
||||
prefs.edit().putBoolean(GeckoPreferences.PREFS_RESTORE_SESSION_ONCE, false).apply();
|
||||
}
|
||||
return resumeOnce;
|
||||
}
|
||||
|
||||
private int incrementCrashCount(SharedPreferences prefs) {
|
||||
final int crashCount = getSuccessiveCrashesCount(prefs) + 1;
|
||||
prefs.edit().putInt(PREFS_CRASHED_COUNT, crashCount).apply();
|
||||
|
|
|
@ -184,6 +184,7 @@ public class GeckoPreferences
|
|||
public static final String PREFS_RESTORE_SESSION = NON_PREF_PREFIX + "restoreSession3";
|
||||
public static final String PREFS_RESTORE_SESSION_FROM_CRASH = "browser.sessionstore.resume_from_crash";
|
||||
public static final String PREFS_RESTORE_SESSION_MAX_CRASH_RESUMES = "browser.sessionstore.max_resumed_crashes";
|
||||
public static final String PREFS_RESTORE_SESSION_ONCE = "browser.sessionstore.resume_session_once";
|
||||
public static final String PREFS_TAB_QUEUE = NON_PREF_PREFIX + "tab_queue";
|
||||
public static final String PREFS_TAB_QUEUE_LAST_SITE = NON_PREF_PREFIX + "last_site";
|
||||
public static final String PREFS_TAB_QUEUE_LAST_TIME = NON_PREF_PREFIX + "last_time";
|
||||
|
|
|
@ -5540,6 +5540,7 @@ var XPInstallObserver = {
|
|||
// If nothing aborted, quit the app
|
||||
if (cancelQuit.data == false) {
|
||||
Services.obs.notifyObservers(null, "quit-application-proceeding", null);
|
||||
SharedPreferences.forApp().setBoolPref("browser.sessionstore.resume_session_once", true);
|
||||
let appStartup = Cc["@mozilla.org/toolkit/app-startup;1"].getService(Ci.nsIAppStartup);
|
||||
appStartup.quit(Ci.nsIAppStartup.eRestart | Ci.nsIAppStartup.eAttemptQuit);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче