Convert tabs.js to a module and type the tab strip from its class
Categories
(Firefox :: Tabbed Browser, task)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox158 | --- | fixed |
People
(Reporter: dao, Assigned: dao)
References
(Blocks 1 open bug)
Details
Attachments
(5 external files, 1 obsolete file)
browser/components/tabbrowser/content/tabs.js is loaded as a subscript, so TypeScript cannot see MozTabbrowserTabs. Nothing stands in for the tab strip either, so every tabContainer access in Tabbrowser.sys.mjs goes unchecked.
Make it a .mjs that exports its class and defines the element, imported with { global: "current" } where the subscript was loaded, the way Bug 2066073 did for tabgroup.js and tabsplitview.js. Then declare MozElements.TabsBase in tools/@types/lib.gecko.augmentations.d.ts - an undeclared base makes every inherited member vanish - and point types/elements.ts at the real class.
| Assignee | ||
Comment 1•2 months ago
|
||
The .mjs extension turns on no-shadow with builtinGlobals, so three locals shadowing window.name, window.parent and window.closed are renamed here.
The subscript loader does not read the extension, so the file still loads as before. Dropping "use strict", which eslint rejects in a .mjs, leaves it sloppy until the next commit makes it a real module; nothing outside the class body depends on strictness.
Updated•2 months ago
|
| Assignee | ||
Comment 2•2 months ago
|
||
The browser-window eslint environment harvests its globals from the scripts browser-main.js loads with loadSubScript, and hands the set back to those same scripts. Once the next commit imports this one as a module instead, it is neither harvested nor handed anything, so the globals it uses have to be named here.
| Assignee | ||
Comment 3•2 months ago
|
||
Dropping the indentation-preserving block re-indents the whole file, so git diff -w is the actual change: the export, and the import that replaces the subscript load.
The three cannot be separated. export is top-level only, so it needs the block gone; and once the block is gone the file's own top-level names collide with the browser-window globals harvested from browser-main.js's loadSubScript line, which only the import removes.
| Assignee | ||
Comment 4•2 months ago
|
||
| Assignee | ||
Comment 5•2 months ago
|
||
Updated•2 months ago
|
| Assignee | ||
Updated•1 month ago
|
Comment 7•1 month ago
|
||
| bugherder | ||
| Assignee | ||
Updated•1 month ago
|
Comment 9•1 month ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/734f34d74cdb
https://hg.mozilla.org/mozilla-central/rev/3c676a88105c
https://hg.mozilla.org/mozilla-central/rev/72c8ebe25e96
| Assignee | ||
Comment 10•1 month ago
|
||
Comment 11•1 month ago
|
||
Comment 12•1 month ago
|
||
| bugherder | ||
Comment 13•1 month ago
|
||
A patch has been attached on this bug, which was already closed. Filing a separate bug will ensure better tracking. If this was not by mistake and further action is needed, please alert the appropriate party. (Or: if the patch doesn't change behavior -- e.g. landing a test case, or fixing a typo -- then feel free to disregard this message)
Updated•1 month ago
|
Description
•