Closed Bug 1614854 Opened 5 years ago Closed 5 years ago

Add UrlbarPrefs.set()

Categories

(Firefox :: Address Bar, enhancement, P3)

enhancement
Points:
2

Tracking

()

RESOLVED FIXED
Firefox 75
Iteration:
75.2 - Feb 24 - Mar 8
Tracking Status
firefox75 --- fixed

People

(Reporter: adw, Assigned: mak)

References

Details

Attachments

(1 file)

We might want to add a UrlbarPrefs.setPref function (or setIntPref, etc.). We have getPref, which should not be passed the browser.urlbar pref name prefix. But since we don't have a setPref, we have to use the prefs service directly, where we do need to use the browser.urlbar prefix. That inconsistency can contribute to bugs like bug 1614656.

I'd recommend a simple API, mirroring getPref, with a similar type checking/ switching implementation as Preferences.jsm has. My 2cts :)

UrlbarPrefs is shaped after Map, thus it should just be .set(key, value); it should only be able to set known prefs, and the type of the pref can be extracted from the default value that is defined in its internal table. Thus it should throw for an unknown pref or a non-coherent type for the passed-in value.

Yes, I was thinking along those lines too.

Summary: Add UrlbarPrefs.setPref() → Add UrlbarPrefs.set()
Assignee: nobody → mak
Status: NEW → ASSIGNED
Iteration: --- → 75.2 - Feb 24 - Mar 8
Flags: needinfo?(mak)
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 75
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: