Skip to content

Commit

Permalink
Bug 1950401 - Mark constants (and enum variants) in xpcom interfaces …
Browse files Browse the repository at this point in the history
…as optional r=Standard8

Differential Revision: https://phabricator.services.mozilla.com/D239809
  • Loading branch information
zombie committed Feb 28, 2025
1 parent c3afbff commit 9364550
Show file tree
Hide file tree
Showing 8 changed files with 2,250 additions and 2,253 deletions.
10 changes: 5 additions & 5 deletions tools/@types/lib.gecko.darwin.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,11 @@ interface nsIStandaloneNativeMenu extends nsISupports {
// https://searchfox.org/mozilla-central/source/widget/nsITaskbarProgress.idl

interface nsITaskbarProgress extends nsISupports {
readonly STATE_NO_PROGRESS: 0;
readonly STATE_INDETERMINATE: 1;
readonly STATE_NORMAL: 2;
readonly STATE_ERROR: 3;
readonly STATE_PAUSED: 4;
readonly STATE_NO_PROGRESS?: 0;
readonly STATE_INDETERMINATE?: 1;
readonly STATE_NORMAL?: 2;
readonly STATE_ERROR?: 3;
readonly STATE_PAUSED?: 4;

setProgressState(state: nsTaskbarProgressState, currentValue?: u64, maxValue?: u64): void;
}
Expand Down
1 change: 1 addition & 0 deletions tools/@types/lib.gecko.dom.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18406,6 +18406,7 @@ declare var Sanitizer: {

interface Scheduler {
postTask(callback: SchedulerPostTaskCallback, options?: SchedulerPostTaskOptions): Promise<any>;
yield(): Promise<void>;
}

declare var Scheduler: {
Expand Down
10 changes: 5 additions & 5 deletions tools/@types/lib.gecko.linux.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ interface nsIGtkTaskbarProgress extends nsITaskbarProgress {
// https://searchfox.org/mozilla-central/source/widget/nsITaskbarProgress.idl

interface nsITaskbarProgress extends nsISupports {
readonly STATE_NO_PROGRESS: 0;
readonly STATE_INDETERMINATE: 1;
readonly STATE_NORMAL: 2;
readonly STATE_ERROR: 3;
readonly STATE_PAUSED: 4;
readonly STATE_NO_PROGRESS?: 0;
readonly STATE_INDETERMINATE?: 1;
readonly STATE_NORMAL?: 2;
readonly STATE_ERROR?: 3;
readonly STATE_PAUSED?: 4;

setProgressState(state: nsTaskbarProgressState, currentValue?: u64, maxValue?: u64): void;
}
Expand Down
65 changes: 32 additions & 33 deletions tools/@types/lib.gecko.win32.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ interface nsIInstalledApplication extends nsISupports {
}

interface nsIAboutThirdParty extends nsISupports {
readonly ModuleType_Unknown: 1;
readonly ModuleType_IME: 2;
readonly ModuleType_ShellExtension: 4;
readonly ModuleType_BlockedByUser: 8;
readonly ModuleType_BlockedByUserAtLaunch: 16;
readonly ModuleType_Unknown?: 1;
readonly ModuleType_IME?: 2;
readonly ModuleType_ShellExtension?: 4;
readonly ModuleType_BlockedByUser?: 8;
readonly ModuleType_BlockedByUserAtLaunch?: 16;

lookupModuleType(aLeafName: string): u32;
lookupApplication(aModulePath: string): nsIInstalledApplication;
Expand Down Expand Up @@ -52,7 +52,6 @@ enum ImagePlacement {
declare global {

interface nsIWindowsAlertNotification extends nsIAlertNotification, Enums<typeof nsIWindowsAlertNotification.ImagePlacement> {
handleActions: boolean;
imagePlacement: nsIWindowsAlertNotification.ImagePlacement;
}

Expand Down Expand Up @@ -215,11 +214,11 @@ interface nsITaskbarPreviewController extends nsISupports {
// https://searchfox.org/mozilla-central/source/widget/nsITaskbarProgress.idl

interface nsITaskbarProgress extends nsISupports {
readonly STATE_NO_PROGRESS: 0;
readonly STATE_INDETERMINATE: 1;
readonly STATE_NORMAL: 2;
readonly STATE_ERROR: 3;
readonly STATE_PAUSED: 4;
readonly STATE_NO_PROGRESS?: 0;
readonly STATE_INDETERMINATE?: 1;
readonly STATE_NORMAL?: 2;
readonly STATE_ERROR?: 3;
readonly STATE_PAUSED?: 4;

setProgressState(state: nsTaskbarProgressState, currentValue?: u64, maxValue?: u64): void;
}
Expand All @@ -235,7 +234,7 @@ interface nsITaskbarTabPreview extends nsITaskbarPreview {
// https://searchfox.org/mozilla-central/source/widget/nsITaskbarWindowPreview.idl

interface nsITaskbarWindowPreview extends nsITaskbarPreview {
readonly NUM_TOOLBAR_BUTTONS: 7;
readonly NUM_TOOLBAR_BUTTONS?: 7;

getButton(index: u32): nsITaskbarPreviewButton;
enableCustomDrawing: boolean;
Expand Down Expand Up @@ -280,25 +279,25 @@ interface nsIWindowsPackageManager extends nsISupports {
// https://searchfox.org/mozilla-central/source/xpcom/ds/nsIWindowsRegKey.idl

interface nsIWindowsRegKey extends nsISupports {
readonly ROOT_KEY_CLASSES_ROOT: 2147483648;
readonly ROOT_KEY_CURRENT_USER: 2147483649;
readonly ROOT_KEY_LOCAL_MACHINE: 2147483650;
readonly ACCESS_BASIC: 131072;
readonly ACCESS_QUERY_VALUE: 1;
readonly ACCESS_SET_VALUE: 2;
readonly ACCESS_CREATE_SUB_KEY: 4;
readonly ACCESS_ENUMERATE_SUB_KEYS: 8;
readonly ACCESS_NOTIFY: 16;
readonly ACCESS_READ: 131097;
readonly ACCESS_WRITE: 131078;
readonly ACCESS_ALL: 131103;
readonly WOW64_32: 512;
readonly WOW64_64: 256;
readonly TYPE_NONE: 0;
readonly TYPE_STRING: 1;
readonly TYPE_BINARY: 3;
readonly TYPE_INT: 4;
readonly TYPE_INT64: 11;
readonly ROOT_KEY_CLASSES_ROOT?: 2147483648;
readonly ROOT_KEY_CURRENT_USER?: 2147483649;
readonly ROOT_KEY_LOCAL_MACHINE?: 2147483650;
readonly ACCESS_BASIC?: 131072;
readonly ACCESS_QUERY_VALUE?: 1;
readonly ACCESS_SET_VALUE?: 2;
readonly ACCESS_CREATE_SUB_KEY?: 4;
readonly ACCESS_ENUMERATE_SUB_KEYS?: 8;
readonly ACCESS_NOTIFY?: 16;
readonly ACCESS_READ?: 131097;
readonly ACCESS_WRITE?: 131078;
readonly ACCESS_ALL?: 131103;
readonly WOW64_32?: 512;
readonly WOW64_64?: 256;
readonly TYPE_NONE?: 0;
readonly TYPE_STRING?: 1;
readonly TYPE_BINARY?: 3;
readonly TYPE_INT?: 4;
readonly TYPE_INT64?: 11;

close(): void;
open(rootKey: u32, relPath: string, mode: u32): void;
Expand Down Expand Up @@ -372,8 +371,8 @@ type InOutParam<T> = { value: T };
/** XPCOM out param is written to the passed in object's value property. */
type OutParam<T> = { value?: T };

/** A named type to enable interfaces to inherit from enums. */
type Enums<enums> = enums;
/** Enable interfaces to inherit from enums: pick variants as optional. */
type Enums<enums> = Partial<Pick<enums, keyof enums>>;

/** Callable accepts either form of a [function] interface. */
type Callable<iface> = iface | Extract<iface[keyof iface], Function>
Expand Down
Loading

0 comments on commit 9364550

Please sign in to comment.