Closed Bug 1837253 Opened 3 years ago Closed 4 days ago

Introduce read-only index property as a replacement for pseudo-private _tPos

Categories

(Firefox :: Tabbed Browser, task)

task

Tracking

()

RESOLVED FIXED
156 Branch
Tracking Status
firefox156 --- fixed

People

(Reporter: dao, Assigned: dao, Mentored)

References

(Blocks 1 open bug, Regressed 1 open bug)

Details

(Keywords: good-next-bug, Whiteboard: [lang=js])

Attachments

(2 files)

_tPos is used quite a bit by external code, so there's no point in pretending it's private anymore. We should add a proper public, read-only property on tabs, perhaps index or position.

See Also: → 1925842
Summary: Introduce read-only tab index property as a replacement for pseudo-private _tPos → Introduce read-only tabIndex property as a replacement for pseudo-private _tPos
See Also: → 2001660

The tricky bit is that assignments to _tPos are done in tabbrowser.js, but MozTabbrowserTab (the tab object) itself is defined in tab.js. So, it is not a simple matter of making a private setter + public getter.

I think we should leave the _tPos assignments as is, and create a public getter (called tabIndex) in MozTabbrowserTab which returns this._tPos. Then replace all outside references to _tPos accordingly.

Nonetheless, this seems like a good fit for a mentored bug.

Mentor: jsudiaman
Keywords: good-next-bug
Whiteboard: [lang=js]
Summary: Introduce read-only tabIndex property as a replacement for pseudo-private _tPos → Introduce read-only index property as a replacement for pseudo-private _tPos
See Also: → 2065468
Blocks: 2065472

Not tabIndex as the bug's summary suggests: every element inherits that one from Element. The underscored _index stays as the write path, since the tabbrowser sets it from outside the tab's own class, and the session store's check for a tab that never got a position becomes a read of the getter.

Assignee: nobody → dao+bmo
Status: NEW → ASSIGNED
See Also: 2065468
Regressions: 2065773
Status: ASSIGNED → RESOLVED
Closed: 4 days ago
Resolution: --- → FIXED
Target Milestone: --- → 156 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: