Declare the browser window's globals as the members of a BrowserWindow type
Categories
(Firefox :: Tabbed Browser, task)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox160 | --- | fixed |
People
(Reporter: dao, Assigned: dao)
References
(Blocks 1 open bug)
Details
Attachments
(2 external files)
tools/@types/browser-window.d.ts declares the globals that browser.xhtml's scripts define, for modules that run in the browser window. Code that reads them off a window value, like Session Restore's win.gBrowser, has no type for that window, so the reads are any through the index signature on Window.
Move the declarations into a module that exports them along with BrowserWindow = ChromeWindow & typeof import(itself), and type each global in browser-window.d.ts from it. A project can then use BrowserWindow without declaring the globals as its own. A type built from typeof globalThis would need the globals in the consuming project's scope, where they clash with a page script's top-level imports, and it leaves out declare const globals.
Also type allSplitViews as MozTabSplitViewWrapper[]; it returns Element[].
| Assignee | ||
Comment 1•1 month ago
|
||
The globals keep their types; browser-window.d.ts now takes them from BrowserWindow.
Updated•1 month ago
|
| Assignee | ||
Comment 2•1 month ago
|
||
Updated•1 month ago
|
Updated•1 month ago
|
Updated•1 month ago
|
Comment 5•1 month ago
|
||
Backed out for causing documentation failures
Backout link: https://hg.mozilla.org/integration/autoland/rev/f8355faa6a589d692906b4d24866fea945be509f
Comment 7•1 month ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/b15898b83788
https://hg.mozilla.org/mozilla-central/rev/0b8575157edb
| Assignee | ||
Updated•1 month ago
|
Updated•1 month ago
|
Description
•