Closed Bug 902280 Opened 7 years ago Closed 7 years ago

[Session Restore] When invalidating while writing, we end up deceeding the write interval


(Firefox :: Session Restore, defect)

Not set



Firefox 26


(Reporter: ttaubert, Assigned: smacleod)



(1 file, 1 obsolete file)

Let's say we just wrote to disk. Everything's fine and _lastSaveTime has been updated with

We now immediately close a tab and this leads to saveStateDelayed() being called. Because we just saved, the minimumDelay in saveStateDelayed() will be a few ms less than 15s (the default interval).

After 15s, the timer is fired and _saveTimer is set back to null. SessionFile.write() is called and we update _lastSaveTime when the promise is resolved.

Now here's the problem: if we close another tab while the SessionFile.write() promise hasn't been resolved yet, minimumDelay will be set to a negative value, because we exceeded the target interval of 15s and the parameter passed (aDelay) will be the timer value, which is 2s by default.

Thus we end up writing just 2s after we wrote again. If we now close another tab... we could keep collecting and writing data in very short intervals.
Assignee: nobody → smacleod
Attachment #792305 - Flags: review?(ttaubert)
Comment on attachment 792305 [details] [diff] [review]
Patch - Update _lastSaveTime before writing

Review of attachment 792305 [details] [diff] [review]:

This is a great and simple solution. We could correct the timeout after we finished writing but I think we shouldn't overcomplicate the code. This will be fine for all the cases where writing takes less time than what the interval is set to.
Attachment #792305 - Flags: review?(ttaubert) → review+
Attachment #792305 - Attachment is obsolete: true
Keywords: checkin-needed
Closed: 7 years ago
Resolution: --- → FIXED
Whiteboard: [fixed-in-fx-team]
Target Milestone: --- → Firefox 26
You need to log in before you can comment on or make changes to this bug.