commit d2e94fc8ba3c0914e6393092a8bbbb1e7006fcbb
parent 870365b83c1953a2e3fdab88423b2826fb58e6b7
Author: Mark Striemer <mstriemer@mozilla.com>
Date: Fri, 14 Nov 2025 19:28:53 +0000
Bug 1999068 - Override CustomElementConstructor type definition in lib.gecko.dom.ts r=Standard8
Differential Revision: https://phabricator.services.mozilla.com/D271874
Diffstat:
6 files changed, 78 insertions(+), 1 deletion(-)
diff --git a/tools/@types/generated/lib.gecko.dom.d.ts b/tools/@types/generated/lib.gecko.dom.d.ts
@@ -26247,7 +26247,7 @@ interface CreateScriptURLCallback {
}
interface CustomElementConstructor {
- (): any;
+ new (...params: any[]): HTMLElement;
}
interface CustomElementCreationCallback {
diff --git a/tools/@types/generated/lib.gecko.linux.d.ts b/tools/@types/generated/lib.gecko.linux.d.ts
@@ -11,6 +11,8 @@ declare global {
interface nsIGNOMEShellService extends nsIShellService {
readonly canSetDesktopBackground: boolean;
isDefaultForScheme(aScheme: string): boolean;
+ getGSettingsString(aScheme: string, aKey: string): string;
+ setGSettingsString(aScheme: string, aKey: string, aValue: string): void;
}
// https://searchfox.org/mozilla-central/source/browser/components/shell/nsIOpenTabsProvider.idl
diff --git a/tools/@types/generated/lib.gecko.modules.d.ts b/tools/@types/generated/lib.gecko.modules.d.ts
@@ -29,6 +29,7 @@ export interface Modules {
"chrome://global/content/ml/ClusterAlgos.sys.mjs": typeof import("chrome://global/content/ml/ClusterAlgos.sys.mjs"),
"chrome://global/content/ml/EmbeddingsGenerator.sys.mjs": typeof import("chrome://global/content/ml/EmbeddingsGenerator.sys.mjs"),
"chrome://global/content/ml/EngineProcess.sys.mjs": typeof import("chrome://global/content/ml/EngineProcess.sys.mjs"),
+ "chrome://global/content/ml/MLTelemetry.sys.mjs": typeof import("chrome://global/content/ml/MLTelemetry.sys.mjs"),
"chrome://global/content/ml/ModelHub.sys.mjs": typeof import("chrome://global/content/ml/ModelHub.sys.mjs"),
"chrome://global/content/ml/NLPUtils.sys.mjs": typeof import("chrome://global/content/ml/NLPUtils.sys.mjs"),
"chrome://global/content/ml/OPFS.sys.mjs": typeof import("chrome://global/content/ml/OPFS.sys.mjs"),
@@ -101,6 +102,7 @@ export interface Modules {
"chrome://remote/content/shared/Navigate.sys.mjs": typeof import("chrome://remote/content/shared/Navigate.sys.mjs"),
"chrome://remote/content/shared/NavigationManager.sys.mjs": typeof import("chrome://remote/content/shared/NavigationManager.sys.mjs"),
"chrome://remote/content/shared/NetworkCacheManager.sys.mjs": typeof import("chrome://remote/content/shared/NetworkCacheManager.sys.mjs"),
+ "chrome://remote/content/shared/NetworkDataBytes.sys.mjs": typeof import("chrome://remote/content/shared/NetworkDataBytes.sys.mjs"),
"chrome://remote/content/shared/NetworkDecodedBodySizeMap.sys.mjs": typeof import("chrome://remote/content/shared/NetworkDecodedBodySizeMap.sys.mjs"),
"chrome://remote/content/shared/NetworkRequest.sys.mjs": typeof import("chrome://remote/content/shared/NetworkRequest.sys.mjs"),
"chrome://remote/content/shared/NetworkResponse.sys.mjs": typeof import("chrome://remote/content/shared/NetworkResponse.sys.mjs"),
@@ -281,6 +283,7 @@ export interface Modules {
"moz-src:///browser/components/urlbar/private/AmpSuggestions.sys.mjs": typeof import("moz-src:///browser/components/urlbar/private/AmpSuggestions.sys.mjs"),
"moz-src:///browser/components/urlbar/private/GeolocationUtils.sys.mjs": typeof import("moz-src:///browser/components/urlbar/private/GeolocationUtils.sys.mjs"),
"moz-src:///browser/components/urlbar/private/MLSuggest.sys.mjs": typeof import("moz-src:///browser/components/urlbar/private/MLSuggest.sys.mjs"),
+ "moz-src:///browser/components/urlbar/private/SportsSuggestions.sys.mjs": typeof import("moz-src:///browser/components/urlbar/private/SportsSuggestions.sys.mjs"),
"moz-src:///browser/components/urlbar/private/SuggestBackendRust.sys.mjs": typeof import("moz-src:///browser/components/urlbar/private/SuggestBackendRust.sys.mjs"),
"moz-src:///browser/modules/CanvasPermissionPromptHelper.sys.mjs": typeof import("moz-src:///browser/modules/CanvasPermissionPromptHelper.sys.mjs"),
"moz-src:///browser/modules/ContextId.sys.mjs": typeof import("moz-src:///browser/modules/ContextId.sys.mjs"),
@@ -357,6 +360,7 @@ export interface Modules {
"resource:///modules/ChromeProfileMigrator.sys.mjs": typeof import("resource:///modules/ChromeProfileMigrator.sys.mjs"),
"resource:///modules/ChromeWindowsLoginCrypto.sys.mjs": typeof import("resource:///modules/ChromeWindowsLoginCrypto.sys.mjs"),
"resource:///modules/ContentCrashHandlers.sys.mjs": typeof import("resource:///modules/ContentCrashHandlers.sys.mjs"),
+ "resource:///modules/CustomKeys.sys.mjs": typeof import("resource:///modules/CustomKeys.sys.mjs"),
"resource:///modules/Dedupe.sys.mjs": typeof import("resource:///modules/Dedupe.sys.mjs"),
"resource:///modules/DevToolsStartup.sys.mjs": typeof import("resource:///modules/DevToolsStartup.sys.mjs"),
"resource:///modules/Discovery.sys.mjs": typeof import("resource:///modules/Discovery.sys.mjs"),
@@ -464,6 +468,7 @@ export interface Modules {
"resource:///modules/ipprotection/IPPProxyManager.sys.mjs": typeof import("resource:///modules/ipprotection/IPPProxyManager.sys.mjs"),
"resource:///modules/ipprotection/IPPSignInWatcher.sys.mjs": typeof import("resource:///modules/ipprotection/IPPSignInWatcher.sys.mjs"),
"resource:///modules/ipprotection/IPPStartupCache.sys.mjs": typeof import("resource:///modules/ipprotection/IPPStartupCache.sys.mjs"),
+ "resource:///modules/ipprotection/IPPVPNAddonHelper.sys.mjs": typeof import("resource:///modules/ipprotection/IPPVPNAddonHelper.sys.mjs"),
"resource:///modules/ipprotection/IPProtection.sys.mjs": typeof import("resource:///modules/ipprotection/IPProtection.sys.mjs"),
"resource:///modules/ipprotection/IPProtectionHelpers.sys.mjs": typeof import("resource:///modules/ipprotection/IPProtectionHelpers.sys.mjs"),
"resource:///modules/ipprotection/IPProtectionPanel.sys.mjs": typeof import("resource:///modules/ipprotection/IPProtectionPanel.sys.mjs"),
@@ -659,6 +664,7 @@ export interface Modules {
"resource://gre/modules/CustomElementsListener.sys.mjs": typeof import("resource://gre/modules/CustomElementsListener.sys.mjs"),
"resource://gre/modules/DAPIncrementality.sys.mjs": typeof import("resource://gre/modules/DAPIncrementality.sys.mjs"),
"resource://gre/modules/DAPReportController.sys.mjs": typeof import("resource://gre/modules/DAPReportController.sys.mjs"),
+ "resource://gre/modules/DAPSender.sys.mjs": typeof import("resource://gre/modules/DAPSender.sys.mjs"),
"resource://gre/modules/DAPTelemetrySender.sys.mjs": typeof import("resource://gre/modules/DAPTelemetrySender.sys.mjs"),
"resource://gre/modules/DAPVisitCounter.sys.mjs": typeof import("resource://gre/modules/DAPVisitCounter.sys.mjs"),
"resource://gre/modules/DateTimePickerPanel.sys.mjs": typeof import("resource://gre/modules/DateTimePickerPanel.sys.mjs"),
@@ -1012,6 +1018,7 @@ export interface Modules {
"resource://newtab/lib/PrefsFeed.sys.mjs": typeof import("resource://newtab/lib/PrefsFeed.sys.mjs"),
"resource://newtab/lib/RecommendationProvider.sys.mjs": typeof import("resource://newtab/lib/RecommendationProvider.sys.mjs"),
"resource://newtab/lib/Screenshots.sys.mjs": typeof import("resource://newtab/lib/Screenshots.sys.mjs"),
+ "resource://newtab/lib/SectionsLayoutManager.sys.mjs": typeof import("resource://newtab/lib/SectionsLayoutManager.sys.mjs"),
"resource://newtab/lib/SectionsManager.sys.mjs": typeof import("resource://newtab/lib/SectionsManager.sys.mjs"),
"resource://newtab/lib/SmartShortcutsFeed.sys.mjs": typeof import("resource://newtab/lib/SmartShortcutsFeed.sys.mjs"),
"resource://newtab/lib/SmartShortcutsRanker/RankShortcuts.mjs": typeof import("resource://newtab/lib/SmartShortcutsRanker/RankShortcuts.mjs"),
diff --git a/tools/@types/generated/lib.gecko.xpcom.d.ts b/tools/@types/generated/lib.gecko.xpcom.d.ts
@@ -10333,6 +10333,28 @@ interface mozISandboxSettings extends nsISupports {
readonly contentWin32kLockdownStateString: string;
}
+// https://searchfox.org/mozilla-central/source/security/sandbox/linux/interfaces/mozISandboxReporter.idl
+
+interface mozISandboxReport extends nsISupports {
+ readonly msecAgo: u64;
+ readonly pid: i32;
+ readonly tid: i32;
+ readonly procType: string;
+ readonly syscall: u32;
+ readonly numArgs: u32;
+ getArg(aIndex: u32): string;
+}
+
+interface mozISandboxReportArray extends nsISupports {
+ readonly begin: u64;
+ readonly end: u64;
+ getElement(aIndex: u64): mozISandboxReport;
+}
+
+interface mozISandboxReporter extends nsISupports {
+ snapshot(): mozISandboxReportArray;
+}
+
// https://searchfox.org/mozilla-central/source/toolkit/components/satchel/nsIFormFillController.idl
interface nsIFormFillController extends nsISupports {
@@ -13644,6 +13666,12 @@ interface nsIAvailableMemoryWatcherBase extends nsISupports {
onUnloadAttemptCompleted(aResult: nsresult): void;
}
+// https://searchfox.org/mozilla-central/source/xpcom/base/nsIAvailableMemoryWatcherTestingLinux.idl
+
+interface nsIAvailableMemoryWatcherTestingLinux extends nsISupports {
+ setPSIPathForTesting(aPSIPath: string): void;
+}
+
// https://searchfox.org/mozilla-central/source/xpcom/base/nsIConsoleListener.idl
type nsIConsoleListener = Callable<{
@@ -16198,6 +16226,9 @@ interface nsIXPCComponents_Interfaces {
nsIApplicationReputationQuery: nsJSIID<nsIApplicationReputationQuery>;
nsIApplicationReputationCallback: nsJSIID<nsIApplicationReputationCallback>;
mozISandboxSettings: nsJSIID<mozISandboxSettings>;
+ mozISandboxReport: nsJSIID<mozISandboxReport>;
+ mozISandboxReportArray: nsJSIID<mozISandboxReportArray>;
+ mozISandboxReporter: nsJSIID<mozISandboxReporter>;
nsIFormFillController: nsJSIID<nsIFormFillController>;
nsIFormFillCompleteObserver: nsJSIID<nsIFormFillCompleteObserver>;
mozIBridgedSyncEngineCallback: nsJSIID<mozIBridgedSyncEngineCallback>;
@@ -16433,6 +16464,7 @@ interface nsIXPCComponents_Interfaces {
nsIWindowWatcher: nsJSIID<nsIWindowWatcher>;
nsITabUnloader: nsJSIID<nsITabUnloader>;
nsIAvailableMemoryWatcherBase: nsJSIID<nsIAvailableMemoryWatcherBase>;
+ nsIAvailableMemoryWatcherTestingLinux: nsJSIID<nsIAvailableMemoryWatcherTestingLinux>;
nsIConsoleListener: nsJSIID<nsIConsoleListener>;
nsIConsoleMessage: nsJSIID<nsIConsoleMessage>;
nsIConsoleService: nsJSIID<nsIConsoleService, typeof nsIConsoleService_OutputMode>;
diff --git a/tools/@types/generated/tspaths.json b/tools/@types/generated/tspaths.json
@@ -92,6 +92,9 @@
"chrome://browser/content/ipprotection/ipprotection-signedout.mjs": [
"browser/components/ipprotection/content/ipprotection-signedout.mjs"
],
+ "chrome://browser/content/ipprotection/ipprotection-status-card.mjs": [
+ "browser/components/ipprotection/content/ipprotection-status-card.mjs"
+ ],
"chrome://browser/content/ipprotection/ipprotection-timer.mjs": [
"browser/components/ipprotection/content/ipprotection-timer.mjs"
],
@@ -296,6 +299,9 @@
"chrome://global/content/ml/EngineProcess.sys.mjs": [
"toolkit/components/ml/content/EngineProcess.sys.mjs"
],
+ "chrome://global/content/ml/MLTelemetry.sys.mjs": [
+ "toolkit/components/ml/MLTelemetry.sys.mjs"
+ ],
"chrome://global/content/ml/ModelHub.sys.mjs": [
"toolkit/components/ml/content/ModelHub.sys.mjs"
],
@@ -572,6 +578,9 @@
"chrome://remote/content/shared/NetworkCacheManager.sys.mjs": [
"remote/shared/NetworkCacheManager.sys.mjs"
],
+ "chrome://remote/content/shared/NetworkDataBytes.sys.mjs": [
+ "remote/shared/NetworkDataBytes.sys.mjs"
+ ],
"chrome://remote/content/shared/NetworkDecodedBodySizeMap.sys.mjs": [
"remote/shared/NetworkDecodedBodySizeMap.sys.mjs"
],
@@ -938,6 +947,9 @@
"resource:///modules/ContentCrashHandlers.sys.mjs": [
"browser/modules/ContentCrashHandlers.sys.mjs"
],
+ "resource:///modules/CustomKeys.sys.mjs": [
+ "browser/components/customkeys/CustomKeys.sys.mjs"
+ ],
"resource:///modules/Dedupe.sys.mjs": [
"browser/modules/Dedupe.sys.mjs"
],
@@ -1277,6 +1289,9 @@
"resource:///modules/ipprotection/IPPStartupCache.sys.mjs": [
"browser/components/ipprotection/IPPStartupCache.sys.mjs"
],
+ "resource:///modules/ipprotection/IPPVPNAddonHelper.sys.mjs": [
+ "browser/components/ipprotection/IPPVPNAddonHelper.sys.mjs"
+ ],
"resource:///modules/ipprotection/IPProtection.sys.mjs": [
"browser/components/ipprotection/IPProtection.sys.mjs"
],
@@ -5378,6 +5393,9 @@
"resource://gre/modules/DAPReportController.sys.mjs": [
"toolkit/components/dap/DAPReportController.sys.mjs"
],
+ "resource://gre/modules/DAPSender.sys.mjs": [
+ "toolkit/components/dap/DAPSender.sys.mjs"
+ ],
"resource://gre/modules/DAPTelemetrySender.sys.mjs": [
"toolkit/components/dap/DAPTelemetrySender.sys.mjs"
],
@@ -6542,6 +6560,9 @@
"resource://newtab/lib/Screenshots.sys.mjs": [
"browser/extensions/newtab/lib/Screenshots.sys.mjs"
],
+ "resource://newtab/lib/SectionsLayoutManager.sys.mjs": [
+ "browser/extensions/newtab/lib/SectionsLayoutManager.sys.mjs"
+ ],
"resource://newtab/lib/SectionsManager.sys.mjs": [
"browser/extensions/newtab/lib/SectionsManager.sys.mjs"
],
diff --git a/tools/ts/build_dom.js b/tools/ts/build_dom.js
@@ -25,6 +25,19 @@ const GENERATED_WEDIDL_FILES = [
"CSSStyleProperties.webidl",
];
+// Support overrides using the syntax from @typescript/dom-lib-generator which
+// is parsing our webidl files and generating types.
+// https://github.com/microsoft/TypeScript-DOM-lib-generator/blob/main/inputfiles/overridingTypes.jsonc
+const OVERRIDE_TYPES = {
+ callbackFunctions: {
+ callbackFunction: {
+ CustomElementConstructor: {
+ overrideSignatures: ["new (...params: any[]): HTMLElement"],
+ },
+ },
+ },
+};
+
const HEADER = `/**
* NOTE: Do not modify this file by hand.
* Content was generated from source .webidl files.
@@ -167,6 +180,8 @@ async function emitDom(webidls, builtin = "builtin.webidl") {
}
}
+ merge(all, OVERRIDE_TYPES);
+
let additionalExports = customize(all, baseTypeConversionMap);
let exposed = getExposedTypes(all, ["Window"], new Set());
let dts = await Promise.all([