commit c612ad015609750e6ef034dacd3bf8ece0770663
parent 6ce7b737ba05d0e60d61c8cfd329f13ba094b2ee
Author: Mark Banner <standard8@mozilla.com>
Date: Mon, 10 Nov 2025 10:16:36 +0000
Bug 1996091 - Add XUL*Element TypeScript mappings for Document.createXULElement. r=zombie,urlbar-reviewers,mak
Differential Revision: https://phabricator.services.mozilla.com/D269827
Diffstat:
2 files changed, 23 insertions(+), 4 deletions(-)
diff --git a/browser/components/urlbar/SearchModeSwitcher.sys.mjs b/browser/components/urlbar/SearchModeSwitcher.sys.mjs
@@ -410,9 +410,12 @@ export class SearchModeSwitcher {
menuitem.classList.add("badge-new");
}
- menuitem.addEventListener("command", e => {
- this.search({ engine, openEngineHomePage: e.shiftKey });
- });
+ menuitem.addEventListener(
+ "command",
+ /** @param {KeyboardEvent} e */ e => {
+ this.search({ engine, openEngineHomePage: e.shiftKey });
+ }
+ );
this.#popup.insertBefore(menuitem, separator);
}
diff --git a/tools/@types/lib.gecko.tweaks.d.ts b/tools/@types/lib.gecko.tweaks.d.ts
@@ -25,8 +25,24 @@ interface ChromeWindow extends Window {
isChromeWindow: true;
}
+interface XULElementTagNameMap {
+ browser: MozBrowser;
+ iframe: XULFrameElement;
+ label: XULTextElement;
+ menu: XULMenuElement;
+ menupopup: XULPopupElement;
+ tree: XULTreeElement;
+}
+
interface Document {
- createXULElement(name: "browser"): MozBrowser;
+ createXULElement<K extends keyof XULElementTagNameMap>(
+ localName: K,
+ options?: string | ElementCreationOptions
+ ): XULElementTagNameMap[K];
+ createXULElement(
+ localName: string,
+ options?: string | ElementCreationOptions
+ ): XULElement;
}
type nsIGleanPingNoReason = {