Bug 1880764 - Initial TypeScript tooling r=mossop,Standard8

* Initial tools/ts setup.
* Mach commands for buidling xpcom related typelibs.
* Mach command for updating the typelib references.
* Mach command for type-checking js projects.

Also included the dom typelib for reference.

Differential Revision: https://phabricator.services.mozilla.com/D197620
This commit is contained in:
Tomislav Jovanovic 2024-03-15 19:20:45 +00:00
Родитель d73bbca658
Коммит c346a789f6
24 изменённых файлов: 61377 добавлений и 0 удалений

4
.gitignore поставляемый
Просмотреть файл

@ -83,6 +83,7 @@ browser/components/asrouter/node_modules/
browser/components/newtab/node_modules/
browser/components/aboutwelcome/node_modules/
tools/esmify/node_modules/
tools/ts/node_modules/
# Ignore newtab component build assets
browser/components/newtab/logs/
@ -333,6 +334,9 @@ tools/esmify/jscodeshift.cmd
tools/esmify/jscodeshift.ps1
tools/esmify/package-lock.json
# Ignore TypeScript declarations reference file updated by tooling.
tools/@types/index.d.ts
# Ignore support files for en-US dictionary updates
extensions/spellcheck/locales/en-US/hunspell/dictionary-sources/scowl
extensions/spellcheck/locales/en-US/hunspell/dictionary-sources/support_files/

Просмотреть файл

@ -75,6 +75,7 @@
^browser/components/newtab/node_modules/
^browser/components/aboutwelcome/node_modules/
^tools/esmify/node_modules/
^tools/ts/node_modules/
# Ignore newtab component build assets
^browser/components/newtab/logs/
@ -325,6 +326,9 @@ tps_result\.json$
^tools/esmify/jscodeshift\.ps1
^tools/esmify/package-lock\.json
# Ignore TypeScript declarations reference file updated by tooling.
^tools/@types/index.d.ts
# Ignore support files for en-US dictionary updates
^extensions/spellcheck/locales/en-US/hunspell/dictionary-sources/scowl
^extensions/spellcheck/locales/en-US/hunspell/dictionary-sources/support_files/

Просмотреть файл

@ -1488,5 +1488,6 @@ toolkit/components/uniffi-js/UniFFIFixtureScaffolding.cpp
toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated
tools/browsertime/package.json
tools/browsertime/package-lock.json
tools/ts/error_list.json
try_task_config.json
xpcom/idl-parser/xpidl/fixtures/xpctest.d.json

10
package-lock.json сгенерированный
Просмотреть файл

@ -8,6 +8,7 @@
"license": "MPL-2.0",
"devDependencies": {
"@microsoft/eslint-plugin-sdl": "0.2.2",
"@types/gecko": "file:tools/@types",
"eslint": "8.57.0",
"eslint-config-prettier": "8.8.0",
"eslint-plugin-eslint-plugin": "5.4.0",
@ -554,6 +555,10 @@
"node": ">= 8"
}
},
"node_modules/@types/gecko": {
"resolved": "tools/@types",
"link": true
},
"node_modules/@types/json-schema": {
"version": "7.0.15",
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz",
@ -5968,6 +5973,11 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
"tools/@types": {
"version": "1.0.0",
"dev": true,
"license": "MPL-2.0"
},
"tools/lint/eslint/eslint-plugin-mozilla": {
"version": "3.7.1",
"dev": true,

Просмотреть файл

@ -5,6 +5,7 @@
"license": "MPL-2.0",
"devDependencies": {
"@microsoft/eslint-plugin-sdl": "0.2.2",
"@types/gecko": "file:tools/@types",
"eslint": "8.57.0",
"eslint-config-prettier": "8.8.0",
"eslint-plugin-eslint-plugin": "5.4.0",

Просмотреть файл

@ -204,6 +204,7 @@ MACH_COMMANDS = {
),
"tps-build": MachCommandReference("testing/tps/mach_commands.py"),
"try": MachCommandReference("tools/tryselect/mach_commands.py"),
"ts": MachCommandReference("tools/ts/mach_commands.py"),
"uniffi": MachCommandReference(
"toolkit/components/uniffi-bindgen-gecko-js/mach_commands.py"
),

36605
tools/@types/lib.gecko.dom.d.ts поставляемый Normal file

Разница между файлами не показана из-за своего большого размера Загрузить разницу

666
tools/@types/lib.gecko.nsresult.d.ts поставляемый Normal file
Просмотреть файл

@ -0,0 +1,666 @@
/**
* NOTE: Do not modify this file by hand.
* Content was generated from xpc.msg and error_list.json.
*/
interface nsIXPCComponents_Results {
// Error Message definitions.
// xpconnect specific codes (from nsIXPConnect.h)
/** Not enough arguments */
NS_ERROR_XPC_NOT_ENOUGH_ARGS: 0x80570001;
/** 'Out' argument must be an object */
NS_ERROR_XPC_NEED_OUT_OBJECT: 0x80570002;
/** Cannot set 'value' property of 'out' argument */
NS_ERROR_XPC_CANT_SET_OUT_VAL: 0x80570003;
/** Component returned failure code: */
NS_ERROR_XPC_NATIVE_RETURNED_FAILURE: 0x80570004;
/** Cannot find interface information */
NS_ERROR_XPC_CANT_GET_INTERFACE_INFO: 0x80570005;
/** Cannot find interface information for parameter */
NS_ERROR_XPC_CANT_GET_PARAM_IFACE_INFO: 0x80570006;
/** Cannot find method information */
NS_ERROR_XPC_CANT_GET_METHOD_INFO: 0x80570007;
/** Unexpected error in XPConnect */
NS_ERROR_XPC_UNEXPECTED: 0x80570008;
/** Could not convert JavaScript argument */
NS_ERROR_XPC_BAD_CONVERT_JS: 0x80570009;
/** Could not convert Native argument */
NS_ERROR_XPC_BAD_CONVERT_NATIVE: 0x8057000a;
/** Could not convert JavaScript argument (NULL value cannot be used for a C++ reference type) */
NS_ERROR_XPC_BAD_CONVERT_JS_NULL_REF: 0x8057000b;
/** Illegal operation on WrappedNative prototype object */
NS_ERROR_XPC_BAD_OP_ON_WN_PROTO: 0x8057000c;
/** Cannot convert WrappedNative to function */
NS_ERROR_XPC_CANT_CONVERT_WN_TO_FUN: 0x8057000d;
/** Cannot define new property in a WrappedNative */
NS_ERROR_XPC_CANT_DEFINE_PROP_ON_WN: 0x8057000e;
/** Cannot place watchpoints on WrappedNative object static properties */
NS_ERROR_XPC_CANT_WATCH_WN_STATIC: 0x8057000f;
/** Cannot export a WrappedNative object's static properties */
NS_ERROR_XPC_CANT_EXPORT_WN_STATIC: 0x80570010;
/** nsIXPCScriptable::Call failed */
NS_ERROR_XPC_SCRIPTABLE_CALL_FAILED: 0x80570011;
/** nsIXPCScriptable::Construct failed */
NS_ERROR_XPC_SCRIPTABLE_CTOR_FAILED: 0x80570012;
/** Cannot use wrapper as function unless it implements nsIXPCScriptable */
NS_ERROR_XPC_CANT_CALL_WO_SCRIPTABLE: 0x80570013;
/** Cannot use wrapper as constructor unless it implements nsIXPCScriptable */
NS_ERROR_XPC_CANT_CTOR_WO_SCRIPTABLE: 0x80570014;
/** ComponentManager::CreateInstance returned failure code: */
NS_ERROR_XPC_CI_RETURNED_FAILURE: 0x80570015;
/** ServiceManager::GetService returned failure code: */
NS_ERROR_XPC_GS_RETURNED_FAILURE: 0x80570016;
/** Invalid ClassID or ContractID */
NS_ERROR_XPC_BAD_CID: 0x80570017;
/** Invalid InterfaceID */
NS_ERROR_XPC_BAD_IID: 0x80570018;
/** Cannot create wrapper around native interface */
NS_ERROR_XPC_CANT_CREATE_WN: 0x80570019;
/** JavaScript component threw exception */
NS_ERROR_XPC_JS_THREW_EXCEPTION: 0x8057001a;
/** JavaScript component threw a native object that is not an exception */
NS_ERROR_XPC_JS_THREW_NATIVE_OBJECT: 0x8057001b;
/** JavaScript component threw a JavaScript object */
NS_ERROR_XPC_JS_THREW_JS_OBJECT: 0x8057001c;
/** JavaScript component threw a null value as an exception */
NS_ERROR_XPC_JS_THREW_NULL: 0x8057001d;
/** JavaScript component threw a string as an exception */
NS_ERROR_XPC_JS_THREW_STRING: 0x8057001e;
/** JavaScript component threw a number as an exception */
NS_ERROR_XPC_JS_THREW_NUMBER: 0x8057001f;
/** JavaScript component caused a JavaScript error */
NS_ERROR_XPC_JAVASCRIPT_ERROR: 0x80570020;
/** JavaScript component caused a JavaScript error (detailed report attached) */
NS_ERROR_XPC_JAVASCRIPT_ERROR_WITH_DETAILS: 0x80570021;
/** Cannot convert primitive JavaScript value into an array */
NS_ERROR_XPC_CANT_CONVERT_PRIMITIVE_TO_ARRAY: 0x80570022;
/** Cannot convert JavaScript object into an array */
NS_ERROR_XPC_CANT_CONVERT_OBJECT_TO_ARRAY: 0x80570023;
/** JavaScript Array does not have as many elements as indicated by size argument */
NS_ERROR_XPC_NOT_ENOUGH_ELEMENTS_IN_ARRAY: 0x80570024;
/** Cannot find array information */
NS_ERROR_XPC_CANT_GET_ARRAY_INFO: 0x80570025;
/** JavaScript String does not have as many characters as indicated by size argument */
NS_ERROR_XPC_NOT_ENOUGH_CHARS_IN_STRING: 0x80570026;
/** Security Manager vetoed action */
NS_ERROR_XPC_SECURITY_MANAGER_VETO: 0x80570027;
/** Failed to build a wrapper because the interface that was not declared [scriptable] */
NS_ERROR_XPC_INTERFACE_NOT_SCRIPTABLE: 0x80570028;
/** Failed to build a wrapper because the interface does not inherit from nsISupports */
NS_ERROR_XPC_INTERFACE_NOT_FROM_NSISUPPORTS: 0x80570029;
/** Property is a constant and cannot be changed */
NS_ERROR_XPC_CANT_SET_READ_ONLY_CONSTANT: 0x8057002b;
/** Property is a read only attribute and cannot be changed */
NS_ERROR_XPC_CANT_SET_READ_ONLY_ATTRIBUTE: 0x8057002c;
/** Property is an interface method and cannot be changed */
NS_ERROR_XPC_CANT_SET_READ_ONLY_METHOD: 0x8057002d;
/** Cannot add property to WrappedNative object */
NS_ERROR_XPC_CANT_ADD_PROP_TO_WRAPPED_NATIVE: 0x8057002e;
/** Call to nsIXPCScriptable interface for WrappedNative failed unexpecedly */
NS_ERROR_XPC_CALL_TO_SCRIPTABLE_FAILED: 0x8057002f;
/** JavaScript component does not have a method named: */
NS_ERROR_XPC_JSOBJECT_HAS_NO_FUNCTION_NAMED: 0x80570030;
/** Bad ID string */
NS_ERROR_XPC_BAD_ID_STRING: 0x80570031;
/** Bad initializer name in Constructor - Component has no method with that name */
NS_ERROR_XPC_BAD_INITIALIZER_NAME: 0x80570032;
/** Operation failed because the XPConnect subsystem has been shutdown */
NS_ERROR_XPC_HAS_BEEN_SHUTDOWN: 0x80570033;
/** Cannot modify properties of a WrappedNative */
NS_ERROR_XPC_CANT_MODIFY_PROP_ON_WN: 0x80570034;
/** Could not convert JavaScript argument - 0 was passed, expected object. Did you mean null? */
NS_ERROR_XPC_BAD_CONVERT_JS_ZERO_ISNOT_NULL: 0x80570035;
// common global codes (from nsError.h)
/** Success */
NS_OK: 0x0;
/** Component not initialized */
NS_ERROR_NOT_INITIALIZED: 0xc1f30001;
/** Component already initialized */
NS_ERROR_ALREADY_INITIALIZED: 0xc1f30002;
/** Method not implemented */
NS_ERROR_NOT_IMPLEMENTED: 0x80004001;
/** Component does not have requested interface */
NS_NOINTERFACE: 0x80004002;
/** Component does not have requested interface */
NS_ERROR_NO_INTERFACE: 0x80004002;
/** Illegal value */
NS_ERROR_ILLEGAL_VALUE: 0x80070057;
/** Invalid pointer */
NS_ERROR_INVALID_POINTER: 0x80070057;
/** Null pointer */
NS_ERROR_NULL_POINTER: 0x80070057;
/** Abort */
NS_ERROR_ABORT: 0x80004004;
/** Failure */
NS_ERROR_FAILURE: 0x80004005;
/** Unexpected error */
NS_ERROR_UNEXPECTED: 0x8000ffff;
/** Out of Memory */
NS_ERROR_OUT_OF_MEMORY: 0x8007000e;
/** Invalid argument */
NS_ERROR_INVALID_ARG: 0x80070057;
/** Component is not available */
NS_ERROR_NOT_AVAILABLE: 0x80040111;
/** Factory not registered */
NS_ERROR_FACTORY_NOT_REGISTERED: 0x80040154;
/** Factory not registered (may be tried again) */
NS_ERROR_FACTORY_REGISTER_AGAIN: 0x80040155;
/** Factory not loaded */
NS_ERROR_FACTORY_NOT_LOADED: 0x800401f8;
/** Factory does not support signatures */
NS_ERROR_FACTORY_NO_SIGNATURE_SUPPORT: 0xc1f30101;
/** Factory already exists */
NS_ERROR_FACTORY_EXISTS: 0xc1f30100;
// added from nsError.h on Feb 28 2001...
/** Stream closed */
NS_BASE_STREAM_CLOSED: 0x80470002;
/** Error from the operating system */
NS_BASE_STREAM_OSERROR: 0x80470003;
/** Illegal arguments */
NS_BASE_STREAM_ILLEGAL_ARGS: 0x80470004;
/** No converter for unichar streams */
NS_BASE_STREAM_NO_CONVERTER: 0x80470005;
/** Bad converter for unichar streams */
NS_BASE_STREAM_BAD_CONVERSION: 0x80470006;
/** Stream would block */
NS_BASE_STREAM_WOULD_BLOCK: 0x80470007;
/** File error: Unrecognized path */
NS_ERROR_FILE_UNRECOGNIZED_PATH: 0x80520001;
/** File error: Unresolvable symlink */
NS_ERROR_FILE_UNRESOLVABLE_SYMLINK: 0x80520002;
/** File error: Execution failed */
NS_ERROR_FILE_EXECUTION_FAILED: 0x80520003;
/** File error: Unknown type */
NS_ERROR_FILE_UNKNOWN_TYPE: 0x80520004;
/** File error: Destination not dir */
NS_ERROR_FILE_DESTINATION_NOT_DIR: 0x80520005;
/** File error: Copy or move failed */
NS_ERROR_FILE_COPY_OR_MOVE_FAILED: 0x80520007;
/** File error: Already exists */
NS_ERROR_FILE_ALREADY_EXISTS: 0x80520008;
/** File error: Invalid path */
NS_ERROR_FILE_INVALID_PATH: 0x80520009;
/** File error: Corrupted */
NS_ERROR_FILE_CORRUPTED: 0x8052000b;
/** File error: Not directory */
NS_ERROR_FILE_NOT_DIRECTORY: 0x8052000c;
/** File error: Is directory */
NS_ERROR_FILE_IS_DIRECTORY: 0x8052000d;
/** File error: Is locked */
NS_ERROR_FILE_IS_LOCKED: 0x8052000e;
/** File error: Too big */
NS_ERROR_FILE_TOO_BIG: 0x8052000f;
/** File error: No device space */
NS_ERROR_FILE_NO_DEVICE_SPACE: 0x80520010;
/** File error: Name too long */
NS_ERROR_FILE_NAME_TOO_LONG: 0x80520011;
/** File error: Not found */
NS_ERROR_FILE_NOT_FOUND: 0x80520012;
/** File error: Read only */
NS_ERROR_FILE_READ_ONLY: 0x80520013;
/** File error: Dir not empty */
NS_ERROR_FILE_DIR_NOT_EMPTY: 0x80520014;
/** File error: Access denied */
NS_ERROR_FILE_ACCESS_DENIED: 0x80520015;
// added from nsError.h on Sept 6 2001...
/** Data conversion error */
NS_ERROR_CANNOT_CONVERT_DATA: 0x80460001;
/** Can not modify immutable data container */
NS_ERROR_OBJECT_IS_IMMUTABLE: 0x80460002;
/** Data conversion failed because significant data would be lost */
NS_ERROR_LOSS_OF_SIGNIFICANT_DATA: 0x80460003;
/** Data conversion succeeded but data was rounded to fit */
NS_SUCCESS_LOSS_OF_INSIGNIFICANT_DATA: 0x460001;
// network related codes (from nsNetError.h)
/** The async request failed for some unknown reason */
NS_BINDING_FAILED: 0x804b0001;
/** The async request failed because it was aborted by some user action */
NS_BINDING_ABORTED: 0x804b0002;
/** The async request has been redirected to a different async request */
NS_BINDING_REDIRECTED: 0x804b0003;
/** The async request has been retargeted to a different handler */
NS_BINDING_RETARGETED: 0x804b0004;
/** The URI is malformed */
NS_ERROR_MALFORMED_URI: 0x804b000a;
/** The URI scheme corresponds to an unknown protocol handler */
NS_ERROR_UNKNOWN_PROTOCOL: 0x804b0012;
/** Channel opened successfully but no data will be returned */
NS_ERROR_NO_CONTENT: 0x804b0011;
/** The requested action could not be completed while the object is busy */
NS_ERROR_IN_PROGRESS: 0x804b000f;
/** Channel is already open */
NS_ERROR_ALREADY_OPENED: 0x804b0049;
/** The content encoding of the source document is incorrect */
NS_ERROR_INVALID_CONTENT_ENCODING: 0x804b001b;
/** Corrupted content received from server (potentially MIME type mismatch because of 'X-Content-Type-Options: nosniff') */
NS_ERROR_CORRUPTED_CONTENT: 0x804b001d;
/** Couldn't extract first component from potentially corrupted header field */
NS_ERROR_FIRST_HEADER_FIELD_COMPONENT_EMPTY: 0x804b0022;
/** The connection is already established */
NS_ERROR_ALREADY_CONNECTED: 0x804b000b;
/** The connection does not exist */
NS_ERROR_NOT_CONNECTED: 0x804b000c;
/** The connection was refused */
NS_ERROR_CONNECTION_REFUSED: 0x804b000d;
/** User refused navigation to potentially unsafe URL with embedded credentials/superfluos authentication */
NS_ERROR_SUPERFLUOS_AUTH: 0x804b005b;
// Error codes return from the proxy
/** The connection to the proxy server was refused */
NS_ERROR_PROXY_CONNECTION_REFUSED: 0x804b0048;
/** The proxy requires authentication */
NS_ERROR_PROXY_AUTHENTICATION_FAILED: 0x804b057f;
/** The request failed on the proxy */
NS_ERROR_PROXY_BAD_GATEWAY: 0x804b05de;
/** The request timed out on the proxy */
NS_ERROR_PROXY_GATEWAY_TIMEOUT: 0x804b05e0;
/** Sending too many requests to a proxy */
NS_ERROR_PROXY_TOO_MANY_REQUESTS: 0x804b0595;
/** The proxy does not support the version of the HTTP request */
NS_ERROR_PROXY_VERSION_NOT_SUPPORTED: 0x804b05e1;
/** The user is banned from the proxy */
NS_ERROR_PROXY_FORBIDDEN: 0x804b057b;
/** The proxy is not available */
NS_ERROR_PROXY_SERVICE_UNAVAILABLE: 0x804b05df;
/** The desired destination is unavailable for legal reasons */
NS_ERROR_PROXY_UNAVAILABLE_FOR_LEGAL_REASONS: 0x804b05ab;
/** The connection has timed out */
NS_ERROR_NET_TIMEOUT: 0x804b000e;
/** The request has been cancelled because of a timeout */
NS_ERROR_NET_TIMEOUT_EXTERNAL: 0x804b0055;
/** The requested action could not be completed in the offline state */
NS_ERROR_OFFLINE: 0x804b0010;
/** Establishing a connection to an unsafe or otherwise banned port was prohibited */
NS_ERROR_PORT_ACCESS_NOT_ALLOWED: 0x804b0013;
/** The connection was established, but no data was ever received */
NS_ERROR_NET_RESET: 0x804b0014;
/** The connection was established, but the data transfer was interrupted */
NS_ERROR_NET_INTERRUPT: 0x804b0047;
/** A transfer was only partially done when it completed */
NS_ERROR_NET_PARTIAL_TRANSFER: 0x804b004c;
/** There has been a http3 protocol error */
NS_ERROR_NET_HTTP3_PROTOCOL_ERROR: 0x804b0054;
/** This request is not resumable, but it was tried to resume it, or to request resume-specific data */
NS_ERROR_NOT_RESUMABLE: 0x804b0019;
/** It was attempted to resume the request, but the entity has changed in the meantime */
NS_ERROR_ENTITY_CHANGED: 0x804b0020;
/** The request failed as a result of a detected redirection loop */
NS_ERROR_REDIRECT_LOOP: 0x804b001f;
/** The request failed because the content type returned by the server was not a type expected by the channel */
NS_ERROR_UNSAFE_CONTENT_TYPE: 0x804b004a;
/** The load caused an error page to be displayed. */
NS_ERROR_LOAD_SHOWED_ERRORPAGE: 0x804b004d;
/** The request was blocked by a policy set by the system administrator. */
NS_ERROR_BLOCKED_BY_POLICY: 0x80780003;
/** The lookup of the hostname failed */
NS_ERROR_UNKNOWN_HOST: 0x804b001e;
/** The DNS lookup queue is full */
NS_ERROR_DNS_LOOKUP_QUEUE_FULL: 0x804b0021;
/** The lookup of the proxy hostname failed */
NS_ERROR_UNKNOWN_PROXY_HOST: 0x804b002a;
/** The specified socket type does not exist */
NS_ERROR_UNKNOWN_SOCKET_TYPE: 0x804b0033;
/** The specified socket type could not be created */
NS_ERROR_SOCKET_CREATE_FAILED: 0x804b0034;
/** The specified socket address type is not supported */
NS_ERROR_SOCKET_ADDRESS_NOT_SUPPORTED: 0x804b0035;
/** Some other socket is already using the specified address. */
NS_ERROR_SOCKET_ADDRESS_IN_USE: 0x804b0036;
/** Cache key could not be found */
NS_ERROR_CACHE_KEY_NOT_FOUND: 0x804b003d;
/** Cache data is a stream */
NS_ERROR_CACHE_DATA_IS_STREAM: 0x804b003e;
/** Cache data is not a stream */
NS_ERROR_CACHE_DATA_IS_NOT_STREAM: 0x804b003f;
/** Cache entry exists but needs to be validated first */
NS_ERROR_CACHE_WAIT_FOR_VALIDATION: 0x804b0040;
/** Cache entry has been doomed */
NS_ERROR_CACHE_ENTRY_DOOMED: 0x804b0041;
/** Read access to cache denied */
NS_ERROR_CACHE_READ_ACCESS_DENIED: 0x804b0042;
/** Write access to cache denied */
NS_ERROR_CACHE_WRITE_ACCESS_DENIED: 0x804b0043;
/** Cache is currently in use */
NS_ERROR_CACHE_IN_USE: 0x804b0044;
/** Document does not exist in cache */
NS_ERROR_DOCUMENT_NOT_CACHED: 0x804b0046;
/** The requested number of domain levels exceeds those present in the host string */
NS_ERROR_INSUFFICIENT_DOMAIN_LEVELS: 0x804b0050;
/** The host string is an IP address */
NS_ERROR_HOST_IS_IP_ADDRESS: 0x804b0051;
/** Can't access a wrapped JS object from a different thread */
NS_ERROR_NOT_SAME_THREAD: 0x80460004;
// storage related codes (from mozStorage.h)
/** SQLite database connection is busy */
NS_ERROR_STORAGE_BUSY: 0x80630001;
/** SQLite encountered an IO error */
NS_ERROR_STORAGE_IOERR: 0x80630002;
/** SQLite database operation failed because a constraint was violated */
NS_ERROR_STORAGE_CONSTRAINT: 0x80630003;
// plugin related codes (from nsPluginError.h)
/** Clearing site data by time range not supported by plugin */
NS_ERROR_PLUGIN_TIME_RANGE_NOT_SUPPORTED: 0x804c03eb;
// character converter related codes
/** The input characters have illegal sequences */
NS_ERROR_ILLEGAL_INPUT: 0x8050000e;
// Codes related to signd jars
/** The JAR is not signed. */
NS_ERROR_SIGNED_JAR_NOT_SIGNED: 0x80680001;
/** An entry in the JAR has been modified after the JAR was signed. */
NS_ERROR_SIGNED_JAR_MODIFIED_ENTRY: 0x80680002;
/** An entry in the JAR has not been signed. */
NS_ERROR_SIGNED_JAR_UNSIGNED_ENTRY: 0x80680003;
/** An entry is missing from the JAR file. */
NS_ERROR_SIGNED_JAR_ENTRY_MISSING: 0x80680004;
/** The JAR's signature is wrong. */
NS_ERROR_SIGNED_JAR_WRONG_SIGNATURE: 0x80680005;
/** An entry in the JAR is too large. */
NS_ERROR_SIGNED_JAR_ENTRY_TOO_LARGE: 0x80680006;
/** An entry in the JAR is invalid. */
NS_ERROR_SIGNED_JAR_ENTRY_INVALID: 0x80680007;
/** The JAR's manifest or signature file is invalid. */
NS_ERROR_SIGNED_JAR_MANIFEST_INVALID: 0x80680008;
/** The PKCS#7 signature is malformed or invalid. */
NS_ERROR_CMS_VERIFY_NO_CONTENT_INFO: 0x805a0401;
/** The PKCS#7 information is not signed. */
NS_ERROR_CMS_VERIFY_NOT_SIGNED: 0x805a0400;
// Codes related to signed manifests
/** The signed app manifest or signature file is invalid. */
NS_ERROR_SIGNED_APP_MANIFEST_INVALID: 0x806b0001;
// Codes for printing-related errors.
/** No printers available. */
NS_ERROR_GFX_PRINTER_NO_PRINTER_AVAILABLE: 0x80480001;
/** The selected printer could not be found. */
NS_ERROR_GFX_PRINTER_NAME_NOT_FOUND: 0x80480002;
/** Failed to open output file for print to file. */
NS_ERROR_GFX_PRINTER_COULD_NOT_OPEN_FILE: 0x80480003;
/** Printing failed while starting the print job. */
NS_ERROR_GFX_PRINTER_STARTDOC: 0x80480004;
/** Printing failed while completing the print job. */
NS_ERROR_GFX_PRINTER_ENDDOC: 0x80480005;
/** Printing failed while starting a new page. */
NS_ERROR_GFX_PRINTER_STARTPAGE: 0x80480006;
/** Cannot print this document yet, it is still being loaded. */
NS_ERROR_GFX_PRINTER_DOC_IS_BUSY: 0x80480007;
// Codes related to content
/** The process that hosted this content has crashed. */
NS_ERROR_CONTENT_CRASHED: 0x805e0010;
/** The process that hosted this frame has crashed. */
NS_ERROR_FRAME_CRASHED: 0x805e000e;
/** The process that hosted this content did not have the same buildID as the parent. */
NS_ERROR_BUILDID_MISMATCH: 0x805e0011;
/** The load for this content was blocked. */
NS_ERROR_CONTENT_BLOCKED: 0x805e0006;
// Codes for the JS-implemented Push DOM API. These can be removed as part of bug 1252660.
/** Invalid raw ECDSA P-256 public key. */
NS_ERROR_DOM_PUSH_INVALID_KEY_ERR: 0x806d0005;
/** A subscription with a different application server key already exists. */
NS_ERROR_DOM_PUSH_MISMATCHED_KEY_ERR: 0x806d0006;
// Codes defined in WebIDL https://heycam.github.io/webidl/#idl-DOMException-error-names
/** The object can not be found here. */
NS_ERROR_DOM_NOT_FOUND_ERR: 0x80530008;
/** The request is not allowed. */
NS_ERROR_DOM_NOT_ALLOWED_ERR: 0x80530021;
// Codes related to the URIClassifier service
/** The URI is malware */
NS_ERROR_MALWARE_URI: 0x805d001e;
/** The URI is phishing */
NS_ERROR_PHISHING_URI: 0x805d001f;
/** The URI is tracking */
NS_ERROR_TRACKING_URI: 0x805d0022;
/** The URI is unwanted */
NS_ERROR_UNWANTED_URI: 0x805d0023;
/** The URI is blocked */
NS_ERROR_BLOCKED_URI: 0x805d0025;
/** The URI is harmful */
NS_ERROR_HARMFUL_URI: 0x805d0026;
/** The URI is fingerprinting */
NS_ERROR_FINGERPRINTING_URI: 0x805d0029;
/** The URI is cryptomining */
NS_ERROR_CRYPTOMINING_URI: 0x805d002a;
/** The URI is social tracking */
NS_ERROR_SOCIALTRACKING_URI: 0x805d002b;
/** The URI is email tracking */
NS_ERROR_EMAILTRACKING_URI: 0x805d002c;
// Profile manager error codes
/** Flushing the profiles to disk would have overwritten changes made elsewhere. */
NS_ERROR_DATABASE_CHANGED: 0x805800ca;
// Codes related to URILoader
/** The data from a channel has already been parsed and cached so it doesn't need to be reparsed from the original source. */
NS_ERROR_PARSED_DATA_CACHED: 0x805d0021;
/** The async request has been cancelled by another async request */
NS_BINDING_CANCELLED_OLD_LOAD: 0x805d0027;
/** The ProgID classes had not been registered. */
NS_ERROR_WDBA_NO_PROGID: 0x80720001;
/** The existing UserChoice Hash could not be verified. */
NS_ERROR_WDBA_HASH_CHECK: 0x80720002;
/** UserChoice was set, but checking the default did not return our ProgID. */
NS_ERROR_WDBA_REJECTED: 0x80720003;
/** The existing UserChoice Hash was verified, but we're on an older, unsupported Windows build, so do not attempt to update the UserChoice hash. */
NS_ERROR_WDBA_BUILD: 0x80720004;
}

61
tools/@types/lib.gecko.services.d.ts поставляемый Normal file
Просмотреть файл

@ -0,0 +1,61 @@
/**
* NOTE: Do not modify this file by hand.
* Content was generated from services.json.
*/
interface JSServices {
DAPTelemetry: nsIDAPTelemetry;
appShell: nsIAppShellService;
appinfo: nsICrashReporter & nsIXULAppInfo & nsIXULRuntime;
blocklist: nsIBlocklistService;
cache2: nsICacheStorageService;
catMan: nsICategoryManager;
clearData: nsIClearDataService;
clipboard: nsIClipboard;
console: nsIConsoleService;
cookieBanners: nsICookieBannerService;
cookies: nsICookieManager & nsICookieService;
cpmm: ContentProcessMessageManager;
dirsvc: nsIDirectoryService & nsIProperties;
dns: nsIDNSService;
domStorageManager: nsIDOMStorageManager & nsILocalStorageManager;
droppedLinkHandler: nsIDroppedLinkHandler;
eTLD: nsIEffectiveTLDService;
els: nsIEventListenerService;
env: nsIEnvironment;
focus: nsIFocusManager;
fog: nsIFOG;
intl: mozIMozIntl;
io: nsIIOService & nsINetUtil & nsISpeculativeConnect;
loadContextInfo: nsILoadContextInfoFactory;
locale: mozILocaleService;
logins: nsILoginManager;
mm: ChromeMessageBroadcaster;
obs: nsIObserverService;
perms: nsIPermissionManager;
policies: nsIEnterprisePolicies;
ppmm: ParentProcessMessageManager;
prefs: nsIPrefBranch & nsIPrefService;
profiler: nsIProfiler;
prompt: nsIPromptService;
qms: nsIQuotaManagerService;
rfp: nsIRFPService;
scriptSecurityManager: nsIScriptSecurityManager;
scriptloader: mozIJSSubScriptLoader;
search: nsISearchService;
sessionStorage: nsISessionStorageService;
startup: nsIAppStartup;
storage: mozIStorageService;
strings: nsIStringBundleService;
sysinfo: nsIPropertyBag2 & nsISystemInfo;
telemetry: nsITelemetry;
textToSubURI: nsITextToSubURI;
tm: nsIThreadManager;
uriFixup: nsIURIFixup;
urlFormatter: nsIURLFormatter;
uuid: nsIUUIDGenerator;
vc: nsIVersionComparator;
wm: nsIWindowMediator;
ww: nsIWindowWatcher;
xulStore: nsIXULStore;
}

16271
tools/@types/lib.gecko.xpcom.d.ts поставляемый Normal file

Разница между файлами не показана из-за своего большого размера Загрузить разницу

26
tools/@types/package.json Normal file
Просмотреть файл

@ -0,0 +1,26 @@
{
"name": "@types/gecko",
"version": "1.0.0",
"description": "TypeScript definitions for gecko dom and xpcom.",
"repository": {
"type": "git",
"url": "git+https://github.com/mozilla/gecko-dev.git"
},
"keywords": [
"dom",
"gecko",
"mozilla",
"types",
"typescript",
"webidl",
"xpcom"
],
"author": "Tomislav Jovanovic",
"license": "MPL-2.0",
"types": "./index.d.ts",
"bugs": {
"url": "https://bugzilla.mozilla.org/enter_bug.cgi?product=Developer+Infrastructure&component=Lint+and+Formatting"
},
"homepage": "https://firefox-source-docs.mozilla.org/code-quality/",
"private": true
}

Просмотреть файл

@ -36,5 +36,6 @@ toolkit/components/uniffi-js/UniFFIFixtureScaffolding.cpp
toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated
tools/browsertime/package.json
tools/browsertime/package-lock.json
tools/ts/error_list.json
try_task_config.json
xpcom/idl-parser/xpidl/fixtures/xpctest.d.json

18
tools/ts/.eslintrc.js Normal file
Просмотреть файл

@ -0,0 +1,18 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
module.exports = {
plugins: ["eslint-plugin"],
extends: ["plugin:eslint-plugin/recommended"],
env: {
browser: false,
node: true,
},
rules: {
"no-console": "off",
strict: ["error", "global"],
},
};

Просмотреть файл

@ -0,0 +1,56 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
/**
* Build: <objdir>/dist/@types/lib.gecko.nsresult.d.ts,
*
* from: <srcdir>/js/xpconnect/src/xpc.msg and
* <srcdir>/tools/ts/error_list.json,
* generated manually for now.
*/
const fs = require("fs");
const peggy = require("peggy");
const HEADER = `/**
* NOTE: Do not modify this file by hand.
* Content was generated from xpc.msg and error_list.json.
*/
`;
const XPC_MSG_GRAMMAR = `
File = Header @( Comment / Definition / NL )*
Header = '/*' (!'*/' .)* '*/' NL
Comment = '/*' @$(!'*/' !NL .)* '*/' NL
Definition = 'XPC_MSG_DEF(' @$[A-Z0-9_]+ [ ]* ', "' @$[^"]+ '")' NL
NL = @$[ ]* '\\n'
`;
function main(lib_dts, xpc_msg, errors_json) {
let parser = peggy.generate(XPC_MSG_GRAMMAR);
let messages = parser.parse(fs.readFileSync(xpc_msg, "utf8"));
let errors = JSON.parse(fs.readFileSync(errors_json, "utf8"));
let lines = messages.map(line => {
if (!Array.isArray(line)) {
return line ? ` // ${line.trim()}` : "";
}
let [name, msg] = line;
return `\n /** ${msg} */\n ${name}: 0x${errors[name].toString(16)};`;
});
let dts = [
HEADER,
"interface nsIXPCComponents_Results {",
lines.join("\n").replaceAll("\n\n\n", "\n\n"),
"}\n",
].join("\n");
console.log(`[INFO] ${lib_dts} (${dts.length.toLocaleString()} bytes)`);
fs.writeFileSync(lib_dts, dts);
}
main(...process.argv.slice(2));

Просмотреть файл

@ -0,0 +1,47 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
/**
* Build: <objdir>/dist/@types/lib.gecko.services.d.ts,
*
* from: <objdir>/xpcom/components/services.json,
* generated by a previous build step.
*/
const fs = require("fs");
const HEADER = `/**
* NOTE: Do not modify this file by hand.
* Content was generated from services.json.
*/
`;
const SERVICES = {
cpmm: ["ContentProcessMessageManager"],
mm: ["ChromeMessageBroadcaster"],
ppmm: ["ParentProcessMessageManager"],
};
function main(lib_dts, services_json) {
let interfaces = JSON.parse(fs.readFileSync(services_json, "utf8"));
for (let [iface, svc] of Object.entries(interfaces)) {
SERVICES[svc] = SERVICES[svc] ?? [];
SERVICES[svc].push(iface);
}
let lines = [HEADER];
lines.push("interface JSServices {");
for (let [svc, ifaces] of Object.entries(SERVICES).sort()) {
lines.push(` ${svc}: ${ifaces.join(" & ")};`);
}
lines.push("}\n");
let dts = lines.join("\n");
console.log(`[INFO] ${lib_dts} (${dts.length.toLocaleString()} bytes)`);
fs.writeFileSync(lib_dts, dts);
}
main(...process.argv.slice(2));

139
tools/ts/build_xpcom.js Normal file
Просмотреть файл

@ -0,0 +1,139 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
/**
* Build: <objdir>/dist/@types/lib.gecko.xpcom.d.ts,
*
* from: <objdir>/config/makefiles/xpidl/*.d.json type definition files,
* generated by a previous build step.
*/
const fs = require("fs");
const URL = "https://searchfox.org/mozilla-central/source/";
const HEADER = `/**
* NOTE: Do not modify this file by hand.
* Content was generated from source XPCOM .idl files.
*/
`;
// Emit a typescript interface, along with any related enums.
function ts_interface(iface) {
let lines = [];
let base = iface.base;
iface.class = iface.id;
// Make QueryInterface optional, enable plain objects to pass as nsISupports.
let partial = iface.id === "nsISupports" ? "?" : "";
let enums = iface.enums.map(e => `typeof ${iface.id}.${e.id}`).join(" & ");
if (enums) {
base += `, Enums<${enums}>`;
iface.class += `, ${enums}`;
// Close the global scope, avoid polluting it with the namespace value.
lines.push("} // global\n");
lines.push(`declare namespace ${iface.id} {\n`);
for (let e of iface.enums) {
lines.push(`enum ${e.id} {`);
for (let v of e.variants) {
lines.push(` ${v.name} = ${v.value},`);
}
lines.push("}\n");
}
lines.push("}\n");
lines.push("declare global {\n");
}
// Handle [function] interfaces.
if (iface.callable) {
lines.push(`type ${iface.id} = Callable<{`);
} else {
lines.push(`interface ${iface.id} ${base ? `extends ${base} ` : ""}{`);
}
for (let c of iface.consts) {
lines.push(` readonly ${c.name}: ${c.value};`);
}
if (iface.consts.length && iface.members.length) {
// For style points.
lines.push("");
}
for (let m of iface.members) {
if (!m.args) {
lines.push(` ${m.readonly ? "readonly " : ""}${m.name}: ${m.type};`);
} else {
let args = [];
for (let arg of m.args) {
// If this is the generic parameter, adjust its type.
let type = arg.name === m.iid_is ? "T" : arg.type;
args.push(`${arg.name}${arg.optional ? "?" : ""}: ${type}`);
}
let type = `(${args.join(", ")}): ${m.type}`;
// Adjust signature if this is a generic method.
let signature = m.iid_is ? `<T extends nsIID>${type}<T>` : type;
lines.push(` ${m.name}${partial}${signature};`);
}
}
lines.push(iface.callable ? "}>\n" : "}\n");
return lines;
}
// Link all generated .d.json files into a self-contained ts typelib.
function ts_link(dir, files) {
let lines = [HEADER, "declare global {\n"];
let typedefs = {};
let iids = [];
for (let djson of files) {
let modules = JSON.parse(fs.readFileSync(`${dir}/${djson}`, "utf8"));
for (let mod of modules) {
lines.push(`// ${URL}${mod.path}\n`);
Object.assign(typedefs, Object.fromEntries(mod.typedefs ?? []));
for (let iface of mod.interfaces ?? []) {
if (iface.id !== "nsIXPCComponents_Interfaces") {
lines = lines.concat(ts_interface(iface));
iids.push(` ${iface.id}: nsJSIID<${iface.class}>;`);
}
}
}
}
lines.push("interface nsIXPCComponents_Interfaces {");
lines = lines.concat(iids);
lines.push("}\n");
lines.push("} // global\n");
lines.push("// Typedefs from xpidl.");
for (let [id, type] of Object.entries(typedefs).sort()) {
lines.push(`type ${id} = ${type};`);
}
lines.push("");
// Include xpcom builtins.
lines.push(fs.readFileSync(`${__dirname}/fixtures/intrinsics.d.ts`, "utf8"));
return lines;
}
// For testing.
module.exports = { ts_link };
function main(lib_dts, djson_dir, ...djson_files) {
let dts = ts_link(djson_dir, djson_files).join("\n");
console.log(`[INFO] ${lib_dts} (${dts.length.toLocaleString()} bytes)`);
fs.writeFileSync(lib_dts, dts);
}
if (require.main === module) {
main(...process.argv.slice(2));
}

535
tools/ts/error_list.json Normal file
Просмотреть файл

@ -0,0 +1,535 @@
{
"NS_OK": 0,
"NS_ERROR_BASE": 3253927936,
"NS_ERROR_NOT_INITIALIZED": 3253927937,
"NS_ERROR_ALREADY_INITIALIZED": 3253927938,
"NS_ERROR_NOT_IMPLEMENTED": 2147500033,
"NS_NOINTERFACE": 2147500034,
"NS_ERROR_NO_INTERFACE": 2147500034,
"NS_ERROR_ABORT": 2147500036,
"NS_ERROR_FAILURE": 2147500037,
"NS_ERROR_UNEXPECTED": 2147549183,
"NS_ERROR_OUT_OF_MEMORY": 2147942414,
"NS_ERROR_ILLEGAL_VALUE": 2147942487,
"NS_ERROR_INVALID_ARG": 2147942487,
"NS_ERROR_INVALID_POINTER": 2147942487,
"NS_ERROR_NULL_POINTER": 2147942487,
"NS_ERROR_NOT_AVAILABLE": 2147746065,
"NS_ERROR_FACTORY_NOT_REGISTERED": 2147746132,
"NS_ERROR_FACTORY_REGISTER_AGAIN": 2147746133,
"NS_ERROR_FACTORY_NOT_LOADED": 2147746296,
"NS_ERROR_FACTORY_NO_SIGNATURE_SUPPORT": 3253928193,
"NS_ERROR_FACTORY_EXISTS": 3253928192,
"NS_ERROR_CANNOT_CONVERT_DATA": 2152071169,
"NS_ERROR_OBJECT_IS_IMMUTABLE": 2152071170,
"NS_ERROR_LOSS_OF_SIGNIFICANT_DATA": 2152071171,
"NS_ERROR_NOT_SAME_THREAD": 2152071172,
"NS_ERROR_ILLEGAL_DURING_SHUTDOWN": 2152071198,
"NS_ERROR_SERVICE_NOT_AVAILABLE": 2152071190,
"NS_SUCCESS_LOSS_OF_INSIGNIFICANT_DATA": 4587521,
"NS_SUCCESS_INTERRUPTED_TRAVERSE": 4587522,
"NS_BASE_STREAM_CLOSED": 2152136706,
"NS_BASE_STREAM_OSERROR": 2152136707,
"NS_BASE_STREAM_ILLEGAL_ARGS": 2152136708,
"NS_BASE_STREAM_NO_CONVERTER": 2152136709,
"NS_BASE_STREAM_BAD_CONVERSION": 2152136710,
"NS_BASE_STREAM_WOULD_BLOCK": 2152136711,
"NS_ERROR_GFX_PRINTER_NO_PRINTER_AVAILABLE": 2152202241,
"NS_ERROR_GFX_PRINTER_NAME_NOT_FOUND": 2152202242,
"NS_ERROR_GFX_PRINTER_COULD_NOT_OPEN_FILE": 2152202243,
"NS_ERROR_GFX_PRINTER_STARTDOC": 2152202244,
"NS_ERROR_GFX_PRINTER_ENDDOC": 2152202245,
"NS_ERROR_GFX_PRINTER_STARTPAGE": 2152202246,
"NS_ERROR_GFX_PRINTER_DOC_IS_BUSY": 2152202247,
"NS_ERROR_GFX_CMAP_MALFORMED": 2152202291,
"NS_SUCCESS_EVENT_CONSUMED": 4784129,
"NS_BINDING_SUCCEEDED": 0,
"NS_BINDING_FAILED": 2152398849,
"NS_BINDING_ABORTED": 2152398850,
"NS_BINDING_REDIRECTED": 2152398851,
"NS_BINDING_RETARGETED": 2152398852,
"NS_ERROR_MALFORMED_URI": 2152398858,
"NS_ERROR_IN_PROGRESS": 2152398863,
"NS_ERROR_NO_CONTENT": 2152398865,
"NS_ERROR_UNKNOWN_PROTOCOL": 2152398866,
"NS_ERROR_INVALID_CONTENT_ENCODING": 2152398875,
"NS_ERROR_CORRUPTED_CONTENT": 2152398877,
"NS_ERROR_INVALID_SIGNATURE": 2152398906,
"NS_ERROR_FIRST_HEADER_FIELD_COMPONENT_EMPTY": 2152398882,
"NS_ERROR_ALREADY_OPENED": 2152398921,
"NS_ERROR_ALREADY_CONNECTED": 2152398859,
"NS_ERROR_NOT_CONNECTED": 2152398860,
"NS_ERROR_CONNECTION_REFUSED": 2152398861,
"NS_ERROR_NET_TIMEOUT": 2152398862,
"NS_ERROR_OFFLINE": 2152398864,
"NS_ERROR_PORT_ACCESS_NOT_ALLOWED": 2152398867,
"NS_ERROR_NET_RESET": 2152398868,
"NS_ERROR_NET_INTERRUPT": 2152398919,
"NS_ERROR_PROXY_CONNECTION_REFUSED": 2152398920,
"NS_ERROR_NET_PARTIAL_TRANSFER": 2152398924,
"NS_ERROR_NET_INADEQUATE_SECURITY": 2152398930,
"NS_ERROR_NET_HTTP2_SENT_GOAWAY": 2152398931,
"NS_ERROR_NET_HTTP3_PROTOCOL_ERROR": 2152398932,
"NS_ERROR_NET_TIMEOUT_EXTERNAL": 2152398933,
"NS_ERROR_HTTPS_ONLY": 2152398934,
"NS_ERROR_WEBSOCKET_CONNECTION_REFUSED": 2152398935,
"NS_ERROR_NON_LOCAL_CONNECTION_REFUSED": 2152398936,
"NS_ERROR_BAD_HSTS_CERT": 2152398937,
"NS_ERROR_PARSING_HTTP_STATUS_LINE": 2152398938,
"NS_ERROR_SUPERFLUOS_AUTH": 2152398939,
"NS_ERROR_NOT_RESUMABLE": 2152398873,
"NS_ERROR_REDIRECT_LOOP": 2152398879,
"NS_ERROR_ENTITY_CHANGED": 2152398880,
"NS_ERROR_UNSAFE_CONTENT_TYPE": 2152398922,
"NS_ERROR_LOAD_SHOWED_ERRORPAGE": 2152398925,
"NS_ERROR_DOCSHELL_DYING": 2152398926,
"NS_ERROR_UNKNOWN_HOST": 2152398878,
"NS_ERROR_DNS_LOOKUP_QUEUE_FULL": 2152398881,
"NS_ERROR_UNKNOWN_PROXY_HOST": 2152398890,
"NS_ERROR_DEFINITIVE_UNKNOWN_HOST": 2152398891,
"NS_ERROR_UNKNOWN_SOCKET_TYPE": 2152398899,
"NS_ERROR_SOCKET_CREATE_FAILED": 2152398900,
"NS_ERROR_SOCKET_ADDRESS_NOT_SUPPORTED": 2152398901,
"NS_ERROR_SOCKET_ADDRESS_IN_USE": 2152398902,
"NS_ERROR_CACHE_KEY_NOT_FOUND": 2152398909,
"NS_ERROR_CACHE_DATA_IS_STREAM": 2152398910,
"NS_ERROR_CACHE_DATA_IS_NOT_STREAM": 2152398911,
"NS_ERROR_CACHE_WAIT_FOR_VALIDATION": 2152398912,
"NS_ERROR_CACHE_ENTRY_DOOMED": 2152398913,
"NS_ERROR_CACHE_READ_ACCESS_DENIED": 2152398914,
"NS_ERROR_CACHE_WRITE_ACCESS_DENIED": 2152398915,
"NS_ERROR_CACHE_IN_USE": 2152398916,
"NS_ERROR_DOCUMENT_NOT_CACHED": 2152398918,
"NS_ERROR_INSUFFICIENT_DOMAIN_LEVELS": 2152398928,
"NS_ERROR_HOST_IS_IP_ADDRESS": 2152398929,
"NS_SUCCESS_ADOPTED_DATA": 4915290,
"NS_SUCCESS_AUTH_FINISHED": 4915240,
"NS_NET_STATUS_READING": 4915208,
"NS_NET_STATUS_WRITING": 4915209,
"NS_NET_STATUS_RESOLVING_HOST": 4915203,
"NS_NET_STATUS_RESOLVED_HOST": 4915211,
"NS_NET_STATUS_CONNECTING_TO": 4915207,
"NS_NET_STATUS_CONNECTED_TO": 4915204,
"NS_NET_STATUS_TLS_HANDSHAKE_STARTING": 4915212,
"NS_NET_STATUS_TLS_HANDSHAKE_ENDED": 4915213,
"NS_NET_STATUS_SENDING_TO": 4915205,
"NS_NET_STATUS_WAITING_FOR": 4915210,
"NS_NET_STATUS_RECEIVING_FROM": 4915206,
"NS_ERROR_INTERCEPTION_FAILED": 2152398948,
"NS_ERROR_WEBTRANSPORT_CODE_BASE": 2152399048,
"NS_ERROR_WEBTRANSPORT_CODE_END": 2152399303,
"NS_ERROR_PROXY_CODE_BASE": 2152399848,
"NS_ERROR_PROXY_MULTIPLE_CHOICES": 2152400148,
"NS_ERROR_PROXY_MOVED_PERMANENTLY": 2152400149,
"NS_ERROR_PROXY_FOUND": 2152400150,
"NS_ERROR_PROXY_SEE_OTHER": 2152400151,
"NS_ERROR_PROXY_NOT_MODIFIED": 2152400152,
"NS_ERROR_PROXY_TEMPORARY_REDIRECT": 2152400155,
"NS_ERROR_PROXY_PERMANENT_REDIRECT": 2152400156,
"NS_ERROR_PROXY_BAD_REQUEST": 2152400248,
"NS_ERROR_PROXY_UNAUTHORIZED": 2152400249,
"NS_ERROR_PROXY_PAYMENT_REQUIRED": 2152400250,
"NS_ERROR_PROXY_FORBIDDEN": 2152400251,
"NS_ERROR_PROXY_NOT_FOUND": 2152400252,
"NS_ERROR_PROXY_METHOD_NOT_ALLOWED": 2152400253,
"NS_ERROR_PROXY_NOT_ACCEPTABLE": 2152400254,
"NS_ERROR_PROXY_AUTHENTICATION_FAILED": 2152400255,
"NS_ERROR_PROXY_REQUEST_TIMEOUT": 2152400256,
"NS_ERROR_PROXY_CONFLICT": 2152400257,
"NS_ERROR_PROXY_GONE": 2152400258,
"NS_ERROR_PROXY_LENGTH_REQUIRED": 2152400259,
"NS_ERROR_PROXY_PRECONDITION_FAILED": 2152400260,
"NS_ERROR_PROXY_REQUEST_ENTITY_TOO_LARGE": 2152400261,
"NS_ERROR_PROXY_REQUEST_URI_TOO_LONG": 2152400262,
"NS_ERROR_PROXY_UNSUPPORTED_MEDIA_TYPE": 2152400263,
"NS_ERROR_PROXY_REQUESTED_RANGE_NOT_SATISFIABLE": 2152400264,
"NS_ERROR_PROXY_EXPECTATION_FAILED": 2152400265,
"NS_ERROR_PROXY_MISDIRECTED_REQUEST": 2152400269,
"NS_ERROR_PROXY_TOO_EARLY": 2152400273,
"NS_ERROR_PROXY_UPGRADE_REQUIRED": 2152400274,
"NS_ERROR_PROXY_PRECONDITION_REQUIRED": 2152400276,
"NS_ERROR_PROXY_TOO_MANY_REQUESTS": 2152400277,
"NS_ERROR_PROXY_REQUEST_HEADER_FIELDS_TOO_LARGE": 2152400279,
"NS_ERROR_PROXY_UNAVAILABLE_FOR_LEGAL_REASONS": 2152400299,
"NS_ERROR_PROXY_INTERNAL_SERVER_ERROR": 2152400348,
"NS_ERROR_PROXY_NOT_IMPLEMENTED": 2152400349,
"NS_ERROR_PROXY_BAD_GATEWAY": 2152400350,
"NS_ERROR_PROXY_SERVICE_UNAVAILABLE": 2152400351,
"NS_ERROR_PROXY_GATEWAY_TIMEOUT": 2152400352,
"NS_ERROR_PROXY_VERSION_NOT_SUPPORTED": 2152400353,
"NS_ERROR_PROXY_VARIANT_ALSO_NEGOTIATES": 2152400354,
"NS_ERROR_PROXY_NOT_EXTENDED": 2152400358,
"NS_ERROR_PROXY_NETWORK_AUTHENTICATION_REQUIRED": 2152400359,
"NS_ERROR_PLUGINS_PLUGINSNOTCHANGED": 2152465384,
"NS_ERROR_PLUGIN_DISABLED": 2152465385,
"NS_ERROR_PLUGIN_BLOCKLISTED": 2152465386,
"NS_ERROR_PLUGIN_TIME_RANGE_NOT_SUPPORTED": 2152465387,
"NS_ERROR_PLUGIN_CLICKTOPLAY": 2152465388,
"NS_OK_PARSE_SHEET": 5046273,
"NS_ERROR_HTMLPARSER_CONTINUE": 0,
"NS_ERROR_HTMLPARSER_EOF": 2152596456,
"NS_ERROR_HTMLPARSER_UNKNOWN": 2152596457,
"NS_ERROR_HTMLPARSER_CANTPROPAGATE": 2152596458,
"NS_ERROR_HTMLPARSER_CONTEXTMISMATCH": 2152596459,
"NS_ERROR_HTMLPARSER_BADFILENAME": 2152596460,
"NS_ERROR_HTMLPARSER_BADURL": 2152596461,
"NS_ERROR_HTMLPARSER_INVALIDPARSERCONTEXT": 2152596462,
"NS_ERROR_HTMLPARSER_INTERRUPTED": 2152596463,
"NS_ERROR_HTMLPARSER_BLOCK": 2152596464,
"NS_ERROR_HTMLPARSER_BADTOKENIZER": 2152596465,
"NS_ERROR_HTMLPARSER_BADATTRIBUTE": 2152596466,
"NS_ERROR_HTMLPARSER_UNRESOLVEDDTD": 2152596467,
"NS_ERROR_HTMLPARSER_MISPLACEDTABLECONTENT": 2152596468,
"NS_ERROR_HTMLPARSER_BADDTD": 2152596469,
"NS_ERROR_HTMLPARSER_BADCONTEXT": 2152596470,
"NS_ERROR_HTMLPARSER_STOPPARSING": 2152596471,
"NS_ERROR_HTMLPARSER_UNTERMINATEDSTRINGLITERAL": 2152596472,
"NS_ERROR_HTMLPARSER_HIERARCHYTOODEEP": 2152596473,
"NS_ERROR_HTMLPARSER_FAKE_ENDTAG": 2152596474,
"NS_ERROR_HTMLPARSER_INVALID_COMMENT": 2152596475,
"NS_RDF_ASSERTION_ACCEPTED": 0,
"NS_RDF_NO_VALUE": 5177346,
"NS_RDF_ASSERTION_REJECTED": 5177347,
"NS_RDF_STOP_VISIT": 5177348,
"NS_ERROR_UCONV_NOCONV": 2152726529,
"NS_ERROR_UDEC_ILLEGALINPUT": 2152726542,
"NS_OK_HAD_REPLACEMENTS": 5242883,
"NS_OK_UDEC_MOREINPUT": 5242892,
"NS_OK_UDEC_MOREOUTPUT": 5242893,
"NS_OK_UENC_MOREOUTPUT": 5242914,
"NS_ERROR_UENC_NOMAPPING": 5242915,
"NS_ERROR_ILLEGAL_INPUT": 2152726542,
"NS_ERROR_FILE_UNRECOGNIZED_PATH": 2152857601,
"NS_ERROR_FILE_UNRESOLVABLE_SYMLINK": 2152857602,
"NS_ERROR_FILE_EXECUTION_FAILED": 2152857603,
"NS_ERROR_FILE_UNKNOWN_TYPE": 2152857604,
"NS_ERROR_FILE_DESTINATION_NOT_DIR": 2152857605,
"NS_ERROR_FILE_COPY_OR_MOVE_FAILED": 2152857607,
"NS_ERROR_FILE_ALREADY_EXISTS": 2152857608,
"NS_ERROR_FILE_INVALID_PATH": 2152857609,
"NS_ERROR_FILE_CORRUPTED": 2152857611,
"NS_ERROR_FILE_NOT_DIRECTORY": 2152857612,
"NS_ERROR_FILE_IS_DIRECTORY": 2152857613,
"NS_ERROR_FILE_IS_LOCKED": 2152857614,
"NS_ERROR_FILE_TOO_BIG": 2152857615,
"NS_ERROR_FILE_NO_DEVICE_SPACE": 2152857616,
"NS_ERROR_FILE_NAME_TOO_LONG": 2152857617,
"NS_ERROR_FILE_NOT_FOUND": 2152857618,
"NS_ERROR_FILE_READ_ONLY": 2152857619,
"NS_ERROR_FILE_DIR_NOT_EMPTY": 2152857620,
"NS_ERROR_FILE_ACCESS_DENIED": 2152857621,
"NS_ERROR_FILE_FS_CORRUPTED": 2152857622,
"NS_ERROR_FILE_DEVICE_FAILURE": 2152857623,
"NS_ERROR_FILE_DEVICE_TEMPORARY_FAILURE": 2152857624,
"NS_ERROR_FILE_INVALID_HANDLE": 2152857625,
"NS_SUCCESS_FILE_DIRECTORY_EMPTY": 5373953,
"NS_SUCCESS_AGGREGATE_RESULT": 5373954,
"NS_ERROR_DOM_INDEX_SIZE_ERR": 2152923137,
"NS_ERROR_DOM_HIERARCHY_REQUEST_ERR": 2152923139,
"NS_ERROR_DOM_WRONG_DOCUMENT_ERR": 2152923140,
"NS_ERROR_DOM_INVALID_CHARACTER_ERR": 2152923141,
"NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR": 2152923143,
"NS_ERROR_DOM_NOT_FOUND_ERR": 2152923144,
"NS_ERROR_DOM_NOT_SUPPORTED_ERR": 2152923145,
"NS_ERROR_DOM_INUSE_ATTRIBUTE_ERR": 2152923146,
"NS_ERROR_DOM_INVALID_STATE_ERR": 2152923147,
"NS_ERROR_DOM_SYNTAX_ERR": 2152923148,
"NS_ERROR_DOM_INVALID_MODIFICATION_ERR": 2152923149,
"NS_ERROR_DOM_NAMESPACE_ERR": 2152923150,
"NS_ERROR_DOM_INVALID_ACCESS_ERR": 2152923151,
"NS_ERROR_DOM_TYPE_MISMATCH_ERR": 2152923153,
"NS_ERROR_DOM_SECURITY_ERR": 2152923154,
"NS_ERROR_DOM_NETWORK_ERR": 2152923155,
"NS_ERROR_DOM_ABORT_ERR": 2152923156,
"NS_ERROR_DOM_URL_MISMATCH_ERR": 2152923157,
"NS_ERROR_DOM_QUOTA_EXCEEDED_ERR": 2152923158,
"NS_ERROR_DOM_TIMEOUT_ERR": 2152923159,
"NS_ERROR_DOM_INVALID_NODE_TYPE_ERR": 2152923160,
"NS_ERROR_DOM_DATA_CLONE_ERR": 2152923161,
"NS_ERROR_DOM_ENCODING_NOT_SUPPORTED_ERR": 2152923164,
"NS_ERROR_DOM_UNKNOWN_ERR": 2152923166,
"NS_ERROR_DOM_DATA_ERR": 2152923167,
"NS_ERROR_DOM_OPERATION_ERR": 2152923168,
"NS_ERROR_DOM_NOT_ALLOWED_ERR": 2152923169,
"NS_ERROR_DOM_WRONG_TYPE_ERR": 2152924138,
"NS_ERROR_DOM_NOT_NUMBER_ERR": 2152924141,
"NS_ERROR_DOM_PROP_ACCESS_DENIED": 2152924146,
"NS_ERROR_DOM_XPCONNECT_ACCESS_DENIED": 2152924147,
"NS_ERROR_DOM_BAD_URI": 2152924148,
"NS_ERROR_DOM_RETVAL_UNDEFINED": 2152924149,
"NS_ERROR_UNCATCHABLE_EXCEPTION": 2152924151,
"NS_ERROR_DOM_MALFORMED_URI": 2152924152,
"NS_ERROR_DOM_INVALID_HEADER_NAME": 2152924153,
"NS_ERROR_DOM_INVALID_STATE_XHR_HAS_INVALID_CONTEXT": 2152924154,
"NS_ERROR_DOM_JS_DECODING_ERROR": 2152924162,
"NS_ERROR_DOM_IMAGE_INACTIVE_DOCUMENT": 2152924163,
"NS_ERROR_DOM_IMAGE_INVALID_REQUEST": 2152924164,
"NS_ERROR_DOM_IMAGE_BROKEN": 2152924165,
"NS_ERROR_DOM_CORP_FAILED": 2152924172,
"NS_ERROR_DOM_BAD_CROSS_ORIGIN_URI": 2152924173,
"NS_ERROR_RECURSIVE_DOCUMENT_LOAD": 2152924174,
"NS_ERROR_DOM_WEBEXT_CONTENT_SCRIPT_URI": 2152924175,
"NS_ERROR_DOM_COEP_FAILED": 2152924176,
"NS_ERROR_DOM_COOP_FAILED": 2152924177,
"NS_ERROR_DOM_INVALID_HEADER_VALUE": 2152924178,
"NS_SUCCESS_DOM_NO_OPERATION": 5439489,
"NS_SUCCESS_DOM_SCRIPT_EVALUATION_THREW": 5439490,
"NS_SUCCESS_DOM_SCRIPT_EVALUATION_THREW_UNCATCHABLE": 5439491,
"NS_IMAGELIB_ERROR_FAILURE": 2152988677,
"NS_IMAGELIB_ERROR_NO_DECODER": 2152988678,
"NS_IMAGELIB_ERROR_NOT_FINISHED": 2152988679,
"NS_IMAGELIB_ERROR_NO_ENCODER": 2152988681,
"NS_ERROR_EDITOR_DESTROYED": 2153119745,
"NS_ERROR_EDITOR_UNEXPECTED_DOM_TREE": 2153119746,
"NS_ERROR_EDITOR_ACTION_CANCELED": 2153119747,
"NS_ERROR_EDITOR_NO_EDITABLE_RANGE": 2153119748,
"NS_SUCCESS_EDITOR_ELEMENT_NOT_FOUND": 5636097,
"NS_SUCCESS_EDITOR_FOUND_TARGET": 5636098,
"NS_SUCCESS_EDITOR_BUT_IGNORED_TRIVIAL_ERROR": 5636099,
"NS_ERROR_XPC_NOT_ENOUGH_ARGS": 2153185281,
"NS_ERROR_XPC_NEED_OUT_OBJECT": 2153185282,
"NS_ERROR_XPC_CANT_SET_OUT_VAL": 2153185283,
"NS_ERROR_XPC_NATIVE_RETURNED_FAILURE": 2153185284,
"NS_ERROR_XPC_CANT_GET_INTERFACE_INFO": 2153185285,
"NS_ERROR_XPC_CANT_GET_PARAM_IFACE_INFO": 2153185286,
"NS_ERROR_XPC_CANT_GET_METHOD_INFO": 2153185287,
"NS_ERROR_XPC_UNEXPECTED": 2153185288,
"NS_ERROR_XPC_BAD_CONVERT_JS": 2153185289,
"NS_ERROR_XPC_BAD_CONVERT_NATIVE": 2153185290,
"NS_ERROR_XPC_BAD_CONVERT_JS_NULL_REF": 2153185291,
"NS_ERROR_XPC_BAD_OP_ON_WN_PROTO": 2153185292,
"NS_ERROR_XPC_CANT_CONVERT_WN_TO_FUN": 2153185293,
"NS_ERROR_XPC_CANT_DEFINE_PROP_ON_WN": 2153185294,
"NS_ERROR_XPC_CANT_WATCH_WN_STATIC": 2153185295,
"NS_ERROR_XPC_CANT_EXPORT_WN_STATIC": 2153185296,
"NS_ERROR_XPC_SCRIPTABLE_CALL_FAILED": 2153185297,
"NS_ERROR_XPC_SCRIPTABLE_CTOR_FAILED": 2153185298,
"NS_ERROR_XPC_CANT_CALL_WO_SCRIPTABLE": 2153185299,
"NS_ERROR_XPC_CANT_CTOR_WO_SCRIPTABLE": 2153185300,
"NS_ERROR_XPC_CI_RETURNED_FAILURE": 2153185301,
"NS_ERROR_XPC_GS_RETURNED_FAILURE": 2153185302,
"NS_ERROR_XPC_BAD_CID": 2153185303,
"NS_ERROR_XPC_BAD_IID": 2153185304,
"NS_ERROR_XPC_CANT_CREATE_WN": 2153185305,
"NS_ERROR_XPC_JS_THREW_EXCEPTION": 2153185306,
"NS_ERROR_XPC_JS_THREW_NATIVE_OBJECT": 2153185307,
"NS_ERROR_XPC_JS_THREW_JS_OBJECT": 2153185308,
"NS_ERROR_XPC_JS_THREW_NULL": 2153185309,
"NS_ERROR_XPC_JS_THREW_STRING": 2153185310,
"NS_ERROR_XPC_JS_THREW_NUMBER": 2153185311,
"NS_ERROR_XPC_JAVASCRIPT_ERROR": 2153185312,
"NS_ERROR_XPC_JAVASCRIPT_ERROR_WITH_DETAILS": 2153185313,
"NS_ERROR_XPC_CANT_CONVERT_PRIMITIVE_TO_ARRAY": 2153185314,
"NS_ERROR_XPC_CANT_CONVERT_OBJECT_TO_ARRAY": 2153185315,
"NS_ERROR_XPC_NOT_ENOUGH_ELEMENTS_IN_ARRAY": 2153185316,
"NS_ERROR_XPC_CANT_GET_ARRAY_INFO": 2153185317,
"NS_ERROR_XPC_NOT_ENOUGH_CHARS_IN_STRING": 2153185318,
"NS_ERROR_XPC_SECURITY_MANAGER_VETO": 2153185319,
"NS_ERROR_XPC_INTERFACE_NOT_SCRIPTABLE": 2153185320,
"NS_ERROR_XPC_INTERFACE_NOT_FROM_NSISUPPORTS": 2153185321,
"NS_ERROR_XPC_CANT_SET_READ_ONLY_CONSTANT": 2153185323,
"NS_ERROR_XPC_CANT_SET_READ_ONLY_ATTRIBUTE": 2153185324,
"NS_ERROR_XPC_CANT_SET_READ_ONLY_METHOD": 2153185325,
"NS_ERROR_XPC_CANT_ADD_PROP_TO_WRAPPED_NATIVE": 2153185326,
"NS_ERROR_XPC_CALL_TO_SCRIPTABLE_FAILED": 2153185327,
"NS_ERROR_XPC_JSOBJECT_HAS_NO_FUNCTION_NAMED": 2153185328,
"NS_ERROR_XPC_BAD_ID_STRING": 2153185329,
"NS_ERROR_XPC_BAD_INITIALIZER_NAME": 2153185330,
"NS_ERROR_XPC_HAS_BEEN_SHUTDOWN": 2153185331,
"NS_ERROR_XPC_CANT_MODIFY_PROP_ON_WN": 2153185332,
"NS_ERROR_XPC_BAD_CONVERT_JS_ZERO_ISNOT_NULL": 2153185333,
"NS_ERROR_LAUNCHED_CHILD_PROCESS": 2153251016,
"NS_ERROR_SHOW_PROFILE_MANAGER": 2153251017,
"NS_ERROR_DATABASE_CHANGED": 2153251018,
"NS_ERROR_XFO_VIOLATION": 2153381984,
"NS_ERROR_CSP_FORM_ACTION_VIOLATION": 2153381985,
"NS_ERROR_CSP_FRAME_ANCESTOR_VIOLATION": 2153381986,
"NS_ERROR_SRI_CORRUPT": 2153382088,
"NS_ERROR_SRI_NOT_ELIGIBLE": 2153382089,
"NS_ERROR_SRI_UNEXPECTED_HASH_TYPE": 2153382090,
"NS_ERROR_SRI_IMPORT": 2153382091,
"NS_ERROR_CMS_VERIFY_NOT_SIGNED": 2153382912,
"NS_ERROR_CMS_VERIFY_NO_CONTENT_INFO": 2153382913,
"NS_ERROR_CMS_VERIFY_BAD_DIGEST": 2153382914,
"NS_ERROR_CMS_VERIFY_NOCERT": 2153382916,
"NS_ERROR_CMS_VERIFY_UNTRUSTED": 2153382917,
"NS_ERROR_CMS_VERIFY_ERROR_UNVERIFIED": 2153382919,
"NS_ERROR_CMS_VERIFY_ERROR_PROCESSING": 2153382920,
"NS_ERROR_CMS_VERIFY_BAD_SIGNATURE": 2153382921,
"NS_ERROR_CMS_VERIFY_DIGEST_MISMATCH": 2153382922,
"NS_ERROR_CMS_VERIFY_UNKNOWN_ALGO": 2153382923,
"NS_ERROR_CMS_VERIFY_UNSUPPORTED_ALGO": 2153382924,
"NS_ERROR_CMS_VERIFY_MALFORMED_SIGNATURE": 2153382925,
"NS_ERROR_CMS_VERIFY_HEADER_MISMATCH": 2153382926,
"NS_ERROR_CMS_VERIFY_NOT_YET_ATTEMPTED": 2153382927,
"NS_ERROR_CMS_VERIFY_CERT_WITHOUT_ADDRESS": 2153382928,
"NS_ERROR_CMS_ENCRYPT_NO_BULK_ALG": 2153382944,
"NS_ERROR_CMS_ENCRYPT_INCOMPLETE": 2153382945,
"NS_ERROR_WONT_HANDLE_CONTENT": 2153578497,
"NS_ERROR_MALWARE_URI": 2153578526,
"NS_ERROR_PHISHING_URI": 2153578527,
"NS_ERROR_TRACKING_URI": 2153578530,
"NS_ERROR_UNWANTED_URI": 2153578531,
"NS_ERROR_BLOCKED_URI": 2153578533,
"NS_ERROR_HARMFUL_URI": 2153578534,
"NS_ERROR_FINGERPRINTING_URI": 2153578537,
"NS_ERROR_CRYPTOMINING_URI": 2153578538,
"NS_ERROR_SOCIALTRACKING_URI": 2153578539,
"NS_ERROR_EMAILTRACKING_URI": 2153578540,
"NS_ERROR_SAVE_LINK_AS_TIMEOUT": 2153578528,
"NS_ERROR_PARSED_DATA_CACHED": 2153578529,
"NS_BINDING_CANCELLED_OLD_LOAD": 2153578535,
"NS_ERROR_CONTENT_BLOCKED": 2153644038,
"NS_ERROR_CONTENT_BLOCKED_SHOW_ALT": 2153644039,
"NS_PROPTABLE_PROP_NOT_THERE": 2153644042,
"NS_ERROR_CONTENT_CRASHED": 2153644048,
"NS_ERROR_FRAME_CRASHED": 2153644046,
"NS_ERROR_BUILDID_MISMATCH": 2153644049,
"NS_PROPTABLE_PROP_OVERWRITTEN": 6160395,
"NS_FINDBROADCASTER_NOT_FOUND": 6160396,
"NS_FINDBROADCASTER_FOUND": 6160397,
"NS_ERROR_XPATH_INVALID_ARG": 2147942487,
"NS_ERROR_XSLT_PARSE_FAILURE": 2153775105,
"NS_ERROR_XPATH_PARSE_FAILURE": 2153775106,
"NS_ERROR_XSLT_ALREADY_SET": 2153775107,
"NS_ERROR_XSLT_EXECUTION_FAILURE": 2153775108,
"NS_ERROR_XPATH_UNKNOWN_FUNCTION": 2153775109,
"NS_ERROR_XSLT_BAD_RECURSION": 2153775110,
"NS_ERROR_XSLT_BAD_VALUE": 2153775111,
"NS_ERROR_XSLT_NODESET_EXPECTED": 2153775112,
"NS_ERROR_XSLT_ABORTED": 2153775113,
"NS_ERROR_XSLT_NETWORK_ERROR": 2153775114,
"NS_ERROR_XSLT_WRONG_MIME_TYPE": 2153775115,
"NS_ERROR_XSLT_LOAD_RECURSION": 2153775116,
"NS_ERROR_XPATH_BAD_ARGUMENT_COUNT": 2153775117,
"NS_ERROR_XPATH_BAD_EXTENSION_FUNCTION": 2153775118,
"NS_ERROR_XPATH_PAREN_EXPECTED": 2153775119,
"NS_ERROR_XPATH_INVALID_AXIS": 2153775120,
"NS_ERROR_XPATH_NO_NODE_TYPE_TEST": 2153775121,
"NS_ERROR_XPATH_BRACKET_EXPECTED": 2153775122,
"NS_ERROR_XPATH_INVALID_VAR_NAME": 2153775123,
"NS_ERROR_XPATH_UNEXPECTED_END": 2153775124,
"NS_ERROR_XPATH_OPERATOR_EXPECTED": 2153775125,
"NS_ERROR_XPATH_UNCLOSED_LITERAL": 2153775126,
"NS_ERROR_XPATH_BAD_COLON": 2153775127,
"NS_ERROR_XPATH_BAD_BANG": 2153775128,
"NS_ERROR_XPATH_ILLEGAL_CHAR": 2153775129,
"NS_ERROR_XPATH_BINARY_EXPECTED": 2153775130,
"NS_ERROR_XSLT_LOAD_BLOCKED_ERROR": 2153775131,
"NS_ERROR_XPATH_INVALID_EXPRESSION_EVALUATED": 2153775132,
"NS_ERROR_XPATH_UNBALANCED_CURLY_BRACE": 2153775133,
"NS_ERROR_XSLT_BAD_NODE_NAME": 2153775134,
"NS_ERROR_XSLT_VAR_ALREADY_SET": 2153775135,
"NS_ERROR_XSLT_CALL_TO_KEY_NOT_ALLOWED": 2153775136,
"NS_XSLT_GET_NEW_HANDLER": 6291457,
"NS_ERROR_TRANSPORT_INIT": 2153840641,
"NS_ERROR_DUPLICATE_HANDLE": 2153840642,
"NS_ERROR_BRIDGE_OPEN_PARENT": 2153840643,
"NS_ERROR_BRIDGE_OPEN_CHILD": 2153840644,
"NS_ERROR_STORAGE_BUSY": 2153971713,
"NS_ERROR_STORAGE_IOERR": 2153971714,
"NS_ERROR_STORAGE_CONSTRAINT": 2153971715,
"NS_ERROR_DOM_FILE_NOT_FOUND_ERR": 2154102784,
"NS_ERROR_DOM_FILE_NOT_READABLE_ERR": 2154102785,
"NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR": 2154168321,
"NS_ERROR_DOM_INDEXEDDB_NOT_FOUND_ERR": 2154168323,
"NS_ERROR_DOM_INDEXEDDB_CONSTRAINT_ERR": 2154168324,
"NS_ERROR_DOM_INDEXEDDB_DATA_ERR": 2154168325,
"NS_ERROR_DOM_INDEXEDDB_NOT_ALLOWED_ERR": 2154168326,
"NS_ERROR_DOM_INDEXEDDB_TRANSACTION_INACTIVE_ERR": 2154168327,
"NS_ERROR_DOM_INDEXEDDB_ABORT_ERR": 2154168328,
"NS_ERROR_DOM_INDEXEDDB_READ_ONLY_ERR": 2154168329,
"NS_ERROR_DOM_INDEXEDDB_QUOTA_ERR": 2154168331,
"NS_ERROR_DOM_INDEXEDDB_VERSION_ERR": 2154168332,
"NS_ERROR_DOM_INDEXEDDB_KEY_ERR": 2154169322,
"NS_ERROR_DOM_INDEXEDDB_RENAME_OBJECT_STORE_ERR": 2154169323,
"NS_ERROR_DOM_INDEXEDDB_RENAME_INDEX_ERR": 2154169324,
"NS_ERROR_DOM_FILEHANDLE_UNKNOWN_ERR": 2154233857,
"NS_ERROR_DOM_FILEHANDLE_NOT_ALLOWED_ERR": 2154233858,
"NS_ERROR_DOM_FILEHANDLE_INACTIVE_ERR": 2154233859,
"NS_ERROR_DOM_FILEHANDLE_ABORT_ERR": 2154233860,
"NS_ERROR_DOM_FILEHANDLE_READ_ONLY_ERR": 2154233861,
"NS_ERROR_DOM_FILEHANDLE_QUOTA_ERR": 2154233862,
"NS_ERROR_SIGNED_JAR_NOT_SIGNED": 2154299393,
"NS_ERROR_SIGNED_JAR_MODIFIED_ENTRY": 2154299394,
"NS_ERROR_SIGNED_JAR_UNSIGNED_ENTRY": 2154299395,
"NS_ERROR_SIGNED_JAR_ENTRY_MISSING": 2154299396,
"NS_ERROR_SIGNED_JAR_WRONG_SIGNATURE": 2154299397,
"NS_ERROR_SIGNED_JAR_ENTRY_TOO_LARGE": 2154299398,
"NS_ERROR_SIGNED_JAR_ENTRY_INVALID": 2154299399,
"NS_ERROR_SIGNED_JAR_MANIFEST_INVALID": 2154299400,
"NS_ERROR_DOM_FILESYSTEM_INVALID_PATH_ERR": 2154364929,
"NS_ERROR_DOM_FILESYSTEM_INVALID_MODIFICATION_ERR": 2154364930,
"NS_ERROR_DOM_FILESYSTEM_NO_MODIFICATION_ALLOWED_ERR": 2154364931,
"NS_ERROR_DOM_FILESYSTEM_PATH_EXISTS_ERR": 2154364932,
"NS_ERROR_DOM_FILESYSTEM_TYPE_MISMATCH_ERR": 2154364933,
"NS_ERROR_DOM_FILESYSTEM_UNKNOWN_ERR": 2154364934,
"NS_ERROR_SIGNED_APP_MANIFEST_INVALID": 2154496001,
"NS_ERROR_DOM_PUSH_DENIED_ERR": 2154627074,
"NS_ERROR_DOM_PUSH_ABORT_ERR": 2154627075,
"NS_ERROR_DOM_PUSH_SERVICE_UNREACHABLE": 2154627076,
"NS_ERROR_DOM_PUSH_INVALID_KEY_ERR": 2154627077,
"NS_ERROR_DOM_PUSH_MISMATCHED_KEY_ERR": 2154627078,
"NS_ERROR_DOM_MEDIA_ABORT_ERR": 2154692609,
"NS_ERROR_DOM_MEDIA_NOT_ALLOWED_ERR": 2154692610,
"NS_ERROR_DOM_MEDIA_NOT_SUPPORTED_ERR": 2154692611,
"NS_ERROR_DOM_MEDIA_DECODE_ERR": 2154692612,
"NS_ERROR_DOM_MEDIA_FATAL_ERR": 2154692613,
"NS_ERROR_DOM_MEDIA_METADATA_ERR": 2154692614,
"NS_ERROR_DOM_MEDIA_OVERFLOW_ERR": 2154692615,
"NS_ERROR_DOM_MEDIA_END_OF_STREAM": 2154692616,
"NS_ERROR_DOM_MEDIA_WAITING_FOR_DATA": 2154692617,
"NS_ERROR_DOM_MEDIA_CANCELED": 2154692618,
"NS_ERROR_DOM_MEDIA_MEDIASINK_ERR": 2154692619,
"NS_ERROR_DOM_MEDIA_DEMUXER_ERR": 2154692620,
"NS_ERROR_DOM_MEDIA_CDM_ERR": 2154692621,
"NS_ERROR_DOM_MEDIA_NEED_NEW_DECODER": 2154692622,
"NS_ERROR_DOM_MEDIA_INITIALIZING_DECODER": 2154692623,
"NS_ERROR_DOM_MEDIA_REMOTE_DECODER_CRASHED_RDD_OR_GPU_ERR": 2154692624,
"NS_ERROR_DOM_MEDIA_REMOTE_DECODER_CRASHED_UTILITY_ERR": 2154692625,
"NS_ERROR_DOM_MEDIA_REMOTE_DECODER_CRASHED_MF_CDM_ERR": 2154692626,
"NS_ERROR_DOM_MEDIA_KEY_QUOTA_EXCEEDED_ERR": 2154692638,
"NS_ERROR_DOM_MEDIA_SOURCE_MAX_BUFFER_QUOTA_EXCEEDED_ERR": 2154692639,
"NS_ERROR_DOM_MEDIA_SOURCE_FULL_BUFFER_QUOTA_EXCEEDED_ERR": 2154692640,
"NS_ERROR_DOM_MEDIA_CDM_NO_SESSION_ERR": 2154692658,
"NS_ERROR_DOM_MEDIA_CDM_SESSION_OPERATION_ERR": 2154692659,
"NS_ERROR_DOM_MEDIA_CDM_HDCP_NOT_SUPPORT": 2154692660,
"NS_ERROR_DOM_MEDIA_CUBEB_INITIALIZATION_ERR": 2154692709,
"NS_ERROR_DOM_MEDIA_EXTERNAL_ENGINE_NOT_SUPPORTED_ERR": 2154692710,
"NS_ERROR_DOM_MEDIA_CDM_PROXY_NOT_SUPPORTED_ERR": 2154692711,
"NS_ERROR_DOM_MEDIA_DENIED_IN_NON_UTILITY": 2154692712,
"NS_ERROR_UC_UPDATE_UNKNOWN": 2154758145,
"NS_ERROR_UC_UPDATE_DUPLICATE_PREFIX": 2154758146,
"NS_ERROR_UC_UPDATE_INFINITE_LOOP": 2154758147,
"NS_ERROR_UC_UPDATE_WRONG_REMOVAL_INDICES": 2154758148,
"NS_ERROR_UC_UPDATE_CHECKSUM_MISMATCH": 2154758149,
"NS_ERROR_UC_UPDATE_MISSING_CHECKSUM": 2154758150,
"NS_ERROR_UC_UPDATE_SHUTDOWNING": 2154758151,
"NS_ERROR_UC_UPDATE_TABLE_NOT_FOUND": 2154758152,
"NS_ERROR_UC_UPDATE_BUILD_PREFIX_FAILURE": 2154758153,
"NS_ERROR_UC_UPDATE_FAIL_TO_WRITE_DISK": 2154758154,
"NS_ERROR_UC_UPDATE_UNEXPECTED_VERSION": 2154758155,
"NS_ERROR_UC_PARSER_MISSING_PARAM": 2154758156,
"NS_ERROR_UC_PARSER_DECODE_FAILURE": 2154758157,
"NS_ERROR_UC_PARSER_UNKNOWN_THREAT": 2154758158,
"NS_ERROR_UC_PARSER_MISSING_VALUE": 2154758159,
"NS_ERROR_INTERNAL_ERRORRESULT_JS_EXCEPTION": 2154823681,
"NS_ERROR_INTERNAL_ERRORRESULT_DOMEXCEPTION": 2154823682,
"NS_ERROR_INTERNAL_ERRORRESULT_EXCEPTION_ON_JSCONTEXT": 2154823683,
"NS_ERROR_INTERNAL_ERRORRESULT_TYPEERROR": 2154823684,
"NS_ERROR_INTERNAL_ERRORRESULT_RANGEERROR": 2154823685,
"NS_ERROR_WDBA_NO_PROGID": 2154954753,
"NS_ERROR_WDBA_HASH_CHECK": 2154954754,
"NS_ERROR_WDBA_REJECTED": 2154954755,
"NS_ERROR_WDBA_BUILD": 2154954756,
"NS_ERROR_DOWNLOAD_COMPLETE": 2155347969,
"NS_ERROR_DOWNLOAD_NOT_PARTIAL": 2155347970,
"NS_ERROR_UNORM_MOREOUTPUT": 2155348001,
"NS_ERROR_DOCSHELL_REQUEST_REJECTED": 2155348969,
"NS_ERROR_DOCUMENT_IS_PRINTMODE": 2155349969,
"NS_SUCCESS_DONT_FIXUP": 7864321,
"NS_SUCCESS_RESTART_APP": 7864321,
"NS_ERROR_NOT_IN_TREE": 2155348006,
"NS_OK_NO_NAME_CLAUSE_HANDLED": 7864354,
"NS_ERROR_BLOCKED_BY_POLICY": 2155347971
}

85
tools/ts/fixtures/intrinsics.d.ts поставляемый Normal file
Просмотреть файл

@ -0,0 +1,85 @@
/**
* Gecko XPCOM builtins and utility types.
*/
/**
* 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#44
*/
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 };
/** 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. */
type Enums<enums> = enums;
/** Callable accepts either form of a [function] interface. */
type Callable<iface> = iface | Extract<iface[keyof iface], Function>
/** Picks only const number properties from T. */
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;

269
tools/ts/fixtures/xpctest.d.ts поставляемый Normal file
Просмотреть файл

@ -0,0 +1,269 @@
/**
* NOTE: Do not modify this file by hand.
* Content was generated from source XPCOM .idl files.
*/
declare global {
// https://searchfox.org/mozilla-central/source/js/xpconnect/tests/idl/xpctest_attributes.idl
interface nsIXPCTestObjectReadOnly extends nsISupports {
readonly strReadOnly: string;
readonly boolReadOnly: boolean;
readonly shortReadOnly: i16;
readonly longReadOnly: i32;
readonly floatReadOnly: float;
readonly charReadOnly: string;
readonly timeReadOnly: PRTime;
}
interface nsIXPCTestObjectReadWrite extends nsISupports {
stringProperty: string;
booleanProperty: boolean;
shortProperty: i16;
longProperty: i32;
floatProperty: float;
charProperty: string;
timeProperty: PRTime;
}
// https://searchfox.org/mozilla-central/source/js/xpconnect/tests/idl/xpctest_bug809674.idl
interface nsIXPCTestBug809674 extends nsISupports {
addArgs(x: u32, y: u32): u32;
addSubMulArgs(x: u32, y: u32, subOut: OutParam<u32>, mulOut: OutParam<u32>): u32;
addVals(x: any, y: any): any;
methodNoArgs(): u32;
methodNoArgsNoRetVal(): void;
addMany(x1: u32, x2: u32, x3: u32, x4: u32, x5: u32, x6: u32, x7: u32, x8: u32): u32;
valProperty: any;
uintProperty: u32;
methodWithOptionalArgc(): void;
}
// https://searchfox.org/mozilla-central/source/js/xpconnect/tests/idl/xpctest_cenums.idl
} // global
declare namespace nsIXPCTestCEnums {
enum testFlagsExplicit {
shouldBe1Explicit = 1,
shouldBe2Explicit = 2,
shouldBe4Explicit = 4,
shouldBe8Explicit = 8,
shouldBe12Explicit = 12,
}
enum testFlagsImplicit {
shouldBe0Implicit = 0,
shouldBe1Implicit = 1,
shouldBe2Implicit = 2,
shouldBe3Implicit = 3,
shouldBe5Implicit = 5,
shouldBe6Implicit = 6,
shouldBe2AgainImplicit = 2,
shouldBe3AgainImplicit = 3,
}
}
declare global {
interface nsIXPCTestCEnums extends nsISupports, Enums<typeof nsIXPCTestCEnums.testFlagsExplicit & typeof nsIXPCTestCEnums.testFlagsImplicit> {
readonly testConst: 1;
testCEnumInput(abc: nsIXPCTestCEnums.testFlagsExplicit): void;
testCEnumOutput(): nsIXPCTestCEnums.testFlagsExplicit;
}
// https://searchfox.org/mozilla-central/source/js/xpconnect/tests/idl/xpctest_interfaces.idl
interface nsIXPCTestInterfaceA extends nsISupports {
name: string;
}
interface nsIXPCTestInterfaceB extends nsISupports {
name: string;
}
interface nsIXPCTestInterfaceC extends nsISupports {
someInteger: i32;
}
// https://searchfox.org/mozilla-central/source/js/xpconnect/tests/idl/xpctest_params.idl
interface nsIXPCTestParams extends nsISupports {
testBoolean(a: boolean, b: InOutParam<boolean>): boolean;
testOctet(a: u8, b: InOutParam<u8>): u8;
testShort(a: i16, b: InOutParam<i16>): i16;
testLong(a: i32, b: InOutParam<i32>): i32;
testLongLong(a: i64, b: InOutParam<i64>): i64;
testUnsignedShort(a: u16, b: InOutParam<u16>): u16;
testUnsignedLong(a: u32, b: InOutParam<u32>): u32;
testUnsignedLongLong(a: u64, b: InOutParam<u64>): u64;
testFloat(a: float, b: InOutParam<float>): float;
testDouble(a: double, b: InOutParam<float>): double;
testChar(a: string, b: InOutParam<string>): string;
testString(a: string, b: InOutParam<string>): string;
testWchar(a: string, b: InOutParam<string>): string;
testWstring(a: string, b: InOutParam<string>): string;
testAString(a: string, b: InOutParam<string>): string;
testAUTF8String(a: string, b: InOutParam<string>): string;
testACString(a: string, b: InOutParam<string>): string;
testJsval(a: any, b: InOutParam<any>): any;
testShortSequence(a: i16[], b: InOutParam<i16[]>): i16[];
testDoubleSequence(a: double[], b: InOutParam<double[]>): double[];
testInterfaceSequence(a: nsIXPCTestInterfaceA[], b: InOutParam<nsIXPCTestInterfaceA[]>): nsIXPCTestInterfaceA[];
testAStringSequence(a: string[], b: InOutParam<string[]>): string[];
testACStringSequence(a: string[], b: InOutParam<string[]>): string[];
testJsvalSequence(a: any[], b: InOutParam<any[]>): any[];
testSequenceSequence(a: i16[][], b: InOutParam<i16[][]>): i16[][];
testOptionalSequence(arr?: u8[]): u8[];
testShortArray(aLength: u32, a: i16[], bLength: InOutParam<u32>, b: InOutParam<i16[]>, rvLength: OutParam<u32>): OutParam<i16[]>;
testDoubleArray(aLength: u32, a: double[], bLength: InOutParam<u32>, b: InOutParam<double[]>, rvLength: OutParam<u32>): OutParam<double[]>;
testStringArray(aLength: u32, a: string[], bLength: InOutParam<u32>, b: InOutParam<string[]>, rvLength: OutParam<u32>): OutParam<string[]>;
testWstringArray(aLength: u32, a: string[], bLength: InOutParam<u32>, b: InOutParam<string[]>, rvLength: OutParam<u32>): OutParam<string[]>;
testInterfaceArray(aLength: u32, a: nsIXPCTestInterfaceA[], bLength: InOutParam<u32>, b: InOutParam<nsIXPCTestInterfaceA[]>, rvLength: OutParam<u32>): OutParam<nsIXPCTestInterfaceA[]>;
testByteArrayOptionalLength(a: u8[], aLength?: u32): u32;
testSizedString(aLength: u32, a: string, bLength: InOutParam<u32>, b: InOutParam<string>, rvLength: OutParam<u32>): OutParam<string>;
testSizedWstring(aLength: u32, a: string, bLength: InOutParam<u32>, b: InOutParam<string>, rvLength: OutParam<u32>): OutParam<string>;
testJsvalArray(aLength: u32, a: any[], bLength: InOutParam<u32>, b: InOutParam<any[]>, rvLength: OutParam<u32>): OutParam<any[]>;
testOutAString(o: OutParam<string>): void;
testStringArrayOptionalSize(a: string[], aLength?: u32): string;
testOmittedOptionalOut(aJSObj: nsIXPCTestParams, aOut?: OutParam<nsIURI>): void;
readonly testNaN: double;
}
// https://searchfox.org/mozilla-central/source/js/xpconnect/tests/idl/xpctest_returncode.idl
interface nsIXPCTestReturnCodeParent extends nsISupports {
callChild(childBehavior: i32): nsresult;
}
interface nsIXPCTestReturnCodeChild extends nsISupports {
readonly CHILD_SHOULD_THROW: 0;
readonly CHILD_SHOULD_RETURN_SUCCESS: 1;
readonly CHILD_SHOULD_RETURN_RESULTCODE: 2;
readonly CHILD_SHOULD_NEST_RESULTCODES: 3;
doIt(behavior: i32): void;
}
// https://searchfox.org/mozilla-central/source/js/xpconnect/tests/idl/xpctest_utils.idl
type nsIXPCTestFunctionInterface = Callable<{
echo(arg: string): string;
}>
interface nsIXPCTestUtils extends nsISupports {
doubleWrapFunction(f: nsIXPCTestFunctionInterface): nsIXPCTestFunctionInterface;
}
interface nsIXPCComponents_Interfaces {
nsIXPCTestObjectReadOnly: nsJSIID<nsIXPCTestObjectReadOnly>;
nsIXPCTestObjectReadWrite: nsJSIID<nsIXPCTestObjectReadWrite>;
nsIXPCTestBug809674: nsJSIID<nsIXPCTestBug809674>;
nsIXPCTestCEnums: nsJSIID<nsIXPCTestCEnums, typeof nsIXPCTestCEnums.testFlagsExplicit & typeof nsIXPCTestCEnums.testFlagsImplicit>;
nsIXPCTestInterfaceA: nsJSIID<nsIXPCTestInterfaceA>;
nsIXPCTestInterfaceB: nsJSIID<nsIXPCTestInterfaceB>;
nsIXPCTestInterfaceC: nsJSIID<nsIXPCTestInterfaceC>;
nsIXPCTestParams: nsJSIID<nsIXPCTestParams>;
nsIXPCTestReturnCodeParent: nsJSIID<nsIXPCTestReturnCodeParent>;
nsIXPCTestReturnCodeChild: nsJSIID<nsIXPCTestReturnCodeChild>;
nsIXPCTestFunctionInterface: nsJSIID<nsIXPCTestFunctionInterface>;
nsIXPCTestUtils: nsJSIID<nsIXPCTestUtils>;
}
} // global
// Typedefs from xpidl.
type PRTime = i64;
type char16_t = u16;
type nsresult = u32;
/**
* Gecko XPCOM builtins and utility types.
*/
/**
* 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#44
*/
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 };
/** 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. */
type Enums<enums> = enums;
/** Callable accepts either form of a [function] interface. */
type Callable<iface> = iface | Extract<iface[keyof iface], Function>
/** Picks only const number properties from T. */
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;

114
tools/ts/mach_commands.py Normal file
Просмотреть файл

@ -0,0 +1,114 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import json
import os
import mozpack.path as mozpath
from mach.decorators import Command, CommandArgument, SubCommand
@Command("ts", category="misc", description="Run TypeScript and related commands.")
def ts(ctx):
"""
TypeScript related commands to build/update typelibs and type-check js.
Example:
# Use tsc to check types in extensions framework code:
$ ./mach ts check toolkit/components/extensions
"""
ctx._sub_mach(["help", "ts"])
return 1
@SubCommand("ts", "build", description="Build typelibs.")
@CommandArgument("lib", choices=["nsresult", "services", "xpcom"])
def buld(ctx, lib):
"""Command to build one of the typelibs."""
types_dir = mozpath.join(ctx.distdir, "@types")
lib_dts = mozpath.join(types_dir, f"lib.gecko.{lib}.d.ts")
if not os.path.exists(types_dir):
os.makedirs(types_dir)
if lib == "nsresult":
xpc_msg = mozpath.join(ctx.topsrcdir, "js/xpconnect/src/xpc.msg")
errors_json = mozpath.join(ctx.topsrcdir, "tools/ts/error_list.json")
return node(ctx, "build_nsresult", lib_dts, xpc_msg, errors_json)
if lib == "services":
services_json = mozpath.join(ctx.topobjdir, "xpcom/components/services.json")
if not os.path.isfile(services_json):
return build_required(lib, services_json)
return node(ctx, "build_services", lib_dts, services_json)
if lib == "xpcom":
# When we hook this up to be part of the build, we'll have
# an explicit list of files. For now, just get all of them.
dir = mozpath.join(ctx.topobjdir, "config/makefiles/xpidl")
if not os.path.isdir(dir):
return build_required(lib, dir)
files = [f for f in os.listdir(dir) if f.endswith(".d.json")]
if not len(files):
return build_required(lib, f"*.d.json files in {dir}")
return node(ctx, "build_xpcom", lib_dts, dir, *files)
raise ValueError(f"Unknown typelib: {lib}")
@SubCommand("ts", "check", description="Check types in a project using tsc.")
@CommandArgument("paths", nargs="+", help="Path to a (dir with) tsconfig.json.")
def check(ctx, paths):
for p in paths:
rv = node(ctx, "node_modules/typescript/bin/tsc", "--project", p)
if rv:
return rv
return 0
@SubCommand("ts", "setup", description="Install TypeScript and other dependencies.")
def setup(ctx):
# Install locally under tools/ts/node_modules, to avoid any conflicts for now.
os.chdir(mozpath.dirname(__file__))
return ctx._sub_mach(["npm", "ci"])
@SubCommand("ts", "update", description="Update tools/@types lib references.")
def update(ctx):
types_dir = mozpath.join(ctx.distdir, "@types")
index_dts = mozpath.join(ctx.topsrcdir, "tools/@types/index.d.ts")
return node(ctx, "update_refs", index_dts, types_dir)
def node(ctx, script, *args):
maybe_setup(ctx)
path = mozpath.join(mozpath.dirname(__file__), script)
return ctx._sub_mach(["node", path, *args])
def maybe_setup(ctx):
"""Check if npm modules are installed, and run setup if needed."""
dir = mozpath.dirname(__file__)
package_json = json.load(open(mozpath.join(dir, "package.json")))
needs_setup = False
# TODO: Use proper version checking from tools/lint/eslint/setup_helper.py.
for module in package_json.get("devDependencies", {}):
path = mozpath.join(dir, "node_modules", module, "package.json")
if not os.path.isfile(path):
print(f"Missing node module {path}.")
needs_setup = True
break
if needs_setup:
print("Running npm install.")
setup(ctx)
def build_required(lib, item):
print(f"Missing {item}.")
print(f"Building {lib} typelib requires a full Firefox build.")
return 1

6400
tools/ts/package-lock.json сгенерированный Normal file

Разница между файлами не показана из-за своего большого размера Загрузить разницу

10
tools/ts/package.json Normal file
Просмотреть файл

@ -0,0 +1,10 @@
{
"devDependencies": {
"jest": "^29.7.0",
"peggy": "^3.0.2",
"typescript": "^5.3.3"
},
"scripts": {
"test": "jest"
}
}

Просмотреть файл

@ -0,0 +1,18 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* eslint-env node, jest */
"use strict";
const fs = require("fs");
const path = require("path");
const { ts_link } = require("../build_xpcom.js");
const test_dts = path.join(__dirname, "../fixtures/xpctest.d.ts");
const dir = path.join(__dirname, "../../../xpcom/idl-parser/xpidl/fixtures/");
const files = ["xpctest.d.json"];
test("xpctest.d.json produces expected baseline d.ts", () => {
let dts = ts_link(dir, files).join("\n");
expect(dts).toEqual(fs.readFileSync(test_dts, "utf8"));
});

35
tools/ts/update_refs.js Normal file
Просмотреть файл

@ -0,0 +1,35 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
/**
* Update: <srcdir>/tools/@types/index.d.ts,
*
* reference: <objdir>/dist/@types/lib.gecko.*.d.json,
* generated by a ts build lib step.
*/
const fs = require("fs");
const libs = ["dom", "nsresult", "services", "xpcom"];
function main(index_dts, lib_dir) {
let index = fs.readFileSync(index_dts, "utf8");
for (let lib of libs) {
let file = `lib.gecko.${lib}.d.ts`;
let path = `${lib_dir}/${file}`;
let found = fs.existsSync(path);
console.log(`[INFO] ${path} (found: ${found})`);
if (found) {
let re = RegExp(` types=".+/${file}" />`);
index = index.replace(re, ` types="${path}" />`);
}
}
console.log(`[INFO] ${index_dts} (${index.length.toLocaleString()} bytes)`);
fs.writeFileSync(index_dts, index);
}
main(...process.argv.slice(2));