Closed Bug 1375952 Opened 7 years ago Closed 7 years ago

Add optional default value to SpecialPowers.get*Pref

Categories

(Testing :: Mochitest, enhancement)

enhancement
Not set
normal

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.
Attachment #8880907 - Flags: review?(jaws) → 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+
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
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla56
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: