Closed
Bug 1375952
Opened 7 years ago
Closed 7 years ago
Add optional default value to SpecialPowers.get*Pref
Categories
(Testing :: Mochitest, enhancement)
Testing
Mochitest
Tracking
(firefox56 fixed)
RESOLVED
FIXED
mozilla56
Tracking | Status | |
---|---|---|
firefox56 | --- | fixed |
People
(Reporter: jryans, Assigned: jryans)
References
Details
Attachments
(2 files)
Bug 1338306 added optional default value args to the various get*Pref APIs. We should support the same thing for SpecialPowers in mochitests.
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Assignee | ||
Comment 3•7 years ago
|
||
Assignee | ||
Comment 4•7 years ago
|
||
Assignee | ||
Updated•7 years ago
|
Blocks: stylo-devtools-tests
Comment 5•7 years ago
|
||
mozreview-review |
Comment on attachment 8880907 [details]
Bug 1375952 - Clean up SpecialPowers pref syntax.
https://reviewboard.mozilla.org/r/152270/#review157320
Attachment #8880907 -
Flags: review?(jaws) → review+
Comment 6•7 years ago
|
||
mozreview-review |
Comment on attachment 8880908 [details]
Bug 1375952 - Support default values in SpecialPowers.get*Pref.
https://reviewboard.mozilla.org/r/152272/#review157324
::: testing/specialpowers/content/SpecialPowersObserverAPI.js:344
(Diff revision 1)
> // Now we make the call
> switch (prefType) {
> case "BOOL":
> - if (aMessage.json.op == "get")
> + if (aMessage.json.op == "get") {
> + if (defaultValue !== undefined) {
> + return (prefs.getBoolPref(prefName, defaultValue));
nit, remove the surrounding parens here and below on the return statements.
::: testing/specialpowers/content/specialpowersAPI.js:1281
(Diff revision 1)
> return Object.prototype.__lookupGetter__.call(obj, name);
> },
>
> // Mimic the get*Pref API
> - getBoolPref(prefName) {
> - return (this._getPref(prefName, "BOOL"));
> + getBoolPref(prefName, defaultValue) {
> + return (this._getPref(prefName, "BOOL", { defaultValue }));
nit, remove the parens around the return value here and elsewhere in this file.
Attachment #8880908 -
Flags: review?(jaws) → review+
Assignee | ||
Comment 7•7 years ago
|
||
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Comment 10•7 years ago
|
||
Pushed by jryans@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/bb86b3300927
Clean up SpecialPowers pref syntax. r=jaws
https://hg.mozilla.org/integration/autoland/rev/14cfbf539b58
Support default values in SpecialPowers.get*Pref. r=jaws
Comment 11•7 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/bb86b3300927
https://hg.mozilla.org/mozilla-central/rev/14cfbf539b58
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
status-firefox56:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla56
You need to log in
before you can comment on or make changes to this bug.
Description
•