refactor pref sync to not sync pref type

RESOLVED DUPLICATE of bug 560580

Status

Cloud Services
Firefox Sync: Backend
RESOLVED DUPLICATE of bug 560580
8 years ago
8 years ago

People

(Reporter: mconnor, Unassigned)

Tracking

unspecified
x86
Mac OS X
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

8 years ago
Our current impl is syncing extra data, and has unnecessarily-complex code.  From bug 548385:

* 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);
      } 
    }   
  }
Status: NEW → RESOLVED
Last Resolved: 8 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 560580
You need to log in before you can comment on or make changes to this bug.