Closed Bug 1382817 Opened 6 years ago Closed 5 years ago

Prefs shouldn't start out dirty or be written out immediately

Categories

(Core :: Preferences: Backend, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla56
Tracking Status
firefox56 --- fixed

People

(Reporter: benjamin, Assigned: benjamin)

References

Details

Attachments

(1 file)

The prefapi dirty callback is called when we read in user prefs, which causes us to do at least one extra write (it looks like more!). This is fairly easy to fix.
Comment on attachment 8888517 [details]
Bug 1382817 - Prefs shouldn't start out dirty or be written almost immediately after being read,

https://reviewboard.mozilla.org/r/159498/#review165166

We do have a scenario (pre this patch) where mSavePending is false, though there is a runnable in the delayed queue.  This in the scenario where the caller changes a pref, then calls SavePrefFile explicitly.  That should be OK, unless the caller repeatedly changes different preferences and calls SavePrefFile after each change.  In other words, the value of mSavePending is only relevant if DirtyCallback shows up during that delay.
Attachment #8888517 - Flags: review?(milan) → review+
Yes that's true: mSavePending is an optimization to avoid dispatching the event over and over again.
Pushed by bsmedberg@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/601d05280d9e
Prefs shouldn't start out dirty or be written almost immediately after being read, r=milan
https://hg.mozilla.org/mozilla-central/rev/601d05280d9e
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla56
You need to log in before you can comment on or make changes to this bug.