Document the tabbrowser's option defaults and settle on one name for every bag
Categories
(Firefox :: Tabbed Browser, task)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox157 | --- | fixed |
People
(Reporter: dao, Assigned: dao)
References
(Blocks 1 open bug)
Details
Attachments
(3 external files)
Tabbrowser.sys.mjs documents its methods' option bags property by property, and the generated gBrowser reference renders each property along with any default the JSDoc declares for it. Two things there disagree with the code.
Twenty-four properties destructure a default. Five say so in their description; the rest leave a caller to read the source to find out what happens when they omit one, and removeTabs animating by default is the likeliest of those to surprise. A literal default belongs in the brackets ([options.animate=true]), where the reference prints it; a computed one belongs in the description, since the brackets cannot be kept in sync with an expression.
The bags are also named inconsistently. Most are options, while setInitialTabTitle, updateBrowserRemotenessByURL, removeCurrentTab, replaceTabWithWindow, replaceTabsWithWindow and duplicateTab take an aOptions or aParams, and removeAllTabsBut documents its destructured bag under aParams. sphinx-js prints that name in front of every property it lists, so the page carries the inconsistency to the reader. The a prefix marks a value the caller supplies, which a bag of named settings is not.
No behavior change: comments, one parameter name per method, and one local variable.
To verify:
./mach doc --no-serve --no-open
./mach lint -l eslint browser/components/tabbrowser/Tabbrowser.sys.mjs
| Assignee | ||
Comment 1•2 months ago
|
||
Updated•2 months ago
|
| Assignee | ||
Comment 2•2 months ago
|
||
| Assignee | ||
Comment 3•2 months ago
|
||
They are the three whose option bags the previous commit renames; the other four it touches were already documented. #setTabLabel destructures exactly the three properties setInitialTabTitle now names, so forwarding them individually passes on what the whole bag did. Typing its tab parameter also makes the _labelIsInitialTitle it sets visible to the type checker, hence the declaration beside its _labelIsContentTitle sibling.
Updated•2 months ago
|
Comment 5•2 months ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/ca948dc7593d
https://hg.mozilla.org/mozilla-central/rev/07042648f1d3
https://hg.mozilla.org/mozilla-central/rev/768ba66bbf1b
Updated•2 months ago
|
Description
•