Bug 1363321 - Part 1 - Always copy crash restore settings to Java on startup. r?jchen
Those settings need to be stored in our shared preferences since they're needed before Gecko is available, however in order to allow them to be easily configured, we also expose them in about:config and sync them to the shared prefs via a change listener.
This however means that changes in the *default* value of those prefs won't be picked up. Therefore we now simply unconditionally copy the setting state into the shared preferences on startup and omit the change listener instead, as they're exposed in about:config only and there is in fact no pressing need for changes there to immediately take effect.
MozReview-Commit-ID: 7c950F1nkdj
--- a/mobile/android/components/SessionStore.js
+++ b/mobile/android/components/SessionStore.js
@@ -116,24 +116,20 @@ SessionStore.prototype = {
this._updateMaxTabsUndo();
Services.prefs.addObserver(PREFS_MAX_TABS_UNDO, () => {
this._updateMaxTabsUndo();
});
// Copy changes in Gecko settings to their Java counterparts,
// so the startup code can access them
- Services.prefs.addObserver(PREFS_RESTORE_FROM_CRASH, function() {
- SharedPreferences.forApp().setBoolPref(PREFS_RESTORE_FROM_CRASH,
- Services.prefs.getBoolPref(PREFS_RESTORE_FROM_CRASH));
- });
- Services.prefs.addObserver(PREFS_MAX_CRASH_RESUMES, function() {
- SharedPreferences.forApp().setIntPref(PREFS_MAX_CRASH_RESUMES,
- Services.prefs.getIntPref(PREFS_MAX_CRASH_RESUMES));
- });
+ SharedPreferences.forApp().setBoolPref(PREFS_RESTORE_FROM_CRASH,
+ Services.prefs.getBoolPref(PREFS_RESTORE_FROM_CRASH));
+ SharedPreferences.forApp().setIntPref(PREFS_MAX_CRASH_RESUMES,
+ Services.prefs.getIntPref(PREFS_MAX_CRASH_RESUMES));
},
_updateMaxTabsUndo: function ss_updateMaxTabsUndo() {
this._maxTabsUndo = Services.prefs.getIntPref(PREFS_MAX_TABS_UNDO);
if (this._maxTabsUndo == 0) {
this._forgetClosedTabs();
}
},