Closed Bug 523538 Opened 10 years ago Closed 10 years ago

Don't sync to/from pref if <setting> has no pref

Categories

(Firefox for Android Graveyard :: General, defect)

defect
Not set

Tracking

(Not tracked)

RESOLVED FIXED
fennec1.0b5

People

(Reporter: Mardak, Assigned: Gavin)

References

Details

Attachments

(1 file, 1 obsolete file)

Normally settings are bound to a pref, but Weave might re-use the <setting type="string"> for the existing styling but not the pref sync.

If you enter a value (or password) into a <setting> without a "pref" attribute, it'll get stored in the "" pref. And on restart, it'll get loaded from that pref.
For now, I'm grabbing each <setting> and setting their "pref" field to {}.
Blocks: 490189
Attached patch patch (obsolete) — Splinter Review
This just checks that we have a valid "pref" attribute before trying to sync to the pref. Prefs without "name" attributes already don't do anything, so no need to worry about syncing from them.

Mardak, is this sufficient for your needs?
Assignee: nobody → gavin.sharp
Status: NEW → ASSIGNED
OS: Mac OS X → All
Hardware: x86 → All
Comment on attachment 410841 [details] [diff] [review]
patch

>+      <constructor><![CDATA[
>+        let prefValue = this.hasAttribute("pref") && this.pref.valueFromPreferences;
>         if (prefValue != null) {
let prefValue = this.pref.valueFromPreferences;
if (this.hasAttribute("pref") && prefValue != null) {

Otherwise, it'll end up setting |false| as the value.

Alternatively, my hack-y solution is to replace the field "pref" to {} ;)

<field name="pref">this.hasAttribute("pref") ? .. : {}</field>
Ok, I guess that does have the advantage of consolidating the check in the base binding. I'll use a getter though, to make it possible to set the pref attribute after binding attachment.
Attached patch patchSplinter Review
Attachment #410841 - Attachment is obsolete: true
Attachment #411148 - Flags: review?(mark.finkle)
Attachment #411148 - Flags: review?(mark.finkle) → review+
https://hg.mozilla.org/mobile-browser/rev/02ca91675919
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → B5
Blocks: 528027
You need to log in before you can comment on or make changes to this bug.