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

RESOLVED FIXED in fennec1.0b5

Status

Firefox for Android Graveyard
General
RESOLVED FIXED
9 years ago
9 years ago

People

(Reporter: Mardak, Assigned: Gavin)

Tracking

Trunk
fennec1.0b5
Dependency tree / graph

Details

Attachments

(1 attachment, 1 obsolete attachment)

(Reporter)

Description

9 years ago
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.
(Reporter)

Comment 1

9 years ago
For now, I'm grabbing each <setting> and setting their "pref" field to {}.

Updated

9 years ago
Blocks: 490189
Created attachment 410841 [details] [diff] [review]
patch

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
(Reporter)

Comment 3

9 years ago
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.
Created attachment 411148 [details] [diff] [review]
patch
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
Last Resolved: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → B5
(Reporter)

Updated

9 years ago
Blocks: 528027
You need to log in before you can comment on or make changes to this bug.