diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:35:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:35:29 +0000 |
commit | 59203c63bb777a3bacec32fb8830fba33540e809 (patch) | |
tree | 58298e711c0ff0575818c30485b44a2f21bf28a0 /tools/ts | |
parent | Adding upstream version 126.0.1. (diff) | |
download | firefox-59203c63bb777a3bacec32fb8830fba33540e809.tar.xz firefox-59203c63bb777a3bacec32fb8830fba33540e809.zip |
Adding upstream version 127.0.upstream/127.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tools/ts')
-rw-r--r-- | tools/ts/fixtures/intrinsics.d.ts | 101 | ||||
-rw-r--r-- | tools/ts/fixtures/xpctest.d.ts | 109 |
2 files changed, 85 insertions, 125 deletions
diff --git a/tools/ts/fixtures/intrinsics.d.ts b/tools/ts/fixtures/intrinsics.d.ts index 7a0b45ee52..125e401eae 100644 --- a/tools/ts/fixtures/intrinsics.d.ts +++ b/tools/ts/fixtures/intrinsics.d.ts @@ -1,30 +1,49 @@ /** - * Gecko XPCOM builtins and utility types. + * Gecko XPCOM builtins. */ +declare global { + /** + * Generic IDs are created by most code which passes a nsID to js. + * https://searchfox.org/mozilla-central/source/js/xpconnect/src/XPCJSID.cpp#24 + */ + interface nsID<uuid = string> { + readonly number: uuid; + } -/** - * Generic IDs are created by most code which passes a nsID to js. - * https://searchfox.org/mozilla-central/source/js/xpconnect/src/XPCJSID.cpp#24 - */ -interface nsID<uuid = string> { - readonly number: uuid; + /** + * In addition to nsID, interface IIDs support instanceof type guards, + * and expose constants defined on the class, including variants from enums. + * https://searchfox.org/mozilla-central/source/js/xpconnect/src/XPCJSID.cpp#45 + */ + type nsJSIID<iface, enums = {}> = nsID & Constants<iface> & enums & { + new (_: never): void; + prototype: iface; + } + + /** A union type of all known interface IIDs. */ + type nsIID = nsIXPCComponents_Interfaces[keyof nsIXPCComponents_Interfaces]; + + /** A generic to resolve QueryInterface return type from a nsIID. */ + export type nsQIResult<iid> = iid extends { prototype: infer U } ? U : never; + + /** u32 */ + type nsresult = u32; + + // Numeric typedefs, useful as a quick reference in method signatures. + type double = number; + type float = number; + type i16 = number; + type i32 = number; + type i64 = number; + type u16 = number; + type u32 = number; + type u64 = number; + type u8 = number; } /** - * In addition to nsID, interface IIDs support instanceof type guards, - * and expose constants defined on the class, including variants from enums. - * https://searchfox.org/mozilla-central/source/js/xpconnect/src/XPCJSID.cpp#44 + * XPCOM utility types. */ -type nsJSIID<iface, enums = {}> = nsID & Constants<iface> & enums & { - new (_: never): void; - prototype: iface; -} - -/** A union of all known IIDs. */ -type nsIID = nsIXPCComponents_Interfaces[keyof nsIXPCComponents_Interfaces]; - -/** A generic to resolve QueryInterface return type from a nsID (or nsIID). */ -export type nsQIResult<iid> = iid extends { prototype: infer U } ? U : never; /** XPCOM inout param is passed in as a js object with a value property. */ type InOutParam<T> = { value: T }; @@ -32,7 +51,7 @@ 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 for interfaces to inherit from enums. */ +/** A named type to enable interfaces to inherit from enums. */ type Enums<enums> = enums; /** Callable accepts either form of a [function] interface. */ @@ -44,42 +63,4 @@ type Constants<T> = { [K in keyof T as IfConst<K, T[K]>]: T[K] }; /** Resolves only for keys K whose corresponding type T is a narrow number. */ type IfConst<K, T> = T extends number ? (number extends T ? never : K) : never; -declare global { - // Until we have [ChromeOnly] webidl. - interface BrowsingContext {} - interface ContentFrameMessageManager {} - interface DOMRequest {} - interface FrameLoader {} - interface JSProcessActorChild {} - interface JSProcessActorParent {} - interface TreeColumn {} - interface WebExtensionContentScript {} - interface WebExtensionPolicy {} - interface WindowGlobalParent {} - interface WindowContext {} - interface XULTreeElement {} -} - -// Non-scriptable interfaces referenced from scriptable ones. -interface nsIAsyncVerifyRedirectReadyCallback {} -interface nsICRLiteTimestamp {} -interface nsIInputAvailableCallback {} -interface nsIScriptElement {} -interface nsIThreadObserver {} -interface nsIUDPSocketSyncListener {} -interface nsIWebAuthnRegisterArgs {} -interface nsIWebAuthnRegisterPromise {} -interface nsIWebAuthnSignArgs {} -interface nsIWebAuthnSignPromise {} -interface nsIXPCScriptable {} - -// Typedefs useful as a quick reference in method signatures. -type double = number; -type float = number; -type i16 = number; -type i32 = number; -type i64 = number; -type u16 = number; -type u32 = number; -type u64 = number; -type u8 = number; +export {}; diff --git a/tools/ts/fixtures/xpctest.d.ts b/tools/ts/fixtures/xpctest.d.ts index 6b2863a656..cf705832b6 100644 --- a/tools/ts/fixtures/xpctest.d.ts +++ b/tools/ts/fixtures/xpctest.d.ts @@ -160,7 +160,7 @@ interface nsIXPCTestUtils extends nsISupports { doubleWrapFunction(f: nsIXPCTestFunctionInterface): nsIXPCTestFunctionInterface; } -interface nsIXPCTestNoScriptMembers extends nsISupports { +interface nsIXPCTestTypeScript extends nsISupports { exposedProp: i32; exposedMethod(arg: i32): void; } @@ -178,43 +178,60 @@ interface nsIXPCComponents_Interfaces { nsIXPCTestReturnCodeChild: nsJSIID<nsIXPCTestReturnCodeChild>; nsIXPCTestFunctionInterface: nsJSIID<nsIXPCTestFunctionInterface>; nsIXPCTestUtils: nsJSIID<nsIXPCTestUtils>; - nsIXPCTestNoScriptMembers: nsJSIID<nsIXPCTestNoScriptMembers>; + nsIXPCTestTypeScript: nsJSIID<nsIXPCTestTypeScript>; } } // global // Typedefs from xpidl. type PRTime = i64; -type char16_t = u16; -type nsresult = u32; /** - * Gecko XPCOM builtins and utility types. + * Gecko XPCOM builtins. */ - -/** - * Generic IDs are created by most code which passes a nsID to js. - * https://searchfox.org/mozilla-central/source/js/xpconnect/src/XPCJSID.cpp#24 - */ -interface nsID<uuid = string> { - readonly number: uuid; +declare global { + /** + * Generic IDs are created by most code which passes a nsID to js. + * https://searchfox.org/mozilla-central/source/js/xpconnect/src/XPCJSID.cpp#24 + */ + interface nsID<uuid = string> { + readonly number: uuid; + } + + /** + * In addition to nsID, interface IIDs support instanceof type guards, + * and expose constants defined on the class, including variants from enums. + * https://searchfox.org/mozilla-central/source/js/xpconnect/src/XPCJSID.cpp#45 + */ + type nsJSIID<iface, enums = {}> = nsID & Constants<iface> & enums & { + new (_: never): void; + prototype: iface; + } + + /** A union type of all known interface IIDs. */ + type nsIID = nsIXPCComponents_Interfaces[keyof nsIXPCComponents_Interfaces]; + + /** A generic to resolve QueryInterface return type from a nsIID. */ + export type nsQIResult<iid> = iid extends { prototype: infer U } ? U : never; + + /** u32 */ + type nsresult = u32; + + // Numeric typedefs, useful as a quick reference in method signatures. + type double = number; + type float = number; + type i16 = number; + type i32 = number; + type i64 = number; + type u16 = number; + type u32 = number; + type u64 = number; + type u8 = number; } /** - * In addition to nsID, interface IIDs support instanceof type guards, - * and expose constants defined on the class, including variants from enums. - * https://searchfox.org/mozilla-central/source/js/xpconnect/src/XPCJSID.cpp#44 + * XPCOM utility types. */ -type nsJSIID<iface, enums = {}> = nsID & Constants<iface> & enums & { - new (_: never): void; - prototype: iface; -} - -/** A union of all known IIDs. */ -type nsIID = nsIXPCComponents_Interfaces[keyof nsIXPCComponents_Interfaces]; - -/** A generic to resolve QueryInterface return type from a nsID (or nsIID). */ -export type nsQIResult<iid> = iid extends { prototype: infer U } ? U : never; /** XPCOM inout param is passed in as a js object with a value property. */ type InOutParam<T> = { value: T }; @@ -222,7 +239,7 @@ 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 for interfaces to inherit from enums. */ +/** A named type to enable interfaces to inherit from enums. */ type Enums<enums> = enums; /** Callable accepts either form of a [function] interface. */ @@ -234,42 +251,4 @@ type Constants<T> = { [K in keyof T as IfConst<K, T[K]>]: T[K] }; /** Resolves only for keys K whose corresponding type T is a narrow number. */ type IfConst<K, T> = T extends number ? (number extends T ? never : K) : never; -declare global { - // Until we have [ChromeOnly] webidl. - interface BrowsingContext {} - interface ContentFrameMessageManager {} - interface DOMRequest {} - interface FrameLoader {} - interface JSProcessActorChild {} - interface JSProcessActorParent {} - interface TreeColumn {} - interface WebExtensionContentScript {} - interface WebExtensionPolicy {} - interface WindowGlobalParent {} - interface WindowContext {} - interface XULTreeElement {} -} - -// Non-scriptable interfaces referenced from scriptable ones. -interface nsIAsyncVerifyRedirectReadyCallback {} -interface nsICRLiteTimestamp {} -interface nsIInputAvailableCallback {} -interface nsIScriptElement {} -interface nsIThreadObserver {} -interface nsIUDPSocketSyncListener {} -interface nsIWebAuthnRegisterArgs {} -interface nsIWebAuthnRegisterPromise {} -interface nsIWebAuthnSignArgs {} -interface nsIWebAuthnSignPromise {} -interface nsIXPCScriptable {} - -// Typedefs useful as a quick reference in method signatures. -type double = number; -type float = number; -type i16 = number; -type i32 = number; -type i64 = number; -type u16 = number; -type u32 = number; -type u64 = number; -type u8 = number; +export {}; |