Bug 1437382 - Part 7 - Change session store time callback behaviour. r?esawin draft
authorJan Henning <jh+bugzilla@buttercookie.de>
Mon, 12 Feb 2018 20:11:46 +0100
changeset 761290 84a78e6e6569fc4996251934a71549bc9b38edc4
parent 761289 cad3279bc236bc08e1c3d93f4185c73f2469bf14
child 761291 80841a51f5bc95a82debfe0dce5941ea75f3e65e
push id100929
push usermozilla@buttercookie.de
push dateWed, 28 Feb 2018 22:01:37 +0000
reviewersesawin
bugs1437382
milestone60.0a1
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
mobile/android/components/SessionStore.js
--- 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;