audit prefapi usage in prefs sync engine

RESOLVED FIXED in 1.3b1

Status

()

RESOLVED FIXED
9 years ago
5 months ago

People

(Reporter: mconnor, Assigned: mconnor)

Tracking

unspecified
1.3b1
Points:
---
Bug Flags:
blocking-weave1.3 +

Firefox Tracking Flags

(Not tracked)

Details

(Assignee)

Updated

9 years ago
Flags: blocking-weave1.3+
(Assignee)

Comment 1

9 years ago
Notes:

* no good reason to sync pref type, we could just check the local type
** This would let us do prefs[prefname] = value and have a simpler data format.
** would be a storage version bump, but that's not especially terrible for prefs
* we don't check whether the local client allows syncing of this preference before setting it
* engine/store/tracker bites us with code duplication in store/tracker
* itemExists: function FormStore_itemExists should be PrefStore
* we could use Preferences.js to simplify a lot of this if we stop syncing type!

  _prefs:     new Preferences();

  _getAllPrefs: function () {
    let values = {};
    let toSync = this._syncPrefs;

    for (let i = 0; i < toSync.length; i++) {
      if (!this._prefs.get(WEAVE_SYNC_PREFS + toSync[i]), false)
        continue;

      let val = this._prefs.get(toSync[i], "");
      if (val)
        values[toSync[i]] = val;
    }

    return values;
  },

  _setAllPrefs: function(values) {
    for (let pref in values) {
      if (!this._prefs.get(WEAVE_SYNC_PREFS + toSync[i]), false)
        continue;
      try {
        this._prefs.set(pref, values[pref]);
      catch(e) {
        this._log.trace("Failed to set pref: " + pref + " Reason: " + e);
      } 
    }   
  }

Comment 2

9 years ago
It might be possible to sync a pref that only existed on one profile, so checking the type on the remote end might not always work. But assuming we only sync bool, int, string prefs, Preferences can figure out what we want.
(Assignee)

Comment 3

9 years ago
Well, right now we ignore the pref if it's anything else, so... yeah, we can probably assume that we're only syncing those values.
(Assignee)

Comment 4

9 years ago
filed Bug 560580 for cleanup, and tweaked Bug 550033 to cover per-app pref syncing.

No other issues in play.
Status: NEW → RESOLVED
Last Resolved: 9 years ago
Resolution: --- → FIXED

Updated

9 years ago
Target Milestone: 1.3 → 1.3b1
Component: Firefox Sync: Backend → Sync
Product: Cloud Services → Firefox
You need to log in before you can comment on or make changes to this bug.