Closed Bug 2081869 Opened 1 month ago Closed 1 month ago

Type the address bar code's browser windows as BrowserWindow

Categories

(Firefox :: Address Bar, task)

task

Tracking

()

RESOLVED FIXED
160 Branch
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.

Depends on: 2076596
Assignee: nobody → dao+bmo
Status: NEW → ASSIGNED
Whiteboard: [sng]

SitePermissions still types as any, because SitePermissions.sys.mjs refers to the object in its own initializer.

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.

UrlbarValueFormatter's window is cast to BrowserWindow, since the formatter already reads gBrowser and gBrowserInit off it.

Attachment #9660366 - Attachment description: Bug 2081869 - Declare the lastLocationChange property that the tabbrowser sets on browser elements. r?Standard8! → Bug 2081869 - Declare the lastLocationChange property that the tabbrowser sets on browser elements. r?#reusable-components-reviewers
Attachment #9660366 - Attachment description: Bug 2081869 - Declare the lastLocationChange property that the tabbrowser sets on browser elements. r?#reusable-components-reviewers → Bug 2081869 - Declare the lastLocationChange property that the tabbrowser sets on browser elements. r?Standard8!
Attachment #9660366 - Attachment description: Bug 2081869 - Declare the lastLocationChange property that the tabbrowser sets on browser elements. r?Standard8! → Bug 2081869 - Declare the lastLocationChange property that the tabbrowser sets on browser elements. r?#reusable-components-reviewers
Pushed by dgottwald@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/4de792cb8c9f https://hg.mozilla.org/integration/autoland/rev/852d2762086d Declare the browser window globals that the address bar reads. r=Standard8 https://github.com/mozilla-firefox/firefox/commit/4a0b297b9d65 https://hg.mozilla.org/integration/autoland/rev/0b4184afb091 Declare the lastLocationChange property that the tabbrowser sets on browser elements. r=reusable-components-reviewers,tgiles https://github.com/mozilla-firefox/firefox/commit/340069cf8b00 https://hg.mozilla.org/integration/autoland/rev/31fd520ceb5a Call URILoadingHelper's openTrustedLinkIn and switchToTabHavingURI directly from the address bar. r=urlbar-reviewers,Standard8 https://github.com/mozilla-firefox/firefox/commit/232ad2b1ce8c https://hg.mozilla.org/integration/autoland/rev/41dc70018d0f Type the address bar code's browser windows as BrowserWindow. r=Standard8,urlbar-reviewers
QA Whiteboard: [search][qa-triage-done-c160/b159]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: