Bug 1437382 - Part 7 - Change session store time callback behaviour. r?esawin
When we get a timer callback for delayed saving, we already only proceed if
we've still got a write pending. Conversely if for whatever reasons _saveState()
is called from outside of a timer callback, any still pending save timer is
cancelled again.
With that in mind, when executing the delayed write timer callback there's no
reason to call the public version of saveState(), whose only extra task is to
increment the pending write count again. Instead, we can just directly call the
internal _saveState() version.
MozReview-Commit-ID: 11EucNm5KFB
--- a/mobile/android/components/SessionStore.js
+++ b/mobile/android/components/SessionStore.js
@@ -348,17 +348,17 @@ SessionStore.prototype = {
this._purgeHistory(aTopic);
break;
case "timer-callback":
if (this._loadState == STATE_RUNNING) {
// Timer call back for delayed saving
this._saveTimer = null;
log("timer-callback, pendingWrite = " + this._pendingWrite);
if (this._pendingWrite) {
- this.saveState();
+ this._saveState(true);
}
}
break;
case "Session:NotifyLocationChange": {
let browser = aSubject;
if (browser.__SS_restoreReloadPending && this._startupRestoreFinished) {
delete browser.__SS_restoreReloadPending;