Closed Bug 2081848 Opened 1 month ago Closed 1 month ago

Declare the browser window's globals as the members of a BrowserWindow type

Categories

(Firefox :: Tabbed Browser, task)

task

Tracking

()

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

The globals keep their types; browser-window.d.ts now takes them from BrowserWindow.

Assignee: nobody → dao+bmo
Status: NEW → ASSIGNED
Attachment #9659537 - Attachment description: Bug 2081848 - Declare the browser window's globals as the members of a BrowserWindow type. r?#tabbrowser-reviewers → Bug 2081848 - Declare the browser window's globals as the members of a BrowserWindow type. r?Standard8!
Blocks: 2081869
Depends on: 2076596
Attachment #9659537 - Attachment description: Bug 2081848 - Declare the browser window's globals as the members of a BrowserWindow type. r?Standard8! → Bug 2081848 - Declare the browser window's globals as the members of a BrowserWindow type. r?#tabbrowser-reviewers
Attachment #9659537 - Attachment description: Bug 2081848 - Declare the browser window's globals as the members of a BrowserWindow type. r?#tabbrowser-reviewers → Bug 2081848 - Declare the browser window's globals as the members of a BrowserWindow type. r?Standard8!
Blocks: 2082766
Pushed by dgottwald@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/9512d8d05c50 https://hg.mozilla.org/integration/autoland/rev/4150d73280a4 Declare the browser window's globals as the members of a BrowserWindow type. r=Standard8 https://github.com/mozilla-firefox/firefox/commit/06af8149e92d https://hg.mozilla.org/integration/autoland/rev/5f43a79202ca Type allSplitViews' return value as MozTabSplitViewWrapper[]. r=tabbrowser-reviewers,sclements
Pushed by smolnar@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/4b6097ab7652 https://hg.mozilla.org/integration/autoland/rev/f8355faa6a58 Revert "Bug 2081848 - Type allSplitViews' return value as MozTabSplitViewWrapper[]. r=tabbrowser-reviewers,sclements" for causing documentation failures
Flags: needinfo?(dao+bmo)
Pushed by dgottwald@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/b04cdb4a9fd9 https://hg.mozilla.org/integration/autoland/rev/b15898b83788 Declare the browser window's globals as the members of a BrowserWindow type. r=Standard8 https://github.com/mozilla-firefox/firefox/commit/14603d952e2e https://hg.mozilla.org/integration/autoland/rev/0b8575157edb Type allSplitViews' return value as MozTabSplitViewWrapper[]. r=tabbrowser-reviewers,sclements
Status: ASSIGNED → RESOLVED
Closed: 1 month ago
Resolution: --- → FIXED
Target Milestone: --- → 160 Branch
Flags: needinfo?(dao+bmo)
QA Whiteboard: [qa-triage-done-c161/b160]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: