1
0
Fork 1
mirror of https://github.com/zen-browser/desktop.git synced 2025-07-08 09:29:58 +02:00

style: Formatted the project, b=(no-bug), c=scripts

This commit is contained in:
Mr. M 2025-04-21 00:05:34 +02:00
parent e65991aa03
commit 8136387a75
No known key found for this signature in database
GPG key ID: 6292C4C8F8652B18
11 changed files with 41339 additions and 33414 deletions

View file

@ -2,23 +2,24 @@
import os import os
FILES = [ FILES = [
"index.d.ts", "index.d.ts",
"lib.gecko.darwin.d.ts", "lib.gecko.darwin.d.ts",
"lib.gecko.dom.d.ts", "lib.gecko.dom.d.ts",
"lib.gecko.glean.d.ts", "lib.gecko.glean.d.ts",
"lib.gecko.linux.d.ts", "lib.gecko.linux.d.ts",
"lib.gecko.modules.d.ts", "lib.gecko.modules.d.ts",
"lib.gecko.nsresult.d.ts", "lib.gecko.nsresult.d.ts",
"lib.gecko.services.d.ts", "lib.gecko.services.d.ts",
"lib.gecko.tweaks.d.ts", "lib.gecko.tweaks.d.ts",
"lib.gecko.win32.d.ts", "lib.gecko.win32.d.ts",
"lib.gecko.xpcom.d.ts", "lib.gecko.xpcom.d.ts",
"lib.gecko.xpidl.d.ts", "lib.gecko.xpidl.d.ts",
] ]
ENGINE_PATH = os.path.join("engine", "tools", "@types") ENGINE_PATH = os.path.join("engine", "tools", "@types")
SRC_PATH = os.path.join("src", "zen", "@types") SRC_PATH = os.path.join("src", "zen", "@types")
def update_ts_types(): def update_ts_types():
os.system("cd engine && ./mach ts build && ./mach ts update") os.system("cd engine && ./mach ts build && ./mach ts update")
# copy the files from engine/tools/@types to src/@types # copy the files from engine/tools/@types to src/@types
@ -36,6 +37,7 @@ def update_ts_types():
f.write('/// <reference types="./zen.d.ts" />\n') f.write('/// <reference types="./zen.d.ts" />\n')
f.write('\n') f.write('\n')
if __name__ == "__main__": if __name__ == "__main__":
update_ts_types() update_ts_types()
print("Updated TypeScript types.") print("Updated TypeScript types.")

View file

@ -34,4 +34,3 @@ declare global {
export {}; export {};
/// <reference types="./zen.d.ts" /> /// <reference types="./zen.d.ts" />

View file

@ -5,13 +5,11 @@
*/ */
declare global { declare global {
// https://searchfox.org/mozilla-central/source/accessible/interfaces/nsIAccessibleMacInterface.idl
// https://searchfox.org/mozilla-central/source/accessible/interfaces/nsIAccessibleMacInterface.idl interface nsIAccessibleMacNSObjectWrapper extends nsISupports {}
interface nsIAccessibleMacNSObjectWrapper extends nsISupports { interface nsIAccessibleMacInterface extends nsISupports {
}
interface nsIAccessibleMacInterface extends nsISupports {
readonly attributeNames: string[]; readonly attributeNames: string[];
readonly parameterizedAttributeNames: string[]; readonly parameterizedAttributeNames: string[];
readonly actionNames: string[]; readonly actionNames: string[];
@ -20,34 +18,34 @@ interface nsIAccessibleMacInterface extends nsISupports {
performAction(actionName: string): void; performAction(actionName: string): void;
isAttributeSettable(attributeName: string): boolean; isAttributeSettable(attributeName: string): boolean;
setAttributeValue(attributeName: string, attributeValue: any): void; setAttributeValue(attributeName: string, attributeValue: any): void;
} }
interface nsIAccessibleMacEvent extends nsISupports { interface nsIAccessibleMacEvent extends nsISupports {
readonly macIface: nsIAccessibleMacInterface; readonly macIface: nsIAccessibleMacInterface;
readonly data: any; readonly data: any;
} }
// https://searchfox.org/mozilla-central/source/browser/components/migration/nsIKeychainMigrationUtils.idl // https://searchfox.org/mozilla-central/source/browser/components/migration/nsIKeychainMigrationUtils.idl
interface nsIKeychainMigrationUtils extends nsISupports { interface nsIKeychainMigrationUtils extends nsISupports {
getGenericPassword(aServiceName: string, aAccountName: string): string; getGenericPassword(aServiceName: string, aAccountName: string): string;
} }
// https://searchfox.org/mozilla-central/source/browser/components/shell/nsIMacShellService.idl // https://searchfox.org/mozilla-central/source/browser/components/shell/nsIMacShellService.idl
interface nsIMacShellService extends nsIShellService { interface nsIMacShellService extends nsIShellService {
showDesktopPreferences(): void; showDesktopPreferences(): void;
showSecurityPreferences(aPaneID: string): void; showSecurityPreferences(aPaneID: string): void;
getAvailableApplicationsForProtocol(protocol: string): string[][]; getAvailableApplicationsForProtocol(protocol: string): string[][];
} }
// https://searchfox.org/mozilla-central/source/widget/nsIMacDockSupport.idl // https://searchfox.org/mozilla-central/source/widget/nsIMacDockSupport.idl
interface nsIAppBundleLaunchOptions extends nsISupports { interface nsIAppBundleLaunchOptions extends nsISupports {
readonly addsToRecentItems: boolean; readonly addsToRecentItems: boolean;
} }
interface nsIMacDockSupport extends nsISupports { interface nsIMacDockSupport extends nsISupports {
dockMenu: nsIStandaloneNativeMenu; dockMenu: nsIStandaloneNativeMenu;
activateApplication(aIgnoreOtherApplications: boolean): void; activateApplication(aIgnoreOtherApplications: boolean): void;
badgeText: string; badgeText: string;
@ -55,59 +53,59 @@ interface nsIMacDockSupport extends nsISupports {
readonly isAppInDock: boolean; readonly isAppInDock: boolean;
ensureAppIsPinnedToDock(aAppPath?: string, aAppToReplacePath?: string): boolean; ensureAppIsPinnedToDock(aAppPath?: string, aAppToReplacePath?: string): boolean;
launchAppBundle(aAppBundle: nsIFile, aArgs: string[], aLaunchOptions?: nsIAppBundleLaunchOptions): void; launchAppBundle(aAppBundle: nsIFile, aArgs: string[], aLaunchOptions?: nsIAppBundleLaunchOptions): void;
} }
// https://searchfox.org/mozilla-central/source/widget/nsIMacFinderProgress.idl // https://searchfox.org/mozilla-central/source/widget/nsIMacFinderProgress.idl
type nsIMacFinderProgressCanceledCallback = Callable<{ type nsIMacFinderProgressCanceledCallback = Callable<{
canceled(): void; canceled(): void;
}> }>;
interface nsIMacFinderProgress extends nsISupports { interface nsIMacFinderProgress extends nsISupports {
init(path: string, canceledCallback: nsIMacFinderProgressCanceledCallback): void; init(path: string, canceledCallback: nsIMacFinderProgressCanceledCallback): void;
updateProgress(currentProgress: u64, totalProgress: u64): void; updateProgress(currentProgress: u64, totalProgress: u64): void;
end(): void; end(): void;
} }
// https://searchfox.org/mozilla-central/source/widget/nsIMacSharingService.idl // https://searchfox.org/mozilla-central/source/widget/nsIMacSharingService.idl
interface nsIMacSharingService extends nsISupports { interface nsIMacSharingService extends nsISupports {
getSharingProviders(pageUrl: string): any; getSharingProviders(pageUrl: string): any;
shareUrl(serviceName: string, pageUrl: string, pageTitle: string): void; shareUrl(serviceName: string, pageUrl: string, pageTitle: string): void;
openSharingPreferences(): void; openSharingPreferences(): void;
} }
// https://searchfox.org/mozilla-central/source/widget/nsIMacUserActivityUpdater.idl // https://searchfox.org/mozilla-central/source/widget/nsIMacUserActivityUpdater.idl
interface nsIMacUserActivityUpdater extends nsISupports { interface nsIMacUserActivityUpdater extends nsISupports {
updateLocation(pageUrl: string, pageTitle: string, window: nsIBaseWindow): void; updateLocation(pageUrl: string, pageTitle: string, window: nsIBaseWindow): void;
} }
// https://searchfox.org/mozilla-central/source/widget/nsIMacWebAppUtils.idl // https://searchfox.org/mozilla-central/source/widget/nsIMacWebAppUtils.idl
type nsITrashAppCallback = Callable<{ type nsITrashAppCallback = Callable<{
trashAppFinished(rv: nsresult): void; trashAppFinished(rv: nsresult): void;
}> }>;
interface nsIMacWebAppUtils extends nsISupports { interface nsIMacWebAppUtils extends nsISupports {
pathForAppWithIdentifier(bundleIdentifier: string): string; pathForAppWithIdentifier(bundleIdentifier: string): string;
launchAppWithIdentifier(bundleIdentifier: string): void; launchAppWithIdentifier(bundleIdentifier: string): void;
trashApp(path: string, callback: nsITrashAppCallback): void; trashApp(path: string, callback: nsITrashAppCallback): void;
} }
// https://searchfox.org/mozilla-central/source/widget/nsIStandaloneNativeMenu.idl // https://searchfox.org/mozilla-central/source/widget/nsIStandaloneNativeMenu.idl
interface nsIStandaloneNativeMenu extends nsISupports { interface nsIStandaloneNativeMenu extends nsISupports {
init(aElement: Element): void; init(aElement: Element): void;
menuWillOpen(): boolean; menuWillOpen(): boolean;
activateNativeMenuItemAt(anIndexString: string): void; activateNativeMenuItemAt(anIndexString: string): void;
forceUpdateNativeMenuAt(anIndexString: string): void; forceUpdateNativeMenuAt(anIndexString: string): void;
dump(): void; dump(): void;
} }
// https://searchfox.org/mozilla-central/source/widget/nsITaskbarProgress.idl // https://searchfox.org/mozilla-central/source/widget/nsITaskbarProgress.idl
interface nsITaskbarProgress extends nsISupports { interface nsITaskbarProgress extends nsISupports {
readonly STATE_NO_PROGRESS?: 0; readonly STATE_NO_PROGRESS?: 0;
readonly STATE_INDETERMINATE?: 1; readonly STATE_INDETERMINATE?: 1;
readonly STATE_NORMAL?: 2; readonly STATE_NORMAL?: 2;
@ -115,11 +113,11 @@ interface nsITaskbarProgress extends nsISupports {
readonly STATE_PAUSED?: 4; readonly STATE_PAUSED?: 4;
setProgressState(state: nsTaskbarProgressState, currentValue?: u64, maxValue?: u64): void; setProgressState(state: nsTaskbarProgressState, currentValue?: u64, maxValue?: u64): void;
} }
// https://searchfox.org/mozilla-central/source/widget/nsITouchBarHelper.idl // https://searchfox.org/mozilla-central/source/widget/nsITouchBarHelper.idl
interface nsITouchBarHelper extends nsISupports { interface nsITouchBarHelper extends nsISupports {
readonly activeUrl: string; readonly activeUrl: string;
readonly activeTitle: string; readonly activeTitle: string;
readonly isUrlbarFocused: boolean; readonly isUrlbarFocused: boolean;
@ -129,15 +127,15 @@ interface nsITouchBarHelper extends nsISupports {
readonly document: Document; readonly document: Document;
getTouchBarInput(aInputName: string): nsITouchBarInput; getTouchBarInput(aInputName: string): nsITouchBarInput;
insertRestrictionInUrlbar(aToken: string): void; insertRestrictionInUrlbar(aToken: string): void;
} }
// https://searchfox.org/mozilla-central/source/widget/nsITouchBarInput.idl // https://searchfox.org/mozilla-central/source/widget/nsITouchBarInput.idl
type nsITouchBarInputCallback = Callable<{ type nsITouchBarInputCallback = Callable<{
onCommand(): void; onCommand(): void;
}> }>;
interface nsITouchBarInput extends nsISupports { interface nsITouchBarInput extends nsISupports {
readonly key: string; readonly key: string;
title: string; title: string;
image: nsIURI; image: nsIURI;
@ -146,28 +144,28 @@ interface nsITouchBarInput extends nsISupports {
color: u32; color: u32;
disabled: boolean; disabled: boolean;
children: nsIArray; children: nsIArray;
} }
// https://searchfox.org/mozilla-central/source/widget/nsITouchBarUpdater.idl // https://searchfox.org/mozilla-central/source/widget/nsITouchBarUpdater.idl
interface nsITouchBarUpdater extends nsISupports { interface nsITouchBarUpdater extends nsISupports {
updateTouchBarInputs(aWindow: nsIBaseWindow, aInputs: nsITouchBarInput[]): void; updateTouchBarInputs(aWindow: nsIBaseWindow, aInputs: nsITouchBarInput[]): void;
enterCustomizeMode(): void; enterCustomizeMode(): void;
isTouchBarInitialized(): boolean; isTouchBarInitialized(): boolean;
setTouchBarInitialized(aIsInitialized: boolean): void; setTouchBarInitialized(aIsInitialized: boolean): void;
showPopover(aWindow: nsIBaseWindow, aPopover: nsITouchBarInput, aShowing: boolean): void; showPopover(aWindow: nsIBaseWindow, aPopover: nsITouchBarInput, aShowing: boolean): void;
} }
// https://searchfox.org/mozilla-central/source/xpcom/base/nsIMacPreferencesReader.idl // https://searchfox.org/mozilla-central/source/xpcom/base/nsIMacPreferencesReader.idl
interface nsIMacPreferencesReader extends nsISupports { interface nsIMacPreferencesReader extends nsISupports {
policiesEnabled(): boolean; policiesEnabled(): boolean;
readPreferences(): any; readPreferences(): any;
} }
// https://searchfox.org/mozilla-central/source/xpcom/io/nsILocalFileMac.idl // https://searchfox.org/mozilla-central/source/xpcom/io/nsILocalFileMac.idl
interface nsILocalFileMac extends nsIFile { interface nsILocalFileMac extends nsIFile {
readonly fileSizeWithResFork: i64; readonly fileSizeWithResFork: i64;
launchWithDoc(aDocToLoad: nsIFile, aLaunchInBackground: boolean): void; launchWithDoc(aDocToLoad: nsIFile, aLaunchInBackground: boolean): void;
openDocWithApp(aAppToOpenWith: nsIFile, aLaunchInBackground: boolean): void; openDocWithApp(aAppToOpenWith: nsIFile, aLaunchInBackground: boolean): void;
@ -179,9 +177,9 @@ interface nsILocalFileMac extends nsIFile {
getXAttr(aAttrName: string): u8[]; getXAttr(aAttrName: string): u8[];
setXAttr(aAttrName: string, aAttrValue: u8[]): void; setXAttr(aAttrName: string, aAttrValue: u8[]): void;
delXAttr(aAttrName: string): void; delXAttr(aAttrName: string): void;
} }
interface nsIXPCComponents_Interfaces { interface nsIXPCComponents_Interfaces {
nsIAccessibleMacNSObjectWrapper: nsJSIID<nsIAccessibleMacNSObjectWrapper>; nsIAccessibleMacNSObjectWrapper: nsJSIID<nsIAccessibleMacNSObjectWrapper>;
nsIAccessibleMacInterface: nsJSIID<nsIAccessibleMacInterface>; nsIAccessibleMacInterface: nsJSIID<nsIAccessibleMacInterface>;
nsIAccessibleMacEvent: nsJSIID<nsIAccessibleMacEvent>; nsIAccessibleMacEvent: nsJSIID<nsIAccessibleMacEvent>;
@ -203,8 +201,7 @@ interface nsIXPCComponents_Interfaces {
nsITouchBarUpdater: nsJSIID<nsITouchBarUpdater>; nsITouchBarUpdater: nsJSIID<nsITouchBarUpdater>;
nsIMacPreferencesReader: nsJSIID<nsIMacPreferencesReader>; nsIMacPreferencesReader: nsJSIID<nsIMacPreferencesReader>;
nsILocalFileMac: nsJSIID<nsILocalFileMac>; nsILocalFileMac: nsJSIID<nsILocalFileMac>;
} }
} // global } // global
// Typedefs from xpidl. // Typedefs from xpidl.
@ -223,6 +220,6 @@ type OutParam<T> = { value?: T };
type Enums<enums> = Partial<Pick<enums, keyof enums>>; type Enums<enums> = Partial<Pick<enums, keyof enums>>;
/** Callable accepts either form of a [function] interface. */ /** Callable accepts either form of a [function] interface. */
type Callable<iface> = iface | Extract<iface[keyof iface], Function> type Callable<iface> = iface | Extract<iface[keyof iface], Function>;
export {}; export {};

File diff suppressed because it is too large Load diff

View file

@ -5,41 +5,40 @@
*/ */
declare global { declare global {
// https://searchfox.org/mozilla-central/source/browser/components/shell/nsIGNOMEShellService.idl
// https://searchfox.org/mozilla-central/source/browser/components/shell/nsIGNOMEShellService.idl interface nsIGNOMEShellService extends nsIShellService {
interface nsIGNOMEShellService extends nsIShellService {
readonly canSetDesktopBackground: boolean; readonly canSetDesktopBackground: boolean;
isDefaultForScheme(aScheme: string): boolean; isDefaultForScheme(aScheme: string): boolean;
} }
// https://searchfox.org/mozilla-central/source/browser/components/shell/nsIOpenTabsProvider.idl // https://searchfox.org/mozilla-central/source/browser/components/shell/nsIOpenTabsProvider.idl
interface nsIOpenTabsProvider extends nsISupports { interface nsIOpenTabsProvider extends nsISupports {
getOpenTabs(): string[]; getOpenTabs(): string[];
switchToOpenTab(url: string): void; switchToOpenTab(url: string): void;
} }
// https://searchfox.org/mozilla-central/source/widget/nsIApplicationChooser.idl // https://searchfox.org/mozilla-central/source/widget/nsIApplicationChooser.idl
type nsIApplicationChooserFinishedCallback = Callable<{ type nsIApplicationChooserFinishedCallback = Callable<{
done(handlerApp: nsIHandlerApp): void; done(handlerApp: nsIHandlerApp): void;
}> }>;
interface nsIApplicationChooser extends nsISupports { interface nsIApplicationChooser extends nsISupports {
init(parent: mozIDOMWindowProxy, title: string): void; init(parent: mozIDOMWindowProxy, title: string): void;
open(contentType: string, applicationChooserFinishedCallback: nsIApplicationChooserFinishedCallback): void; open(contentType: string, applicationChooserFinishedCallback: nsIApplicationChooserFinishedCallback): void;
} }
// https://searchfox.org/mozilla-central/source/widget/nsIGtkTaskbarProgress.idl // https://searchfox.org/mozilla-central/source/widget/nsIGtkTaskbarProgress.idl
interface nsIGtkTaskbarProgress extends nsITaskbarProgress { interface nsIGtkTaskbarProgress extends nsITaskbarProgress {
setPrimaryWindow(aWindow: mozIDOMWindowProxy): void; setPrimaryWindow(aWindow: mozIDOMWindowProxy): void;
} }
// https://searchfox.org/mozilla-central/source/widget/nsITaskbarProgress.idl // https://searchfox.org/mozilla-central/source/widget/nsITaskbarProgress.idl
interface nsITaskbarProgress extends nsISupports { interface nsITaskbarProgress extends nsISupports {
readonly STATE_NO_PROGRESS?: 0; readonly STATE_NO_PROGRESS?: 0;
readonly STATE_INDETERMINATE?: 1; readonly STATE_INDETERMINATE?: 1;
readonly STATE_NORMAL?: 2; readonly STATE_NORMAL?: 2;
@ -47,17 +46,16 @@ interface nsITaskbarProgress extends nsISupports {
readonly STATE_PAUSED?: 4; readonly STATE_PAUSED?: 4;
setProgressState(state: nsTaskbarProgressState, currentValue?: u64, maxValue?: u64): void; setProgressState(state: nsTaskbarProgressState, currentValue?: u64, maxValue?: u64): void;
} }
interface nsIXPCComponents_Interfaces { interface nsIXPCComponents_Interfaces {
nsIGNOMEShellService: nsJSIID<nsIGNOMEShellService>; nsIGNOMEShellService: nsJSIID<nsIGNOMEShellService>;
nsIOpenTabsProvider: nsJSIID<nsIOpenTabsProvider>; nsIOpenTabsProvider: nsJSIID<nsIOpenTabsProvider>;
nsIApplicationChooserFinishedCallback: nsJSIID<nsIApplicationChooserFinishedCallback>; nsIApplicationChooserFinishedCallback: nsJSIID<nsIApplicationChooserFinishedCallback>;
nsIApplicationChooser: nsJSIID<nsIApplicationChooser>; nsIApplicationChooser: nsJSIID<nsIApplicationChooser>;
nsIGtkTaskbarProgress: nsJSIID<nsIGtkTaskbarProgress>; nsIGtkTaskbarProgress: nsJSIID<nsIGtkTaskbarProgress>;
nsITaskbarProgress: nsJSIID<nsITaskbarProgress>; nsITaskbarProgress: nsJSIID<nsITaskbarProgress>;
} }
} // global } // global
// Typedefs from xpidl. // Typedefs from xpidl.
@ -77,6 +75,6 @@ type OutParam<T> = { value?: T };
type Enums<enums> = Partial<Pick<enums, keyof enums>>; type Enums<enums> = Partial<Pick<enums, keyof enums>>;
/** Callable accepts either form of a [function] interface. */ /** Callable accepts either form of a [function] interface. */
type Callable<iface> = iface | Extract<iface[keyof iface], Function> type Callable<iface> = iface | Extract<iface[keyof iface], Function>;
export {}; export {};

File diff suppressed because it is too large Load diff

View file

@ -5,7 +5,6 @@
*/ */
interface nsIXPCComponents_Results { interface nsIXPCComponents_Results {
// Error Message definitions. // Error Message definitions.
// xpconnect specific codes (from nsIXPConnect.h) // xpconnect specific codes (from nsIXPConnect.h)

View file

@ -17,21 +17,21 @@ interface ChromeWindow extends Window {
} }
interface Document { interface Document {
createXULElement(name: "browser"): XULBrowserElement; createXULElement(name: 'browser'): XULBrowserElement;
} }
type nsIGleanPingNoReason = { type nsIGleanPingNoReason = {
[K in keyof nsIGleanPing]: K extends "submit" ? (_?: never) => void : nsIGleanPing[K]; [K in keyof nsIGleanPing]: K extends 'submit' ? (_?: never) => void : nsIGleanPing[K];
} };
type nsIGleanPingWithReason<T> = { type nsIGleanPingWithReason<T> = {
[K in keyof nsIGleanPing]: K extends "submit" ? (reason: T) => void : nsIGleanPing[K]; [K in keyof nsIGleanPing]: K extends 'submit' ? (reason: T) => void : nsIGleanPing[K];
} };
interface MessageListenerManagerMixin { interface MessageListenerManagerMixin {
// Overloads that define `data` arg as required, since it's ~always expected. // Overloads that define `data` arg as required, since it's ~always expected.
addMessageListener(msg: string, listener: { receiveMessage(_: ReceiveMessageArgument & { data })}); addMessageListener(msg: string, listener: { receiveMessage(_: ReceiveMessageArgument & { data }) });
removeMessageListener(msg: string, listener: { receiveMessage(_: ReceiveMessageArgument & { data })}); removeMessageListener(msg: string, listener: { receiveMessage(_: ReceiveMessageArgument & { data }) });
} }
interface MozQueryInterface { interface MozQueryInterface {
@ -52,31 +52,30 @@ interface nsISupports {
} }
interface nsIXPCComponents_Constructor { interface nsIXPCComponents_Constructor {
<const T, IIDs = nsIXPCComponents_Interfaces>(cid, id: T, init?): { <const T, IIDs = nsIXPCComponents_Interfaces>(
cid,
id: T,
init?
): {
new (...any): nsQIResult<T extends keyof IIDs ? IIDs[T] : T>; new (...any): nsQIResult<T extends keyof IIDs ? IIDs[T] : T>;
(...any): nsQIResult<T extends keyof IIDs ? IIDs[T] : T>; (...any): nsQIResult<T extends keyof IIDs ? IIDs[T] : T>;
} };
} }
interface ComponentsExceptionOptions { interface ComponentsExceptionOptions {
result?: number, result?: number;
stack?: nsIStackFrame, stack?: nsIStackFrame;
data?: object, data?: object;
} }
interface nsIException extends Exception {} interface nsIException extends Exception {}
interface nsIXPCComponents_Exception { interface nsIXPCComponents_Exception {
( (message?: string, resultOrOptions?: number | ComponentsExceptionOptions, stack?: nsIStackFrame, data?: object): nsIException;
message?: string,
resultOrOptions?: number | ComponentsExceptionOptions,
stack?: nsIStackFrame,
data?: object
): nsIException;
} }
interface nsIXPCComponents_ID { interface nsIXPCComponents_ID {
(uuid: string): nsID (uuid: string): nsID;
} }
interface nsIXPCComponents_utils_Sandbox { interface nsIXPCComponents_utils_Sandbox {
@ -87,7 +86,7 @@ interface nsXPCComponents_Classes {
[cid: string]: { [cid: string]: {
createInstance<T>(aID: T): nsQIResult<T>; createInstance<T>(aID: T): nsQIResult<T>;
getService<T>(aID?: T): unknown extends T ? nsISupports : nsQIResult<T>; getService<T>(aID?: T): unknown extends T ? nsISupports : nsQIResult<T>;
} };
} }
// Generic overloads. // Generic overloads.

View file

@ -5,15 +5,14 @@
*/ */
declare global { declare global {
// https://searchfox.org/mozilla-central/source/toolkit/components/aboutthirdparty/nsIAboutThirdParty.idl
// https://searchfox.org/mozilla-central/source/toolkit/components/aboutthirdparty/nsIAboutThirdParty.idl interface nsIInstalledApplication extends nsISupports {
interface nsIInstalledApplication extends nsISupports {
readonly name: string; readonly name: string;
readonly publisher: string; readonly publisher: string;
} }
interface nsIAboutThirdParty extends nsISupports { interface nsIAboutThirdParty extends nsISupports {
readonly ModuleType_Unknown?: 1; readonly ModuleType_Unknown?: 1;
readonly ModuleType_IME?: 2; readonly ModuleType_IME?: 2;
readonly ModuleType_ShellExtension?: 4; readonly ModuleType_ShellExtension?: 4;
@ -27,16 +26,15 @@ interface nsIAboutThirdParty extends nsISupports {
updateBlocklist(aLeafName: string, aNewBlockStatus: boolean): Promise<any>; updateBlocklist(aLeafName: string, aNewBlockStatus: boolean): Promise<any>;
collectSystemInfo(): Promise<any>; collectSystemInfo(): Promise<any>;
loadModuleForTesting(aModulePath: string): void; loadModuleForTesting(aModulePath: string): void;
} }
// https://searchfox.org/mozilla-central/source/toolkit/components/aboutwindowsmessages/nsIAboutWindowsMessages.idl // https://searchfox.org/mozilla-central/source/toolkit/components/aboutwindowsmessages/nsIAboutWindowsMessages.idl
interface nsIAboutWindowsMessages extends nsISupports { interface nsIAboutWindowsMessages extends nsISupports {
getMessages(currentWindow: mozIDOMWindowProxy, messages: OutParam<string[][]>, windowTitles: OutParam<string[]>): void; getMessages(currentWindow: mozIDOMWindowProxy, messages: OutParam<string[][]>, windowTitles: OutParam<string[]>): void;
} }
// https://searchfox.org/mozilla-central/source/toolkit/components/alerts/nsIWindowsAlertsService.idl
// https://searchfox.org/mozilla-central/source/toolkit/components/alerts/nsIWindowsAlertsService.idl
} // global } // global
declare enum nsIWindowsAlertNotification_ImagePlacement { declare enum nsIWindowsAlertNotification_ImagePlacement {
@ -46,24 +44,23 @@ declare enum nsIWindowsAlertNotification_ImagePlacement {
} }
declare global { declare global {
namespace nsIWindowsAlertNotification {
namespace nsIWindowsAlertNotification {
type ImagePlacement = nsIWindowsAlertNotification_ImagePlacement; type ImagePlacement = nsIWindowsAlertNotification_ImagePlacement;
} }
interface nsIWindowsAlertNotification extends nsIAlertNotification, Enums<typeof nsIWindowsAlertNotification_ImagePlacement> { interface nsIWindowsAlertNotification extends nsIAlertNotification, Enums<typeof nsIWindowsAlertNotification_ImagePlacement> {
imagePlacement: nsIWindowsAlertNotification.ImagePlacement; imagePlacement: nsIWindowsAlertNotification.ImagePlacement;
} }
interface nsIWindowsAlertsService extends nsIAlertsService { interface nsIWindowsAlertsService extends nsIAlertsService {
handleWindowsTag(aWindowsTag: string): Promise<any>; handleWindowsTag(aWindowsTag: string): Promise<any>;
getXmlStringForWindowsAlert(aAlert: nsIAlertNotification, aWindowsTag?: string): string; getXmlStringForWindowsAlert(aAlert: nsIAlertNotification, aWindowsTag?: string): string;
removeAllNotificationsForInstall(): void; removeAllNotificationsForInstall(): void;
} }
// https://searchfox.org/mozilla-central/source/toolkit/mozapps/defaultagent/nsIDefaultAgent.idl // https://searchfox.org/mozilla-central/source/toolkit/mozapps/defaultagent/nsIDefaultAgent.idl
interface nsIDefaultAgent extends nsISupports { interface nsIDefaultAgent extends nsISupports {
registerTask(aUniqueToken: string): void; registerTask(aUniqueToken: string): void;
updateTask(aUniqueToken: string): void; updateTask(aUniqueToken: string): void;
unregisterTask(aUniqueToken: string): void; unregisterTask(aUniqueToken: string): void;
@ -72,35 +69,41 @@ interface nsIDefaultAgent extends nsISupports {
getDefaultBrowser(): string; getDefaultBrowser(): string;
getReplacePreviousDefaultBrowser(aCurrentBrowser: string): string; getReplacePreviousDefaultBrowser(aCurrentBrowser: string): string;
getDefaultPdfHandler(): string; getDefaultPdfHandler(): string;
sendPing(aCurrentBrowser: string, aPreviousBrowser: string, aPdfHandler: string, aNotificationShown: string, aNotificationAction: string, daysSinceLastAppLaunch: u32): void; sendPing(
aCurrentBrowser: string,
aPreviousBrowser: string,
aPdfHandler: string,
aNotificationShown: string,
aNotificationAction: string,
daysSinceLastAppLaunch: u32
): void;
setDefaultBrowserUserChoice(aAumid: string, aExtraFileExtensions: string[]): void; setDefaultBrowserUserChoice(aAumid: string, aExtraFileExtensions: string[]): void;
setDefaultBrowserUserChoiceAsync(aAumid: string, aExtraFileExtensions: string[]): Promise<any>; setDefaultBrowserUserChoiceAsync(aAumid: string, aExtraFileExtensions: string[]): Promise<any>;
setDefaultExtensionHandlersUserChoice(aAumid: string, aFileExtensions: string[]): void; setDefaultExtensionHandlersUserChoice(aAumid: string, aFileExtensions: string[]): void;
agentDisabled(): boolean; agentDisabled(): boolean;
} }
// https://searchfox.org/mozilla-central/source/toolkit/mozapps/defaultagent/nsIWindowsMutex.idl // https://searchfox.org/mozilla-central/source/toolkit/mozapps/defaultagent/nsIWindowsMutex.idl
interface nsIWindowsMutex extends nsISupports { interface nsIWindowsMutex extends nsISupports {
tryLock(): void; tryLock(): void;
isLocked(): boolean; isLocked(): boolean;
unlock(): void; unlock(): void;
} }
interface nsIWindowsMutexFactory extends nsISupports { interface nsIWindowsMutexFactory extends nsISupports {
createMutex(aName: string): nsIWindowsMutex; createMutex(aName: string): nsIWindowsMutex;
} }
// https://searchfox.org/mozilla-central/source/dom/geolocation/nsIGeolocationUIUtilsWin.idl // https://searchfox.org/mozilla-central/source/dom/geolocation/nsIGeolocationUIUtilsWin.idl
interface nsIGeolocationUIUtilsWin extends nsISupports { interface nsIGeolocationUIUtilsWin extends nsISupports {
dismissPrompts(aBC: BrowsingContext): void; dismissPrompts(aBC: BrowsingContext): void;
} }
// https://searchfox.org/mozilla-central/source/netwerk/socket/nsINamedPipeService.idl // https://searchfox.org/mozilla-central/source/netwerk/socket/nsINamedPipeService.idl
// https://searchfox.org/mozilla-central/source/browser/components/shell/nsIWindowsShellService.idl
// https://searchfox.org/mozilla-central/source/browser/components/shell/nsIWindowsShellService.idl
} // global } // global
declare enum nsIWindowsShellService_LaunchOnLoginEnabledEnumerator { declare enum nsIWindowsShellService_LaunchOnLoginEnabledEnumerator {
@ -111,13 +114,23 @@ declare enum nsIWindowsShellService_LaunchOnLoginEnabledEnumerator {
} }
declare global { declare global {
namespace nsIWindowsShellService {
namespace nsIWindowsShellService {
type LaunchOnLoginEnabledEnumerator = nsIWindowsShellService_LaunchOnLoginEnabledEnumerator; type LaunchOnLoginEnabledEnumerator = nsIWindowsShellService_LaunchOnLoginEnabledEnumerator;
} }
interface nsIWindowsShellService extends nsIShellService, Enums<typeof nsIWindowsShellService_LaunchOnLoginEnabledEnumerator> { interface nsIWindowsShellService
createShortcut(aBinary: nsIFile, aArguments: string[], aDescription: string, aIconFile: nsIFile, aIconIndex: u16, aAppUserModelId: string, aShortcutFolder: string, aShortcutName: string): Promise<any>; extends nsIShellService,
Enums<typeof nsIWindowsShellService_LaunchOnLoginEnabledEnumerator> {
createShortcut(
aBinary: nsIFile,
aArguments: string[],
aDescription: string,
aIconFile: nsIFile,
aIconIndex: u16,
aAppUserModelId: string,
aShortcutFolder: string,
aShortcutName: string
): Promise<any>;
getLaunchOnLoginShortcuts(): string[]; getLaunchOnLoginShortcuts(): string[];
pinCurrentAppToStartMenuAsync(aCheckOnly: boolean): Promise<any>; pinCurrentAppToStartMenuAsync(aCheckOnly: boolean): Promise<any>;
isCurrentAppPinnedToStartMenuAsync(): Promise<any>; isCurrentAppPinnedToStartMenuAsync(): Promise<any>;
@ -139,11 +152,11 @@ interface nsIWindowsShellService extends nsIShellService, Enums<typeof nsIWindow
checkBrowserUserChoiceHashes(): boolean; checkBrowserUserChoiceHashes(): boolean;
isDefaultHandlerFor(aFileExtensionOrProtocol: string): boolean; isDefaultHandlerFor(aFileExtensionOrProtocol: string): boolean;
queryCurrentDefaultHandlerFor(aFileExtensionOrProtocol: string): string; queryCurrentDefaultHandlerFor(aFileExtensionOrProtocol: string): string;
} }
// https://searchfox.org/mozilla-central/source/toolkit/components/taskscheduler/nsIWinTaskSchedulerService.idl // https://searchfox.org/mozilla-central/source/toolkit/components/taskscheduler/nsIWinTaskSchedulerService.idl
interface nsIWinTaskSchedulerService extends nsISupports { interface nsIWinTaskSchedulerService extends nsISupports {
registerTask(aFolderName: string, aTaskName: string, aDefinitionXML: string, aUpdateExisting?: boolean): void; registerTask(aFolderName: string, aTaskName: string, aDefinitionXML: string, aUpdateExisting?: boolean): void;
validateTaskDefinition(aDefinitionXML: string): i32; validateTaskDefinition(aDefinitionXML: string): i32;
getTaskXML(aFolderName: string, aTaskName: string): string; getTaskXML(aFolderName: string, aTaskName: string): string;
@ -152,55 +165,55 @@ interface nsIWinTaskSchedulerService extends nsISupports {
getFolderTasks(aFolderName: string): string[]; getFolderTasks(aFolderName: string): string[];
createFolder(aParentFolderName: string, aSubFolderName: string): void; createFolder(aParentFolderName: string, aSubFolderName: string): void;
deleteFolder(aParentFolderName: string, aSubFolderName: string): void; deleteFolder(aParentFolderName: string, aSubFolderName: string): void;
} }
// https://searchfox.org/mozilla-central/source/widget/nsIJumpListBuilder.idl // https://searchfox.org/mozilla-central/source/widget/nsIJumpListBuilder.idl
interface nsIJumpListBuilder extends nsISupports { interface nsIJumpListBuilder extends nsISupports {
obtainAndCacheFavicon(faviconURL: nsIURI): string; obtainAndCacheFavicon(faviconURL: nsIURI): string;
obtainAndCacheFaviconAsync(faviconURL: nsIURI): Promise<any>; obtainAndCacheFaviconAsync(faviconURL: nsIURI): Promise<any>;
isAvailable(): Promise<any>; isAvailable(): Promise<any>;
checkForRemovals(): Promise<any>; checkForRemovals(): Promise<any>;
populateJumpList(aTaskDescriptions: any, aCustomTitle: string, aCustomDescriptions: any): Promise<any>; populateJumpList(aTaskDescriptions: any, aCustomTitle: string, aCustomDescriptions: any): Promise<any>;
clearJumpList(): Promise<any>; clearJumpList(): Promise<any>;
} }
// https://searchfox.org/mozilla-central/source/widget/nsIPrintSettingsWin.idl // https://searchfox.org/mozilla-central/source/widget/nsIPrintSettingsWin.idl
// https://searchfox.org/mozilla-central/source/widget/nsITaskbarOverlayIconController.idl // https://searchfox.org/mozilla-central/source/widget/nsITaskbarOverlayIconController.idl
interface nsITaskbarOverlayIconController extends nsISupports { interface nsITaskbarOverlayIconController extends nsISupports {
setOverlayIcon(statusIcon: imgIContainer, statusDescription: string, paintContext?: nsISVGPaintContext): void; setOverlayIcon(statusIcon: imgIContainer, statusDescription: string, paintContext?: nsISVGPaintContext): void;
} }
// https://searchfox.org/mozilla-central/source/widget/nsITaskbarPreview.idl // https://searchfox.org/mozilla-central/source/widget/nsITaskbarPreview.idl
interface nsITaskbarPreview extends nsISupports { interface nsITaskbarPreview extends nsISupports {
controller: nsITaskbarPreviewController; controller: nsITaskbarPreviewController;
tooltip: string; tooltip: string;
visible: boolean; visible: boolean;
active: boolean; active: boolean;
invalidate(): void; invalidate(): void;
} }
// https://searchfox.org/mozilla-central/source/widget/nsITaskbarPreviewButton.idl // https://searchfox.org/mozilla-central/source/widget/nsITaskbarPreviewButton.idl
interface nsITaskbarPreviewButton extends nsISupports { interface nsITaskbarPreviewButton extends nsISupports {
tooltip: string; tooltip: string;
dismissOnClick: boolean; dismissOnClick: boolean;
hasBorder: boolean; hasBorder: boolean;
disabled: boolean; disabled: boolean;
image: imgIContainer; image: imgIContainer;
visible: boolean; visible: boolean;
} }
// https://searchfox.org/mozilla-central/source/widget/nsITaskbarPreviewController.idl // https://searchfox.org/mozilla-central/source/widget/nsITaskbarPreviewController.idl
type nsITaskbarPreviewCallback = Callable<{ type nsITaskbarPreviewCallback = Callable<{
done(aCanvas: nsISupports, aDrawBorder: boolean): void; done(aCanvas: nsISupports, aDrawBorder: boolean): void;
}> }>;
interface nsITaskbarPreviewController extends nsISupports { interface nsITaskbarPreviewController extends nsISupports {
readonly width: u32; readonly width: u32;
readonly height: u32; readonly height: u32;
readonly thumbnailAspectRatio: float; readonly thumbnailAspectRatio: float;
@ -209,11 +222,11 @@ interface nsITaskbarPreviewController extends nsISupports {
onClose(): void; onClose(): void;
onActivate(): boolean; onActivate(): boolean;
onClick(button: nsITaskbarPreviewButton): void; onClick(button: nsITaskbarPreviewButton): void;
} }
// https://searchfox.org/mozilla-central/source/widget/nsITaskbarProgress.idl // https://searchfox.org/mozilla-central/source/widget/nsITaskbarProgress.idl
interface nsITaskbarProgress extends nsISupports { interface nsITaskbarProgress extends nsISupports {
readonly STATE_NO_PROGRESS?: 0; readonly STATE_NO_PROGRESS?: 0;
readonly STATE_INDETERMINATE?: 1; readonly STATE_INDETERMINATE?: 1;
readonly STATE_NORMAL?: 2; readonly STATE_NORMAL?: 2;
@ -221,28 +234,28 @@ interface nsITaskbarProgress extends nsISupports {
readonly STATE_PAUSED?: 4; readonly STATE_PAUSED?: 4;
setProgressState(state: nsTaskbarProgressState, currentValue?: u64, maxValue?: u64): void; setProgressState(state: nsTaskbarProgressState, currentValue?: u64, maxValue?: u64): void;
} }
// https://searchfox.org/mozilla-central/source/widget/nsITaskbarTabPreview.idl // https://searchfox.org/mozilla-central/source/widget/nsITaskbarTabPreview.idl
interface nsITaskbarTabPreview extends nsITaskbarPreview { interface nsITaskbarTabPreview extends nsITaskbarPreview {
title: string; title: string;
icon: imgIContainer; icon: imgIContainer;
move(aNext: nsITaskbarTabPreview): void; move(aNext: nsITaskbarTabPreview): void;
} }
// https://searchfox.org/mozilla-central/source/widget/nsITaskbarWindowPreview.idl // https://searchfox.org/mozilla-central/source/widget/nsITaskbarWindowPreview.idl
interface nsITaskbarWindowPreview extends nsITaskbarPreview { interface nsITaskbarWindowPreview extends nsITaskbarPreview {
readonly NUM_TOOLBAR_BUTTONS?: 7; readonly NUM_TOOLBAR_BUTTONS?: 7;
getButton(index: u32): nsITaskbarPreviewButton; getButton(index: u32): nsITaskbarPreviewButton;
enableCustomDrawing: boolean; enableCustomDrawing: boolean;
} }
// https://searchfox.org/mozilla-central/source/widget/nsIWinTaskbar.idl // https://searchfox.org/mozilla-central/source/widget/nsIWinTaskbar.idl
interface nsIWinTaskbar extends nsISupports { interface nsIWinTaskbar extends nsISupports {
readonly available: boolean; readonly available: boolean;
readonly defaultGroupId: string; readonly defaultGroupId: string;
readonly defaultPrivateGroupId: string; readonly defaultPrivateGroupId: string;
@ -253,11 +266,11 @@ interface nsIWinTaskbar extends nsISupports {
createJumpListBuilder(aPrivateBrowsing: boolean): nsIJumpListBuilder; createJumpListBuilder(aPrivateBrowsing: boolean): nsIJumpListBuilder;
getGroupIdForWindow(aParent: mozIDOMWindow): string; getGroupIdForWindow(aParent: mozIDOMWindow): string;
setGroupIdForWindow(aParent: mozIDOMWindow, aIdentifier: string): void; setGroupIdForWindow(aParent: mozIDOMWindow, aIdentifier: string): void;
} }
// https://searchfox.org/mozilla-central/source/widget/nsIWindowsUIUtils.idl // https://searchfox.org/mozilla-central/source/widget/nsIWindowsUIUtils.idl
interface nsIWindowsUIUtils extends nsISupports { interface nsIWindowsUIUtils extends nsISupports {
readonly systemSmallIconSize: i32; readonly systemSmallIconSize: i32;
readonly systemLargeIconSize: i32; readonly systemLargeIconSize: i32;
setWindowIcon(aWindow: mozIDOMWindowProxy, aSmallIcon: imgIContainer, aLargeIcon: imgIContainer): void; setWindowIcon(aWindow: mozIDOMWindowProxy, aSmallIcon: imgIContainer, aLargeIcon: imgIContainer): void;
@ -266,19 +279,19 @@ interface nsIWindowsUIUtils extends nsISupports {
readonly inWin10TabletMode: boolean; readonly inWin10TabletMode: boolean;
readonly inWin11TabletMode: boolean; readonly inWin11TabletMode: boolean;
shareUrl(shareTitle: string, urlToShare: string): void; shareUrl(shareTitle: string, urlToShare: string): void;
} }
// https://searchfox.org/mozilla-central/source/toolkit/system/windowsPackageManager/nsIWindowsPackageManager.idl // https://searchfox.org/mozilla-central/source/toolkit/system/windowsPackageManager/nsIWindowsPackageManager.idl
interface nsIWindowsPackageManager extends nsISupports { interface nsIWindowsPackageManager extends nsISupports {
findUserInstalledPackages(prefix: string[]): string[]; findUserInstalledPackages(prefix: string[]): string[];
getInstalledDate(): u64; getInstalledDate(): u64;
campaignId(): Promise<any>; campaignId(): Promise<any>;
} }
// https://searchfox.org/mozilla-central/source/xpcom/ds/nsIWindowsRegKey.idl // https://searchfox.org/mozilla-central/source/xpcom/ds/nsIWindowsRegKey.idl
interface nsIWindowsRegKey extends nsISupports { interface nsIWindowsRegKey extends nsISupports {
readonly ROOT_KEY_CLASSES_ROOT?: 2147483648; readonly ROOT_KEY_CLASSES_ROOT?: 2147483648;
readonly ROOT_KEY_CURRENT_USER?: 2147483649; readonly ROOT_KEY_CURRENT_USER?: 2147483649;
readonly ROOT_KEY_LOCAL_MACHINE?: 2147483650; readonly ROOT_KEY_LOCAL_MACHINE?: 2147483650;
@ -321,15 +334,15 @@ interface nsIWindowsRegKey extends nsISupports {
writeIntValue(name: string, data: u32): void; writeIntValue(name: string, data: u32): void;
writeInt64Value(name: string, data: u64): void; writeInt64Value(name: string, data: u64): void;
writeBinaryValue(name: string, data: string): void; writeBinaryValue(name: string, data: string): void;
} }
// https://searchfox.org/mozilla-central/source/toolkit/xre/nsIWinAppHelper.idl // https://searchfox.org/mozilla-central/source/toolkit/xre/nsIWinAppHelper.idl
interface nsIWinAppHelper extends nsISupports { interface nsIWinAppHelper extends nsISupports {
readonly userCanElevate: boolean; readonly userCanElevate: boolean;
} }
interface nsIXPCComponents_Interfaces { interface nsIXPCComponents_Interfaces {
nsIInstalledApplication: nsJSIID<nsIInstalledApplication>; nsIInstalledApplication: nsJSIID<nsIInstalledApplication>;
nsIAboutThirdParty: nsJSIID<nsIAboutThirdParty>; nsIAboutThirdParty: nsJSIID<nsIAboutThirdParty>;
nsIAboutWindowsMessages: nsJSIID<nsIAboutWindowsMessages>; nsIAboutWindowsMessages: nsJSIID<nsIAboutWindowsMessages>;
@ -355,8 +368,7 @@ interface nsIXPCComponents_Interfaces {
nsIWindowsPackageManager: nsJSIID<nsIWindowsPackageManager>; nsIWindowsPackageManager: nsJSIID<nsIWindowsPackageManager>;
nsIWindowsRegKey: nsJSIID<nsIWindowsRegKey>; nsIWindowsRegKey: nsJSIID<nsIWindowsRegKey>;
nsIWinAppHelper: nsJSIID<nsIWinAppHelper>; nsIWinAppHelper: nsJSIID<nsIWinAppHelper>;
} }
} // global } // global
// Typedefs from xpidl. // Typedefs from xpidl.
@ -375,6 +387,6 @@ type OutParam<T> = { value?: T };
type Enums<enums> = Partial<Pick<enums, keyof enums>>; type Enums<enums> = Partial<Pick<enums, keyof enums>>;
/** Callable accepts either form of a [function] interface. */ /** Callable accepts either form of a [function] interface. */
type Callable<iface> = iface | Extract<iface[keyof iface], Function> type Callable<iface> = iface | Extract<iface[keyof iface], Function>;
export {}; export {};

File diff suppressed because it is too large Load diff

View file

@ -15,10 +15,12 @@ interface nsID<uuid = string> {
* and expose constants defined on the class, including variants from enums. * and expose constants defined on the class, including variants from enums.
* https://searchfox.org/mozilla-central/source/js/xpconnect/src/XPCJSID.cpp#45 * https://searchfox.org/mozilla-central/source/js/xpconnect/src/XPCJSID.cpp#45
*/ */
type nsJSIID<iface, enums = {}> = nsID & Constants<iface> & enums & { type nsJSIID<iface, enums = {}> = nsID &
Constants<iface> &
enums & {
new (_: never): void; new (_: never): void;
prototype: iface; prototype: iface;
} };
/** A union type of all known interface IIDs. */ /** A union type of all known interface IIDs. */
type nsIID = nsIXPCComponents_Interfaces[keyof nsIXPCComponents_Interfaces]; type nsIID = nsIXPCComponents_Interfaces[keyof nsIXPCComponents_Interfaces];