prefs shim should merge in prefs defaults at startup

RESOLVED FIXED in Firefox 52

Status

enhancement
P1
normal
RESOLVED FIXED
3 years ago
Last year

People

(Reporter: tromey, Assigned: tromey)

Tracking

unspecified
Firefox 52
Dependency tree / graph
Bug Flags:
qe-verify -

Firefox Tracking Flags

(firefox52 fixed)

Details

(Whiteboard: [devtools-html])

Attachments

(2 attachments, 1 obsolete attachment)

Assignee

Description

3 years ago
The prefs shim should either merge in defaults at startup or it
should write everything out.  (But probably merging is best.)
See https://bugzilla.mozilla.org/show_bug.cgi?id=1291049#c63
Iteration: --- → 52.2 - Oct 17
Flags: qe-verify-
Priority: -- → P1
Whiteboard: [devtools-html] → [reserve-html]
Thanks for filing Tom! 

(In reply to Tom Tromey :tromey from comment #0)
> The prefs shim should either merge in defaults at startup or it
> should write everything out.  (But probably merging is best.)

I agree, merging would be the best here. This way if a default value changes and has not been overridden by the user, the new default value will be used.
Assignee

Comment 2

3 years ago
Wow, I really don't know what I was thinking in this code.
The startup stuff all seems backward.
Comment hidden (mozreview-request)

Comment 4

3 years ago
mozreview-review
Comment on attachment 8801146 [details]
Bug 1309384 - merge default and user prefs in Services shim;

https://reviewboard.mozilla.org/r/85918/#review84586

Great patch, thanks for fixing this! Just two nits.

(For the record I tested your patch with the inspector webpack bundle and it fixes the startup issue)

::: devtools/client/shared/shim/Services.js:363
(Diff revision 1)
>     * @param {Any} userValue the user value to use if the pref does not exist
>     * @param {Any} defaultValue the default value to use if the pref
>     *        does not exist
>     * @param {Boolean} hasUserValue if a new pref is created, whether
>     *        the default value is also a user value
> +   * @param {Boolean} init if true, then this call is initialization

nit: The two previous arguments are swapped in the jsdoc, would be nice to fix it here.

::: devtools/client/shared/shim/test/test_service_prefs_defaults.html:67
(Diff revision 1)
> +
> +  SimpleTest.finish();
> +}
> +
> +SimpleTest.waitForExplicitFinish();
> +do_tests();

nit: Since the test is synchronous I think you can get rid of SimpleTest.finish(), SimpleTest.waitForExplicitFinish() as well as the "do_tests" wrapper.
Attachment #8801146 - Flags: review?(jdescottes) → review+
Blocks: devtools-html-phase2
No longer blocks: devtools-html-3
Whiteboard: [reserve-html] → [devtools-html]
Comment hidden (mozreview-request)
Tom: I pushed https://bugzilla.mozilla.org/attachment.cgi?id=8801183 here so that I don't forget. 

While testing your patch I realized the preferences where still not saved when reloading the inspector. Maybe it's best to address it in a separate bug? But if you want to integrate it and land it here, that works for me :)
Assignee

Comment 7

3 years ago
mozreview-review
Comment on attachment 8801183 [details]
Bug 1309384 - fix override of default preference;

https://reviewboard.mozilla.org/r/85926/#review84618

Thanks, this looks good.
Attachment #8801183 - Flags: review?(ttromey) → review+
Comment hidden (mozreview-request)
Comment hidden (mozreview-request)
Assignee

Comment 10

3 years ago
mozreview-review
Comment on attachment 8801227 [details]
Bug 1309384 - fix override of default preference;

https://reviewboard.mozilla.org/r/85940/#review84620

I already r+d the other one, this is just fixing it after the changes requested to the first patch.
Attachment #8801227 - Flags: review?(ttromey) → review+
Assignee

Comment 11

3 years ago
Comment on attachment 8801183 [details]
Bug 1309384 - fix override of default preference;

I would have thought that mozreview would do this automatically.
Attachment #8801183 - Attachment is obsolete: true

Comment 12

3 years ago
Pushed by ttromey@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/d61c25d687c4
merge default and user prefs in Services shim; r=jdescottes
https://hg.mozilla.org/integration/autoland/rev/ce7b9aa047e8
fix override of default preference;r=tromey

Comment 13

3 years ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/d61c25d687c4
https://hg.mozilla.org/mozilla-central/rev/ce7b9aa047e8
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 52

Updated

Last year
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.