Closed
Bug 1348331
Opened 9 years ago
Closed 9 years ago
Change Preferences::RegisterCallback(AndCall) to either default to ExactMatch for aMatchKind or have no default at all
Categories
(Core :: Preferences: Backend, enhancement)
Core
Preferences: Backend
Tracking
()
RESOLVED
FIXED
mozilla55
| Tracking | Status | |
|---|---|---|
| firefox55 | --- | fixed |
People
(Reporter: bzbarsky, Assigned: bzbarsky)
Details
Attachments
(3 files)
|
2.67 KB,
patch
|
froydnj
:
review+
|
Details | Diff | Splinter Review |
|
22.68 KB,
patch
|
froydnj
:
review+
padenot
:
review+
|
Details | Diff | Splinter Review |
|
7.79 KB,
patch
|
froydnj
:
review+
|
Details | Diff | Splinter Review |
The PrefixMatch behavior is a footgun; see bug 1348215.
We have similar footguns right this second in nsJSContext::EnsureStatics for the same reasons.
In general, we only have 40-ish callsites of RegisterCallbackAndCall and 60-ish of RegisterCallback, so auditing them is not prohibitive.
| Assignee | ||
Comment 1•9 years ago
|
||
This will allow us to remove the PrefixMatch option from the public API version
of RegisterCallback/RegisterCallbackAndCall.
MozReview-Commit-ID: 6D0S35nv88Z
Attachment #8848699 -
Flags: review?(nfroyd)
| Assignee | ||
Updated•9 years ago
|
Assignee: nobody → bzbarsky
Status: NEW → ASSIGNED
| Assignee | ||
Comment 2•9 years ago
|
||
MozReview-Commit-ID: 2ebVZO4fN6i
Attachment #8848700 -
Flags: review?(nfroyd)
| Assignee | ||
Comment 3•9 years ago
|
||
MozReview-Commit-ID: GY6J62yWkfk
Attachment #8848701 -
Flags: review?(nfroyd)
Updated•9 years ago
|
Attachment #8848699 -
Flags: review?(nfroyd) → review+
Comment 4•9 years ago
|
||
Comment on attachment 8848700 [details] [diff] [review]
part 2. Switch Preferences::RegisterCallback/RegisterCallbackAndCall consumers that want prefix matches to the new RefisterPrefixCallback(AndCall) APIs
Review of attachment 8848700 [details] [diff] [review]:
-----------------------------------------------------------------
I think this is good. I reviewed all the other RegisterCallback usages in tree and none of those looked like they needed to be changed.
::: dom/media/CubebUtils.cpp
@@ +418,5 @@
> + Preferences::RegisterCallbackAndCall(PrefChanged, PREF_VOLUME_SCALE);
> + Preferences::RegisterCallbackAndCall(PrefChanged, PREF_CUBEB_LATENCY_PLAYBACK);
> + Preferences::RegisterCallbackAndCall(PrefChanged, PREF_CUBEB_LATENCY_MSG);
> + Preferences::RegisterCallbackAndCall(PrefChanged, PREF_CUBEB_BACKEND);
> + Preferences::RegisterCallbackAndCall(PrefChanged, PREF_CUBEB_LOG_LEVEL);
It looks like we didn't call the PrefChanged callback for this one...shouldn't this one be just ::RegisterCallback? Or were you changing it because it seemed like a semi-obvious "this is what they really intended"?
::: js/xpconnect/src/XPCJSContext.cpp
@@ +1635,5 @@
> + JS_OPTIONS_DOT_STR, this);
> +
> +#ifdef FUZZING
> + Preferences::UnRegisterCallback(ReloadPrefsCallback, "fuzzing.enabled", this);
> +#endif
Nit: trailing whitespace.
Attachment #8848700 -
Flags: review?(nfroyd) → review+
Comment 5•9 years ago
|
||
Comment on attachment 8848701 [details] [diff] [review]
part 3. Change Preferences::RegisterCallback/RegisterCallbackAndCall/UnregisterCallback to do exact matching on the pref name, not prefix matching
Review of attachment 8848701 [details] [diff] [review]:
-----------------------------------------------------------------
Please send an email to dev-platform about this API change; I'm sure everybody will enjoy the "wait, it worked how?!" moment and comm-central may appreciate the heads-up (even if comm-central DXR apparently has no RegisterCallback hits).
Attachment #8848701 -
Flags: review?(nfroyd) → review+
| Assignee | ||
Comment 6•9 years ago
|
||
> Or were you changing it because it seemed like a semi-obvious "this is what they really intended"?
The latter. But you're right, I should get the author of that code to check that part. I will do that.
| Assignee | ||
Comment 7•9 years ago
|
||
Comment on attachment 8848700 [details] [diff] [review]
part 2. Switch Preferences::RegisterCallback/RegisterCallbackAndCall consumers that want prefix matches to the new RefisterPrefixCallback(AndCall) APIs
Paul, could you look over the dom/media/CubebUtils.cpp changes here, please? In particular, note the behavior change for PREF_CUBEB_LOG_LEVEL.
Attachment #8848700 -
Flags: review?(padenot)
Comment 8•9 years ago
|
||
Comment on attachment 8848700 [details] [diff] [review]
part 2. Switch Preferences::RegisterCallback/RegisterCallbackAndCall consumers that want prefix matches to the new RefisterPrefixCallback(AndCall) APIs
Review of attachment 8848700 [details] [diff] [review]:
-----------------------------------------------------------------
This can land. I'll remove it soon anyways, I wrote this because I was not aware we already had a mechanism for this ("logging.foo" -> "verbose" enables verbose logging for the module "foo").
Thanks !
Attachment #8848700 -
Flags: review?(padenot) → review+
Pushed by bzbarsky@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/4dd21d428e43
part 1. Add RegisterPrefixCallback and RegisterPrefixCallbackAndCall APIs to Preferences. r=froydnj
https://hg.mozilla.org/integration/mozilla-inbound/rev/3526737363c6
part 2. Switch Preferences::RegisterCallback/RegisterCallbackAndCall consumers that want prefix matches to the new RefisterPrefixCallback(AndCall) APIs. r=froydnj,padenot
https://hg.mozilla.org/integration/mozilla-inbound/rev/0c4aa26a808b
part 3. Change Preferences::RegisterCallback/RegisterCallbackAndCall/UnregisterCallback to do exact matching on the pref name, not prefix matching. r=froydnj.
| Assignee | ||
Comment 10•9 years ago
|
||
Comment 11•9 years ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/4dd21d428e43
https://hg.mozilla.org/mozilla-central/rev/3526737363c6
https://hg.mozilla.org/mozilla-central/rev/0c4aa26a808b
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
You need to log in
before you can comment on or make changes to this bug.
Description
•