Type the address bar code's browser windows as BrowserWindow
Categories
(Firefox :: Address Bar, task)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox160 | --- | fixed |
People
(Reporter: dao, Assigned: dao)
References
(Blocks 1 open bug)
Details
(Whiteboard: [sng])
Attachments
(4 external files)
The address bar modules read browser window globals such as gBrowser off window values (window, controller.browserWindow), which tsc types as Window or ChromeWindow. Neither declares those globals, so each read falls through the index signature on Window and is any. Without that index signature, the urlbar project raised 62 errors on 2026-10-05, the most of the ten projects the TypeScript lint checks.
Bug 2081848 adds a BrowserWindow type in tools/@types/browser-window-globals.d.ts. The .sys.mjs modules can alias it in the project's types, as bug 2079204 does for Session Restore, and type their window values with it. The modules under content/ run in the window and can include browser-window.d.ts instead. The local BrowserWindow typedef in UrlbarInputBase.mjs (ChromeWindow & {gBrowser: Tabbrowser}) goes away in favor of the shared type.
| Assignee | ||
Updated•1 month ago
|
Updated•1 month ago
|
| Assignee | ||
Comment 1•1 month ago
|
||
SitePermissions still types as any, because SitePermissions.sys.mjs refers to the object in its own initializer.
| Assignee | ||
Comment 2•1 month ago
|
||
| Assignee | ||
Comment 3•1 month ago
|
||
The tests spy on URILoadingHelper, which the window's wrappers forward to. browser_searchbar_dragdrop.js now creates its spy in the sandbox it restores.
| Assignee | ||
Comment 4•1 month ago
|
||
UrlbarValueFormatter's window is cast to BrowserWindow, since the formatter already reads gBrowser and gBrowserInit off it.
Updated•1 month ago
|
Updated•1 month ago
|
Updated•1 month ago
|
Comment 6•1 month ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/852d2762086d
https://hg.mozilla.org/mozilla-central/rev/0b4184afb091
https://hg.mozilla.org/mozilla-central/rev/31fd520ceb5a
https://hg.mozilla.org/mozilla-central/rev/41dc70018d0f
Updated•1 month ago
|
Description
•