diff options
author | 2023-04-07 08:02:05 -0300 | |
---|---|---|
committer | 2023-04-07 04:02:05 -0700 | |
commit | 6baedd27bc6f0f271249a5b332d3212254909141 (patch) | |
tree | 22b8f7a3a847bb1ea5df53e799ec331f3b737b8b | |
parent | 5465a3980a915ec1b3b20a8c445cdbaa49f8924f (diff) | |
download | bun-6baedd27bc6f0f271249a5b332d3212254909141.tar.gz bun-6baedd27bc6f0f271249a5b332d3212254909141.tar.zst bun-6baedd27bc6f0f271249a5b332d3212254909141.zip |
feat(tls.Server) basic support (cert, key, rejectUnauthorized, requestCert, ca) #2412 (#2552)
* cherry picked
* add StringOrBuffer parameter
* Format and adds types
* update uws
* fix tests
* more types
* fix typing
* add timeouts, clean some stuff
* move tests to describe
* fixes SSL hostname when Host is provided
* cleanup on tests
* change 127.0.0.1 to 0.0.0.0
* try another listening parameter
* test timings and update uws
* remove unnecessary comment
* move listening event around
* always await Bun.connect
* do not fail if the tests already passed when using Bun.connect
* regenerate classes
* undo generated classes
* generate classes
* fix merge
---------
Co-authored-by: cirospaciari <cirospaciari@MiWiFi-RA82-srv.cirospaciari>
23 files changed, 13923 insertions, 10346 deletions
diff --git a/packages/bun-types/bun.d.ts b/packages/bun-types/bun.d.ts index e8374c928..97b28fbe5 100644 --- a/packages/bun-types/bun.d.ts +++ b/packages/bun-types/bun.d.ts @@ -1354,7 +1354,6 @@ declare module "bun" { code: number, message: string, ) => void | Promise<void>; - /** * Enable compression for clients that support it. By default, compression is disabled. * @@ -2844,6 +2843,11 @@ declare module "bun" { Data = unknown, DataBinaryType extends BinaryType = "buffer", > { + /** + * Is called when the socket connects, or in case of TLS if no handshake is provided + * this will be called only after handshake + * @param socket + */ open?(socket: Socket<Data>): void | Promise<void>; close?(socket: Socket<Data>): void | Promise<void>; error?(socket: Socket<Data>, error: Error): void | Promise<void>; @@ -2854,6 +2858,18 @@ declare module "bun" { drain?(socket: Socket<Data>): void | Promise<void>; /** + * When handshake is completed, this functions is called. + * @param socket + * @param success Indicates if the server authorized despite the authorizationError. + * @param authorizationError Certificate Authorization Error or null. + */ + handshake?( + socket: Socket<Data>, + success: boolean, + authorizationError: Error | null, + ): void; + + /** * When the socket has been shutdown from the other end, this function is * called. This is a TCP FIN packet. */ diff --git a/packages/bun-types/net.d.ts b/packages/bun-types/net.d.ts index 4817d98f8..ad9007e40 100644 --- a/packages/bun-types/net.d.ts +++ b/packages/bun-types/net.d.ts @@ -527,8 +527,7 @@ declare module "net" { * This class is used to create a TCP or `IPC` server. * @since v0.1.90 */ - // change back to class once implemented - interface Server extends EventEmitter { + class Server extends EventEmitter { // constructor(connectionListener?: (socket: Socket) => void); // constructor( // options?: ServerOpts, @@ -667,8 +666,8 @@ declare module "net" { * with `child_process.fork()`. * @since v0.2.0 */ - // maxConnections: number; - // connections: number; + maxConnections: number; + connections: number; /** * Indicates whether or not the server is listening for connections. * @since v5.7.0 diff --git a/packages/bun-types/tls.d.ts b/packages/bun-types/tls.d.ts index 42c1b2174..2f361d453 100644 --- a/packages/bun-types/tls.d.ts +++ b/packages/bun-types/tls.d.ts @@ -589,263 +589,263 @@ declare module "tls" { * Accepts encrypted connections using TLS or SSL. * @since v0.3.2 */ - // class Server extends net.Server { - // constructor(secureConnectionListener?: (socket: TLSSocket) => void); - // constructor( - // options: TlsOptions, - // secureConnectionListener?: (socket: TLSSocket) => void, - // ); - // /** - // * The `server.addContext()` method adds a secure context that will be used if - // * the client request's SNI name matches the supplied `hostname` (or wildcard). - // * - // * When there are multiple matching contexts, the most recently added one is - // * used. - // * @since v0.5.3 - // * @param hostname A SNI host name or wildcard (e.g. `'*'`) - // * @param context An object containing any of the possible properties from the {@link createSecureContext} `options` arguments (e.g. `key`, `cert`, `ca`, etc). - // */ - // addContext(hostname: string, context: SecureContextOptions): void; - // /** - // * Returns the session ticket keys. - // * - // * See `Session Resumption` for more information. - // * @since v3.0.0 - // * @return A 48-byte buffer containing the session ticket keys. - // */ - // getTicketKeys(): Buffer; - // /** - // * The `server.setSecureContext()` method replaces the secure context of an - // * existing server. Existing connections to the server are not interrupted. - // * @since v11.0.0 - // * @param options An object containing any of the possible properties from the {@link createSecureContext} `options` arguments (e.g. `key`, `cert`, `ca`, etc). - // */ - // setSecureContext(options: SecureContextOptions): void; - // /** - // * Sets the session ticket keys. - // * - // * Changes to the ticket keys are effective only for future server connections. - // * Existing or currently pending server connections will use the previous keys. - // * - // * See `Session Resumption` for more information. - // * @since v3.0.0 - // * @param keys A 48-byte buffer containing the session ticket keys. - // */ - // setTicketKeys(keys: Buffer): void; - // /** - // * events.EventEmitter - // * 1. tlsClientError - // * 2. newSession - // * 3. OCSPRequest - // * 4. resumeSession - // * 5. secureConnection - // * 6. keylog - // */ - // addListener(event: string, listener: (...args: any[]) => void): this; - // addListener( - // event: "tlsClientError", - // listener: (err: Error, tlsSocket: TLSSocket) => void, - // ): this; - // addListener( - // event: "newSession", - // listener: ( - // sessionId: Buffer, - // sessionData: Buffer, - // callback: () => void, - // ) => void, - // ): this; - // addListener( - // event: "OCSPRequest", - // listener: ( - // certificate: Buffer, - // issuer: Buffer, - // callback: (err: Error | null, resp: Buffer) => void, - // ) => void, - // ): this; - // addListener( - // event: "resumeSession", - // listener: ( - // sessionId: Buffer, - // callback: (err: Error | null, sessionData: Buffer | null) => void, - // ) => void, - // ): this; - // addListener( - // event: "secureConnection", - // listener: (tlsSocket: TLSSocket) => void, - // ): this; - // addListener( - // event: "keylog", - // listener: (line: Buffer, tlsSocket: TLSSocket) => void, - // ): this; - // emit(event: string | symbol, ...args: any[]): boolean; - // emit(event: "tlsClientError", err: Error, tlsSocket: TLSSocket): boolean; - // emit( - // event: "newSession", - // sessionId: Buffer, - // sessionData: Buffer, - // callback: () => void, - // ): boolean; - // emit( - // event: "OCSPRequest", - // certificate: Buffer, - // issuer: Buffer, - // callback: (err: Error | null, resp: Buffer) => void, - // ): boolean; - // emit( - // event: "resumeSession", - // sessionId: Buffer, - // callback: (err: Error | null, sessionData: Buffer | null) => void, - // ): boolean; - // emit(event: "secureConnection", tlsSocket: TLSSocket): boolean; - // emit(event: "keylog", line: Buffer, tlsSocket: TLSSocket): boolean; - // on(event: string, listener: (...args: any[]) => void): this; - // on( - // event: "tlsClientError", - // listener: (err: Error, tlsSocket: TLSSocket) => void, - // ): this; - // on( - // event: "newSession", - // listener: ( - // sessionId: Buffer, - // sessionData: Buffer, - // callback: () => void, - // ) => void, - // ): this; - // on( - // event: "OCSPRequest", - // listener: ( - // certificate: Buffer, - // issuer: Buffer, - // callback: (err: Error | null, resp: Buffer) => void, - // ) => void, - // ): this; - // on( - // event: "resumeSession", - // listener: ( - // sessionId: Buffer, - // callback: (err: Error | null, sessionData: Buffer | null) => void, - // ) => void, - // ): this; - // on( - // event: "secureConnection", - // listener: (tlsSocket: TLSSocket) => void, - // ): this; - // on( - // event: "keylog", - // listener: (line: Buffer, tlsSocket: TLSSocket) => void, - // ): this; - // once(event: string, listener: (...args: any[]) => void): this; - // once( - // event: "tlsClientError", - // listener: (err: Error, tlsSocket: TLSSocket) => void, - // ): this; - // once( - // event: "newSession", - // listener: ( - // sessionId: Buffer, - // sessionData: Buffer, - // callback: () => void, - // ) => void, - // ): this; - // once( - // event: "OCSPRequest", - // listener: ( - // certificate: Buffer, - // issuer: Buffer, - // callback: (err: Error | null, resp: Buffer) => void, - // ) => void, - // ): this; - // once( - // event: "resumeSession", - // listener: ( - // sessionId: Buffer, - // callback: (err: Error | null, sessionData: Buffer | null) => void, - // ) => void, - // ): this; - // once( - // event: "secureConnection", - // listener: (tlsSocket: TLSSocket) => void, - // ): this; - // once( - // event: "keylog", - // listener: (line: Buffer, tlsSocket: TLSSocket) => void, - // ): this; - // prependListener(event: string, listener: (...args: any[]) => void): this; - // prependListener( - // event: "tlsClientError", - // listener: (err: Error, tlsSocket: TLSSocket) => void, - // ): this; - // prependListener( - // event: "newSession", - // listener: ( - // sessionId: Buffer, - // sessionData: Buffer, - // callback: () => void, - // ) => void, - // ): this; - // prependListener( - // event: "OCSPRequest", - // listener: ( - // certificate: Buffer, - // issuer: Buffer, - // callback: (err: Error | null, resp: Buffer) => void, - // ) => void, - // ): this; - // prependListener( - // event: "resumeSession", - // listener: ( - // sessionId: Buffer, - // callback: (err: Error | null, sessionData: Buffer | null) => void, - // ) => void, - // ): this; - // prependListener( - // event: "secureConnection", - // listener: (tlsSocket: TLSSocket) => void, - // ): this; - // prependListener( - // event: "keylog", - // listener: (line: Buffer, tlsSocket: TLSSocket) => void, - // ): this; - // prependOnceListener( - // event: string, - // listener: (...args: any[]) => void, - // ): this; - // prependOnceListener( - // event: "tlsClientError", - // listener: (err: Error, tlsSocket: TLSSocket) => void, - // ): this; - // prependOnceListener( - // event: "newSession", - // listener: ( - // sessionId: Buffer, - // sessionData: Buffer, - // callback: () => void, - // ) => void, - // ): this; - // prependOnceListener( - // event: "OCSPRequest", - // listener: ( - // certificate: Buffer, - // issuer: Buffer, - // callback: (err: Error | null, resp: Buffer) => void, - // ) => void, - // ): this; - // prependOnceListener( - // event: "resumeSession", - // listener: ( - // sessionId: Buffer, - // callback: (err: Error | null, sessionData: Buffer | null) => void, - // ) => void, - // ): this; - // prependOnceListener( - // event: "secureConnection", - // listener: (tlsSocket: TLSSocket) => void, - // ): this; - // prependOnceListener( - // event: "keylog", - // listener: (line: Buffer, tlsSocket: TLSSocket) => void, - // ): this; - // } + class Server extends net.Server { + constructor(secureConnectionListener?: (socket: TLSSocket) => void); + constructor( + options: TlsOptions, + secureConnectionListener?: (socket: TLSSocket) => void, + ); + /** + * The `server.addContext()` method adds a secure context that will be used if + * the client request's SNI name matches the supplied `hostname` (or wildcard). + * + * When there are multiple matching contexts, the most recently added one is + * used. + * @since v0.5.3 + * @param hostname A SNI host name or wildcard (e.g. `'*'`) + * @param context An object containing any of the possible properties from the {@link createSecureContext} `options` arguments (e.g. `key`, `cert`, `ca`, etc). + */ + addContext(hostname: string, context: SecureContextOptions): void; + /** + * Returns the session ticket keys. + * + * See `Session Resumption` for more information. + * @since v3.0.0 + * @return A 48-byte buffer containing the session ticket keys. + */ + getTicketKeys(): Buffer; + /** + * The `server.setSecureContext()` method replaces the secure context of an + * existing server. Existing connections to the server are not interrupted. + * @since v11.0.0 + * @param options An object containing any of the possible properties from the {@link createSecureContext} `options` arguments (e.g. `key`, `cert`, `ca`, etc). + */ + setSecureContext(options: SecureContextOptions): void; + /** + * Sets the session ticket keys. + * + * Changes to the ticket keys are effective only for future server connections. + * Existing or currently pending server connections will use the previous keys. + * + * See `Session Resumption` for more information. + * @since v3.0.0 + * @param keys A 48-byte buffer containing the session ticket keys. + */ + setTicketKeys(keys: Buffer): void; + /** + * events.EventEmitter + * 1. tlsClientError + * 2. newSession + * 3. OCSPRequest + * 4. resumeSession + * 5. secureConnection + * 6. keylog + */ + addListener(event: string, listener: (...args: any[]) => void): this; + addListener( + event: "tlsClientError", + listener: (err: Error, tlsSocket: TLSSocket) => void, + ): this; + addListener( + event: "newSession", + listener: ( + sessionId: Buffer, + sessionData: Buffer, + callback: () => void, + ) => void, + ): this; + addListener( + event: "OCSPRequest", + listener: ( + certificate: Buffer, + issuer: Buffer, + callback: (err: Error | null, resp: Buffer) => void, + ) => void, + ): this; + addListener( + event: "resumeSession", + listener: ( + sessionId: Buffer, + callback: (err: Error | null, sessionData: Buffer | null) => void, + ) => void, + ): this; + addListener( + event: "secureConnection", + listener: (tlsSocket: TLSSocket) => void, + ): this; + addListener( + event: "keylog", + listener: (line: Buffer, tlsSocket: TLSSocket) => void, + ): this; + emit(event: string | symbol, ...args: any[]): boolean; + emit(event: "tlsClientError", err: Error, tlsSocket: TLSSocket): boolean; + emit( + event: "newSession", + sessionId: Buffer, + sessionData: Buffer, + callback: () => void, + ): boolean; + emit( + event: "OCSPRequest", + certificate: Buffer, + issuer: Buffer, + callback: (err: Error | null, resp: Buffer) => void, + ): boolean; + emit( + event: "resumeSession", + sessionId: Buffer, + callback: (err: Error | null, sessionData: Buffer | null) => void, + ): boolean; + emit(event: "secureConnection", tlsSocket: TLSSocket): boolean; + emit(event: "keylog", line: Buffer, tlsSocket: TLSSocket): boolean; + on(event: string, listener: (...args: any[]) => void): this; + on( + event: "tlsClientError", + listener: (err: Error, tlsSocket: TLSSocket) => void, + ): this; + on( + event: "newSession", + listener: ( + sessionId: Buffer, + sessionData: Buffer, + callback: () => void, + ) => void, + ): this; + on( + event: "OCSPRequest", + listener: ( + certificate: Buffer, + issuer: Buffer, + callback: (err: Error | null, resp: Buffer) => void, + ) => void, + ): this; + on( + event: "resumeSession", + listener: ( + sessionId: Buffer, + callback: (err: Error | null, sessionData: Buffer | null) => void, + ) => void, + ): this; + on( + event: "secureConnection", + listener: (tlsSocket: TLSSocket) => void, + ): this; + on( + event: "keylog", + listener: (line: Buffer, tlsSocket: TLSSocket) => void, + ): this; + once(event: string, listener: (...args: any[]) => void): this; + once( + event: "tlsClientError", + listener: (err: Error, tlsSocket: TLSSocket) => void, + ): this; + once( + event: "newSession", + listener: ( + sessionId: Buffer, + sessionData: Buffer, + callback: () => void, + ) => void, + ): this; + once( + event: "OCSPRequest", + listener: ( + certificate: Buffer, + issuer: Buffer, + callback: (err: Error | null, resp: Buffer) => void, + ) => void, + ): this; + once( + event: "resumeSession", + listener: ( + sessionId: Buffer, + callback: (err: Error | null, sessionData: Buffer | null) => void, + ) => void, + ): this; + once( + event: "secureConnection", + listener: (tlsSocket: TLSSocket) => void, + ): this; + once( + event: "keylog", + listener: (line: Buffer, tlsSocket: TLSSocket) => void, + ): this; + prependListener(event: string, listener: (...args: any[]) => void): this; + prependListener( + event: "tlsClientError", + listener: (err: Error, tlsSocket: TLSSocket) => void, + ): this; + prependListener( + event: "newSession", + listener: ( + sessionId: Buffer, + sessionData: Buffer, + callback: () => void, + ) => void, + ): this; + prependListener( + event: "OCSPRequest", + listener: ( + certificate: Buffer, + issuer: Buffer, + callback: (err: Error | null, resp: Buffer) => void, + ) => void, + ): this; + prependListener( + event: "resumeSession", + listener: ( + sessionId: Buffer, + callback: (err: Error | null, sessionData: Buffer | null) => void, + ) => void, + ): this; + prependListener( + event: "secureConnection", + listener: (tlsSocket: TLSSocket) => void, + ): this; + prependListener( + event: "keylog", + listener: (line: Buffer, tlsSocket: TLSSocket) => void, + ): this; + prependOnceListener( + event: string, + listener: (...args: any[]) => void, + ): this; + prependOnceListener( + event: "tlsClientError", + listener: (err: Error, tlsSocket: TLSSocket) => void, + ): this; + prependOnceListener( + event: "newSession", + listener: ( + sessionId: Buffer, + sessionData: Buffer, + callback: () => void, + ) => void, + ): this; + prependOnceListener( + event: "OCSPRequest", + listener: ( + certificate: Buffer, + issuer: Buffer, + callback: (err: Error | null, resp: Buffer) => void, + ) => void, + ): this; + prependOnceListener( + event: "resumeSession", + listener: ( + sessionId: Buffer, + callback: (err: Error | null, sessionData: Buffer | null) => void, + ) => void, + ): this; + prependOnceListener( + event: "secureConnection", + listener: (tlsSocket: TLSSocket) => void, + ): this; + prependOnceListener( + event: "keylog", + listener: (line: Buffer, tlsSocket: TLSSocket) => void, + ): this; + } /** * @deprecated since v0.11.3 Use `tls.TLSSocket` instead. */ @@ -860,7 +860,7 @@ declare module "tls" { * the well-known CAs curated by Mozilla. Mozilla's CAs are completely * replaced when CAs are explicitly specified using this option. */ - // ca?: string | Buffer | Array<string | Buffer> | undefined; + ca?: string | Buffer | Array<string | Buffer> | undefined; /** * Cert chains in PEM format. One cert chain should be provided per * private key. Each cert chain should consist of the PEM formatted @@ -872,7 +872,7 @@ declare module "tls" { * intermediate certificates are not provided, the peer will not be * able to validate the certificate, and the handshake will fail. */ - // cert?: string | Buffer | Array<string | Buffer> | undefined; + cert?: string | Buffer | Array<string | Buffer> | undefined; /** * Colon-separated list of supported signature algorithms. The list * can contain digest algorithms (SHA256, MD5 etc.), public key @@ -886,7 +886,7 @@ declare module "tls" { * ciphers can be obtained via tls.getCiphers(). Cipher names must be * uppercased in order for OpenSSL to accept them. */ - // ciphers?: string | undefined; + ciphers?: string | undefined; /** * Name of an OpenSSL engine which can provide the client certificate. */ @@ -930,7 +930,7 @@ declare module "tls" { * object.passphrase is optional. Encrypted keys will be decrypted with * object.passphrase if provided, or options.passphrase if it is not. */ - // key?: string | Buffer | Array<string | Buffer | KeyObject> | undefined; + key?: string | Buffer | Array<string | Buffer | KeyObject> | undefined; /** * Name of an OpenSSL engine to get private key from. Should be used * together with privateKeyIdentifier. @@ -965,7 +965,7 @@ declare module "tls" { /** * Shared passphrase used for a single private key and/or a PFX. */ - // passphrase?: string | undefined; + passphrase?: string | undefined; /** * PFX or PKCS12 encoded private key and certificate chain. pfx is an * alternative to providing key and cert individually. PFX is usually @@ -982,7 +982,7 @@ declare module "tls" { * usually necessary. This should be used carefully if at all! Value is * a numeric bitmask of the SSL_OP_* options from OpenSSL Options */ - // secureOptions?: number | undefined; // Value is a numeric bitmask of the `SSL_OP_*` options + secureOptions?: number | undefined; // Value is a numeric bitmask of the `SSL_OP_*` options /** * Legacy mechanism to select the TLS protocol version to use, it does * not support independent control of the minimum and maximum version, @@ -1081,13 +1081,13 @@ declare module "tls" { * The server can be tested by connecting to it using the example client from {@link connect}. * @since v0.3.2 */ - // function createServer( - // secureConnectionListener?: (socket: TLSSocket) => void, - // ): Server; - // function createServer( - // options: TlsOptions, - // secureConnectionListener?: (socket: TLSSocket) => void, - // ): Server; + function createServer( + secureConnectionListener?: (socket: TLSSocket) => void, + ): Server; + function createServer( + options: TlsOptions, + secureConnectionListener?: (socket: TLSSocket) => void, + ): Server; /** * The `callback` function, if specified, will be added as a listener for the `'secureConnect'` event. * diff --git a/src/bun.js/api/bun/socket.zig b/src/bun.js/api/bun/socket.zig index bc2b65a09..3fa022907 100644 --- a/src/bun.js/api/bun/socket.zig +++ b/src/bun.js/api/bun/socket.zig @@ -77,6 +77,7 @@ const Handlers = struct { onConnectError: JSC.JSValue = .zero, onEnd: JSC.JSValue = .zero, onError: JSC.JSValue = .zero, + onHandshake: JSC.JSValue = .zero, binary_type: BinaryType = .Buffer, @@ -157,6 +158,7 @@ const Handlers = struct { .{ "onConnectError", "connectError" }, .{ "onEnd", "end" }, .{ "onError", "error" }, + .{ "onHandshake", "handshake" }, }; inline for (pairs) |pair| { if (opts.getTruthy(globalObject, pair.@"1")) |callback_value| { @@ -198,6 +200,7 @@ const Handlers = struct { this.onConnectError.unprotect(); this.onEnd.unprotect(); this.onError.unprotect(); + this.onHandshake.unprotect(); } pub fn protect(this: *Handlers) void { @@ -209,6 +212,7 @@ const Handlers = struct { this.onConnectError.protect(); this.onEnd.protect(); this.onError.protect(); + this.onHandshake.protect(); } }; @@ -446,24 +450,12 @@ pub const Listener = struct { const socket_flags: i32 = if (exclusive) 1 else 0; - const ctx_opts: uws.us_socket_context_options_t = brk: { - var sock_ctx: uws.us_socket_context_options_t = undefined; - @memset(@ptrCast([*]u8, &sock_ctx), 0, @sizeOf(uws.us_socket_context_options_t)); - - if (ssl) |ssl_config| { - sock_ctx.key_file_name = ssl_config.key_file_name; - sock_ctx.cert_file_name = ssl_config.cert_file_name; - sock_ctx.ca_file_name = ssl_config.ca_file_name; - sock_ctx.dh_params_file_name = ssl_config.dh_params_file_name; - sock_ctx.passphrase = ssl_config.passphrase; - sock_ctx.ssl_prefer_low_memory_usage = @boolToInt(ssl_config.low_memory_mode); - } - break :brk sock_ctx; - }; + const ctx_opts: uws.us_bun_socket_context_options_t = JSC.API.ServerConfig.SSLConfig.asUSockets(ssl); + defer if (ssl != null) ssl.?.deinit(); globalObject.bunVM().eventLoop().ensureWaker(); - var socket_context = uws.us_create_socket_context( + var socket_context = uws.us_create_bun_socket_context( @boolToInt(ssl_enabled), uws.Loop.get().?, @sizeOf(usize), @@ -501,6 +493,7 @@ pub const Listener = struct { pub const onTimeout = NewSocket(true).onTimeout; pub const onConnectError = NewSocket(true).onConnectError; pub const onEnd = NewSocket(true).onEnd; + pub const onHandshake = NewSocket(true).onHandshake; }, ); } else { @@ -517,6 +510,7 @@ pub const Listener = struct { pub const onTimeout = NewSocket(false).onTimeout; pub const onConnectError = NewSocket(false).onConnectError; pub const onEnd = NewSocket(false).onEnd; + pub const onHandshake = NewSocket(false).onHandshake; }, ); } @@ -592,8 +586,11 @@ pub const Listener = struct { } if (ssl) |ssl_config| { - if (bun.asByteSlice(ssl_config.server_name).len > 0) - uws.us_socket_context_add_server_name(1, socket.socket_context, ssl_config.server_name, ctx_opts, null); + if (ssl_config.server_name) |server_name| { + const slice = bun.asByteSlice(server_name); + if (slice.len > 0) + uws.us_bun_socket_context_add_server_name(1, socket.socket_context, server_name, ctx_opts, null); + } } var this: *Listener = handlers.vm.allocator.create(Listener) catch @panic("OOM"); @@ -773,11 +770,11 @@ pub const Listener = struct { handlers.protect(); - const ctx_opts: uws.us_socket_context_options_t = JSC.API.ServerConfig.SSLConfig.asUSockets(socket_config.ssl); + const ctx_opts: uws.us_bun_socket_context_options_t = JSC.API.ServerConfig.SSLConfig.asUSockets(socket_config.ssl); globalObject.bunVM().eventLoop().ensureWaker(); - var socket_context = uws.us_create_socket_context(@boolToInt(ssl_enabled), uws.Loop.get().?, @sizeOf(usize), ctx_opts).?; + var socket_context = uws.us_create_bun_socket_context(@boolToInt(ssl_enabled), uws.Loop.get().?, @sizeOf(usize), ctx_opts).?; var connection: Listener.UnixOrHost = if (port) |port_| .{ .host = .{ .host = (hostname_or_unix.cloneIfNeeded(bun.default_allocator) catch unreachable).slice(), .port = port_ }, } else .{ @@ -797,6 +794,7 @@ pub const Listener = struct { pub const onTimeout = NewSocket(true).onTimeout; pub const onConnectError = NewSocket(true).onConnectError; pub const onEnd = NewSocket(true).onEnd; + pub const onHandshake = NewSocket(true).onHandshake; }, ); } else { @@ -812,6 +810,7 @@ pub const Listener = struct { pub const onTimeout = NewSocket(false).onTimeout; pub const onConnectError = NewSocket(false).onConnectError; pub const onEnd = NewSocket(false).onEnd; + pub const onHandshake = NewSocket(false).onHandshake; }, ); } @@ -892,12 +891,12 @@ fn NewSocket(comptime ssl: bool) type { poll_ref: JSC.PollRef = JSC.PollRef.init(), reffer: JSC.Ref = JSC.Ref.init(), last_4: [4]u8 = .{ 0, 0, 0, 0 }, + authorized: bool = false, // TODO: switch to something that uses `visitAggregate` and have the // `Listener` keep a list of all the sockets JSValue in there // This is wasteful because it means we are keeping a JSC::Weak for every single open socket has_pending_activity: std.atomic.Atomic(bool) = std.atomic.Atomic(bool).init(true), - const This = @This(); const log = Output.scoped(.Socket, false); const WriteResult = union(enum) { @@ -951,7 +950,6 @@ fn NewSocket(comptime ssl: bool) type { JSC.markBinding(@src()); log("onWritable", .{}); if (this.detached) return; - const handlers = this.handlers; const callback = handlers.onWritable; if (callback == .zero) return; @@ -1076,6 +1074,7 @@ fn NewSocket(comptime ssl: bool) type { const handlers = this.handlers; const callback = handlers.onOpen; + const handshake_callback = handlers.onHandshake; const globalObject = handlers.globalObject; const this_value = this.getThisValue(globalObject); @@ -1083,8 +1082,14 @@ fn NewSocket(comptime ssl: bool) type { this.markActive(); handlers.resolvePromise(this_value); - if (callback == .zero) return; - + if (comptime ssl) { + // only calls open callback if handshake callback is provided + // If handshake is provided, open is called on connection open + // If is not provided, open is called after handshake + if (callback == .zero or handshake_callback == .zero) return; + } else { + if (callback == .zero) return; + } const result = callback.callWithThis(globalObject, this_value, &[_]JSValue{ this_value, }); @@ -1137,6 +1142,63 @@ fn NewSocket(comptime ssl: bool) type { } } + pub fn onHandshake(this: *This, _: Socket, success: i32, ssl_error: uws.us_bun_verify_error_t) void { + JSC.markBinding(@src()); + + const authorized = if (success == 1) true else false; + + this.authorized = authorized; + + const handlers = this.handlers; + var callback = handlers.onHandshake; + var is_open = false; + + // Use open callback when handshake is not provided + if (callback == .zero) { + callback = handlers.onOpen; + if (callback == .zero) { + return; + } + is_open = true; + } + + const globalObject = handlers.globalObject; + const this_value = this.getThisValue(globalObject); + + var result: JSC.JSValue = JSC.JSValue.zero; + // open callback only have 1 parameters and its the socket + // you should use getAuthorizationError and authorized getter to get those values in this case + if (is_open) { + result = callback.callWithThis(globalObject, this_value, &[_]JSValue{this_value}); + } else { + // call handhsake callback with authorized and authorization error if has one + var authorization_error: JSValue = undefined; + if (ssl_error.error_no == 0) { + authorization_error = JSValue.jsNull(); + } else { + const code = if (ssl_error.code == null) "" else ssl_error.code[0..bun.len(ssl_error.code)]; + + const reason = if (ssl_error.reason == null) "" else ssl_error.reason[0..bun.len(ssl_error.reason)]; + + const fallback = JSC.SystemError{ + .code = ZigString.init(code), + .message = ZigString.init(reason), + }; + + authorization_error = fallback.toErrorInstance(globalObject); + } + result = callback.callWithThis(globalObject, this_value, &[_]JSValue{ + this_value, + JSValue.jsBoolean(authorized), + authorization_error, + }); + } + + if (result.toError()) |err_value| { + _ = handlers.callErrorHandler(this_value, &[_]JSC.JSValue{ this_value, err_value }); + } + } + pub fn onClose(this: *This, _: Socket, err: c_int, _: ?*anyopaque) void { JSC.markBinding(@src()); log("onClose", .{}); @@ -1232,6 +1294,13 @@ fn NewSocket(comptime ssl: bool) type { } } + pub fn getAuthorized( + this: *This, + _: *JSC.JSGlobalObject, + ) callconv(.C) JSValue { + log("getAuthorized()", .{}); + return JSValue.jsBoolean(this.authorized); + } pub fn timeout( this: *This, globalObject: *JSC.JSGlobalObject, @@ -1255,6 +1324,36 @@ fn NewSocket(comptime ssl: bool) type { return JSValue.jsUndefined(); } + pub fn getAuthorizationError( + this: *This, + globalObject: *JSC.JSGlobalObject, + _: *JSC.CallFrame, + ) callconv(.C) JSValue { + JSC.markBinding(@src()); + + if (this.detached) { + return JSValue.jsNull(); + } + + // this error can change if called in different stages of hanshake + // is very usefull to have this feature depending on the user workflow + const ssl_error = this.socket.verifyError(); + if (ssl_error.error_no == 0) { + return JSValue.jsNull(); + } + + const code = if (ssl_error.code == null) "" else ssl_error.code[0..bun.len(ssl_error.code)]; + + const reason = if (ssl_error.reason == null) "" else ssl_error.reason[0..bun.len(ssl_error.reason)]; + + const fallback = JSC.SystemError{ + .code = ZigString.init(code), + .message = ZigString.init(reason), + }; + + return fallback.toErrorInstance(globalObject); + } + pub fn write( this: *This, globalObject: *JSC.JSGlobalObject, @@ -1350,7 +1449,10 @@ fn NewSocket(comptime ssl: bool) type { } } - if (slice.len == 0) return .{ .success = .{} }; + // sending empty can be used to ensure that we'll cycle through internal openssl's state + if (comptime ssl == false) { + if (slice.len == 0) return .{ .success = .{} }; + } return .{ .success = .{ @@ -1408,7 +1510,10 @@ fn NewSocket(comptime ssl: bool) type { } } - if (slice.len == 0) return .{ .success = .{} }; + // sending empty can be used to ensure that we'll cycle through internal openssl's state + if (comptime ssl == false) { + if (slice.len == 0) return .{ .success = .{} }; + } return .{ .success = .{ @@ -1446,7 +1551,10 @@ fn NewSocket(comptime ssl: bool) type { } } - if (slice.len == 0) return .{ .success = .{} }; + // sending empty can be used to ensure that we'll cycle through internal openssl's state + if (comptime ssl == false) { + if (slice.len == 0) return .{ .success = .{} }; + } return .{ .success = .{ diff --git a/src/bun.js/api/server.zig b/src/bun.js/api/server.zig index ed26ea3a7..11237844a 100644 --- a/src/bun.js/api/server.zig +++ b/src/bun.js/api/server.zig @@ -121,9 +121,25 @@ pub const ServerConfig = struct { passphrase: [*c]const u8 = null, low_memory_mode: bool = false, - pub fn asUSockets(this_: ?SSLConfig) uws.us_socket_context_options_t { - var ctx_opts: uws.us_socket_context_options_t = undefined; - @memset(@ptrCast([*]u8, &ctx_opts), 0, @sizeOf(uws.us_socket_context_options_t)); + key: ?[][*c]const u8 = null, + key_count: u32 = 0, + + cert: ?[][*c]const u8 = null, + cert_count: u32 = 0, + + ca: ?[][*c]const u8 = null, + ca_count: u32 = 0, + + secure_options: u32 = 0, + request_cert: i32 = 0, + reject_unauthorized: i32 = 0, + ssl_ciphers: [*c]const u8 = null, + + const log = Output.scoped(.SSLConfig, false); + + pub fn asUSockets(this_: ?SSLConfig) uws.us_bun_socket_context_options_t { + var ctx_opts: uws.us_bun_socket_context_options_t = undefined; + @memset(@ptrCast([*]u8, &ctx_opts), 0, @sizeOf(uws.us_bun_socket_context_options_t)); if (this_) |ssl_config| { if (ssl_config.key_file_name != null) @@ -137,6 +153,25 @@ pub const ServerConfig = struct { if (ssl_config.passphrase != null) ctx_opts.passphrase = ssl_config.passphrase; ctx_opts.ssl_prefer_low_memory_usage = @boolToInt(ssl_config.low_memory_mode); + + if (ssl_config.key) |key| { + ctx_opts.key = key.ptr; + ctx_opts.key_count = ssl_config.key_count; + } + if (ssl_config.cert) |cert| { + ctx_opts.cert = cert.ptr; + ctx_opts.cert_count = ssl_config.cert_count; + } + if (ssl_config.ca) |ca| { + ctx_opts.ca = ca.ptr; + ctx_opts.ca_count = ssl_config.ca_count; + } + + if (ssl_config.ssl_ciphers != null) { + ctx_opts.ssl_ciphers = ssl_config.ssl_ciphers; + } + ctx_opts.request_cert = ssl_config.request_cert; + ctx_opts.reject_unauthorized = ssl_config.reject_unauthorized; } return ctx_opts; @@ -150,6 +185,7 @@ pub const ServerConfig = struct { "ca_file_name", "dh_params_file_name", "passphrase", + "ssl_ciphers", }; inline for (fields) |field| { @@ -160,6 +196,45 @@ pub const ServerConfig = struct { } } } + + if (this.cert) |cert| { + var i: u32 = 0; + while (i < this.cert_count) : (i += 1) { + const slice = std.mem.span(cert[i]); + if (slice.len > 0) { + bun.default_allocator.free(slice); + } + } + + bun.default_allocator.free(cert); + this.cert = null; + } + + if (this.key) |key| { + var i: u32 = 0; + while (i < this.key_count) : (i += 1) { + const slice = std.mem.span(key[i]); + if (slice.len > 0) { + bun.default_allocator.free(slice); + } + } + + bun.default_allocator.free(key); + this.key = null; + } + + if (this.ca) |ca| { + var i: u32 = 0; + while (i < this.ca_count) : (i += 1) { + const slice = std.mem.span(ca[i]); + if (slice.len > 0) { + bun.default_allocator.free(slice); + } + } + + bun.default_allocator.free(ca); + this.ca = null; + } } pub const zero = SSLConfig{}; @@ -183,6 +258,52 @@ pub const ServerConfig = struct { any = true; } } + + if (obj.getTruthy(global, "key")) |js_obj| { + if (js_obj.jsType().isArray()) { + const count = js_obj.getLengthOfArray(global); + if (count > 0) { + const native_array = bun.default_allocator.alloc([*c]const u8, count) catch unreachable; + + var i: u32 = 0; + var valid_count: u32 = 0; + var arena: std.heap.ArenaAllocator = std.heap.ArenaAllocator.init(bun.default_allocator); + while (i < count) : (i += 1) { + const item = js_obj.getIndex(global, i); + if (JSC.Node.StringOrBuffer.fromJS(global, arena.allocator(), item, exception)) |sb| { + const sliced = sb.slice(); + if (sliced.len > 0) { + native_array[valid_count] = bun.default_allocator.dupeZ(u8, sliced) catch unreachable; + valid_count += 1; + any = true; + } + } else { + global.throwInvalidArguments("key argument must be an array containing string, Buffer or TypedArray", .{}); + arena.deinit(); + // mark and free all keys + result.key = native_array; + result.deinit(); + return null; + } + } + + arena.deinit(); + + if (valid_count == 0) { + bun.default_allocator.free(native_array); + } else { + result.key = native_array; + } + + result.key_count = valid_count; + } + } else { + global.throwInvalidArguments("key argument must be an array containing string, Buffer or TypedArray", .{}); + result.deinit(); + return null; + } + } + if (obj.getTruthy(global, "certFile")) |cert_file_name| { var sliced = cert_file_name.toSlice(global, bun.default_allocator); defer sliced.deinit(); @@ -197,8 +318,77 @@ pub const ServerConfig = struct { } } + if (obj.getTruthy(global, "cert")) |js_obj| { + if (js_obj.jsType().isArray()) { + const count = js_obj.getLengthOfArray(global); + if (count > 0) { + const native_array = bun.default_allocator.alloc([*c]const u8, count) catch unreachable; + + var i: u32 = 0; + var valid_count: u32 = 0; + + var arena: std.heap.ArenaAllocator = std.heap.ArenaAllocator.init(bun.default_allocator); + while (i < count) : (i += 1) { + const item = js_obj.getIndex(global, i); + if (JSC.Node.StringOrBuffer.fromJS(global, arena.allocator(), item, exception)) |sb| { + const sliced = sb.slice(); + if (sliced.len > 0) { + native_array[valid_count] = bun.default_allocator.dupeZ(u8, sliced) catch unreachable; + valid_count += 1; + any = true; + } + } else { + global.throwInvalidArguments("cert argument must be an array containing string, Buffer or TypedArray", .{}); + arena.deinit(); + // mark and free all certs + result.cert = native_array; + result.deinit(); + return null; + } + } + + arena.deinit(); + + if (valid_count == 0) { + bun.default_allocator.free(native_array); + } else { + result.cert = native_array; + } + + result.cert_count = valid_count; + } + } else { + global.throwInvalidArguments("cert argument must be an array containing string, Buffer or TypedArray", .{}); + result.deinit(); + return null; + } + } + + if (obj.getTruthy(global, "requestCert")) |request_cert| { + result.request_cert = if (request_cert.asBoolean()) 1 else 0; + } + + if (obj.getTruthy(global, "rejectUnauthorized")) |reject_unauthorized| { + result.reject_unauthorized = if (reject_unauthorized.asBoolean()) 1 else 0; + } + + if (obj.getTruthy(global, "ciphers")) |ssl_ciphers| { + var sliced = ssl_ciphers.toSlice(global, bun.default_allocator); + defer sliced.deinit(); + if (sliced.len > 0) { + result.ssl_ciphers = bun.default_allocator.dupeZ(u8, sliced.slice()) catch unreachable; + any = true; + } + } + // Optional if (any) { + if (obj.getTruthy(global, "secureOptions")) |secure_options| { + if (secure_options.isNumber()) { + result.secure_options = secure_options.toU32(); + } + } + if (obj.getTruthy(global, "serverName")) |key_file_name| { var sliced = key_file_name.toSlice(global, bun.default_allocator); defer sliced.deinit(); @@ -207,6 +397,52 @@ pub const ServerConfig = struct { } } + if (obj.getTruthy(global, "ca")) |js_obj| { + if (js_obj.jsType().isArray()) { + const count = js_obj.getLengthOfArray(global); + if (count > 0) { + const native_array = bun.default_allocator.alloc([*c]const u8, count) catch unreachable; + + var i: u32 = 0; + var valid_count: u32 = 0; + + var arena: std.heap.ArenaAllocator = std.heap.ArenaAllocator.init(bun.default_allocator); + while (i < count) : (i += 1) { + const item = js_obj.getIndex(global, i); + if (JSC.Node.StringOrBuffer.fromJS(global, arena.allocator(), item, exception)) |sb| { + const sliced = sb.slice(); + if (sliced.len > 0) { + native_array[valid_count] = bun.default_allocator.dupeZ(u8, sliced) catch unreachable; + valid_count += 1; + any = true; + } + } else { + global.throwInvalidArguments("ca argument must be an array containing string, Buffer or TypedArray", .{}); + arena.deinit(); + // mark and free all CA's + result.cert = native_array; + result.deinit(); + return null; + } + } + + arena.deinit(); + + if (valid_count == 0) { + bun.default_allocator.free(native_array); + } else { + result.ca = native_array; + } + + result.ca_count = valid_count; + } + } else { + global.throwInvalidArguments("cert argument must be an array containing string, Buffer or TypedArray", .{}); + result.deinit(); + return null; + } + } + if (obj.getTruthy(global, "caFile")) |ca_file_name| { var sliced = ca_file_name.toSlice(global, bun.default_allocator); defer sliced.deinit(); @@ -219,6 +455,7 @@ pub const ServerConfig = struct { } } } + if (obj.getTruthy(global, "dhParamsFile")) |dh_params_file_name| { var sliced = dh_params_file_name.toSlice(global, bun.default_allocator); defer sliced.deinit(); diff --git a/src/bun.js/api/sockets.classes.ts b/src/bun.js/api/sockets.classes.ts index eb59e6fc6..da07741a3 100644 --- a/src/bun.js/api/sockets.classes.ts +++ b/src/bun.js/api/sockets.classes.ts @@ -8,6 +8,13 @@ function generate(ssl) { noConstructor: true, configurable: false, proto: { + getAuthorizationError: { + fn: "getAuthorizationError", + length: 0, + }, + authorized: { + getter: "getAuthorized", + }, write: { fn: "write", length: 3, diff --git a/src/bun.js/bindings/ZigGeneratedClasses.cpp b/src/bun.js/bindings/ZigGeneratedClasses.cpp index cd263dce4..6496c281b 100644 --- a/src/bun.js/bindings/ZigGeneratedClasses.cpp +++ b/src/bun.js/bindings/ZigGeneratedClasses.cpp @@ -23,130 +23,151 @@ #include "JSDOMConvertBufferSource.h" #include "ZigGeneratedClasses.h" -namespace WebCore { -using namespace JSC; -using namespace Zig; -class JSBlobPrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - static JSBlobPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSBlobPrototype* ptr = new (NotNull, JSC::allocateCell<JSBlobPrototype>(vm)) JSBlobPrototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } +namespace WebCore { - DECLARE_INFO; - template<typename CellType, JSC::SubspaceAccess> - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } +using namespace JSC; +using namespace Zig; -private: - JSBlobPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; + class JSBlobPrototype final : public JSC::JSNonFinalObject { + public: + using Base = JSC::JSNonFinalObject; + + static JSBlobPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) + { + JSBlobPrototype* ptr = new (NotNull, JSC::allocateCell<JSBlobPrototype>(vm)) JSBlobPrototype(vm, globalObject, structure); + ptr->finishCreation(vm, globalObject); + return ptr; + } + + DECLARE_INFO; + template<typename CellType, JSC::SubspaceAccess> + static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + return &vm.plainObjectSpace(); + } + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); + } + + private: + JSBlobPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) + : Base(vm, structure) + { + } + + void finishCreation(JSC::VM&, JSC::JSGlobalObject*); + }; class JSBlobConstructor final : public JSC::InternalFunction { -public: - using Base = JSC::InternalFunction; - static JSBlobConstructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSBlobPrototype* prototype); - - static constexpr unsigned StructureFlags = Base::StructureFlags; - static constexpr bool needsDestruction = false; - - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); - } - - template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl<JSBlobConstructor, WebCore::UseCustomHeapCellType::No>( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForBlobConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForBlobConstructor = std::forward<decltype(space)>(space); }, - [](auto& spaces) { return spaces.m_subspaceForBlobConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForBlobConstructor = std::forward<decltype(space)>(space); }); - } - - void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSBlobPrototype* prototype); + public: + using Base = JSC::InternalFunction; + static JSBlobConstructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSBlobPrototype* prototype); + + static constexpr unsigned StructureFlags = Base::StructureFlags; + static constexpr bool needsDestruction = false; + + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); + } + + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return WebCore::subspaceForImpl<JSBlobConstructor, WebCore::UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForBlobConstructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForBlobConstructor = std::forward<decltype(space)>(space); }, + [](auto& spaces) { return spaces.m_subspaceForBlobConstructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForBlobConstructor = std::forward<decltype(space)>(space); }); + } + + + void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSBlobPrototype* prototype); + + // Must be defined for each specialization class. + static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); + + DECLARE_EXPORT_INFO; + private: + JSBlobConstructor(JSC::VM& vm, JSC::Structure* structure); + void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSBlobPrototype* prototype); + }; - // Must be defined for each specialization class. - static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); - - DECLARE_EXPORT_INFO; - -private: - JSBlobConstructor(JSC::VM& vm, JSC::Structure* structure); - void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSBlobPrototype* prototype); -}; extern "C" void* BlobClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); JSC_DECLARE_CUSTOM_GETTER(jsBlobConstructor); extern "C" void BlobClass__finalize(void*); + extern "C" EncodedJSValue BlobPrototype__getArrayBuffer(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(BlobPrototype__arrayBufferCallback); + extern "C" EncodedJSValue BlobPrototype__getFormData(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(BlobPrototype__formDataCallback); + extern "C" EncodedJSValue BlobPrototype__getJSON(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(BlobPrototype__jsonCallback); + extern "C" JSC::EncodedJSValue BlobPrototype__getLastModified(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(BlobPrototype__lastModifiedGetterWrap); + extern "C" JSC::EncodedJSValue BlobPrototype__getSize(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(BlobPrototype__sizeGetterWrap); + extern "C" EncodedJSValue BlobPrototype__getSlice(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(BlobPrototype__sliceCallback); + extern "C" EncodedJSValue BlobPrototype__getStream(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(BlobPrototype__streamCallback); + extern "C" EncodedJSValue BlobPrototype__getText(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(BlobPrototype__textCallback); + extern "C" JSC::EncodedJSValue BlobPrototype__getType(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(BlobPrototype__typeGetterWrap); + extern "C" EncodedJSValue BlobPrototype__getWriter(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(BlobPrototype__writerCallback); + STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSBlobPrototype, JSBlobPrototype::Base); -static const HashTableValue JSBlobPrototypeTableValues[] = { - { "arrayBuffer"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, BlobPrototype__arrayBufferCallback, 0 } }, - { "formData"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, BlobPrototype__formDataCallback, 0 } }, - { "json"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, BlobPrototype__jsonCallback, 0 } }, - { "lastModified"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, BlobPrototype__lastModifiedGetterWrap, 0 } }, - { "size"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, BlobPrototype__sizeGetterWrap, 0 } }, - { "slice"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, BlobPrototype__sliceCallback, 2 } }, - { "stream"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, BlobPrototype__streamCallback, 1 } }, - { "text"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, BlobPrototype__textCallback, 0 } }, - { "type"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, BlobPrototype__typeGetterWrap, 0 } }, - { "writer"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, BlobPrototype__writerCallback, 1 } } + + static const HashTableValue JSBlobPrototypeTableValues[] = { +{ "arrayBuffer"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, BlobPrototype__arrayBufferCallback, 0 } } , +{ "formData"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, BlobPrototype__formDataCallback, 0 } } , +{ "json"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, BlobPrototype__jsonCallback, 0 } } , +{ "lastModified"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, BlobPrototype__lastModifiedGetterWrap, 0 } } , +{ "size"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, BlobPrototype__sizeGetterWrap, 0 } } , +{ "slice"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, BlobPrototype__sliceCallback, 2 } } , +{ "stream"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, BlobPrototype__streamCallback, 1 } } , +{ "text"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, BlobPrototype__textCallback, 0 } } , +{ "type"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, BlobPrototype__typeGetterWrap, 0 } } , +{ "writer"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, BlobPrototype__writerCallback, 1 } } }; + + const ClassInfo JSBlobPrototype::s_info = { "Blob"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSBlobPrototype) }; + + JSC_DEFINE_CUSTOM_GETTER(jsBlobConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); @@ -157,60 +178,65 @@ JSC_DEFINE_CUSTOM_GETTER(jsBlobConstructor, (JSGlobalObject * lexicalGlobalObjec if (UNLIKELY(!prototype)) return throwVMTypeError(lexicalGlobalObject, throwScope); return JSValue::encode(globalObject->JSBlobConstructor()); -} +} + -JSC_DEFINE_HOST_FUNCTION(BlobPrototype__arrayBufferCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - JSBlob* thisObject = jsDynamicCast<JSBlob*>(callFrame->thisValue()); + JSC_DEFINE_HOST_FUNCTION(BlobPrototype__arrayBufferCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + JSBlob* thisObject = jsDynamicCast<JSBlob*>(callFrame->thisValue()); + + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } + + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + + return BlobPrototype__getArrayBuffer(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(BlobPrototype__formDataCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return BlobPrototype__getArrayBuffer(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSBlob* thisObject = jsDynamicCast<JSBlob*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(BlobPrototype__formDataCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSBlob* thisObject = jsDynamicCast<JSBlob*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return BlobPrototype__getFormData(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(BlobPrototype__jsonCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return BlobPrototype__getFormData(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSBlob* thisObject = jsDynamicCast<JSBlob*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(BlobPrototype__jsonCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSBlob* thisObject = jsDynamicCast<JSBlob*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return BlobPrototype__getJSON(thisObject->wrapped(), lexicalGlobalObject, callFrame); } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - return BlobPrototype__getJSON(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSC_DEFINE_CUSTOM_GETTER(BlobPrototype__lastModifiedGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSBlob* thisObject = jsCast<JSBlob*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -218,11 +244,12 @@ JSC_DEFINE_CUSTOM_GETTER(BlobPrototype__lastModifiedGetterWrap, (JSGlobalObject RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + JSC_DEFINE_CUSTOM_GETTER(BlobPrototype__sizeGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSBlob* thisObject = jsCast<JSBlob*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -230,59 +257,63 @@ JSC_DEFINE_CUSTOM_GETTER(BlobPrototype__sizeGetterWrap, (JSGlobalObject * lexica RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + -JSC_DEFINE_HOST_FUNCTION(BlobPrototype__sliceCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + JSC_DEFINE_HOST_FUNCTION(BlobPrototype__sliceCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - JSBlob* thisObject = jsDynamicCast<JSBlob*>(callFrame->thisValue()); + JSBlob* thisObject = jsDynamicCast<JSBlob*>(callFrame->thisValue()); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } + + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + + return BlobPrototype__getSlice(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(BlobPrototype__streamCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return BlobPrototype__getSlice(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSBlob* thisObject = jsDynamicCast<JSBlob*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(BlobPrototype__streamCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSBlob* thisObject = jsDynamicCast<JSBlob*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return BlobPrototype__getStream(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(BlobPrototype__textCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return BlobPrototype__getStream(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSBlob* thisObject = jsDynamicCast<JSBlob*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(BlobPrototype__textCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSBlob* thisObject = jsDynamicCast<JSBlob*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return BlobPrototype__getText(thisObject->wrapped(), lexicalGlobalObject, callFrame); } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - return BlobPrototype__getText(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSC_DEFINE_CUSTOM_GETTER(BlobPrototype__typeGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSBlob* thisObject = jsCast<JSBlob*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -290,22 +321,24 @@ JSC_DEFINE_CUSTOM_GETTER(BlobPrototype__typeGetterWrap, (JSGlobalObject * lexica RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + -JSC_DEFINE_HOST_FUNCTION(BlobPrototype__writerCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + JSC_DEFINE_HOST_FUNCTION(BlobPrototype__writerCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - JSBlob* thisObject = jsDynamicCast<JSBlob*>(callFrame->thisValue()); + JSBlob* thisObject = jsDynamicCast<JSBlob*>(callFrame->thisValue()); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return BlobPrototype__getWriter(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + return BlobPrototype__getWriter(thisObject->wrapped(), lexicalGlobalObject, callFrame); + } + void JSBlobPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) { @@ -317,64 +350,67 @@ void JSBlobPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObj void JSBlobConstructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSBlobPrototype* prototype) { Base::finishCreation(vm, 0, "Blob"_s, PropertyAdditionMode::WithoutStructureTransition); - + putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly); ASSERT(inherits(info())); } -JSBlobConstructor::JSBlobConstructor(JSC::VM& vm, JSC::Structure* structure) - : Base(vm, structure, construct, construct) -{ -} +JSBlobConstructor::JSBlobConstructor(JSC::VM& vm, JSC::Structure* structure) : Base(vm, structure, construct, construct) { -JSBlobConstructor* JSBlobConstructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSBlobPrototype* prototype) -{ + } + +JSBlobConstructor* JSBlobConstructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSBlobPrototype* prototype) { JSBlobConstructor* ptr = new (NotNull, JSC::allocateCell<JSBlobConstructor>(vm)) JSBlobConstructor(vm, structure); ptr->finishCreation(vm, globalObject, prototype); return ptr; } + JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSBlobConstructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) { - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); - JSC::VM& vm = globalObject->vm(); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + JSC::VM &vm = globalObject->vm(); JSObject* newTarget = asObject(callFrame->newTarget()); auto* constructor = globalObject->JSBlobConstructor(); Structure* structure = globalObject->JSBlobStructure(); if (constructor != newTarget) { - auto scope = DECLARE_THROW_SCOPE(vm); + auto scope = DECLARE_THROW_SCOPE(vm); - auto* functionGlobalObject = reinterpret_cast<Zig::GlobalObject*>( - // ShadowRealm functions belong to a different global object. - getFunctionRealm(globalObject, newTarget)); - RETURN_IF_EXCEPTION(scope, {}); - structure = InternalFunction::createSubclassStructure( - globalObject, - newTarget, - functionGlobalObject->JSBlobStructure()); + auto* functionGlobalObject = reinterpret_cast<Zig::GlobalObject*>( + // ShadowRealm functions belong to a different global object. + getFunctionRealm(globalObject, newTarget) + ); + RETURN_IF_EXCEPTION(scope, {}); + structure = InternalFunction::createSubclassStructure( + globalObject, + newTarget, + functionGlobalObject->JSBlobStructure() + ); } void* ptr = BlobClass__construct(globalObject, callFrame); if (UNLIKELY(!ptr)) { - return JSValue::encode(JSC::jsUndefined()); + return JSValue::encode(JSC::jsUndefined()); } JSBlob* instance = JSBlob::create(vm, globalObject, structure, ptr); + return JSValue::encode(instance); } void JSBlobConstructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSBlobPrototype* prototype) { + } const ClassInfo JSBlobConstructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSBlobConstructor) }; -extern "C" EncodedJSValue Blob__getConstructor(Zig::GlobalObject* globalObject) -{ + + extern "C" EncodedJSValue Blob__getConstructor(Zig::GlobalObject* globalObject) { return JSValue::encode(globalObject->JSBlobConstructor()); -} + } JSBlob::~JSBlob() { @@ -386,7 +422,7 @@ void JSBlob::destroy(JSCell* cell) { static_cast<JSBlob*>(cell)->JSBlob::~JSBlob(); } - + const ClassInfo JSBlob::s_info = { "Blob"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSBlob) }; void JSBlob::finishCreation(VM& vm) @@ -395,38 +431,37 @@ void JSBlob::finishCreation(VM& vm) ASSERT(inherits(info())); } -JSBlob* JSBlob::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSBlob* ptr = new (NotNull, JSC::allocateCell<JSBlob>(vm)) JSBlob(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} -extern "C" void* Blob__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; +JSBlob* JSBlob::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) { + JSBlob* ptr = new (NotNull, JSC::allocateCell<JSBlob>(vm)) JSBlob(vm, structure, ctx); + ptr->finishCreation(vm); + return ptr; +} - JSC::JSCell* cell = decodedValue.asCell(); - JSBlob* object = JSC::jsDynamicCast<JSBlob*>(cell); +extern "C" void* Blob__fromJS(JSC::EncodedJSValue value) { + JSC::JSValue decodedValue = JSC::JSValue::decode(value); + if (decodedValue.isEmpty() || !decodedValue.isCell()) + return nullptr; - if (!object) - return nullptr; + JSC::JSCell* cell = decodedValue.asCell(); + JSBlob* object = JSC::jsDynamicCast<JSBlob*>(cell); - return object->wrapped(); + if (!object) + return nullptr; + + return object->wrapped(); } -extern "C" bool Blob__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSBlob* object = JSC::jsDynamicCast<JSBlob*>(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; +extern "C" bool Blob__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) { + JSBlob* object = JSC::jsDynamicCast<JSBlob*>(JSValue::decode(value)); + if (!object) + return false; + + object->m_ctx = ptr; + return true; } + extern "C" const size_t Blob__ptrOffset = JSBlob::offsetOfWrapped(); void JSBlob::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) @@ -441,7 +476,7 @@ void JSBlob::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) JSObject* JSBlob::createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype) { - return WebCore::JSBlobConstructor::create(vm, globalObject, WebCore::JSBlobConstructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast<WebCore::JSBlobPrototype*>(prototype)); + return WebCore::JSBlobConstructor::create(vm, globalObject, WebCore::JSBlobConstructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast<WebCore::JSBlobPrototype*>(prototype)); } JSObject* JSBlob::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) @@ -449,109 +484,119 @@ JSObject* JSBlob::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) return JSBlobPrototype::create(vm, globalObject, JSBlobPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); } -extern "C" EncodedJSValue Blob__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSBlobStructure(); - JSBlob* instance = JSBlob::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} -class JSCryptoHasherPrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSCryptoHasherPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSCryptoHasherPrototype* ptr = new (NotNull, JSC::allocateCell<JSCryptoHasherPrototype>(vm)) JSCryptoHasherPrototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template<typename CellType, JSC::SubspaceAccess> - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSCryptoHasherPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; +extern "C" EncodedJSValue Blob__create(Zig::GlobalObject* globalObject, void* ptr) { + auto &vm = globalObject->vm(); + JSC::Structure* structure = globalObject->JSBlobStructure(); + JSBlob* instance = JSBlob::create(vm, globalObject, structure, ptr); + + return JSValue::encode(instance); +} + class JSCryptoHasherPrototype final : public JSC::JSNonFinalObject { + public: + using Base = JSC::JSNonFinalObject; + + static JSCryptoHasherPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) + { + JSCryptoHasherPrototype* ptr = new (NotNull, JSC::allocateCell<JSCryptoHasherPrototype>(vm)) JSCryptoHasherPrototype(vm, globalObject, structure); + ptr->finishCreation(vm, globalObject); + return ptr; + } + + DECLARE_INFO; + template<typename CellType, JSC::SubspaceAccess> + static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + return &vm.plainObjectSpace(); + } + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); + } + + private: + JSCryptoHasherPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) + : Base(vm, structure) + { + } + + void finishCreation(JSC::VM&, JSC::JSGlobalObject*); + }; class JSCryptoHasherConstructor final : public JSC::InternalFunction { -public: - using Base = JSC::InternalFunction; - static JSCryptoHasherConstructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSCryptoHasherPrototype* prototype); + public: + using Base = JSC::InternalFunction; + static JSCryptoHasherConstructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSCryptoHasherPrototype* prototype); + + static constexpr unsigned StructureFlags = Base::StructureFlags; + static constexpr bool needsDestruction = false; + + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); + } + + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return WebCore::subspaceForImpl<JSCryptoHasherConstructor, WebCore::UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForCryptoHasherConstructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForCryptoHasherConstructor = std::forward<decltype(space)>(space); }, + [](auto& spaces) { return spaces.m_subspaceForCryptoHasherConstructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForCryptoHasherConstructor = std::forward<decltype(space)>(space); }); + } + + + void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSCryptoHasherPrototype* prototype); + + // Must be defined for each specialization class. + static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); + + DECLARE_EXPORT_INFO; + private: + JSCryptoHasherConstructor(JSC::VM& vm, JSC::Structure* structure); + void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSCryptoHasherPrototype* prototype); + }; - static constexpr unsigned StructureFlags = Base::StructureFlags; - static constexpr bool needsDestruction = false; - - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); - } - - template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl<JSCryptoHasherConstructor, WebCore::UseCustomHeapCellType::No>( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForCryptoHasherConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForCryptoHasherConstructor = std::forward<decltype(space)>(space); }, - [](auto& spaces) { return spaces.m_subspaceForCryptoHasherConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForCryptoHasherConstructor = std::forward<decltype(space)>(space); }); - } - - void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSCryptoHasherPrototype* prototype); - - // Must be defined for each specialization class. - static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); - - DECLARE_EXPORT_INFO; - -private: - JSCryptoHasherConstructor(JSC::VM& vm, JSC::Structure* structure); - void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSCryptoHasherPrototype* prototype); -}; extern "C" void* CryptoHasherClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); JSC_DECLARE_CUSTOM_GETTER(jsCryptoHasherConstructor); extern "C" void CryptoHasherClass__finalize(void*); + extern "C" JSC::EncodedJSValue CryptoHasherPrototype__getAlgorithm(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(CryptoHasherPrototype__algorithmGetterWrap); + extern "C" JSC::EncodedJSValue CryptoHasherPrototype__getByteLength(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(CryptoHasherPrototype__byteLengthGetterWrap); + extern "C" EncodedJSValue CryptoHasherPrototype__digest(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(CryptoHasherPrototype__digestCallback); + extern "C" EncodedJSValue CryptoHasherPrototype__update(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(CryptoHasherPrototype__updateCallback); + STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSCryptoHasherPrototype, JSCryptoHasherPrototype::Base); -static const HashTableValue JSCryptoHasherPrototypeTableValues[] = { - { "algorithm"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, CryptoHasherPrototype__algorithmGetterWrap, 0 } }, - { "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, CryptoHasherPrototype__byteLengthGetterWrap, 0 } }, - { "digest"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, CryptoHasherPrototype__digestCallback, 0 } }, - { "update"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, CryptoHasherPrototype__updateCallback, 2 } } + + static const HashTableValue JSCryptoHasherPrototypeTableValues[] = { +{ "algorithm"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, CryptoHasherPrototype__algorithmGetterWrap, 0 } } , +{ "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, CryptoHasherPrototype__byteLengthGetterWrap, 0 } } , +{ "digest"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, CryptoHasherPrototype__digestCallback, 0 } } , +{ "update"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, CryptoHasherPrototype__updateCallback, 2 } } }; + + const ClassInfo JSCryptoHasherPrototype::s_info = { "CryptoHasher"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSCryptoHasherPrototype) }; + + JSC_DEFINE_CUSTOM_GETTER(jsCryptoHasherConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); @@ -562,43 +607,49 @@ JSC_DEFINE_CUSTOM_GETTER(jsCryptoHasherConstructor, (JSGlobalObject * lexicalGlo if (UNLIKELY(!prototype)) return throwVMTypeError(lexicalGlobalObject, throwScope); return JSValue::encode(globalObject->JSCryptoHasherConstructor()); -} +} + + JSC_DEFINE_CUSTOM_GETTER(CryptoHasherPrototype__algorithmGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSCryptoHasher* thisObject = jsCast<JSCryptoHasher*>(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + if (JSValue cachedValue = thisObject->m_algorithm.get()) return JSValue::encode(cachedValue); - + JSC::JSValue result = JSC::JSValue::decode( - CryptoHasherPrototype__getAlgorithm(thisObject->wrapped(), globalObject)); + CryptoHasherPrototype__getAlgorithm(thisObject->wrapped(), globalObject) + ); RETURN_IF_EXCEPTION(throwScope, {}); thisObject->m_algorithm.set(vm, thisObject, result); RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); } -extern "C" void CryptoHasherPrototype__algorithmSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast<JSCryptoHasher*>(JSValue::decode(thisValue)); - thisObject->m_algorithm.set(vm, thisObject, JSValue::decode(value)); -} -extern "C" EncodedJSValue CryptoHasherPrototype__algorithmGetCachedValue(JSC::EncodedJSValue thisValue) -{ + extern "C" void CryptoHasherPrototype__algorithmSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject *globalObject, JSC::EncodedJSValue value) + { + auto& vm = globalObject->vm(); + auto* thisObject = jsCast<JSCryptoHasher*>(JSValue::decode(thisValue)); + thisObject->m_algorithm.set(vm, thisObject, JSValue::decode(value)); + } + + extern "C" EncodedJSValue CryptoHasherPrototype__algorithmGetCachedValue(JSC::EncodedJSValue thisValue) + { auto* thisObject = jsCast<JSCryptoHasher*>(JSValue::decode(thisValue)); return JSValue::encode(thisObject->m_algorithm.get()); -} + } + + JSC_DEFINE_CUSTOM_GETTER(CryptoHasherPrototype__byteLengthGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSCryptoHasher* thisObject = jsCast<JSCryptoHasher*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -606,38 +657,41 @@ JSC_DEFINE_CUSTOM_GETTER(CryptoHasherPrototype__byteLengthGetterWrap, (JSGlobalO RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + -JSC_DEFINE_HOST_FUNCTION(CryptoHasherPrototype__digestCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + JSC_DEFINE_HOST_FUNCTION(CryptoHasherPrototype__digestCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - JSCryptoHasher* thisObject = jsDynamicCast<JSCryptoHasher*>(callFrame->thisValue()); + JSCryptoHasher* thisObject = jsDynamicCast<JSCryptoHasher*>(callFrame->thisValue()); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return CryptoHasherPrototype__digest(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + return CryptoHasherPrototype__digest(thisObject->wrapped(), lexicalGlobalObject, callFrame); + } + -JSC_DEFINE_HOST_FUNCTION(CryptoHasherPrototype__updateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + JSC_DEFINE_HOST_FUNCTION(CryptoHasherPrototype__updateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - JSCryptoHasher* thisObject = jsDynamicCast<JSCryptoHasher*>(callFrame->thisValue()); + JSCryptoHasher* thisObject = jsDynamicCast<JSCryptoHasher*>(callFrame->thisValue()); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return CryptoHasherPrototype__update(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + return CryptoHasherPrototype__update(thisObject->wrapped(), lexicalGlobalObject, callFrame); + } + void JSCryptoHasherPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) { @@ -649,11 +703,12 @@ void JSCryptoHasherPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* g extern "C" JSC_DECLARE_CUSTOM_GETTER(CryptoHasherClass__getAlgorithms); extern "C" JSC_DECLARE_HOST_FUNCTION(CryptoHasherClass__hash); -static const HashTableValue JSCryptoHasherConstructorTableValues[] = { - { "algorithms"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, CryptoHasherClass__getAlgorithms, 0 } }, - { "hash"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, CryptoHasherClass__hash, 2 } } + static const HashTableValue JSCryptoHasherConstructorTableValues[] = { +{ "algorithms"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, CryptoHasherClass__getAlgorithms, 0 } } , +{ "hash"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, CryptoHasherClass__hash, 2 } } }; + void JSCryptoHasherConstructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSCryptoHasherPrototype* prototype) { Base::finishCreation(vm, 0, "CryptoHasher"_s, PropertyAdditionMode::WithoutStructureTransition); @@ -662,59 +717,62 @@ void JSCryptoHasherConstructor::finishCreation(VM& vm, JSC::JSGlobalObject* glob ASSERT(inherits(info())); } -JSCryptoHasherConstructor::JSCryptoHasherConstructor(JSC::VM& vm, JSC::Structure* structure) - : Base(vm, structure, construct, construct) -{ -} +JSCryptoHasherConstructor::JSCryptoHasherConstructor(JSC::VM& vm, JSC::Structure* structure) : Base(vm, structure, construct, construct) { -JSCryptoHasherConstructor* JSCryptoHasherConstructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSCryptoHasherPrototype* prototype) -{ + } + +JSCryptoHasherConstructor* JSCryptoHasherConstructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSCryptoHasherPrototype* prototype) { JSCryptoHasherConstructor* ptr = new (NotNull, JSC::allocateCell<JSCryptoHasherConstructor>(vm)) JSCryptoHasherConstructor(vm, structure); ptr->finishCreation(vm, globalObject, prototype); return ptr; } + JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSCryptoHasherConstructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) { - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); - JSC::VM& vm = globalObject->vm(); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + JSC::VM &vm = globalObject->vm(); JSObject* newTarget = asObject(callFrame->newTarget()); auto* constructor = globalObject->JSCryptoHasherConstructor(); Structure* structure = globalObject->JSCryptoHasherStructure(); if (constructor != newTarget) { - auto scope = DECLARE_THROW_SCOPE(vm); + auto scope = DECLARE_THROW_SCOPE(vm); - auto* functionGlobalObject = reinterpret_cast<Zig::GlobalObject*>( - // ShadowRealm functions belong to a different global object. - getFunctionRealm(globalObject, newTarget)); - RETURN_IF_EXCEPTION(scope, {}); - structure = InternalFunction::createSubclassStructure( - globalObject, - newTarget, - functionGlobalObject->JSCryptoHasherStructure()); + auto* functionGlobalObject = reinterpret_cast<Zig::GlobalObject*>( + // ShadowRealm functions belong to a different global object. + getFunctionRealm(globalObject, newTarget) + ); + RETURN_IF_EXCEPTION(scope, {}); + structure = InternalFunction::createSubclassStructure( + globalObject, + newTarget, + functionGlobalObject->JSCryptoHasherStructure() + ); } void* ptr = CryptoHasherClass__construct(globalObject, callFrame); if (UNLIKELY(!ptr)) { - return JSValue::encode(JSC::jsUndefined()); + return JSValue::encode(JSC::jsUndefined()); } JSCryptoHasher* instance = JSCryptoHasher::create(vm, globalObject, structure, ptr); + return JSValue::encode(instance); } void JSCryptoHasherConstructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSCryptoHasherPrototype* prototype) { + } const ClassInfo JSCryptoHasherConstructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSCryptoHasherConstructor) }; -extern "C" EncodedJSValue CryptoHasher__getConstructor(Zig::GlobalObject* globalObject) -{ + + extern "C" EncodedJSValue CryptoHasher__getConstructor(Zig::GlobalObject* globalObject) { return JSValue::encode(globalObject->JSCryptoHasherConstructor()); -} + } JSCryptoHasher::~JSCryptoHasher() { @@ -726,7 +784,7 @@ void JSCryptoHasher::destroy(JSCell* cell) { static_cast<JSCryptoHasher*>(cell)->JSCryptoHasher::~JSCryptoHasher(); } - + const ClassInfo JSCryptoHasher::s_info = { "CryptoHasher"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSCryptoHasher) }; void JSCryptoHasher::finishCreation(VM& vm) @@ -735,38 +793,37 @@ void JSCryptoHasher::finishCreation(VM& vm) ASSERT(inherits(info())); } -JSCryptoHasher* JSCryptoHasher::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSCryptoHasher* ptr = new (NotNull, JSC::allocateCell<JSCryptoHasher>(vm)) JSCryptoHasher(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} -extern "C" void* CryptoHasher__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; +JSCryptoHasher* JSCryptoHasher::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) { + JSCryptoHasher* ptr = new (NotNull, JSC::allocateCell<JSCryptoHasher>(vm)) JSCryptoHasher(vm, structure, ctx); + ptr->finishCreation(vm); + return ptr; +} - JSC::JSCell* cell = decodedValue.asCell(); - JSCryptoHasher* object = JSC::jsDynamicCast<JSCryptoHasher*>(cell); +extern "C" void* CryptoHasher__fromJS(JSC::EncodedJSValue value) { + JSC::JSValue decodedValue = JSC::JSValue::decode(value); + if (decodedValue.isEmpty() || !decodedValue.isCell()) + return nullptr; - if (!object) - return nullptr; + JSC::JSCell* cell = decodedValue.asCell(); + JSCryptoHasher* object = JSC::jsDynamicCast<JSCryptoHasher*>(cell); - return object->wrapped(); + if (!object) + return nullptr; + + return object->wrapped(); } -extern "C" bool CryptoHasher__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSCryptoHasher* object = JSC::jsDynamicCast<JSCryptoHasher*>(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; +extern "C" bool CryptoHasher__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) { + JSCryptoHasher* object = JSC::jsDynamicCast<JSCryptoHasher*>(JSValue::decode(value)); + if (!object) + return false; + + object->m_ctx = ptr; + return true; } + extern "C" const size_t CryptoHasher__ptrOffset = JSCryptoHasher::offsetOfWrapped(); void JSCryptoHasher::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) @@ -781,7 +838,7 @@ void JSCryptoHasher::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) JSObject* JSCryptoHasher::createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype) { - return WebCore::JSCryptoHasherConstructor::create(vm, globalObject, WebCore::JSCryptoHasherConstructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast<WebCore::JSCryptoHasherPrototype*>(prototype)); + return WebCore::JSCryptoHasherConstructor::create(vm, globalObject, WebCore::JSCryptoHasherConstructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast<WebCore::JSCryptoHasherPrototype*>(prototype)); } JSObject* JSCryptoHasher::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) @@ -789,13 +846,12 @@ JSObject* JSCryptoHasher::createPrototype(VM& vm, JSDOMGlobalObject* globalObjec return JSCryptoHasherPrototype::create(vm, globalObject, JSCryptoHasherPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); } -extern "C" EncodedJSValue CryptoHasher__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSCryptoHasherStructure(); - JSCryptoHasher* instance = JSCryptoHasher::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); +extern "C" EncodedJSValue CryptoHasher__create(Zig::GlobalObject* globalObject, void* ptr) { + auto &vm = globalObject->vm(); + JSC::Structure* structure = globalObject->JSCryptoHasherStructure(); + JSCryptoHasher* instance = JSCryptoHasher::create(vm, globalObject, structure, ptr); + + return JSValue::encode(instance); } template<typename Visitor> @@ -804,9 +860,11 @@ void JSCryptoHasher::visitChildrenImpl(JSCell* cell, Visitor& visitor) JSCryptoHasher* thisObject = jsCast<JSCryptoHasher*>(cell); ASSERT_GC_OBJECT_INHERITS(thisObject, info()); Base::visitChildren(thisObject, visitor); - + + visitor.append(thisObject->m_algorithms); visitor.append(thisObject->m_algorithm); + } DEFINE_VISIT_CHILDREN(JSCryptoHasher); @@ -814,10 +872,10 @@ DEFINE_VISIT_CHILDREN(JSCryptoHasher); template<typename Visitor> void JSCryptoHasher::visitAdditionalChildren(Visitor& visitor) { - JSCryptoHasher* thisObject = this; + JSCryptoHasher* thisObject = this; ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - - visitor.append(thisObject->m_algorithms); + + visitor.append(thisObject->m_algorithms); visitor.append(thisObject->m_algorithm); ; } @@ -825,7 +883,7 @@ void JSCryptoHasher::visitAdditionalChildren(Visitor& visitor) DEFINE_VISIT_ADDITIONAL_CHILDREN(JSCryptoHasher); template<typename Visitor> -void JSCryptoHasher::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) +void JSCryptoHasher::visitOutputConstraintsImpl(JSCell *cell, Visitor& visitor) { JSCryptoHasher* thisObject = jsCast<JSCryptoHasher*>(cell); ASSERT_GC_OBJECT_INHERITS(thisObject, info()); @@ -833,117 +891,132 @@ void JSCryptoHasher::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) } DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSCryptoHasher); -class JSDirentPrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSDirentPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSDirentPrototype* ptr = new (NotNull, JSC::allocateCell<JSDirentPrototype>(vm)) JSDirentPrototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template<typename CellType, JSC::SubspaceAccess> - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSDirentPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; + class JSDirentPrototype final : public JSC::JSNonFinalObject { + public: + using Base = JSC::JSNonFinalObject; + + static JSDirentPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) + { + JSDirentPrototype* ptr = new (NotNull, JSC::allocateCell<JSDirentPrototype>(vm)) JSDirentPrototype(vm, globalObject, structure); + ptr->finishCreation(vm, globalObject); + return ptr; + } + + DECLARE_INFO; + template<typename CellType, JSC::SubspaceAccess> + static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + return &vm.plainObjectSpace(); + } + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); + } + + private: + JSDirentPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) + : Base(vm, structure) + { + } + + void finishCreation(JSC::VM&, JSC::JSGlobalObject*); + }; class JSDirentConstructor final : public JSC::InternalFunction { -public: - using Base = JSC::InternalFunction; - static JSDirentConstructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSDirentPrototype* prototype); + public: + using Base = JSC::InternalFunction; + static JSDirentConstructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSDirentPrototype* prototype); + + static constexpr unsigned StructureFlags = Base::StructureFlags; + static constexpr bool needsDestruction = false; + + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); + } + + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return WebCore::subspaceForImpl<JSDirentConstructor, WebCore::UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForDirentConstructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForDirentConstructor = std::forward<decltype(space)>(space); }, + [](auto& spaces) { return spaces.m_subspaceForDirentConstructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForDirentConstructor = std::forward<decltype(space)>(space); }); + } + + + void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSDirentPrototype* prototype); + + // Must be defined for each specialization class. + static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); + + DECLARE_EXPORT_INFO; + private: + JSDirentConstructor(JSC::VM& vm, JSC::Structure* structure); + void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSDirentPrototype* prototype); + }; - static constexpr unsigned StructureFlags = Base::StructureFlags; - static constexpr bool needsDestruction = false; - - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); - } - - template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl<JSDirentConstructor, WebCore::UseCustomHeapCellType::No>( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForDirentConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForDirentConstructor = std::forward<decltype(space)>(space); }, - [](auto& spaces) { return spaces.m_subspaceForDirentConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForDirentConstructor = std::forward<decltype(space)>(space); }); - } - - void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSDirentPrototype* prototype); - - // Must be defined for each specialization class. - static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); - - DECLARE_EXPORT_INFO; - -private: - JSDirentConstructor(JSC::VM& vm, JSC::Structure* structure); - void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSDirentPrototype* prototype); -}; extern "C" void* DirentClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); JSC_DECLARE_CUSTOM_GETTER(jsDirentConstructor); extern "C" void DirentClass__finalize(void*); + extern "C" EncodedJSValue DirentPrototype__isBlockDevice(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(DirentPrototype__isBlockDeviceCallback); + extern "C" EncodedJSValue DirentPrototype__isCharacterDevice(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(DirentPrototype__isCharacterDeviceCallback); + extern "C" EncodedJSValue DirentPrototype__isDirectory(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(DirentPrototype__isDirectoryCallback); + extern "C" EncodedJSValue DirentPrototype__isFIFO(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(DirentPrototype__isFIFOCallback); + extern "C" EncodedJSValue DirentPrototype__isFile(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(DirentPrototype__isFileCallback); + extern "C" EncodedJSValue DirentPrototype__isSocket(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(DirentPrototype__isSocketCallback); + extern "C" EncodedJSValue DirentPrototype__isSymbolicLink(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(DirentPrototype__isSymbolicLinkCallback); + extern "C" JSC::EncodedJSValue DirentPrototype__getName(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(DirentPrototype__nameGetterWrap); + STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSDirentPrototype, JSDirentPrototype::Base); -static const HashTableValue JSDirentPrototypeTableValues[] = { - { "isBlockDevice"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, DirentPrototype__isBlockDeviceCallback, 0 } }, - { "isCharacterDevice"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, DirentPrototype__isCharacterDeviceCallback, 0 } }, - { "isDirectory"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, DirentPrototype__isDirectoryCallback, 0 } }, - { "isFIFO"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, DirentPrototype__isFIFOCallback, 0 } }, - { "isFile"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, DirentPrototype__isFileCallback, 0 } }, - { "isSocket"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, DirentPrototype__isSocketCallback, 0 } }, - { "isSymbolicLink"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, DirentPrototype__isSymbolicLinkCallback, 0 } }, - { "name"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, DirentPrototype__nameGetterWrap, 0 } } + + static const HashTableValue JSDirentPrototypeTableValues[] = { +{ "isBlockDevice"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, DirentPrototype__isBlockDeviceCallback, 0 } } , +{ "isCharacterDevice"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, DirentPrototype__isCharacterDeviceCallback, 0 } } , +{ "isDirectory"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, DirentPrototype__isDirectoryCallback, 0 } } , +{ "isFIFO"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, DirentPrototype__isFIFOCallback, 0 } } , +{ "isFile"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, DirentPrototype__isFileCallback, 0 } } , +{ "isSocket"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, DirentPrototype__isSocketCallback, 0 } } , +{ "isSymbolicLink"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, DirentPrototype__isSymbolicLinkCallback, 0 } } , +{ "name"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, DirentPrototype__nameGetterWrap, 0 } } }; + + const ClassInfo JSDirentPrototype::s_info = { "Dirent"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSDirentPrototype) }; + + JSC_DEFINE_CUSTOM_GETTER(jsDirentConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); @@ -954,150 +1027,163 @@ JSC_DEFINE_CUSTOM_GETTER(jsDirentConstructor, (JSGlobalObject * lexicalGlobalObj if (UNLIKELY(!prototype)) return throwVMTypeError(lexicalGlobalObject, throwScope); return JSValue::encode(globalObject->JSDirentConstructor()); -} +} + -JSC_DEFINE_HOST_FUNCTION(DirentPrototype__isBlockDeviceCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - JSDirent* thisObject = jsDynamicCast<JSDirent*>(callFrame->thisValue()); + JSC_DEFINE_HOST_FUNCTION(DirentPrototype__isBlockDeviceCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + JSDirent* thisObject = jsDynamicCast<JSDirent*>(callFrame->thisValue()); + + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } + + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + + return DirentPrototype__isBlockDevice(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(DirentPrototype__isCharacterDeviceCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return DirentPrototype__isBlockDevice(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSDirent* thisObject = jsDynamicCast<JSDirent*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(DirentPrototype__isCharacterDeviceCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSDirent* thisObject = jsDynamicCast<JSDirent*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return DirentPrototype__isCharacterDevice(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(DirentPrototype__isDirectoryCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return DirentPrototype__isCharacterDevice(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSDirent* thisObject = jsDynamicCast<JSDirent*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(DirentPrototype__isDirectoryCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSDirent* thisObject = jsDynamicCast<JSDirent*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return DirentPrototype__isDirectory(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(DirentPrototype__isFIFOCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return DirentPrototype__isDirectory(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSDirent* thisObject = jsDynamicCast<JSDirent*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(DirentPrototype__isFIFOCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSDirent* thisObject = jsDynamicCast<JSDirent*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return DirentPrototype__isFIFO(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(DirentPrototype__isFileCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return DirentPrototype__isFIFO(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSDirent* thisObject = jsDynamicCast<JSDirent*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(DirentPrototype__isFileCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSDirent* thisObject = jsDynamicCast<JSDirent*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return DirentPrototype__isFile(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(DirentPrototype__isSocketCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return DirentPrototype__isFile(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSDirent* thisObject = jsDynamicCast<JSDirent*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(DirentPrototype__isSocketCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSDirent* thisObject = jsDynamicCast<JSDirent*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return DirentPrototype__isSocket(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(DirentPrototype__isSymbolicLinkCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return DirentPrototype__isSocket(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSDirent* thisObject = jsDynamicCast<JSDirent*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(DirentPrototype__isSymbolicLinkCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSDirent* thisObject = jsDynamicCast<JSDirent*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return DirentPrototype__isSymbolicLink(thisObject->wrapped(), lexicalGlobalObject, callFrame); } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - return DirentPrototype__isSymbolicLink(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSC_DEFINE_CUSTOM_GETTER(DirentPrototype__nameGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSDirent* thisObject = jsCast<JSDirent*>(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + if (JSValue cachedValue = thisObject->m_name.get()) return JSValue::encode(cachedValue); - + JSC::JSValue result = JSC::JSValue::decode( - DirentPrototype__getName(thisObject->wrapped(), globalObject)); + DirentPrototype__getName(thisObject->wrapped(), globalObject) + ); RETURN_IF_EXCEPTION(throwScope, {}); thisObject->m_name.set(vm, thisObject, result); RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); } -extern "C" void DirentPrototype__nameSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast<JSDirent*>(JSValue::decode(thisValue)); - thisObject->m_name.set(vm, thisObject, JSValue::decode(value)); -} -extern "C" EncodedJSValue DirentPrototype__nameGetCachedValue(JSC::EncodedJSValue thisValue) -{ + extern "C" void DirentPrototype__nameSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject *globalObject, JSC::EncodedJSValue value) + { + auto& vm = globalObject->vm(); + auto* thisObject = jsCast<JSDirent*>(JSValue::decode(thisValue)); + thisObject->m_name.set(vm, thisObject, JSValue::decode(value)); + } + + extern "C" EncodedJSValue DirentPrototype__nameGetCachedValue(JSC::EncodedJSValue thisValue) + { auto* thisObject = jsCast<JSDirent*>(JSValue::decode(thisValue)); return JSValue::encode(thisObject->m_name.get()); -} + } + + void JSDirentPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) { @@ -1109,64 +1195,67 @@ void JSDirentPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalO void JSDirentConstructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSDirentPrototype* prototype) { Base::finishCreation(vm, 0, "Dirent"_s, PropertyAdditionMode::WithoutStructureTransition); - + putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly); ASSERT(inherits(info())); } -JSDirentConstructor::JSDirentConstructor(JSC::VM& vm, JSC::Structure* structure) - : Base(vm, structure, construct, construct) -{ -} +JSDirentConstructor::JSDirentConstructor(JSC::VM& vm, JSC::Structure* structure) : Base(vm, structure, construct, construct) { -JSDirentConstructor* JSDirentConstructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSDirentPrototype* prototype) -{ + } + +JSDirentConstructor* JSDirentConstructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSDirentPrototype* prototype) { JSDirentConstructor* ptr = new (NotNull, JSC::allocateCell<JSDirentConstructor>(vm)) JSDirentConstructor(vm, structure); ptr->finishCreation(vm, globalObject, prototype); return ptr; } + JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSDirentConstructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) { - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); - JSC::VM& vm = globalObject->vm(); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + JSC::VM &vm = globalObject->vm(); JSObject* newTarget = asObject(callFrame->newTarget()); auto* constructor = globalObject->JSDirentConstructor(); Structure* structure = globalObject->JSDirentStructure(); if (constructor != newTarget) { - auto scope = DECLARE_THROW_SCOPE(vm); + auto scope = DECLARE_THROW_SCOPE(vm); - auto* functionGlobalObject = reinterpret_cast<Zig::GlobalObject*>( - // ShadowRealm functions belong to a different global object. - getFunctionRealm(globalObject, newTarget)); - RETURN_IF_EXCEPTION(scope, {}); - structure = InternalFunction::createSubclassStructure( - globalObject, - newTarget, - functionGlobalObject->JSDirentStructure()); + auto* functionGlobalObject = reinterpret_cast<Zig::GlobalObject*>( + // ShadowRealm functions belong to a different global object. + getFunctionRealm(globalObject, newTarget) + ); + RETURN_IF_EXCEPTION(scope, {}); + structure = InternalFunction::createSubclassStructure( + globalObject, + newTarget, + functionGlobalObject->JSDirentStructure() + ); } void* ptr = DirentClass__construct(globalObject, callFrame); if (UNLIKELY(!ptr)) { - return JSValue::encode(JSC::jsUndefined()); + return JSValue::encode(JSC::jsUndefined()); } JSDirent* instance = JSDirent::create(vm, globalObject, structure, ptr); + return JSValue::encode(instance); } void JSDirentConstructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSDirentPrototype* prototype) { + } const ClassInfo JSDirentConstructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSDirentConstructor) }; -extern "C" EncodedJSValue Dirent__getConstructor(Zig::GlobalObject* globalObject) -{ + + extern "C" EncodedJSValue Dirent__getConstructor(Zig::GlobalObject* globalObject) { return JSValue::encode(globalObject->JSDirentConstructor()); -} + } JSDirent::~JSDirent() { @@ -1178,7 +1267,7 @@ void JSDirent::destroy(JSCell* cell) { static_cast<JSDirent*>(cell)->JSDirent::~JSDirent(); } - + const ClassInfo JSDirent::s_info = { "Dirent"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSDirent) }; void JSDirent::finishCreation(VM& vm) @@ -1187,38 +1276,37 @@ void JSDirent::finishCreation(VM& vm) ASSERT(inherits(info())); } -JSDirent* JSDirent::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSDirent* ptr = new (NotNull, JSC::allocateCell<JSDirent>(vm)) JSDirent(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} -extern "C" void* Dirent__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; +JSDirent* JSDirent::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) { + JSDirent* ptr = new (NotNull, JSC::allocateCell<JSDirent>(vm)) JSDirent(vm, structure, ctx); + ptr->finishCreation(vm); + return ptr; +} - JSC::JSCell* cell = decodedValue.asCell(); - JSDirent* object = JSC::jsDynamicCast<JSDirent*>(cell); +extern "C" void* Dirent__fromJS(JSC::EncodedJSValue value) { + JSC::JSValue decodedValue = JSC::JSValue::decode(value); + if (decodedValue.isEmpty() || !decodedValue.isCell()) + return nullptr; - if (!object) - return nullptr; + JSC::JSCell* cell = decodedValue.asCell(); + JSDirent* object = JSC::jsDynamicCast<JSDirent*>(cell); - return object->wrapped(); + if (!object) + return nullptr; + + return object->wrapped(); } -extern "C" bool Dirent__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSDirent* object = JSC::jsDynamicCast<JSDirent*>(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; +extern "C" bool Dirent__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) { + JSDirent* object = JSC::jsDynamicCast<JSDirent*>(JSValue::decode(value)); + if (!object) + return false; + + object->m_ctx = ptr; + return true; } + extern "C" const size_t Dirent__ptrOffset = JSDirent::offsetOfWrapped(); void JSDirent::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) @@ -1233,7 +1321,7 @@ void JSDirent::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) JSObject* JSDirent::createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype) { - return WebCore::JSDirentConstructor::create(vm, globalObject, WebCore::JSDirentConstructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast<WebCore::JSDirentPrototype*>(prototype)); + return WebCore::JSDirentConstructor::create(vm, globalObject, WebCore::JSDirentConstructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast<WebCore::JSDirentPrototype*>(prototype)); } JSObject* JSDirent::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) @@ -1241,13 +1329,12 @@ JSObject* JSDirent::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) return JSDirentPrototype::create(vm, globalObject, JSDirentPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); } -extern "C" EncodedJSValue Dirent__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSDirentStructure(); - JSDirent* instance = JSDirent::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); +extern "C" EncodedJSValue Dirent__create(Zig::GlobalObject* globalObject, void* ptr) { + auto &vm = globalObject->vm(); + JSC::Structure* structure = globalObject->JSDirentStructure(); + JSDirent* instance = JSDirent::create(vm, globalObject, structure, ptr); + + return JSValue::encode(instance); } template<typename Visitor> @@ -1256,8 +1343,10 @@ void JSDirent::visitChildrenImpl(JSCell* cell, Visitor& visitor) JSDirent* thisObject = jsCast<JSDirent*>(cell); ASSERT_GC_OBJECT_INHERITS(thisObject, info()); Base::visitChildren(thisObject, visitor); - + + visitor.append(thisObject->m_name); + } DEFINE_VISIT_CHILDREN(JSDirent); @@ -1265,17 +1354,17 @@ DEFINE_VISIT_CHILDREN(JSDirent); template<typename Visitor> void JSDirent::visitAdditionalChildren(Visitor& visitor) { - JSDirent* thisObject = this; + JSDirent* thisObject = this; ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - - visitor.append(thisObject->m_name); + + visitor.append(thisObject->m_name); ; } DEFINE_VISIT_ADDITIONAL_CHILDREN(JSDirent); template<typename Visitor> -void JSDirent::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) +void JSDirent::visitOutputConstraintsImpl(JSCell *cell, Visitor& visitor) { JSDirent* thisObject = jsCast<JSDirent*>(cell); ASSERT_GC_OBJECT_INHERITS(thisObject, info()); @@ -1283,234 +1372,277 @@ void JSDirent::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) } DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSDirent); -class JSExpectPrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSExpectPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSExpectPrototype* ptr = new (NotNull, JSC::allocateCell<JSExpectPrototype>(vm)) JSExpectPrototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template<typename CellType, JSC::SubspaceAccess> - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSExpectPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; + class JSExpectPrototype final : public JSC::JSNonFinalObject { + public: + using Base = JSC::JSNonFinalObject; + + static JSExpectPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) + { + JSExpectPrototype* ptr = new (NotNull, JSC::allocateCell<JSExpectPrototype>(vm)) JSExpectPrototype(vm, globalObject, structure); + ptr->finishCreation(vm, globalObject); + return ptr; + } + + DECLARE_INFO; + template<typename CellType, JSC::SubspaceAccess> + static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + return &vm.plainObjectSpace(); + } + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); + } + + private: + JSExpectPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) + : Base(vm, structure) + { + } + + void finishCreation(JSC::VM&, JSC::JSGlobalObject*); + }; class JSExpectConstructor final : public JSC::InternalFunction { -public: - using Base = JSC::InternalFunction; - static JSExpectConstructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSExpectPrototype* prototype); - - static constexpr unsigned StructureFlags = Base::StructureFlags; - static constexpr bool needsDestruction = false; - - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); - } - - template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl<JSExpectConstructor, WebCore::UseCustomHeapCellType::No>( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForExpectConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForExpectConstructor = std::forward<decltype(space)>(space); }, - [](auto& spaces) { return spaces.m_subspaceForExpectConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForExpectConstructor = std::forward<decltype(space)>(space); }); - } - - void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSExpectPrototype* prototype); - - // Must be defined for each specialization class. - static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); - - DECLARE_EXPORT_INFO; + public: + using Base = JSC::InternalFunction; + static JSExpectConstructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSExpectPrototype* prototype); + + static constexpr unsigned StructureFlags = Base::StructureFlags; + static constexpr bool needsDestruction = false; + + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); + } + + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return WebCore::subspaceForImpl<JSExpectConstructor, WebCore::UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForExpectConstructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForExpectConstructor = std::forward<decltype(space)>(space); }, + [](auto& spaces) { return spaces.m_subspaceForExpectConstructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForExpectConstructor = std::forward<decltype(space)>(space); }); + } + + + void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSExpectPrototype* prototype); + + // Must be defined for each specialization class. + static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); + + DECLARE_EXPORT_INFO; + private: + JSExpectConstructor(JSC::VM& vm, JSC::Structure* structure); + void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSExpectPrototype* prototype); + }; -private: - JSExpectConstructor(JSC::VM& vm, JSC::Structure* structure); - void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSExpectPrototype* prototype); -}; extern "C" void* ExpectClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); JSC_DECLARE_CUSTOM_GETTER(jsExpectConstructor); extern "C" void ExpectClass__finalize(void*); extern "C" JSC_DECLARE_HOST_FUNCTION(ExpectClass__call); -extern "C" JSC::EncodedJSValue ExpectPrototype__getNot(void* ptr, JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* lexicalGlobalObject); +extern "C" JSC::EncodedJSValue ExpectPrototype__getNot(void* ptr, JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(ExpectPrototype__notGetterWrap); -extern "C" JSC::EncodedJSValue ExpectPrototype__getRejects(void* ptr, JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* lexicalGlobalObject); + +extern "C" JSC::EncodedJSValue ExpectPrototype__getRejects(void* ptr, JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(ExpectPrototype__rejectsGetterWrap); -extern "C" JSC::EncodedJSValue ExpectPrototype__getResolves(void* ptr, JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* lexicalGlobalObject); + +extern "C" JSC::EncodedJSValue ExpectPrototype__getResolves(void* ptr, JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(ExpectPrototype__resolvesGetterWrap); + extern "C" EncodedJSValue ExpectPrototype__toBe(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toBeCallback); + extern "C" EncodedJSValue ExpectPrototype__toBeCloseTo(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toBeCloseToCallback); + extern "C" EncodedJSValue ExpectPrototype__toBeDefined(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toBeDefinedCallback); + extern "C" EncodedJSValue ExpectPrototype__toBeFalsy(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toBeFalsyCallback); + extern "C" EncodedJSValue ExpectPrototype__toBeGreaterThan(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toBeGreaterThanCallback); + extern "C" EncodedJSValue ExpectPrototype__toBeGreaterThanOrEqual(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toBeGreaterThanOrEqualCallback); + extern "C" EncodedJSValue ExpectPrototype__toBeInstanceOf(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toBeInstanceOfCallback); + extern "C" EncodedJSValue ExpectPrototype__toBeLessThan(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toBeLessThanCallback); + extern "C" EncodedJSValue ExpectPrototype__toBeLessThanOrEqual(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toBeLessThanOrEqualCallback); + extern "C" EncodedJSValue ExpectPrototype__toBeNaN(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toBeNaNCallback); + extern "C" EncodedJSValue ExpectPrototype__toBeNull(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toBeNullCallback); + extern "C" EncodedJSValue ExpectPrototype__toBeTruthy(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toBeTruthyCallback); + extern "C" EncodedJSValue ExpectPrototype__toBeUndefined(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toBeUndefinedCallback); + extern "C" EncodedJSValue ExpectPrototype__toContain(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toContainCallback); + extern "C" EncodedJSValue ExpectPrototype__toContainEqual(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toContainEqualCallback); + extern "C" EncodedJSValue ExpectPrototype__toEqual(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toEqualCallback); + extern "C" EncodedJSValue ExpectPrototype__toHaveBeenCalledTimes(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toHaveBeenCalledTimesCallback); + extern "C" EncodedJSValue ExpectPrototype__toHaveBeenCalledWith(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toHaveBeenCalledWithCallback); + extern "C" EncodedJSValue ExpectPrototype__toHaveBeenLastCalledWith(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toHaveBeenLastCalledWithCallback); + extern "C" EncodedJSValue ExpectPrototype__toHaveBeenNthCalledWith(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toHaveBeenNthCalledWithCallback); + extern "C" EncodedJSValue ExpectPrototype__toHaveLastReturnedWith(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toHaveLastReturnedWithCallback); + extern "C" EncodedJSValue ExpectPrototype__toHaveLength(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toHaveLengthCallback); + extern "C" EncodedJSValue ExpectPrototype__toHaveNthReturnedWith(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toHaveNthReturnedWithCallback); + extern "C" EncodedJSValue ExpectPrototype__toHaveProperty(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toHavePropertyCallback); + extern "C" EncodedJSValue ExpectPrototype__toHaveReturnedTimes(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toHaveReturnedTimesCallback); + extern "C" EncodedJSValue ExpectPrototype__toHaveReturnedWith(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toHaveReturnedWithCallback); + extern "C" EncodedJSValue ExpectPrototype__toMatch(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toMatchCallback); + extern "C" EncodedJSValue ExpectPrototype__toMatchInlineSnapshot(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toMatchInlineSnapshotCallback); + extern "C" EncodedJSValue ExpectPrototype__toMatchObject(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toMatchObjectCallback); + extern "C" EncodedJSValue ExpectPrototype__toMatchSnapshot(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toMatchSnapshotCallback); + extern "C" EncodedJSValue ExpectPrototype__toStrictEqual(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toStrictEqualCallback); + extern "C" EncodedJSValue ExpectPrototype__toThrow(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toThrowCallback); + extern "C" EncodedJSValue ExpectPrototype__toThrowErrorMatchingInlineSnapshot(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toThrowErrorMatchingInlineSnapshotCallback); + extern "C" EncodedJSValue ExpectPrototype__toThrowErrorMatchingSnapshot(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toThrowErrorMatchingSnapshotCallback); + STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSExpectPrototype, JSExpectPrototype::Base); -static const HashTableValue JSExpectPrototypeTableValues[] = { - { "not"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ExpectPrototype__notGetterWrap, 0 } }, - { "rejects"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ExpectPrototype__rejectsGetterWrap, 0 } }, - { "resolves"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ExpectPrototype__resolvesGetterWrap, 0 } }, - { "toBe"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeCallback, 1 } }, - { "toBeCloseTo"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeCloseToCallback, 1 } }, - { "toBeDefined"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeDefinedCallback, 0 } }, - { "toBeFalsy"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeFalsyCallback, 0 } }, - { "toBeGreaterThan"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeGreaterThanCallback, 1 } }, - { "toBeGreaterThanOrEqual"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeGreaterThanOrEqualCallback, 1 } }, - { "toBeInstanceOf"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeInstanceOfCallback, 1 } }, - { "toBeLessThan"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeLessThanCallback, 1 } }, - { "toBeLessThanOrEqual"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeLessThanOrEqualCallback, 1 } }, - { "toBeNaN"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeNaNCallback, 0 } }, - { "toBeNull"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeNullCallback, 0 } }, - { "toBeTruthy"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeTruthyCallback, 0 } }, - { "toBeUndefined"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeUndefinedCallback, 0 } }, - { "toContain"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toContainCallback, 1 } }, - { "toContainEqual"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toContainEqualCallback, 1 } }, - { "toEqual"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toEqualCallback, 1 } }, - { "toHaveBeenCalledTimes"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toHaveBeenCalledTimesCallback, 1 } }, - { "toHaveBeenCalledWith"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toHaveBeenCalledWithCallback, 1 } }, - { "toHaveBeenLastCalledWith"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toHaveBeenLastCalledWithCallback, 1 } }, - { "toHaveBeenNthCalledWith"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toHaveBeenNthCalledWithCallback, 1 } }, - { "toHaveLastReturnedWith"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toHaveLastReturnedWithCallback, 1 } }, - { "toHaveLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toHaveLengthCallback, 1 } }, - { "toHaveNthReturnedWith"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toHaveNthReturnedWithCallback, 1 } }, - { "toHaveProperty"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toHavePropertyCallback, 2 } }, - { "toHaveReturnedTimes"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toHaveReturnedTimesCallback, 1 } }, - { "toHaveReturnedWith"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toHaveReturnedWithCallback, 1 } }, - { "toMatch"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toMatchCallback, 1 } }, - { "toMatchInlineSnapshot"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toMatchInlineSnapshotCallback, 1 } }, - { "toMatchObject"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toMatchObjectCallback, 1 } }, - { "toMatchSnapshot"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toMatchSnapshotCallback, 1 } }, - { "toStrictEqual"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toStrictEqualCallback, 1 } }, - { "toThrow"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toThrowCallback, 1 } }, - { "toThrowErrorMatchingInlineSnapshot"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toThrowErrorMatchingInlineSnapshotCallback, 1 } }, - { "toThrowErrorMatchingSnapshot"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toThrowErrorMatchingSnapshotCallback, 1 } } + + static const HashTableValue JSExpectPrototypeTableValues[] = { +{ "not"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ExpectPrototype__notGetterWrap, 0 } } , +{ "rejects"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ExpectPrototype__rejectsGetterWrap, 0 } } , +{ "resolves"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ExpectPrototype__resolvesGetterWrap, 0 } } , +{ "toBe"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeCallback, 1 } } , +{ "toBeCloseTo"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeCloseToCallback, 1 } } , +{ "toBeDefined"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeDefinedCallback, 0 } } , +{ "toBeFalsy"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeFalsyCallback, 0 } } , +{ "toBeGreaterThan"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeGreaterThanCallback, 1 } } , +{ "toBeGreaterThanOrEqual"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeGreaterThanOrEqualCallback, 1 } } , +{ "toBeInstanceOf"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeInstanceOfCallback, 1 } } , +{ "toBeLessThan"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeLessThanCallback, 1 } } , +{ "toBeLessThanOrEqual"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeLessThanOrEqualCallback, 1 } } , +{ "toBeNaN"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeNaNCallback, 0 } } , +{ "toBeNull"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeNullCallback, 0 } } , +{ "toBeTruthy"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeTruthyCallback, 0 } } , +{ "toBeUndefined"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeUndefinedCallback, 0 } } , +{ "toContain"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toContainCallback, 1 } } , +{ "toContainEqual"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toContainEqualCallback, 1 } } , +{ "toEqual"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toEqualCallback, 1 } } , +{ "toHaveBeenCalledTimes"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toHaveBeenCalledTimesCallback, 1 } } , +{ "toHaveBeenCalledWith"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toHaveBeenCalledWithCallback, 1 } } , +{ "toHaveBeenLastCalledWith"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toHaveBeenLastCalledWithCallback, 1 } } , +{ "toHaveBeenNthCalledWith"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toHaveBeenNthCalledWithCallback, 1 } } , +{ "toHaveLastReturnedWith"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toHaveLastReturnedWithCallback, 1 } } , +{ "toHaveLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toHaveLengthCallback, 1 } } , +{ "toHaveNthReturnedWith"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toHaveNthReturnedWithCallback, 1 } } , +{ "toHaveProperty"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toHavePropertyCallback, 2 } } , +{ "toHaveReturnedTimes"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toHaveReturnedTimesCallback, 1 } } , +{ "toHaveReturnedWith"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toHaveReturnedWithCallback, 1 } } , +{ "toMatch"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toMatchCallback, 1 } } , +{ "toMatchInlineSnapshot"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toMatchInlineSnapshotCallback, 1 } } , +{ "toMatchObject"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toMatchObjectCallback, 1 } } , +{ "toMatchSnapshot"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toMatchSnapshotCallback, 1 } } , +{ "toStrictEqual"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toStrictEqualCallback, 1 } } , +{ "toThrow"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toThrowCallback, 1 } } , +{ "toThrowErrorMatchingInlineSnapshot"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toThrowErrorMatchingInlineSnapshotCallback, 1 } } , +{ "toThrowErrorMatchingSnapshot"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toThrowErrorMatchingSnapshotCallback, 1 } } }; + + const ClassInfo JSExpectPrototype::s_info = { "Expect"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSExpectPrototype) }; + + JSC_DEFINE_CUSTOM_GETTER(jsExpectConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); @@ -1521,613 +1653,658 @@ JSC_DEFINE_CUSTOM_GETTER(jsExpectConstructor, (JSGlobalObject * lexicalGlobalObj if (UNLIKELY(!prototype)) return throwVMTypeError(lexicalGlobalObject, throwScope); return JSValue::encode(globalObject->JSExpectConstructor()); -} +} + + JSC_DEFINE_CUSTOM_GETTER(ExpectPrototype__notGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSExpect* thisObject = jsCast<JSExpect*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = ExpectPrototype__getNot(thisObject->wrapped(), thisValue, globalObject); + JSC::EncodedJSValue result = ExpectPrototype__getNot(thisObject->wrapped(), thisValue, globalObject); RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + JSC_DEFINE_CUSTOM_GETTER(ExpectPrototype__rejectsGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSExpect* thisObject = jsCast<JSExpect*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = ExpectPrototype__getRejects(thisObject->wrapped(), thisValue, globalObject); + JSC::EncodedJSValue result = ExpectPrototype__getRejects(thisObject->wrapped(), thisValue, globalObject); RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + JSC_DEFINE_CUSTOM_GETTER(ExpectPrototype__resolvesGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSExpect* thisObject = jsCast<JSExpect*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = ExpectPrototype__getResolves(thisObject->wrapped(), thisValue, globalObject); + JSC::EncodedJSValue result = ExpectPrototype__getResolves(thisObject->wrapped(), thisValue, globalObject); RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); + JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } + + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + + return ExpectPrototype__toBe(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeCloseToCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return ExpectPrototype__toBe(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeCloseToCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return ExpectPrototype__toBeCloseTo(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeDefinedCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return ExpectPrototype__toBeCloseTo(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeDefinedCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return ExpectPrototype__toBeDefined(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeFalsyCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return ExpectPrototype__toBeDefined(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeFalsyCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return ExpectPrototype__toBeFalsy(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeGreaterThanCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return ExpectPrototype__toBeFalsy(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeGreaterThanCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return ExpectPrototype__toBeGreaterThan(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeGreaterThanOrEqualCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return ExpectPrototype__toBeGreaterThan(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeGreaterThanOrEqualCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return ExpectPrototype__toBeGreaterThanOrEqual(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeInstanceOfCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return ExpectPrototype__toBeGreaterThanOrEqual(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeInstanceOfCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return ExpectPrototype__toBeInstanceOf(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeLessThanCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return ExpectPrototype__toBeInstanceOf(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeLessThanCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return ExpectPrototype__toBeLessThan(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeLessThanOrEqualCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return ExpectPrototype__toBeLessThan(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeLessThanOrEqualCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return ExpectPrototype__toBeLessThanOrEqual(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeNaNCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return ExpectPrototype__toBeLessThanOrEqual(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeNaNCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return ExpectPrototype__toBeNaN(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeNullCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return ExpectPrototype__toBeNaN(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeNullCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return ExpectPrototype__toBeNull(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeTruthyCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return ExpectPrototype__toBeNull(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeTruthyCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return ExpectPrototype__toBeTruthy(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeUndefinedCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return ExpectPrototype__toBeTruthy(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeUndefinedCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return ExpectPrototype__toBeUndefined(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toContainCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return ExpectPrototype__toBeUndefined(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toContainCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return ExpectPrototype__toContain(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toContainEqualCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return ExpectPrototype__toContain(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toContainEqualCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return ExpectPrototype__toContainEqual(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toEqualCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return ExpectPrototype__toContainEqual(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toEqualCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return ExpectPrototype__toEqual(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toHaveBeenCalledTimesCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return ExpectPrototype__toEqual(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toHaveBeenCalledTimesCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return ExpectPrototype__toHaveBeenCalledTimes(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toHaveBeenCalledWithCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return ExpectPrototype__toHaveBeenCalledTimes(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toHaveBeenCalledWithCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return ExpectPrototype__toHaveBeenCalledWith(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toHaveBeenLastCalledWithCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return ExpectPrototype__toHaveBeenCalledWith(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toHaveBeenLastCalledWithCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return ExpectPrototype__toHaveBeenLastCalledWith(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toHaveBeenNthCalledWithCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return ExpectPrototype__toHaveBeenLastCalledWith(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toHaveBeenNthCalledWithCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return ExpectPrototype__toHaveBeenNthCalledWith(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toHaveLastReturnedWithCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return ExpectPrototype__toHaveBeenNthCalledWith(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toHaveLastReturnedWithCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return ExpectPrototype__toHaveLastReturnedWith(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toHaveLengthCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return ExpectPrototype__toHaveLastReturnedWith(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toHaveLengthCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return ExpectPrototype__toHaveLength(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toHaveNthReturnedWithCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return ExpectPrototype__toHaveLength(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toHaveNthReturnedWithCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return ExpectPrototype__toHaveNthReturnedWith(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toHavePropertyCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return ExpectPrototype__toHaveNthReturnedWith(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toHavePropertyCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return ExpectPrototype__toHaveProperty(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toHaveReturnedTimesCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return ExpectPrototype__toHaveProperty(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toHaveReturnedTimesCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return ExpectPrototype__toHaveReturnedTimes(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toHaveReturnedWithCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return ExpectPrototype__toHaveReturnedTimes(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toHaveReturnedWithCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return ExpectPrototype__toHaveReturnedWith(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toMatchCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return ExpectPrototype__toHaveReturnedWith(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toMatchCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return ExpectPrototype__toMatch(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toMatchInlineSnapshotCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return ExpectPrototype__toMatch(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toMatchInlineSnapshotCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return ExpectPrototype__toMatchInlineSnapshot(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toMatchObjectCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return ExpectPrototype__toMatchInlineSnapshot(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toMatchObjectCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return ExpectPrototype__toMatchObject(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toMatchSnapshotCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return ExpectPrototype__toMatchObject(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toMatchSnapshotCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return ExpectPrototype__toMatchSnapshot(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toStrictEqualCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return ExpectPrototype__toMatchSnapshot(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toStrictEqualCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return ExpectPrototype__toStrictEqual(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toThrowCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return ExpectPrototype__toStrictEqual(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toThrowCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return ExpectPrototype__toThrow(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toThrowErrorMatchingInlineSnapshotCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return ExpectPrototype__toThrow(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toThrowErrorMatchingInlineSnapshotCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return ExpectPrototype__toThrowErrorMatchingInlineSnapshot(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toThrowErrorMatchingSnapshotCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return ExpectPrototype__toThrowErrorMatchingInlineSnapshot(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toThrowErrorMatchingSnapshotCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return ExpectPrototype__toThrowErrorMatchingSnapshot(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - return ExpectPrototype__toThrowErrorMatchingSnapshot(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -extern "C" void ExpectPrototype__capturedValueSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast<JSExpect*>(JSValue::decode(thisValue)); - thisObject->m_capturedValue.set(vm, thisObject, JSValue::decode(value)); -} -extern "C" EncodedJSValue ExpectPrototype__capturedValueGetCachedValue(JSC::EncodedJSValue thisValue) -{ + extern "C" void ExpectPrototype__capturedValueSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject *globalObject, JSC::EncodedJSValue value) + { + auto& vm = globalObject->vm(); + auto* thisObject = jsCast<JSExpect*>(JSValue::decode(thisValue)); + thisObject->m_capturedValue.set(vm, thisObject, JSValue::decode(value)); + } + + extern "C" EncodedJSValue ExpectPrototype__capturedValueGetCachedValue(JSC::EncodedJSValue thisValue) + { auto* thisObject = jsCast<JSExpect*>(JSValue::decode(thisValue)); return JSValue::encode(thisObject->m_capturedValue.get()); -} - -extern "C" void ExpectPrototype__resultValueSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast<JSExpect*>(JSValue::decode(thisValue)); - thisObject->m_resultValue.set(vm, thisObject, JSValue::decode(value)); -} - -extern "C" EncodedJSValue ExpectPrototype__resultValueGetCachedValue(JSC::EncodedJSValue thisValue) -{ + } + + + + + extern "C" void ExpectPrototype__resultValueSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject *globalObject, JSC::EncodedJSValue value) + { + auto& vm = globalObject->vm(); + auto* thisObject = jsCast<JSExpect*>(JSValue::decode(thisValue)); + thisObject->m_resultValue.set(vm, thisObject, JSValue::decode(value)); + } + + extern "C" EncodedJSValue ExpectPrototype__resultValueGetCachedValue(JSC::EncodedJSValue thisValue) + { auto* thisObject = jsCast<JSExpect*>(JSValue::decode(thisValue)); return JSValue::encode(thisObject->m_resultValue.get()); -} + } + + void JSExpectPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) { @@ -2150,22 +2327,23 @@ extern "C" JSC_DECLARE_CUSTOM_GETTER(ExpectClass__getStaticResolves); extern "C" JSC_DECLARE_HOST_FUNCTION(ExpectClass__stringContaining); extern "C" JSC_DECLARE_HOST_FUNCTION(ExpectClass__stringMatching); -static const HashTableValue JSExpectConstructorTableValues[] = { - { "addSnapshotSerializer"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectClass__addSnapshotSerializer, 1 } }, - { "any"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectClass__any, 1 } }, - { "anything"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectClass__anything, 1 } }, - { "arrayContaining"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectClass__arrayContaining, 1 } }, - { "assertions"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectClass__assertions, 1 } }, - { "extend"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectClass__extend, 1 } }, - { "hasAssertions"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectClass__hasAssertions, 1 } }, - { "not"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ExpectClass__getStaticNot, 0 } }, - { "objectContaining"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectClass__objectContaining, 1 } }, - { "rejects"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ExpectClass__getStaticRejects, 0 } }, - { "resolves"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ExpectClass__getStaticResolves, 0 } }, - { "stringContaining"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectClass__stringContaining, 1 } }, - { "stringMatching"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectClass__stringMatching, 1 } } + static const HashTableValue JSExpectConstructorTableValues[] = { +{ "addSnapshotSerializer"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectClass__addSnapshotSerializer, 1 } } , +{ "any"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectClass__any, 1 } } , +{ "anything"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectClass__anything, 1 } } , +{ "arrayContaining"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectClass__arrayContaining, 1 } } , +{ "assertions"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectClass__assertions, 1 } } , +{ "extend"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectClass__extend, 1 } } , +{ "hasAssertions"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectClass__hasAssertions, 1 } } , +{ "not"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ExpectClass__getStaticNot, 0 } } , +{ "objectContaining"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectClass__objectContaining, 1 } } , +{ "rejects"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ExpectClass__getStaticRejects, 0 } } , +{ "resolves"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ExpectClass__getStaticResolves, 0 } } , +{ "stringContaining"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectClass__stringContaining, 1 } } , +{ "stringMatching"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectClass__stringMatching, 1 } } }; + void JSExpectConstructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSExpectPrototype* prototype) { Base::finishCreation(vm, 0, "Expect"_s, PropertyAdditionMode::WithoutStructureTransition); @@ -2174,59 +2352,62 @@ void JSExpectConstructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObje ASSERT(inherits(info())); } -JSExpectConstructor::JSExpectConstructor(JSC::VM& vm, JSC::Structure* structure) - : Base(vm, structure, ExpectClass__call, construct) -{ -} +JSExpectConstructor::JSExpectConstructor(JSC::VM& vm, JSC::Structure* structure) : Base(vm, structure, ExpectClass__call, construct) { -JSExpectConstructor* JSExpectConstructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSExpectPrototype* prototype) -{ + } + +JSExpectConstructor* JSExpectConstructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSExpectPrototype* prototype) { JSExpectConstructor* ptr = new (NotNull, JSC::allocateCell<JSExpectConstructor>(vm)) JSExpectConstructor(vm, structure); ptr->finishCreation(vm, globalObject, prototype); return ptr; } + JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSExpectConstructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) { - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); - JSC::VM& vm = globalObject->vm(); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + JSC::VM &vm = globalObject->vm(); JSObject* newTarget = asObject(callFrame->newTarget()); auto* constructor = globalObject->JSExpectConstructor(); Structure* structure = globalObject->JSExpectStructure(); if (constructor != newTarget) { - auto scope = DECLARE_THROW_SCOPE(vm); + auto scope = DECLARE_THROW_SCOPE(vm); - auto* functionGlobalObject = reinterpret_cast<Zig::GlobalObject*>( - // ShadowRealm functions belong to a different global object. - getFunctionRealm(globalObject, newTarget)); - RETURN_IF_EXCEPTION(scope, {}); - structure = InternalFunction::createSubclassStructure( - globalObject, - newTarget, - functionGlobalObject->JSExpectStructure()); + auto* functionGlobalObject = reinterpret_cast<Zig::GlobalObject*>( + // ShadowRealm functions belong to a different global object. + getFunctionRealm(globalObject, newTarget) + ); + RETURN_IF_EXCEPTION(scope, {}); + structure = InternalFunction::createSubclassStructure( + globalObject, + newTarget, + functionGlobalObject->JSExpectStructure() + ); } void* ptr = ExpectClass__construct(globalObject, callFrame); if (UNLIKELY(!ptr)) { - return JSValue::encode(JSC::jsUndefined()); + return JSValue::encode(JSC::jsUndefined()); } JSExpect* instance = JSExpect::create(vm, globalObject, structure, ptr); + return JSValue::encode(instance); } void JSExpectConstructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSExpectPrototype* prototype) { + } const ClassInfo JSExpectConstructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSExpectConstructor) }; -extern "C" EncodedJSValue Expect__getConstructor(Zig::GlobalObject* globalObject) -{ + + extern "C" EncodedJSValue Expect__getConstructor(Zig::GlobalObject* globalObject) { return JSValue::encode(globalObject->JSExpectConstructor()); -} + } JSExpect::~JSExpect() { @@ -2238,7 +2419,7 @@ void JSExpect::destroy(JSCell* cell) { static_cast<JSExpect*>(cell)->JSExpect::~JSExpect(); } - + const ClassInfo JSExpect::s_info = { "Expect"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSExpect) }; void JSExpect::finishCreation(VM& vm) @@ -2247,38 +2428,37 @@ void JSExpect::finishCreation(VM& vm) ASSERT(inherits(info())); } -JSExpect* JSExpect::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSExpect* ptr = new (NotNull, JSC::allocateCell<JSExpect>(vm)) JSExpect(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} -extern "C" void* Expect__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; +JSExpect* JSExpect::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) { + JSExpect* ptr = new (NotNull, JSC::allocateCell<JSExpect>(vm)) JSExpect(vm, structure, ctx); + ptr->finishCreation(vm); + return ptr; +} - JSC::JSCell* cell = decodedValue.asCell(); - JSExpect* object = JSC::jsDynamicCast<JSExpect*>(cell); +extern "C" void* Expect__fromJS(JSC::EncodedJSValue value) { + JSC::JSValue decodedValue = JSC::JSValue::decode(value); + if (decodedValue.isEmpty() || !decodedValue.isCell()) + return nullptr; - if (!object) - return nullptr; + JSC::JSCell* cell = decodedValue.asCell(); + JSExpect* object = JSC::jsDynamicCast<JSExpect*>(cell); - return object->wrapped(); + if (!object) + return nullptr; + + return object->wrapped(); } -extern "C" bool Expect__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSExpect* object = JSC::jsDynamicCast<JSExpect*>(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; +extern "C" bool Expect__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) { + JSExpect* object = JSC::jsDynamicCast<JSExpect*>(JSValue::decode(value)); + if (!object) + return false; + + object->m_ctx = ptr; + return true; } + extern "C" const size_t Expect__ptrOffset = JSExpect::offsetOfWrapped(); void JSExpect::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) @@ -2293,7 +2473,7 @@ void JSExpect::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) JSObject* JSExpect::createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype) { - return WebCore::JSExpectConstructor::create(vm, globalObject, WebCore::JSExpectConstructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast<WebCore::JSExpectPrototype*>(prototype)); + return WebCore::JSExpectConstructor::create(vm, globalObject, WebCore::JSExpectConstructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast<WebCore::JSExpectPrototype*>(prototype)); } JSObject* JSExpect::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) @@ -2301,13 +2481,12 @@ JSObject* JSExpect::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) return JSExpectPrototype::create(vm, globalObject, JSExpectPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); } -extern "C" EncodedJSValue Expect__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSExpectStructure(); - JSExpect* instance = JSExpect::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); +extern "C" EncodedJSValue Expect__create(Zig::GlobalObject* globalObject, void* ptr) { + auto &vm = globalObject->vm(); + JSC::Structure* structure = globalObject->JSExpectStructure(); + JSExpect* instance = JSExpect::create(vm, globalObject, structure, ptr); + + return JSValue::encode(instance); } template<typename Visitor> @@ -2317,7 +2496,10 @@ void JSExpect::visitChildrenImpl(JSCell* cell, Visitor& visitor) ASSERT_GC_OBJECT_INHERITS(thisObject, info()); Base::visitChildren(thisObject, visitor); visitor.append(thisObject->m_capturedValue); - visitor.append(thisObject->m_resultValue); +visitor.append(thisObject->m_resultValue); + + + } DEFINE_VISIT_CHILDREN(JSExpect); @@ -2325,18 +2507,18 @@ DEFINE_VISIT_CHILDREN(JSExpect); template<typename Visitor> void JSExpect::visitAdditionalChildren(Visitor& visitor) { - JSExpect* thisObject = this; + JSExpect* thisObject = this; ASSERT_GC_OBJECT_INHERITS(thisObject, info()); visitor.append(thisObject->m_capturedValue); - visitor.append(thisObject->m_resultValue); - +visitor.append(thisObject->m_resultValue); + ; } DEFINE_VISIT_ADDITIONAL_CHILDREN(JSExpect); template<typename Visitor> -void JSExpect::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) +void JSExpect::visitOutputConstraintsImpl(JSCell *cell, Visitor& visitor) { JSExpect* thisObject = jsCast<JSExpect*>(cell); ASSERT_GC_OBJECT_INHERITS(thisObject, info()); @@ -2344,63 +2526,71 @@ void JSExpect::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) } DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSExpect); -class JSExpectAnyPrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; + class JSExpectAnyPrototype final : public JSC::JSNonFinalObject { + public: + using Base = JSC::JSNonFinalObject; + + static JSExpectAnyPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) + { + JSExpectAnyPrototype* ptr = new (NotNull, JSC::allocateCell<JSExpectAnyPrototype>(vm)) JSExpectAnyPrototype(vm, globalObject, structure); + ptr->finishCreation(vm, globalObject); + return ptr; + } + + DECLARE_INFO; + template<typename CellType, JSC::SubspaceAccess> + static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + return &vm.plainObjectSpace(); + } + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); + } + + private: + JSExpectAnyPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) + : Base(vm, structure) + { + } + + void finishCreation(JSC::VM&, JSC::JSGlobalObject*); + }; - static JSExpectAnyPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSExpectAnyPrototype* ptr = new (NotNull, JSC::allocateCell<JSExpectAnyPrototype>(vm)) JSExpectAnyPrototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } +extern "C" void ExpectAnyClass__finalize(void*); +extern "C" JSC_DECLARE_HOST_FUNCTION(ExpectAnyClass__call); - DECLARE_INFO; - template<typename CellType, JSC::SubspaceAccess> - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } -private: - JSExpectAnyPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } +STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSExpectAnyPrototype, JSExpectAnyPrototype::Base); - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; -extern "C" void ExpectAnyClass__finalize(void*); -extern "C" JSC_DECLARE_HOST_FUNCTION(ExpectAnyClass__call); + static const HashTableValue JSExpectAnyPrototypeTableValues[] = {}; -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSExpectAnyPrototype, JSExpectAnyPrototype::Base); -static const HashTableValue JSExpectAnyPrototypeTableValues[] = {}; const ClassInfo JSExpectAnyPrototype::s_info = { "ExpectAny"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSExpectAnyPrototype) }; -extern "C" void ExpectAnyPrototype__constructorValueSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast<JSExpectAny*>(JSValue::decode(thisValue)); - thisObject->m_constructorValue.set(vm, thisObject, JSValue::decode(value)); -} -extern "C" EncodedJSValue ExpectAnyPrototype__constructorValueGetCachedValue(JSC::EncodedJSValue thisValue) -{ + + extern "C" void ExpectAnyPrototype__constructorValueSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject *globalObject, JSC::EncodedJSValue value) + { + auto& vm = globalObject->vm(); + auto* thisObject = jsCast<JSExpectAny*>(JSValue::decode(thisValue)); + thisObject->m_constructorValue.set(vm, thisObject, JSValue::decode(value)); + } + + extern "C" EncodedJSValue ExpectAnyPrototype__constructorValueGetCachedValue(JSC::EncodedJSValue thisValue) + { auto* thisObject = jsCast<JSExpectAny*>(JSValue::decode(thisValue)); return JSValue::encode(thisObject->m_constructorValue.get()); -} + } + + void JSExpectAnyPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) { Base::finishCreation(vm); - + JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); } @@ -2414,7 +2604,7 @@ void JSExpectAny::destroy(JSCell* cell) { static_cast<JSExpectAny*>(cell)->JSExpectAny::~JSExpectAny(); } - + const ClassInfo JSExpectAny::s_info = { "ExpectAny"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSExpectAny) }; void JSExpectAny::finishCreation(VM& vm) @@ -2423,38 +2613,37 @@ void JSExpectAny::finishCreation(VM& vm) ASSERT(inherits(info())); } -JSExpectAny* JSExpectAny::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSExpectAny* ptr = new (NotNull, JSC::allocateCell<JSExpectAny>(vm)) JSExpectAny(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} -extern "C" void* ExpectAny__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; +JSExpectAny* JSExpectAny::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) { + JSExpectAny* ptr = new (NotNull, JSC::allocateCell<JSExpectAny>(vm)) JSExpectAny(vm, structure, ctx); + ptr->finishCreation(vm); + return ptr; +} - JSC::JSCell* cell = decodedValue.asCell(); - JSExpectAny* object = JSC::jsDynamicCast<JSExpectAny*>(cell); +extern "C" void* ExpectAny__fromJS(JSC::EncodedJSValue value) { + JSC::JSValue decodedValue = JSC::JSValue::decode(value); + if (decodedValue.isEmpty() || !decodedValue.isCell()) + return nullptr; - if (!object) - return nullptr; + JSC::JSCell* cell = decodedValue.asCell(); + JSExpectAny* object = JSC::jsDynamicCast<JSExpectAny*>(cell); - return object->wrapped(); + if (!object) + return nullptr; + + return object->wrapped(); } -extern "C" bool ExpectAny__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSExpectAny* object = JSC::jsDynamicCast<JSExpectAny*>(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; +extern "C" bool ExpectAny__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) { + JSExpectAny* object = JSC::jsDynamicCast<JSExpectAny*>(JSValue::decode(value)); + if (!object) + return false; + + object->m_ctx = ptr; + return true; } + extern "C" const size_t ExpectAny__ptrOffset = JSExpectAny::offsetOfWrapped(); void JSExpectAny::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) @@ -2467,18 +2656,19 @@ void JSExpectAny::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) Base::analyzeHeap(cell, analyzer); } + + JSObject* JSExpectAny::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) { return JSExpectAnyPrototype::create(vm, globalObject, JSExpectAnyPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); } -extern "C" EncodedJSValue ExpectAny__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSExpectAnyStructure(); - JSExpectAny* instance = JSExpectAny::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); +extern "C" EncodedJSValue ExpectAny__create(Zig::GlobalObject* globalObject, void* ptr) { + auto &vm = globalObject->vm(); + JSC::Structure* structure = globalObject->JSExpectAnyStructure(); + JSExpectAny* instance = JSExpectAny::create(vm, globalObject, structure, ptr); + + return JSValue::encode(instance); } template<typename Visitor> @@ -2488,6 +2678,9 @@ void JSExpectAny::visitChildrenImpl(JSCell* cell, Visitor& visitor) ASSERT_GC_OBJECT_INHERITS(thisObject, info()); Base::visitChildren(thisObject, visitor); visitor.append(thisObject->m_constructorValue); + + + } DEFINE_VISIT_CHILDREN(JSExpectAny); @@ -2495,17 +2688,17 @@ DEFINE_VISIT_CHILDREN(JSExpectAny); template<typename Visitor> void JSExpectAny::visitAdditionalChildren(Visitor& visitor) { - JSExpectAny* thisObject = this; + JSExpectAny* thisObject = this; ASSERT_GC_OBJECT_INHERITS(thisObject, info()); visitor.append(thisObject->m_constructorValue); - + ; } DEFINE_VISIT_ADDITIONAL_CHILDREN(JSExpectAny); template<typename Visitor> -void JSExpectAny::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) +void JSExpectAny::visitOutputConstraintsImpl(JSCell *cell, Visitor& visitor) { JSExpectAny* thisObject = jsCast<JSExpectAny*>(cell); ASSERT_GC_OBJECT_INHERITS(thisObject, info()); @@ -2513,105 +2706,117 @@ void JSExpectAny::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) } DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSExpectAny); -class JSFileSystemRouterPrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSFileSystemRouterPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSFileSystemRouterPrototype* ptr = new (NotNull, JSC::allocateCell<JSFileSystemRouterPrototype>(vm)) JSFileSystemRouterPrototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template<typename CellType, JSC::SubspaceAccess> - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSFileSystemRouterPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; + class JSFileSystemRouterPrototype final : public JSC::JSNonFinalObject { + public: + using Base = JSC::JSNonFinalObject; + + static JSFileSystemRouterPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) + { + JSFileSystemRouterPrototype* ptr = new (NotNull, JSC::allocateCell<JSFileSystemRouterPrototype>(vm)) JSFileSystemRouterPrototype(vm, globalObject, structure); + ptr->finishCreation(vm, globalObject); + return ptr; + } + + DECLARE_INFO; + template<typename CellType, JSC::SubspaceAccess> + static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + return &vm.plainObjectSpace(); + } + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); + } + + private: + JSFileSystemRouterPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) + : Base(vm, structure) + { + } + + void finishCreation(JSC::VM&, JSC::JSGlobalObject*); + }; class JSFileSystemRouterConstructor final : public JSC::InternalFunction { -public: - using Base = JSC::InternalFunction; - static JSFileSystemRouterConstructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSFileSystemRouterPrototype* prototype); - - static constexpr unsigned StructureFlags = Base::StructureFlags; - static constexpr bool needsDestruction = false; - - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); - } - - template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl<JSFileSystemRouterConstructor, WebCore::UseCustomHeapCellType::No>( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForFileSystemRouterConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForFileSystemRouterConstructor = std::forward<decltype(space)>(space); }, - [](auto& spaces) { return spaces.m_subspaceForFileSystemRouterConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForFileSystemRouterConstructor = std::forward<decltype(space)>(space); }); - } + public: + using Base = JSC::InternalFunction; + static JSFileSystemRouterConstructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSFileSystemRouterPrototype* prototype); + + static constexpr unsigned StructureFlags = Base::StructureFlags; + static constexpr bool needsDestruction = false; + + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); + } + + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return WebCore::subspaceForImpl<JSFileSystemRouterConstructor, WebCore::UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForFileSystemRouterConstructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForFileSystemRouterConstructor = std::forward<decltype(space)>(space); }, + [](auto& spaces) { return spaces.m_subspaceForFileSystemRouterConstructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForFileSystemRouterConstructor = std::forward<decltype(space)>(space); }); + } + + + void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSFileSystemRouterPrototype* prototype); + + // Must be defined for each specialization class. + static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); + + DECLARE_EXPORT_INFO; + private: + JSFileSystemRouterConstructor(JSC::VM& vm, JSC::Structure* structure); + void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSFileSystemRouterPrototype* prototype); + }; - void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSFileSystemRouterPrototype* prototype); - - // Must be defined for each specialization class. - static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); - - DECLARE_EXPORT_INFO; - -private: - JSFileSystemRouterConstructor(JSC::VM& vm, JSC::Structure* structure); - void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSFileSystemRouterPrototype* prototype); -}; extern "C" void* FileSystemRouterClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); JSC_DECLARE_CUSTOM_GETTER(jsFileSystemRouterConstructor); extern "C" void FileSystemRouterClass__finalize(void*); + extern "C" EncodedJSValue FileSystemRouterPrototype__match(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(FileSystemRouterPrototype__matchCallback); + extern "C" JSC::EncodedJSValue FileSystemRouterPrototype__getOrigin(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(FileSystemRouterPrototype__originGetterWrap); + extern "C" EncodedJSValue FileSystemRouterPrototype__reload(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(FileSystemRouterPrototype__reloadCallback); + extern "C" JSC::EncodedJSValue FileSystemRouterPrototype__getRoutes(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(FileSystemRouterPrototype__routesGetterWrap); + extern "C" JSC::EncodedJSValue FileSystemRouterPrototype__getStyle(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(FileSystemRouterPrototype__styleGetterWrap); + STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSFileSystemRouterPrototype, JSFileSystemRouterPrototype::Base); -static const HashTableValue JSFileSystemRouterPrototypeTableValues[] = { - { "match"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, FileSystemRouterPrototype__matchCallback, 1 } }, - { "origin"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, FileSystemRouterPrototype__originGetterWrap, 0 } }, - { "reload"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, FileSystemRouterPrototype__reloadCallback, 0 } }, - { "routes"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, FileSystemRouterPrototype__routesGetterWrap, 0 } }, - { "style"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, FileSystemRouterPrototype__styleGetterWrap, 0 } } + + static const HashTableValue JSFileSystemRouterPrototypeTableValues[] = { +{ "match"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, FileSystemRouterPrototype__matchCallback, 1 } } , +{ "origin"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, FileSystemRouterPrototype__originGetterWrap, 0 } } , +{ "reload"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, FileSystemRouterPrototype__reloadCallback, 0 } } , +{ "routes"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, FileSystemRouterPrototype__routesGetterWrap, 0 } } , +{ "style"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, FileSystemRouterPrototype__styleGetterWrap, 0 } } }; + + const ClassInfo JSFileSystemRouterPrototype::s_info = { "FileSystemRouter"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSFileSystemRouterPrototype) }; + + JSC_DEFINE_CUSTOM_GETTER(jsFileSystemRouterConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); @@ -2622,132 +2827,148 @@ JSC_DEFINE_CUSTOM_GETTER(jsFileSystemRouterConstructor, (JSGlobalObject * lexica if (UNLIKELY(!prototype)) return throwVMTypeError(lexicalGlobalObject, throwScope); return JSValue::encode(globalObject->JSFileSystemRouterConstructor()); -} +} + -JSC_DEFINE_HOST_FUNCTION(FileSystemRouterPrototype__matchCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - JSFileSystemRouter* thisObject = jsDynamicCast<JSFileSystemRouter*>(callFrame->thisValue()); + JSC_DEFINE_HOST_FUNCTION(FileSystemRouterPrototype__matchCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } + JSFileSystemRouter* thisObject = jsDynamicCast<JSFileSystemRouter*>(callFrame->thisValue()); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - return FileSystemRouterPrototype__match(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + + return FileSystemRouterPrototype__match(thisObject->wrapped(), lexicalGlobalObject, callFrame); + } + JSC_DEFINE_CUSTOM_GETTER(FileSystemRouterPrototype__originGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSFileSystemRouter* thisObject = jsCast<JSFileSystemRouter*>(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + if (JSValue cachedValue = thisObject->m_origin.get()) return JSValue::encode(cachedValue); - + JSC::JSValue result = JSC::JSValue::decode( - FileSystemRouterPrototype__getOrigin(thisObject->wrapped(), globalObject)); + FileSystemRouterPrototype__getOrigin(thisObject->wrapped(), globalObject) + ); RETURN_IF_EXCEPTION(throwScope, {}); thisObject->m_origin.set(vm, thisObject, result); RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); } -extern "C" void FileSystemRouterPrototype__originSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast<JSFileSystemRouter*>(JSValue::decode(thisValue)); - thisObject->m_origin.set(vm, thisObject, JSValue::decode(value)); -} -extern "C" EncodedJSValue FileSystemRouterPrototype__originGetCachedValue(JSC::EncodedJSValue thisValue) -{ + extern "C" void FileSystemRouterPrototype__originSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject *globalObject, JSC::EncodedJSValue value) + { + auto& vm = globalObject->vm(); + auto* thisObject = jsCast<JSFileSystemRouter*>(JSValue::decode(thisValue)); + thisObject->m_origin.set(vm, thisObject, JSValue::decode(value)); + } + + extern "C" EncodedJSValue FileSystemRouterPrototype__originGetCachedValue(JSC::EncodedJSValue thisValue) + { auto* thisObject = jsCast<JSFileSystemRouter*>(JSValue::decode(thisValue)); return JSValue::encode(thisObject->m_origin.get()); -} + } + + -JSC_DEFINE_HOST_FUNCTION(FileSystemRouterPrototype__reloadCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + JSC_DEFINE_HOST_FUNCTION(FileSystemRouterPrototype__reloadCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - JSFileSystemRouter* thisObject = jsDynamicCast<JSFileSystemRouter*>(callFrame->thisValue()); + JSFileSystemRouter* thisObject = jsDynamicCast<JSFileSystemRouter*>(callFrame->thisValue()); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return FileSystemRouterPrototype__reload(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + return FileSystemRouterPrototype__reload(thisObject->wrapped(), lexicalGlobalObject, callFrame); + } + JSC_DEFINE_CUSTOM_GETTER(FileSystemRouterPrototype__routesGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSFileSystemRouter* thisObject = jsCast<JSFileSystemRouter*>(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + if (JSValue cachedValue = thisObject->m_routes.get()) return JSValue::encode(cachedValue); - + JSC::JSValue result = JSC::JSValue::decode( - FileSystemRouterPrototype__getRoutes(thisObject->wrapped(), globalObject)); + FileSystemRouterPrototype__getRoutes(thisObject->wrapped(), globalObject) + ); RETURN_IF_EXCEPTION(throwScope, {}); thisObject->m_routes.set(vm, thisObject, result); RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); } -extern "C" void FileSystemRouterPrototype__routesSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast<JSFileSystemRouter*>(JSValue::decode(thisValue)); - thisObject->m_routes.set(vm, thisObject, JSValue::decode(value)); -} -extern "C" EncodedJSValue FileSystemRouterPrototype__routesGetCachedValue(JSC::EncodedJSValue thisValue) -{ + extern "C" void FileSystemRouterPrototype__routesSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject *globalObject, JSC::EncodedJSValue value) + { + auto& vm = globalObject->vm(); + auto* thisObject = jsCast<JSFileSystemRouter*>(JSValue::decode(thisValue)); + thisObject->m_routes.set(vm, thisObject, JSValue::decode(value)); + } + + extern "C" EncodedJSValue FileSystemRouterPrototype__routesGetCachedValue(JSC::EncodedJSValue thisValue) + { auto* thisObject = jsCast<JSFileSystemRouter*>(JSValue::decode(thisValue)); return JSValue::encode(thisObject->m_routes.get()); -} + } + + JSC_DEFINE_CUSTOM_GETTER(FileSystemRouterPrototype__styleGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSFileSystemRouter* thisObject = jsCast<JSFileSystemRouter*>(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + if (JSValue cachedValue = thisObject->m_style.get()) return JSValue::encode(cachedValue); - + JSC::JSValue result = JSC::JSValue::decode( - FileSystemRouterPrototype__getStyle(thisObject->wrapped(), globalObject)); + FileSystemRouterPrototype__getStyle(thisObject->wrapped(), globalObject) + ); RETURN_IF_EXCEPTION(throwScope, {}); thisObject->m_style.set(vm, thisObject, result); RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); } -extern "C" void FileSystemRouterPrototype__styleSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast<JSFileSystemRouter*>(JSValue::decode(thisValue)); - thisObject->m_style.set(vm, thisObject, JSValue::decode(value)); -} -extern "C" EncodedJSValue FileSystemRouterPrototype__styleGetCachedValue(JSC::EncodedJSValue thisValue) -{ + extern "C" void FileSystemRouterPrototype__styleSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject *globalObject, JSC::EncodedJSValue value) + { + auto& vm = globalObject->vm(); + auto* thisObject = jsCast<JSFileSystemRouter*>(JSValue::decode(thisValue)); + thisObject->m_style.set(vm, thisObject, JSValue::decode(value)); + } + + extern "C" EncodedJSValue FileSystemRouterPrototype__styleGetCachedValue(JSC::EncodedJSValue thisValue) + { auto* thisObject = jsCast<JSFileSystemRouter*>(JSValue::decode(thisValue)); return JSValue::encode(thisObject->m_style.get()); -} + } + + void JSFileSystemRouterPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) { @@ -2759,64 +2980,67 @@ void JSFileSystemRouterPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObjec void JSFileSystemRouterConstructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSFileSystemRouterPrototype* prototype) { Base::finishCreation(vm, 0, "FileSystemRouter"_s, PropertyAdditionMode::WithoutStructureTransition); - + putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly); ASSERT(inherits(info())); } -JSFileSystemRouterConstructor::JSFileSystemRouterConstructor(JSC::VM& vm, JSC::Structure* structure) - : Base(vm, structure, construct, construct) -{ -} +JSFileSystemRouterConstructor::JSFileSystemRouterConstructor(JSC::VM& vm, JSC::Structure* structure) : Base(vm, structure, construct, construct) { -JSFileSystemRouterConstructor* JSFileSystemRouterConstructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSFileSystemRouterPrototype* prototype) -{ + } + +JSFileSystemRouterConstructor* JSFileSystemRouterConstructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSFileSystemRouterPrototype* prototype) { JSFileSystemRouterConstructor* ptr = new (NotNull, JSC::allocateCell<JSFileSystemRouterConstructor>(vm)) JSFileSystemRouterConstructor(vm, structure); ptr->finishCreation(vm, globalObject, prototype); return ptr; } + JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSFileSystemRouterConstructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) { - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); - JSC::VM& vm = globalObject->vm(); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + JSC::VM &vm = globalObject->vm(); JSObject* newTarget = asObject(callFrame->newTarget()); auto* constructor = globalObject->JSFileSystemRouterConstructor(); Structure* structure = globalObject->JSFileSystemRouterStructure(); if (constructor != newTarget) { - auto scope = DECLARE_THROW_SCOPE(vm); + auto scope = DECLARE_THROW_SCOPE(vm); - auto* functionGlobalObject = reinterpret_cast<Zig::GlobalObject*>( - // ShadowRealm functions belong to a different global object. - getFunctionRealm(globalObject, newTarget)); - RETURN_IF_EXCEPTION(scope, {}); - structure = InternalFunction::createSubclassStructure( - globalObject, - newTarget, - functionGlobalObject->JSFileSystemRouterStructure()); + auto* functionGlobalObject = reinterpret_cast<Zig::GlobalObject*>( + // ShadowRealm functions belong to a different global object. + getFunctionRealm(globalObject, newTarget) + ); + RETURN_IF_EXCEPTION(scope, {}); + structure = InternalFunction::createSubclassStructure( + globalObject, + newTarget, + functionGlobalObject->JSFileSystemRouterStructure() + ); } void* ptr = FileSystemRouterClass__construct(globalObject, callFrame); if (UNLIKELY(!ptr)) { - return JSValue::encode(JSC::jsUndefined()); + return JSValue::encode(JSC::jsUndefined()); } JSFileSystemRouter* instance = JSFileSystemRouter::create(vm, globalObject, structure, ptr); + return JSValue::encode(instance); } void JSFileSystemRouterConstructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSFileSystemRouterPrototype* prototype) { + } const ClassInfo JSFileSystemRouterConstructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSFileSystemRouterConstructor) }; -extern "C" EncodedJSValue FileSystemRouter__getConstructor(Zig::GlobalObject* globalObject) -{ + + extern "C" EncodedJSValue FileSystemRouter__getConstructor(Zig::GlobalObject* globalObject) { return JSValue::encode(globalObject->JSFileSystemRouterConstructor()); -} + } JSFileSystemRouter::~JSFileSystemRouter() { @@ -2828,7 +3052,7 @@ void JSFileSystemRouter::destroy(JSCell* cell) { static_cast<JSFileSystemRouter*>(cell)->JSFileSystemRouter::~JSFileSystemRouter(); } - + const ClassInfo JSFileSystemRouter::s_info = { "FileSystemRouter"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSFileSystemRouter) }; void JSFileSystemRouter::finishCreation(VM& vm) @@ -2837,38 +3061,37 @@ void JSFileSystemRouter::finishCreation(VM& vm) ASSERT(inherits(info())); } -JSFileSystemRouter* JSFileSystemRouter::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSFileSystemRouter* ptr = new (NotNull, JSC::allocateCell<JSFileSystemRouter>(vm)) JSFileSystemRouter(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} -extern "C" void* FileSystemRouter__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; +JSFileSystemRouter* JSFileSystemRouter::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) { + JSFileSystemRouter* ptr = new (NotNull, JSC::allocateCell<JSFileSystemRouter>(vm)) JSFileSystemRouter(vm, structure, ctx); + ptr->finishCreation(vm); + return ptr; +} - JSC::JSCell* cell = decodedValue.asCell(); - JSFileSystemRouter* object = JSC::jsDynamicCast<JSFileSystemRouter*>(cell); +extern "C" void* FileSystemRouter__fromJS(JSC::EncodedJSValue value) { + JSC::JSValue decodedValue = JSC::JSValue::decode(value); + if (decodedValue.isEmpty() || !decodedValue.isCell()) + return nullptr; - if (!object) - return nullptr; + JSC::JSCell* cell = decodedValue.asCell(); + JSFileSystemRouter* object = JSC::jsDynamicCast<JSFileSystemRouter*>(cell); - return object->wrapped(); + if (!object) + return nullptr; + + return object->wrapped(); } -extern "C" bool FileSystemRouter__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSFileSystemRouter* object = JSC::jsDynamicCast<JSFileSystemRouter*>(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; +extern "C" bool FileSystemRouter__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) { + JSFileSystemRouter* object = JSC::jsDynamicCast<JSFileSystemRouter*>(JSValue::decode(value)); + if (!object) + return false; + + object->m_ctx = ptr; + return true; } + extern "C" const size_t FileSystemRouter__ptrOffset = JSFileSystemRouter::offsetOfWrapped(); void JSFileSystemRouter::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) @@ -2883,7 +3106,7 @@ void JSFileSystemRouter::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) JSObject* JSFileSystemRouter::createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype) { - return WebCore::JSFileSystemRouterConstructor::create(vm, globalObject, WebCore::JSFileSystemRouterConstructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast<WebCore::JSFileSystemRouterPrototype*>(prototype)); + return WebCore::JSFileSystemRouterConstructor::create(vm, globalObject, WebCore::JSFileSystemRouterConstructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast<WebCore::JSFileSystemRouterPrototype*>(prototype)); } JSObject* JSFileSystemRouter::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) @@ -2891,13 +3114,12 @@ JSObject* JSFileSystemRouter::createPrototype(VM& vm, JSDOMGlobalObject* globalO return JSFileSystemRouterPrototype::create(vm, globalObject, JSFileSystemRouterPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); } -extern "C" EncodedJSValue FileSystemRouter__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSFileSystemRouterStructure(); - JSFileSystemRouter* instance = JSFileSystemRouter::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); +extern "C" EncodedJSValue FileSystemRouter__create(Zig::GlobalObject* globalObject, void* ptr) { + auto &vm = globalObject->vm(); + JSC::Structure* structure = globalObject->JSFileSystemRouterStructure(); + JSFileSystemRouter* instance = JSFileSystemRouter::create(vm, globalObject, structure, ptr); + + return JSValue::encode(instance); } template<typename Visitor> @@ -2906,10 +3128,12 @@ void JSFileSystemRouter::visitChildrenImpl(JSCell* cell, Visitor& visitor) JSFileSystemRouter* thisObject = jsCast<JSFileSystemRouter*>(cell); ASSERT_GC_OBJECT_INHERITS(thisObject, info()); Base::visitChildren(thisObject, visitor); - + + visitor.append(thisObject->m_origin); visitor.append(thisObject->m_routes); visitor.append(thisObject->m_style); + } DEFINE_VISIT_CHILDREN(JSFileSystemRouter); @@ -2917,10 +3141,10 @@ DEFINE_VISIT_CHILDREN(JSFileSystemRouter); template<typename Visitor> void JSFileSystemRouter::visitAdditionalChildren(Visitor& visitor) { - JSFileSystemRouter* thisObject = this; + JSFileSystemRouter* thisObject = this; ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - - visitor.append(thisObject->m_origin); + + visitor.append(thisObject->m_origin); visitor.append(thisObject->m_routes); visitor.append(thisObject->m_style); ; @@ -2929,7 +3153,7 @@ void JSFileSystemRouter::visitAdditionalChildren(Visitor& visitor) DEFINE_VISIT_ADDITIONAL_CHILDREN(JSFileSystemRouter); template<typename Visitor> -void JSFileSystemRouter::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) +void JSFileSystemRouter::visitOutputConstraintsImpl(JSCell *cell, Visitor& visitor) { JSFileSystemRouter* thisObject = jsCast<JSFileSystemRouter*>(cell); ASSERT_GC_OBJECT_INHERITS(thisObject, info()); @@ -2937,83 +3161,98 @@ void JSFileSystemRouter::visitOutputConstraintsImpl(JSCell* cell, Visitor& visit } DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSFileSystemRouter); -class JSListenerPrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSListenerPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSListenerPrototype* ptr = new (NotNull, JSC::allocateCell<JSListenerPrototype>(vm)) JSListenerPrototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template<typename CellType, JSC::SubspaceAccess> - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSListenerPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; + class JSListenerPrototype final : public JSC::JSNonFinalObject { + public: + using Base = JSC::JSNonFinalObject; + + static JSListenerPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) + { + JSListenerPrototype* ptr = new (NotNull, JSC::allocateCell<JSListenerPrototype>(vm)) JSListenerPrototype(vm, globalObject, structure); + ptr->finishCreation(vm, globalObject); + return ptr; + } + + DECLARE_INFO; + template<typename CellType, JSC::SubspaceAccess> + static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + return &vm.plainObjectSpace(); + } + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); + } + + private: + JSListenerPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) + : Base(vm, structure) + { + } + + void finishCreation(JSC::VM&, JSC::JSGlobalObject*); + }; extern "C" void* ListenerClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); JSC_DECLARE_CUSTOM_GETTER(jsListenerConstructor); extern "C" void ListenerClass__finalize(void*); + extern "C" JSC::EncodedJSValue ListenerPrototype__getData(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(ListenerPrototype__dataGetterWrap); + extern "C" bool ListenerPrototype__setData(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::EncodedJSValue value); JSC_DECLARE_CUSTOM_SETTER(ListenerPrototype__dataSetterWrap); + extern "C" JSC::EncodedJSValue ListenerPrototype__getHostname(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(ListenerPrototype__hostnameGetterWrap); + extern "C" JSC::EncodedJSValue ListenerPrototype__getPort(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(ListenerPrototype__portGetterWrap); + extern "C" EncodedJSValue ListenerPrototype__ref(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(ListenerPrototype__refCallback); + extern "C" EncodedJSValue ListenerPrototype__reload(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(ListenerPrototype__reloadCallback); + extern "C" EncodedJSValue ListenerPrototype__stop(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(ListenerPrototype__stopCallback); + extern "C" JSC::EncodedJSValue ListenerPrototype__getUnix(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(ListenerPrototype__unixGetterWrap); + extern "C" EncodedJSValue ListenerPrototype__unref(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(ListenerPrototype__unrefCallback); + STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSListenerPrototype, JSListenerPrototype::Base); -static const HashTableValue JSListenerPrototypeTableValues[] = { - { "data"_s, static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ListenerPrototype__dataGetterWrap, ListenerPrototype__dataSetterWrap } }, - { "hostname"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ListenerPrototype__hostnameGetterWrap, 0 } }, - { "port"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ListenerPrototype__portGetterWrap, 0 } }, - { "ref"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ListenerPrototype__refCallback, 0 } }, - { "reload"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ListenerPrototype__reloadCallback, 1 } }, - { "stop"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ListenerPrototype__stopCallback, 1 } }, - { "unix"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ListenerPrototype__unixGetterWrap, 0 } }, - { "unref"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ListenerPrototype__unrefCallback, 0 } } + + static const HashTableValue JSListenerPrototypeTableValues[] = { +{ "data"_s, static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ListenerPrototype__dataGetterWrap, ListenerPrototype__dataSetterWrap } } , +{ "hostname"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ListenerPrototype__hostnameGetterWrap, 0 } } , +{ "port"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ListenerPrototype__portGetterWrap, 0 } } , +{ "ref"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ListenerPrototype__refCallback, 0 } } , +{ "reload"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ListenerPrototype__reloadCallback, 1 } } , +{ "stop"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ListenerPrototype__stopCallback, 1 } } , +{ "unix"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ListenerPrototype__unixGetterWrap, 0 } } , +{ "unref"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ListenerPrototype__unrefCallback, 0 } } }; + + const ClassInfo JSListenerPrototype::s_info = { "Listener"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSListenerPrototype) }; + + JSC_DEFINE_CUSTOM_GETTER(jsListenerConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); @@ -3024,12 +3263,14 @@ JSC_DEFINE_CUSTOM_GETTER(jsListenerConstructor, (JSGlobalObject * lexicalGlobalO if (UNLIKELY(!prototype)) return throwVMTypeError(lexicalGlobalObject, throwScope); return JSValue::encode(globalObject->JSListenerConstructor()); -} +} + + JSC_DEFINE_CUSTOM_GETTER(ListenerPrototype__dataGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSListener* thisObject = jsCast<JSListener*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -3037,6 +3278,7 @@ JSC_DEFINE_CUSTOM_GETTER(ListenerPrototype__dataGetterWrap, (JSGlobalObject * le RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + JSC_DEFINE_CUSTOM_SETTER(ListenerPrototype__dataSetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue, PropertyName attributeName)) { @@ -3049,41 +3291,46 @@ JSC_DEFINE_CUSTOM_SETTER(ListenerPrototype__dataSetterWrap, (JSGlobalObject * le RELEASE_AND_RETURN(throwScope, result); } + JSC_DEFINE_CUSTOM_GETTER(ListenerPrototype__hostnameGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSListener* thisObject = jsCast<JSListener*>(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + if (JSValue cachedValue = thisObject->m_hostname.get()) return JSValue::encode(cachedValue); - + JSC::JSValue result = JSC::JSValue::decode( - ListenerPrototype__getHostname(thisObject->wrapped(), globalObject)); + ListenerPrototype__getHostname(thisObject->wrapped(), globalObject) + ); RETURN_IF_EXCEPTION(throwScope, {}); thisObject->m_hostname.set(vm, thisObject, result); RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); } -extern "C" void ListenerPrototype__hostnameSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast<JSListener*>(JSValue::decode(thisValue)); - thisObject->m_hostname.set(vm, thisObject, JSValue::decode(value)); -} -extern "C" EncodedJSValue ListenerPrototype__hostnameGetCachedValue(JSC::EncodedJSValue thisValue) -{ + extern "C" void ListenerPrototype__hostnameSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject *globalObject, JSC::EncodedJSValue value) + { + auto& vm = globalObject->vm(); + auto* thisObject = jsCast<JSListener*>(JSValue::decode(thisValue)); + thisObject->m_hostname.set(vm, thisObject, JSValue::decode(value)); + } + + extern "C" EncodedJSValue ListenerPrototype__hostnameGetCachedValue(JSC::EncodedJSValue thisValue) + { auto* thisObject = jsCast<JSListener*>(JSValue::decode(thisValue)); return JSValue::encode(thisObject->m_hostname.get()); -} + } + + JSC_DEFINE_CUSTOM_GETTER(ListenerPrototype__portGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSListener* thisObject = jsCast<JSListener*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -3091,101 +3338,110 @@ JSC_DEFINE_CUSTOM_GETTER(ListenerPrototype__portGetterWrap, (JSGlobalObject * le RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + -JSC_DEFINE_HOST_FUNCTION(ListenerPrototype__refCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + JSC_DEFINE_HOST_FUNCTION(ListenerPrototype__refCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - JSListener* thisObject = jsDynamicCast<JSListener*>(callFrame->thisValue()); + JSListener* thisObject = jsDynamicCast<JSListener*>(callFrame->thisValue()); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } + + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + + return ListenerPrototype__ref(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(ListenerPrototype__reloadCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return ListenerPrototype__ref(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSListener* thisObject = jsDynamicCast<JSListener*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(ListenerPrototype__reloadCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSListener* thisObject = jsDynamicCast<JSListener*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return ListenerPrototype__reload(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(ListenerPrototype__stopCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return ListenerPrototype__reload(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSListener* thisObject = jsDynamicCast<JSListener*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(ListenerPrototype__stopCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSListener* thisObject = jsDynamicCast<JSListener*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return ListenerPrototype__stop(thisObject->wrapped(), lexicalGlobalObject, callFrame); } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - return ListenerPrototype__stop(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSC_DEFINE_CUSTOM_GETTER(ListenerPrototype__unixGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSListener* thisObject = jsCast<JSListener*>(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + if (JSValue cachedValue = thisObject->m_unix.get()) return JSValue::encode(cachedValue); - + JSC::JSValue result = JSC::JSValue::decode( - ListenerPrototype__getUnix(thisObject->wrapped(), globalObject)); + ListenerPrototype__getUnix(thisObject->wrapped(), globalObject) + ); RETURN_IF_EXCEPTION(throwScope, {}); thisObject->m_unix.set(vm, thisObject, result); RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); } -extern "C" void ListenerPrototype__unixSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast<JSListener*>(JSValue::decode(thisValue)); - thisObject->m_unix.set(vm, thisObject, JSValue::decode(value)); -} -extern "C" EncodedJSValue ListenerPrototype__unixGetCachedValue(JSC::EncodedJSValue thisValue) -{ + extern "C" void ListenerPrototype__unixSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject *globalObject, JSC::EncodedJSValue value) + { + auto& vm = globalObject->vm(); + auto* thisObject = jsCast<JSListener*>(JSValue::decode(thisValue)); + thisObject->m_unix.set(vm, thisObject, JSValue::decode(value)); + } + + extern "C" EncodedJSValue ListenerPrototype__unixGetCachedValue(JSC::EncodedJSValue thisValue) + { auto* thisObject = jsCast<JSListener*>(JSValue::decode(thisValue)); return JSValue::encode(thisObject->m_unix.get()); -} + } + + -JSC_DEFINE_HOST_FUNCTION(ListenerPrototype__unrefCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + JSC_DEFINE_HOST_FUNCTION(ListenerPrototype__unrefCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - JSListener* thisObject = jsDynamicCast<JSListener*>(callFrame->thisValue()); + JSListener* thisObject = jsDynamicCast<JSListener*>(callFrame->thisValue()); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return ListenerPrototype__unref(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + return ListenerPrototype__unref(thisObject->wrapped(), lexicalGlobalObject, callFrame); + } + void JSListenerPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) { @@ -3204,7 +3460,7 @@ void JSListener::destroy(JSCell* cell) { static_cast<JSListener*>(cell)->JSListener::~JSListener(); } - + const ClassInfo JSListener::s_info = { "Listener"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSListener) }; void JSListener::finishCreation(VM& vm) @@ -3213,38 +3469,37 @@ void JSListener::finishCreation(VM& vm) ASSERT(inherits(info())); } -JSListener* JSListener::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSListener* ptr = new (NotNull, JSC::allocateCell<JSListener>(vm)) JSListener(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} -extern "C" void* Listener__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; +JSListener* JSListener::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) { + JSListener* ptr = new (NotNull, JSC::allocateCell<JSListener>(vm)) JSListener(vm, structure, ctx); + ptr->finishCreation(vm); + return ptr; +} - JSC::JSCell* cell = decodedValue.asCell(); - JSListener* object = JSC::jsDynamicCast<JSListener*>(cell); +extern "C" void* Listener__fromJS(JSC::EncodedJSValue value) { + JSC::JSValue decodedValue = JSC::JSValue::decode(value); + if (decodedValue.isEmpty() || !decodedValue.isCell()) + return nullptr; - if (!object) - return nullptr; + JSC::JSCell* cell = decodedValue.asCell(); + JSListener* object = JSC::jsDynamicCast<JSListener*>(cell); - return object->wrapped(); + if (!object) + return nullptr; + + return object->wrapped(); } -extern "C" bool Listener__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSListener* object = JSC::jsDynamicCast<JSListener*>(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; +extern "C" bool Listener__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) { + JSListener* object = JSC::jsDynamicCast<JSListener*>(JSValue::decode(value)); + if (!object) + return false; + + object->m_ctx = ptr; + return true; } + extern "C" const size_t Listener__ptrOffset = JSListener::offsetOfWrapped(); void JSListener::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) @@ -3257,18 +3512,19 @@ void JSListener::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) Base::analyzeHeap(cell, analyzer); } + + JSObject* JSListener::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) { return JSListenerPrototype::create(vm, globalObject, JSListenerPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); } -extern "C" EncodedJSValue Listener__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSListenerStructure(); - JSListener* instance = JSListener::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); +extern "C" EncodedJSValue Listener__create(Zig::GlobalObject* globalObject, void* ptr) { + auto &vm = globalObject->vm(); + JSC::Structure* structure = globalObject->JSListenerStructure(); + JSListener* instance = JSListener::create(vm, globalObject, structure, ptr); + + return JSValue::encode(instance); } template<typename Visitor> @@ -3277,9 +3533,11 @@ void JSListener::visitChildrenImpl(JSCell* cell, Visitor& visitor) JSListener* thisObject = jsCast<JSListener*>(cell); ASSERT_GC_OBJECT_INHERITS(thisObject, info()); Base::visitChildren(thisObject, visitor); - + + visitor.append(thisObject->m_hostname); visitor.append(thisObject->m_unix); + } DEFINE_VISIT_CHILDREN(JSListener); @@ -3287,10 +3545,10 @@ DEFINE_VISIT_CHILDREN(JSListener); template<typename Visitor> void JSListener::visitAdditionalChildren(Visitor& visitor) { - JSListener* thisObject = this; + JSListener* thisObject = this; ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - - visitor.append(thisObject->m_hostname); + + visitor.append(thisObject->m_hostname); visitor.append(thisObject->m_unix); ; } @@ -3298,7 +3556,7 @@ void JSListener::visitAdditionalChildren(Visitor& visitor) DEFINE_VISIT_ADDITIONAL_CHILDREN(JSListener); template<typename Visitor> -void JSListener::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) +void JSListener::visitOutputConstraintsImpl(JSCell *cell, Visitor& visitor) { JSListener* thisObject = jsCast<JSListener*>(cell); ASSERT_GC_OBJECT_INHERITS(thisObject, info()); @@ -3306,97 +3564,107 @@ void JSListener::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) } DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSListener); -class JSMD4Prototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSMD4Prototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSMD4Prototype* ptr = new (NotNull, JSC::allocateCell<JSMD4Prototype>(vm)) JSMD4Prototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template<typename CellType, JSC::SubspaceAccess> - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSMD4Prototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; + class JSMD4Prototype final : public JSC::JSNonFinalObject { + public: + using Base = JSC::JSNonFinalObject; + + static JSMD4Prototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) + { + JSMD4Prototype* ptr = new (NotNull, JSC::allocateCell<JSMD4Prototype>(vm)) JSMD4Prototype(vm, globalObject, structure); + ptr->finishCreation(vm, globalObject); + return ptr; + } + + DECLARE_INFO; + template<typename CellType, JSC::SubspaceAccess> + static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + return &vm.plainObjectSpace(); + } + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); + } + + private: + JSMD4Prototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) + : Base(vm, structure) + { + } + + void finishCreation(JSC::VM&, JSC::JSGlobalObject*); + }; class JSMD4Constructor final : public JSC::InternalFunction { -public: - using Base = JSC::InternalFunction; - static JSMD4Constructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSMD4Prototype* prototype); - - static constexpr unsigned StructureFlags = Base::StructureFlags; - static constexpr bool needsDestruction = false; - - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); - } - - template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl<JSMD4Constructor, WebCore::UseCustomHeapCellType::No>( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForMD4Constructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForMD4Constructor = std::forward<decltype(space)>(space); }, - [](auto& spaces) { return spaces.m_subspaceForMD4Constructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForMD4Constructor = std::forward<decltype(space)>(space); }); - } - - void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSMD4Prototype* prototype); + public: + using Base = JSC::InternalFunction; + static JSMD4Constructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSMD4Prototype* prototype); + + static constexpr unsigned StructureFlags = Base::StructureFlags; + static constexpr bool needsDestruction = false; + + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); + } + + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return WebCore::subspaceForImpl<JSMD4Constructor, WebCore::UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForMD4Constructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForMD4Constructor = std::forward<decltype(space)>(space); }, + [](auto& spaces) { return spaces.m_subspaceForMD4Constructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForMD4Constructor = std::forward<decltype(space)>(space); }); + } + + + void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSMD4Prototype* prototype); + + // Must be defined for each specialization class. + static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); + + DECLARE_EXPORT_INFO; + private: + JSMD4Constructor(JSC::VM& vm, JSC::Structure* structure); + void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSMD4Prototype* prototype); + }; - // Must be defined for each specialization class. - static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); - - DECLARE_EXPORT_INFO; - -private: - JSMD4Constructor(JSC::VM& vm, JSC::Structure* structure); - void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSMD4Prototype* prototype); -}; extern "C" void* MD4Class__construct(JSC::JSGlobalObject*, JSC::CallFrame*); JSC_DECLARE_CUSTOM_GETTER(jsMD4Constructor); extern "C" void MD4Class__finalize(void*); + extern "C" JSC::EncodedJSValue MD4Prototype__getByteLength(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(MD4Prototype__byteLengthGetterWrap); + extern "C" EncodedJSValue MD4Prototype__digest(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(MD4Prototype__digestCallback); + extern "C" EncodedJSValue MD4Prototype__update(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(MD4Prototype__updateCallback); + STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSMD4Prototype, JSMD4Prototype::Base); -static const HashTableValue JSMD4PrototypeTableValues[] = { - { "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, MD4Prototype__byteLengthGetterWrap, 0 } }, - { "digest"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, MD4Prototype__digestCallback, 0 } }, - { "update"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, MD4Prototype__updateCallback, 1 } } + + static const HashTableValue JSMD4PrototypeTableValues[] = { +{ "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, MD4Prototype__byteLengthGetterWrap, 0 } } , +{ "digest"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, MD4Prototype__digestCallback, 0 } } , +{ "update"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, MD4Prototype__updateCallback, 1 } } }; + + const ClassInfo JSMD4Prototype::s_info = { "MD4"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSMD4Prototype) }; + + JSC_DEFINE_CUSTOM_GETTER(jsMD4Constructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); @@ -3407,12 +3675,14 @@ JSC_DEFINE_CUSTOM_GETTER(jsMD4Constructor, (JSGlobalObject * lexicalGlobalObject if (UNLIKELY(!prototype)) return throwVMTypeError(lexicalGlobalObject, throwScope); return JSValue::encode(globalObject->JSMD4Constructor()); -} +} + + JSC_DEFINE_CUSTOM_GETTER(MD4Prototype__byteLengthGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSMD4* thisObject = jsCast<JSMD4*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -3420,38 +3690,41 @@ JSC_DEFINE_CUSTOM_GETTER(MD4Prototype__byteLengthGetterWrap, (JSGlobalObject * l RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + -JSC_DEFINE_HOST_FUNCTION(MD4Prototype__digestCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + JSC_DEFINE_HOST_FUNCTION(MD4Prototype__digestCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - JSMD4* thisObject = jsDynamicCast<JSMD4*>(callFrame->thisValue()); + JSMD4* thisObject = jsDynamicCast<JSMD4*>(callFrame->thisValue()); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return MD4Prototype__digest(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + return MD4Prototype__digest(thisObject->wrapped(), lexicalGlobalObject, callFrame); + } + -JSC_DEFINE_HOST_FUNCTION(MD4Prototype__updateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + JSC_DEFINE_HOST_FUNCTION(MD4Prototype__updateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - JSMD4* thisObject = jsDynamicCast<JSMD4*>(callFrame->thisValue()); + JSMD4* thisObject = jsDynamicCast<JSMD4*>(callFrame->thisValue()); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return MD4Prototype__update(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + return MD4Prototype__update(thisObject->wrapped(), lexicalGlobalObject, callFrame); + } + void JSMD4Prototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) { @@ -3463,11 +3736,12 @@ void JSMD4Prototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObje extern "C" JSC_DECLARE_CUSTOM_GETTER(MD4Class__getByteLengthStatic); extern "C" JSC_DECLARE_HOST_FUNCTION(MD4Class__hash); -static const HashTableValue JSMD4ConstructorTableValues[] = { - { "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, MD4Class__getByteLengthStatic, 0 } }, - { "hash"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, MD4Class__hash, 2 } } + static const HashTableValue JSMD4ConstructorTableValues[] = { +{ "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, MD4Class__getByteLengthStatic, 0 } } , +{ "hash"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, MD4Class__hash, 2 } } }; + void JSMD4Constructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSMD4Prototype* prototype) { Base::finishCreation(vm, 0, "MD4"_s, PropertyAdditionMode::WithoutStructureTransition); @@ -3476,59 +3750,62 @@ void JSMD4Constructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, ASSERT(inherits(info())); } -JSMD4Constructor::JSMD4Constructor(JSC::VM& vm, JSC::Structure* structure) - : Base(vm, structure, construct, construct) -{ -} +JSMD4Constructor::JSMD4Constructor(JSC::VM& vm, JSC::Structure* structure) : Base(vm, structure, construct, construct) { -JSMD4Constructor* JSMD4Constructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSMD4Prototype* prototype) -{ + } + +JSMD4Constructor* JSMD4Constructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSMD4Prototype* prototype) { JSMD4Constructor* ptr = new (NotNull, JSC::allocateCell<JSMD4Constructor>(vm)) JSMD4Constructor(vm, structure); ptr->finishCreation(vm, globalObject, prototype); return ptr; } + JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSMD4Constructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) { - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); - JSC::VM& vm = globalObject->vm(); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + JSC::VM &vm = globalObject->vm(); JSObject* newTarget = asObject(callFrame->newTarget()); auto* constructor = globalObject->JSMD4Constructor(); Structure* structure = globalObject->JSMD4Structure(); if (constructor != newTarget) { - auto scope = DECLARE_THROW_SCOPE(vm); + auto scope = DECLARE_THROW_SCOPE(vm); - auto* functionGlobalObject = reinterpret_cast<Zig::GlobalObject*>( - // ShadowRealm functions belong to a different global object. - getFunctionRealm(globalObject, newTarget)); - RETURN_IF_EXCEPTION(scope, {}); - structure = InternalFunction::createSubclassStructure( - globalObject, - newTarget, - functionGlobalObject->JSMD4Structure()); + auto* functionGlobalObject = reinterpret_cast<Zig::GlobalObject*>( + // ShadowRealm functions belong to a different global object. + getFunctionRealm(globalObject, newTarget) + ); + RETURN_IF_EXCEPTION(scope, {}); + structure = InternalFunction::createSubclassStructure( + globalObject, + newTarget, + functionGlobalObject->JSMD4Structure() + ); } void* ptr = MD4Class__construct(globalObject, callFrame); if (UNLIKELY(!ptr)) { - return JSValue::encode(JSC::jsUndefined()); + return JSValue::encode(JSC::jsUndefined()); } JSMD4* instance = JSMD4::create(vm, globalObject, structure, ptr); + return JSValue::encode(instance); } void JSMD4Constructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSMD4Prototype* prototype) { + } const ClassInfo JSMD4Constructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSMD4Constructor) }; -extern "C" EncodedJSValue MD4__getConstructor(Zig::GlobalObject* globalObject) -{ + + extern "C" EncodedJSValue MD4__getConstructor(Zig::GlobalObject* globalObject) { return JSValue::encode(globalObject->JSMD4Constructor()); -} + } JSMD4::~JSMD4() { @@ -3540,7 +3817,7 @@ void JSMD4::destroy(JSCell* cell) { static_cast<JSMD4*>(cell)->JSMD4::~JSMD4(); } - + const ClassInfo JSMD4::s_info = { "MD4"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSMD4) }; void JSMD4::finishCreation(VM& vm) @@ -3549,38 +3826,37 @@ void JSMD4::finishCreation(VM& vm) ASSERT(inherits(info())); } -JSMD4* JSMD4::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSMD4* ptr = new (NotNull, JSC::allocateCell<JSMD4>(vm)) JSMD4(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} -extern "C" void* MD4__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; +JSMD4* JSMD4::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) { + JSMD4* ptr = new (NotNull, JSC::allocateCell<JSMD4>(vm)) JSMD4(vm, structure, ctx); + ptr->finishCreation(vm); + return ptr; +} - JSC::JSCell* cell = decodedValue.asCell(); - JSMD4* object = JSC::jsDynamicCast<JSMD4*>(cell); +extern "C" void* MD4__fromJS(JSC::EncodedJSValue value) { + JSC::JSValue decodedValue = JSC::JSValue::decode(value); + if (decodedValue.isEmpty() || !decodedValue.isCell()) + return nullptr; - if (!object) - return nullptr; + JSC::JSCell* cell = decodedValue.asCell(); + JSMD4* object = JSC::jsDynamicCast<JSMD4*>(cell); - return object->wrapped(); + if (!object) + return nullptr; + + return object->wrapped(); } -extern "C" bool MD4__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSMD4* object = JSC::jsDynamicCast<JSMD4*>(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; +extern "C" bool MD4__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) { + JSMD4* object = JSC::jsDynamicCast<JSMD4*>(JSValue::decode(value)); + if (!object) + return false; + + object->m_ctx = ptr; + return true; } + extern "C" const size_t MD4__ptrOffset = JSMD4::offsetOfWrapped(); void JSMD4::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) @@ -3595,7 +3871,7 @@ void JSMD4::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) JSObject* JSMD4::createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype) { - return WebCore::JSMD4Constructor::create(vm, globalObject, WebCore::JSMD4Constructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast<WebCore::JSMD4Prototype*>(prototype)); + return WebCore::JSMD4Constructor::create(vm, globalObject, WebCore::JSMD4Constructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast<WebCore::JSMD4Prototype*>(prototype)); } JSObject* JSMD4::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) @@ -3603,105 +3879,114 @@ JSObject* JSMD4::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) return JSMD4Prototype::create(vm, globalObject, JSMD4Prototype::createStructure(vm, globalObject, globalObject->objectPrototype())); } -extern "C" EncodedJSValue MD4__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSMD4Structure(); - JSMD4* instance = JSMD4::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} -class JSMD5Prototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSMD5Prototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSMD5Prototype* ptr = new (NotNull, JSC::allocateCell<JSMD5Prototype>(vm)) JSMD5Prototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template<typename CellType, JSC::SubspaceAccess> - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSMD5Prototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; +extern "C" EncodedJSValue MD4__create(Zig::GlobalObject* globalObject, void* ptr) { + auto &vm = globalObject->vm(); + JSC::Structure* structure = globalObject->JSMD4Structure(); + JSMD4* instance = JSMD4::create(vm, globalObject, structure, ptr); + + return JSValue::encode(instance); +} + class JSMD5Prototype final : public JSC::JSNonFinalObject { + public: + using Base = JSC::JSNonFinalObject; + + static JSMD5Prototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) + { + JSMD5Prototype* ptr = new (NotNull, JSC::allocateCell<JSMD5Prototype>(vm)) JSMD5Prototype(vm, globalObject, structure); + ptr->finishCreation(vm, globalObject); + return ptr; + } + + DECLARE_INFO; + template<typename CellType, JSC::SubspaceAccess> + static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + return &vm.plainObjectSpace(); + } + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); + } + + private: + JSMD5Prototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) + : Base(vm, structure) + { + } + + void finishCreation(JSC::VM&, JSC::JSGlobalObject*); + }; class JSMD5Constructor final : public JSC::InternalFunction { -public: - using Base = JSC::InternalFunction; - static JSMD5Constructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSMD5Prototype* prototype); - - static constexpr unsigned StructureFlags = Base::StructureFlags; - static constexpr bool needsDestruction = false; - - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); - } - - template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl<JSMD5Constructor, WebCore::UseCustomHeapCellType::No>( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForMD5Constructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForMD5Constructor = std::forward<decltype(space)>(space); }, - [](auto& spaces) { return spaces.m_subspaceForMD5Constructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForMD5Constructor = std::forward<decltype(space)>(space); }); - } + public: + using Base = JSC::InternalFunction; + static JSMD5Constructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSMD5Prototype* prototype); + + static constexpr unsigned StructureFlags = Base::StructureFlags; + static constexpr bool needsDestruction = false; + + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); + } + + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return WebCore::subspaceForImpl<JSMD5Constructor, WebCore::UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForMD5Constructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForMD5Constructor = std::forward<decltype(space)>(space); }, + [](auto& spaces) { return spaces.m_subspaceForMD5Constructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForMD5Constructor = std::forward<decltype(space)>(space); }); + } + + + void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSMD5Prototype* prototype); + + // Must be defined for each specialization class. + static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); + + DECLARE_EXPORT_INFO; + private: + JSMD5Constructor(JSC::VM& vm, JSC::Structure* structure); + void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSMD5Prototype* prototype); + }; - void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSMD5Prototype* prototype); - - // Must be defined for each specialization class. - static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); - - DECLARE_EXPORT_INFO; - -private: - JSMD5Constructor(JSC::VM& vm, JSC::Structure* structure); - void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSMD5Prototype* prototype); -}; extern "C" void* MD5Class__construct(JSC::JSGlobalObject*, JSC::CallFrame*); JSC_DECLARE_CUSTOM_GETTER(jsMD5Constructor); extern "C" void MD5Class__finalize(void*); + extern "C" JSC::EncodedJSValue MD5Prototype__getByteLength(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(MD5Prototype__byteLengthGetterWrap); + extern "C" EncodedJSValue MD5Prototype__digest(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(MD5Prototype__digestCallback); + extern "C" EncodedJSValue MD5Prototype__update(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(MD5Prototype__updateCallback); + STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSMD5Prototype, JSMD5Prototype::Base); -static const HashTableValue JSMD5PrototypeTableValues[] = { - { "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, MD5Prototype__byteLengthGetterWrap, 0 } }, - { "digest"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, MD5Prototype__digestCallback, 0 } }, - { "update"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, MD5Prototype__updateCallback, 1 } } + + static const HashTableValue JSMD5PrototypeTableValues[] = { +{ "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, MD5Prototype__byteLengthGetterWrap, 0 } } , +{ "digest"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, MD5Prototype__digestCallback, 0 } } , +{ "update"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, MD5Prototype__updateCallback, 1 } } }; + + const ClassInfo JSMD5Prototype::s_info = { "MD5"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSMD5Prototype) }; + + JSC_DEFINE_CUSTOM_GETTER(jsMD5Constructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); @@ -3712,12 +3997,14 @@ JSC_DEFINE_CUSTOM_GETTER(jsMD5Constructor, (JSGlobalObject * lexicalGlobalObject if (UNLIKELY(!prototype)) return throwVMTypeError(lexicalGlobalObject, throwScope); return JSValue::encode(globalObject->JSMD5Constructor()); -} +} + + JSC_DEFINE_CUSTOM_GETTER(MD5Prototype__byteLengthGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSMD5* thisObject = jsCast<JSMD5*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -3725,38 +4012,41 @@ JSC_DEFINE_CUSTOM_GETTER(MD5Prototype__byteLengthGetterWrap, (JSGlobalObject * l RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + -JSC_DEFINE_HOST_FUNCTION(MD5Prototype__digestCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + JSC_DEFINE_HOST_FUNCTION(MD5Prototype__digestCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - JSMD5* thisObject = jsDynamicCast<JSMD5*>(callFrame->thisValue()); + JSMD5* thisObject = jsDynamicCast<JSMD5*>(callFrame->thisValue()); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return MD5Prototype__digest(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + return MD5Prototype__digest(thisObject->wrapped(), lexicalGlobalObject, callFrame); + } + -JSC_DEFINE_HOST_FUNCTION(MD5Prototype__updateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + JSC_DEFINE_HOST_FUNCTION(MD5Prototype__updateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - JSMD5* thisObject = jsDynamicCast<JSMD5*>(callFrame->thisValue()); + JSMD5* thisObject = jsDynamicCast<JSMD5*>(callFrame->thisValue()); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return MD5Prototype__update(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + return MD5Prototype__update(thisObject->wrapped(), lexicalGlobalObject, callFrame); + } + void JSMD5Prototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) { @@ -3768,11 +4058,12 @@ void JSMD5Prototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObje extern "C" JSC_DECLARE_CUSTOM_GETTER(MD5Class__getByteLengthStatic); extern "C" JSC_DECLARE_HOST_FUNCTION(MD5Class__hash); -static const HashTableValue JSMD5ConstructorTableValues[] = { - { "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, MD5Class__getByteLengthStatic, 0 } }, - { "hash"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, MD5Class__hash, 2 } } + static const HashTableValue JSMD5ConstructorTableValues[] = { +{ "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, MD5Class__getByteLengthStatic, 0 } } , +{ "hash"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, MD5Class__hash, 2 } } }; + void JSMD5Constructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSMD5Prototype* prototype) { Base::finishCreation(vm, 0, "MD5"_s, PropertyAdditionMode::WithoutStructureTransition); @@ -3781,59 +4072,62 @@ void JSMD5Constructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, ASSERT(inherits(info())); } -JSMD5Constructor::JSMD5Constructor(JSC::VM& vm, JSC::Structure* structure) - : Base(vm, structure, construct, construct) -{ -} +JSMD5Constructor::JSMD5Constructor(JSC::VM& vm, JSC::Structure* structure) : Base(vm, structure, construct, construct) { -JSMD5Constructor* JSMD5Constructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSMD5Prototype* prototype) -{ + } + +JSMD5Constructor* JSMD5Constructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSMD5Prototype* prototype) { JSMD5Constructor* ptr = new (NotNull, JSC::allocateCell<JSMD5Constructor>(vm)) JSMD5Constructor(vm, structure); ptr->finishCreation(vm, globalObject, prototype); return ptr; } + JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSMD5Constructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) { - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); - JSC::VM& vm = globalObject->vm(); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + JSC::VM &vm = globalObject->vm(); JSObject* newTarget = asObject(callFrame->newTarget()); auto* constructor = globalObject->JSMD5Constructor(); Structure* structure = globalObject->JSMD5Structure(); if (constructor != newTarget) { - auto scope = DECLARE_THROW_SCOPE(vm); + auto scope = DECLARE_THROW_SCOPE(vm); - auto* functionGlobalObject = reinterpret_cast<Zig::GlobalObject*>( - // ShadowRealm functions belong to a different global object. - getFunctionRealm(globalObject, newTarget)); - RETURN_IF_EXCEPTION(scope, {}); - structure = InternalFunction::createSubclassStructure( - globalObject, - newTarget, - functionGlobalObject->JSMD5Structure()); + auto* functionGlobalObject = reinterpret_cast<Zig::GlobalObject*>( + // ShadowRealm functions belong to a different global object. + getFunctionRealm(globalObject, newTarget) + ); + RETURN_IF_EXCEPTION(scope, {}); + structure = InternalFunction::createSubclassStructure( + globalObject, + newTarget, + functionGlobalObject->JSMD5Structure() + ); } void* ptr = MD5Class__construct(globalObject, callFrame); if (UNLIKELY(!ptr)) { - return JSValue::encode(JSC::jsUndefined()); + return JSValue::encode(JSC::jsUndefined()); } JSMD5* instance = JSMD5::create(vm, globalObject, structure, ptr); + return JSValue::encode(instance); } void JSMD5Constructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSMD5Prototype* prototype) { + } const ClassInfo JSMD5Constructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSMD5Constructor) }; -extern "C" EncodedJSValue MD5__getConstructor(Zig::GlobalObject* globalObject) -{ + + extern "C" EncodedJSValue MD5__getConstructor(Zig::GlobalObject* globalObject) { return JSValue::encode(globalObject->JSMD5Constructor()); -} + } JSMD5::~JSMD5() { @@ -3845,7 +4139,7 @@ void JSMD5::destroy(JSCell* cell) { static_cast<JSMD5*>(cell)->JSMD5::~JSMD5(); } - + const ClassInfo JSMD5::s_info = { "MD5"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSMD5) }; void JSMD5::finishCreation(VM& vm) @@ -3854,38 +4148,37 @@ void JSMD5::finishCreation(VM& vm) ASSERT(inherits(info())); } -JSMD5* JSMD5::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSMD5* ptr = new (NotNull, JSC::allocateCell<JSMD5>(vm)) JSMD5(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} -extern "C" void* MD5__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; +JSMD5* JSMD5::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) { + JSMD5* ptr = new (NotNull, JSC::allocateCell<JSMD5>(vm)) JSMD5(vm, structure, ctx); + ptr->finishCreation(vm); + return ptr; +} - JSC::JSCell* cell = decodedValue.asCell(); - JSMD5* object = JSC::jsDynamicCast<JSMD5*>(cell); +extern "C" void* MD5__fromJS(JSC::EncodedJSValue value) { + JSC::JSValue decodedValue = JSC::JSValue::decode(value); + if (decodedValue.isEmpty() || !decodedValue.isCell()) + return nullptr; - if (!object) - return nullptr; + JSC::JSCell* cell = decodedValue.asCell(); + JSMD5* object = JSC::jsDynamicCast<JSMD5*>(cell); - return object->wrapped(); + if (!object) + return nullptr; + + return object->wrapped(); } -extern "C" bool MD5__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSMD5* object = JSC::jsDynamicCast<JSMD5*>(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; +extern "C" bool MD5__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) { + JSMD5* object = JSC::jsDynamicCast<JSMD5*>(JSValue::decode(value)); + if (!object) + return false; + + object->m_ctx = ptr; + return true; } + extern "C" const size_t MD5__ptrOffset = JSMD5::offsetOfWrapped(); void JSMD5::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) @@ -3900,7 +4193,7 @@ void JSMD5::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) JSObject* JSMD5::createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype) { - return WebCore::JSMD5Constructor::create(vm, globalObject, WebCore::JSMD5Constructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast<WebCore::JSMD5Prototype*>(prototype)); + return WebCore::JSMD5Constructor::create(vm, globalObject, WebCore::JSMD5Constructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast<WebCore::JSMD5Prototype*>(prototype)); } JSObject* JSMD5::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) @@ -3908,88 +4201,101 @@ JSObject* JSMD5::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) return JSMD5Prototype::create(vm, globalObject, JSMD5Prototype::createStructure(vm, globalObject, globalObject->objectPrototype())); } -extern "C" EncodedJSValue MD5__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSMD5Structure(); - JSMD5* instance = JSMD5::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} -class JSMatchedRoutePrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSMatchedRoutePrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSMatchedRoutePrototype* ptr = new (NotNull, JSC::allocateCell<JSMatchedRoutePrototype>(vm)) JSMatchedRoutePrototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template<typename CellType, JSC::SubspaceAccess> - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSMatchedRoutePrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; +extern "C" EncodedJSValue MD5__create(Zig::GlobalObject* globalObject, void* ptr) { + auto &vm = globalObject->vm(); + JSC::Structure* structure = globalObject->JSMD5Structure(); + JSMD5* instance = JSMD5::create(vm, globalObject, structure, ptr); + + return JSValue::encode(instance); +} + class JSMatchedRoutePrototype final : public JSC::JSNonFinalObject { + public: + using Base = JSC::JSNonFinalObject; + + static JSMatchedRoutePrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) + { + JSMatchedRoutePrototype* ptr = new (NotNull, JSC::allocateCell<JSMatchedRoutePrototype>(vm)) JSMatchedRoutePrototype(vm, globalObject, structure); + ptr->finishCreation(vm, globalObject); + return ptr; + } + + DECLARE_INFO; + template<typename CellType, JSC::SubspaceAccess> + static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + return &vm.plainObjectSpace(); + } + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); + } + + private: + JSMatchedRoutePrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) + : Base(vm, structure) + { + } + + void finishCreation(JSC::VM&, JSC::JSGlobalObject*); + }; extern "C" void* MatchedRouteClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); JSC_DECLARE_CUSTOM_GETTER(jsMatchedRouteConstructor); extern "C" void MatchedRouteClass__finalize(void*); + extern "C" JSC::EncodedJSValue MatchedRoutePrototype__getFilePath(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(MatchedRoutePrototype__filePathGetterWrap); + extern "C" JSC::EncodedJSValue MatchedRoutePrototype__getKind(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(MatchedRoutePrototype__kindGetterWrap); + extern "C" JSC::EncodedJSValue MatchedRoutePrototype__getName(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(MatchedRoutePrototype__nameGetterWrap); + extern "C" JSC::EncodedJSValue MatchedRoutePrototype__getParams(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(MatchedRoutePrototype__paramsGetterWrap); + extern "C" JSC::EncodedJSValue MatchedRoutePrototype__getPathname(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(MatchedRoutePrototype__pathnameGetterWrap); + extern "C" JSC::EncodedJSValue MatchedRoutePrototype__getQuery(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(MatchedRoutePrototype__queryGetterWrap); + extern "C" JSC::EncodedJSValue MatchedRoutePrototype__getScriptSrc(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(MatchedRoutePrototype__scriptSrcGetterWrap); + extern "C" JSC::EncodedJSValue MatchedRoutePrototype__getScriptSrc(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(MatchedRoutePrototype__srcGetterWrap); + STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSMatchedRoutePrototype, JSMatchedRoutePrototype::Base); -static const HashTableValue JSMatchedRoutePrototypeTableValues[] = { - { "filePath"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, MatchedRoutePrototype__filePathGetterWrap, 0 } }, - { "kind"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, MatchedRoutePrototype__kindGetterWrap, 0 } }, - { "name"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, MatchedRoutePrototype__nameGetterWrap, 0 } }, - { "params"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, MatchedRoutePrototype__paramsGetterWrap, 0 } }, - { "pathname"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, MatchedRoutePrototype__pathnameGetterWrap, 0 } }, - { "query"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, MatchedRoutePrototype__queryGetterWrap, 0 } }, - { "scriptSrc"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, MatchedRoutePrototype__scriptSrcGetterWrap, 0 } }, - { "src"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, MatchedRoutePrototype__srcGetterWrap, 0 } } + + static const HashTableValue JSMatchedRoutePrototypeTableValues[] = { +{ "filePath"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, MatchedRoutePrototype__filePathGetterWrap, 0 } } , +{ "kind"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, MatchedRoutePrototype__kindGetterWrap, 0 } } , +{ "name"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, MatchedRoutePrototype__nameGetterWrap, 0 } } , +{ "params"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, MatchedRoutePrototype__paramsGetterWrap, 0 } } , +{ "pathname"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, MatchedRoutePrototype__pathnameGetterWrap, 0 } } , +{ "query"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, MatchedRoutePrototype__queryGetterWrap, 0 } } , +{ "scriptSrc"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, MatchedRoutePrototype__scriptSrcGetterWrap, 0 } } , +{ "src"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, MatchedRoutePrototype__srcGetterWrap, 0 } } }; + + const ClassInfo JSMatchedRoutePrototype::s_info = { "MatchedRoute"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSMatchedRoutePrototype) }; + + JSC_DEFINE_CUSTOM_GETTER(jsMatchedRouteConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); @@ -4000,255 +4306,289 @@ JSC_DEFINE_CUSTOM_GETTER(jsMatchedRouteConstructor, (JSGlobalObject * lexicalGlo if (UNLIKELY(!prototype)) return throwVMTypeError(lexicalGlobalObject, throwScope); return JSValue::encode(globalObject->JSMatchedRouteConstructor()); -} +} + + JSC_DEFINE_CUSTOM_GETTER(MatchedRoutePrototype__filePathGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSMatchedRoute* thisObject = jsCast<JSMatchedRoute*>(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + if (JSValue cachedValue = thisObject->m_filePath.get()) return JSValue::encode(cachedValue); - + JSC::JSValue result = JSC::JSValue::decode( - MatchedRoutePrototype__getFilePath(thisObject->wrapped(), globalObject)); + MatchedRoutePrototype__getFilePath(thisObject->wrapped(), globalObject) + ); RETURN_IF_EXCEPTION(throwScope, {}); thisObject->m_filePath.set(vm, thisObject, result); RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); } -extern "C" void MatchedRoutePrototype__filePathSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast<JSMatchedRoute*>(JSValue::decode(thisValue)); - thisObject->m_filePath.set(vm, thisObject, JSValue::decode(value)); -} -extern "C" EncodedJSValue MatchedRoutePrototype__filePathGetCachedValue(JSC::EncodedJSValue thisValue) -{ + extern "C" void MatchedRoutePrototype__filePathSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject *globalObject, JSC::EncodedJSValue value) + { + auto& vm = globalObject->vm(); + auto* thisObject = jsCast<JSMatchedRoute*>(JSValue::decode(thisValue)); + thisObject->m_filePath.set(vm, thisObject, JSValue::decode(value)); + } + + extern "C" EncodedJSValue MatchedRoutePrototype__filePathGetCachedValue(JSC::EncodedJSValue thisValue) + { auto* thisObject = jsCast<JSMatchedRoute*>(JSValue::decode(thisValue)); return JSValue::encode(thisObject->m_filePath.get()); -} + } + + JSC_DEFINE_CUSTOM_GETTER(MatchedRoutePrototype__kindGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSMatchedRoute* thisObject = jsCast<JSMatchedRoute*>(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + if (JSValue cachedValue = thisObject->m_kind.get()) return JSValue::encode(cachedValue); - + JSC::JSValue result = JSC::JSValue::decode( - MatchedRoutePrototype__getKind(thisObject->wrapped(), globalObject)); + MatchedRoutePrototype__getKind(thisObject->wrapped(), globalObject) + ); RETURN_IF_EXCEPTION(throwScope, {}); thisObject->m_kind.set(vm, thisObject, result); RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); } -extern "C" void MatchedRoutePrototype__kindSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast<JSMatchedRoute*>(JSValue::decode(thisValue)); - thisObject->m_kind.set(vm, thisObject, JSValue::decode(value)); -} -extern "C" EncodedJSValue MatchedRoutePrototype__kindGetCachedValue(JSC::EncodedJSValue thisValue) -{ + extern "C" void MatchedRoutePrototype__kindSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject *globalObject, JSC::EncodedJSValue value) + { + auto& vm = globalObject->vm(); + auto* thisObject = jsCast<JSMatchedRoute*>(JSValue::decode(thisValue)); + thisObject->m_kind.set(vm, thisObject, JSValue::decode(value)); + } + + extern "C" EncodedJSValue MatchedRoutePrototype__kindGetCachedValue(JSC::EncodedJSValue thisValue) + { auto* thisObject = jsCast<JSMatchedRoute*>(JSValue::decode(thisValue)); return JSValue::encode(thisObject->m_kind.get()); -} + } + + JSC_DEFINE_CUSTOM_GETTER(MatchedRoutePrototype__nameGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSMatchedRoute* thisObject = jsCast<JSMatchedRoute*>(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + if (JSValue cachedValue = thisObject->m_name.get()) return JSValue::encode(cachedValue); - + JSC::JSValue result = JSC::JSValue::decode( - MatchedRoutePrototype__getName(thisObject->wrapped(), globalObject)); + MatchedRoutePrototype__getName(thisObject->wrapped(), globalObject) + ); RETURN_IF_EXCEPTION(throwScope, {}); thisObject->m_name.set(vm, thisObject, result); RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); } -extern "C" void MatchedRoutePrototype__nameSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast<JSMatchedRoute*>(JSValue::decode(thisValue)); - thisObject->m_name.set(vm, thisObject, JSValue::decode(value)); -} -extern "C" EncodedJSValue MatchedRoutePrototype__nameGetCachedValue(JSC::EncodedJSValue thisValue) -{ + extern "C" void MatchedRoutePrototype__nameSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject *globalObject, JSC::EncodedJSValue value) + { + auto& vm = globalObject->vm(); + auto* thisObject = jsCast<JSMatchedRoute*>(JSValue::decode(thisValue)); + thisObject->m_name.set(vm, thisObject, JSValue::decode(value)); + } + + extern "C" EncodedJSValue MatchedRoutePrototype__nameGetCachedValue(JSC::EncodedJSValue thisValue) + { auto* thisObject = jsCast<JSMatchedRoute*>(JSValue::decode(thisValue)); return JSValue::encode(thisObject->m_name.get()); -} + } + + JSC_DEFINE_CUSTOM_GETTER(MatchedRoutePrototype__paramsGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSMatchedRoute* thisObject = jsCast<JSMatchedRoute*>(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + if (JSValue cachedValue = thisObject->m_params.get()) return JSValue::encode(cachedValue); - + JSC::JSValue result = JSC::JSValue::decode( - MatchedRoutePrototype__getParams(thisObject->wrapped(), globalObject)); + MatchedRoutePrototype__getParams(thisObject->wrapped(), globalObject) + ); RETURN_IF_EXCEPTION(throwScope, {}); thisObject->m_params.set(vm, thisObject, result); RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); } -extern "C" void MatchedRoutePrototype__paramsSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast<JSMatchedRoute*>(JSValue::decode(thisValue)); - thisObject->m_params.set(vm, thisObject, JSValue::decode(value)); -} -extern "C" EncodedJSValue MatchedRoutePrototype__paramsGetCachedValue(JSC::EncodedJSValue thisValue) -{ + extern "C" void MatchedRoutePrototype__paramsSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject *globalObject, JSC::EncodedJSValue value) + { + auto& vm = globalObject->vm(); + auto* thisObject = jsCast<JSMatchedRoute*>(JSValue::decode(thisValue)); + thisObject->m_params.set(vm, thisObject, JSValue::decode(value)); + } + + extern "C" EncodedJSValue MatchedRoutePrototype__paramsGetCachedValue(JSC::EncodedJSValue thisValue) + { auto* thisObject = jsCast<JSMatchedRoute*>(JSValue::decode(thisValue)); return JSValue::encode(thisObject->m_params.get()); -} + } + + JSC_DEFINE_CUSTOM_GETTER(MatchedRoutePrototype__pathnameGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSMatchedRoute* thisObject = jsCast<JSMatchedRoute*>(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + if (JSValue cachedValue = thisObject->m_pathname.get()) return JSValue::encode(cachedValue); - + JSC::JSValue result = JSC::JSValue::decode( - MatchedRoutePrototype__getPathname(thisObject->wrapped(), globalObject)); + MatchedRoutePrototype__getPathname(thisObject->wrapped(), globalObject) + ); RETURN_IF_EXCEPTION(throwScope, {}); thisObject->m_pathname.set(vm, thisObject, result); RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); } -extern "C" void MatchedRoutePrototype__pathnameSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast<JSMatchedRoute*>(JSValue::decode(thisValue)); - thisObject->m_pathname.set(vm, thisObject, JSValue::decode(value)); -} -extern "C" EncodedJSValue MatchedRoutePrototype__pathnameGetCachedValue(JSC::EncodedJSValue thisValue) -{ + extern "C" void MatchedRoutePrototype__pathnameSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject *globalObject, JSC::EncodedJSValue value) + { + auto& vm = globalObject->vm(); + auto* thisObject = jsCast<JSMatchedRoute*>(JSValue::decode(thisValue)); + thisObject->m_pathname.set(vm, thisObject, JSValue::decode(value)); + } + + extern "C" EncodedJSValue MatchedRoutePrototype__pathnameGetCachedValue(JSC::EncodedJSValue thisValue) + { auto* thisObject = jsCast<JSMatchedRoute*>(JSValue::decode(thisValue)); return JSValue::encode(thisObject->m_pathname.get()); -} + } + + JSC_DEFINE_CUSTOM_GETTER(MatchedRoutePrototype__queryGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSMatchedRoute* thisObject = jsCast<JSMatchedRoute*>(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + if (JSValue cachedValue = thisObject->m_query.get()) return JSValue::encode(cachedValue); - + JSC::JSValue result = JSC::JSValue::decode( - MatchedRoutePrototype__getQuery(thisObject->wrapped(), globalObject)); + MatchedRoutePrototype__getQuery(thisObject->wrapped(), globalObject) + ); RETURN_IF_EXCEPTION(throwScope, {}); thisObject->m_query.set(vm, thisObject, result); RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); } -extern "C" void MatchedRoutePrototype__querySetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast<JSMatchedRoute*>(JSValue::decode(thisValue)); - thisObject->m_query.set(vm, thisObject, JSValue::decode(value)); -} -extern "C" EncodedJSValue MatchedRoutePrototype__queryGetCachedValue(JSC::EncodedJSValue thisValue) -{ + extern "C" void MatchedRoutePrototype__querySetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject *globalObject, JSC::EncodedJSValue value) + { + auto& vm = globalObject->vm(); + auto* thisObject = jsCast<JSMatchedRoute*>(JSValue::decode(thisValue)); + thisObject->m_query.set(vm, thisObject, JSValue::decode(value)); + } + + extern "C" EncodedJSValue MatchedRoutePrototype__queryGetCachedValue(JSC::EncodedJSValue thisValue) + { auto* thisObject = jsCast<JSMatchedRoute*>(JSValue::decode(thisValue)); return JSValue::encode(thisObject->m_query.get()); -} + } + + JSC_DEFINE_CUSTOM_GETTER(MatchedRoutePrototype__scriptSrcGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSMatchedRoute* thisObject = jsCast<JSMatchedRoute*>(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + if (JSValue cachedValue = thisObject->m_scriptSrc.get()) return JSValue::encode(cachedValue); - + JSC::JSValue result = JSC::JSValue::decode( - MatchedRoutePrototype__getScriptSrc(thisObject->wrapped(), globalObject)); + MatchedRoutePrototype__getScriptSrc(thisObject->wrapped(), globalObject) + ); RETURN_IF_EXCEPTION(throwScope, {}); thisObject->m_scriptSrc.set(vm, thisObject, result); RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); } -extern "C" void MatchedRoutePrototype__scriptSrcSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast<JSMatchedRoute*>(JSValue::decode(thisValue)); - thisObject->m_scriptSrc.set(vm, thisObject, JSValue::decode(value)); -} -extern "C" EncodedJSValue MatchedRoutePrototype__scriptSrcGetCachedValue(JSC::EncodedJSValue thisValue) -{ + extern "C" void MatchedRoutePrototype__scriptSrcSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject *globalObject, JSC::EncodedJSValue value) + { + auto& vm = globalObject->vm(); + auto* thisObject = jsCast<JSMatchedRoute*>(JSValue::decode(thisValue)); + thisObject->m_scriptSrc.set(vm, thisObject, JSValue::decode(value)); + } + + extern "C" EncodedJSValue MatchedRoutePrototype__scriptSrcGetCachedValue(JSC::EncodedJSValue thisValue) + { auto* thisObject = jsCast<JSMatchedRoute*>(JSValue::decode(thisValue)); return JSValue::encode(thisObject->m_scriptSrc.get()); -} + } + + JSC_DEFINE_CUSTOM_GETTER(MatchedRoutePrototype__srcGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSMatchedRoute* thisObject = jsCast<JSMatchedRoute*>(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + if (JSValue cachedValue = thisObject->m_scriptSrc.get()) return JSValue::encode(cachedValue); - + JSC::JSValue result = JSC::JSValue::decode( - MatchedRoutePrototype__getScriptSrc(thisObject->wrapped(), globalObject)); + MatchedRoutePrototype__getScriptSrc(thisObject->wrapped(), globalObject) + ); RETURN_IF_EXCEPTION(throwScope, {}); thisObject->m_scriptSrc.set(vm, thisObject, result); RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); } -extern "C" void MatchedRoutePrototype__srcSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast<JSMatchedRoute*>(JSValue::decode(thisValue)); - thisObject->m_scriptSrc.set(vm, thisObject, JSValue::decode(value)); -} -extern "C" EncodedJSValue MatchedRoutePrototype__srcGetCachedValue(JSC::EncodedJSValue thisValue) -{ + extern "C" void MatchedRoutePrototype__srcSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject *globalObject, JSC::EncodedJSValue value) + { + auto& vm = globalObject->vm(); + auto* thisObject = jsCast<JSMatchedRoute*>(JSValue::decode(thisValue)); + thisObject->m_scriptSrc.set(vm, thisObject, JSValue::decode(value)); + } + + extern "C" EncodedJSValue MatchedRoutePrototype__srcGetCachedValue(JSC::EncodedJSValue thisValue) + { auto* thisObject = jsCast<JSMatchedRoute*>(JSValue::decode(thisValue)); return JSValue::encode(thisObject->m_scriptSrc.get()); -} + } + + void JSMatchedRoutePrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) { @@ -4267,7 +4607,7 @@ void JSMatchedRoute::destroy(JSCell* cell) { static_cast<JSMatchedRoute*>(cell)->JSMatchedRoute::~JSMatchedRoute(); } - + const ClassInfo JSMatchedRoute::s_info = { "MatchedRoute"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSMatchedRoute) }; void JSMatchedRoute::finishCreation(VM& vm) @@ -4276,38 +4616,37 @@ void JSMatchedRoute::finishCreation(VM& vm) ASSERT(inherits(info())); } -JSMatchedRoute* JSMatchedRoute::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSMatchedRoute* ptr = new (NotNull, JSC::allocateCell<JSMatchedRoute>(vm)) JSMatchedRoute(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} -extern "C" void* MatchedRoute__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; +JSMatchedRoute* JSMatchedRoute::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) { + JSMatchedRoute* ptr = new (NotNull, JSC::allocateCell<JSMatchedRoute>(vm)) JSMatchedRoute(vm, structure, ctx); + ptr->finishCreation(vm); + return ptr; +} - JSC::JSCell* cell = decodedValue.asCell(); - JSMatchedRoute* object = JSC::jsDynamicCast<JSMatchedRoute*>(cell); +extern "C" void* MatchedRoute__fromJS(JSC::EncodedJSValue value) { + JSC::JSValue decodedValue = JSC::JSValue::decode(value); + if (decodedValue.isEmpty() || !decodedValue.isCell()) + return nullptr; - if (!object) - return nullptr; + JSC::JSCell* cell = decodedValue.asCell(); + JSMatchedRoute* object = JSC::jsDynamicCast<JSMatchedRoute*>(cell); - return object->wrapped(); + if (!object) + return nullptr; + + return object->wrapped(); } -extern "C" bool MatchedRoute__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSMatchedRoute* object = JSC::jsDynamicCast<JSMatchedRoute*>(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; +extern "C" bool MatchedRoute__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) { + JSMatchedRoute* object = JSC::jsDynamicCast<JSMatchedRoute*>(JSValue::decode(value)); + if (!object) + return false; + + object->m_ctx = ptr; + return true; } + extern "C" const size_t MatchedRoute__ptrOffset = JSMatchedRoute::offsetOfWrapped(); void JSMatchedRoute::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) @@ -4320,18 +4659,19 @@ void JSMatchedRoute::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) Base::analyzeHeap(cell, analyzer); } + + JSObject* JSMatchedRoute::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) { return JSMatchedRoutePrototype::create(vm, globalObject, JSMatchedRoutePrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); } -extern "C" EncodedJSValue MatchedRoute__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSMatchedRouteStructure(); - JSMatchedRoute* instance = JSMatchedRoute::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); +extern "C" EncodedJSValue MatchedRoute__create(Zig::GlobalObject* globalObject, void* ptr) { + auto &vm = globalObject->vm(); + JSC::Structure* structure = globalObject->JSMatchedRouteStructure(); + JSMatchedRoute* instance = JSMatchedRoute::create(vm, globalObject, structure, ptr); + + return JSValue::encode(instance); } template<typename Visitor> @@ -4340,7 +4680,8 @@ void JSMatchedRoute::visitChildrenImpl(JSCell* cell, Visitor& visitor) JSMatchedRoute* thisObject = jsCast<JSMatchedRoute*>(cell); ASSERT_GC_OBJECT_INHERITS(thisObject, info()); Base::visitChildren(thisObject, visitor); - + + visitor.append(thisObject->m_filePath); visitor.append(thisObject->m_kind); visitor.append(thisObject->m_name); @@ -4348,6 +4689,7 @@ void JSMatchedRoute::visitChildrenImpl(JSCell* cell, Visitor& visitor) visitor.append(thisObject->m_pathname); visitor.append(thisObject->m_query); visitor.append(thisObject->m_scriptSrc); + } DEFINE_VISIT_CHILDREN(JSMatchedRoute); @@ -4355,10 +4697,10 @@ DEFINE_VISIT_CHILDREN(JSMatchedRoute); template<typename Visitor> void JSMatchedRoute::visitAdditionalChildren(Visitor& visitor) { - JSMatchedRoute* thisObject = this; + JSMatchedRoute* thisObject = this; ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - - visitor.append(thisObject->m_filePath); + + visitor.append(thisObject->m_filePath); visitor.append(thisObject->m_kind); visitor.append(thisObject->m_name); visitor.append(thisObject->m_params); @@ -4371,7 +4713,7 @@ void JSMatchedRoute::visitAdditionalChildren(Visitor& visitor) DEFINE_VISIT_ADDITIONAL_CHILDREN(JSMatchedRoute); template<typename Visitor> -void JSMatchedRoute::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) +void JSMatchedRoute::visitOutputConstraintsImpl(JSCell *cell, Visitor& visitor) { JSMatchedRoute* thisObject = jsCast<JSMatchedRoute*>(cell); ASSERT_GC_OBJECT_INHERITS(thisObject, info()); @@ -4379,413 +4721,502 @@ void JSMatchedRoute::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) } DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSMatchedRoute); -class JSNodeJSFSPrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSNodeJSFSPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSNodeJSFSPrototype* ptr = new (NotNull, JSC::allocateCell<JSNodeJSFSPrototype>(vm)) JSNodeJSFSPrototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template<typename CellType, JSC::SubspaceAccess> - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSNodeJSFSPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; + class JSNodeJSFSPrototype final : public JSC::JSNonFinalObject { + public: + using Base = JSC::JSNonFinalObject; + + static JSNodeJSFSPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) + { + JSNodeJSFSPrototype* ptr = new (NotNull, JSC::allocateCell<JSNodeJSFSPrototype>(vm)) JSNodeJSFSPrototype(vm, globalObject, structure); + ptr->finishCreation(vm, globalObject); + return ptr; + } + + DECLARE_INFO; + template<typename CellType, JSC::SubspaceAccess> + static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + return &vm.plainObjectSpace(); + } + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); + } + + private: + JSNodeJSFSPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) + : Base(vm, structure) + { + } + + void finishCreation(JSC::VM&, JSC::JSGlobalObject*); + }; class JSNodeJSFSConstructor final : public JSC::InternalFunction { -public: - using Base = JSC::InternalFunction; - static JSNodeJSFSConstructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSNodeJSFSPrototype* prototype); - - static constexpr unsigned StructureFlags = Base::StructureFlags; - static constexpr bool needsDestruction = false; - - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); - } - - template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl<JSNodeJSFSConstructor, WebCore::UseCustomHeapCellType::No>( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForNodeJSFSConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForNodeJSFSConstructor = std::forward<decltype(space)>(space); }, - [](auto& spaces) { return spaces.m_subspaceForNodeJSFSConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForNodeJSFSConstructor = std::forward<decltype(space)>(space); }); - } - - void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSNodeJSFSPrototype* prototype); + public: + using Base = JSC::InternalFunction; + static JSNodeJSFSConstructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSNodeJSFSPrototype* prototype); + + static constexpr unsigned StructureFlags = Base::StructureFlags; + static constexpr bool needsDestruction = false; + + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); + } + + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return WebCore::subspaceForImpl<JSNodeJSFSConstructor, WebCore::UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForNodeJSFSConstructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForNodeJSFSConstructor = std::forward<decltype(space)>(space); }, + [](auto& spaces) { return spaces.m_subspaceForNodeJSFSConstructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForNodeJSFSConstructor = std::forward<decltype(space)>(space); }); + } + + + void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSNodeJSFSPrototype* prototype); + + // Must be defined for each specialization class. + static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); + + DECLARE_EXPORT_INFO; + private: + JSNodeJSFSConstructor(JSC::VM& vm, JSC::Structure* structure); + void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSNodeJSFSPrototype* prototype); + }; - // Must be defined for each specialization class. - static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); - - DECLARE_EXPORT_INFO; - -private: - JSNodeJSFSConstructor(JSC::VM& vm, JSC::Structure* structure); - void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSNodeJSFSPrototype* prototype); -}; extern "C" void* NodeJSFSClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); JSC_DECLARE_CUSTOM_GETTER(jsNodeJSFSConstructor); extern "C" void NodeJSFSClass__finalize(void*); + extern "C" EncodedJSValue NodeJSFSPrototype__access(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__accessCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__accessSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__accessSyncCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__appendFile(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__appendFileCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__appendFileSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__appendFileSyncCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__chmod(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__chmodCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__chmodSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__chmodSyncCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__chown(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__chownCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__chownSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__chownSyncCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__close(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__closeCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__closeSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__closeSyncCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__copyFile(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__copyFileCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__copyFileSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__copyFileSyncCallback); + extern "C" JSC::EncodedJSValue NodeJSFSPrototype__getDirent(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(NodeJSFSPrototype__DirentGetterWrap); + extern "C" EncodedJSValue NodeJSFSPrototype__exists(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__existsCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__existsSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__existsSyncCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__fchmod(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__fchmodCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__fchmodSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__fchmodSyncCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__fchown(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__fchownCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__fchownSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__fchownSyncCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__fdatasync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__fdatasyncCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__fdatasyncSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__fdatasyncSyncCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__fstat(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__fstatCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__fstatSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__fstatSyncCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__fsync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__fsyncCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__fsyncSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__fsyncSyncCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__ftruncate(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__ftruncateCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__ftruncateSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__ftruncateSyncCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__futimes(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__futimesCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__futimesSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__futimesSyncCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__lchmod(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__lchmodCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__lchmodSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__lchmodSyncCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__lchown(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__lchownCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__lchownSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__lchownSyncCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__link(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__linkCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__linkSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__linkSyncCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__lstat(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__lstatCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__lstatSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__lstatSyncCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__lutimes(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__lutimesCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__lutimesSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__lutimesSyncCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__mkdir(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__mkdirCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__mkdirSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__mkdirSyncCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__mkdtemp(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__mkdtempCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__mkdtempSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__mkdtempSyncCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__open(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__openCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__opendir(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__opendirCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__opendirSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__opendirSyncCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__openSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__openSyncCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__read(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__readCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__readdir(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__readdirCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__readdirSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__readdirSyncCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__readFile(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__readFileCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__readFileSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__readFileSyncCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__readlink(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__readlinkCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__readlinkSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__readlinkSyncCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__readSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__readSyncCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__readv(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__readvCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__readvSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__readvSyncCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__realpath(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__realpathCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__realpathSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__realpathSyncCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__rename(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__renameCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__renameSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__renameSyncCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__rm(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__rmCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__rmdir(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__rmdirCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__rmdirSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__rmdirSyncCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__rmSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__rmSyncCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__stat(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__statCallback); + extern "C" JSC::EncodedJSValue NodeJSFSPrototype__getStats(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(NodeJSFSPrototype__StatsGetterWrap); + extern "C" EncodedJSValue NodeJSFSPrototype__statSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__statSyncCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__symlink(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__symlinkCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__symlinkSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__symlinkSyncCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__truncate(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__truncateCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__truncateSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__truncateSyncCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__unlink(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__unlinkCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__unlinkSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__unlinkSyncCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__utimes(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__utimesCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__utimesSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__utimesSyncCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__write(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__writeCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__writeFile(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__writeFileCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__writeFileSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__writeFileSyncCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__writeSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__writeSyncCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__writev(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__writevCallback); + extern "C" EncodedJSValue NodeJSFSPrototype__writevSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__writevSyncCallback); + STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSNodeJSFSPrototype, JSNodeJSFSPrototype::Base); -static const HashTableValue JSNodeJSFSPrototypeTableValues[] = { - { "access"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__accessCallback, 3 } }, - { "accessSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__accessSyncCallback, 2 } }, - { "appendFile"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__appendFileCallback, 4 } }, - { "appendFileSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__appendFileSyncCallback, 3 } }, - { "chmod"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__chmodCallback, 3 } }, - { "chmodSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__chmodSyncCallback, 2 } }, - { "chown"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__chownCallback, 4 } }, - { "chownSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__chownSyncCallback, 3 } }, - { "close"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__closeCallback, 1 } }, - { "closeSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__closeSyncCallback, 1 } }, - { "copyFile"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__copyFileCallback, 4 } }, - { "copyFileSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__copyFileSyncCallback, 3 } }, - { "Dirent"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, NodeJSFSPrototype__DirentGetterWrap, 0 } }, - { "exists"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__existsCallback, 2 } }, - { "existsSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__existsSyncCallback, 1 } }, - { "fchmod"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__fchmodCallback, 3 } }, - { "fchmodSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__fchmodSyncCallback, 2 } }, - { "fchown"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__fchownCallback, 4 } }, - { "fchownSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__fchownSyncCallback, 3 } }, - { "fdatasync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__fdatasyncCallback, 2 } }, - { "fdatasyncSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__fdatasyncSyncCallback, 1 } }, - { "fstat"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__fstatCallback, 1 } }, - { "fstatSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__fstatSyncCallback, 1 } }, - { "fsync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__fsyncCallback, 2 } }, - { "fsyncSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__fsyncSyncCallback, 1 } }, - { "ftruncate"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__ftruncateCallback, 1 } }, - { "ftruncateSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__ftruncateSyncCallback, 1 } }, - { "futimes"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__futimesCallback, 4 } }, - { "futimesSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__futimesSyncCallback, 3 } }, - { "lchmod"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__lchmodCallback, 3 } }, - { "lchmodSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__lchmodSyncCallback, 2 } }, - { "lchown"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__lchownCallback, 4 } }, - { "lchownSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__lchownSyncCallback, 3 } }, - { "link"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__linkCallback, 3 } }, - { "linkSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__linkSyncCallback, 2 } }, - { "lstat"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__lstatCallback, 1 } }, - { "lstatSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__lstatSyncCallback, 1 } }, - { "lutimes"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__lutimesCallback, 4 } }, - { "lutimesSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__lutimesSyncCallback, 3 } }, - { "mkdir"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__mkdirCallback, 3 } }, - { "mkdirSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__mkdirSyncCallback, 2 } }, - { "mkdtemp"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__mkdtempCallback, 3 } }, - { "mkdtempSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__mkdtempSyncCallback, 2 } }, - { "open"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__openCallback, 4 } }, - { "opendir"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__opendirCallback, 3 } }, - { "opendirSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__opendirSyncCallback, 2 } }, - { "openSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__openSyncCallback, 3 } }, - { "read"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__readCallback, 6 } }, - { "readdir"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__readdirCallback, 3 } }, - { "readdirSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__readdirSyncCallback, 2 } }, - { "readFile"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__readFileCallback, 3 } }, - { "readFileSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__readFileSyncCallback, 2 } }, - { "readlink"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__readlinkCallback, 3 } }, - { "readlinkSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__readlinkSyncCallback, 2 } }, - { "readSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__readSyncCallback, 5 } }, - { "readv"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__readvCallback, 4 } }, - { "readvSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__readvSyncCallback, 3 } }, - { "realpath"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__realpathCallback, 3 } }, - { "realpathSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__realpathSyncCallback, 2 } }, - { "rename"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__renameCallback, 3 } }, - { "renameSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__renameSyncCallback, 2 } }, - { "rm"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__rmCallback, 3 } }, - { "rmdir"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__rmdirCallback, 3 } }, - { "rmdirSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__rmdirSyncCallback, 2 } }, - { "rmSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__rmSyncCallback, 2 } }, - { "stat"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__statCallback, 1 } }, - { "Stats"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, NodeJSFSPrototype__StatsGetterWrap, 0 } }, - { "statSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__statSyncCallback, 1 } }, - { "symlink"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__symlinkCallback, 4 } }, - { "symlinkSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__symlinkSyncCallback, 3 } }, - { "truncate"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__truncateCallback, 3 } }, - { "truncateSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__truncateSyncCallback, 2 } }, - { "unlink"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__unlinkCallback, 2 } }, - { "unlinkSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__unlinkSyncCallback, 1 } }, - { "utimes"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__utimesCallback, 4 } }, - { "utimesSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__utimesSyncCallback, 3 } }, - { "write"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__writeCallback, 6 } }, - { "writeFile"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__writeFileCallback, 4 } }, - { "writeFileSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__writeFileSyncCallback, 3 } }, - { "writeSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__writeSyncCallback, 5 } }, - { "writev"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__writevCallback, 4 } }, - { "writevSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__writevSyncCallback, 3 } } + + static const HashTableValue JSNodeJSFSPrototypeTableValues[] = { +{ "access"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__accessCallback, 3 } } , +{ "accessSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__accessSyncCallback, 2 } } , +{ "appendFile"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__appendFileCallback, 4 } } , +{ "appendFileSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__appendFileSyncCallback, 3 } } , +{ "chmod"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__chmodCallback, 3 } } , +{ "chmodSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__chmodSyncCallback, 2 } } , +{ "chown"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__chownCallback, 4 } } , +{ "chownSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__chownSyncCallback, 3 } } , +{ "close"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__closeCallback, 1 } } , +{ "closeSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__closeSyncCallback, 1 } } , +{ "copyFile"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__copyFileCallback, 4 } } , +{ "copyFileSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__copyFileSyncCallback, 3 } } , +{ "Dirent"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, NodeJSFSPrototype__DirentGetterWrap, 0 } } , +{ "exists"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__existsCallback, 2 } } , +{ "existsSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__existsSyncCallback, 1 } } , +{ "fchmod"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__fchmodCallback, 3 } } , +{ "fchmodSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__fchmodSyncCallback, 2 } } , +{ "fchown"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__fchownCallback, 4 } } , +{ "fchownSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__fchownSyncCallback, 3 } } , +{ "fdatasync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__fdatasyncCallback, 2 } } , +{ "fdatasyncSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__fdatasyncSyncCallback, 1 } } , +{ "fstat"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__fstatCallback, 1 } } , +{ "fstatSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__fstatSyncCallback, 1 } } , +{ "fsync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__fsyncCallback, 2 } } , +{ "fsyncSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__fsyncSyncCallback, 1 } } , +{ "ftruncate"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__ftruncateCallback, 1 } } , +{ "ftruncateSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__ftruncateSyncCallback, 1 } } , +{ "futimes"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__futimesCallback, 4 } } , +{ "futimesSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__futimesSyncCallback, 3 } } , +{ "lchmod"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__lchmodCallback, 3 } } , +{ "lchmodSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__lchmodSyncCallback, 2 } } , +{ "lchown"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__lchownCallback, 4 } } , +{ "lchownSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__lchownSyncCallback, 3 } } , +{ "link"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__linkCallback, 3 } } , +{ "linkSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__linkSyncCallback, 2 } } , +{ "lstat"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__lstatCallback, 1 } } , +{ "lstatSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__lstatSyncCallback, 1 } } , +{ "lutimes"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__lutimesCallback, 4 } } , +{ "lutimesSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__lutimesSyncCallback, 3 } } , +{ "mkdir"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__mkdirCallback, 3 } } , +{ "mkdirSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__mkdirSyncCallback, 2 } } , +{ "mkdtemp"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__mkdtempCallback, 3 } } , +{ "mkdtempSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__mkdtempSyncCallback, 2 } } , +{ "open"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__openCallback, 4 } } , +{ "opendir"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__opendirCallback, 3 } } , +{ "opendirSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__opendirSyncCallback, 2 } } , +{ "openSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__openSyncCallback, 3 } } , +{ "read"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__readCallback, 6 } } , +{ "readdir"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__readdirCallback, 3 } } , +{ "readdirSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__readdirSyncCallback, 2 } } , +{ "readFile"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__readFileCallback, 3 } } , +{ "readFileSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__readFileSyncCallback, 2 } } , +{ "readlink"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__readlinkCallback, 3 } } , +{ "readlinkSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__readlinkSyncCallback, 2 } } , +{ "readSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__readSyncCallback, 5 } } , +{ "readv"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__readvCallback, 4 } } , +{ "readvSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__readvSyncCallback, 3 } } , +{ "realpath"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__realpathCallback, 3 } } , +{ "realpathSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__realpathSyncCallback, 2 } } , +{ "rename"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__renameCallback, 3 } } , +{ "renameSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__renameSyncCallback, 2 } } , +{ "rm"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__rmCallback, 3 } } , +{ "rmdir"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__rmdirCallback, 3 } } , +{ "rmdirSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__rmdirSyncCallback, 2 } } , +{ "rmSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__rmSyncCallback, 2 } } , +{ "stat"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__statCallback, 1 } } , +{ "Stats"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, NodeJSFSPrototype__StatsGetterWrap, 0 } } , +{ "statSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__statSyncCallback, 1 } } , +{ "symlink"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__symlinkCallback, 4 } } , +{ "symlinkSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__symlinkSyncCallback, 3 } } , +{ "truncate"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__truncateCallback, 3 } } , +{ "truncateSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__truncateSyncCallback, 2 } } , +{ "unlink"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__unlinkCallback, 2 } } , +{ "unlinkSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__unlinkSyncCallback, 1 } } , +{ "utimes"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__utimesCallback, 4 } } , +{ "utimesSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__utimesSyncCallback, 3 } } , +{ "write"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__writeCallback, 6 } } , +{ "writeFile"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__writeFileCallback, 4 } } , +{ "writeFileSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__writeFileSyncCallback, 3 } } , +{ "writeSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__writeSyncCallback, 5 } } , +{ "writev"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__writevCallback, 4 } } , +{ "writevSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__writevSyncCallback, 3 } } }; + + const ClassInfo JSNodeJSFSPrototype::s_info = { "NodeJSFS"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSNodeJSFSPrototype) }; + + JSC_DEFINE_CUSTOM_GETTER(jsNodeJSFSConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); @@ -4796,204 +5227,218 @@ JSC_DEFINE_CUSTOM_GETTER(jsNodeJSFSConstructor, (JSGlobalObject * lexicalGlobalO if (UNLIKELY(!prototype)) return throwVMTypeError(lexicalGlobalObject, throwScope); return JSValue::encode(globalObject->JSNodeJSFSConstructor()); -} +} + -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__accessCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__accessCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } + + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + + return NodeJSFSPrototype__access(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__accessSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__access(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__accessSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__accessSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__appendFileCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__accessSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__appendFileCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__appendFile(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__appendFileSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__appendFile(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__appendFileSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__appendFileSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__chmodCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__appendFileSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__chmodCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__chmod(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__chmodSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__chmod(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__chmodSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__chmodSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__chownCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__chmodSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__chownCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__chown(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__chownSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__chown(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__chownSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__chownSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__closeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__chownSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__closeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__close(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__closeSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__close(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__closeSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__closeSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__copyFileCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__closeSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__copyFileCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__copyFile(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__copyFileSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__copyFile(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__copyFileSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__copyFileSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - return NodeJSFSPrototype__copyFileSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSC_DEFINE_CUSTOM_GETTER(NodeJSFSPrototype__DirentGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSNodeJSFS* thisObject = jsCast<JSNodeJSFS*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -5001,859 +5446,913 @@ JSC_DEFINE_CUSTOM_GETTER(NodeJSFSPrototype__DirentGetterWrap, (JSGlobalObject * RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__existsCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__existsCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } + + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + + return NodeJSFSPrototype__exists(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__existsSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__exists(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__existsSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__existsSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__fchmodCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__existsSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__fchmodCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__fchmod(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__fchmodSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__fchmod(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__fchmodSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__fchmodSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__fchownCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__fchmodSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__fchownCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__fchown(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__fchownSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__fchown(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__fchownSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__fchownSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__fdatasyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__fchownSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__fdatasyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__fdatasync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__fdatasyncSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__fdatasync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__fdatasyncSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__fdatasyncSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__fstatCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__fdatasyncSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__fstatCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__fstat(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__fstatSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__fstat(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__fstatSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__fstatSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__fsyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__fstatSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__fsyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__fsync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__fsyncSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__fsync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__fsyncSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__fsyncSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__ftruncateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__fsyncSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__ftruncateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__ftruncate(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__ftruncateSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__ftruncate(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__ftruncateSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__ftruncateSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__futimesCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__ftruncateSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__futimesCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__futimes(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__futimesSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__futimes(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__futimesSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__futimesSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__lchmodCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__futimesSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__lchmodCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__lchmod(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__lchmodSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__lchmod(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__lchmodSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__lchmodSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__lchownCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__lchmodSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__lchownCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__lchown(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__lchownSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__lchown(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__lchownSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__lchownSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__linkCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__lchownSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__linkCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__link(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__linkSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__link(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__linkSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__linkSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__lstatCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__linkSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__lstatCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__lstat(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__lstatSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__lstat(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__lstatSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__lstatSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__lutimesCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__lstatSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__lutimesCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__lutimes(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__lutimesSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__lutimes(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__lutimesSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__lutimesSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__mkdirCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__lutimesSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__mkdirCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__mkdir(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__mkdirSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__mkdir(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__mkdirSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__mkdirSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__mkdtempCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__mkdirSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__mkdtempCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__mkdtemp(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__mkdtempSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__mkdtemp(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__mkdtempSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__mkdtempSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__openCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__mkdtempSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__openCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__open(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__opendirCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__open(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__opendirCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__opendir(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__opendirSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__opendir(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__opendirSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__opendirSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__openSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__opendirSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__openSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__openSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__readCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__openSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__readCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__read(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__readdirCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__read(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__readdirCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__readdir(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__readdirSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__readdir(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__readdirSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__readdirSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__readFileCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__readdirSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__readFileCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__readFile(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__readFileSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__readFile(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__readFileSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__readFileSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__readlinkCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__readFileSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__readlinkCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__readlink(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__readlinkSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__readlink(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__readlinkSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__readlinkSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__readSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__readlinkSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__readSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__readSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__readvCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__readSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__readvCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__readv(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__readvSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__readv(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__readvSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__readvSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__realpathCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__readvSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__realpathCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__realpath(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__realpathSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__realpath(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__realpathSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__realpathSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__renameCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__realpathSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__renameCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__rename(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__renameSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__rename(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__renameSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__renameSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__rmCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__renameSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__rmCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__rm(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__rmdirCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__rm(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__rmdirCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__rmdir(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__rmdirSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__rmdir(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__rmdirSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__rmdirSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__rmSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__rmdirSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__rmSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__rmSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__statCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__rmSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__statCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__stat(thisObject->wrapped(), lexicalGlobalObject, callFrame); } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - return NodeJSFSPrototype__stat(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSC_DEFINE_CUSTOM_GETTER(NodeJSFSPrototype__StatsGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSNodeJSFS* thisObject = jsCast<JSNodeJSFS*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -5861,246 +6360,262 @@ JSC_DEFINE_CUSTOM_GETTER(NodeJSFSPrototype__StatsGetterWrap, (JSGlobalObject * l RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__statSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__statSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } + + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + + return NodeJSFSPrototype__statSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__symlinkCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__statSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__symlinkCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__symlink(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__symlinkSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__symlink(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__symlinkSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__symlinkSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__truncateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__symlinkSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__truncateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__truncate(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__truncateSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__truncate(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__truncateSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__truncateSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__unlinkCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__truncateSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__unlinkCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__unlink(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__unlinkSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__unlink(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__unlinkSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__unlinkSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__utimesCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__unlinkSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__utimesCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__utimes(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__utimesSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__utimes(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__utimesSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__utimesSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__writeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__utimesSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__writeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__write(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__writeFileCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__write(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__writeFileCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__writeFile(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__writeFileSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__writeFile(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__writeFileSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__writeFileSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__writeSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__writeFileSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__writeSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__writeSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__writevCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__writeSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__writevCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__writev(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__writevSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return NodeJSFSPrototype__writev(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__writevSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return NodeJSFSPrototype__writevSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - return NodeJSFSPrototype__writevSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + void JSNodeJSFSPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) { @@ -6112,64 +6627,67 @@ void JSNodeJSFSPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globa void JSNodeJSFSConstructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSNodeJSFSPrototype* prototype) { Base::finishCreation(vm, 0, "NodeJSFS"_s, PropertyAdditionMode::WithoutStructureTransition); - + putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly); ASSERT(inherits(info())); } -JSNodeJSFSConstructor::JSNodeJSFSConstructor(JSC::VM& vm, JSC::Structure* structure) - : Base(vm, structure, construct, construct) -{ -} +JSNodeJSFSConstructor::JSNodeJSFSConstructor(JSC::VM& vm, JSC::Structure* structure) : Base(vm, structure, construct, construct) { -JSNodeJSFSConstructor* JSNodeJSFSConstructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSNodeJSFSPrototype* prototype) -{ + } + +JSNodeJSFSConstructor* JSNodeJSFSConstructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSNodeJSFSPrototype* prototype) { JSNodeJSFSConstructor* ptr = new (NotNull, JSC::allocateCell<JSNodeJSFSConstructor>(vm)) JSNodeJSFSConstructor(vm, structure); ptr->finishCreation(vm, globalObject, prototype); return ptr; } + JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSNodeJSFSConstructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) { - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); - JSC::VM& vm = globalObject->vm(); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + JSC::VM &vm = globalObject->vm(); JSObject* newTarget = asObject(callFrame->newTarget()); auto* constructor = globalObject->JSNodeJSFSConstructor(); Structure* structure = globalObject->JSNodeJSFSStructure(); if (constructor != newTarget) { - auto scope = DECLARE_THROW_SCOPE(vm); + auto scope = DECLARE_THROW_SCOPE(vm); - auto* functionGlobalObject = reinterpret_cast<Zig::GlobalObject*>( - // ShadowRealm functions belong to a different global object. - getFunctionRealm(globalObject, newTarget)); - RETURN_IF_EXCEPTION(scope, {}); - structure = InternalFunction::createSubclassStructure( - globalObject, - newTarget, - functionGlobalObject->JSNodeJSFSStructure()); + auto* functionGlobalObject = reinterpret_cast<Zig::GlobalObject*>( + // ShadowRealm functions belong to a different global object. + getFunctionRealm(globalObject, newTarget) + ); + RETURN_IF_EXCEPTION(scope, {}); + structure = InternalFunction::createSubclassStructure( + globalObject, + newTarget, + functionGlobalObject->JSNodeJSFSStructure() + ); } void* ptr = NodeJSFSClass__construct(globalObject, callFrame); if (UNLIKELY(!ptr)) { - return JSValue::encode(JSC::jsUndefined()); + return JSValue::encode(JSC::jsUndefined()); } JSNodeJSFS* instance = JSNodeJSFS::create(vm, globalObject, structure, ptr); + return JSValue::encode(instance); } void JSNodeJSFSConstructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSNodeJSFSPrototype* prototype) { + } const ClassInfo JSNodeJSFSConstructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSNodeJSFSConstructor) }; -extern "C" EncodedJSValue NodeJSFS__getConstructor(Zig::GlobalObject* globalObject) -{ + + extern "C" EncodedJSValue NodeJSFS__getConstructor(Zig::GlobalObject* globalObject) { return JSValue::encode(globalObject->JSNodeJSFSConstructor()); -} + } JSNodeJSFS::~JSNodeJSFS() { @@ -6178,7 +6696,7 @@ void JSNodeJSFS::destroy(JSCell* cell) { static_cast<JSNodeJSFS*>(cell)->JSNodeJSFS::~JSNodeJSFS(); } - + const ClassInfo JSNodeJSFS::s_info = { "NodeJSFS"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSNodeJSFS) }; void JSNodeJSFS::finishCreation(VM& vm) @@ -6187,38 +6705,37 @@ void JSNodeJSFS::finishCreation(VM& vm) ASSERT(inherits(info())); } -JSNodeJSFS* JSNodeJSFS::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSNodeJSFS* ptr = new (NotNull, JSC::allocateCell<JSNodeJSFS>(vm)) JSNodeJSFS(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} -extern "C" void* NodeJSFS__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; +JSNodeJSFS* JSNodeJSFS::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) { + JSNodeJSFS* ptr = new (NotNull, JSC::allocateCell<JSNodeJSFS>(vm)) JSNodeJSFS(vm, structure, ctx); + ptr->finishCreation(vm); + return ptr; +} - JSC::JSCell* cell = decodedValue.asCell(); - JSNodeJSFS* object = JSC::jsDynamicCast<JSNodeJSFS*>(cell); +extern "C" void* NodeJSFS__fromJS(JSC::EncodedJSValue value) { + JSC::JSValue decodedValue = JSC::JSValue::decode(value); + if (decodedValue.isEmpty() || !decodedValue.isCell()) + return nullptr; - if (!object) - return nullptr; + JSC::JSCell* cell = decodedValue.asCell(); + JSNodeJSFS* object = JSC::jsDynamicCast<JSNodeJSFS*>(cell); - return object->wrapped(); + if (!object) + return nullptr; + + return object->wrapped(); } -extern "C" bool NodeJSFS__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSNodeJSFS* object = JSC::jsDynamicCast<JSNodeJSFS*>(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; +extern "C" bool NodeJSFS__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) { + JSNodeJSFS* object = JSC::jsDynamicCast<JSNodeJSFS*>(JSValue::decode(value)); + if (!object) + return false; + + object->m_ctx = ptr; + return true; } + extern "C" const size_t NodeJSFS__ptrOffset = JSNodeJSFS::offsetOfWrapped(); void JSNodeJSFS::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) @@ -6233,7 +6750,7 @@ void JSNodeJSFS::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) JSObject* JSNodeJSFS::createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype) { - return WebCore::JSNodeJSFSConstructor::create(vm, globalObject, WebCore::JSNodeJSFSConstructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast<WebCore::JSNodeJSFSPrototype*>(prototype)); + return WebCore::JSNodeJSFSConstructor::create(vm, globalObject, WebCore::JSNodeJSFSConstructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast<WebCore::JSNodeJSFSPrototype*>(prototype)); } JSObject* JSNodeJSFS::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) @@ -6241,173 +6758,199 @@ JSObject* JSNodeJSFS::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) return JSNodeJSFSPrototype::create(vm, globalObject, JSNodeJSFSPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); } -extern "C" EncodedJSValue NodeJSFS__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSNodeJSFSStructure(); - JSNodeJSFS* instance = JSNodeJSFS::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} -class JSRequestPrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSRequestPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSRequestPrototype* ptr = new (NotNull, JSC::allocateCell<JSRequestPrototype>(vm)) JSRequestPrototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template<typename CellType, JSC::SubspaceAccess> - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSRequestPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; +extern "C" EncodedJSValue NodeJSFS__create(Zig::GlobalObject* globalObject, void* ptr) { + auto &vm = globalObject->vm(); + JSC::Structure* structure = globalObject->JSNodeJSFSStructure(); + JSNodeJSFS* instance = JSNodeJSFS::create(vm, globalObject, structure, ptr); + + return JSValue::encode(instance); +} + class JSRequestPrototype final : public JSC::JSNonFinalObject { + public: + using Base = JSC::JSNonFinalObject; + + static JSRequestPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) + { + JSRequestPrototype* ptr = new (NotNull, JSC::allocateCell<JSRequestPrototype>(vm)) JSRequestPrototype(vm, globalObject, structure); + ptr->finishCreation(vm, globalObject); + return ptr; + } + + DECLARE_INFO; + template<typename CellType, JSC::SubspaceAccess> + static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + return &vm.plainObjectSpace(); + } + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); + } + + private: + JSRequestPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) + : Base(vm, structure) + { + } + + void finishCreation(JSC::VM&, JSC::JSGlobalObject*); + }; class JSRequestConstructor final : public JSC::InternalFunction { -public: - using Base = JSC::InternalFunction; - static JSRequestConstructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSRequestPrototype* prototype); + public: + using Base = JSC::InternalFunction; + static JSRequestConstructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSRequestPrototype* prototype); + + static constexpr unsigned StructureFlags = Base::StructureFlags; + static constexpr bool needsDestruction = false; + + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); + } + + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return WebCore::subspaceForImpl<JSRequestConstructor, WebCore::UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForRequestConstructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForRequestConstructor = std::forward<decltype(space)>(space); }, + [](auto& spaces) { return spaces.m_subspaceForRequestConstructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForRequestConstructor = std::forward<decltype(space)>(space); }); + } + + + void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSRequestPrototype* prototype); + + // Must be defined for each specialization class. + static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); + + DECLARE_EXPORT_INFO; + private: + JSRequestConstructor(JSC::VM& vm, JSC::Structure* structure); + void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSRequestPrototype* prototype); + }; - static constexpr unsigned StructureFlags = Base::StructureFlags; - static constexpr bool needsDestruction = false; - - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); - } - - template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl<JSRequestConstructor, WebCore::UseCustomHeapCellType::No>( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForRequestConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForRequestConstructor = std::forward<decltype(space)>(space); }, - [](auto& spaces) { return spaces.m_subspaceForRequestConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForRequestConstructor = std::forward<decltype(space)>(space); }); - } - - void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSRequestPrototype* prototype); - - // Must be defined for each specialization class. - static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); - - DECLARE_EXPORT_INFO; - -private: - JSRequestConstructor(JSC::VM& vm, JSC::Structure* structure); - void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSRequestPrototype* prototype); -}; extern "C" void* RequestClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); JSC_DECLARE_CUSTOM_GETTER(jsRequestConstructor); extern "C" void RequestClass__finalize(void*); + extern "C" EncodedJSValue RequestPrototype__getArrayBuffer(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(RequestPrototype__arrayBufferCallback); + extern "C" EncodedJSValue RequestPrototype__getBlob(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(RequestPrototype__blobCallback); + extern "C" JSC::EncodedJSValue RequestPrototype__getBody(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(RequestPrototype__bodyGetterWrap); + extern "C" JSC::EncodedJSValue RequestPrototype__getBodyUsed(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(RequestPrototype__bodyUsedGetterWrap); + extern "C" JSC::EncodedJSValue RequestPrototype__getCache(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(RequestPrototype__cacheGetterWrap); + extern "C" EncodedJSValue RequestPrototype__doClone(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(RequestPrototype__cloneCallback); + extern "C" JSC::EncodedJSValue RequestPrototype__getCredentials(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(RequestPrototype__credentialsGetterWrap); + extern "C" JSC::EncodedJSValue RequestPrototype__getDestination(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(RequestPrototype__destinationGetterWrap); + extern "C" EncodedJSValue RequestPrototype__getFormData(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(RequestPrototype__formDataCallback); + extern "C" JSC::EncodedJSValue RequestPrototype__getHeaders(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(RequestPrototype__headersGetterWrap); + extern "C" JSC::EncodedJSValue RequestPrototype__getIntegrity(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(RequestPrototype__integrityGetterWrap); + extern "C" EncodedJSValue RequestPrototype__getJSON(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(RequestPrototype__jsonCallback); + extern "C" JSC::EncodedJSValue RequestPrototype__getMethod(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(RequestPrototype__methodGetterWrap); + extern "C" JSC::EncodedJSValue RequestPrototype__getMode(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(RequestPrototype__modeGetterWrap); + extern "C" JSC::EncodedJSValue RequestPrototype__getRedirect(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(RequestPrototype__redirectGetterWrap); + extern "C" JSC::EncodedJSValue RequestPrototype__getReferrer(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(RequestPrototype__referrerGetterWrap); + extern "C" JSC::EncodedJSValue RequestPrototype__getReferrerPolicy(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(RequestPrototype__referrerPolicyGetterWrap); + extern "C" JSC::EncodedJSValue RequestPrototype__getSignal(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(RequestPrototype__signalGetterWrap); + extern "C" EncodedJSValue RequestPrototype__getText(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(RequestPrototype__textCallback); + extern "C" JSC::EncodedJSValue RequestPrototype__getUrl(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(RequestPrototype__urlGetterWrap); + STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSRequestPrototype, JSRequestPrototype::Base); -static const HashTableValue JSRequestPrototypeTableValues[] = { - { "arrayBuffer"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, RequestPrototype__arrayBufferCallback, 0 } }, - { "blob"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, RequestPrototype__blobCallback, 0 } }, - { "body"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, RequestPrototype__bodyGetterWrap, 0 } }, - { "bodyUsed"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, RequestPrototype__bodyUsedGetterWrap, 0 } }, - { "cache"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, RequestPrototype__cacheGetterWrap, 0 } }, - { "clone"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, RequestPrototype__cloneCallback, 1 } }, - { "credentials"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, RequestPrototype__credentialsGetterWrap, 0 } }, - { "destination"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, RequestPrototype__destinationGetterWrap, 0 } }, - { "formData"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, RequestPrototype__formDataCallback, 0 } }, - { "headers"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, RequestPrototype__headersGetterWrap, 0 } }, - { "integrity"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, RequestPrototype__integrityGetterWrap, 0 } }, - { "json"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, RequestPrototype__jsonCallback, 0 } }, - { "method"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, RequestPrototype__methodGetterWrap, 0 } }, - { "mode"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, RequestPrototype__modeGetterWrap, 0 } }, - { "redirect"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, RequestPrototype__redirectGetterWrap, 0 } }, - { "referrer"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, RequestPrototype__referrerGetterWrap, 0 } }, - { "referrerPolicy"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, RequestPrototype__referrerPolicyGetterWrap, 0 } }, - { "signal"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, RequestPrototype__signalGetterWrap, 0 } }, - { "text"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, RequestPrototype__textCallback, 0 } }, - { "url"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, RequestPrototype__urlGetterWrap, 0 } } + + static const HashTableValue JSRequestPrototypeTableValues[] = { +{ "arrayBuffer"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, RequestPrototype__arrayBufferCallback, 0 } } , +{ "blob"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, RequestPrototype__blobCallback, 0 } } , +{ "body"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, RequestPrototype__bodyGetterWrap, 0 } } , +{ "bodyUsed"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, RequestPrototype__bodyUsedGetterWrap, 0 } } , +{ "cache"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, RequestPrototype__cacheGetterWrap, 0 } } , +{ "clone"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, RequestPrototype__cloneCallback, 1 } } , +{ "credentials"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, RequestPrototype__credentialsGetterWrap, 0 } } , +{ "destination"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, RequestPrototype__destinationGetterWrap, 0 } } , +{ "formData"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, RequestPrototype__formDataCallback, 0 } } , +{ "headers"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, RequestPrototype__headersGetterWrap, 0 } } , +{ "integrity"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, RequestPrototype__integrityGetterWrap, 0 } } , +{ "json"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, RequestPrototype__jsonCallback, 0 } } , +{ "method"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, RequestPrototype__methodGetterWrap, 0 } } , +{ "mode"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, RequestPrototype__modeGetterWrap, 0 } } , +{ "redirect"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, RequestPrototype__redirectGetterWrap, 0 } } , +{ "referrer"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, RequestPrototype__referrerGetterWrap, 0 } } , +{ "referrerPolicy"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, RequestPrototype__referrerPolicyGetterWrap, 0 } } , +{ "signal"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, RequestPrototype__signalGetterWrap, 0 } } , +{ "text"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, RequestPrototype__textCallback, 0 } } , +{ "url"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, RequestPrototype__urlGetterWrap, 0 } } }; + + const ClassInfo JSRequestPrototype::s_info = { "Request"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSRequestPrototype) }; + + JSC_DEFINE_CUSTOM_GETTER(jsRequestConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); @@ -6418,75 +6961,83 @@ JSC_DEFINE_CUSTOM_GETTER(jsRequestConstructor, (JSGlobalObject * lexicalGlobalOb if (UNLIKELY(!prototype)) return throwVMTypeError(lexicalGlobalObject, throwScope); return JSValue::encode(globalObject->JSRequestConstructor()); -} +} + -JSC_DEFINE_HOST_FUNCTION(RequestPrototype__arrayBufferCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - JSRequest* thisObject = jsDynamicCast<JSRequest*>(callFrame->thisValue()); + JSC_DEFINE_HOST_FUNCTION(RequestPrototype__arrayBufferCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); + + JSRequest* thisObject = jsDynamicCast<JSRequest*>(callFrame->thisValue()); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return RequestPrototype__getArrayBuffer(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + return RequestPrototype__getArrayBuffer(thisObject->wrapped(), lexicalGlobalObject, callFrame); + } + -JSC_DEFINE_HOST_FUNCTION(RequestPrototype__blobCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + JSC_DEFINE_HOST_FUNCTION(RequestPrototype__blobCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - JSRequest* thisObject = jsDynamicCast<JSRequest*>(callFrame->thisValue()); + JSRequest* thisObject = jsDynamicCast<JSRequest*>(callFrame->thisValue()); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return RequestPrototype__getBlob(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + return RequestPrototype__getBlob(thisObject->wrapped(), lexicalGlobalObject, callFrame); + } + JSC_DEFINE_CUSTOM_GETTER(RequestPrototype__bodyGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSRequest* thisObject = jsCast<JSRequest*>(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + if (JSValue cachedValue = thisObject->m_body.get()) return JSValue::encode(cachedValue); - + JSC::JSValue result = JSC::JSValue::decode( - RequestPrototype__getBody(thisObject->wrapped(), globalObject)); + RequestPrototype__getBody(thisObject->wrapped(), globalObject) + ); RETURN_IF_EXCEPTION(throwScope, {}); thisObject->m_body.set(vm, thisObject, result); RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); } -extern "C" void RequestPrototype__bodySetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast<JSRequest*>(JSValue::decode(thisValue)); - thisObject->m_body.set(vm, thisObject, JSValue::decode(value)); -} -extern "C" EncodedJSValue RequestPrototype__bodyGetCachedValue(JSC::EncodedJSValue thisValue) -{ + extern "C" void RequestPrototype__bodySetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject *globalObject, JSC::EncodedJSValue value) + { + auto& vm = globalObject->vm(); + auto* thisObject = jsCast<JSRequest*>(JSValue::decode(thisValue)); + thisObject->m_body.set(vm, thisObject, JSValue::decode(value)); + } + + extern "C" EncodedJSValue RequestPrototype__bodyGetCachedValue(JSC::EncodedJSValue thisValue) + { auto* thisObject = jsCast<JSRequest*>(JSValue::decode(thisValue)); return JSValue::encode(thisObject->m_body.get()); -} + } + + JSC_DEFINE_CUSTOM_GETTER(RequestPrototype__bodyUsedGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSRequest* thisObject = jsCast<JSRequest*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -6494,11 +7045,12 @@ JSC_DEFINE_CUSTOM_GETTER(RequestPrototype__bodyUsedGetterWrap, (JSGlobalObject * RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + JSC_DEFINE_CUSTOM_GETTER(RequestPrototype__cacheGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSRequest* thisObject = jsCast<JSRequest*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -6506,27 +7058,29 @@ JSC_DEFINE_CUSTOM_GETTER(RequestPrototype__cacheGetterWrap, (JSGlobalObject * le RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + -JSC_DEFINE_HOST_FUNCTION(RequestPrototype__cloneCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + JSC_DEFINE_HOST_FUNCTION(RequestPrototype__cloneCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - JSRequest* thisObject = jsDynamicCast<JSRequest*>(callFrame->thisValue()); + JSRequest* thisObject = jsDynamicCast<JSRequest*>(callFrame->thisValue()); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return RequestPrototype__doClone(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + return RequestPrototype__doClone(thisObject->wrapped(), lexicalGlobalObject, callFrame); + } + JSC_DEFINE_CUSTOM_GETTER(RequestPrototype__credentialsGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSRequest* thisObject = jsCast<JSRequest*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -6534,11 +7088,12 @@ JSC_DEFINE_CUSTOM_GETTER(RequestPrototype__credentialsGetterWrap, (JSGlobalObjec RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + JSC_DEFINE_CUSTOM_GETTER(RequestPrototype__destinationGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSRequest* thisObject = jsCast<JSRequest*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -6546,58 +7101,64 @@ JSC_DEFINE_CUSTOM_GETTER(RequestPrototype__destinationGetterWrap, (JSGlobalObjec RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + -JSC_DEFINE_HOST_FUNCTION(RequestPrototype__formDataCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + JSC_DEFINE_HOST_FUNCTION(RequestPrototype__formDataCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - JSRequest* thisObject = jsDynamicCast<JSRequest*>(callFrame->thisValue()); + JSRequest* thisObject = jsDynamicCast<JSRequest*>(callFrame->thisValue()); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return RequestPrototype__getFormData(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + return RequestPrototype__getFormData(thisObject->wrapped(), lexicalGlobalObject, callFrame); + } + JSC_DEFINE_CUSTOM_GETTER(RequestPrototype__headersGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSRequest* thisObject = jsCast<JSRequest*>(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + if (JSValue cachedValue = thisObject->m_headers.get()) return JSValue::encode(cachedValue); - + JSC::JSValue result = JSC::JSValue::decode( - RequestPrototype__getHeaders(thisObject->wrapped(), globalObject)); + RequestPrototype__getHeaders(thisObject->wrapped(), globalObject) + ); RETURN_IF_EXCEPTION(throwScope, {}); thisObject->m_headers.set(vm, thisObject, result); RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); } -extern "C" void RequestPrototype__headersSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast<JSRequest*>(JSValue::decode(thisValue)); - thisObject->m_headers.set(vm, thisObject, JSValue::decode(value)); -} -extern "C" EncodedJSValue RequestPrototype__headersGetCachedValue(JSC::EncodedJSValue thisValue) -{ + extern "C" void RequestPrototype__headersSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject *globalObject, JSC::EncodedJSValue value) + { + auto& vm = globalObject->vm(); + auto* thisObject = jsCast<JSRequest*>(JSValue::decode(thisValue)); + thisObject->m_headers.set(vm, thisObject, JSValue::decode(value)); + } + + extern "C" EncodedJSValue RequestPrototype__headersGetCachedValue(JSC::EncodedJSValue thisValue) + { auto* thisObject = jsCast<JSRequest*>(JSValue::decode(thisValue)); return JSValue::encode(thisObject->m_headers.get()); -} + } + + JSC_DEFINE_CUSTOM_GETTER(RequestPrototype__integrityGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSRequest* thisObject = jsCast<JSRequest*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -6605,27 +7166,29 @@ JSC_DEFINE_CUSTOM_GETTER(RequestPrototype__integrityGetterWrap, (JSGlobalObject RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + -JSC_DEFINE_HOST_FUNCTION(RequestPrototype__jsonCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + JSC_DEFINE_HOST_FUNCTION(RequestPrototype__jsonCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - JSRequest* thisObject = jsDynamicCast<JSRequest*>(callFrame->thisValue()); + JSRequest* thisObject = jsDynamicCast<JSRequest*>(callFrame->thisValue()); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return RequestPrototype__getJSON(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + return RequestPrototype__getJSON(thisObject->wrapped(), lexicalGlobalObject, callFrame); + } + JSC_DEFINE_CUSTOM_GETTER(RequestPrototype__methodGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSRequest* thisObject = jsCast<JSRequest*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -6633,11 +7196,12 @@ JSC_DEFINE_CUSTOM_GETTER(RequestPrototype__methodGetterWrap, (JSGlobalObject * l RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + JSC_DEFINE_CUSTOM_GETTER(RequestPrototype__modeGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSRequest* thisObject = jsCast<JSRequest*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -6645,11 +7209,12 @@ JSC_DEFINE_CUSTOM_GETTER(RequestPrototype__modeGetterWrap, (JSGlobalObject * lex RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + JSC_DEFINE_CUSTOM_GETTER(RequestPrototype__redirectGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSRequest* thisObject = jsCast<JSRequest*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -6657,11 +7222,12 @@ JSC_DEFINE_CUSTOM_GETTER(RequestPrototype__redirectGetterWrap, (JSGlobalObject * RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + JSC_DEFINE_CUSTOM_GETTER(RequestPrototype__referrerGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSRequest* thisObject = jsCast<JSRequest*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -6669,11 +7235,12 @@ JSC_DEFINE_CUSTOM_GETTER(RequestPrototype__referrerGetterWrap, (JSGlobalObject * RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + JSC_DEFINE_CUSTOM_GETTER(RequestPrototype__referrerPolicyGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSRequest* thisObject = jsCast<JSRequest*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -6681,84 +7248,94 @@ JSC_DEFINE_CUSTOM_GETTER(RequestPrototype__referrerPolicyGetterWrap, (JSGlobalOb RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + JSC_DEFINE_CUSTOM_GETTER(RequestPrototype__signalGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSRequest* thisObject = jsCast<JSRequest*>(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + if (JSValue cachedValue = thisObject->m_signal.get()) return JSValue::encode(cachedValue); - + JSC::JSValue result = JSC::JSValue::decode( - RequestPrototype__getSignal(thisObject->wrapped(), globalObject)); + RequestPrototype__getSignal(thisObject->wrapped(), globalObject) + ); RETURN_IF_EXCEPTION(throwScope, {}); thisObject->m_signal.set(vm, thisObject, result); RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); } -extern "C" void RequestPrototype__signalSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast<JSRequest*>(JSValue::decode(thisValue)); - thisObject->m_signal.set(vm, thisObject, JSValue::decode(value)); -} -extern "C" EncodedJSValue RequestPrototype__signalGetCachedValue(JSC::EncodedJSValue thisValue) -{ + extern "C" void RequestPrototype__signalSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject *globalObject, JSC::EncodedJSValue value) + { + auto& vm = globalObject->vm(); + auto* thisObject = jsCast<JSRequest*>(JSValue::decode(thisValue)); + thisObject->m_signal.set(vm, thisObject, JSValue::decode(value)); + } + + extern "C" EncodedJSValue RequestPrototype__signalGetCachedValue(JSC::EncodedJSValue thisValue) + { auto* thisObject = jsCast<JSRequest*>(JSValue::decode(thisValue)); return JSValue::encode(thisObject->m_signal.get()); -} + } + + -JSC_DEFINE_HOST_FUNCTION(RequestPrototype__textCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + JSC_DEFINE_HOST_FUNCTION(RequestPrototype__textCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - JSRequest* thisObject = jsDynamicCast<JSRequest*>(callFrame->thisValue()); + JSRequest* thisObject = jsDynamicCast<JSRequest*>(callFrame->thisValue()); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return RequestPrototype__getText(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + return RequestPrototype__getText(thisObject->wrapped(), lexicalGlobalObject, callFrame); + } + JSC_DEFINE_CUSTOM_GETTER(RequestPrototype__urlGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSRequest* thisObject = jsCast<JSRequest*>(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + if (JSValue cachedValue = thisObject->m_url.get()) return JSValue::encode(cachedValue); - + JSC::JSValue result = JSC::JSValue::decode( - RequestPrototype__getUrl(thisObject->wrapped(), globalObject)); + RequestPrototype__getUrl(thisObject->wrapped(), globalObject) + ); RETURN_IF_EXCEPTION(throwScope, {}); thisObject->m_url.set(vm, thisObject, result); RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); } -extern "C" void RequestPrototype__urlSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast<JSRequest*>(JSValue::decode(thisValue)); - thisObject->m_url.set(vm, thisObject, JSValue::decode(value)); -} -extern "C" EncodedJSValue RequestPrototype__urlGetCachedValue(JSC::EncodedJSValue thisValue) -{ + extern "C" void RequestPrototype__urlSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject *globalObject, JSC::EncodedJSValue value) + { + auto& vm = globalObject->vm(); + auto* thisObject = jsCast<JSRequest*>(JSValue::decode(thisValue)); + thisObject->m_url.set(vm, thisObject, JSValue::decode(value)); + } + + extern "C" EncodedJSValue RequestPrototype__urlGetCachedValue(JSC::EncodedJSValue thisValue) + { auto* thisObject = jsCast<JSRequest*>(JSValue::decode(thisValue)); return JSValue::encode(thisObject->m_url.get()); -} + } + + void JSRequestPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) { @@ -6769,68 +7346,72 @@ void JSRequestPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* global extern "C" size_t Request__estimatedSize(void* ptr); + + void JSRequestConstructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSRequestPrototype* prototype) { Base::finishCreation(vm, 0, "Request"_s, PropertyAdditionMode::WithoutStructureTransition); - + putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly); ASSERT(inherits(info())); } -JSRequestConstructor::JSRequestConstructor(JSC::VM& vm, JSC::Structure* structure) - : Base(vm, structure, construct, construct) -{ -} +JSRequestConstructor::JSRequestConstructor(JSC::VM& vm, JSC::Structure* structure) : Base(vm, structure, construct, construct) { -JSRequestConstructor* JSRequestConstructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSRequestPrototype* prototype) -{ + } + +JSRequestConstructor* JSRequestConstructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSRequestPrototype* prototype) { JSRequestConstructor* ptr = new (NotNull, JSC::allocateCell<JSRequestConstructor>(vm)) JSRequestConstructor(vm, structure); ptr->finishCreation(vm, globalObject, prototype); return ptr; } + JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSRequestConstructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) { - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); - JSC::VM& vm = globalObject->vm(); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + JSC::VM &vm = globalObject->vm(); JSObject* newTarget = asObject(callFrame->newTarget()); auto* constructor = globalObject->JSRequestConstructor(); Structure* structure = globalObject->JSRequestStructure(); if (constructor != newTarget) { - auto scope = DECLARE_THROW_SCOPE(vm); + auto scope = DECLARE_THROW_SCOPE(vm); - auto* functionGlobalObject = reinterpret_cast<Zig::GlobalObject*>( - // ShadowRealm functions belong to a different global object. - getFunctionRealm(globalObject, newTarget)); - RETURN_IF_EXCEPTION(scope, {}); - structure = InternalFunction::createSubclassStructure( - globalObject, - newTarget, - functionGlobalObject->JSRequestStructure()); + auto* functionGlobalObject = reinterpret_cast<Zig::GlobalObject*>( + // ShadowRealm functions belong to a different global object. + getFunctionRealm(globalObject, newTarget) + ); + RETURN_IF_EXCEPTION(scope, {}); + structure = InternalFunction::createSubclassStructure( + globalObject, + newTarget, + functionGlobalObject->JSRequestStructure() + ); } void* ptr = RequestClass__construct(globalObject, callFrame); if (UNLIKELY(!ptr)) { - return JSValue::encode(JSC::jsUndefined()); + return JSValue::encode(JSC::jsUndefined()); } JSRequest* instance = JSRequest::create(vm, globalObject, structure, ptr); - vm.heap.reportExtraMemoryAllocated(Request__estimatedSize(instance->wrapped())); + vm.heap.reportExtraMemoryAllocated(Request__estimatedSize(instance->wrapped())); return JSValue::encode(instance); } void JSRequestConstructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSRequestPrototype* prototype) { + } const ClassInfo JSRequestConstructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSRequestConstructor) }; -extern "C" EncodedJSValue Request__getConstructor(Zig::GlobalObject* globalObject) -{ + + extern "C" EncodedJSValue Request__getConstructor(Zig::GlobalObject* globalObject) { return JSValue::encode(globalObject->JSRequestConstructor()); -} + } JSRequest::~JSRequest() { @@ -6842,7 +7423,7 @@ void JSRequest::destroy(JSCell* cell) { static_cast<JSRequest*>(cell)->JSRequest::~JSRequest(); } - + const ClassInfo JSRequest::s_info = { "Request"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSRequest) }; void JSRequest::finishCreation(VM& vm) @@ -6851,38 +7432,37 @@ void JSRequest::finishCreation(VM& vm) ASSERT(inherits(info())); } -JSRequest* JSRequest::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSRequest* ptr = new (NotNull, JSC::allocateCell<JSRequest>(vm)) JSRequest(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} -extern "C" void* Request__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; +JSRequest* JSRequest::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) { + JSRequest* ptr = new (NotNull, JSC::allocateCell<JSRequest>(vm)) JSRequest(vm, structure, ctx); + ptr->finishCreation(vm); + return ptr; +} - JSC::JSCell* cell = decodedValue.asCell(); - JSRequest* object = JSC::jsDynamicCast<JSRequest*>(cell); +extern "C" void* Request__fromJS(JSC::EncodedJSValue value) { + JSC::JSValue decodedValue = JSC::JSValue::decode(value); + if (decodedValue.isEmpty() || !decodedValue.isCell()) + return nullptr; - if (!object) - return nullptr; + JSC::JSCell* cell = decodedValue.asCell(); + JSRequest* object = JSC::jsDynamicCast<JSRequest*>(cell); - return object->wrapped(); + if (!object) + return nullptr; + + return object->wrapped(); } -extern "C" bool Request__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSRequest* object = JSC::jsDynamicCast<JSRequest*>(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; +extern "C" bool Request__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) { + JSRequest* object = JSC::jsDynamicCast<JSRequest*>(JSValue::decode(value)); + if (!object) + return false; + + object->m_ctx = ptr; + return true; } + extern "C" const size_t Request__ptrOffset = JSRequest::offsetOfWrapped(); void JSRequest::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) @@ -6897,7 +7477,7 @@ void JSRequest::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) JSObject* JSRequest::createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype) { - return WebCore::JSRequestConstructor::create(vm, globalObject, WebCore::JSRequestConstructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast<WebCore::JSRequestPrototype*>(prototype)); + return WebCore::JSRequestConstructor::create(vm, globalObject, WebCore::JSRequestConstructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast<WebCore::JSRequestPrototype*>(prototype)); } JSObject* JSRequest::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) @@ -6905,13 +7485,12 @@ JSObject* JSRequest::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) return JSRequestPrototype::create(vm, globalObject, JSRequestPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); } -extern "C" EncodedJSValue Request__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSRequestStructure(); - JSRequest* instance = JSRequest::create(vm, globalObject, structure, ptr); - vm.heap.reportExtraMemoryAllocated(Request__estimatedSize(ptr)); - return JSValue::encode(instance); +extern "C" EncodedJSValue Request__create(Zig::GlobalObject* globalObject, void* ptr) { + auto &vm = globalObject->vm(); + JSC::Structure* structure = globalObject->JSRequestStructure(); + JSRequest* instance = JSRequest::create(vm, globalObject, structure, ptr); + vm.heap.reportExtraMemoryAllocated(Request__estimatedSize(ptr)); + return JSValue::encode(instance); } template<typename Visitor> @@ -6920,14 +7499,15 @@ void JSRequest::visitChildrenImpl(JSCell* cell, Visitor& visitor) JSRequest* thisObject = jsCast<JSRequest*>(cell); ASSERT_GC_OBJECT_INHERITS(thisObject, info()); Base::visitChildren(thisObject, visitor); - + if (auto* ptr = thisObject->wrapped()) { - visitor.reportExtraMemoryVisited(Request__estimatedSize(ptr)); - } +visitor.reportExtraMemoryVisited(Request__estimatedSize(ptr)); +} visitor.append(thisObject->m_body); visitor.append(thisObject->m_headers); visitor.append(thisObject->m_signal); visitor.append(thisObject->m_url); + } DEFINE_VISIT_CHILDREN(JSRequest); @@ -6935,10 +7515,10 @@ DEFINE_VISIT_CHILDREN(JSRequest); template<typename Visitor> void JSRequest::visitAdditionalChildren(Visitor& visitor) { - JSRequest* thisObject = this; + JSRequest* thisObject = this; ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - - visitor.append(thisObject->m_body); + + visitor.append(thisObject->m_body); visitor.append(thisObject->m_headers); visitor.append(thisObject->m_signal); visitor.append(thisObject->m_url); @@ -6948,7 +7528,7 @@ void JSRequest::visitAdditionalChildren(Visitor& visitor) DEFINE_VISIT_ADDITIONAL_CHILDREN(JSRequest); template<typename Visitor> -void JSRequest::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) +void JSRequest::visitOutputConstraintsImpl(JSCell *cell, Visitor& visitor) { JSRequest* thisObject = jsCast<JSRequest*>(cell); ASSERT_GC_OBJECT_INHERITS(thisObject, info()); @@ -6956,145 +7536,167 @@ void JSRequest::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) } DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSRequest); -class JSResponsePrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSResponsePrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSResponsePrototype* ptr = new (NotNull, JSC::allocateCell<JSResponsePrototype>(vm)) JSResponsePrototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template<typename CellType, JSC::SubspaceAccess> - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSResponsePrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; + class JSResponsePrototype final : public JSC::JSNonFinalObject { + public: + using Base = JSC::JSNonFinalObject; + + static JSResponsePrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) + { + JSResponsePrototype* ptr = new (NotNull, JSC::allocateCell<JSResponsePrototype>(vm)) JSResponsePrototype(vm, globalObject, structure); + ptr->finishCreation(vm, globalObject); + return ptr; + } + + DECLARE_INFO; + template<typename CellType, JSC::SubspaceAccess> + static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + return &vm.plainObjectSpace(); + } + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); + } + + private: + JSResponsePrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) + : Base(vm, structure) + { + } + + void finishCreation(JSC::VM&, JSC::JSGlobalObject*); + }; class JSResponseConstructor final : public JSC::InternalFunction { -public: - using Base = JSC::InternalFunction; - static JSResponseConstructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSResponsePrototype* prototype); + public: + using Base = JSC::InternalFunction; + static JSResponseConstructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSResponsePrototype* prototype); + + static constexpr unsigned StructureFlags = Base::StructureFlags; + static constexpr bool needsDestruction = false; + + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); + } + + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return WebCore::subspaceForImpl<JSResponseConstructor, WebCore::UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForResponseConstructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForResponseConstructor = std::forward<decltype(space)>(space); }, + [](auto& spaces) { return spaces.m_subspaceForResponseConstructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForResponseConstructor = std::forward<decltype(space)>(space); }); + } + + + void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSResponsePrototype* prototype); + + // Must be defined for each specialization class. + static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); + + DECLARE_EXPORT_INFO; + private: + JSResponseConstructor(JSC::VM& vm, JSC::Structure* structure); + void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSResponsePrototype* prototype); + }; - static constexpr unsigned StructureFlags = Base::StructureFlags; - static constexpr bool needsDestruction = false; - - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); - } - - template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl<JSResponseConstructor, WebCore::UseCustomHeapCellType::No>( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForResponseConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForResponseConstructor = std::forward<decltype(space)>(space); }, - [](auto& spaces) { return spaces.m_subspaceForResponseConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForResponseConstructor = std::forward<decltype(space)>(space); }); - } - - void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSResponsePrototype* prototype); - - // Must be defined for each specialization class. - static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); - - DECLARE_EXPORT_INFO; - -private: - JSResponseConstructor(JSC::VM& vm, JSC::Structure* structure); - void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSResponsePrototype* prototype); -}; extern "C" void* ResponseClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); JSC_DECLARE_CUSTOM_GETTER(jsResponseConstructor); extern "C" void ResponseClass__finalize(void*); + extern "C" EncodedJSValue ResponsePrototype__getArrayBuffer(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(ResponsePrototype__arrayBufferCallback); + extern "C" EncodedJSValue ResponsePrototype__getBlob(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(ResponsePrototype__blobCallback); + extern "C" JSC::EncodedJSValue ResponsePrototype__getBody(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(ResponsePrototype__bodyGetterWrap); + extern "C" JSC::EncodedJSValue ResponsePrototype__getBodyUsed(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(ResponsePrototype__bodyUsedGetterWrap); + extern "C" EncodedJSValue ResponsePrototype__doClone(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(ResponsePrototype__cloneCallback); + extern "C" EncodedJSValue ResponsePrototype__getFormData(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(ResponsePrototype__formDataCallback); + extern "C" JSC::EncodedJSValue ResponsePrototype__getHeaders(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(ResponsePrototype__headersGetterWrap); + extern "C" EncodedJSValue ResponsePrototype__getJSON(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(ResponsePrototype__jsonCallback); + extern "C" JSC::EncodedJSValue ResponsePrototype__getOK(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(ResponsePrototype__okGetterWrap); + extern "C" JSC::EncodedJSValue ResponsePrototype__getRedirected(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(ResponsePrototype__redirectedGetterWrap); + extern "C" JSC::EncodedJSValue ResponsePrototype__getStatus(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(ResponsePrototype__statusGetterWrap); + extern "C" JSC::EncodedJSValue ResponsePrototype__getStatusText(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(ResponsePrototype__statusTextGetterWrap); + extern "C" EncodedJSValue ResponsePrototype__getText(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(ResponsePrototype__textCallback); + extern "C" JSC::EncodedJSValue ResponsePrototype__getResponseType(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(ResponsePrototype__typeGetterWrap); + extern "C" JSC::EncodedJSValue ResponsePrototype__getURL(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(ResponsePrototype__urlGetterWrap); + STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSResponsePrototype, JSResponsePrototype::Base); -static const HashTableValue JSResponsePrototypeTableValues[] = { - { "arrayBuffer"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ResponsePrototype__arrayBufferCallback, 0 } }, - { "blob"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ResponsePrototype__blobCallback, 0 } }, - { "body"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ResponsePrototype__bodyGetterWrap, 0 } }, - { "bodyUsed"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ResponsePrototype__bodyUsedGetterWrap, 0 } }, - { "clone"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ResponsePrototype__cloneCallback, 1 } }, - { "formData"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ResponsePrototype__formDataCallback, 0 } }, - { "headers"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ResponsePrototype__headersGetterWrap, 0 } }, - { "json"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ResponsePrototype__jsonCallback, 0 } }, - { "ok"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ResponsePrototype__okGetterWrap, 0 } }, - { "redirected"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ResponsePrototype__redirectedGetterWrap, 0 } }, - { "status"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ResponsePrototype__statusGetterWrap, 0 } }, - { "statusText"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ResponsePrototype__statusTextGetterWrap, 0 } }, - { "text"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ResponsePrototype__textCallback, 0 } }, - { "type"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ResponsePrototype__typeGetterWrap, 0 } }, - { "url"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ResponsePrototype__urlGetterWrap, 0 } } + + static const HashTableValue JSResponsePrototypeTableValues[] = { +{ "arrayBuffer"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ResponsePrototype__arrayBufferCallback, 0 } } , +{ "blob"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ResponsePrototype__blobCallback, 0 } } , +{ "body"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ResponsePrototype__bodyGetterWrap, 0 } } , +{ "bodyUsed"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ResponsePrototype__bodyUsedGetterWrap, 0 } } , +{ "clone"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ResponsePrototype__cloneCallback, 1 } } , +{ "formData"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ResponsePrototype__formDataCallback, 0 } } , +{ "headers"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ResponsePrototype__headersGetterWrap, 0 } } , +{ "json"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ResponsePrototype__jsonCallback, 0 } } , +{ "ok"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ResponsePrototype__okGetterWrap, 0 } } , +{ "redirected"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ResponsePrototype__redirectedGetterWrap, 0 } } , +{ "status"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ResponsePrototype__statusGetterWrap, 0 } } , +{ "statusText"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ResponsePrototype__statusTextGetterWrap, 0 } } , +{ "text"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ResponsePrototype__textCallback, 0 } } , +{ "type"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ResponsePrototype__typeGetterWrap, 0 } } , +{ "url"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ResponsePrototype__urlGetterWrap, 0 } } }; + + const ClassInfo JSResponsePrototype::s_info = { "Response"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSResponsePrototype) }; + + JSC_DEFINE_CUSTOM_GETTER(jsResponseConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); @@ -7105,75 +7707,83 @@ JSC_DEFINE_CUSTOM_GETTER(jsResponseConstructor, (JSGlobalObject * lexicalGlobalO if (UNLIKELY(!prototype)) return throwVMTypeError(lexicalGlobalObject, throwScope); return JSValue::encode(globalObject->JSResponseConstructor()); -} +} + -JSC_DEFINE_HOST_FUNCTION(ResponsePrototype__arrayBufferCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - JSResponse* thisObject = jsDynamicCast<JSResponse*>(callFrame->thisValue()); + JSC_DEFINE_HOST_FUNCTION(ResponsePrototype__arrayBufferCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } + JSResponse* thisObject = jsDynamicCast<JSResponse*>(callFrame->thisValue()); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - return ResponsePrototype__getArrayBuffer(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); -JSC_DEFINE_HOST_FUNCTION(ResponsePrototype__blobCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + return ResponsePrototype__getArrayBuffer(thisObject->wrapped(), lexicalGlobalObject, callFrame); + } + + + JSC_DEFINE_HOST_FUNCTION(ResponsePrototype__blobCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - JSResponse* thisObject = jsDynamicCast<JSResponse*>(callFrame->thisValue()); + JSResponse* thisObject = jsDynamicCast<JSResponse*>(callFrame->thisValue()); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return ResponsePrototype__getBlob(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + return ResponsePrototype__getBlob(thisObject->wrapped(), lexicalGlobalObject, callFrame); + } + JSC_DEFINE_CUSTOM_GETTER(ResponsePrototype__bodyGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSResponse* thisObject = jsCast<JSResponse*>(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + if (JSValue cachedValue = thisObject->m_body.get()) return JSValue::encode(cachedValue); - + JSC::JSValue result = JSC::JSValue::decode( - ResponsePrototype__getBody(thisObject->wrapped(), globalObject)); + ResponsePrototype__getBody(thisObject->wrapped(), globalObject) + ); RETURN_IF_EXCEPTION(throwScope, {}); thisObject->m_body.set(vm, thisObject, result); RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); } -extern "C" void ResponsePrototype__bodySetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast<JSResponse*>(JSValue::decode(thisValue)); - thisObject->m_body.set(vm, thisObject, JSValue::decode(value)); -} -extern "C" EncodedJSValue ResponsePrototype__bodyGetCachedValue(JSC::EncodedJSValue thisValue) -{ + extern "C" void ResponsePrototype__bodySetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject *globalObject, JSC::EncodedJSValue value) + { + auto& vm = globalObject->vm(); + auto* thisObject = jsCast<JSResponse*>(JSValue::decode(thisValue)); + thisObject->m_body.set(vm, thisObject, JSValue::decode(value)); + } + + extern "C" EncodedJSValue ResponsePrototype__bodyGetCachedValue(JSC::EncodedJSValue thisValue) + { auto* thisObject = jsCast<JSResponse*>(JSValue::decode(thisValue)); return JSValue::encode(thisObject->m_body.get()); -} + } + + JSC_DEFINE_CUSTOM_GETTER(ResponsePrototype__bodyUsedGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSResponse* thisObject = jsCast<JSResponse*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -7181,90 +7791,98 @@ JSC_DEFINE_CUSTOM_GETTER(ResponsePrototype__bodyUsedGetterWrap, (JSGlobalObject RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + -JSC_DEFINE_HOST_FUNCTION(ResponsePrototype__cloneCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + JSC_DEFINE_HOST_FUNCTION(ResponsePrototype__cloneCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - JSResponse* thisObject = jsDynamicCast<JSResponse*>(callFrame->thisValue()); + JSResponse* thisObject = jsDynamicCast<JSResponse*>(callFrame->thisValue()); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return ResponsePrototype__doClone(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + return ResponsePrototype__doClone(thisObject->wrapped(), lexicalGlobalObject, callFrame); + } + -JSC_DEFINE_HOST_FUNCTION(ResponsePrototype__formDataCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + JSC_DEFINE_HOST_FUNCTION(ResponsePrototype__formDataCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - JSResponse* thisObject = jsDynamicCast<JSResponse*>(callFrame->thisValue()); + JSResponse* thisObject = jsDynamicCast<JSResponse*>(callFrame->thisValue()); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return ResponsePrototype__getFormData(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + return ResponsePrototype__getFormData(thisObject->wrapped(), lexicalGlobalObject, callFrame); + } + JSC_DEFINE_CUSTOM_GETTER(ResponsePrototype__headersGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSResponse* thisObject = jsCast<JSResponse*>(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + if (JSValue cachedValue = thisObject->m_headers.get()) return JSValue::encode(cachedValue); - + JSC::JSValue result = JSC::JSValue::decode( - ResponsePrototype__getHeaders(thisObject->wrapped(), globalObject)); + ResponsePrototype__getHeaders(thisObject->wrapped(), globalObject) + ); RETURN_IF_EXCEPTION(throwScope, {}); thisObject->m_headers.set(vm, thisObject, result); RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); } -extern "C" void ResponsePrototype__headersSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast<JSResponse*>(JSValue::decode(thisValue)); - thisObject->m_headers.set(vm, thisObject, JSValue::decode(value)); -} -extern "C" EncodedJSValue ResponsePrototype__headersGetCachedValue(JSC::EncodedJSValue thisValue) -{ + extern "C" void ResponsePrototype__headersSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject *globalObject, JSC::EncodedJSValue value) + { + auto& vm = globalObject->vm(); + auto* thisObject = jsCast<JSResponse*>(JSValue::decode(thisValue)); + thisObject->m_headers.set(vm, thisObject, JSValue::decode(value)); + } + + extern "C" EncodedJSValue ResponsePrototype__headersGetCachedValue(JSC::EncodedJSValue thisValue) + { auto* thisObject = jsCast<JSResponse*>(JSValue::decode(thisValue)); return JSValue::encode(thisObject->m_headers.get()); -} + } + + -JSC_DEFINE_HOST_FUNCTION(ResponsePrototype__jsonCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + JSC_DEFINE_HOST_FUNCTION(ResponsePrototype__jsonCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - JSResponse* thisObject = jsDynamicCast<JSResponse*>(callFrame->thisValue()); + JSResponse* thisObject = jsDynamicCast<JSResponse*>(callFrame->thisValue()); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return ResponsePrototype__getJSON(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + return ResponsePrototype__getJSON(thisObject->wrapped(), lexicalGlobalObject, callFrame); + } + JSC_DEFINE_CUSTOM_GETTER(ResponsePrototype__okGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSResponse* thisObject = jsCast<JSResponse*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -7272,11 +7890,12 @@ JSC_DEFINE_CUSTOM_GETTER(ResponsePrototype__okGetterWrap, (JSGlobalObject * lexi RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + JSC_DEFINE_CUSTOM_GETTER(ResponsePrototype__redirectedGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSResponse* thisObject = jsCast<JSResponse*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -7284,11 +7903,12 @@ JSC_DEFINE_CUSTOM_GETTER(ResponsePrototype__redirectedGetterWrap, (JSGlobalObjec RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + JSC_DEFINE_CUSTOM_GETTER(ResponsePrototype__statusGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSResponse* thisObject = jsCast<JSResponse*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -7296,58 +7916,64 @@ JSC_DEFINE_CUSTOM_GETTER(ResponsePrototype__statusGetterWrap, (JSGlobalObject * RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + JSC_DEFINE_CUSTOM_GETTER(ResponsePrototype__statusTextGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSResponse* thisObject = jsCast<JSResponse*>(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + if (JSValue cachedValue = thisObject->m_statusText.get()) return JSValue::encode(cachedValue); - + JSC::JSValue result = JSC::JSValue::decode( - ResponsePrototype__getStatusText(thisObject->wrapped(), globalObject)); + ResponsePrototype__getStatusText(thisObject->wrapped(), globalObject) + ); RETURN_IF_EXCEPTION(throwScope, {}); thisObject->m_statusText.set(vm, thisObject, result); RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); } -extern "C" void ResponsePrototype__statusTextSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast<JSResponse*>(JSValue::decode(thisValue)); - thisObject->m_statusText.set(vm, thisObject, JSValue::decode(value)); -} -extern "C" EncodedJSValue ResponsePrototype__statusTextGetCachedValue(JSC::EncodedJSValue thisValue) -{ + extern "C" void ResponsePrototype__statusTextSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject *globalObject, JSC::EncodedJSValue value) + { + auto& vm = globalObject->vm(); + auto* thisObject = jsCast<JSResponse*>(JSValue::decode(thisValue)); + thisObject->m_statusText.set(vm, thisObject, JSValue::decode(value)); + } + + extern "C" EncodedJSValue ResponsePrototype__statusTextGetCachedValue(JSC::EncodedJSValue thisValue) + { auto* thisObject = jsCast<JSResponse*>(JSValue::decode(thisValue)); return JSValue::encode(thisObject->m_statusText.get()); -} + } + + -JSC_DEFINE_HOST_FUNCTION(ResponsePrototype__textCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + JSC_DEFINE_HOST_FUNCTION(ResponsePrototype__textCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - JSResponse* thisObject = jsDynamicCast<JSResponse*>(callFrame->thisValue()); + JSResponse* thisObject = jsDynamicCast<JSResponse*>(callFrame->thisValue()); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return ResponsePrototype__getText(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + return ResponsePrototype__getText(thisObject->wrapped(), lexicalGlobalObject, callFrame); + } + JSC_DEFINE_CUSTOM_GETTER(ResponsePrototype__typeGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSResponse* thisObject = jsCast<JSResponse*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -7355,37 +7981,42 @@ JSC_DEFINE_CUSTOM_GETTER(ResponsePrototype__typeGetterWrap, (JSGlobalObject * le RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + JSC_DEFINE_CUSTOM_GETTER(ResponsePrototype__urlGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSResponse* thisObject = jsCast<JSResponse*>(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + if (JSValue cachedValue = thisObject->m_url.get()) return JSValue::encode(cachedValue); - + JSC::JSValue result = JSC::JSValue::decode( - ResponsePrototype__getURL(thisObject->wrapped(), globalObject)); + ResponsePrototype__getURL(thisObject->wrapped(), globalObject) + ); RETURN_IF_EXCEPTION(throwScope, {}); thisObject->m_url.set(vm, thisObject, result); RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); } -extern "C" void ResponsePrototype__urlSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast<JSResponse*>(JSValue::decode(thisValue)); - thisObject->m_url.set(vm, thisObject, JSValue::decode(value)); -} -extern "C" EncodedJSValue ResponsePrototype__urlGetCachedValue(JSC::EncodedJSValue thisValue) -{ + extern "C" void ResponsePrototype__urlSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject *globalObject, JSC::EncodedJSValue value) + { + auto& vm = globalObject->vm(); + auto* thisObject = jsCast<JSResponse*>(JSValue::decode(thisValue)); + thisObject->m_url.set(vm, thisObject, JSValue::decode(value)); + } + + extern "C" EncodedJSValue ResponsePrototype__urlGetCachedValue(JSC::EncodedJSValue thisValue) + { auto* thisObject = jsCast<JSResponse*>(JSValue::decode(thisValue)); return JSValue::encode(thisObject->m_url.get()); -} + } + + void JSResponsePrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) { @@ -7399,12 +8030,13 @@ extern "C" JSC_DECLARE_HOST_FUNCTION(ResponseClass__constructError); extern "C" JSC_DECLARE_HOST_FUNCTION(ResponseClass__constructJSON); extern "C" JSC_DECLARE_HOST_FUNCTION(ResponseClass__constructRedirect); -static const HashTableValue JSResponseConstructorTableValues[] = { - { "error"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ResponseClass__constructError, 0 } }, - { "json"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ResponseClass__constructJSON, 0 } }, - { "redirect"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ResponseClass__constructRedirect, 0 } } + static const HashTableValue JSResponseConstructorTableValues[] = { +{ "error"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ResponseClass__constructError, 0 } } , +{ "json"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ResponseClass__constructJSON, 0 } } , +{ "redirect"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ResponseClass__constructRedirect, 0 } } }; + void JSResponseConstructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSResponsePrototype* prototype) { Base::finishCreation(vm, 0, "Response"_s, PropertyAdditionMode::WithoutStructureTransition); @@ -7413,60 +8045,62 @@ void JSResponseConstructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalOb ASSERT(inherits(info())); } -JSResponseConstructor::JSResponseConstructor(JSC::VM& vm, JSC::Structure* structure) - : Base(vm, structure, construct, construct) -{ -} +JSResponseConstructor::JSResponseConstructor(JSC::VM& vm, JSC::Structure* structure) : Base(vm, structure, construct, construct) { -JSResponseConstructor* JSResponseConstructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSResponsePrototype* prototype) -{ + } + +JSResponseConstructor* JSResponseConstructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSResponsePrototype* prototype) { JSResponseConstructor* ptr = new (NotNull, JSC::allocateCell<JSResponseConstructor>(vm)) JSResponseConstructor(vm, structure); ptr->finishCreation(vm, globalObject, prototype); return ptr; } + JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSResponseConstructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) { - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); - JSC::VM& vm = globalObject->vm(); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + JSC::VM &vm = globalObject->vm(); JSObject* newTarget = asObject(callFrame->newTarget()); auto* constructor = globalObject->JSResponseConstructor(); Structure* structure = globalObject->JSResponseStructure(); if (constructor != newTarget) { - auto scope = DECLARE_THROW_SCOPE(vm); + auto scope = DECLARE_THROW_SCOPE(vm); - auto* functionGlobalObject = reinterpret_cast<Zig::GlobalObject*>( - // ShadowRealm functions belong to a different global object. - getFunctionRealm(globalObject, newTarget)); - RETURN_IF_EXCEPTION(scope, {}); - structure = InternalFunction::createSubclassStructure( - globalObject, - newTarget, - functionGlobalObject->JSResponseStructure()); + auto* functionGlobalObject = reinterpret_cast<Zig::GlobalObject*>( + // ShadowRealm functions belong to a different global object. + getFunctionRealm(globalObject, newTarget) + ); + RETURN_IF_EXCEPTION(scope, {}); + structure = InternalFunction::createSubclassStructure( + globalObject, + newTarget, + functionGlobalObject->JSResponseStructure() + ); } void* ptr = ResponseClass__construct(globalObject, callFrame); if (UNLIKELY(!ptr)) { - return JSValue::encode(JSC::jsUndefined()); + return JSValue::encode(JSC::jsUndefined()); } JSResponse* instance = JSResponse::create(vm, globalObject, structure, ptr); - vm.heap.reportExtraMemoryAllocated(Response__estimatedSize(instance->wrapped())); + vm.heap.reportExtraMemoryAllocated(Response__estimatedSize(instance->wrapped())); return JSValue::encode(instance); } void JSResponseConstructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSResponsePrototype* prototype) { + } const ClassInfo JSResponseConstructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSResponseConstructor) }; -extern "C" EncodedJSValue Response__getConstructor(Zig::GlobalObject* globalObject) -{ + + extern "C" EncodedJSValue Response__getConstructor(Zig::GlobalObject* globalObject) { return JSValue::encode(globalObject->JSResponseConstructor()); -} + } JSResponse::~JSResponse() { @@ -7478,7 +8112,7 @@ void JSResponse::destroy(JSCell* cell) { static_cast<JSResponse*>(cell)->JSResponse::~JSResponse(); } - + const ClassInfo JSResponse::s_info = { "Response"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSResponse) }; void JSResponse::finishCreation(VM& vm) @@ -7487,38 +8121,37 @@ void JSResponse::finishCreation(VM& vm) ASSERT(inherits(info())); } -JSResponse* JSResponse::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSResponse* ptr = new (NotNull, JSC::allocateCell<JSResponse>(vm)) JSResponse(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} -extern "C" void* Response__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; +JSResponse* JSResponse::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) { + JSResponse* ptr = new (NotNull, JSC::allocateCell<JSResponse>(vm)) JSResponse(vm, structure, ctx); + ptr->finishCreation(vm); + return ptr; +} - JSC::JSCell* cell = decodedValue.asCell(); - JSResponse* object = JSC::jsDynamicCast<JSResponse*>(cell); +extern "C" void* Response__fromJS(JSC::EncodedJSValue value) { + JSC::JSValue decodedValue = JSC::JSValue::decode(value); + if (decodedValue.isEmpty() || !decodedValue.isCell()) + return nullptr; - if (!object) - return nullptr; + JSC::JSCell* cell = decodedValue.asCell(); + JSResponse* object = JSC::jsDynamicCast<JSResponse*>(cell); - return object->wrapped(); + if (!object) + return nullptr; + + return object->wrapped(); } -extern "C" bool Response__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSResponse* object = JSC::jsDynamicCast<JSResponse*>(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; +extern "C" bool Response__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) { + JSResponse* object = JSC::jsDynamicCast<JSResponse*>(JSValue::decode(value)); + if (!object) + return false; + + object->m_ctx = ptr; + return true; } + extern "C" const size_t Response__ptrOffset = JSResponse::offsetOfWrapped(); void JSResponse::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) @@ -7533,7 +8166,7 @@ void JSResponse::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) JSObject* JSResponse::createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype) { - return WebCore::JSResponseConstructor::create(vm, globalObject, WebCore::JSResponseConstructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast<WebCore::JSResponsePrototype*>(prototype)); + return WebCore::JSResponseConstructor::create(vm, globalObject, WebCore::JSResponseConstructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast<WebCore::JSResponsePrototype*>(prototype)); } JSObject* JSResponse::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) @@ -7541,13 +8174,12 @@ JSObject* JSResponse::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) return JSResponsePrototype::create(vm, globalObject, JSResponsePrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); } -extern "C" EncodedJSValue Response__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSResponseStructure(); - JSResponse* instance = JSResponse::create(vm, globalObject, structure, ptr); - vm.heap.reportExtraMemoryAllocated(Response__estimatedSize(ptr)); - return JSValue::encode(instance); +extern "C" EncodedJSValue Response__create(Zig::GlobalObject* globalObject, void* ptr) { + auto &vm = globalObject->vm(); + JSC::Structure* structure = globalObject->JSResponseStructure(); + JSResponse* instance = JSResponse::create(vm, globalObject, structure, ptr); + vm.heap.reportExtraMemoryAllocated(Response__estimatedSize(ptr)); + return JSValue::encode(instance); } template<typename Visitor> @@ -7556,14 +8188,15 @@ void JSResponse::visitChildrenImpl(JSCell* cell, Visitor& visitor) JSResponse* thisObject = jsCast<JSResponse*>(cell); ASSERT_GC_OBJECT_INHERITS(thisObject, info()); Base::visitChildren(thisObject, visitor); - + if (auto* ptr = thisObject->wrapped()) { - visitor.reportExtraMemoryVisited(Response__estimatedSize(ptr)); - } +visitor.reportExtraMemoryVisited(Response__estimatedSize(ptr)); +} visitor.append(thisObject->m_body); visitor.append(thisObject->m_headers); visitor.append(thisObject->m_statusText); visitor.append(thisObject->m_url); + } DEFINE_VISIT_CHILDREN(JSResponse); @@ -7571,10 +8204,10 @@ DEFINE_VISIT_CHILDREN(JSResponse); template<typename Visitor> void JSResponse::visitAdditionalChildren(Visitor& visitor) { - JSResponse* thisObject = this; + JSResponse* thisObject = this; ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - - visitor.append(thisObject->m_body); + + visitor.append(thisObject->m_body); visitor.append(thisObject->m_headers); visitor.append(thisObject->m_statusText); visitor.append(thisObject->m_url); @@ -7584,7 +8217,7 @@ void JSResponse::visitAdditionalChildren(Visitor& visitor) DEFINE_VISIT_ADDITIONAL_CHILDREN(JSResponse); template<typename Visitor> -void JSResponse::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) +void JSResponse::visitOutputConstraintsImpl(JSCell *cell, Visitor& visitor) { JSResponse* thisObject = jsCast<JSResponse*>(cell); ASSERT_GC_OBJECT_INHERITS(thisObject, info()); @@ -7592,97 +8225,107 @@ void JSResponse::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) } DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSResponse); -class JSSHA1Prototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSSHA1Prototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSSHA1Prototype* ptr = new (NotNull, JSC::allocateCell<JSSHA1Prototype>(vm)) JSSHA1Prototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template<typename CellType, JSC::SubspaceAccess> - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSSHA1Prototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; + class JSSHA1Prototype final : public JSC::JSNonFinalObject { + public: + using Base = JSC::JSNonFinalObject; + + static JSSHA1Prototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) + { + JSSHA1Prototype* ptr = new (NotNull, JSC::allocateCell<JSSHA1Prototype>(vm)) JSSHA1Prototype(vm, globalObject, structure); + ptr->finishCreation(vm, globalObject); + return ptr; + } + + DECLARE_INFO; + template<typename CellType, JSC::SubspaceAccess> + static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + return &vm.plainObjectSpace(); + } + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); + } + + private: + JSSHA1Prototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) + : Base(vm, structure) + { + } + + void finishCreation(JSC::VM&, JSC::JSGlobalObject*); + }; class JSSHA1Constructor final : public JSC::InternalFunction { -public: - using Base = JSC::InternalFunction; - static JSSHA1Constructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSSHA1Prototype* prototype); - - static constexpr unsigned StructureFlags = Base::StructureFlags; - static constexpr bool needsDestruction = false; - - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); - } - - template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl<JSSHA1Constructor, WebCore::UseCustomHeapCellType::No>( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForSHA1Constructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForSHA1Constructor = std::forward<decltype(space)>(space); }, - [](auto& spaces) { return spaces.m_subspaceForSHA1Constructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForSHA1Constructor = std::forward<decltype(space)>(space); }); - } - - void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSSHA1Prototype* prototype); + public: + using Base = JSC::InternalFunction; + static JSSHA1Constructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSSHA1Prototype* prototype); + + static constexpr unsigned StructureFlags = Base::StructureFlags; + static constexpr bool needsDestruction = false; + + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); + } + + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return WebCore::subspaceForImpl<JSSHA1Constructor, WebCore::UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForSHA1Constructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForSHA1Constructor = std::forward<decltype(space)>(space); }, + [](auto& spaces) { return spaces.m_subspaceForSHA1Constructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForSHA1Constructor = std::forward<decltype(space)>(space); }); + } + + + void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSSHA1Prototype* prototype); + + // Must be defined for each specialization class. + static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); + + DECLARE_EXPORT_INFO; + private: + JSSHA1Constructor(JSC::VM& vm, JSC::Structure* structure); + void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSSHA1Prototype* prototype); + }; - // Must be defined for each specialization class. - static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); - - DECLARE_EXPORT_INFO; - -private: - JSSHA1Constructor(JSC::VM& vm, JSC::Structure* structure); - void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSSHA1Prototype* prototype); -}; extern "C" void* SHA1Class__construct(JSC::JSGlobalObject*, JSC::CallFrame*); JSC_DECLARE_CUSTOM_GETTER(jsSHA1Constructor); extern "C" void SHA1Class__finalize(void*); + extern "C" JSC::EncodedJSValue SHA1Prototype__getByteLength(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(SHA1Prototype__byteLengthGetterWrap); + extern "C" EncodedJSValue SHA1Prototype__digest(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(SHA1Prototype__digestCallback); + extern "C" EncodedJSValue SHA1Prototype__update(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(SHA1Prototype__updateCallback); + STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSSHA1Prototype, JSSHA1Prototype::Base); -static const HashTableValue JSSHA1PrototypeTableValues[] = { - { "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, SHA1Prototype__byteLengthGetterWrap, 0 } }, - { "digest"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA1Prototype__digestCallback, 0 } }, - { "update"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA1Prototype__updateCallback, 1 } } + + static const HashTableValue JSSHA1PrototypeTableValues[] = { +{ "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, SHA1Prototype__byteLengthGetterWrap, 0 } } , +{ "digest"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA1Prototype__digestCallback, 0 } } , +{ "update"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA1Prototype__updateCallback, 1 } } }; + + const ClassInfo JSSHA1Prototype::s_info = { "SHA1"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA1Prototype) }; + + JSC_DEFINE_CUSTOM_GETTER(jsSHA1Constructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); @@ -7693,12 +8336,14 @@ JSC_DEFINE_CUSTOM_GETTER(jsSHA1Constructor, (JSGlobalObject * lexicalGlobalObjec if (UNLIKELY(!prototype)) return throwVMTypeError(lexicalGlobalObject, throwScope); return JSValue::encode(globalObject->JSSHA1Constructor()); -} +} + + JSC_DEFINE_CUSTOM_GETTER(SHA1Prototype__byteLengthGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSSHA1* thisObject = jsCast<JSSHA1*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -7706,38 +8351,41 @@ JSC_DEFINE_CUSTOM_GETTER(SHA1Prototype__byteLengthGetterWrap, (JSGlobalObject * RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + -JSC_DEFINE_HOST_FUNCTION(SHA1Prototype__digestCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + JSC_DEFINE_HOST_FUNCTION(SHA1Prototype__digestCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - JSSHA1* thisObject = jsDynamicCast<JSSHA1*>(callFrame->thisValue()); + JSSHA1* thisObject = jsDynamicCast<JSSHA1*>(callFrame->thisValue()); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return SHA1Prototype__digest(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + return SHA1Prototype__digest(thisObject->wrapped(), lexicalGlobalObject, callFrame); + } + -JSC_DEFINE_HOST_FUNCTION(SHA1Prototype__updateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + JSC_DEFINE_HOST_FUNCTION(SHA1Prototype__updateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - JSSHA1* thisObject = jsDynamicCast<JSSHA1*>(callFrame->thisValue()); + JSSHA1* thisObject = jsDynamicCast<JSSHA1*>(callFrame->thisValue()); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return SHA1Prototype__update(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + return SHA1Prototype__update(thisObject->wrapped(), lexicalGlobalObject, callFrame); + } + void JSSHA1Prototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) { @@ -7749,11 +8397,12 @@ void JSSHA1Prototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObj extern "C" JSC_DECLARE_CUSTOM_GETTER(SHA1Class__getByteLengthStatic); extern "C" JSC_DECLARE_HOST_FUNCTION(SHA1Class__hash); -static const HashTableValue JSSHA1ConstructorTableValues[] = { - { "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, SHA1Class__getByteLengthStatic, 0 } }, - { "hash"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA1Class__hash, 2 } } + static const HashTableValue JSSHA1ConstructorTableValues[] = { +{ "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, SHA1Class__getByteLengthStatic, 0 } } , +{ "hash"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA1Class__hash, 2 } } }; + void JSSHA1Constructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSSHA1Prototype* prototype) { Base::finishCreation(vm, 0, "SHA1"_s, PropertyAdditionMode::WithoutStructureTransition); @@ -7762,59 +8411,62 @@ void JSSHA1Constructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject ASSERT(inherits(info())); } -JSSHA1Constructor::JSSHA1Constructor(JSC::VM& vm, JSC::Structure* structure) - : Base(vm, structure, construct, construct) -{ -} +JSSHA1Constructor::JSSHA1Constructor(JSC::VM& vm, JSC::Structure* structure) : Base(vm, structure, construct, construct) { -JSSHA1Constructor* JSSHA1Constructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSSHA1Prototype* prototype) -{ + } + +JSSHA1Constructor* JSSHA1Constructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSSHA1Prototype* prototype) { JSSHA1Constructor* ptr = new (NotNull, JSC::allocateCell<JSSHA1Constructor>(vm)) JSSHA1Constructor(vm, structure); ptr->finishCreation(vm, globalObject, prototype); return ptr; } + JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSSHA1Constructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) { - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); - JSC::VM& vm = globalObject->vm(); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + JSC::VM &vm = globalObject->vm(); JSObject* newTarget = asObject(callFrame->newTarget()); auto* constructor = globalObject->JSSHA1Constructor(); Structure* structure = globalObject->JSSHA1Structure(); if (constructor != newTarget) { - auto scope = DECLARE_THROW_SCOPE(vm); + auto scope = DECLARE_THROW_SCOPE(vm); - auto* functionGlobalObject = reinterpret_cast<Zig::GlobalObject*>( - // ShadowRealm functions belong to a different global object. - getFunctionRealm(globalObject, newTarget)); - RETURN_IF_EXCEPTION(scope, {}); - structure = InternalFunction::createSubclassStructure( - globalObject, - newTarget, - functionGlobalObject->JSSHA1Structure()); + auto* functionGlobalObject = reinterpret_cast<Zig::GlobalObject*>( + // ShadowRealm functions belong to a different global object. + getFunctionRealm(globalObject, newTarget) + ); + RETURN_IF_EXCEPTION(scope, {}); + structure = InternalFunction::createSubclassStructure( + globalObject, + newTarget, + functionGlobalObject->JSSHA1Structure() + ); } void* ptr = SHA1Class__construct(globalObject, callFrame); if (UNLIKELY(!ptr)) { - return JSValue::encode(JSC::jsUndefined()); + return JSValue::encode(JSC::jsUndefined()); } JSSHA1* instance = JSSHA1::create(vm, globalObject, structure, ptr); + return JSValue::encode(instance); } void JSSHA1Constructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSSHA1Prototype* prototype) { + } const ClassInfo JSSHA1Constructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA1Constructor) }; -extern "C" EncodedJSValue SHA1__getConstructor(Zig::GlobalObject* globalObject) -{ + + extern "C" EncodedJSValue SHA1__getConstructor(Zig::GlobalObject* globalObject) { return JSValue::encode(globalObject->JSSHA1Constructor()); -} + } JSSHA1::~JSSHA1() { @@ -7826,7 +8478,7 @@ void JSSHA1::destroy(JSCell* cell) { static_cast<JSSHA1*>(cell)->JSSHA1::~JSSHA1(); } - + const ClassInfo JSSHA1::s_info = { "SHA1"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA1) }; void JSSHA1::finishCreation(VM& vm) @@ -7835,38 +8487,37 @@ void JSSHA1::finishCreation(VM& vm) ASSERT(inherits(info())); } -JSSHA1* JSSHA1::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSSHA1* ptr = new (NotNull, JSC::allocateCell<JSSHA1>(vm)) JSSHA1(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} -extern "C" void* SHA1__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; +JSSHA1* JSSHA1::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) { + JSSHA1* ptr = new (NotNull, JSC::allocateCell<JSSHA1>(vm)) JSSHA1(vm, structure, ctx); + ptr->finishCreation(vm); + return ptr; +} - JSC::JSCell* cell = decodedValue.asCell(); - JSSHA1* object = JSC::jsDynamicCast<JSSHA1*>(cell); +extern "C" void* SHA1__fromJS(JSC::EncodedJSValue value) { + JSC::JSValue decodedValue = JSC::JSValue::decode(value); + if (decodedValue.isEmpty() || !decodedValue.isCell()) + return nullptr; - if (!object) - return nullptr; + JSC::JSCell* cell = decodedValue.asCell(); + JSSHA1* object = JSC::jsDynamicCast<JSSHA1*>(cell); - return object->wrapped(); + if (!object) + return nullptr; + + return object->wrapped(); } -extern "C" bool SHA1__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSSHA1* object = JSC::jsDynamicCast<JSSHA1*>(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; +extern "C" bool SHA1__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) { + JSSHA1* object = JSC::jsDynamicCast<JSSHA1*>(JSValue::decode(value)); + if (!object) + return false; + + object->m_ctx = ptr; + return true; } + extern "C" const size_t SHA1__ptrOffset = JSSHA1::offsetOfWrapped(); void JSSHA1::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) @@ -7881,7 +8532,7 @@ void JSSHA1::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) JSObject* JSSHA1::createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype) { - return WebCore::JSSHA1Constructor::create(vm, globalObject, WebCore::JSSHA1Constructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast<WebCore::JSSHA1Prototype*>(prototype)); + return WebCore::JSSHA1Constructor::create(vm, globalObject, WebCore::JSSHA1Constructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast<WebCore::JSSHA1Prototype*>(prototype)); } JSObject* JSSHA1::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) @@ -7889,105 +8540,114 @@ JSObject* JSSHA1::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) return JSSHA1Prototype::create(vm, globalObject, JSSHA1Prototype::createStructure(vm, globalObject, globalObject->objectPrototype())); } -extern "C" EncodedJSValue SHA1__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSSHA1Structure(); - JSSHA1* instance = JSSHA1::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} -class JSSHA224Prototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSSHA224Prototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSSHA224Prototype* ptr = new (NotNull, JSC::allocateCell<JSSHA224Prototype>(vm)) JSSHA224Prototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template<typename CellType, JSC::SubspaceAccess> - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSSHA224Prototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; +extern "C" EncodedJSValue SHA1__create(Zig::GlobalObject* globalObject, void* ptr) { + auto &vm = globalObject->vm(); + JSC::Structure* structure = globalObject->JSSHA1Structure(); + JSSHA1* instance = JSSHA1::create(vm, globalObject, structure, ptr); + + return JSValue::encode(instance); +} + class JSSHA224Prototype final : public JSC::JSNonFinalObject { + public: + using Base = JSC::JSNonFinalObject; + + static JSSHA224Prototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) + { + JSSHA224Prototype* ptr = new (NotNull, JSC::allocateCell<JSSHA224Prototype>(vm)) JSSHA224Prototype(vm, globalObject, structure); + ptr->finishCreation(vm, globalObject); + return ptr; + } + + DECLARE_INFO; + template<typename CellType, JSC::SubspaceAccess> + static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + return &vm.plainObjectSpace(); + } + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); + } + + private: + JSSHA224Prototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) + : Base(vm, structure) + { + } + + void finishCreation(JSC::VM&, JSC::JSGlobalObject*); + }; class JSSHA224Constructor final : public JSC::InternalFunction { -public: - using Base = JSC::InternalFunction; - static JSSHA224Constructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSSHA224Prototype* prototype); - - static constexpr unsigned StructureFlags = Base::StructureFlags; - static constexpr bool needsDestruction = false; + public: + using Base = JSC::InternalFunction; + static JSSHA224Constructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSSHA224Prototype* prototype); + + static constexpr unsigned StructureFlags = Base::StructureFlags; + static constexpr bool needsDestruction = false; + + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); + } + + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return WebCore::subspaceForImpl<JSSHA224Constructor, WebCore::UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForSHA224Constructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForSHA224Constructor = std::forward<decltype(space)>(space); }, + [](auto& spaces) { return spaces.m_subspaceForSHA224Constructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForSHA224Constructor = std::forward<decltype(space)>(space); }); + } + + + void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSSHA224Prototype* prototype); + + // Must be defined for each specialization class. + static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); + + DECLARE_EXPORT_INFO; + private: + JSSHA224Constructor(JSC::VM& vm, JSC::Structure* structure); + void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSSHA224Prototype* prototype); + }; - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); - } - - template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl<JSSHA224Constructor, WebCore::UseCustomHeapCellType::No>( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForSHA224Constructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForSHA224Constructor = std::forward<decltype(space)>(space); }, - [](auto& spaces) { return spaces.m_subspaceForSHA224Constructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForSHA224Constructor = std::forward<decltype(space)>(space); }); - } - - void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSSHA224Prototype* prototype); - - // Must be defined for each specialization class. - static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); - - DECLARE_EXPORT_INFO; - -private: - JSSHA224Constructor(JSC::VM& vm, JSC::Structure* structure); - void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSSHA224Prototype* prototype); -}; extern "C" void* SHA224Class__construct(JSC::JSGlobalObject*, JSC::CallFrame*); JSC_DECLARE_CUSTOM_GETTER(jsSHA224Constructor); extern "C" void SHA224Class__finalize(void*); + extern "C" JSC::EncodedJSValue SHA224Prototype__getByteLength(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(SHA224Prototype__byteLengthGetterWrap); + extern "C" EncodedJSValue SHA224Prototype__digest(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(SHA224Prototype__digestCallback); + extern "C" EncodedJSValue SHA224Prototype__update(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(SHA224Prototype__updateCallback); + STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSSHA224Prototype, JSSHA224Prototype::Base); -static const HashTableValue JSSHA224PrototypeTableValues[] = { - { "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, SHA224Prototype__byteLengthGetterWrap, 0 } }, - { "digest"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA224Prototype__digestCallback, 0 } }, - { "update"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA224Prototype__updateCallback, 1 } } + + static const HashTableValue JSSHA224PrototypeTableValues[] = { +{ "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, SHA224Prototype__byteLengthGetterWrap, 0 } } , +{ "digest"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA224Prototype__digestCallback, 0 } } , +{ "update"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA224Prototype__updateCallback, 1 } } }; + + const ClassInfo JSSHA224Prototype::s_info = { "SHA224"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA224Prototype) }; + + JSC_DEFINE_CUSTOM_GETTER(jsSHA224Constructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); @@ -7998,12 +8658,14 @@ JSC_DEFINE_CUSTOM_GETTER(jsSHA224Constructor, (JSGlobalObject * lexicalGlobalObj if (UNLIKELY(!prototype)) return throwVMTypeError(lexicalGlobalObject, throwScope); return JSValue::encode(globalObject->JSSHA224Constructor()); -} +} + + JSC_DEFINE_CUSTOM_GETTER(SHA224Prototype__byteLengthGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSSHA224* thisObject = jsCast<JSSHA224*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -8011,38 +8673,41 @@ JSC_DEFINE_CUSTOM_GETTER(SHA224Prototype__byteLengthGetterWrap, (JSGlobalObject RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + -JSC_DEFINE_HOST_FUNCTION(SHA224Prototype__digestCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + JSC_DEFINE_HOST_FUNCTION(SHA224Prototype__digestCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - JSSHA224* thisObject = jsDynamicCast<JSSHA224*>(callFrame->thisValue()); + JSSHA224* thisObject = jsDynamicCast<JSSHA224*>(callFrame->thisValue()); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return SHA224Prototype__digest(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + return SHA224Prototype__digest(thisObject->wrapped(), lexicalGlobalObject, callFrame); + } + -JSC_DEFINE_HOST_FUNCTION(SHA224Prototype__updateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + JSC_DEFINE_HOST_FUNCTION(SHA224Prototype__updateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - JSSHA224* thisObject = jsDynamicCast<JSSHA224*>(callFrame->thisValue()); + JSSHA224* thisObject = jsDynamicCast<JSSHA224*>(callFrame->thisValue()); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return SHA224Prototype__update(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + return SHA224Prototype__update(thisObject->wrapped(), lexicalGlobalObject, callFrame); + } + void JSSHA224Prototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) { @@ -8054,11 +8719,12 @@ void JSSHA224Prototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalO extern "C" JSC_DECLARE_CUSTOM_GETTER(SHA224Class__getByteLengthStatic); extern "C" JSC_DECLARE_HOST_FUNCTION(SHA224Class__hash); -static const HashTableValue JSSHA224ConstructorTableValues[] = { - { "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, SHA224Class__getByteLengthStatic, 0 } }, - { "hash"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA224Class__hash, 2 } } + static const HashTableValue JSSHA224ConstructorTableValues[] = { +{ "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, SHA224Class__getByteLengthStatic, 0 } } , +{ "hash"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA224Class__hash, 2 } } }; + void JSSHA224Constructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSSHA224Prototype* prototype) { Base::finishCreation(vm, 0, "SHA224"_s, PropertyAdditionMode::WithoutStructureTransition); @@ -8067,59 +8733,62 @@ void JSSHA224Constructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObje ASSERT(inherits(info())); } -JSSHA224Constructor::JSSHA224Constructor(JSC::VM& vm, JSC::Structure* structure) - : Base(vm, structure, construct, construct) -{ -} +JSSHA224Constructor::JSSHA224Constructor(JSC::VM& vm, JSC::Structure* structure) : Base(vm, structure, construct, construct) { -JSSHA224Constructor* JSSHA224Constructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSSHA224Prototype* prototype) -{ + } + +JSSHA224Constructor* JSSHA224Constructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSSHA224Prototype* prototype) { JSSHA224Constructor* ptr = new (NotNull, JSC::allocateCell<JSSHA224Constructor>(vm)) JSSHA224Constructor(vm, structure); ptr->finishCreation(vm, globalObject, prototype); return ptr; } + JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSSHA224Constructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) { - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); - JSC::VM& vm = globalObject->vm(); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + JSC::VM &vm = globalObject->vm(); JSObject* newTarget = asObject(callFrame->newTarget()); auto* constructor = globalObject->JSSHA224Constructor(); Structure* structure = globalObject->JSSHA224Structure(); if (constructor != newTarget) { - auto scope = DECLARE_THROW_SCOPE(vm); + auto scope = DECLARE_THROW_SCOPE(vm); - auto* functionGlobalObject = reinterpret_cast<Zig::GlobalObject*>( - // ShadowRealm functions belong to a different global object. - getFunctionRealm(globalObject, newTarget)); - RETURN_IF_EXCEPTION(scope, {}); - structure = InternalFunction::createSubclassStructure( - globalObject, - newTarget, - functionGlobalObject->JSSHA224Structure()); + auto* functionGlobalObject = reinterpret_cast<Zig::GlobalObject*>( + // ShadowRealm functions belong to a different global object. + getFunctionRealm(globalObject, newTarget) + ); + RETURN_IF_EXCEPTION(scope, {}); + structure = InternalFunction::createSubclassStructure( + globalObject, + newTarget, + functionGlobalObject->JSSHA224Structure() + ); } void* ptr = SHA224Class__construct(globalObject, callFrame); if (UNLIKELY(!ptr)) { - return JSValue::encode(JSC::jsUndefined()); + return JSValue::encode(JSC::jsUndefined()); } JSSHA224* instance = JSSHA224::create(vm, globalObject, structure, ptr); + return JSValue::encode(instance); } void JSSHA224Constructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSSHA224Prototype* prototype) { + } const ClassInfo JSSHA224Constructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA224Constructor) }; -extern "C" EncodedJSValue SHA224__getConstructor(Zig::GlobalObject* globalObject) -{ + + extern "C" EncodedJSValue SHA224__getConstructor(Zig::GlobalObject* globalObject) { return JSValue::encode(globalObject->JSSHA224Constructor()); -} + } JSSHA224::~JSSHA224() { @@ -8131,7 +8800,7 @@ void JSSHA224::destroy(JSCell* cell) { static_cast<JSSHA224*>(cell)->JSSHA224::~JSSHA224(); } - + const ClassInfo JSSHA224::s_info = { "SHA224"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA224) }; void JSSHA224::finishCreation(VM& vm) @@ -8140,38 +8809,37 @@ void JSSHA224::finishCreation(VM& vm) ASSERT(inherits(info())); } -JSSHA224* JSSHA224::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSSHA224* ptr = new (NotNull, JSC::allocateCell<JSSHA224>(vm)) JSSHA224(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} -extern "C" void* SHA224__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; +JSSHA224* JSSHA224::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) { + JSSHA224* ptr = new (NotNull, JSC::allocateCell<JSSHA224>(vm)) JSSHA224(vm, structure, ctx); + ptr->finishCreation(vm); + return ptr; +} - JSC::JSCell* cell = decodedValue.asCell(); - JSSHA224* object = JSC::jsDynamicCast<JSSHA224*>(cell); +extern "C" void* SHA224__fromJS(JSC::EncodedJSValue value) { + JSC::JSValue decodedValue = JSC::JSValue::decode(value); + if (decodedValue.isEmpty() || !decodedValue.isCell()) + return nullptr; - if (!object) - return nullptr; + JSC::JSCell* cell = decodedValue.asCell(); + JSSHA224* object = JSC::jsDynamicCast<JSSHA224*>(cell); - return object->wrapped(); + if (!object) + return nullptr; + + return object->wrapped(); } -extern "C" bool SHA224__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSSHA224* object = JSC::jsDynamicCast<JSSHA224*>(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; +extern "C" bool SHA224__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) { + JSSHA224* object = JSC::jsDynamicCast<JSSHA224*>(JSValue::decode(value)); + if (!object) + return false; + + object->m_ctx = ptr; + return true; } + extern "C" const size_t SHA224__ptrOffset = JSSHA224::offsetOfWrapped(); void JSSHA224::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) @@ -8186,7 +8854,7 @@ void JSSHA224::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) JSObject* JSSHA224::createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype) { - return WebCore::JSSHA224Constructor::create(vm, globalObject, WebCore::JSSHA224Constructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast<WebCore::JSSHA224Prototype*>(prototype)); + return WebCore::JSSHA224Constructor::create(vm, globalObject, WebCore::JSSHA224Constructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast<WebCore::JSSHA224Prototype*>(prototype)); } JSObject* JSSHA224::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) @@ -8194,105 +8862,114 @@ JSObject* JSSHA224::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) return JSSHA224Prototype::create(vm, globalObject, JSSHA224Prototype::createStructure(vm, globalObject, globalObject->objectPrototype())); } -extern "C" EncodedJSValue SHA224__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSSHA224Structure(); - JSSHA224* instance = JSSHA224::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} -class JSSHA256Prototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSSHA256Prototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSSHA256Prototype* ptr = new (NotNull, JSC::allocateCell<JSSHA256Prototype>(vm)) JSSHA256Prototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template<typename CellType, JSC::SubspaceAccess> - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSSHA256Prototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; +extern "C" EncodedJSValue SHA224__create(Zig::GlobalObject* globalObject, void* ptr) { + auto &vm = globalObject->vm(); + JSC::Structure* structure = globalObject->JSSHA224Structure(); + JSSHA224* instance = JSSHA224::create(vm, globalObject, structure, ptr); + + return JSValue::encode(instance); +} + class JSSHA256Prototype final : public JSC::JSNonFinalObject { + public: + using Base = JSC::JSNonFinalObject; + + static JSSHA256Prototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) + { + JSSHA256Prototype* ptr = new (NotNull, JSC::allocateCell<JSSHA256Prototype>(vm)) JSSHA256Prototype(vm, globalObject, structure); + ptr->finishCreation(vm, globalObject); + return ptr; + } + + DECLARE_INFO; + template<typename CellType, JSC::SubspaceAccess> + static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + return &vm.plainObjectSpace(); + } + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); + } + + private: + JSSHA256Prototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) + : Base(vm, structure) + { + } + + void finishCreation(JSC::VM&, JSC::JSGlobalObject*); + }; class JSSHA256Constructor final : public JSC::InternalFunction { -public: - using Base = JSC::InternalFunction; - static JSSHA256Constructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSSHA256Prototype* prototype); - - static constexpr unsigned StructureFlags = Base::StructureFlags; - static constexpr bool needsDestruction = false; - - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); - } - - template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl<JSSHA256Constructor, WebCore::UseCustomHeapCellType::No>( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForSHA256Constructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForSHA256Constructor = std::forward<decltype(space)>(space); }, - [](auto& spaces) { return spaces.m_subspaceForSHA256Constructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForSHA256Constructor = std::forward<decltype(space)>(space); }); - } - - void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSSHA256Prototype* prototype); + public: + using Base = JSC::InternalFunction; + static JSSHA256Constructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSSHA256Prototype* prototype); + + static constexpr unsigned StructureFlags = Base::StructureFlags; + static constexpr bool needsDestruction = false; + + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); + } + + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return WebCore::subspaceForImpl<JSSHA256Constructor, WebCore::UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForSHA256Constructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForSHA256Constructor = std::forward<decltype(space)>(space); }, + [](auto& spaces) { return spaces.m_subspaceForSHA256Constructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForSHA256Constructor = std::forward<decltype(space)>(space); }); + } + + + void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSSHA256Prototype* prototype); + + // Must be defined for each specialization class. + static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); + + DECLARE_EXPORT_INFO; + private: + JSSHA256Constructor(JSC::VM& vm, JSC::Structure* structure); + void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSSHA256Prototype* prototype); + }; - // Must be defined for each specialization class. - static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); - - DECLARE_EXPORT_INFO; - -private: - JSSHA256Constructor(JSC::VM& vm, JSC::Structure* structure); - void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSSHA256Prototype* prototype); -}; extern "C" void* SHA256Class__construct(JSC::JSGlobalObject*, JSC::CallFrame*); JSC_DECLARE_CUSTOM_GETTER(jsSHA256Constructor); extern "C" void SHA256Class__finalize(void*); + extern "C" JSC::EncodedJSValue SHA256Prototype__getByteLength(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(SHA256Prototype__byteLengthGetterWrap); + extern "C" EncodedJSValue SHA256Prototype__digest(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(SHA256Prototype__digestCallback); + extern "C" EncodedJSValue SHA256Prototype__update(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(SHA256Prototype__updateCallback); + STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSSHA256Prototype, JSSHA256Prototype::Base); -static const HashTableValue JSSHA256PrototypeTableValues[] = { - { "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, SHA256Prototype__byteLengthGetterWrap, 0 } }, - { "digest"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA256Prototype__digestCallback, 0 } }, - { "update"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA256Prototype__updateCallback, 1 } } + + static const HashTableValue JSSHA256PrototypeTableValues[] = { +{ "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, SHA256Prototype__byteLengthGetterWrap, 0 } } , +{ "digest"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA256Prototype__digestCallback, 0 } } , +{ "update"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA256Prototype__updateCallback, 1 } } }; + + const ClassInfo JSSHA256Prototype::s_info = { "SHA256"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA256Prototype) }; + + JSC_DEFINE_CUSTOM_GETTER(jsSHA256Constructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); @@ -8303,12 +8980,14 @@ JSC_DEFINE_CUSTOM_GETTER(jsSHA256Constructor, (JSGlobalObject * lexicalGlobalObj if (UNLIKELY(!prototype)) return throwVMTypeError(lexicalGlobalObject, throwScope); return JSValue::encode(globalObject->JSSHA256Constructor()); -} +} + + JSC_DEFINE_CUSTOM_GETTER(SHA256Prototype__byteLengthGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSSHA256* thisObject = jsCast<JSSHA256*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -8316,38 +8995,41 @@ JSC_DEFINE_CUSTOM_GETTER(SHA256Prototype__byteLengthGetterWrap, (JSGlobalObject RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + -JSC_DEFINE_HOST_FUNCTION(SHA256Prototype__digestCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + JSC_DEFINE_HOST_FUNCTION(SHA256Prototype__digestCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - JSSHA256* thisObject = jsDynamicCast<JSSHA256*>(callFrame->thisValue()); + JSSHA256* thisObject = jsDynamicCast<JSSHA256*>(callFrame->thisValue()); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return SHA256Prototype__digest(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + return SHA256Prototype__digest(thisObject->wrapped(), lexicalGlobalObject, callFrame); + } + -JSC_DEFINE_HOST_FUNCTION(SHA256Prototype__updateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + JSC_DEFINE_HOST_FUNCTION(SHA256Prototype__updateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - JSSHA256* thisObject = jsDynamicCast<JSSHA256*>(callFrame->thisValue()); + JSSHA256* thisObject = jsDynamicCast<JSSHA256*>(callFrame->thisValue()); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return SHA256Prototype__update(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + return SHA256Prototype__update(thisObject->wrapped(), lexicalGlobalObject, callFrame); + } + void JSSHA256Prototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) { @@ -8359,11 +9041,12 @@ void JSSHA256Prototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalO extern "C" JSC_DECLARE_CUSTOM_GETTER(SHA256Class__getByteLengthStatic); extern "C" JSC_DECLARE_HOST_FUNCTION(SHA256Class__hash); -static const HashTableValue JSSHA256ConstructorTableValues[] = { - { "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, SHA256Class__getByteLengthStatic, 0 } }, - { "hash"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA256Class__hash, 2 } } + static const HashTableValue JSSHA256ConstructorTableValues[] = { +{ "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, SHA256Class__getByteLengthStatic, 0 } } , +{ "hash"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA256Class__hash, 2 } } }; + void JSSHA256Constructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSSHA256Prototype* prototype) { Base::finishCreation(vm, 0, "SHA256"_s, PropertyAdditionMode::WithoutStructureTransition); @@ -8372,59 +9055,62 @@ void JSSHA256Constructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObje ASSERT(inherits(info())); } -JSSHA256Constructor::JSSHA256Constructor(JSC::VM& vm, JSC::Structure* structure) - : Base(vm, structure, construct, construct) -{ -} +JSSHA256Constructor::JSSHA256Constructor(JSC::VM& vm, JSC::Structure* structure) : Base(vm, structure, construct, construct) { -JSSHA256Constructor* JSSHA256Constructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSSHA256Prototype* prototype) -{ + } + +JSSHA256Constructor* JSSHA256Constructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSSHA256Prototype* prototype) { JSSHA256Constructor* ptr = new (NotNull, JSC::allocateCell<JSSHA256Constructor>(vm)) JSSHA256Constructor(vm, structure); ptr->finishCreation(vm, globalObject, prototype); return ptr; } + JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSSHA256Constructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) { - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); - JSC::VM& vm = globalObject->vm(); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + JSC::VM &vm = globalObject->vm(); JSObject* newTarget = asObject(callFrame->newTarget()); auto* constructor = globalObject->JSSHA256Constructor(); Structure* structure = globalObject->JSSHA256Structure(); if (constructor != newTarget) { - auto scope = DECLARE_THROW_SCOPE(vm); + auto scope = DECLARE_THROW_SCOPE(vm); - auto* functionGlobalObject = reinterpret_cast<Zig::GlobalObject*>( - // ShadowRealm functions belong to a different global object. - getFunctionRealm(globalObject, newTarget)); - RETURN_IF_EXCEPTION(scope, {}); - structure = InternalFunction::createSubclassStructure( - globalObject, - newTarget, - functionGlobalObject->JSSHA256Structure()); + auto* functionGlobalObject = reinterpret_cast<Zig::GlobalObject*>( + // ShadowRealm functions belong to a different global object. + getFunctionRealm(globalObject, newTarget) + ); + RETURN_IF_EXCEPTION(scope, {}); + structure = InternalFunction::createSubclassStructure( + globalObject, + newTarget, + functionGlobalObject->JSSHA256Structure() + ); } void* ptr = SHA256Class__construct(globalObject, callFrame); if (UNLIKELY(!ptr)) { - return JSValue::encode(JSC::jsUndefined()); + return JSValue::encode(JSC::jsUndefined()); } JSSHA256* instance = JSSHA256::create(vm, globalObject, structure, ptr); + return JSValue::encode(instance); } void JSSHA256Constructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSSHA256Prototype* prototype) { + } const ClassInfo JSSHA256Constructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA256Constructor) }; -extern "C" EncodedJSValue SHA256__getConstructor(Zig::GlobalObject* globalObject) -{ + + extern "C" EncodedJSValue SHA256__getConstructor(Zig::GlobalObject* globalObject) { return JSValue::encode(globalObject->JSSHA256Constructor()); -} + } JSSHA256::~JSSHA256() { @@ -8436,7 +9122,7 @@ void JSSHA256::destroy(JSCell* cell) { static_cast<JSSHA256*>(cell)->JSSHA256::~JSSHA256(); } - + const ClassInfo JSSHA256::s_info = { "SHA256"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA256) }; void JSSHA256::finishCreation(VM& vm) @@ -8445,38 +9131,37 @@ void JSSHA256::finishCreation(VM& vm) ASSERT(inherits(info())); } -JSSHA256* JSSHA256::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSSHA256* ptr = new (NotNull, JSC::allocateCell<JSSHA256>(vm)) JSSHA256(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} -extern "C" void* SHA256__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; +JSSHA256* JSSHA256::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) { + JSSHA256* ptr = new (NotNull, JSC::allocateCell<JSSHA256>(vm)) JSSHA256(vm, structure, ctx); + ptr->finishCreation(vm); + return ptr; +} - JSC::JSCell* cell = decodedValue.asCell(); - JSSHA256* object = JSC::jsDynamicCast<JSSHA256*>(cell); +extern "C" void* SHA256__fromJS(JSC::EncodedJSValue value) { + JSC::JSValue decodedValue = JSC::JSValue::decode(value); + if (decodedValue.isEmpty() || !decodedValue.isCell()) + return nullptr; - if (!object) - return nullptr; + JSC::JSCell* cell = decodedValue.asCell(); + JSSHA256* object = JSC::jsDynamicCast<JSSHA256*>(cell); - return object->wrapped(); + if (!object) + return nullptr; + + return object->wrapped(); } -extern "C" bool SHA256__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSSHA256* object = JSC::jsDynamicCast<JSSHA256*>(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; +extern "C" bool SHA256__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) { + JSSHA256* object = JSC::jsDynamicCast<JSSHA256*>(JSValue::decode(value)); + if (!object) + return false; + + object->m_ctx = ptr; + return true; } + extern "C" const size_t SHA256__ptrOffset = JSSHA256::offsetOfWrapped(); void JSSHA256::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) @@ -8491,7 +9176,7 @@ void JSSHA256::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) JSObject* JSSHA256::createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype) { - return WebCore::JSSHA256Constructor::create(vm, globalObject, WebCore::JSSHA256Constructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast<WebCore::JSSHA256Prototype*>(prototype)); + return WebCore::JSSHA256Constructor::create(vm, globalObject, WebCore::JSSHA256Constructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast<WebCore::JSSHA256Prototype*>(prototype)); } JSObject* JSSHA256::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) @@ -8499,105 +9184,114 @@ JSObject* JSSHA256::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) return JSSHA256Prototype::create(vm, globalObject, JSSHA256Prototype::createStructure(vm, globalObject, globalObject->objectPrototype())); } -extern "C" EncodedJSValue SHA256__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSSHA256Structure(); - JSSHA256* instance = JSSHA256::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} -class JSSHA384Prototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSSHA384Prototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSSHA384Prototype* ptr = new (NotNull, JSC::allocateCell<JSSHA384Prototype>(vm)) JSSHA384Prototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template<typename CellType, JSC::SubspaceAccess> - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSSHA384Prototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; +extern "C" EncodedJSValue SHA256__create(Zig::GlobalObject* globalObject, void* ptr) { + auto &vm = globalObject->vm(); + JSC::Structure* structure = globalObject->JSSHA256Structure(); + JSSHA256* instance = JSSHA256::create(vm, globalObject, structure, ptr); + + return JSValue::encode(instance); +} + class JSSHA384Prototype final : public JSC::JSNonFinalObject { + public: + using Base = JSC::JSNonFinalObject; + + static JSSHA384Prototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) + { + JSSHA384Prototype* ptr = new (NotNull, JSC::allocateCell<JSSHA384Prototype>(vm)) JSSHA384Prototype(vm, globalObject, structure); + ptr->finishCreation(vm, globalObject); + return ptr; + } + + DECLARE_INFO; + template<typename CellType, JSC::SubspaceAccess> + static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + return &vm.plainObjectSpace(); + } + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); + } + + private: + JSSHA384Prototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) + : Base(vm, structure) + { + } + + void finishCreation(JSC::VM&, JSC::JSGlobalObject*); + }; class JSSHA384Constructor final : public JSC::InternalFunction { -public: - using Base = JSC::InternalFunction; - static JSSHA384Constructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSSHA384Prototype* prototype); - - static constexpr unsigned StructureFlags = Base::StructureFlags; - static constexpr bool needsDestruction = false; - - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); - } - - template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl<JSSHA384Constructor, WebCore::UseCustomHeapCellType::No>( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForSHA384Constructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForSHA384Constructor = std::forward<decltype(space)>(space); }, - [](auto& spaces) { return spaces.m_subspaceForSHA384Constructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForSHA384Constructor = std::forward<decltype(space)>(space); }); - } + public: + using Base = JSC::InternalFunction; + static JSSHA384Constructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSSHA384Prototype* prototype); + + static constexpr unsigned StructureFlags = Base::StructureFlags; + static constexpr bool needsDestruction = false; + + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); + } + + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return WebCore::subspaceForImpl<JSSHA384Constructor, WebCore::UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForSHA384Constructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForSHA384Constructor = std::forward<decltype(space)>(space); }, + [](auto& spaces) { return spaces.m_subspaceForSHA384Constructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForSHA384Constructor = std::forward<decltype(space)>(space); }); + } + + + void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSSHA384Prototype* prototype); + + // Must be defined for each specialization class. + static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); + + DECLARE_EXPORT_INFO; + private: + JSSHA384Constructor(JSC::VM& vm, JSC::Structure* structure); + void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSSHA384Prototype* prototype); + }; - void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSSHA384Prototype* prototype); - - // Must be defined for each specialization class. - static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); - - DECLARE_EXPORT_INFO; - -private: - JSSHA384Constructor(JSC::VM& vm, JSC::Structure* structure); - void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSSHA384Prototype* prototype); -}; extern "C" void* SHA384Class__construct(JSC::JSGlobalObject*, JSC::CallFrame*); JSC_DECLARE_CUSTOM_GETTER(jsSHA384Constructor); extern "C" void SHA384Class__finalize(void*); + extern "C" JSC::EncodedJSValue SHA384Prototype__getByteLength(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(SHA384Prototype__byteLengthGetterWrap); + extern "C" EncodedJSValue SHA384Prototype__digest(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(SHA384Prototype__digestCallback); + extern "C" EncodedJSValue SHA384Prototype__update(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(SHA384Prototype__updateCallback); + STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSSHA384Prototype, JSSHA384Prototype::Base); -static const HashTableValue JSSHA384PrototypeTableValues[] = { - { "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, SHA384Prototype__byteLengthGetterWrap, 0 } }, - { "digest"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA384Prototype__digestCallback, 0 } }, - { "update"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA384Prototype__updateCallback, 1 } } + + static const HashTableValue JSSHA384PrototypeTableValues[] = { +{ "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, SHA384Prototype__byteLengthGetterWrap, 0 } } , +{ "digest"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA384Prototype__digestCallback, 0 } } , +{ "update"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA384Prototype__updateCallback, 1 } } }; + + const ClassInfo JSSHA384Prototype::s_info = { "SHA384"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA384Prototype) }; + + JSC_DEFINE_CUSTOM_GETTER(jsSHA384Constructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); @@ -8608,12 +9302,14 @@ JSC_DEFINE_CUSTOM_GETTER(jsSHA384Constructor, (JSGlobalObject * lexicalGlobalObj if (UNLIKELY(!prototype)) return throwVMTypeError(lexicalGlobalObject, throwScope); return JSValue::encode(globalObject->JSSHA384Constructor()); -} +} + + JSC_DEFINE_CUSTOM_GETTER(SHA384Prototype__byteLengthGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSSHA384* thisObject = jsCast<JSSHA384*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -8621,38 +9317,41 @@ JSC_DEFINE_CUSTOM_GETTER(SHA384Prototype__byteLengthGetterWrap, (JSGlobalObject RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + -JSC_DEFINE_HOST_FUNCTION(SHA384Prototype__digestCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + JSC_DEFINE_HOST_FUNCTION(SHA384Prototype__digestCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - JSSHA384* thisObject = jsDynamicCast<JSSHA384*>(callFrame->thisValue()); + JSSHA384* thisObject = jsDynamicCast<JSSHA384*>(callFrame->thisValue()); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return SHA384Prototype__digest(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + return SHA384Prototype__digest(thisObject->wrapped(), lexicalGlobalObject, callFrame); + } + -JSC_DEFINE_HOST_FUNCTION(SHA384Prototype__updateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + JSC_DEFINE_HOST_FUNCTION(SHA384Prototype__updateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - JSSHA384* thisObject = jsDynamicCast<JSSHA384*>(callFrame->thisValue()); + JSSHA384* thisObject = jsDynamicCast<JSSHA384*>(callFrame->thisValue()); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return SHA384Prototype__update(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + return SHA384Prototype__update(thisObject->wrapped(), lexicalGlobalObject, callFrame); + } + void JSSHA384Prototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) { @@ -8664,11 +9363,12 @@ void JSSHA384Prototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalO extern "C" JSC_DECLARE_CUSTOM_GETTER(SHA384Class__getByteLengthStatic); extern "C" JSC_DECLARE_HOST_FUNCTION(SHA384Class__hash); -static const HashTableValue JSSHA384ConstructorTableValues[] = { - { "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, SHA384Class__getByteLengthStatic, 0 } }, - { "hash"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA384Class__hash, 2 } } + static const HashTableValue JSSHA384ConstructorTableValues[] = { +{ "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, SHA384Class__getByteLengthStatic, 0 } } , +{ "hash"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA384Class__hash, 2 } } }; + void JSSHA384Constructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSSHA384Prototype* prototype) { Base::finishCreation(vm, 0, "SHA384"_s, PropertyAdditionMode::WithoutStructureTransition); @@ -8677,59 +9377,62 @@ void JSSHA384Constructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObje ASSERT(inherits(info())); } -JSSHA384Constructor::JSSHA384Constructor(JSC::VM& vm, JSC::Structure* structure) - : Base(vm, structure, construct, construct) -{ -} +JSSHA384Constructor::JSSHA384Constructor(JSC::VM& vm, JSC::Structure* structure) : Base(vm, structure, construct, construct) { -JSSHA384Constructor* JSSHA384Constructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSSHA384Prototype* prototype) -{ + } + +JSSHA384Constructor* JSSHA384Constructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSSHA384Prototype* prototype) { JSSHA384Constructor* ptr = new (NotNull, JSC::allocateCell<JSSHA384Constructor>(vm)) JSSHA384Constructor(vm, structure); ptr->finishCreation(vm, globalObject, prototype); return ptr; } + JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSSHA384Constructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) { - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); - JSC::VM& vm = globalObject->vm(); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + JSC::VM &vm = globalObject->vm(); JSObject* newTarget = asObject(callFrame->newTarget()); auto* constructor = globalObject->JSSHA384Constructor(); Structure* structure = globalObject->JSSHA384Structure(); if (constructor != newTarget) { - auto scope = DECLARE_THROW_SCOPE(vm); + auto scope = DECLARE_THROW_SCOPE(vm); - auto* functionGlobalObject = reinterpret_cast<Zig::GlobalObject*>( - // ShadowRealm functions belong to a different global object. - getFunctionRealm(globalObject, newTarget)); - RETURN_IF_EXCEPTION(scope, {}); - structure = InternalFunction::createSubclassStructure( - globalObject, - newTarget, - functionGlobalObject->JSSHA384Structure()); + auto* functionGlobalObject = reinterpret_cast<Zig::GlobalObject*>( + // ShadowRealm functions belong to a different global object. + getFunctionRealm(globalObject, newTarget) + ); + RETURN_IF_EXCEPTION(scope, {}); + structure = InternalFunction::createSubclassStructure( + globalObject, + newTarget, + functionGlobalObject->JSSHA384Structure() + ); } void* ptr = SHA384Class__construct(globalObject, callFrame); if (UNLIKELY(!ptr)) { - return JSValue::encode(JSC::jsUndefined()); + return JSValue::encode(JSC::jsUndefined()); } JSSHA384* instance = JSSHA384::create(vm, globalObject, structure, ptr); + return JSValue::encode(instance); } void JSSHA384Constructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSSHA384Prototype* prototype) { + } const ClassInfo JSSHA384Constructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA384Constructor) }; -extern "C" EncodedJSValue SHA384__getConstructor(Zig::GlobalObject* globalObject) -{ + + extern "C" EncodedJSValue SHA384__getConstructor(Zig::GlobalObject* globalObject) { return JSValue::encode(globalObject->JSSHA384Constructor()); -} + } JSSHA384::~JSSHA384() { @@ -8741,7 +9444,7 @@ void JSSHA384::destroy(JSCell* cell) { static_cast<JSSHA384*>(cell)->JSSHA384::~JSSHA384(); } - + const ClassInfo JSSHA384::s_info = { "SHA384"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA384) }; void JSSHA384::finishCreation(VM& vm) @@ -8750,38 +9453,37 @@ void JSSHA384::finishCreation(VM& vm) ASSERT(inherits(info())); } -JSSHA384* JSSHA384::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSSHA384* ptr = new (NotNull, JSC::allocateCell<JSSHA384>(vm)) JSSHA384(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} -extern "C" void* SHA384__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; +JSSHA384* JSSHA384::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) { + JSSHA384* ptr = new (NotNull, JSC::allocateCell<JSSHA384>(vm)) JSSHA384(vm, structure, ctx); + ptr->finishCreation(vm); + return ptr; +} - JSC::JSCell* cell = decodedValue.asCell(); - JSSHA384* object = JSC::jsDynamicCast<JSSHA384*>(cell); +extern "C" void* SHA384__fromJS(JSC::EncodedJSValue value) { + JSC::JSValue decodedValue = JSC::JSValue::decode(value); + if (decodedValue.isEmpty() || !decodedValue.isCell()) + return nullptr; - if (!object) - return nullptr; + JSC::JSCell* cell = decodedValue.asCell(); + JSSHA384* object = JSC::jsDynamicCast<JSSHA384*>(cell); - return object->wrapped(); + if (!object) + return nullptr; + + return object->wrapped(); } -extern "C" bool SHA384__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSSHA384* object = JSC::jsDynamicCast<JSSHA384*>(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; +extern "C" bool SHA384__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) { + JSSHA384* object = JSC::jsDynamicCast<JSSHA384*>(JSValue::decode(value)); + if (!object) + return false; + + object->m_ctx = ptr; + return true; } + extern "C" const size_t SHA384__ptrOffset = JSSHA384::offsetOfWrapped(); void JSSHA384::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) @@ -8796,7 +9498,7 @@ void JSSHA384::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) JSObject* JSSHA384::createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype) { - return WebCore::JSSHA384Constructor::create(vm, globalObject, WebCore::JSSHA384Constructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast<WebCore::JSSHA384Prototype*>(prototype)); + return WebCore::JSSHA384Constructor::create(vm, globalObject, WebCore::JSSHA384Constructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast<WebCore::JSSHA384Prototype*>(prototype)); } JSObject* JSSHA384::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) @@ -8804,105 +9506,114 @@ JSObject* JSSHA384::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) return JSSHA384Prototype::create(vm, globalObject, JSSHA384Prototype::createStructure(vm, globalObject, globalObject->objectPrototype())); } -extern "C" EncodedJSValue SHA384__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSSHA384Structure(); - JSSHA384* instance = JSSHA384::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} -class JSSHA512Prototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSSHA512Prototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSSHA512Prototype* ptr = new (NotNull, JSC::allocateCell<JSSHA512Prototype>(vm)) JSSHA512Prototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template<typename CellType, JSC::SubspaceAccess> - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSSHA512Prototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; +extern "C" EncodedJSValue SHA384__create(Zig::GlobalObject* globalObject, void* ptr) { + auto &vm = globalObject->vm(); + JSC::Structure* structure = globalObject->JSSHA384Structure(); + JSSHA384* instance = JSSHA384::create(vm, globalObject, structure, ptr); + + return JSValue::encode(instance); +} + class JSSHA512Prototype final : public JSC::JSNonFinalObject { + public: + using Base = JSC::JSNonFinalObject; + + static JSSHA512Prototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) + { + JSSHA512Prototype* ptr = new (NotNull, JSC::allocateCell<JSSHA512Prototype>(vm)) JSSHA512Prototype(vm, globalObject, structure); + ptr->finishCreation(vm, globalObject); + return ptr; + } + + DECLARE_INFO; + template<typename CellType, JSC::SubspaceAccess> + static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + return &vm.plainObjectSpace(); + } + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); + } + + private: + JSSHA512Prototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) + : Base(vm, structure) + { + } + + void finishCreation(JSC::VM&, JSC::JSGlobalObject*); + }; class JSSHA512Constructor final : public JSC::InternalFunction { -public: - using Base = JSC::InternalFunction; - static JSSHA512Constructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSSHA512Prototype* prototype); + public: + using Base = JSC::InternalFunction; + static JSSHA512Constructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSSHA512Prototype* prototype); + + static constexpr unsigned StructureFlags = Base::StructureFlags; + static constexpr bool needsDestruction = false; + + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); + } + + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return WebCore::subspaceForImpl<JSSHA512Constructor, WebCore::UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForSHA512Constructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForSHA512Constructor = std::forward<decltype(space)>(space); }, + [](auto& spaces) { return spaces.m_subspaceForSHA512Constructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForSHA512Constructor = std::forward<decltype(space)>(space); }); + } + + + void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSSHA512Prototype* prototype); + + // Must be defined for each specialization class. + static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); + + DECLARE_EXPORT_INFO; + private: + JSSHA512Constructor(JSC::VM& vm, JSC::Structure* structure); + void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSSHA512Prototype* prototype); + }; - static constexpr unsigned StructureFlags = Base::StructureFlags; - static constexpr bool needsDestruction = false; - - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); - } - - template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl<JSSHA512Constructor, WebCore::UseCustomHeapCellType::No>( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForSHA512Constructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForSHA512Constructor = std::forward<decltype(space)>(space); }, - [](auto& spaces) { return spaces.m_subspaceForSHA512Constructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForSHA512Constructor = std::forward<decltype(space)>(space); }); - } - - void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSSHA512Prototype* prototype); - - // Must be defined for each specialization class. - static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); - - DECLARE_EXPORT_INFO; - -private: - JSSHA512Constructor(JSC::VM& vm, JSC::Structure* structure); - void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSSHA512Prototype* prototype); -}; extern "C" void* SHA512Class__construct(JSC::JSGlobalObject*, JSC::CallFrame*); JSC_DECLARE_CUSTOM_GETTER(jsSHA512Constructor); extern "C" void SHA512Class__finalize(void*); + extern "C" JSC::EncodedJSValue SHA512Prototype__getByteLength(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(SHA512Prototype__byteLengthGetterWrap); + extern "C" EncodedJSValue SHA512Prototype__digest(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(SHA512Prototype__digestCallback); + extern "C" EncodedJSValue SHA512Prototype__update(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(SHA512Prototype__updateCallback); + STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSSHA512Prototype, JSSHA512Prototype::Base); -static const HashTableValue JSSHA512PrototypeTableValues[] = { - { "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, SHA512Prototype__byteLengthGetterWrap, 0 } }, - { "digest"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA512Prototype__digestCallback, 0 } }, - { "update"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA512Prototype__updateCallback, 1 } } + + static const HashTableValue JSSHA512PrototypeTableValues[] = { +{ "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, SHA512Prototype__byteLengthGetterWrap, 0 } } , +{ "digest"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA512Prototype__digestCallback, 0 } } , +{ "update"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA512Prototype__updateCallback, 1 } } }; + + const ClassInfo JSSHA512Prototype::s_info = { "SHA512"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA512Prototype) }; + + JSC_DEFINE_CUSTOM_GETTER(jsSHA512Constructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); @@ -8913,12 +9624,14 @@ JSC_DEFINE_CUSTOM_GETTER(jsSHA512Constructor, (JSGlobalObject * lexicalGlobalObj if (UNLIKELY(!prototype)) return throwVMTypeError(lexicalGlobalObject, throwScope); return JSValue::encode(globalObject->JSSHA512Constructor()); -} +} + + JSC_DEFINE_CUSTOM_GETTER(SHA512Prototype__byteLengthGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSSHA512* thisObject = jsCast<JSSHA512*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -8926,38 +9639,41 @@ JSC_DEFINE_CUSTOM_GETTER(SHA512Prototype__byteLengthGetterWrap, (JSGlobalObject RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + -JSC_DEFINE_HOST_FUNCTION(SHA512Prototype__digestCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + JSC_DEFINE_HOST_FUNCTION(SHA512Prototype__digestCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - JSSHA512* thisObject = jsDynamicCast<JSSHA512*>(callFrame->thisValue()); + JSSHA512* thisObject = jsDynamicCast<JSSHA512*>(callFrame->thisValue()); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return SHA512Prototype__digest(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + return SHA512Prototype__digest(thisObject->wrapped(), lexicalGlobalObject, callFrame); + } + -JSC_DEFINE_HOST_FUNCTION(SHA512Prototype__updateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + JSC_DEFINE_HOST_FUNCTION(SHA512Prototype__updateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - JSSHA512* thisObject = jsDynamicCast<JSSHA512*>(callFrame->thisValue()); + JSSHA512* thisObject = jsDynamicCast<JSSHA512*>(callFrame->thisValue()); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return SHA512Prototype__update(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + return SHA512Prototype__update(thisObject->wrapped(), lexicalGlobalObject, callFrame); + } + void JSSHA512Prototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) { @@ -8969,11 +9685,12 @@ void JSSHA512Prototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalO extern "C" JSC_DECLARE_CUSTOM_GETTER(SHA512Class__getByteLengthStatic); extern "C" JSC_DECLARE_HOST_FUNCTION(SHA512Class__hash); -static const HashTableValue JSSHA512ConstructorTableValues[] = { - { "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, SHA512Class__getByteLengthStatic, 0 } }, - { "hash"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA512Class__hash, 2 } } + static const HashTableValue JSSHA512ConstructorTableValues[] = { +{ "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, SHA512Class__getByteLengthStatic, 0 } } , +{ "hash"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA512Class__hash, 2 } } }; + void JSSHA512Constructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSSHA512Prototype* prototype) { Base::finishCreation(vm, 0, "SHA512"_s, PropertyAdditionMode::WithoutStructureTransition); @@ -8982,59 +9699,62 @@ void JSSHA512Constructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObje ASSERT(inherits(info())); } -JSSHA512Constructor::JSSHA512Constructor(JSC::VM& vm, JSC::Structure* structure) - : Base(vm, structure, construct, construct) -{ -} +JSSHA512Constructor::JSSHA512Constructor(JSC::VM& vm, JSC::Structure* structure) : Base(vm, structure, construct, construct) { -JSSHA512Constructor* JSSHA512Constructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSSHA512Prototype* prototype) -{ + } + +JSSHA512Constructor* JSSHA512Constructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSSHA512Prototype* prototype) { JSSHA512Constructor* ptr = new (NotNull, JSC::allocateCell<JSSHA512Constructor>(vm)) JSSHA512Constructor(vm, structure); ptr->finishCreation(vm, globalObject, prototype); return ptr; } + JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSSHA512Constructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) { - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); - JSC::VM& vm = globalObject->vm(); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + JSC::VM &vm = globalObject->vm(); JSObject* newTarget = asObject(callFrame->newTarget()); auto* constructor = globalObject->JSSHA512Constructor(); Structure* structure = globalObject->JSSHA512Structure(); if (constructor != newTarget) { - auto scope = DECLARE_THROW_SCOPE(vm); + auto scope = DECLARE_THROW_SCOPE(vm); - auto* functionGlobalObject = reinterpret_cast<Zig::GlobalObject*>( - // ShadowRealm functions belong to a different global object. - getFunctionRealm(globalObject, newTarget)); - RETURN_IF_EXCEPTION(scope, {}); - structure = InternalFunction::createSubclassStructure( - globalObject, - newTarget, - functionGlobalObject->JSSHA512Structure()); + auto* functionGlobalObject = reinterpret_cast<Zig::GlobalObject*>( + // ShadowRealm functions belong to a different global object. + getFunctionRealm(globalObject, newTarget) + ); + RETURN_IF_EXCEPTION(scope, {}); + structure = InternalFunction::createSubclassStructure( + globalObject, + newTarget, + functionGlobalObject->JSSHA512Structure() + ); } void* ptr = SHA512Class__construct(globalObject, callFrame); if (UNLIKELY(!ptr)) { - return JSValue::encode(JSC::jsUndefined()); + return JSValue::encode(JSC::jsUndefined()); } JSSHA512* instance = JSSHA512::create(vm, globalObject, structure, ptr); + return JSValue::encode(instance); } void JSSHA512Constructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSSHA512Prototype* prototype) { + } const ClassInfo JSSHA512Constructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA512Constructor) }; -extern "C" EncodedJSValue SHA512__getConstructor(Zig::GlobalObject* globalObject) -{ + + extern "C" EncodedJSValue SHA512__getConstructor(Zig::GlobalObject* globalObject) { return JSValue::encode(globalObject->JSSHA512Constructor()); -} + } JSSHA512::~JSSHA512() { @@ -9046,7 +9766,7 @@ void JSSHA512::destroy(JSCell* cell) { static_cast<JSSHA512*>(cell)->JSSHA512::~JSSHA512(); } - + const ClassInfo JSSHA512::s_info = { "SHA512"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA512) }; void JSSHA512::finishCreation(VM& vm) @@ -9055,38 +9775,37 @@ void JSSHA512::finishCreation(VM& vm) ASSERT(inherits(info())); } -JSSHA512* JSSHA512::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSSHA512* ptr = new (NotNull, JSC::allocateCell<JSSHA512>(vm)) JSSHA512(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} -extern "C" void* SHA512__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; +JSSHA512* JSSHA512::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) { + JSSHA512* ptr = new (NotNull, JSC::allocateCell<JSSHA512>(vm)) JSSHA512(vm, structure, ctx); + ptr->finishCreation(vm); + return ptr; +} - JSC::JSCell* cell = decodedValue.asCell(); - JSSHA512* object = JSC::jsDynamicCast<JSSHA512*>(cell); +extern "C" void* SHA512__fromJS(JSC::EncodedJSValue value) { + JSC::JSValue decodedValue = JSC::JSValue::decode(value); + if (decodedValue.isEmpty() || !decodedValue.isCell()) + return nullptr; - if (!object) - return nullptr; + JSC::JSCell* cell = decodedValue.asCell(); + JSSHA512* object = JSC::jsDynamicCast<JSSHA512*>(cell); - return object->wrapped(); + if (!object) + return nullptr; + + return object->wrapped(); } -extern "C" bool SHA512__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSSHA512* object = JSC::jsDynamicCast<JSSHA512*>(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; +extern "C" bool SHA512__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) { + JSSHA512* object = JSC::jsDynamicCast<JSSHA512*>(JSValue::decode(value)); + if (!object) + return false; + + object->m_ctx = ptr; + return true; } + extern "C" const size_t SHA512__ptrOffset = JSSHA512::offsetOfWrapped(); void JSSHA512::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) @@ -9101,7 +9820,7 @@ void JSSHA512::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) JSObject* JSSHA512::createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype) { - return WebCore::JSSHA512Constructor::create(vm, globalObject, WebCore::JSSHA512Constructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast<WebCore::JSSHA512Prototype*>(prototype)); + return WebCore::JSSHA512Constructor::create(vm, globalObject, WebCore::JSSHA512Constructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast<WebCore::JSSHA512Prototype*>(prototype)); } JSObject* JSSHA512::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) @@ -9109,105 +9828,114 @@ JSObject* JSSHA512::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) return JSSHA512Prototype::create(vm, globalObject, JSSHA512Prototype::createStructure(vm, globalObject, globalObject->objectPrototype())); } -extern "C" EncodedJSValue SHA512__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSSHA512Structure(); - JSSHA512* instance = JSSHA512::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} -class JSSHA512_256Prototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSSHA512_256Prototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSSHA512_256Prototype* ptr = new (NotNull, JSC::allocateCell<JSSHA512_256Prototype>(vm)) JSSHA512_256Prototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template<typename CellType, JSC::SubspaceAccess> - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSSHA512_256Prototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; +extern "C" EncodedJSValue SHA512__create(Zig::GlobalObject* globalObject, void* ptr) { + auto &vm = globalObject->vm(); + JSC::Structure* structure = globalObject->JSSHA512Structure(); + JSSHA512* instance = JSSHA512::create(vm, globalObject, structure, ptr); + + return JSValue::encode(instance); +} + class JSSHA512_256Prototype final : public JSC::JSNonFinalObject { + public: + using Base = JSC::JSNonFinalObject; + + static JSSHA512_256Prototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) + { + JSSHA512_256Prototype* ptr = new (NotNull, JSC::allocateCell<JSSHA512_256Prototype>(vm)) JSSHA512_256Prototype(vm, globalObject, structure); + ptr->finishCreation(vm, globalObject); + return ptr; + } + + DECLARE_INFO; + template<typename CellType, JSC::SubspaceAccess> + static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + return &vm.plainObjectSpace(); + } + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); + } + + private: + JSSHA512_256Prototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) + : Base(vm, structure) + { + } + + void finishCreation(JSC::VM&, JSC::JSGlobalObject*); + }; class JSSHA512_256Constructor final : public JSC::InternalFunction { -public: - using Base = JSC::InternalFunction; - static JSSHA512_256Constructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSSHA512_256Prototype* prototype); - - static constexpr unsigned StructureFlags = Base::StructureFlags; - static constexpr bool needsDestruction = false; - - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); - } - - template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl<JSSHA512_256Constructor, WebCore::UseCustomHeapCellType::No>( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForSHA512_256Constructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForSHA512_256Constructor = std::forward<decltype(space)>(space); }, - [](auto& spaces) { return spaces.m_subspaceForSHA512_256Constructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForSHA512_256Constructor = std::forward<decltype(space)>(space); }); - } - - void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSSHA512_256Prototype* prototype); + public: + using Base = JSC::InternalFunction; + static JSSHA512_256Constructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSSHA512_256Prototype* prototype); + + static constexpr unsigned StructureFlags = Base::StructureFlags; + static constexpr bool needsDestruction = false; + + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); + } + + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return WebCore::subspaceForImpl<JSSHA512_256Constructor, WebCore::UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForSHA512_256Constructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForSHA512_256Constructor = std::forward<decltype(space)>(space); }, + [](auto& spaces) { return spaces.m_subspaceForSHA512_256Constructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForSHA512_256Constructor = std::forward<decltype(space)>(space); }); + } + + + void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSSHA512_256Prototype* prototype); + + // Must be defined for each specialization class. + static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); + + DECLARE_EXPORT_INFO; + private: + JSSHA512_256Constructor(JSC::VM& vm, JSC::Structure* structure); + void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSSHA512_256Prototype* prototype); + }; - // Must be defined for each specialization class. - static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); - - DECLARE_EXPORT_INFO; - -private: - JSSHA512_256Constructor(JSC::VM& vm, JSC::Structure* structure); - void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSSHA512_256Prototype* prototype); -}; extern "C" void* SHA512_256Class__construct(JSC::JSGlobalObject*, JSC::CallFrame*); JSC_DECLARE_CUSTOM_GETTER(jsSHA512_256Constructor); extern "C" void SHA512_256Class__finalize(void*); + extern "C" JSC::EncodedJSValue SHA512_256Prototype__getByteLength(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(SHA512_256Prototype__byteLengthGetterWrap); + extern "C" EncodedJSValue SHA512_256Prototype__digest(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(SHA512_256Prototype__digestCallback); + extern "C" EncodedJSValue SHA512_256Prototype__update(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(SHA512_256Prototype__updateCallback); + STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSSHA512_256Prototype, JSSHA512_256Prototype::Base); -static const HashTableValue JSSHA512_256PrototypeTableValues[] = { - { "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, SHA512_256Prototype__byteLengthGetterWrap, 0 } }, - { "digest"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA512_256Prototype__digestCallback, 0 } }, - { "update"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA512_256Prototype__updateCallback, 1 } } + + static const HashTableValue JSSHA512_256PrototypeTableValues[] = { +{ "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, SHA512_256Prototype__byteLengthGetterWrap, 0 } } , +{ "digest"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA512_256Prototype__digestCallback, 0 } } , +{ "update"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA512_256Prototype__updateCallback, 1 } } }; + + const ClassInfo JSSHA512_256Prototype::s_info = { "SHA512_256"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA512_256Prototype) }; + + JSC_DEFINE_CUSTOM_GETTER(jsSHA512_256Constructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); @@ -9218,12 +9946,14 @@ JSC_DEFINE_CUSTOM_GETTER(jsSHA512_256Constructor, (JSGlobalObject * lexicalGloba if (UNLIKELY(!prototype)) return throwVMTypeError(lexicalGlobalObject, throwScope); return JSValue::encode(globalObject->JSSHA512_256Constructor()); -} +} + + JSC_DEFINE_CUSTOM_GETTER(SHA512_256Prototype__byteLengthGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSSHA512_256* thisObject = jsCast<JSSHA512_256*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -9231,38 +9961,41 @@ JSC_DEFINE_CUSTOM_GETTER(SHA512_256Prototype__byteLengthGetterWrap, (JSGlobalObj RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + -JSC_DEFINE_HOST_FUNCTION(SHA512_256Prototype__digestCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + JSC_DEFINE_HOST_FUNCTION(SHA512_256Prototype__digestCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - JSSHA512_256* thisObject = jsDynamicCast<JSSHA512_256*>(callFrame->thisValue()); + JSSHA512_256* thisObject = jsDynamicCast<JSSHA512_256*>(callFrame->thisValue()); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return SHA512_256Prototype__digest(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + return SHA512_256Prototype__digest(thisObject->wrapped(), lexicalGlobalObject, callFrame); + } + -JSC_DEFINE_HOST_FUNCTION(SHA512_256Prototype__updateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + JSC_DEFINE_HOST_FUNCTION(SHA512_256Prototype__updateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - JSSHA512_256* thisObject = jsDynamicCast<JSSHA512_256*>(callFrame->thisValue()); + JSSHA512_256* thisObject = jsDynamicCast<JSSHA512_256*>(callFrame->thisValue()); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return SHA512_256Prototype__update(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + return SHA512_256Prototype__update(thisObject->wrapped(), lexicalGlobalObject, callFrame); + } + void JSSHA512_256Prototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) { @@ -9274,11 +10007,12 @@ void JSSHA512_256Prototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* glo extern "C" JSC_DECLARE_CUSTOM_GETTER(SHA512_256Class__getByteLengthStatic); extern "C" JSC_DECLARE_HOST_FUNCTION(SHA512_256Class__hash); -static const HashTableValue JSSHA512_256ConstructorTableValues[] = { - { "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, SHA512_256Class__getByteLengthStatic, 0 } }, - { "hash"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA512_256Class__hash, 2 } } + static const HashTableValue JSSHA512_256ConstructorTableValues[] = { +{ "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, SHA512_256Class__getByteLengthStatic, 0 } } , +{ "hash"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA512_256Class__hash, 2 } } }; + void JSSHA512_256Constructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSSHA512_256Prototype* prototype) { Base::finishCreation(vm, 0, "SHA512_256"_s, PropertyAdditionMode::WithoutStructureTransition); @@ -9287,59 +10021,62 @@ void JSSHA512_256Constructor::finishCreation(VM& vm, JSC::JSGlobalObject* global ASSERT(inherits(info())); } -JSSHA512_256Constructor::JSSHA512_256Constructor(JSC::VM& vm, JSC::Structure* structure) - : Base(vm, structure, construct, construct) -{ -} +JSSHA512_256Constructor::JSSHA512_256Constructor(JSC::VM& vm, JSC::Structure* structure) : Base(vm, structure, construct, construct) { -JSSHA512_256Constructor* JSSHA512_256Constructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSSHA512_256Prototype* prototype) -{ + } + +JSSHA512_256Constructor* JSSHA512_256Constructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSSHA512_256Prototype* prototype) { JSSHA512_256Constructor* ptr = new (NotNull, JSC::allocateCell<JSSHA512_256Constructor>(vm)) JSSHA512_256Constructor(vm, structure); ptr->finishCreation(vm, globalObject, prototype); return ptr; } + JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSSHA512_256Constructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) { - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); - JSC::VM& vm = globalObject->vm(); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + JSC::VM &vm = globalObject->vm(); JSObject* newTarget = asObject(callFrame->newTarget()); auto* constructor = globalObject->JSSHA512_256Constructor(); Structure* structure = globalObject->JSSHA512_256Structure(); if (constructor != newTarget) { - auto scope = DECLARE_THROW_SCOPE(vm); + auto scope = DECLARE_THROW_SCOPE(vm); - auto* functionGlobalObject = reinterpret_cast<Zig::GlobalObject*>( - // ShadowRealm functions belong to a different global object. - getFunctionRealm(globalObject, newTarget)); - RETURN_IF_EXCEPTION(scope, {}); - structure = InternalFunction::createSubclassStructure( - globalObject, - newTarget, - functionGlobalObject->JSSHA512_256Structure()); + auto* functionGlobalObject = reinterpret_cast<Zig::GlobalObject*>( + // ShadowRealm functions belong to a different global object. + getFunctionRealm(globalObject, newTarget) + ); + RETURN_IF_EXCEPTION(scope, {}); + structure = InternalFunction::createSubclassStructure( + globalObject, + newTarget, + functionGlobalObject->JSSHA512_256Structure() + ); } void* ptr = SHA512_256Class__construct(globalObject, callFrame); if (UNLIKELY(!ptr)) { - return JSValue::encode(JSC::jsUndefined()); + return JSValue::encode(JSC::jsUndefined()); } JSSHA512_256* instance = JSSHA512_256::create(vm, globalObject, structure, ptr); + return JSValue::encode(instance); } void JSSHA512_256Constructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSSHA512_256Prototype* prototype) { + } const ClassInfo JSSHA512_256Constructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA512_256Constructor) }; -extern "C" EncodedJSValue SHA512_256__getConstructor(Zig::GlobalObject* globalObject) -{ + + extern "C" EncodedJSValue SHA512_256__getConstructor(Zig::GlobalObject* globalObject) { return JSValue::encode(globalObject->JSSHA512_256Constructor()); -} + } JSSHA512_256::~JSSHA512_256() { @@ -9351,7 +10088,7 @@ void JSSHA512_256::destroy(JSCell* cell) { static_cast<JSSHA512_256*>(cell)->JSSHA512_256::~JSSHA512_256(); } - + const ClassInfo JSSHA512_256::s_info = { "SHA512_256"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA512_256) }; void JSSHA512_256::finishCreation(VM& vm) @@ -9360,38 +10097,37 @@ void JSSHA512_256::finishCreation(VM& vm) ASSERT(inherits(info())); } -JSSHA512_256* JSSHA512_256::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSSHA512_256* ptr = new (NotNull, JSC::allocateCell<JSSHA512_256>(vm)) JSSHA512_256(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} -extern "C" void* SHA512_256__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; +JSSHA512_256* JSSHA512_256::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) { + JSSHA512_256* ptr = new (NotNull, JSC::allocateCell<JSSHA512_256>(vm)) JSSHA512_256(vm, structure, ctx); + ptr->finishCreation(vm); + return ptr; +} - JSC::JSCell* cell = decodedValue.asCell(); - JSSHA512_256* object = JSC::jsDynamicCast<JSSHA512_256*>(cell); +extern "C" void* SHA512_256__fromJS(JSC::EncodedJSValue value) { + JSC::JSValue decodedValue = JSC::JSValue::decode(value); + if (decodedValue.isEmpty() || !decodedValue.isCell()) + return nullptr; - if (!object) - return nullptr; + JSC::JSCell* cell = decodedValue.asCell(); + JSSHA512_256* object = JSC::jsDynamicCast<JSSHA512_256*>(cell); - return object->wrapped(); + if (!object) + return nullptr; + + return object->wrapped(); } -extern "C" bool SHA512_256__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSSHA512_256* object = JSC::jsDynamicCast<JSSHA512_256*>(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; +extern "C" bool SHA512_256__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) { + JSSHA512_256* object = JSC::jsDynamicCast<JSSHA512_256*>(JSValue::decode(value)); + if (!object) + return false; + + object->m_ctx = ptr; + return true; } + extern "C" const size_t SHA512_256__ptrOffset = JSSHA512_256::offsetOfWrapped(); void JSSHA512_256::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) @@ -9406,7 +10142,7 @@ void JSSHA512_256::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) JSObject* JSSHA512_256::createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype) { - return WebCore::JSSHA512_256Constructor::create(vm, globalObject, WebCore::JSSHA512_256Constructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast<WebCore::JSSHA512_256Prototype*>(prototype)); + return WebCore::JSSHA512_256Constructor::create(vm, globalObject, WebCore::JSSHA512_256Constructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast<WebCore::JSSHA512_256Prototype*>(prototype)); } JSObject* JSSHA512_256::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) @@ -9414,123 +10150,134 @@ JSObject* JSSHA512_256::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) return JSSHA512_256Prototype::create(vm, globalObject, JSSHA512_256Prototype::createStructure(vm, globalObject, globalObject->objectPrototype())); } -extern "C" EncodedJSValue SHA512_256__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSSHA512_256Structure(); - JSSHA512_256* instance = JSSHA512_256::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} -class JSServerWebSocketPrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSServerWebSocketPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSServerWebSocketPrototype* ptr = new (NotNull, JSC::allocateCell<JSServerWebSocketPrototype>(vm)) JSServerWebSocketPrototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template<typename CellType, JSC::SubspaceAccess> - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSServerWebSocketPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; +extern "C" EncodedJSValue SHA512_256__create(Zig::GlobalObject* globalObject, void* ptr) { + auto &vm = globalObject->vm(); + JSC::Structure* structure = globalObject->JSSHA512_256Structure(); + JSSHA512_256* instance = JSSHA512_256::create(vm, globalObject, structure, ptr); + + return JSValue::encode(instance); +} + class JSServerWebSocketPrototype final : public JSC::JSNonFinalObject { + public: + using Base = JSC::JSNonFinalObject; + + static JSServerWebSocketPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) + { + JSServerWebSocketPrototype* ptr = new (NotNull, JSC::allocateCell<JSServerWebSocketPrototype>(vm)) JSServerWebSocketPrototype(vm, globalObject, structure); + ptr->finishCreation(vm, globalObject); + return ptr; + } + + DECLARE_INFO; + template<typename CellType, JSC::SubspaceAccess> + static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + return &vm.plainObjectSpace(); + } + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); + } + + private: + JSServerWebSocketPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) + : Base(vm, structure) + { + } + + void finishCreation(JSC::VM&, JSC::JSGlobalObject*); + }; class JSServerWebSocketConstructor final : public JSC::InternalFunction { -public: - using Base = JSC::InternalFunction; - static JSServerWebSocketConstructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSServerWebSocketPrototype* prototype); + public: + using Base = JSC::InternalFunction; + static JSServerWebSocketConstructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSServerWebSocketPrototype* prototype); + + static constexpr unsigned StructureFlags = Base::StructureFlags; + static constexpr bool needsDestruction = false; + + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); + } + + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return WebCore::subspaceForImpl<JSServerWebSocketConstructor, WebCore::UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForServerWebSocketConstructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForServerWebSocketConstructor = std::forward<decltype(space)>(space); }, + [](auto& spaces) { return spaces.m_subspaceForServerWebSocketConstructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForServerWebSocketConstructor = std::forward<decltype(space)>(space); }); + } + + + void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSServerWebSocketPrototype* prototype); + + // Must be defined for each specialization class. + static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); + + DECLARE_EXPORT_INFO; + private: + JSServerWebSocketConstructor(JSC::VM& vm, JSC::Structure* structure); + void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSServerWebSocketPrototype* prototype); + }; - static constexpr unsigned StructureFlags = Base::StructureFlags; - static constexpr bool needsDestruction = false; - - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); - } - - template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl<JSServerWebSocketConstructor, WebCore::UseCustomHeapCellType::No>( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForServerWebSocketConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForServerWebSocketConstructor = std::forward<decltype(space)>(space); }, - [](auto& spaces) { return spaces.m_subspaceForServerWebSocketConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForServerWebSocketConstructor = std::forward<decltype(space)>(space); }); - } - - void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSServerWebSocketPrototype* prototype); - - // Must be defined for each specialization class. - static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); - - DECLARE_EXPORT_INFO; - -private: - JSServerWebSocketConstructor(JSC::VM& vm, JSC::Structure* structure); - void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSServerWebSocketPrototype* prototype); -}; extern "C" void* ServerWebSocketClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); JSC_DECLARE_CUSTOM_GETTER(jsServerWebSocketConstructor); extern "C" void ServerWebSocketClass__finalize(void*); + extern "C" JSC::EncodedJSValue ServerWebSocketPrototype__getBinaryType(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(ServerWebSocketPrototype__binaryTypeGetterWrap); + extern "C" bool ServerWebSocketPrototype__setBinaryType(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::EncodedJSValue value); JSC_DECLARE_CUSTOM_SETTER(ServerWebSocketPrototype__binaryTypeSetterWrap); + extern "C" EncodedJSValue ServerWebSocketPrototype__close(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(ServerWebSocketPrototype__closeCallback); + extern "C" EncodedJSValue ServerWebSocketPrototype__cork(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(ServerWebSocketPrototype__corkCallback); + extern "C" JSC::EncodedJSValue ServerWebSocketPrototype__getData(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(ServerWebSocketPrototype__dataGetterWrap); + extern "C" bool ServerWebSocketPrototype__setData(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::EncodedJSValue value); JSC_DECLARE_CUSTOM_SETTER(ServerWebSocketPrototype__dataSetterWrap); + extern "C" EncodedJSValue ServerWebSocketPrototype__getBufferedAmount(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(ServerWebSocketPrototype__getBufferedAmountCallback); + extern "C" EncodedJSValue ServerWebSocketPrototype__isSubscribed(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(ServerWebSocketPrototype__isSubscribedCallback); + extern "C" EncodedJSValue ServerWebSocketPrototype__publish(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(ServerWebSocketPrototype__publishCallback); + extern "C" EncodedJSValue ServerWebSocketPrototype__publishBinary(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(ServerWebSocketPrototype__publishBinaryCallback); + extern "C" JSC_DECLARE_JIT_OPERATION_WITHOUT_WTF_INTERNAL(ServerWebSocketPrototype__publishBinaryWithoutTypeChecksWrapper, EncodedJSValue, (JSC::JSGlobalObject * lexicalGlobalObject, void* thisValue, JSC::JSString* arg0, JSC::JSUint8Array* arg1)); -extern "C" EncodedJSValue ServerWebSocketPrototype__publishBinaryWithoutTypeChecks(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::JSString* arg0, JSC::JSUint8Array* arg1); + extern "C" EncodedJSValue ServerWebSocketPrototype__publishBinaryWithoutTypeChecks(void* ptr, JSC::JSGlobalObject * lexicalGlobalObject, JSC::JSString* arg0, JSC::JSUint8Array* arg1); -static const JSC::DOMJIT::Signature DOMJITSignatureForServerWebSocketPrototype__publishBinary(ServerWebSocketPrototype__publishBinaryWithoutTypeChecksWrapper, - JSServerWebSocket::info(), - JSC::DOMJIT::Effect::forReadWrite(JSC::DOMJIT::HeapRange::top(), JSC::DOMJIT::HeapRange::top()), - JSC::SpecHeapTop, JSC::SpecString, JSC::SpecUint8Array); + static const JSC::DOMJIT::Signature DOMJITSignatureForServerWebSocketPrototype__publishBinary(ServerWebSocketPrototype__publishBinaryWithoutTypeChecksWrapper, + JSServerWebSocket::info(), + JSC::DOMJIT::Effect::forReadWrite(JSC::DOMJIT::HeapRange::top(), JSC::DOMJIT::HeapRange::top()), + JSC::SpecHeapTop, JSC::SpecString, JSC::SpecUint8Array); JSC_DEFINE_JIT_OPERATION(ServerWebSocketPrototype__publishBinaryWithoutTypeChecksWrapper, EncodedJSValue, (JSC::JSGlobalObject * lexicalGlobalObject, void* thisValue, JSC::JSString* arg0, JSC::JSUint8Array* arg1)) { @@ -9545,13 +10292,14 @@ JSC_DEFINE_JIT_OPERATION(ServerWebSocketPrototype__publishBinaryWithoutTypeCheck extern "C" EncodedJSValue ServerWebSocketPrototype__publishText(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(ServerWebSocketPrototype__publishTextCallback); + extern "C" JSC_DECLARE_JIT_OPERATION_WITHOUT_WTF_INTERNAL(ServerWebSocketPrototype__publishTextWithoutTypeChecksWrapper, EncodedJSValue, (JSC::JSGlobalObject * lexicalGlobalObject, void* thisValue, JSC::JSString* arg0, JSC::JSString* arg1)); -extern "C" EncodedJSValue ServerWebSocketPrototype__publishTextWithoutTypeChecks(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::JSString* arg0, JSC::JSString* arg1); + extern "C" EncodedJSValue ServerWebSocketPrototype__publishTextWithoutTypeChecks(void* ptr, JSC::JSGlobalObject * lexicalGlobalObject, JSC::JSString* arg0, JSC::JSString* arg1); -static const JSC::DOMJIT::Signature DOMJITSignatureForServerWebSocketPrototype__publishText(ServerWebSocketPrototype__publishTextWithoutTypeChecksWrapper, - JSServerWebSocket::info(), - JSC::DOMJIT::Effect::forReadWrite(JSC::DOMJIT::HeapRange::top(), JSC::DOMJIT::HeapRange::top()), - JSC::SpecHeapTop, JSC::SpecString, JSC::SpecString); + static const JSC::DOMJIT::Signature DOMJITSignatureForServerWebSocketPrototype__publishText(ServerWebSocketPrototype__publishTextWithoutTypeChecksWrapper, + JSServerWebSocket::info(), + JSC::DOMJIT::Effect::forReadWrite(JSC::DOMJIT::HeapRange::top(), JSC::DOMJIT::HeapRange::top()), + JSC::SpecHeapTop, JSC::SpecString, JSC::SpecString); JSC_DEFINE_JIT_OPERATION(ServerWebSocketPrototype__publishTextWithoutTypeChecksWrapper, EncodedJSValue, (JSC::JSGlobalObject * lexicalGlobalObject, void* thisValue, JSC::JSString* arg0, JSC::JSString* arg1)) { @@ -9566,22 +10314,26 @@ JSC_DEFINE_JIT_OPERATION(ServerWebSocketPrototype__publishTextWithoutTypeChecksW extern "C" JSC::EncodedJSValue ServerWebSocketPrototype__getReadyState(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(ServerWebSocketPrototype__readyStateGetterWrap); + extern "C" JSC::EncodedJSValue ServerWebSocketPrototype__getRemoteAddress(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(ServerWebSocketPrototype__remoteAddressGetterWrap); + extern "C" EncodedJSValue ServerWebSocketPrototype__send(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(ServerWebSocketPrototype__sendCallback); + extern "C" EncodedJSValue ServerWebSocketPrototype__sendBinary(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(ServerWebSocketPrototype__sendBinaryCallback); + extern "C" JSC_DECLARE_JIT_OPERATION_WITHOUT_WTF_INTERNAL(ServerWebSocketPrototype__sendBinaryWithoutTypeChecksWrapper, EncodedJSValue, (JSC::JSGlobalObject * lexicalGlobalObject, void* thisValue, JSC::JSUint8Array* arg0, bool arg1)); -extern "C" EncodedJSValue ServerWebSocketPrototype__sendBinaryWithoutTypeChecks(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::JSUint8Array* arg0, bool arg1); + extern "C" EncodedJSValue ServerWebSocketPrototype__sendBinaryWithoutTypeChecks(void* ptr, JSC::JSGlobalObject * lexicalGlobalObject, JSC::JSUint8Array* arg0, bool arg1); -static const JSC::DOMJIT::Signature DOMJITSignatureForServerWebSocketPrototype__sendBinary(ServerWebSocketPrototype__sendBinaryWithoutTypeChecksWrapper, - JSServerWebSocket::info(), - JSC::DOMJIT::Effect::forReadWrite(JSC::DOMJIT::HeapRange::top(), JSC::DOMJIT::HeapRange::top()), - JSC::SpecHeapTop, JSC::SpecUint8Array, JSC::SpecBoolean); + static const JSC::DOMJIT::Signature DOMJITSignatureForServerWebSocketPrototype__sendBinary(ServerWebSocketPrototype__sendBinaryWithoutTypeChecksWrapper, + JSServerWebSocket::info(), + JSC::DOMJIT::Effect::forReadWrite(JSC::DOMJIT::HeapRange::top(), JSC::DOMJIT::HeapRange::top()), + JSC::SpecHeapTop, JSC::SpecUint8Array, JSC::SpecBoolean); JSC_DEFINE_JIT_OPERATION(ServerWebSocketPrototype__sendBinaryWithoutTypeChecksWrapper, EncodedJSValue, (JSC::JSGlobalObject * lexicalGlobalObject, void* thisValue, JSC::JSUint8Array* arg0, bool arg1)) { @@ -9596,13 +10348,14 @@ JSC_DEFINE_JIT_OPERATION(ServerWebSocketPrototype__sendBinaryWithoutTypeChecksWr extern "C" EncodedJSValue ServerWebSocketPrototype__sendText(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(ServerWebSocketPrototype__sendTextCallback); + extern "C" JSC_DECLARE_JIT_OPERATION_WITHOUT_WTF_INTERNAL(ServerWebSocketPrototype__sendTextWithoutTypeChecksWrapper, EncodedJSValue, (JSC::JSGlobalObject * lexicalGlobalObject, void* thisValue, JSC::JSString* arg0, bool arg1)); -extern "C" EncodedJSValue ServerWebSocketPrototype__sendTextWithoutTypeChecks(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::JSString* arg0, bool arg1); + extern "C" EncodedJSValue ServerWebSocketPrototype__sendTextWithoutTypeChecks(void* ptr, JSC::JSGlobalObject * lexicalGlobalObject, JSC::JSString* arg0, bool arg1); -static const JSC::DOMJIT::Signature DOMJITSignatureForServerWebSocketPrototype__sendText(ServerWebSocketPrototype__sendTextWithoutTypeChecksWrapper, - JSServerWebSocket::info(), - JSC::DOMJIT::Effect::forReadWrite(JSC::DOMJIT::HeapRange::top(), JSC::DOMJIT::HeapRange::top()), - JSC::SpecHeapTop, JSC::SpecString, JSC::SpecBoolean); + static const JSC::DOMJIT::Signature DOMJITSignatureForServerWebSocketPrototype__sendText(ServerWebSocketPrototype__sendTextWithoutTypeChecksWrapper, + JSServerWebSocket::info(), + JSC::DOMJIT::Effect::forReadWrite(JSC::DOMJIT::HeapRange::top(), JSC::DOMJIT::HeapRange::top()), + JSC::SpecHeapTop, JSC::SpecString, JSC::SpecBoolean); JSC_DEFINE_JIT_OPERATION(ServerWebSocketPrototype__sendTextWithoutTypeChecksWrapper, EncodedJSValue, (JSC::JSGlobalObject * lexicalGlobalObject, void* thisValue, JSC::JSString* arg0, bool arg1)) { @@ -9617,32 +10370,39 @@ JSC_DEFINE_JIT_OPERATION(ServerWebSocketPrototype__sendTextWithoutTypeChecksWrap extern "C" EncodedJSValue ServerWebSocketPrototype__subscribe(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(ServerWebSocketPrototype__subscribeCallback); + extern "C" EncodedJSValue ServerWebSocketPrototype__unsubscribe(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(ServerWebSocketPrototype__unsubscribeCallback); + STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSServerWebSocketPrototype, JSServerWebSocketPrototype::Base); -static const HashTableValue JSServerWebSocketPrototypeTableValues[] = { - { "binaryType"_s, static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ServerWebSocketPrototype__binaryTypeGetterWrap, ServerWebSocketPrototype__binaryTypeSetterWrap } }, - { "close"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ServerWebSocketPrototype__closeCallback, 1 } }, - { "cork"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ServerWebSocketPrototype__corkCallback, 1 } }, - { "data"_s, static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ServerWebSocketPrototype__dataGetterWrap, ServerWebSocketPrototype__dataSetterWrap } }, - { "getBufferedAmount"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ServerWebSocketPrototype__getBufferedAmountCallback, 0 } }, - { "isSubscribed"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ServerWebSocketPrototype__isSubscribedCallback, 1 } }, - { "publish"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ServerWebSocketPrototype__publishCallback, 3 } }, - { "publishBinary"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | JSC::PropertyAttribute::DOMJITFunction | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::DOMJITFunctionType, ServerWebSocketPrototype__publishBinaryCallback, &DOMJITSignatureForServerWebSocketPrototype__publishBinary } }, - { "publishText"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | JSC::PropertyAttribute::DOMJITFunction | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::DOMJITFunctionType, ServerWebSocketPrototype__publishTextCallback, &DOMJITSignatureForServerWebSocketPrototype__publishText } }, - { "readyState"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ServerWebSocketPrototype__readyStateGetterWrap, 0 } }, - { "remoteAddress"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ServerWebSocketPrototype__remoteAddressGetterWrap, 0 } }, - { "send"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ServerWebSocketPrototype__sendCallback, 2 } }, - { "sendBinary"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | JSC::PropertyAttribute::DOMJITFunction | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::DOMJITFunctionType, ServerWebSocketPrototype__sendBinaryCallback, &DOMJITSignatureForServerWebSocketPrototype__sendBinary } }, - { "sendText"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | JSC::PropertyAttribute::DOMJITFunction | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::DOMJITFunctionType, ServerWebSocketPrototype__sendTextCallback, &DOMJITSignatureForServerWebSocketPrototype__sendText } }, - { "subscribe"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ServerWebSocketPrototype__subscribeCallback, 1 } }, - { "unsubscribe"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ServerWebSocketPrototype__unsubscribeCallback, 1 } } + + static const HashTableValue JSServerWebSocketPrototypeTableValues[] = { +{ "binaryType"_s, static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ServerWebSocketPrototype__binaryTypeGetterWrap, ServerWebSocketPrototype__binaryTypeSetterWrap } } , +{ "close"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ServerWebSocketPrototype__closeCallback, 1 } } , +{ "cork"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ServerWebSocketPrototype__corkCallback, 1 } } , +{ "data"_s, static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ServerWebSocketPrototype__dataGetterWrap, ServerWebSocketPrototype__dataSetterWrap } } , +{ "getBufferedAmount"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ServerWebSocketPrototype__getBufferedAmountCallback, 0 } } , +{ "isSubscribed"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ServerWebSocketPrototype__isSubscribedCallback, 1 } } , +{ "publish"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ServerWebSocketPrototype__publishCallback, 3 } } , +{ "publishBinary"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | JSC::PropertyAttribute::DOMJITFunction | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::DOMJITFunctionType, ServerWebSocketPrototype__publishBinaryCallback, &DOMJITSignatureForServerWebSocketPrototype__publishBinary } } , +{ "publishText"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | JSC::PropertyAttribute::DOMJITFunction | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::DOMJITFunctionType, ServerWebSocketPrototype__publishTextCallback, &DOMJITSignatureForServerWebSocketPrototype__publishText } } , +{ "readyState"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ServerWebSocketPrototype__readyStateGetterWrap, 0 } } , +{ "remoteAddress"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, ServerWebSocketPrototype__remoteAddressGetterWrap, 0 } } , +{ "send"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ServerWebSocketPrototype__sendCallback, 2 } } , +{ "sendBinary"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | JSC::PropertyAttribute::DOMJITFunction | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::DOMJITFunctionType, ServerWebSocketPrototype__sendBinaryCallback, &DOMJITSignatureForServerWebSocketPrototype__sendBinary } } , +{ "sendText"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | JSC::PropertyAttribute::DOMJITFunction | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::DOMJITFunctionType, ServerWebSocketPrototype__sendTextCallback, &DOMJITSignatureForServerWebSocketPrototype__sendText } } , +{ "subscribe"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ServerWebSocketPrototype__subscribeCallback, 1 } } , +{ "unsubscribe"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, ServerWebSocketPrototype__unsubscribeCallback, 1 } } }; + + const ClassInfo JSServerWebSocketPrototype::s_info = { "ServerWebSocket"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSServerWebSocketPrototype) }; + + JSC_DEFINE_CUSTOM_GETTER(jsServerWebSocketConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); @@ -9653,12 +10413,14 @@ JSC_DEFINE_CUSTOM_GETTER(jsServerWebSocketConstructor, (JSGlobalObject * lexical if (UNLIKELY(!prototype)) return throwVMTypeError(lexicalGlobalObject, throwScope); return JSValue::encode(globalObject->JSServerWebSocketConstructor()); -} +} + + JSC_DEFINE_CUSTOM_GETTER(ServerWebSocketPrototype__binaryTypeGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSServerWebSocket* thisObject = jsCast<JSServerWebSocket*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -9666,6 +10428,7 @@ JSC_DEFINE_CUSTOM_GETTER(ServerWebSocketPrototype__binaryTypeGetterWrap, (JSGlob RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + JSC_DEFINE_CUSTOM_SETTER(ServerWebSocketPrototype__binaryTypeSetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue, PropertyName attributeName)) { @@ -9678,68 +10441,75 @@ JSC_DEFINE_CUSTOM_SETTER(ServerWebSocketPrototype__binaryTypeSetterWrap, (JSGlob RELEASE_AND_RETURN(throwScope, result); } -JSC_DEFINE_HOST_FUNCTION(ServerWebSocketPrototype__closeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - JSServerWebSocket* thisObject = jsDynamicCast<JSServerWebSocket*>(callFrame->thisValue()); + JSC_DEFINE_HOST_FUNCTION(ServerWebSocketPrototype__closeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } + JSServerWebSocket* thisObject = jsDynamicCast<JSServerWebSocket*>(callFrame->thisValue()); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - return ServerWebSocketPrototype__close(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); -JSC_DEFINE_HOST_FUNCTION(ServerWebSocketPrototype__corkCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + return ServerWebSocketPrototype__close(thisObject->wrapped(), lexicalGlobalObject, callFrame); + } + - JSServerWebSocket* thisObject = jsDynamicCast<JSServerWebSocket*>(callFrame->thisValue()); + JSC_DEFINE_HOST_FUNCTION(ServerWebSocketPrototype__corkCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } + JSServerWebSocket* thisObject = jsDynamicCast<JSServerWebSocket*>(callFrame->thisValue()); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - return ServerWebSocketPrototype__cork(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + + return ServerWebSocketPrototype__cork(thisObject->wrapped(), lexicalGlobalObject, callFrame); + } + JSC_DEFINE_CUSTOM_GETTER(ServerWebSocketPrototype__dataGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSServerWebSocket* thisObject = jsCast<JSServerWebSocket*>(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + if (JSValue cachedValue = thisObject->m_data.get()) return JSValue::encode(cachedValue); - + JSC::JSValue result = JSC::JSValue::decode( - ServerWebSocketPrototype__getData(thisObject->wrapped(), globalObject)); + ServerWebSocketPrototype__getData(thisObject->wrapped(), globalObject) + ); RETURN_IF_EXCEPTION(throwScope, {}); thisObject->m_data.set(vm, thisObject, result); RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); } -extern "C" void ServerWebSocketPrototype__dataSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast<JSServerWebSocket*>(JSValue::decode(thisValue)); - thisObject->m_data.set(vm, thisObject, JSValue::decode(value)); -} -extern "C" EncodedJSValue ServerWebSocketPrototype__dataGetCachedValue(JSC::EncodedJSValue thisValue) -{ + extern "C" void ServerWebSocketPrototype__dataSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject *globalObject, JSC::EncodedJSValue value) + { + auto& vm = globalObject->vm(); + auto* thisObject = jsCast<JSServerWebSocket*>(JSValue::decode(thisValue)); + thisObject->m_data.set(vm, thisObject, JSValue::decode(value)); + } + + extern "C" EncodedJSValue ServerWebSocketPrototype__dataGetCachedValue(JSC::EncodedJSValue thisValue) + { auto* thisObject = jsCast<JSServerWebSocket*>(JSValue::decode(thisValue)); return JSValue::encode(thisObject->m_data.get()); -} + } + + JSC_DEFINE_CUSTOM_SETTER(ServerWebSocketPrototype__dataSetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue, PropertyName attributeName)) { @@ -9752,90 +10522,96 @@ JSC_DEFINE_CUSTOM_SETTER(ServerWebSocketPrototype__dataSetterWrap, (JSGlobalObje RELEASE_AND_RETURN(throwScope, result); } -JSC_DEFINE_HOST_FUNCTION(ServerWebSocketPrototype__getBufferedAmountCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - JSServerWebSocket* thisObject = jsDynamicCast<JSServerWebSocket*>(callFrame->thisValue()); + JSC_DEFINE_HOST_FUNCTION(ServerWebSocketPrototype__getBufferedAmountCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); + + JSServerWebSocket* thisObject = jsDynamicCast<JSServerWebSocket*>(callFrame->thisValue()); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } + + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + + return ServerWebSocketPrototype__getBufferedAmount(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(ServerWebSocketPrototype__isSubscribedCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return ServerWebSocketPrototype__getBufferedAmount(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSServerWebSocket* thisObject = jsDynamicCast<JSServerWebSocket*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(ServerWebSocketPrototype__isSubscribedCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSServerWebSocket* thisObject = jsDynamicCast<JSServerWebSocket*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return ServerWebSocketPrototype__isSubscribed(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(ServerWebSocketPrototype__publishCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return ServerWebSocketPrototype__isSubscribed(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSServerWebSocket* thisObject = jsDynamicCast<JSServerWebSocket*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(ServerWebSocketPrototype__publishCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSServerWebSocket* thisObject = jsDynamicCast<JSServerWebSocket*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return ServerWebSocketPrototype__publish(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(ServerWebSocketPrototype__publishBinaryCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return ServerWebSocketPrototype__publish(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSServerWebSocket* thisObject = jsDynamicCast<JSServerWebSocket*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(ServerWebSocketPrototype__publishBinaryCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSServerWebSocket* thisObject = jsDynamicCast<JSServerWebSocket*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return ServerWebSocketPrototype__publishBinary(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(ServerWebSocketPrototype__publishTextCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return ServerWebSocketPrototype__publishBinary(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSServerWebSocket* thisObject = jsDynamicCast<JSServerWebSocket*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(ServerWebSocketPrototype__publishTextCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSServerWebSocket* thisObject = jsDynamicCast<JSServerWebSocket*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return ServerWebSocketPrototype__publishText(thisObject->wrapped(), lexicalGlobalObject, callFrame); } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - return ServerWebSocketPrototype__publishText(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSC_DEFINE_CUSTOM_GETTER(ServerWebSocketPrototype__readyStateGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSServerWebSocket* thisObject = jsCast<JSServerWebSocket*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -9843,117 +10619,127 @@ JSC_DEFINE_CUSTOM_GETTER(ServerWebSocketPrototype__readyStateGetterWrap, (JSGlob RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + JSC_DEFINE_CUSTOM_GETTER(ServerWebSocketPrototype__remoteAddressGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSServerWebSocket* thisObject = jsCast<JSServerWebSocket*>(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + if (JSValue cachedValue = thisObject->m_remoteAddress.get()) return JSValue::encode(cachedValue); - + JSC::JSValue result = JSC::JSValue::decode( - ServerWebSocketPrototype__getRemoteAddress(thisObject->wrapped(), globalObject)); + ServerWebSocketPrototype__getRemoteAddress(thisObject->wrapped(), globalObject) + ); RETURN_IF_EXCEPTION(throwScope, {}); thisObject->m_remoteAddress.set(vm, thisObject, result); RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); } -extern "C" void ServerWebSocketPrototype__remoteAddressSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast<JSServerWebSocket*>(JSValue::decode(thisValue)); - thisObject->m_remoteAddress.set(vm, thisObject, JSValue::decode(value)); -} -extern "C" EncodedJSValue ServerWebSocketPrototype__remoteAddressGetCachedValue(JSC::EncodedJSValue thisValue) -{ + extern "C" void ServerWebSocketPrototype__remoteAddressSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject *globalObject, JSC::EncodedJSValue value) + { + auto& vm = globalObject->vm(); + auto* thisObject = jsCast<JSServerWebSocket*>(JSValue::decode(thisValue)); + thisObject->m_remoteAddress.set(vm, thisObject, JSValue::decode(value)); + } + + extern "C" EncodedJSValue ServerWebSocketPrototype__remoteAddressGetCachedValue(JSC::EncodedJSValue thisValue) + { auto* thisObject = jsCast<JSServerWebSocket*>(JSValue::decode(thisValue)); return JSValue::encode(thisObject->m_remoteAddress.get()); -} + } + + -JSC_DEFINE_HOST_FUNCTION(ServerWebSocketPrototype__sendCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + JSC_DEFINE_HOST_FUNCTION(ServerWebSocketPrototype__sendCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - JSServerWebSocket* thisObject = jsDynamicCast<JSServerWebSocket*>(callFrame->thisValue()); + JSServerWebSocket* thisObject = jsDynamicCast<JSServerWebSocket*>(callFrame->thisValue()); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } + + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + + return ServerWebSocketPrototype__send(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(ServerWebSocketPrototype__sendBinaryCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return ServerWebSocketPrototype__send(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSServerWebSocket* thisObject = jsDynamicCast<JSServerWebSocket*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(ServerWebSocketPrototype__sendBinaryCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSServerWebSocket* thisObject = jsDynamicCast<JSServerWebSocket*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return ServerWebSocketPrototype__sendBinary(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(ServerWebSocketPrototype__sendTextCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return ServerWebSocketPrototype__sendBinary(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSServerWebSocket* thisObject = jsDynamicCast<JSServerWebSocket*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(ServerWebSocketPrototype__sendTextCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSServerWebSocket* thisObject = jsDynamicCast<JSServerWebSocket*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return ServerWebSocketPrototype__sendText(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(ServerWebSocketPrototype__subscribeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return ServerWebSocketPrototype__sendText(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSServerWebSocket* thisObject = jsDynamicCast<JSServerWebSocket*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(ServerWebSocketPrototype__subscribeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSServerWebSocket* thisObject = jsDynamicCast<JSServerWebSocket*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return ServerWebSocketPrototype__subscribe(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(ServerWebSocketPrototype__unsubscribeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return ServerWebSocketPrototype__subscribe(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSServerWebSocket* thisObject = jsDynamicCast<JSServerWebSocket*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(ServerWebSocketPrototype__unsubscribeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSServerWebSocket* thisObject = jsDynamicCast<JSServerWebSocket*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return ServerWebSocketPrototype__unsubscribe(thisObject->wrapped(), lexicalGlobalObject, callFrame); } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - return ServerWebSocketPrototype__unsubscribe(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + void JSServerWebSocketPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) { @@ -9965,64 +10751,67 @@ void JSServerWebSocketPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject void JSServerWebSocketConstructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSServerWebSocketPrototype* prototype) { Base::finishCreation(vm, 0, "ServerWebSocket"_s, PropertyAdditionMode::WithoutStructureTransition); - + putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly); ASSERT(inherits(info())); } -JSServerWebSocketConstructor::JSServerWebSocketConstructor(JSC::VM& vm, JSC::Structure* structure) - : Base(vm, structure, construct, construct) -{ -} +JSServerWebSocketConstructor::JSServerWebSocketConstructor(JSC::VM& vm, JSC::Structure* structure) : Base(vm, structure, construct, construct) { -JSServerWebSocketConstructor* JSServerWebSocketConstructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSServerWebSocketPrototype* prototype) -{ + } + +JSServerWebSocketConstructor* JSServerWebSocketConstructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSServerWebSocketPrototype* prototype) { JSServerWebSocketConstructor* ptr = new (NotNull, JSC::allocateCell<JSServerWebSocketConstructor>(vm)) JSServerWebSocketConstructor(vm, structure); ptr->finishCreation(vm, globalObject, prototype); return ptr; } + JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSServerWebSocketConstructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) { - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); - JSC::VM& vm = globalObject->vm(); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + JSC::VM &vm = globalObject->vm(); JSObject* newTarget = asObject(callFrame->newTarget()); auto* constructor = globalObject->JSServerWebSocketConstructor(); Structure* structure = globalObject->JSServerWebSocketStructure(); if (constructor != newTarget) { - auto scope = DECLARE_THROW_SCOPE(vm); + auto scope = DECLARE_THROW_SCOPE(vm); - auto* functionGlobalObject = reinterpret_cast<Zig::GlobalObject*>( - // ShadowRealm functions belong to a different global object. - getFunctionRealm(globalObject, newTarget)); - RETURN_IF_EXCEPTION(scope, {}); - structure = InternalFunction::createSubclassStructure( - globalObject, - newTarget, - functionGlobalObject->JSServerWebSocketStructure()); + auto* functionGlobalObject = reinterpret_cast<Zig::GlobalObject*>( + // ShadowRealm functions belong to a different global object. + getFunctionRealm(globalObject, newTarget) + ); + RETURN_IF_EXCEPTION(scope, {}); + structure = InternalFunction::createSubclassStructure( + globalObject, + newTarget, + functionGlobalObject->JSServerWebSocketStructure() + ); } void* ptr = ServerWebSocketClass__construct(globalObject, callFrame); if (UNLIKELY(!ptr)) { - return JSValue::encode(JSC::jsUndefined()); + return JSValue::encode(JSC::jsUndefined()); } JSServerWebSocket* instance = JSServerWebSocket::create(vm, globalObject, structure, ptr); + return JSValue::encode(instance); } void JSServerWebSocketConstructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSServerWebSocketPrototype* prototype) { + } const ClassInfo JSServerWebSocketConstructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSServerWebSocketConstructor) }; -extern "C" EncodedJSValue ServerWebSocket__getConstructor(Zig::GlobalObject* globalObject) -{ + + extern "C" EncodedJSValue ServerWebSocket__getConstructor(Zig::GlobalObject* globalObject) { return JSValue::encode(globalObject->JSServerWebSocketConstructor()); -} + } JSServerWebSocket::~JSServerWebSocket() { @@ -10034,7 +10823,7 @@ void JSServerWebSocket::destroy(JSCell* cell) { static_cast<JSServerWebSocket*>(cell)->JSServerWebSocket::~JSServerWebSocket(); } - + const ClassInfo JSServerWebSocket::s_info = { "ServerWebSocket"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSServerWebSocket) }; void JSServerWebSocket::finishCreation(VM& vm) @@ -10043,38 +10832,37 @@ void JSServerWebSocket::finishCreation(VM& vm) ASSERT(inherits(info())); } -JSServerWebSocket* JSServerWebSocket::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSServerWebSocket* ptr = new (NotNull, JSC::allocateCell<JSServerWebSocket>(vm)) JSServerWebSocket(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} -extern "C" void* ServerWebSocket__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; +JSServerWebSocket* JSServerWebSocket::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) { + JSServerWebSocket* ptr = new (NotNull, JSC::allocateCell<JSServerWebSocket>(vm)) JSServerWebSocket(vm, structure, ctx); + ptr->finishCreation(vm); + return ptr; +} - JSC::JSCell* cell = decodedValue.asCell(); - JSServerWebSocket* object = JSC::jsDynamicCast<JSServerWebSocket*>(cell); +extern "C" void* ServerWebSocket__fromJS(JSC::EncodedJSValue value) { + JSC::JSValue decodedValue = JSC::JSValue::decode(value); + if (decodedValue.isEmpty() || !decodedValue.isCell()) + return nullptr; - if (!object) - return nullptr; + JSC::JSCell* cell = decodedValue.asCell(); + JSServerWebSocket* object = JSC::jsDynamicCast<JSServerWebSocket*>(cell); - return object->wrapped(); + if (!object) + return nullptr; + + return object->wrapped(); } -extern "C" bool ServerWebSocket__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSServerWebSocket* object = JSC::jsDynamicCast<JSServerWebSocket*>(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; +extern "C" bool ServerWebSocket__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) { + JSServerWebSocket* object = JSC::jsDynamicCast<JSServerWebSocket*>(JSValue::decode(value)); + if (!object) + return false; + + object->m_ctx = ptr; + return true; } + extern "C" const size_t ServerWebSocket__ptrOffset = JSServerWebSocket::offsetOfWrapped(); void JSServerWebSocket::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) @@ -10089,7 +10877,7 @@ void JSServerWebSocket::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) JSObject* JSServerWebSocket::createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype) { - return WebCore::JSServerWebSocketConstructor::create(vm, globalObject, WebCore::JSServerWebSocketConstructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast<WebCore::JSServerWebSocketPrototype*>(prototype)); + return WebCore::JSServerWebSocketConstructor::create(vm, globalObject, WebCore::JSServerWebSocketConstructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast<WebCore::JSServerWebSocketPrototype*>(prototype)); } JSObject* JSServerWebSocket::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) @@ -10097,13 +10885,12 @@ JSObject* JSServerWebSocket::createPrototype(VM& vm, JSDOMGlobalObject* globalOb return JSServerWebSocketPrototype::create(vm, globalObject, JSServerWebSocketPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); } -extern "C" EncodedJSValue ServerWebSocket__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSServerWebSocketStructure(); - JSServerWebSocket* instance = JSServerWebSocket::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); +extern "C" EncodedJSValue ServerWebSocket__create(Zig::GlobalObject* globalObject, void* ptr) { + auto &vm = globalObject->vm(); + JSC::Structure* structure = globalObject->JSServerWebSocketStructure(); + JSServerWebSocket* instance = JSServerWebSocket::create(vm, globalObject, structure, ptr); + + return JSValue::encode(instance); } template<typename Visitor> @@ -10112,9 +10899,11 @@ void JSServerWebSocket::visitChildrenImpl(JSCell* cell, Visitor& visitor) JSServerWebSocket* thisObject = jsCast<JSServerWebSocket*>(cell); ASSERT_GC_OBJECT_INHERITS(thisObject, info()); Base::visitChildren(thisObject, visitor); - + + visitor.append(thisObject->m_data); visitor.append(thisObject->m_remoteAddress); + } DEFINE_VISIT_CHILDREN(JSServerWebSocket); @@ -10122,10 +10911,10 @@ DEFINE_VISIT_CHILDREN(JSServerWebSocket); template<typename Visitor> void JSServerWebSocket::visitAdditionalChildren(Visitor& visitor) { - JSServerWebSocket* thisObject = this; + JSServerWebSocket* thisObject = this; ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - - visitor.append(thisObject->m_data); + + visitor.append(thisObject->m_data); visitor.append(thisObject->m_remoteAddress); ; } @@ -10133,7 +10922,7 @@ void JSServerWebSocket::visitAdditionalChildren(Visitor& visitor) DEFINE_VISIT_ADDITIONAL_CHILDREN(JSServerWebSocket); template<typename Visitor> -void JSServerWebSocket::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) +void JSServerWebSocket::visitOutputConstraintsImpl(JSCell *cell, Visitor& visitor) { JSServerWebSocket* thisObject = jsCast<JSServerWebSocket*>(cell); ASSERT_GC_OBJECT_INHERITS(thisObject, info()); @@ -10141,121 +10930,135 @@ void JSServerWebSocket::visitOutputConstraintsImpl(JSCell* cell, Visitor& visito } DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSServerWebSocket); -class JSStatsPrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSStatsPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSStatsPrototype* ptr = new (NotNull, JSC::allocateCell<JSStatsPrototype>(vm)) JSStatsPrototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template<typename CellType, JSC::SubspaceAccess> - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSStatsPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; + class JSStatsPrototype final : public JSC::JSNonFinalObject { + public: + using Base = JSC::JSNonFinalObject; + + static JSStatsPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) + { + JSStatsPrototype* ptr = new (NotNull, JSC::allocateCell<JSStatsPrototype>(vm)) JSStatsPrototype(vm, globalObject, structure); + ptr->finishCreation(vm, globalObject); + return ptr; + } + + DECLARE_INFO; + template<typename CellType, JSC::SubspaceAccess> + static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + return &vm.plainObjectSpace(); + } + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); + } + + private: + JSStatsPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) + : Base(vm, structure) + { + } + + void finishCreation(JSC::VM&, JSC::JSGlobalObject*); + }; class JSStatsConstructor final : public JSC::InternalFunction { -public: - using Base = JSC::InternalFunction; - static JSStatsConstructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSStatsPrototype* prototype); + public: + using Base = JSC::InternalFunction; + static JSStatsConstructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSStatsPrototype* prototype); + + static constexpr unsigned StructureFlags = Base::StructureFlags; + static constexpr bool needsDestruction = false; + + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); + } + + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return WebCore::subspaceForImpl<JSStatsConstructor, WebCore::UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForStatsConstructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForStatsConstructor = std::forward<decltype(space)>(space); }, + [](auto& spaces) { return spaces.m_subspaceForStatsConstructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForStatsConstructor = std::forward<decltype(space)>(space); }); + } + + + void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSStatsPrototype* prototype); + + // Must be defined for each specialization class. + static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); + + DECLARE_EXPORT_INFO; + private: + JSStatsConstructor(JSC::VM& vm, JSC::Structure* structure); + void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSStatsPrototype* prototype); + }; - static constexpr unsigned StructureFlags = Base::StructureFlags; - static constexpr bool needsDestruction = false; - - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); - } - - template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl<JSStatsConstructor, WebCore::UseCustomHeapCellType::No>( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForStatsConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForStatsConstructor = std::forward<decltype(space)>(space); }, - [](auto& spaces) { return spaces.m_subspaceForStatsConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForStatsConstructor = std::forward<decltype(space)>(space); }); - } - - void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSStatsPrototype* prototype); - - // Must be defined for each specialization class. - static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); - - DECLARE_EXPORT_INFO; - -private: - JSStatsConstructor(JSC::VM& vm, JSC::Structure* structure); - void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSStatsPrototype* prototype); -}; extern "C" void* StatsClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); JSC_DECLARE_CUSTOM_GETTER(jsStatsConstructor); extern "C" void StatsClass__finalize(void*); + extern "C" JSC::EncodedJSValue StatsPrototype__atime(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(StatsPrototype__atimeGetterWrap); + extern "C" JSC::EncodedJSValue StatsPrototype__atimeMs(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(StatsPrototype__atimeMsGetterWrap); + extern "C" JSC::EncodedJSValue StatsPrototype__birthtime(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(StatsPrototype__birthtimeGetterWrap); + extern "C" JSC::EncodedJSValue StatsPrototype__birthtimeMs(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(StatsPrototype__birthtimeMsGetterWrap); + extern "C" JSC::EncodedJSValue StatsPrototype__blksize(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(StatsPrototype__blksizeGetterWrap); + extern "C" JSC::EncodedJSValue StatsPrototype__blocks(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(StatsPrototype__blocksGetterWrap); + extern "C" JSC::EncodedJSValue StatsPrototype__ctime(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(StatsPrototype__ctimeGetterWrap); + extern "C" JSC::EncodedJSValue StatsPrototype__ctimeMs(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(StatsPrototype__ctimeMsGetterWrap); + extern "C" JSC::EncodedJSValue StatsPrototype__dev(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(StatsPrototype__devGetterWrap); + extern "C" JSC::EncodedJSValue StatsPrototype__gid(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(StatsPrototype__gidGetterWrap); + extern "C" JSC::EncodedJSValue StatsPrototype__ino(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(StatsPrototype__inoGetterWrap); + extern "C" EncodedJSValue StatsPrototype__isBlockDevice_(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(StatsPrototype__isBlockDeviceCallback); + extern "C" JSC_DECLARE_JIT_OPERATION_WITHOUT_WTF_INTERNAL(StatsPrototype__isBlockDeviceWithoutTypeChecksWrapper, EncodedJSValue, (JSC::JSGlobalObject * lexicalGlobalObject, void* thisValue)); -extern "C" EncodedJSValue StatsPrototype__isBlockDevice_WithoutTypeChecks(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); + extern "C" EncodedJSValue StatsPrototype__isBlockDevice_WithoutTypeChecks(void* ptr, JSC::JSGlobalObject * lexicalGlobalObject); -static const JSC::DOMJIT::Signature DOMJITSignatureForStatsPrototype__isBlockDevice(StatsPrototype__isBlockDeviceWithoutTypeChecksWrapper, - JSStats::info(), - JSC::DOMJIT::Effect::forPure(), - JSC::SpecHeapTop); + static const JSC::DOMJIT::Signature DOMJITSignatureForStatsPrototype__isBlockDevice(StatsPrototype__isBlockDeviceWithoutTypeChecksWrapper, + JSStats::info(), + JSC::DOMJIT::Effect::forPure(), + JSC::SpecHeapTop); JSC_DEFINE_JIT_OPERATION(StatsPrototype__isBlockDeviceWithoutTypeChecksWrapper, EncodedJSValue, (JSC::JSGlobalObject * lexicalGlobalObject, void* thisValue)) { @@ -10270,13 +11073,14 @@ JSC_DEFINE_JIT_OPERATION(StatsPrototype__isBlockDeviceWithoutTypeChecksWrapper, extern "C" EncodedJSValue StatsPrototype__isCharacterDevice_(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(StatsPrototype__isCharacterDeviceCallback); + extern "C" JSC_DECLARE_JIT_OPERATION_WITHOUT_WTF_INTERNAL(StatsPrototype__isCharacterDeviceWithoutTypeChecksWrapper, EncodedJSValue, (JSC::JSGlobalObject * lexicalGlobalObject, void* thisValue)); -extern "C" EncodedJSValue StatsPrototype__isCharacterDevice_WithoutTypeChecks(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); + extern "C" EncodedJSValue StatsPrototype__isCharacterDevice_WithoutTypeChecks(void* ptr, JSC::JSGlobalObject * lexicalGlobalObject); -static const JSC::DOMJIT::Signature DOMJITSignatureForStatsPrototype__isCharacterDevice(StatsPrototype__isCharacterDeviceWithoutTypeChecksWrapper, - JSStats::info(), - JSC::DOMJIT::Effect::forPure(), - JSC::SpecHeapTop); + static const JSC::DOMJIT::Signature DOMJITSignatureForStatsPrototype__isCharacterDevice(StatsPrototype__isCharacterDeviceWithoutTypeChecksWrapper, + JSStats::info(), + JSC::DOMJIT::Effect::forPure(), + JSC::SpecHeapTop); JSC_DEFINE_JIT_OPERATION(StatsPrototype__isCharacterDeviceWithoutTypeChecksWrapper, EncodedJSValue, (JSC::JSGlobalObject * lexicalGlobalObject, void* thisValue)) { @@ -10291,13 +11095,14 @@ JSC_DEFINE_JIT_OPERATION(StatsPrototype__isCharacterDeviceWithoutTypeChecksWrapp extern "C" EncodedJSValue StatsPrototype__isDirectory_(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(StatsPrototype__isDirectoryCallback); + extern "C" JSC_DECLARE_JIT_OPERATION_WITHOUT_WTF_INTERNAL(StatsPrototype__isDirectoryWithoutTypeChecksWrapper, EncodedJSValue, (JSC::JSGlobalObject * lexicalGlobalObject, void* thisValue)); -extern "C" EncodedJSValue StatsPrototype__isDirectory_WithoutTypeChecks(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); + extern "C" EncodedJSValue StatsPrototype__isDirectory_WithoutTypeChecks(void* ptr, JSC::JSGlobalObject * lexicalGlobalObject); -static const JSC::DOMJIT::Signature DOMJITSignatureForStatsPrototype__isDirectory(StatsPrototype__isDirectoryWithoutTypeChecksWrapper, - JSStats::info(), - JSC::DOMJIT::Effect::forPure(), - JSC::SpecHeapTop); + static const JSC::DOMJIT::Signature DOMJITSignatureForStatsPrototype__isDirectory(StatsPrototype__isDirectoryWithoutTypeChecksWrapper, + JSStats::info(), + JSC::DOMJIT::Effect::forPure(), + JSC::SpecHeapTop); JSC_DEFINE_JIT_OPERATION(StatsPrototype__isDirectoryWithoutTypeChecksWrapper, EncodedJSValue, (JSC::JSGlobalObject * lexicalGlobalObject, void* thisValue)) { @@ -10312,13 +11117,14 @@ JSC_DEFINE_JIT_OPERATION(StatsPrototype__isDirectoryWithoutTypeChecksWrapper, En extern "C" EncodedJSValue StatsPrototype__isFIFO_(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(StatsPrototype__isFIFOCallback); + extern "C" JSC_DECLARE_JIT_OPERATION_WITHOUT_WTF_INTERNAL(StatsPrototype__isFIFOWithoutTypeChecksWrapper, EncodedJSValue, (JSC::JSGlobalObject * lexicalGlobalObject, void* thisValue)); -extern "C" EncodedJSValue StatsPrototype__isFIFO_WithoutTypeChecks(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); + extern "C" EncodedJSValue StatsPrototype__isFIFO_WithoutTypeChecks(void* ptr, JSC::JSGlobalObject * lexicalGlobalObject); -static const JSC::DOMJIT::Signature DOMJITSignatureForStatsPrototype__isFIFO(StatsPrototype__isFIFOWithoutTypeChecksWrapper, - JSStats::info(), - JSC::DOMJIT::Effect::forPure(), - JSC::SpecHeapTop); + static const JSC::DOMJIT::Signature DOMJITSignatureForStatsPrototype__isFIFO(StatsPrototype__isFIFOWithoutTypeChecksWrapper, + JSStats::info(), + JSC::DOMJIT::Effect::forPure(), + JSC::SpecHeapTop); JSC_DEFINE_JIT_OPERATION(StatsPrototype__isFIFOWithoutTypeChecksWrapper, EncodedJSValue, (JSC::JSGlobalObject * lexicalGlobalObject, void* thisValue)) { @@ -10333,13 +11139,14 @@ JSC_DEFINE_JIT_OPERATION(StatsPrototype__isFIFOWithoutTypeChecksWrapper, Encoded extern "C" EncodedJSValue StatsPrototype__isFile_(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(StatsPrototype__isFileCallback); + extern "C" JSC_DECLARE_JIT_OPERATION_WITHOUT_WTF_INTERNAL(StatsPrototype__isFileWithoutTypeChecksWrapper, EncodedJSValue, (JSC::JSGlobalObject * lexicalGlobalObject, void* thisValue)); -extern "C" EncodedJSValue StatsPrototype__isFile_WithoutTypeChecks(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); + extern "C" EncodedJSValue StatsPrototype__isFile_WithoutTypeChecks(void* ptr, JSC::JSGlobalObject * lexicalGlobalObject); -static const JSC::DOMJIT::Signature DOMJITSignatureForStatsPrototype__isFile(StatsPrototype__isFileWithoutTypeChecksWrapper, - JSStats::info(), - JSC::DOMJIT::Effect::forPure(), - JSC::SpecHeapTop); + static const JSC::DOMJIT::Signature DOMJITSignatureForStatsPrototype__isFile(StatsPrototype__isFileWithoutTypeChecksWrapper, + JSStats::info(), + JSC::DOMJIT::Effect::forPure(), + JSC::SpecHeapTop); JSC_DEFINE_JIT_OPERATION(StatsPrototype__isFileWithoutTypeChecksWrapper, EncodedJSValue, (JSC::JSGlobalObject * lexicalGlobalObject, void* thisValue)) { @@ -10354,13 +11161,14 @@ JSC_DEFINE_JIT_OPERATION(StatsPrototype__isFileWithoutTypeChecksWrapper, Encoded extern "C" EncodedJSValue StatsPrototype__isSocket_(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(StatsPrototype__isSocketCallback); + extern "C" JSC_DECLARE_JIT_OPERATION_WITHOUT_WTF_INTERNAL(StatsPrototype__isSocketWithoutTypeChecksWrapper, EncodedJSValue, (JSC::JSGlobalObject * lexicalGlobalObject, void* thisValue)); -extern "C" EncodedJSValue StatsPrototype__isSocket_WithoutTypeChecks(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); + extern "C" EncodedJSValue StatsPrototype__isSocket_WithoutTypeChecks(void* ptr, JSC::JSGlobalObject * lexicalGlobalObject); -static const JSC::DOMJIT::Signature DOMJITSignatureForStatsPrototype__isSocket(StatsPrototype__isSocketWithoutTypeChecksWrapper, - JSStats::info(), - JSC::DOMJIT::Effect::forPure(), - JSC::SpecHeapTop); + static const JSC::DOMJIT::Signature DOMJITSignatureForStatsPrototype__isSocket(StatsPrototype__isSocketWithoutTypeChecksWrapper, + JSStats::info(), + JSC::DOMJIT::Effect::forPure(), + JSC::SpecHeapTop); JSC_DEFINE_JIT_OPERATION(StatsPrototype__isSocketWithoutTypeChecksWrapper, EncodedJSValue, (JSC::JSGlobalObject * lexicalGlobalObject, void* thisValue)) { @@ -10375,13 +11183,14 @@ JSC_DEFINE_JIT_OPERATION(StatsPrototype__isSocketWithoutTypeChecksWrapper, Encod extern "C" EncodedJSValue StatsPrototype__isSymbolicLink_(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(StatsPrototype__isSymbolicLinkCallback); + extern "C" JSC_DECLARE_JIT_OPERATION_WITHOUT_WTF_INTERNAL(StatsPrototype__isSymbolicLinkWithoutTypeChecksWrapper, EncodedJSValue, (JSC::JSGlobalObject * lexicalGlobalObject, void* thisValue)); -extern "C" EncodedJSValue StatsPrototype__isSymbolicLink_WithoutTypeChecks(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); + extern "C" EncodedJSValue StatsPrototype__isSymbolicLink_WithoutTypeChecks(void* ptr, JSC::JSGlobalObject * lexicalGlobalObject); -static const JSC::DOMJIT::Signature DOMJITSignatureForStatsPrototype__isSymbolicLink(StatsPrototype__isSymbolicLinkWithoutTypeChecksWrapper, - JSStats::info(), - JSC::DOMJIT::Effect::forPure(), - JSC::SpecHeapTop); + static const JSC::DOMJIT::Signature DOMJITSignatureForStatsPrototype__isSymbolicLink(StatsPrototype__isSymbolicLinkWithoutTypeChecksWrapper, + JSStats::info(), + JSC::DOMJIT::Effect::forPure(), + JSC::SpecHeapTop); JSC_DEFINE_JIT_OPERATION(StatsPrototype__isSymbolicLinkWithoutTypeChecksWrapper, EncodedJSValue, (JSC::JSGlobalObject * lexicalGlobalObject, void* thisValue)) { @@ -10396,56 +11205,68 @@ JSC_DEFINE_JIT_OPERATION(StatsPrototype__isSymbolicLinkWithoutTypeChecksWrapper, extern "C" JSC::EncodedJSValue StatsPrototype__mode(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(StatsPrototype__modeGetterWrap); + extern "C" JSC::EncodedJSValue StatsPrototype__mtime(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(StatsPrototype__mtimeGetterWrap); + extern "C" JSC::EncodedJSValue StatsPrototype__mtimeMs(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(StatsPrototype__mtimeMsGetterWrap); + extern "C" JSC::EncodedJSValue StatsPrototype__nlink(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(StatsPrototype__nlinkGetterWrap); + extern "C" JSC::EncodedJSValue StatsPrototype__rdev(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(StatsPrototype__rdevGetterWrap); + extern "C" JSC::EncodedJSValue StatsPrototype__size(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(StatsPrototype__sizeGetterWrap); + extern "C" JSC::EncodedJSValue StatsPrototype__uid(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(StatsPrototype__uidGetterWrap); + STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSStatsPrototype, JSStatsPrototype::Base); -static const HashTableValue JSStatsPrototypeTableValues[] = { - { "atime"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, StatsPrototype__atimeGetterWrap, 0 } }, - { "atimeMs"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, StatsPrototype__atimeMsGetterWrap, 0 } }, - { "birthtime"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, StatsPrototype__birthtimeGetterWrap, 0 } }, - { "birthtimeMs"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, StatsPrototype__birthtimeMsGetterWrap, 0 } }, - { "blksize"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, StatsPrototype__blksizeGetterWrap, 0 } }, - { "blocks"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, StatsPrototype__blocksGetterWrap, 0 } }, - { "ctime"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, StatsPrototype__ctimeGetterWrap, 0 } }, - { "ctimeMs"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, StatsPrototype__ctimeMsGetterWrap, 0 } }, - { "dev"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, StatsPrototype__devGetterWrap, 0 } }, - { "gid"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, StatsPrototype__gidGetterWrap, 0 } }, - { "ino"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, StatsPrototype__inoGetterWrap, 0 } }, - { "isBlockDevice"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | JSC::PropertyAttribute::DOMJITFunction | PropertyAttribute::DontEnum | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::DOMJITFunctionType, StatsPrototype__isBlockDeviceCallback, &DOMJITSignatureForStatsPrototype__isBlockDevice } }, - { "isCharacterDevice"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | JSC::PropertyAttribute::DOMJITFunction | PropertyAttribute::DontEnum | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::DOMJITFunctionType, StatsPrototype__isCharacterDeviceCallback, &DOMJITSignatureForStatsPrototype__isCharacterDevice } }, - { "isDirectory"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | JSC::PropertyAttribute::DOMJITFunction | PropertyAttribute::DontEnum | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::DOMJITFunctionType, StatsPrototype__isDirectoryCallback, &DOMJITSignatureForStatsPrototype__isDirectory } }, - { "isFIFO"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | JSC::PropertyAttribute::DOMJITFunction | PropertyAttribute::DontEnum | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::DOMJITFunctionType, StatsPrototype__isFIFOCallback, &DOMJITSignatureForStatsPrototype__isFIFO } }, - { "isFile"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | JSC::PropertyAttribute::DOMJITFunction | PropertyAttribute::DontEnum | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::DOMJITFunctionType, StatsPrototype__isFileCallback, &DOMJITSignatureForStatsPrototype__isFile } }, - { "isSocket"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | JSC::PropertyAttribute::DOMJITFunction | PropertyAttribute::DontEnum | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::DOMJITFunctionType, StatsPrototype__isSocketCallback, &DOMJITSignatureForStatsPrototype__isSocket } }, - { "isSymbolicLink"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | JSC::PropertyAttribute::DOMJITFunction | PropertyAttribute::DontEnum | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::DOMJITFunctionType, StatsPrototype__isSymbolicLinkCallback, &DOMJITSignatureForStatsPrototype__isSymbolicLink } }, - { "mode"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, StatsPrototype__modeGetterWrap, 0 } }, - { "mtime"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, StatsPrototype__mtimeGetterWrap, 0 } }, - { "mtimeMs"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, StatsPrototype__mtimeMsGetterWrap, 0 } }, - { "nlink"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, StatsPrototype__nlinkGetterWrap, 0 } }, - { "rdev"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, StatsPrototype__rdevGetterWrap, 0 } }, - { "size"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, StatsPrototype__sizeGetterWrap, 0 } }, - { "uid"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, StatsPrototype__uidGetterWrap, 0 } } + + static const HashTableValue JSStatsPrototypeTableValues[] = { +{ "atime"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, StatsPrototype__atimeGetterWrap, 0 } } , +{ "atimeMs"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, StatsPrototype__atimeMsGetterWrap, 0 } } , +{ "birthtime"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, StatsPrototype__birthtimeGetterWrap, 0 } } , +{ "birthtimeMs"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, StatsPrototype__birthtimeMsGetterWrap, 0 } } , +{ "blksize"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, StatsPrototype__blksizeGetterWrap, 0 } } , +{ "blocks"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, StatsPrototype__blocksGetterWrap, 0 } } , +{ "ctime"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, StatsPrototype__ctimeGetterWrap, 0 } } , +{ "ctimeMs"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, StatsPrototype__ctimeMsGetterWrap, 0 } } , +{ "dev"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, StatsPrototype__devGetterWrap, 0 } } , +{ "gid"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, StatsPrototype__gidGetterWrap, 0 } } , +{ "ino"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, StatsPrototype__inoGetterWrap, 0 } } , +{ "isBlockDevice"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | JSC::PropertyAttribute::DOMJITFunction | PropertyAttribute::DontEnum | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::DOMJITFunctionType, StatsPrototype__isBlockDeviceCallback, &DOMJITSignatureForStatsPrototype__isBlockDevice } } , +{ "isCharacterDevice"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | JSC::PropertyAttribute::DOMJITFunction | PropertyAttribute::DontEnum | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::DOMJITFunctionType, StatsPrototype__isCharacterDeviceCallback, &DOMJITSignatureForStatsPrototype__isCharacterDevice } } , +{ "isDirectory"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | JSC::PropertyAttribute::DOMJITFunction | PropertyAttribute::DontEnum | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::DOMJITFunctionType, StatsPrototype__isDirectoryCallback, &DOMJITSignatureForStatsPrototype__isDirectory } } , +{ "isFIFO"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | JSC::PropertyAttribute::DOMJITFunction | PropertyAttribute::DontEnum | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::DOMJITFunctionType, StatsPrototype__isFIFOCallback, &DOMJITSignatureForStatsPrototype__isFIFO } } , +{ "isFile"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | JSC::PropertyAttribute::DOMJITFunction | PropertyAttribute::DontEnum | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::DOMJITFunctionType, StatsPrototype__isFileCallback, &DOMJITSignatureForStatsPrototype__isFile } } , +{ "isSocket"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | JSC::PropertyAttribute::DOMJITFunction | PropertyAttribute::DontEnum | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::DOMJITFunctionType, StatsPrototype__isSocketCallback, &DOMJITSignatureForStatsPrototype__isSocket } } , +{ "isSymbolicLink"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | JSC::PropertyAttribute::DOMJITFunction | PropertyAttribute::DontEnum | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::DOMJITFunctionType, StatsPrototype__isSymbolicLinkCallback, &DOMJITSignatureForStatsPrototype__isSymbolicLink } } , +{ "mode"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, StatsPrototype__modeGetterWrap, 0 } } , +{ "mtime"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, StatsPrototype__mtimeGetterWrap, 0 } } , +{ "mtimeMs"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, StatsPrototype__mtimeMsGetterWrap, 0 } } , +{ "nlink"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, StatsPrototype__nlinkGetterWrap, 0 } } , +{ "rdev"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, StatsPrototype__rdevGetterWrap, 0 } } , +{ "size"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, StatsPrototype__sizeGetterWrap, 0 } } , +{ "uid"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, StatsPrototype__uidGetterWrap, 0 } } }; + + const ClassInfo JSStatsPrototype::s_info = { "Stats"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSStatsPrototype) }; + + JSC_DEFINE_CUSTOM_GETTER(jsStatsConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); @@ -10456,43 +11277,49 @@ JSC_DEFINE_CUSTOM_GETTER(jsStatsConstructor, (JSGlobalObject * lexicalGlobalObje if (UNLIKELY(!prototype)) return throwVMTypeError(lexicalGlobalObject, throwScope); return JSValue::encode(globalObject->JSStatsConstructor()); -} +} + + JSC_DEFINE_CUSTOM_GETTER(StatsPrototype__atimeGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSStats* thisObject = jsCast<JSStats*>(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + if (JSValue cachedValue = thisObject->m_atime.get()) return JSValue::encode(cachedValue); - + JSC::JSValue result = JSC::JSValue::decode( - StatsPrototype__atime(thisObject->wrapped(), globalObject)); + StatsPrototype__atime(thisObject->wrapped(), globalObject) + ); RETURN_IF_EXCEPTION(throwScope, {}); thisObject->m_atime.set(vm, thisObject, result); RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); } -extern "C" void StatsPrototype__atimeSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast<JSStats*>(JSValue::decode(thisValue)); - thisObject->m_atime.set(vm, thisObject, JSValue::decode(value)); -} -extern "C" EncodedJSValue StatsPrototype__atimeGetCachedValue(JSC::EncodedJSValue thisValue) -{ + extern "C" void StatsPrototype__atimeSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject *globalObject, JSC::EncodedJSValue value) + { + auto& vm = globalObject->vm(); + auto* thisObject = jsCast<JSStats*>(JSValue::decode(thisValue)); + thisObject->m_atime.set(vm, thisObject, JSValue::decode(value)); + } + + extern "C" EncodedJSValue StatsPrototype__atimeGetCachedValue(JSC::EncodedJSValue thisValue) + { auto* thisObject = jsCast<JSStats*>(JSValue::decode(thisValue)); return JSValue::encode(thisObject->m_atime.get()); -} + } + + JSC_DEFINE_CUSTOM_GETTER(StatsPrototype__atimeMsGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSStats* thisObject = jsCast<JSStats*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -10500,11 +11327,12 @@ JSC_DEFINE_CUSTOM_GETTER(StatsPrototype__atimeMsGetterWrap, (JSGlobalObject * le RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + JSC_DEFINE_CUSTOM_GETTER(StatsPrototype__birthtimeGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSStats* thisObject = jsCast<JSStats*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -10512,11 +11340,12 @@ JSC_DEFINE_CUSTOM_GETTER(StatsPrototype__birthtimeGetterWrap, (JSGlobalObject * RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + JSC_DEFINE_CUSTOM_GETTER(StatsPrototype__birthtimeMsGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSStats* thisObject = jsCast<JSStats*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -10524,11 +11353,12 @@ JSC_DEFINE_CUSTOM_GETTER(StatsPrototype__birthtimeMsGetterWrap, (JSGlobalObject RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + JSC_DEFINE_CUSTOM_GETTER(StatsPrototype__blksizeGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSStats* thisObject = jsCast<JSStats*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -10536,11 +11366,12 @@ JSC_DEFINE_CUSTOM_GETTER(StatsPrototype__blksizeGetterWrap, (JSGlobalObject * le RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + JSC_DEFINE_CUSTOM_GETTER(StatsPrototype__blocksGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSStats* thisObject = jsCast<JSStats*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -10548,42 +11379,47 @@ JSC_DEFINE_CUSTOM_GETTER(StatsPrototype__blocksGetterWrap, (JSGlobalObject * lex RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + JSC_DEFINE_CUSTOM_GETTER(StatsPrototype__ctimeGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSStats* thisObject = jsCast<JSStats*>(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + if (JSValue cachedValue = thisObject->m_ctime.get()) return JSValue::encode(cachedValue); - + JSC::JSValue result = JSC::JSValue::decode( - StatsPrototype__ctime(thisObject->wrapped(), globalObject)); + StatsPrototype__ctime(thisObject->wrapped(), globalObject) + ); RETURN_IF_EXCEPTION(throwScope, {}); thisObject->m_ctime.set(vm, thisObject, result); RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); } -extern "C" void StatsPrototype__ctimeSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast<JSStats*>(JSValue::decode(thisValue)); - thisObject->m_ctime.set(vm, thisObject, JSValue::decode(value)); -} -extern "C" EncodedJSValue StatsPrototype__ctimeGetCachedValue(JSC::EncodedJSValue thisValue) -{ + extern "C" void StatsPrototype__ctimeSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject *globalObject, JSC::EncodedJSValue value) + { + auto& vm = globalObject->vm(); + auto* thisObject = jsCast<JSStats*>(JSValue::decode(thisValue)); + thisObject->m_ctime.set(vm, thisObject, JSValue::decode(value)); + } + + extern "C" EncodedJSValue StatsPrototype__ctimeGetCachedValue(JSC::EncodedJSValue thisValue) + { auto* thisObject = jsCast<JSStats*>(JSValue::decode(thisValue)); return JSValue::encode(thisObject->m_ctime.get()); -} + } + + JSC_DEFINE_CUSTOM_GETTER(StatsPrototype__ctimeMsGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSStats* thisObject = jsCast<JSStats*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -10591,11 +11427,12 @@ JSC_DEFINE_CUSTOM_GETTER(StatsPrototype__ctimeMsGetterWrap, (JSGlobalObject * le RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + JSC_DEFINE_CUSTOM_GETTER(StatsPrototype__devGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSStats* thisObject = jsCast<JSStats*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -10603,11 +11440,12 @@ JSC_DEFINE_CUSTOM_GETTER(StatsPrototype__devGetterWrap, (JSGlobalObject * lexica RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + JSC_DEFINE_CUSTOM_GETTER(StatsPrototype__gidGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSStats* thisObject = jsCast<JSStats*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -10615,11 +11453,12 @@ JSC_DEFINE_CUSTOM_GETTER(StatsPrototype__gidGetterWrap, (JSGlobalObject * lexica RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + JSC_DEFINE_CUSTOM_GETTER(StatsPrototype__inoGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSStats* thisObject = jsCast<JSStats*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -10627,123 +11466,131 @@ JSC_DEFINE_CUSTOM_GETTER(StatsPrototype__inoGetterWrap, (JSGlobalObject * lexica RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + -JSC_DEFINE_HOST_FUNCTION(StatsPrototype__isBlockDeviceCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + JSC_DEFINE_HOST_FUNCTION(StatsPrototype__isBlockDeviceCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - JSStats* thisObject = jsDynamicCast<JSStats*>(callFrame->thisValue()); + JSStats* thisObject = jsDynamicCast<JSStats*>(callFrame->thisValue()); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } + + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + + return StatsPrototype__isBlockDevice_(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(StatsPrototype__isCharacterDeviceCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return StatsPrototype__isBlockDevice_(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSStats* thisObject = jsDynamicCast<JSStats*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(StatsPrototype__isCharacterDeviceCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSStats* thisObject = jsDynamicCast<JSStats*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return StatsPrototype__isCharacterDevice_(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(StatsPrototype__isDirectoryCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return StatsPrototype__isCharacterDevice_(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSStats* thisObject = jsDynamicCast<JSStats*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(StatsPrototype__isDirectoryCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSStats* thisObject = jsDynamicCast<JSStats*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return StatsPrototype__isDirectory_(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(StatsPrototype__isFIFOCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return StatsPrototype__isDirectory_(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSStats* thisObject = jsDynamicCast<JSStats*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(StatsPrototype__isFIFOCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSStats* thisObject = jsDynamicCast<JSStats*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return StatsPrototype__isFIFO_(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(StatsPrototype__isFileCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return StatsPrototype__isFIFO_(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSStats* thisObject = jsDynamicCast<JSStats*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(StatsPrototype__isFileCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSStats* thisObject = jsDynamicCast<JSStats*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return StatsPrototype__isFile_(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(StatsPrototype__isSocketCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return StatsPrototype__isFile_(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSStats* thisObject = jsDynamicCast<JSStats*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(StatsPrototype__isSocketCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSStats* thisObject = jsDynamicCast<JSStats*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return StatsPrototype__isSocket_(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(StatsPrototype__isSymbolicLinkCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return StatsPrototype__isSocket_(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSStats* thisObject = jsDynamicCast<JSStats*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(StatsPrototype__isSymbolicLinkCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSStats* thisObject = jsDynamicCast<JSStats*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return StatsPrototype__isSymbolicLink_(thisObject->wrapped(), lexicalGlobalObject, callFrame); } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - return StatsPrototype__isSymbolicLink_(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSC_DEFINE_CUSTOM_GETTER(StatsPrototype__modeGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSStats* thisObject = jsCast<JSStats*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -10751,42 +11598,47 @@ JSC_DEFINE_CUSTOM_GETTER(StatsPrototype__modeGetterWrap, (JSGlobalObject * lexic RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + JSC_DEFINE_CUSTOM_GETTER(StatsPrototype__mtimeGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSStats* thisObject = jsCast<JSStats*>(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + if (JSValue cachedValue = thisObject->m_mtime.get()) return JSValue::encode(cachedValue); - + JSC::JSValue result = JSC::JSValue::decode( - StatsPrototype__mtime(thisObject->wrapped(), globalObject)); + StatsPrototype__mtime(thisObject->wrapped(), globalObject) + ); RETURN_IF_EXCEPTION(throwScope, {}); thisObject->m_mtime.set(vm, thisObject, result); RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); } -extern "C" void StatsPrototype__mtimeSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast<JSStats*>(JSValue::decode(thisValue)); - thisObject->m_mtime.set(vm, thisObject, JSValue::decode(value)); -} -extern "C" EncodedJSValue StatsPrototype__mtimeGetCachedValue(JSC::EncodedJSValue thisValue) -{ + extern "C" void StatsPrototype__mtimeSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject *globalObject, JSC::EncodedJSValue value) + { + auto& vm = globalObject->vm(); + auto* thisObject = jsCast<JSStats*>(JSValue::decode(thisValue)); + thisObject->m_mtime.set(vm, thisObject, JSValue::decode(value)); + } + + extern "C" EncodedJSValue StatsPrototype__mtimeGetCachedValue(JSC::EncodedJSValue thisValue) + { auto* thisObject = jsCast<JSStats*>(JSValue::decode(thisValue)); return JSValue::encode(thisObject->m_mtime.get()); -} + } + + JSC_DEFINE_CUSTOM_GETTER(StatsPrototype__mtimeMsGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSStats* thisObject = jsCast<JSStats*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -10794,11 +11646,12 @@ JSC_DEFINE_CUSTOM_GETTER(StatsPrototype__mtimeMsGetterWrap, (JSGlobalObject * le RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + JSC_DEFINE_CUSTOM_GETTER(StatsPrototype__nlinkGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSStats* thisObject = jsCast<JSStats*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -10806,11 +11659,12 @@ JSC_DEFINE_CUSTOM_GETTER(StatsPrototype__nlinkGetterWrap, (JSGlobalObject * lexi RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + JSC_DEFINE_CUSTOM_GETTER(StatsPrototype__rdevGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSStats* thisObject = jsCast<JSStats*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -10818,11 +11672,12 @@ JSC_DEFINE_CUSTOM_GETTER(StatsPrototype__rdevGetterWrap, (JSGlobalObject * lexic RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + JSC_DEFINE_CUSTOM_GETTER(StatsPrototype__sizeGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSStats* thisObject = jsCast<JSStats*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -10830,11 +11685,12 @@ JSC_DEFINE_CUSTOM_GETTER(StatsPrototype__sizeGetterWrap, (JSGlobalObject * lexic RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + JSC_DEFINE_CUSTOM_GETTER(StatsPrototype__uidGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSStats* thisObject = jsCast<JSStats*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -10842,6 +11698,7 @@ JSC_DEFINE_CUSTOM_GETTER(StatsPrototype__uidGetterWrap, (JSGlobalObject * lexica RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + void JSStatsPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) { @@ -10853,64 +11710,67 @@ void JSStatsPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalOb void JSStatsConstructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSStatsPrototype* prototype) { Base::finishCreation(vm, 0, "Stats"_s, PropertyAdditionMode::WithoutStructureTransition); - + putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly); ASSERT(inherits(info())); } -JSStatsConstructor::JSStatsConstructor(JSC::VM& vm, JSC::Structure* structure) - : Base(vm, structure, construct, construct) -{ -} +JSStatsConstructor::JSStatsConstructor(JSC::VM& vm, JSC::Structure* structure) : Base(vm, structure, construct, construct) { -JSStatsConstructor* JSStatsConstructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSStatsPrototype* prototype) -{ + } + +JSStatsConstructor* JSStatsConstructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSStatsPrototype* prototype) { JSStatsConstructor* ptr = new (NotNull, JSC::allocateCell<JSStatsConstructor>(vm)) JSStatsConstructor(vm, structure); ptr->finishCreation(vm, globalObject, prototype); return ptr; } + JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSStatsConstructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) { - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); - JSC::VM& vm = globalObject->vm(); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + JSC::VM &vm = globalObject->vm(); JSObject* newTarget = asObject(callFrame->newTarget()); auto* constructor = globalObject->JSStatsConstructor(); Structure* structure = globalObject->JSStatsStructure(); if (constructor != newTarget) { - auto scope = DECLARE_THROW_SCOPE(vm); + auto scope = DECLARE_THROW_SCOPE(vm); - auto* functionGlobalObject = reinterpret_cast<Zig::GlobalObject*>( - // ShadowRealm functions belong to a different global object. - getFunctionRealm(globalObject, newTarget)); - RETURN_IF_EXCEPTION(scope, {}); - structure = InternalFunction::createSubclassStructure( - globalObject, - newTarget, - functionGlobalObject->JSStatsStructure()); + auto* functionGlobalObject = reinterpret_cast<Zig::GlobalObject*>( + // ShadowRealm functions belong to a different global object. + getFunctionRealm(globalObject, newTarget) + ); + RETURN_IF_EXCEPTION(scope, {}); + structure = InternalFunction::createSubclassStructure( + globalObject, + newTarget, + functionGlobalObject->JSStatsStructure() + ); } void* ptr = StatsClass__construct(globalObject, callFrame); if (UNLIKELY(!ptr)) { - return JSValue::encode(JSC::jsUndefined()); + return JSValue::encode(JSC::jsUndefined()); } JSStats* instance = JSStats::create(vm, globalObject, structure, ptr); + return JSValue::encode(instance); } void JSStatsConstructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSStatsPrototype* prototype) { + } const ClassInfo JSStatsConstructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSStatsConstructor) }; -extern "C" EncodedJSValue Stats__getConstructor(Zig::GlobalObject* globalObject) -{ + + extern "C" EncodedJSValue Stats__getConstructor(Zig::GlobalObject* globalObject) { return JSValue::encode(globalObject->JSStatsConstructor()); -} + } JSStats::~JSStats() { @@ -10922,7 +11782,7 @@ void JSStats::destroy(JSCell* cell) { static_cast<JSStats*>(cell)->JSStats::~JSStats(); } - + const ClassInfo JSStats::s_info = { "Stats"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSStats) }; void JSStats::finishCreation(VM& vm) @@ -10931,38 +11791,37 @@ void JSStats::finishCreation(VM& vm) ASSERT(inherits(info())); } -JSStats* JSStats::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSStats* ptr = new (NotNull, JSC::allocateCell<JSStats>(vm)) JSStats(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} -extern "C" void* Stats__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; +JSStats* JSStats::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) { + JSStats* ptr = new (NotNull, JSC::allocateCell<JSStats>(vm)) JSStats(vm, structure, ctx); + ptr->finishCreation(vm); + return ptr; +} - JSC::JSCell* cell = decodedValue.asCell(); - JSStats* object = JSC::jsDynamicCast<JSStats*>(cell); +extern "C" void* Stats__fromJS(JSC::EncodedJSValue value) { + JSC::JSValue decodedValue = JSC::JSValue::decode(value); + if (decodedValue.isEmpty() || !decodedValue.isCell()) + return nullptr; - if (!object) - return nullptr; + JSC::JSCell* cell = decodedValue.asCell(); + JSStats* object = JSC::jsDynamicCast<JSStats*>(cell); - return object->wrapped(); + if (!object) + return nullptr; + + return object->wrapped(); } -extern "C" bool Stats__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSStats* object = JSC::jsDynamicCast<JSStats*>(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; +extern "C" bool Stats__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) { + JSStats* object = JSC::jsDynamicCast<JSStats*>(JSValue::decode(value)); + if (!object) + return false; + + object->m_ctx = ptr; + return true; } + extern "C" const size_t Stats__ptrOffset = JSStats::offsetOfWrapped(); void JSStats::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) @@ -10977,7 +11836,7 @@ void JSStats::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) JSObject* JSStats::createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype) { - return WebCore::JSStatsConstructor::create(vm, globalObject, WebCore::JSStatsConstructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast<WebCore::JSStatsPrototype*>(prototype)); + return WebCore::JSStatsConstructor::create(vm, globalObject, WebCore::JSStatsConstructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast<WebCore::JSStatsPrototype*>(prototype)); } JSObject* JSStats::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) @@ -10985,13 +11844,12 @@ JSObject* JSStats::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) return JSStatsPrototype::create(vm, globalObject, JSStatsPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); } -extern "C" EncodedJSValue Stats__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSStatsStructure(); - JSStats* instance = JSStats::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); +extern "C" EncodedJSValue Stats__create(Zig::GlobalObject* globalObject, void* ptr) { + auto &vm = globalObject->vm(); + JSC::Structure* structure = globalObject->JSStatsStructure(); + JSStats* instance = JSStats::create(vm, globalObject, structure, ptr); + + return JSValue::encode(instance); } template<typename Visitor> @@ -11000,10 +11858,12 @@ void JSStats::visitChildrenImpl(JSCell* cell, Visitor& visitor) JSStats* thisObject = jsCast<JSStats*>(cell); ASSERT_GC_OBJECT_INHERITS(thisObject, info()); Base::visitChildren(thisObject, visitor); - + + visitor.append(thisObject->m_atime); visitor.append(thisObject->m_ctime); visitor.append(thisObject->m_mtime); + } DEFINE_VISIT_CHILDREN(JSStats); @@ -11011,10 +11871,10 @@ DEFINE_VISIT_CHILDREN(JSStats); template<typename Visitor> void JSStats::visitAdditionalChildren(Visitor& visitor) { - JSStats* thisObject = this; + JSStats* thisObject = this; ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - - visitor.append(thisObject->m_atime); + + visitor.append(thisObject->m_atime); visitor.append(thisObject->m_ctime); visitor.append(thisObject->m_mtime); ; @@ -11023,7 +11883,7 @@ void JSStats::visitAdditionalChildren(Visitor& visitor) DEFINE_VISIT_ADDITIONAL_CHILDREN(JSStats); template<typename Visitor> -void JSStats::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) +void JSStats::visitOutputConstraintsImpl(JSCell *cell, Visitor& visitor) { JSStats* thisObject = jsCast<JSStats*>(cell); ASSERT_GC_OBJECT_INHERITS(thisObject, info()); @@ -11031,100 +11891,119 @@ void JSStats::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) } DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSStats); -class JSSubprocessPrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSSubprocessPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSSubprocessPrototype* ptr = new (NotNull, JSC::allocateCell<JSSubprocessPrototype>(vm)) JSSubprocessPrototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template<typename CellType, JSC::SubspaceAccess> - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSSubprocessPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; + class JSSubprocessPrototype final : public JSC::JSNonFinalObject { + public: + using Base = JSC::JSNonFinalObject; + + static JSSubprocessPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) + { + JSSubprocessPrototype* ptr = new (NotNull, JSC::allocateCell<JSSubprocessPrototype>(vm)) JSSubprocessPrototype(vm, globalObject, structure); + ptr->finishCreation(vm, globalObject); + return ptr; + } + + DECLARE_INFO; + template<typename CellType, JSC::SubspaceAccess> + static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + return &vm.plainObjectSpace(); + } + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); + } + + private: + JSSubprocessPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) + : Base(vm, structure) + { + } + + void finishCreation(JSC::VM&, JSC::JSGlobalObject*); + }; extern "C" void* SubprocessClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); JSC_DECLARE_CUSTOM_GETTER(jsSubprocessConstructor); extern "C" void SubprocessClass__finalize(void*); + extern "C" JSC::EncodedJSValue SubprocessPrototype__getExitCode(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(SubprocessPrototype__exitCodeGetterWrap); + extern "C" JSC::EncodedJSValue SubprocessPrototype__getExited(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(SubprocessPrototype__exitedGetterWrap); + extern "C" EncodedJSValue SubprocessPrototype__kill(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(SubprocessPrototype__killCallback); + extern "C" JSC::EncodedJSValue SubprocessPrototype__getKilled(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(SubprocessPrototype__killedGetterWrap); + extern "C" JSC::EncodedJSValue SubprocessPrototype__getPid(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(SubprocessPrototype__pidGetterWrap); + extern "C" JSC::EncodedJSValue SubprocessPrototype__getStdout(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(SubprocessPrototype__readableGetterWrap); + extern "C" EncodedJSValue SubprocessPrototype__doRef(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(SubprocessPrototype__refCallback); + extern "C" JSC::EncodedJSValue SubprocessPrototype__getSignalCode(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(SubprocessPrototype__signalCodeGetterWrap); + extern "C" JSC::EncodedJSValue SubprocessPrototype__getStderr(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(SubprocessPrototype__stderrGetterWrap); + extern "C" JSC::EncodedJSValue SubprocessPrototype__getStdin(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(SubprocessPrototype__stdinGetterWrap); + extern "C" JSC::EncodedJSValue SubprocessPrototype__getStdout(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(SubprocessPrototype__stdoutGetterWrap); + extern "C" EncodedJSValue SubprocessPrototype__doUnref(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(SubprocessPrototype__unrefCallback); + extern "C" JSC::EncodedJSValue SubprocessPrototype__getStdin(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(SubprocessPrototype__writableGetterWrap); + STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSSubprocessPrototype, JSSubprocessPrototype::Base); -static const HashTableValue JSSubprocessPrototypeTableValues[] = { - { "exitCode"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, SubprocessPrototype__exitCodeGetterWrap, 0 } }, - { "exited"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, SubprocessPrototype__exitedGetterWrap, 0 } }, - { "kill"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, SubprocessPrototype__killCallback, 1 } }, - { "killed"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, SubprocessPrototype__killedGetterWrap, 0 } }, - { "pid"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, SubprocessPrototype__pidGetterWrap, 0 } }, - { "readable"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, SubprocessPrototype__readableGetterWrap, 0 } }, - { "ref"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, SubprocessPrototype__refCallback, 0 } }, - { "signalCode"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, SubprocessPrototype__signalCodeGetterWrap, 0 } }, - { "stderr"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, SubprocessPrototype__stderrGetterWrap, 0 } }, - { "stdin"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, SubprocessPrototype__stdinGetterWrap, 0 } }, - { "stdout"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, SubprocessPrototype__stdoutGetterWrap, 0 } }, - { "unref"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, SubprocessPrototype__unrefCallback, 0 } }, - { "writable"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, SubprocessPrototype__writableGetterWrap, 0 } } + + static const HashTableValue JSSubprocessPrototypeTableValues[] = { +{ "exitCode"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, SubprocessPrototype__exitCodeGetterWrap, 0 } } , +{ "exited"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, SubprocessPrototype__exitedGetterWrap, 0 } } , +{ "kill"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, SubprocessPrototype__killCallback, 1 } } , +{ "killed"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, SubprocessPrototype__killedGetterWrap, 0 } } , +{ "pid"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, SubprocessPrototype__pidGetterWrap, 0 } } , +{ "readable"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, SubprocessPrototype__readableGetterWrap, 0 } } , +{ "ref"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, SubprocessPrototype__refCallback, 0 } } , +{ "signalCode"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, SubprocessPrototype__signalCodeGetterWrap, 0 } } , +{ "stderr"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, SubprocessPrototype__stderrGetterWrap, 0 } } , +{ "stdin"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, SubprocessPrototype__stdinGetterWrap, 0 } } , +{ "stdout"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, SubprocessPrototype__stdoutGetterWrap, 0 } } , +{ "unref"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, SubprocessPrototype__unrefCallback, 0 } } , +{ "writable"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, SubprocessPrototype__writableGetterWrap, 0 } } }; + + const ClassInfo JSSubprocessPrototype::s_info = { "Subprocess"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSubprocessPrototype) }; + + JSC_DEFINE_CUSTOM_GETTER(jsSubprocessConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); @@ -11135,12 +12014,14 @@ JSC_DEFINE_CUSTOM_GETTER(jsSubprocessConstructor, (JSGlobalObject * lexicalGloba if (UNLIKELY(!prototype)) return throwVMTypeError(lexicalGlobalObject, throwScope); return JSValue::encode(globalObject->JSSubprocessConstructor()); -} +} + + JSC_DEFINE_CUSTOM_GETTER(SubprocessPrototype__exitCodeGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSSubprocess* thisObject = jsCast<JSSubprocess*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -11148,11 +12029,12 @@ JSC_DEFINE_CUSTOM_GETTER(SubprocessPrototype__exitCodeGetterWrap, (JSGlobalObjec RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + JSC_DEFINE_CUSTOM_GETTER(SubprocessPrototype__exitedGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSSubprocess* thisObject = jsCast<JSSubprocess*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -11160,27 +12042,29 @@ JSC_DEFINE_CUSTOM_GETTER(SubprocessPrototype__exitedGetterWrap, (JSGlobalObject RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + -JSC_DEFINE_HOST_FUNCTION(SubprocessPrototype__killCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + JSC_DEFINE_HOST_FUNCTION(SubprocessPrototype__killCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - JSSubprocess* thisObject = jsDynamicCast<JSSubprocess*>(callFrame->thisValue()); + JSSubprocess* thisObject = jsDynamicCast<JSSubprocess*>(callFrame->thisValue()); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return SubprocessPrototype__kill(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + return SubprocessPrototype__kill(thisObject->wrapped(), lexicalGlobalObject, callFrame); + } + JSC_DEFINE_CUSTOM_GETTER(SubprocessPrototype__killedGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSSubprocess* thisObject = jsCast<JSSubprocess*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -11188,11 +12072,12 @@ JSC_DEFINE_CUSTOM_GETTER(SubprocessPrototype__killedGetterWrap, (JSGlobalObject RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + JSC_DEFINE_CUSTOM_GETTER(SubprocessPrototype__pidGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSSubprocess* thisObject = jsCast<JSSubprocess*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -11200,58 +12085,64 @@ JSC_DEFINE_CUSTOM_GETTER(SubprocessPrototype__pidGetterWrap, (JSGlobalObject * l RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + JSC_DEFINE_CUSTOM_GETTER(SubprocessPrototype__readableGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSSubprocess* thisObject = jsCast<JSSubprocess*>(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + if (JSValue cachedValue = thisObject->m_stdout.get()) return JSValue::encode(cachedValue); - + JSC::JSValue result = JSC::JSValue::decode( - SubprocessPrototype__getStdout(thisObject->wrapped(), globalObject)); + SubprocessPrototype__getStdout(thisObject->wrapped(), globalObject) + ); RETURN_IF_EXCEPTION(throwScope, {}); thisObject->m_stdout.set(vm, thisObject, result); RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); } -extern "C" void SubprocessPrototype__readableSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast<JSSubprocess*>(JSValue::decode(thisValue)); - thisObject->m_stdout.set(vm, thisObject, JSValue::decode(value)); -} -extern "C" EncodedJSValue SubprocessPrototype__readableGetCachedValue(JSC::EncodedJSValue thisValue) -{ + extern "C" void SubprocessPrototype__readableSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject *globalObject, JSC::EncodedJSValue value) + { + auto& vm = globalObject->vm(); + auto* thisObject = jsCast<JSSubprocess*>(JSValue::decode(thisValue)); + thisObject->m_stdout.set(vm, thisObject, JSValue::decode(value)); + } + + extern "C" EncodedJSValue SubprocessPrototype__readableGetCachedValue(JSC::EncodedJSValue thisValue) + { auto* thisObject = jsCast<JSSubprocess*>(JSValue::decode(thisValue)); return JSValue::encode(thisObject->m_stdout.get()); -} + } + + -JSC_DEFINE_HOST_FUNCTION(SubprocessPrototype__refCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + JSC_DEFINE_HOST_FUNCTION(SubprocessPrototype__refCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - JSSubprocess* thisObject = jsDynamicCast<JSSubprocess*>(callFrame->thisValue()); + JSSubprocess* thisObject = jsDynamicCast<JSSubprocess*>(callFrame->thisValue()); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return SubprocessPrototype__doRef(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + return SubprocessPrototype__doRef(thisObject->wrapped(), lexicalGlobalObject, callFrame); + } + JSC_DEFINE_CUSTOM_GETTER(SubprocessPrototype__signalCodeGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSSubprocess* thisObject = jsCast<JSSubprocess*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -11259,146 +12150,164 @@ JSC_DEFINE_CUSTOM_GETTER(SubprocessPrototype__signalCodeGetterWrap, (JSGlobalObj RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + JSC_DEFINE_CUSTOM_GETTER(SubprocessPrototype__stderrGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSSubprocess* thisObject = jsCast<JSSubprocess*>(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + if (JSValue cachedValue = thisObject->m_stderr.get()) return JSValue::encode(cachedValue); - + JSC::JSValue result = JSC::JSValue::decode( - SubprocessPrototype__getStderr(thisObject->wrapped(), globalObject)); + SubprocessPrototype__getStderr(thisObject->wrapped(), globalObject) + ); RETURN_IF_EXCEPTION(throwScope, {}); thisObject->m_stderr.set(vm, thisObject, result); RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); } -extern "C" void SubprocessPrototype__stderrSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast<JSSubprocess*>(JSValue::decode(thisValue)); - thisObject->m_stderr.set(vm, thisObject, JSValue::decode(value)); -} -extern "C" EncodedJSValue SubprocessPrototype__stderrGetCachedValue(JSC::EncodedJSValue thisValue) -{ + extern "C" void SubprocessPrototype__stderrSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject *globalObject, JSC::EncodedJSValue value) + { + auto& vm = globalObject->vm(); + auto* thisObject = jsCast<JSSubprocess*>(JSValue::decode(thisValue)); + thisObject->m_stderr.set(vm, thisObject, JSValue::decode(value)); + } + + extern "C" EncodedJSValue SubprocessPrototype__stderrGetCachedValue(JSC::EncodedJSValue thisValue) + { auto* thisObject = jsCast<JSSubprocess*>(JSValue::decode(thisValue)); return JSValue::encode(thisObject->m_stderr.get()); -} + } + + JSC_DEFINE_CUSTOM_GETTER(SubprocessPrototype__stdinGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSSubprocess* thisObject = jsCast<JSSubprocess*>(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + if (JSValue cachedValue = thisObject->m_stdin.get()) return JSValue::encode(cachedValue); - + JSC::JSValue result = JSC::JSValue::decode( - SubprocessPrototype__getStdin(thisObject->wrapped(), globalObject)); + SubprocessPrototype__getStdin(thisObject->wrapped(), globalObject) + ); RETURN_IF_EXCEPTION(throwScope, {}); thisObject->m_stdin.set(vm, thisObject, result); RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); } -extern "C" void SubprocessPrototype__stdinSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast<JSSubprocess*>(JSValue::decode(thisValue)); - thisObject->m_stdin.set(vm, thisObject, JSValue::decode(value)); -} -extern "C" EncodedJSValue SubprocessPrototype__stdinGetCachedValue(JSC::EncodedJSValue thisValue) -{ + extern "C" void SubprocessPrototype__stdinSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject *globalObject, JSC::EncodedJSValue value) + { + auto& vm = globalObject->vm(); + auto* thisObject = jsCast<JSSubprocess*>(JSValue::decode(thisValue)); + thisObject->m_stdin.set(vm, thisObject, JSValue::decode(value)); + } + + extern "C" EncodedJSValue SubprocessPrototype__stdinGetCachedValue(JSC::EncodedJSValue thisValue) + { auto* thisObject = jsCast<JSSubprocess*>(JSValue::decode(thisValue)); return JSValue::encode(thisObject->m_stdin.get()); -} + } + + JSC_DEFINE_CUSTOM_GETTER(SubprocessPrototype__stdoutGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSSubprocess* thisObject = jsCast<JSSubprocess*>(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + if (JSValue cachedValue = thisObject->m_stdout.get()) return JSValue::encode(cachedValue); - + JSC::JSValue result = JSC::JSValue::decode( - SubprocessPrototype__getStdout(thisObject->wrapped(), globalObject)); + SubprocessPrototype__getStdout(thisObject->wrapped(), globalObject) + ); RETURN_IF_EXCEPTION(throwScope, {}); thisObject->m_stdout.set(vm, thisObject, result); RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); } -extern "C" void SubprocessPrototype__stdoutSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast<JSSubprocess*>(JSValue::decode(thisValue)); - thisObject->m_stdout.set(vm, thisObject, JSValue::decode(value)); -} -extern "C" EncodedJSValue SubprocessPrototype__stdoutGetCachedValue(JSC::EncodedJSValue thisValue) -{ + extern "C" void SubprocessPrototype__stdoutSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject *globalObject, JSC::EncodedJSValue value) + { + auto& vm = globalObject->vm(); + auto* thisObject = jsCast<JSSubprocess*>(JSValue::decode(thisValue)); + thisObject->m_stdout.set(vm, thisObject, JSValue::decode(value)); + } + + extern "C" EncodedJSValue SubprocessPrototype__stdoutGetCachedValue(JSC::EncodedJSValue thisValue) + { auto* thisObject = jsCast<JSSubprocess*>(JSValue::decode(thisValue)); return JSValue::encode(thisObject->m_stdout.get()); -} + } + + -JSC_DEFINE_HOST_FUNCTION(SubprocessPrototype__unrefCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + JSC_DEFINE_HOST_FUNCTION(SubprocessPrototype__unrefCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - JSSubprocess* thisObject = jsDynamicCast<JSSubprocess*>(callFrame->thisValue()); + JSSubprocess* thisObject = jsDynamicCast<JSSubprocess*>(callFrame->thisValue()); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return SubprocessPrototype__doUnref(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + return SubprocessPrototype__doUnref(thisObject->wrapped(), lexicalGlobalObject, callFrame); + } + JSC_DEFINE_CUSTOM_GETTER(SubprocessPrototype__writableGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSSubprocess* thisObject = jsCast<JSSubprocess*>(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + if (JSValue cachedValue = thisObject->m_stdin.get()) return JSValue::encode(cachedValue); - + JSC::JSValue result = JSC::JSValue::decode( - SubprocessPrototype__getStdin(thisObject->wrapped(), globalObject)); + SubprocessPrototype__getStdin(thisObject->wrapped(), globalObject) + ); RETURN_IF_EXCEPTION(throwScope, {}); thisObject->m_stdin.set(vm, thisObject, result); RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); } -extern "C" void SubprocessPrototype__writableSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast<JSSubprocess*>(JSValue::decode(thisValue)); - thisObject->m_stdin.set(vm, thisObject, JSValue::decode(value)); -} -extern "C" EncodedJSValue SubprocessPrototype__writableGetCachedValue(JSC::EncodedJSValue thisValue) -{ + extern "C" void SubprocessPrototype__writableSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject *globalObject, JSC::EncodedJSValue value) + { + auto& vm = globalObject->vm(); + auto* thisObject = jsCast<JSSubprocess*>(JSValue::decode(thisValue)); + thisObject->m_stdin.set(vm, thisObject, JSValue::decode(value)); + } + + extern "C" EncodedJSValue SubprocessPrototype__writableGetCachedValue(JSC::EncodedJSValue thisValue) + { auto* thisObject = jsCast<JSSubprocess*>(JSValue::decode(thisValue)); return JSValue::encode(thisObject->m_stdin.get()); -} + } + + void JSSubprocessPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) { @@ -11408,10 +12317,9 @@ void JSSubprocessPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* glo } extern "C" bool Subprocess__hasPendingActivity(void* ptr); -bool JSSubprocess::hasPendingActivity(void* ctx) -{ - return Subprocess__hasPendingActivity(ctx); -} + bool JSSubprocess::hasPendingActivity(void* ctx) { + return Subprocess__hasPendingActivity(ctx); + } JSSubprocess::~JSSubprocess() { @@ -11423,7 +12331,7 @@ void JSSubprocess::destroy(JSCell* cell) { static_cast<JSSubprocess*>(cell)->JSSubprocess::~JSSubprocess(); } - + const ClassInfo JSSubprocess::s_info = { "Subprocess"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSubprocess) }; void JSSubprocess::finishCreation(VM& vm) @@ -11432,38 +12340,37 @@ void JSSubprocess::finishCreation(VM& vm) ASSERT(inherits(info())); } -JSSubprocess* JSSubprocess::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSSubprocess* ptr = new (NotNull, JSC::allocateCell<JSSubprocess>(vm)) JSSubprocess(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} -extern "C" void* Subprocess__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; +JSSubprocess* JSSubprocess::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) { + JSSubprocess* ptr = new (NotNull, JSC::allocateCell<JSSubprocess>(vm)) JSSubprocess(vm, structure, ctx); + ptr->finishCreation(vm); + return ptr; +} - JSC::JSCell* cell = decodedValue.asCell(); - JSSubprocess* object = JSC::jsDynamicCast<JSSubprocess*>(cell); +extern "C" void* Subprocess__fromJS(JSC::EncodedJSValue value) { + JSC::JSValue decodedValue = JSC::JSValue::decode(value); + if (decodedValue.isEmpty() || !decodedValue.isCell()) + return nullptr; - if (!object) - return nullptr; + JSC::JSCell* cell = decodedValue.asCell(); + JSSubprocess* object = JSC::jsDynamicCast<JSSubprocess*>(cell); - return object->wrapped(); + if (!object) + return nullptr; + + return object->wrapped(); } -extern "C" bool Subprocess__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSSubprocess* object = JSC::jsDynamicCast<JSSubprocess*>(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; +extern "C" bool Subprocess__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) { + JSSubprocess* object = JSC::jsDynamicCast<JSSubprocess*>(JSValue::decode(value)); + if (!object) + return false; + + object->m_ctx = ptr; + return true; } + extern "C" const size_t Subprocess__ptrOffset = JSSubprocess::offsetOfWrapped(); void JSSubprocess::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) @@ -11476,18 +12383,19 @@ void JSSubprocess::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) Base::analyzeHeap(cell, analyzer); } + + JSObject* JSSubprocess::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) { return JSSubprocessPrototype::create(vm, globalObject, JSSubprocessPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); } -extern "C" EncodedJSValue Subprocess__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSSubprocessStructure(); - JSSubprocess* instance = JSSubprocess::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); +extern "C" EncodedJSValue Subprocess__create(Zig::GlobalObject* globalObject, void* ptr) { + auto &vm = globalObject->vm(); + JSC::Structure* structure = globalObject->JSSubprocessStructure(); + JSSubprocess* instance = JSSubprocess::create(vm, globalObject, structure, ptr); + + return JSValue::encode(instance); } template<typename Visitor> @@ -11496,11 +12404,12 @@ void JSSubprocess::visitChildrenImpl(JSCell* cell, Visitor& visitor) JSSubprocess* thisObject = jsCast<JSSubprocess*>(cell); ASSERT_GC_OBJECT_INHERITS(thisObject, info()); Base::visitChildren(thisObject, visitor); - + + visitor.append(thisObject->m_stderr); visitor.append(thisObject->m_stdin); visitor.append(thisObject->m_stdout); - visitor.addOpaqueRoot(thisObject->wrapped()); +visitor.addOpaqueRoot(thisObject->wrapped()); } DEFINE_VISIT_CHILDREN(JSSubprocess); @@ -11508,10 +12417,10 @@ DEFINE_VISIT_CHILDREN(JSSubprocess); template<typename Visitor> void JSSubprocess::visitAdditionalChildren(Visitor& visitor) { - JSSubprocess* thisObject = this; + JSSubprocess* thisObject = this; ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - - visitor.append(thisObject->m_stderr); + + visitor.append(thisObject->m_stderr); visitor.append(thisObject->m_stdin); visitor.append(thisObject->m_stdout); visitor.addOpaqueRoot(this->wrapped()); @@ -11520,7 +12429,7 @@ void JSSubprocess::visitAdditionalChildren(Visitor& visitor) DEFINE_VISIT_ADDITIONAL_CHILDREN(JSSubprocess); template<typename Visitor> -void JSSubprocess::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) +void JSSubprocess::visitOutputConstraintsImpl(JSCell *cell, Visitor& visitor) { JSSubprocess* thisObject = jsCast<JSSubprocess*>(cell); ASSERT_GC_OBJECT_INHERITS(thisObject, info()); @@ -11528,103 +12437,133 @@ void JSSubprocess::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) } DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSSubprocess); -class JSTCPSocketPrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSTCPSocketPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSTCPSocketPrototype* ptr = new (NotNull, JSC::allocateCell<JSTCPSocketPrototype>(vm)) JSTCPSocketPrototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template<typename CellType, JSC::SubspaceAccess> - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSTCPSocketPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; + class JSTCPSocketPrototype final : public JSC::JSNonFinalObject { + public: + using Base = JSC::JSNonFinalObject; + + static JSTCPSocketPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) + { + JSTCPSocketPrototype* ptr = new (NotNull, JSC::allocateCell<JSTCPSocketPrototype>(vm)) JSTCPSocketPrototype(vm, globalObject, structure); + ptr->finishCreation(vm, globalObject); + return ptr; + } + + DECLARE_INFO; + template<typename CellType, JSC::SubspaceAccess> + static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + return &vm.plainObjectSpace(); + } + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); + } + + private: + JSTCPSocketPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) + : Base(vm, structure) + { + } + + void finishCreation(JSC::VM&, JSC::JSGlobalObject*); + }; extern "C" void* TCPSocketClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); JSC_DECLARE_CUSTOM_GETTER(jsTCPSocketConstructor); extern "C" void TCPSocketClass__finalize(void*); + +extern "C" JSC::EncodedJSValue TCPSocketPrototype__getAuthorized(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); +JSC_DECLARE_CUSTOM_GETTER(TCPSocketPrototype__authorizedGetterWrap); + + extern "C" JSC::EncodedJSValue TCPSocketPrototype__getData(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(TCPSocketPrototype__dataGetterWrap); + extern "C" bool TCPSocketPrototype__setData(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::EncodedJSValue value); JSC_DECLARE_CUSTOM_SETTER(TCPSocketPrototype__dataSetterWrap); + extern "C" EncodedJSValue TCPSocketPrototype__end(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(TCPSocketPrototype__endCallback); + extern "C" EncodedJSValue TCPSocketPrototype__flush(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(TCPSocketPrototype__flushCallback); + +extern "C" EncodedJSValue TCPSocketPrototype__getAuthorizationError(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(TCPSocketPrototype__getAuthorizationErrorCallback); + + extern "C" JSC::EncodedJSValue TCPSocketPrototype__getListener(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(TCPSocketPrototype__listenerGetterWrap); + extern "C" JSC::EncodedJSValue TCPSocketPrototype__getLocalPort(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(TCPSocketPrototype__localPortGetterWrap); + extern "C" JSC::EncodedJSValue TCPSocketPrototype__getReadyState(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(TCPSocketPrototype__readyStateGetterWrap); + extern "C" EncodedJSValue TCPSocketPrototype__ref(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(TCPSocketPrototype__refCallback); + extern "C" EncodedJSValue TCPSocketPrototype__reload(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(TCPSocketPrototype__reloadCallback); + extern "C" JSC::EncodedJSValue TCPSocketPrototype__getRemoteAddress(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(TCPSocketPrototype__remoteAddressGetterWrap); + extern "C" EncodedJSValue TCPSocketPrototype__shutdown(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(TCPSocketPrototype__shutdownCallback); + extern "C" EncodedJSValue TCPSocketPrototype__timeout(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(TCPSocketPrototype__timeoutCallback); + extern "C" EncodedJSValue TCPSocketPrototype__unref(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(TCPSocketPrototype__unrefCallback); + extern "C" EncodedJSValue TCPSocketPrototype__write(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(TCPSocketPrototype__writeCallback); + STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSTCPSocketPrototype, JSTCPSocketPrototype::Base); -static const HashTableValue JSTCPSocketPrototypeTableValues[] = { - { "data"_s, static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, TCPSocketPrototype__dataGetterWrap, TCPSocketPrototype__dataSetterWrap } }, - { "end"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__endCallback, 3 } }, - { "flush"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__flushCallback, 0 } }, - { "listener"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, TCPSocketPrototype__listenerGetterWrap, 0 } }, - { "localPort"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, TCPSocketPrototype__localPortGetterWrap, 0 } }, - { "readyState"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, TCPSocketPrototype__readyStateGetterWrap, 0 } }, - { "ref"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__refCallback, 0 } }, - { "reload"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__reloadCallback, 1 } }, - { "remoteAddress"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, TCPSocketPrototype__remoteAddressGetterWrap, 0 } }, - { "shutdown"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__shutdownCallback, 1 } }, - { "timeout"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__timeoutCallback, 1 } }, - { "unref"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__unrefCallback, 0 } }, - { "write"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__writeCallback, 3 } } + + static const HashTableValue JSTCPSocketPrototypeTableValues[] = { +{ "authorized"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, TCPSocketPrototype__authorizedGetterWrap, 0 } } , +{ "data"_s, static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, TCPSocketPrototype__dataGetterWrap, TCPSocketPrototype__dataSetterWrap } } , +{ "end"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__endCallback, 3 } } , +{ "flush"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__flushCallback, 0 } } , +{ "getAuthorizationError"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__getAuthorizationErrorCallback, 0 } } , +{ "listener"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, TCPSocketPrototype__listenerGetterWrap, 0 } } , +{ "localPort"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, TCPSocketPrototype__localPortGetterWrap, 0 } } , +{ "readyState"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, TCPSocketPrototype__readyStateGetterWrap, 0 } } , +{ "ref"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__refCallback, 0 } } , +{ "reload"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__reloadCallback, 1 } } , +{ "remoteAddress"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, TCPSocketPrototype__remoteAddressGetterWrap, 0 } } , +{ "shutdown"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__shutdownCallback, 1 } } , +{ "timeout"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__timeoutCallback, 1 } } , +{ "unref"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__unrefCallback, 0 } } , +{ "write"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__writeCallback, 3 } } }; + + const ClassInfo JSTCPSocketPrototype::s_info = { "TCPSocket"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTCPSocketPrototype) }; + + JSC_DEFINE_CUSTOM_GETTER(jsTCPSocketConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); @@ -11635,38 +12574,57 @@ JSC_DEFINE_CUSTOM_GETTER(jsTCPSocketConstructor, (JSGlobalObject * lexicalGlobal if (UNLIKELY(!prototype)) return throwVMTypeError(lexicalGlobalObject, throwScope); return JSValue::encode(globalObject->JSTCPSocketConstructor()); -} +} + -JSC_DEFINE_CUSTOM_GETTER(TCPSocketPrototype__dataGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) + +JSC_DEFINE_CUSTOM_GETTER(TCPSocketPrototype__authorizedGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSTCPSocket* thisObject = jsCast<JSTCPSocket*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC::EncodedJSValue result = TCPSocketPrototype__getAuthorized(thisObject->wrapped(), globalObject); + RETURN_IF_EXCEPTION(throwScope, {}); + RELEASE_AND_RETURN(throwScope, result); +} + +JSC_DEFINE_CUSTOM_GETTER(TCPSocketPrototype__dataGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +{ + auto& vm = lexicalGlobalObject->vm(); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + JSTCPSocket* thisObject = jsCast<JSTCPSocket*>(JSValue::decode(thisValue)); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + if (JSValue cachedValue = thisObject->m_data.get()) return JSValue::encode(cachedValue); - + JSC::JSValue result = JSC::JSValue::decode( - TCPSocketPrototype__getData(thisObject->wrapped(), globalObject)); + TCPSocketPrototype__getData(thisObject->wrapped(), globalObject) + ); RETURN_IF_EXCEPTION(throwScope, {}); thisObject->m_data.set(vm, thisObject, result); RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); } -extern "C" void TCPSocketPrototype__dataSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast<JSTCPSocket*>(JSValue::decode(thisValue)); - thisObject->m_data.set(vm, thisObject, JSValue::decode(value)); -} -extern "C" EncodedJSValue TCPSocketPrototype__dataGetCachedValue(JSC::EncodedJSValue thisValue) -{ + extern "C" void TCPSocketPrototype__dataSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject *globalObject, JSC::EncodedJSValue value) + { + auto& vm = globalObject->vm(); + auto* thisObject = jsCast<JSTCPSocket*>(JSValue::decode(thisValue)); + thisObject->m_data.set(vm, thisObject, JSValue::decode(value)); + } + + extern "C" EncodedJSValue TCPSocketPrototype__dataGetCachedValue(JSC::EncodedJSValue thisValue) + { auto* thisObject = jsCast<JSTCPSocket*>(JSValue::decode(thisValue)); return JSValue::encode(thisObject->m_data.get()); -} + } + + JSC_DEFINE_CUSTOM_SETTER(TCPSocketPrototype__dataSetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue, PropertyName attributeName)) { @@ -11679,42 +12637,62 @@ JSC_DEFINE_CUSTOM_SETTER(TCPSocketPrototype__dataSetterWrap, (JSGlobalObject * l RELEASE_AND_RETURN(throwScope, result); } -JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__endCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - JSTCPSocket* thisObject = jsDynamicCast<JSTCPSocket*>(callFrame->thisValue()); + JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__endCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); + + JSTCPSocket* thisObject = jsDynamicCast<JSTCPSocket*>(callFrame->thisValue()); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } + + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + + return TCPSocketPrototype__end(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__flushCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return TCPSocketPrototype__end(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSTCPSocket* thisObject = jsDynamicCast<JSTCPSocket*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__flushCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSTCPSocket* thisObject = jsDynamicCast<JSTCPSocket*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return TCPSocketPrototype__flush(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__getAuthorizationErrorCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return TCPSocketPrototype__flush(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSTCPSocket* thisObject = jsDynamicCast<JSTCPSocket*>(callFrame->thisValue()); + + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } + + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + + return TCPSocketPrototype__getAuthorizationError(thisObject->wrapped(), lexicalGlobalObject, callFrame); + } + JSC_DEFINE_CUSTOM_GETTER(TCPSocketPrototype__listenerGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSTCPSocket* thisObject = jsCast<JSTCPSocket*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -11722,11 +12700,12 @@ JSC_DEFINE_CUSTOM_GETTER(TCPSocketPrototype__listenerGetterWrap, (JSGlobalObject RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + JSC_DEFINE_CUSTOM_GETTER(TCPSocketPrototype__localPortGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSTCPSocket* thisObject = jsCast<JSTCPSocket*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -11734,11 +12713,12 @@ JSC_DEFINE_CUSTOM_GETTER(TCPSocketPrototype__localPortGetterWrap, (JSGlobalObjec RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + JSC_DEFINE_CUSTOM_GETTER(TCPSocketPrototype__readyStateGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSTCPSocket* thisObject = jsCast<JSTCPSocket*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -11746,133 +12726,144 @@ JSC_DEFINE_CUSTOM_GETTER(TCPSocketPrototype__readyStateGetterWrap, (JSGlobalObje RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + -JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__refCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__refCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - JSTCPSocket* thisObject = jsDynamicCast<JSTCPSocket*>(callFrame->thisValue()); + JSTCPSocket* thisObject = jsDynamicCast<JSTCPSocket*>(callFrame->thisValue()); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return TCPSocketPrototype__ref(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + return TCPSocketPrototype__ref(thisObject->wrapped(), lexicalGlobalObject, callFrame); + } + -JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__reloadCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__reloadCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - JSTCPSocket* thisObject = jsDynamicCast<JSTCPSocket*>(callFrame->thisValue()); + JSTCPSocket* thisObject = jsDynamicCast<JSTCPSocket*>(callFrame->thisValue()); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return TCPSocketPrototype__reload(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + return TCPSocketPrototype__reload(thisObject->wrapped(), lexicalGlobalObject, callFrame); + } + JSC_DEFINE_CUSTOM_GETTER(TCPSocketPrototype__remoteAddressGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSTCPSocket* thisObject = jsCast<JSTCPSocket*>(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + if (JSValue cachedValue = thisObject->m_remoteAddress.get()) return JSValue::encode(cachedValue); - + JSC::JSValue result = JSC::JSValue::decode( - TCPSocketPrototype__getRemoteAddress(thisObject->wrapped(), globalObject)); + TCPSocketPrototype__getRemoteAddress(thisObject->wrapped(), globalObject) + ); RETURN_IF_EXCEPTION(throwScope, {}); thisObject->m_remoteAddress.set(vm, thisObject, result); RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); } -extern "C" void TCPSocketPrototype__remoteAddressSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast<JSTCPSocket*>(JSValue::decode(thisValue)); - thisObject->m_remoteAddress.set(vm, thisObject, JSValue::decode(value)); -} -extern "C" EncodedJSValue TCPSocketPrototype__remoteAddressGetCachedValue(JSC::EncodedJSValue thisValue) -{ + extern "C" void TCPSocketPrototype__remoteAddressSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject *globalObject, JSC::EncodedJSValue value) + { + auto& vm = globalObject->vm(); + auto* thisObject = jsCast<JSTCPSocket*>(JSValue::decode(thisValue)); + thisObject->m_remoteAddress.set(vm, thisObject, JSValue::decode(value)); + } + + extern "C" EncodedJSValue TCPSocketPrototype__remoteAddressGetCachedValue(JSC::EncodedJSValue thisValue) + { auto* thisObject = jsCast<JSTCPSocket*>(JSValue::decode(thisValue)); return JSValue::encode(thisObject->m_remoteAddress.get()); -} + } + + -JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__shutdownCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__shutdownCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - JSTCPSocket* thisObject = jsDynamicCast<JSTCPSocket*>(callFrame->thisValue()); + JSTCPSocket* thisObject = jsDynamicCast<JSTCPSocket*>(callFrame->thisValue()); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } + + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + + return TCPSocketPrototype__shutdown(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__timeoutCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return TCPSocketPrototype__shutdown(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSTCPSocket* thisObject = jsDynamicCast<JSTCPSocket*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__timeoutCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSTCPSocket* thisObject = jsDynamicCast<JSTCPSocket*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return TCPSocketPrototype__timeout(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__unrefCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return TCPSocketPrototype__timeout(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSTCPSocket* thisObject = jsDynamicCast<JSTCPSocket*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__unrefCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSTCPSocket* thisObject = jsDynamicCast<JSTCPSocket*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return TCPSocketPrototype__unref(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__writeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return TCPSocketPrototype__unref(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSTCPSocket* thisObject = jsDynamicCast<JSTCPSocket*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__writeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSTCPSocket* thisObject = jsDynamicCast<JSTCPSocket*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return TCPSocketPrototype__write(thisObject->wrapped(), lexicalGlobalObject, callFrame); } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - return TCPSocketPrototype__write(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + void JSTCPSocketPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) { @@ -11882,10 +12873,9 @@ void JSTCPSocketPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* glob } extern "C" bool TCPSocket__hasPendingActivity(void* ptr); -bool JSTCPSocket::hasPendingActivity(void* ctx) -{ - return TCPSocket__hasPendingActivity(ctx); -} + bool JSTCPSocket::hasPendingActivity(void* ctx) { + return TCPSocket__hasPendingActivity(ctx); + } JSTCPSocket::~JSTCPSocket() { @@ -11897,7 +12887,7 @@ void JSTCPSocket::destroy(JSCell* cell) { static_cast<JSTCPSocket*>(cell)->JSTCPSocket::~JSTCPSocket(); } - + const ClassInfo JSTCPSocket::s_info = { "TCPSocket"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTCPSocket) }; void JSTCPSocket::finishCreation(VM& vm) @@ -11906,38 +12896,37 @@ void JSTCPSocket::finishCreation(VM& vm) ASSERT(inherits(info())); } -JSTCPSocket* JSTCPSocket::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSTCPSocket* ptr = new (NotNull, JSC::allocateCell<JSTCPSocket>(vm)) JSTCPSocket(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} -extern "C" void* TCPSocket__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; +JSTCPSocket* JSTCPSocket::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) { + JSTCPSocket* ptr = new (NotNull, JSC::allocateCell<JSTCPSocket>(vm)) JSTCPSocket(vm, structure, ctx); + ptr->finishCreation(vm); + return ptr; +} - JSC::JSCell* cell = decodedValue.asCell(); - JSTCPSocket* object = JSC::jsDynamicCast<JSTCPSocket*>(cell); +extern "C" void* TCPSocket__fromJS(JSC::EncodedJSValue value) { + JSC::JSValue decodedValue = JSC::JSValue::decode(value); + if (decodedValue.isEmpty() || !decodedValue.isCell()) + return nullptr; - if (!object) - return nullptr; + JSC::JSCell* cell = decodedValue.asCell(); + JSTCPSocket* object = JSC::jsDynamicCast<JSTCPSocket*>(cell); - return object->wrapped(); + if (!object) + return nullptr; + + return object->wrapped(); } -extern "C" bool TCPSocket__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSTCPSocket* object = JSC::jsDynamicCast<JSTCPSocket*>(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; +extern "C" bool TCPSocket__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) { + JSTCPSocket* object = JSC::jsDynamicCast<JSTCPSocket*>(JSValue::decode(value)); + if (!object) + return false; + + object->m_ctx = ptr; + return true; } + extern "C" const size_t TCPSocket__ptrOffset = JSTCPSocket::offsetOfWrapped(); void JSTCPSocket::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) @@ -11950,18 +12939,19 @@ void JSTCPSocket::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) Base::analyzeHeap(cell, analyzer); } + + JSObject* JSTCPSocket::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) { return JSTCPSocketPrototype::create(vm, globalObject, JSTCPSocketPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); } -extern "C" EncodedJSValue TCPSocket__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSTCPSocketStructure(); - JSTCPSocket* instance = JSTCPSocket::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); +extern "C" EncodedJSValue TCPSocket__create(Zig::GlobalObject* globalObject, void* ptr) { + auto &vm = globalObject->vm(); + JSC::Structure* structure = globalObject->JSTCPSocketStructure(); + JSTCPSocket* instance = JSTCPSocket::create(vm, globalObject, structure, ptr); + + return JSValue::encode(instance); } template<typename Visitor> @@ -11970,10 +12960,11 @@ void JSTCPSocket::visitChildrenImpl(JSCell* cell, Visitor& visitor) JSTCPSocket* thisObject = jsCast<JSTCPSocket*>(cell); ASSERT_GC_OBJECT_INHERITS(thisObject, info()); Base::visitChildren(thisObject, visitor); - + + visitor.append(thisObject->m_data); visitor.append(thisObject->m_remoteAddress); - visitor.addOpaqueRoot(thisObject->wrapped()); +visitor.addOpaqueRoot(thisObject->wrapped()); } DEFINE_VISIT_CHILDREN(JSTCPSocket); @@ -11981,10 +12972,10 @@ DEFINE_VISIT_CHILDREN(JSTCPSocket); template<typename Visitor> void JSTCPSocket::visitAdditionalChildren(Visitor& visitor) { - JSTCPSocket* thisObject = this; + JSTCPSocket* thisObject = this; ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - - visitor.append(thisObject->m_data); + + visitor.append(thisObject->m_data); visitor.append(thisObject->m_remoteAddress); visitor.addOpaqueRoot(this->wrapped()); } @@ -11992,7 +12983,7 @@ void JSTCPSocket::visitAdditionalChildren(Visitor& visitor) DEFINE_VISIT_ADDITIONAL_CHILDREN(JSTCPSocket); template<typename Visitor> -void JSTCPSocket::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) +void JSTCPSocket::visitOutputConstraintsImpl(JSCell *cell, Visitor& visitor) { JSTCPSocket* thisObject = jsCast<JSTCPSocket*>(cell); ASSERT_GC_OBJECT_INHERITS(thisObject, info()); @@ -12000,103 +12991,133 @@ void JSTCPSocket::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) } DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSTCPSocket); -class JSTLSSocketPrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSTLSSocketPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSTLSSocketPrototype* ptr = new (NotNull, JSC::allocateCell<JSTLSSocketPrototype>(vm)) JSTLSSocketPrototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template<typename CellType, JSC::SubspaceAccess> - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSTLSSocketPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; + class JSTLSSocketPrototype final : public JSC::JSNonFinalObject { + public: + using Base = JSC::JSNonFinalObject; + + static JSTLSSocketPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) + { + JSTLSSocketPrototype* ptr = new (NotNull, JSC::allocateCell<JSTLSSocketPrototype>(vm)) JSTLSSocketPrototype(vm, globalObject, structure); + ptr->finishCreation(vm, globalObject); + return ptr; + } + + DECLARE_INFO; + template<typename CellType, JSC::SubspaceAccess> + static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + return &vm.plainObjectSpace(); + } + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); + } + + private: + JSTLSSocketPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) + : Base(vm, structure) + { + } + + void finishCreation(JSC::VM&, JSC::JSGlobalObject*); + }; extern "C" void* TLSSocketClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); JSC_DECLARE_CUSTOM_GETTER(jsTLSSocketConstructor); extern "C" void TLSSocketClass__finalize(void*); + +extern "C" JSC::EncodedJSValue TLSSocketPrototype__getAuthorized(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); +JSC_DECLARE_CUSTOM_GETTER(TLSSocketPrototype__authorizedGetterWrap); + + extern "C" JSC::EncodedJSValue TLSSocketPrototype__getData(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(TLSSocketPrototype__dataGetterWrap); + extern "C" bool TLSSocketPrototype__setData(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::EncodedJSValue value); JSC_DECLARE_CUSTOM_SETTER(TLSSocketPrototype__dataSetterWrap); + extern "C" EncodedJSValue TLSSocketPrototype__end(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(TLSSocketPrototype__endCallback); + extern "C" EncodedJSValue TLSSocketPrototype__flush(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(TLSSocketPrototype__flushCallback); + +extern "C" EncodedJSValue TLSSocketPrototype__getAuthorizationError(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(TLSSocketPrototype__getAuthorizationErrorCallback); + + extern "C" JSC::EncodedJSValue TLSSocketPrototype__getListener(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(TLSSocketPrototype__listenerGetterWrap); + extern "C" JSC::EncodedJSValue TLSSocketPrototype__getLocalPort(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(TLSSocketPrototype__localPortGetterWrap); + extern "C" JSC::EncodedJSValue TLSSocketPrototype__getReadyState(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(TLSSocketPrototype__readyStateGetterWrap); + extern "C" EncodedJSValue TLSSocketPrototype__ref(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(TLSSocketPrototype__refCallback); + extern "C" EncodedJSValue TLSSocketPrototype__reload(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(TLSSocketPrototype__reloadCallback); + extern "C" JSC::EncodedJSValue TLSSocketPrototype__getRemoteAddress(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(TLSSocketPrototype__remoteAddressGetterWrap); + extern "C" EncodedJSValue TLSSocketPrototype__shutdown(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(TLSSocketPrototype__shutdownCallback); + extern "C" EncodedJSValue TLSSocketPrototype__timeout(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(TLSSocketPrototype__timeoutCallback); + extern "C" EncodedJSValue TLSSocketPrototype__unref(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(TLSSocketPrototype__unrefCallback); + extern "C" EncodedJSValue TLSSocketPrototype__write(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(TLSSocketPrototype__writeCallback); + STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSTLSSocketPrototype, JSTLSSocketPrototype::Base); -static const HashTableValue JSTLSSocketPrototypeTableValues[] = { - { "data"_s, static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, TLSSocketPrototype__dataGetterWrap, TLSSocketPrototype__dataSetterWrap } }, - { "end"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__endCallback, 3 } }, - { "flush"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__flushCallback, 0 } }, - { "listener"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, TLSSocketPrototype__listenerGetterWrap, 0 } }, - { "localPort"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, TLSSocketPrototype__localPortGetterWrap, 0 } }, - { "readyState"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, TLSSocketPrototype__readyStateGetterWrap, 0 } }, - { "ref"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__refCallback, 0 } }, - { "reload"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__reloadCallback, 1 } }, - { "remoteAddress"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, TLSSocketPrototype__remoteAddressGetterWrap, 0 } }, - { "shutdown"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__shutdownCallback, 1 } }, - { "timeout"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__timeoutCallback, 1 } }, - { "unref"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__unrefCallback, 0 } }, - { "write"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__writeCallback, 3 } } + + static const HashTableValue JSTLSSocketPrototypeTableValues[] = { +{ "authorized"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, TLSSocketPrototype__authorizedGetterWrap, 0 } } , +{ "data"_s, static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, TLSSocketPrototype__dataGetterWrap, TLSSocketPrototype__dataSetterWrap } } , +{ "end"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__endCallback, 3 } } , +{ "flush"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__flushCallback, 0 } } , +{ "getAuthorizationError"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__getAuthorizationErrorCallback, 0 } } , +{ "listener"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, TLSSocketPrototype__listenerGetterWrap, 0 } } , +{ "localPort"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, TLSSocketPrototype__localPortGetterWrap, 0 } } , +{ "readyState"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, TLSSocketPrototype__readyStateGetterWrap, 0 } } , +{ "ref"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__refCallback, 0 } } , +{ "reload"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__reloadCallback, 1 } } , +{ "remoteAddress"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, TLSSocketPrototype__remoteAddressGetterWrap, 0 } } , +{ "shutdown"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__shutdownCallback, 1 } } , +{ "timeout"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__timeoutCallback, 1 } } , +{ "unref"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__unrefCallback, 0 } } , +{ "write"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__writeCallback, 3 } } }; + + const ClassInfo JSTLSSocketPrototype::s_info = { "TLSSocket"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTLSSocketPrototype) }; + + JSC_DEFINE_CUSTOM_GETTER(jsTLSSocketConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); @@ -12107,38 +13128,57 @@ JSC_DEFINE_CUSTOM_GETTER(jsTLSSocketConstructor, (JSGlobalObject * lexicalGlobal if (UNLIKELY(!prototype)) return throwVMTypeError(lexicalGlobalObject, throwScope); return JSValue::encode(globalObject->JSTLSSocketConstructor()); -} +} + -JSC_DEFINE_CUSTOM_GETTER(TLSSocketPrototype__dataGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) + +JSC_DEFINE_CUSTOM_GETTER(TLSSocketPrototype__authorizedGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSTLSSocket* thisObject = jsCast<JSTLSSocket*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC::EncodedJSValue result = TLSSocketPrototype__getAuthorized(thisObject->wrapped(), globalObject); + RETURN_IF_EXCEPTION(throwScope, {}); + RELEASE_AND_RETURN(throwScope, result); +} + +JSC_DEFINE_CUSTOM_GETTER(TLSSocketPrototype__dataGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +{ + auto& vm = lexicalGlobalObject->vm(); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + JSTLSSocket* thisObject = jsCast<JSTLSSocket*>(JSValue::decode(thisValue)); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + if (JSValue cachedValue = thisObject->m_data.get()) return JSValue::encode(cachedValue); - + JSC::JSValue result = JSC::JSValue::decode( - TLSSocketPrototype__getData(thisObject->wrapped(), globalObject)); + TLSSocketPrototype__getData(thisObject->wrapped(), globalObject) + ); RETURN_IF_EXCEPTION(throwScope, {}); thisObject->m_data.set(vm, thisObject, result); RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); } -extern "C" void TLSSocketPrototype__dataSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast<JSTLSSocket*>(JSValue::decode(thisValue)); - thisObject->m_data.set(vm, thisObject, JSValue::decode(value)); -} -extern "C" EncodedJSValue TLSSocketPrototype__dataGetCachedValue(JSC::EncodedJSValue thisValue) -{ + extern "C" void TLSSocketPrototype__dataSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject *globalObject, JSC::EncodedJSValue value) + { + auto& vm = globalObject->vm(); + auto* thisObject = jsCast<JSTLSSocket*>(JSValue::decode(thisValue)); + thisObject->m_data.set(vm, thisObject, JSValue::decode(value)); + } + + extern "C" EncodedJSValue TLSSocketPrototype__dataGetCachedValue(JSC::EncodedJSValue thisValue) + { auto* thisObject = jsCast<JSTLSSocket*>(JSValue::decode(thisValue)); return JSValue::encode(thisObject->m_data.get()); -} + } + + JSC_DEFINE_CUSTOM_SETTER(TLSSocketPrototype__dataSetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue, PropertyName attributeName)) { @@ -12151,42 +13191,62 @@ JSC_DEFINE_CUSTOM_SETTER(TLSSocketPrototype__dataSetterWrap, (JSGlobalObject * l RELEASE_AND_RETURN(throwScope, result); } -JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__endCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - JSTLSSocket* thisObject = jsDynamicCast<JSTLSSocket*>(callFrame->thisValue()); + JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__endCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); + + JSTLSSocket* thisObject = jsDynamicCast<JSTLSSocket*>(callFrame->thisValue()); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } + + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + + return TLSSocketPrototype__end(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__flushCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return TLSSocketPrototype__end(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSTLSSocket* thisObject = jsDynamicCast<JSTLSSocket*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__flushCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSTLSSocket* thisObject = jsDynamicCast<JSTLSSocket*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return TLSSocketPrototype__flush(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__getAuthorizationErrorCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return TLSSocketPrototype__flush(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSTLSSocket* thisObject = jsDynamicCast<JSTLSSocket*>(callFrame->thisValue()); + + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } + + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + + return TLSSocketPrototype__getAuthorizationError(thisObject->wrapped(), lexicalGlobalObject, callFrame); + } + JSC_DEFINE_CUSTOM_GETTER(TLSSocketPrototype__listenerGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSTLSSocket* thisObject = jsCast<JSTLSSocket*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -12194,11 +13254,12 @@ JSC_DEFINE_CUSTOM_GETTER(TLSSocketPrototype__listenerGetterWrap, (JSGlobalObject RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + JSC_DEFINE_CUSTOM_GETTER(TLSSocketPrototype__localPortGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSTLSSocket* thisObject = jsCast<JSTLSSocket*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -12206,11 +13267,12 @@ JSC_DEFINE_CUSTOM_GETTER(TLSSocketPrototype__localPortGetterWrap, (JSGlobalObjec RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + JSC_DEFINE_CUSTOM_GETTER(TLSSocketPrototype__readyStateGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSTLSSocket* thisObject = jsCast<JSTLSSocket*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -12218,133 +13280,144 @@ JSC_DEFINE_CUSTOM_GETTER(TLSSocketPrototype__readyStateGetterWrap, (JSGlobalObje RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + -JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__refCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__refCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - JSTLSSocket* thisObject = jsDynamicCast<JSTLSSocket*>(callFrame->thisValue()); + JSTLSSocket* thisObject = jsDynamicCast<JSTLSSocket*>(callFrame->thisValue()); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return TLSSocketPrototype__ref(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + return TLSSocketPrototype__ref(thisObject->wrapped(), lexicalGlobalObject, callFrame); + } + -JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__reloadCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__reloadCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - JSTLSSocket* thisObject = jsDynamicCast<JSTLSSocket*>(callFrame->thisValue()); + JSTLSSocket* thisObject = jsDynamicCast<JSTLSSocket*>(callFrame->thisValue()); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return TLSSocketPrototype__reload(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + return TLSSocketPrototype__reload(thisObject->wrapped(), lexicalGlobalObject, callFrame); + } + JSC_DEFINE_CUSTOM_GETTER(TLSSocketPrototype__remoteAddressGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSTLSSocket* thisObject = jsCast<JSTLSSocket*>(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + if (JSValue cachedValue = thisObject->m_remoteAddress.get()) return JSValue::encode(cachedValue); - + JSC::JSValue result = JSC::JSValue::decode( - TLSSocketPrototype__getRemoteAddress(thisObject->wrapped(), globalObject)); + TLSSocketPrototype__getRemoteAddress(thisObject->wrapped(), globalObject) + ); RETURN_IF_EXCEPTION(throwScope, {}); thisObject->m_remoteAddress.set(vm, thisObject, result); RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); } -extern "C" void TLSSocketPrototype__remoteAddressSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast<JSTLSSocket*>(JSValue::decode(thisValue)); - thisObject->m_remoteAddress.set(vm, thisObject, JSValue::decode(value)); -} -extern "C" EncodedJSValue TLSSocketPrototype__remoteAddressGetCachedValue(JSC::EncodedJSValue thisValue) -{ + extern "C" void TLSSocketPrototype__remoteAddressSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject *globalObject, JSC::EncodedJSValue value) + { + auto& vm = globalObject->vm(); + auto* thisObject = jsCast<JSTLSSocket*>(JSValue::decode(thisValue)); + thisObject->m_remoteAddress.set(vm, thisObject, JSValue::decode(value)); + } + + extern "C" EncodedJSValue TLSSocketPrototype__remoteAddressGetCachedValue(JSC::EncodedJSValue thisValue) + { auto* thisObject = jsCast<JSTLSSocket*>(JSValue::decode(thisValue)); return JSValue::encode(thisObject->m_remoteAddress.get()); -} + } + + -JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__shutdownCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__shutdownCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - JSTLSSocket* thisObject = jsDynamicCast<JSTLSSocket*>(callFrame->thisValue()); + JSTLSSocket* thisObject = jsDynamicCast<JSTLSSocket*>(callFrame->thisValue()); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } + + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + + return TLSSocketPrototype__shutdown(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__timeoutCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return TLSSocketPrototype__shutdown(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSTLSSocket* thisObject = jsDynamicCast<JSTLSSocket*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__timeoutCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSTLSSocket* thisObject = jsDynamicCast<JSTLSSocket*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return TLSSocketPrototype__timeout(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__unrefCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return TLSSocketPrototype__timeout(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSTLSSocket* thisObject = jsDynamicCast<JSTLSSocket*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__unrefCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSTLSSocket* thisObject = jsDynamicCast<JSTLSSocket*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return TLSSocketPrototype__unref(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__writeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return TLSSocketPrototype__unref(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSTLSSocket* thisObject = jsDynamicCast<JSTLSSocket*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__writeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSTLSSocket* thisObject = jsDynamicCast<JSTLSSocket*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return TLSSocketPrototype__write(thisObject->wrapped(), lexicalGlobalObject, callFrame); } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - return TLSSocketPrototype__write(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + void JSTLSSocketPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) { @@ -12354,10 +13427,9 @@ void JSTLSSocketPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* glob } extern "C" bool TLSSocket__hasPendingActivity(void* ptr); -bool JSTLSSocket::hasPendingActivity(void* ctx) -{ - return TLSSocket__hasPendingActivity(ctx); -} + bool JSTLSSocket::hasPendingActivity(void* ctx) { + return TLSSocket__hasPendingActivity(ctx); + } JSTLSSocket::~JSTLSSocket() { @@ -12369,7 +13441,7 @@ void JSTLSSocket::destroy(JSCell* cell) { static_cast<JSTLSSocket*>(cell)->JSTLSSocket::~JSTLSSocket(); } - + const ClassInfo JSTLSSocket::s_info = { "TLSSocket"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTLSSocket) }; void JSTLSSocket::finishCreation(VM& vm) @@ -12378,38 +13450,37 @@ void JSTLSSocket::finishCreation(VM& vm) ASSERT(inherits(info())); } -JSTLSSocket* JSTLSSocket::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSTLSSocket* ptr = new (NotNull, JSC::allocateCell<JSTLSSocket>(vm)) JSTLSSocket(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} -extern "C" void* TLSSocket__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; +JSTLSSocket* JSTLSSocket::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) { + JSTLSSocket* ptr = new (NotNull, JSC::allocateCell<JSTLSSocket>(vm)) JSTLSSocket(vm, structure, ctx); + ptr->finishCreation(vm); + return ptr; +} - JSC::JSCell* cell = decodedValue.asCell(); - JSTLSSocket* object = JSC::jsDynamicCast<JSTLSSocket*>(cell); +extern "C" void* TLSSocket__fromJS(JSC::EncodedJSValue value) { + JSC::JSValue decodedValue = JSC::JSValue::decode(value); + if (decodedValue.isEmpty() || !decodedValue.isCell()) + return nullptr; - if (!object) - return nullptr; + JSC::JSCell* cell = decodedValue.asCell(); + JSTLSSocket* object = JSC::jsDynamicCast<JSTLSSocket*>(cell); - return object->wrapped(); + if (!object) + return nullptr; + + return object->wrapped(); } -extern "C" bool TLSSocket__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSTLSSocket* object = JSC::jsDynamicCast<JSTLSSocket*>(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; +extern "C" bool TLSSocket__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) { + JSTLSSocket* object = JSC::jsDynamicCast<JSTLSSocket*>(JSValue::decode(value)); + if (!object) + return false; + + object->m_ctx = ptr; + return true; } + extern "C" const size_t TLSSocket__ptrOffset = JSTLSSocket::offsetOfWrapped(); void JSTLSSocket::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) @@ -12422,18 +13493,19 @@ void JSTLSSocket::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) Base::analyzeHeap(cell, analyzer); } + + JSObject* JSTLSSocket::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) { return JSTLSSocketPrototype::create(vm, globalObject, JSTLSSocketPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); } -extern "C" EncodedJSValue TLSSocket__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSTLSSocketStructure(); - JSTLSSocket* instance = JSTLSSocket::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); +extern "C" EncodedJSValue TLSSocket__create(Zig::GlobalObject* globalObject, void* ptr) { + auto &vm = globalObject->vm(); + JSC::Structure* structure = globalObject->JSTLSSocketStructure(); + JSTLSSocket* instance = JSTLSSocket::create(vm, globalObject, structure, ptr); + + return JSValue::encode(instance); } template<typename Visitor> @@ -12442,10 +13514,11 @@ void JSTLSSocket::visitChildrenImpl(JSCell* cell, Visitor& visitor) JSTLSSocket* thisObject = jsCast<JSTLSSocket*>(cell); ASSERT_GC_OBJECT_INHERITS(thisObject, info()); Base::visitChildren(thisObject, visitor); - + + visitor.append(thisObject->m_data); visitor.append(thisObject->m_remoteAddress); - visitor.addOpaqueRoot(thisObject->wrapped()); +visitor.addOpaqueRoot(thisObject->wrapped()); } DEFINE_VISIT_CHILDREN(JSTLSSocket); @@ -12453,10 +13526,10 @@ DEFINE_VISIT_CHILDREN(JSTLSSocket); template<typename Visitor> void JSTLSSocket::visitAdditionalChildren(Visitor& visitor) { - JSTLSSocket* thisObject = this; + JSTLSSocket* thisObject = this; ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - - visitor.append(thisObject->m_data); + + visitor.append(thisObject->m_data); visitor.append(thisObject->m_remoteAddress); visitor.addOpaqueRoot(this->wrapped()); } @@ -12464,7 +13537,7 @@ void JSTLSSocket::visitAdditionalChildren(Visitor& visitor) DEFINE_VISIT_ADDITIONAL_CHILDREN(JSTLSSocket); template<typename Visitor> -void JSTLSSocket::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) +void JSTLSSocket::visitOutputConstraintsImpl(JSCell *cell, Visitor& visitor) { JSTLSSocket* thisObject = jsCast<JSTLSSocket*>(cell); ASSERT_GC_OBJECT_INHERITS(thisObject, info()); @@ -12472,88 +13545,91 @@ void JSTLSSocket::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) } DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSTLSSocket); -class JSTextDecoderPrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSTextDecoderPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSTextDecoderPrototype* ptr = new (NotNull, JSC::allocateCell<JSTextDecoderPrototype>(vm)) JSTextDecoderPrototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template<typename CellType, JSC::SubspaceAccess> - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSTextDecoderPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; + class JSTextDecoderPrototype final : public JSC::JSNonFinalObject { + public: + using Base = JSC::JSNonFinalObject; + + static JSTextDecoderPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) + { + JSTextDecoderPrototype* ptr = new (NotNull, JSC::allocateCell<JSTextDecoderPrototype>(vm)) JSTextDecoderPrototype(vm, globalObject, structure); + ptr->finishCreation(vm, globalObject); + return ptr; + } + + DECLARE_INFO; + template<typename CellType, JSC::SubspaceAccess> + static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + return &vm.plainObjectSpace(); + } + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); + } + + private: + JSTextDecoderPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) + : Base(vm, structure) + { + } + + void finishCreation(JSC::VM&, JSC::JSGlobalObject*); + }; class JSTextDecoderConstructor final : public JSC::InternalFunction { -public: - using Base = JSC::InternalFunction; - static JSTextDecoderConstructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSTextDecoderPrototype* prototype); - - static constexpr unsigned StructureFlags = Base::StructureFlags; - static constexpr bool needsDestruction = false; - - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); - } - - template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl<JSTextDecoderConstructor, WebCore::UseCustomHeapCellType::No>( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForTextDecoderConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForTextDecoderConstructor = std::forward<decltype(space)>(space); }, - [](auto& spaces) { return spaces.m_subspaceForTextDecoderConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForTextDecoderConstructor = std::forward<decltype(space)>(space); }); - } - - void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSTextDecoderPrototype* prototype); + public: + using Base = JSC::InternalFunction; + static JSTextDecoderConstructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSTextDecoderPrototype* prototype); + + static constexpr unsigned StructureFlags = Base::StructureFlags; + static constexpr bool needsDestruction = false; + + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); + } + + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return WebCore::subspaceForImpl<JSTextDecoderConstructor, WebCore::UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForTextDecoderConstructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForTextDecoderConstructor = std::forward<decltype(space)>(space); }, + [](auto& spaces) { return spaces.m_subspaceForTextDecoderConstructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForTextDecoderConstructor = std::forward<decltype(space)>(space); }); + } + + + void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSTextDecoderPrototype* prototype); + + // Must be defined for each specialization class. + static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); + + DECLARE_EXPORT_INFO; + private: + JSTextDecoderConstructor(JSC::VM& vm, JSC::Structure* structure); + void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSTextDecoderPrototype* prototype); + }; - // Must be defined for each specialization class. - static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); - - DECLARE_EXPORT_INFO; - -private: - JSTextDecoderConstructor(JSC::VM& vm, JSC::Structure* structure); - void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSTextDecoderPrototype* prototype); -}; extern "C" void* TextDecoderClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); JSC_DECLARE_CUSTOM_GETTER(jsTextDecoderConstructor); extern "C" void TextDecoderClass__finalize(void*); + extern "C" EncodedJSValue TextDecoderPrototype__decode(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(TextDecoderPrototype__decodeCallback); + extern "C" JSC_DECLARE_JIT_OPERATION_WITHOUT_WTF_INTERNAL(TextDecoderPrototype__decodeWithoutTypeChecksWrapper, EncodedJSValue, (JSC::JSGlobalObject * lexicalGlobalObject, void* thisValue, JSC::JSUint8Array* arg0)); -extern "C" EncodedJSValue TextDecoderPrototype__decodeWithoutTypeChecks(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::JSUint8Array* arg0); + extern "C" EncodedJSValue TextDecoderPrototype__decodeWithoutTypeChecks(void* ptr, JSC::JSGlobalObject * lexicalGlobalObject, JSC::JSUint8Array* arg0); -static const JSC::DOMJIT::Signature DOMJITSignatureForTextDecoderPrototype__decode(TextDecoderPrototype__decodeWithoutTypeChecksWrapper, - JSTextDecoder::info(), - JSC::DOMJIT::Effect::forReadWrite(JSC::DOMJIT::HeapRange::top(), JSC::DOMJIT::HeapRange::top()), - JSC::SpecString, JSC::SpecUint8Array); + static const JSC::DOMJIT::Signature DOMJITSignatureForTextDecoderPrototype__decode(TextDecoderPrototype__decodeWithoutTypeChecksWrapper, + JSTextDecoder::info(), + JSC::DOMJIT::Effect::forReadWrite(JSC::DOMJIT::HeapRange::top(), JSC::DOMJIT::HeapRange::top()), + JSC::SpecString, JSC::SpecUint8Array); JSC_DEFINE_JIT_OPERATION(TextDecoderPrototype__decodeWithoutTypeChecksWrapper, EncodedJSValue, (JSC::JSGlobalObject * lexicalGlobalObject, void* thisValue, JSC::JSUint8Array* arg0)) { @@ -12568,19 +13644,26 @@ JSC_DEFINE_JIT_OPERATION(TextDecoderPrototype__decodeWithoutTypeChecksWrapper, E extern "C" JSC::EncodedJSValue TextDecoderPrototype__getEncoding(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(TextDecoderPrototype__encodingGetterWrap); + extern "C" JSC::EncodedJSValue TextDecoderPrototype__getFatal(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(TextDecoderPrototype__fatalGetterWrap); + STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSTextDecoderPrototype, JSTextDecoderPrototype::Base); -static const HashTableValue JSTextDecoderPrototypeTableValues[] = { - { "decode"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | JSC::PropertyAttribute::DOMJITFunction | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::DOMJITFunctionType, TextDecoderPrototype__decodeCallback, &DOMJITSignatureForTextDecoderPrototype__decode } }, - { "encoding"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, TextDecoderPrototype__encodingGetterWrap, 0 } }, - { "fatal"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, TextDecoderPrototype__fatalGetterWrap, 0 } } + + static const HashTableValue JSTextDecoderPrototypeTableValues[] = { +{ "decode"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | JSC::PropertyAttribute::DOMJITFunction | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::DOMJITFunctionType, TextDecoderPrototype__decodeCallback, &DOMJITSignatureForTextDecoderPrototype__decode } } , +{ "encoding"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, TextDecoderPrototype__encodingGetterWrap, 0 } } , +{ "fatal"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::GetterSetterType, TextDecoderPrototype__fatalGetterWrap, 0 } } }; + + const ClassInfo JSTextDecoderPrototype::s_info = { "TextDecoder"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTextDecoderPrototype) }; + + JSC_DEFINE_CUSTOM_GETTER(jsTextDecoderConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); @@ -12591,59 +13674,66 @@ JSC_DEFINE_CUSTOM_GETTER(jsTextDecoderConstructor, (JSGlobalObject * lexicalGlob if (UNLIKELY(!prototype)) return throwVMTypeError(lexicalGlobalObject, throwScope); return JSValue::encode(globalObject->JSTextDecoderConstructor()); -} +} + -JSC_DEFINE_HOST_FUNCTION(TextDecoderPrototype__decodeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - JSTextDecoder* thisObject = jsDynamicCast<JSTextDecoder*>(callFrame->thisValue()); + JSC_DEFINE_HOST_FUNCTION(TextDecoderPrototype__decodeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } + JSTextDecoder* thisObject = jsDynamicCast<JSTextDecoder*>(callFrame->thisValue()); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - return TextDecoderPrototype__decode(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + + return TextDecoderPrototype__decode(thisObject->wrapped(), lexicalGlobalObject, callFrame); + } + JSC_DEFINE_CUSTOM_GETTER(TextDecoderPrototype__encodingGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSTextDecoder* thisObject = jsCast<JSTextDecoder*>(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + if (JSValue cachedValue = thisObject->m_encoding.get()) return JSValue::encode(cachedValue); - + JSC::JSValue result = JSC::JSValue::decode( - TextDecoderPrototype__getEncoding(thisObject->wrapped(), globalObject)); + TextDecoderPrototype__getEncoding(thisObject->wrapped(), globalObject) + ); RETURN_IF_EXCEPTION(throwScope, {}); thisObject->m_encoding.set(vm, thisObject, result); RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); } -extern "C" void TextDecoderPrototype__encodingSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - auto& vm = globalObject->vm(); - auto* thisObject = jsCast<JSTextDecoder*>(JSValue::decode(thisValue)); - thisObject->m_encoding.set(vm, thisObject, JSValue::decode(value)); -} -extern "C" EncodedJSValue TextDecoderPrototype__encodingGetCachedValue(JSC::EncodedJSValue thisValue) -{ + extern "C" void TextDecoderPrototype__encodingSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject *globalObject, JSC::EncodedJSValue value) + { + auto& vm = globalObject->vm(); + auto* thisObject = jsCast<JSTextDecoder*>(JSValue::decode(thisValue)); + thisObject->m_encoding.set(vm, thisObject, JSValue::decode(value)); + } + + extern "C" EncodedJSValue TextDecoderPrototype__encodingGetCachedValue(JSC::EncodedJSValue thisValue) + { auto* thisObject = jsCast<JSTextDecoder*>(JSValue::decode(thisValue)); return JSValue::encode(thisObject->m_encoding.get()); -} + } + + JSC_DEFINE_CUSTOM_GETTER(TextDecoderPrototype__fatalGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSTextDecoder* thisObject = jsCast<JSTextDecoder*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -12651,6 +13741,7 @@ JSC_DEFINE_CUSTOM_GETTER(TextDecoderPrototype__fatalGetterWrap, (JSGlobalObject RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + void JSTextDecoderPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) { @@ -12662,64 +13753,67 @@ void JSTextDecoderPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* gl void JSTextDecoderConstructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSTextDecoderPrototype* prototype) { Base::finishCreation(vm, 0, "TextDecoder"_s, PropertyAdditionMode::WithoutStructureTransition); - + putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly); ASSERT(inherits(info())); } -JSTextDecoderConstructor::JSTextDecoderConstructor(JSC::VM& vm, JSC::Structure* structure) - : Base(vm, structure, construct, construct) -{ -} +JSTextDecoderConstructor::JSTextDecoderConstructor(JSC::VM& vm, JSC::Structure* structure) : Base(vm, structure, construct, construct) { -JSTextDecoderConstructor* JSTextDecoderConstructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSTextDecoderPrototype* prototype) -{ + } + +JSTextDecoderConstructor* JSTextDecoderConstructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSTextDecoderPrototype* prototype) { JSTextDecoderConstructor* ptr = new (NotNull, JSC::allocateCell<JSTextDecoderConstructor>(vm)) JSTextDecoderConstructor(vm, structure); ptr->finishCreation(vm, globalObject, prototype); return ptr; } + JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSTextDecoderConstructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) { - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); - JSC::VM& vm = globalObject->vm(); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + JSC::VM &vm = globalObject->vm(); JSObject* newTarget = asObject(callFrame->newTarget()); auto* constructor = globalObject->JSTextDecoderConstructor(); Structure* structure = globalObject->JSTextDecoderStructure(); if (constructor != newTarget) { - auto scope = DECLARE_THROW_SCOPE(vm); + auto scope = DECLARE_THROW_SCOPE(vm); - auto* functionGlobalObject = reinterpret_cast<Zig::GlobalObject*>( - // ShadowRealm functions belong to a different global object. - getFunctionRealm(globalObject, newTarget)); - RETURN_IF_EXCEPTION(scope, {}); - structure = InternalFunction::createSubclassStructure( - globalObject, - newTarget, - functionGlobalObject->JSTextDecoderStructure()); + auto* functionGlobalObject = reinterpret_cast<Zig::GlobalObject*>( + // ShadowRealm functions belong to a different global object. + getFunctionRealm(globalObject, newTarget) + ); + RETURN_IF_EXCEPTION(scope, {}); + structure = InternalFunction::createSubclassStructure( + globalObject, + newTarget, + functionGlobalObject->JSTextDecoderStructure() + ); } void* ptr = TextDecoderClass__construct(globalObject, callFrame); if (UNLIKELY(!ptr)) { - return JSValue::encode(JSC::jsUndefined()); + return JSValue::encode(JSC::jsUndefined()); } JSTextDecoder* instance = JSTextDecoder::create(vm, globalObject, structure, ptr); + return JSValue::encode(instance); } void JSTextDecoderConstructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSTextDecoderPrototype* prototype) { + } const ClassInfo JSTextDecoderConstructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTextDecoderConstructor) }; -extern "C" EncodedJSValue TextDecoder__getConstructor(Zig::GlobalObject* globalObject) -{ + + extern "C" EncodedJSValue TextDecoder__getConstructor(Zig::GlobalObject* globalObject) { return JSValue::encode(globalObject->JSTextDecoderConstructor()); -} + } JSTextDecoder::~JSTextDecoder() { @@ -12731,7 +13825,7 @@ void JSTextDecoder::destroy(JSCell* cell) { static_cast<JSTextDecoder*>(cell)->JSTextDecoder::~JSTextDecoder(); } - + const ClassInfo JSTextDecoder::s_info = { "TextDecoder"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTextDecoder) }; void JSTextDecoder::finishCreation(VM& vm) @@ -12740,38 +13834,37 @@ void JSTextDecoder::finishCreation(VM& vm) ASSERT(inherits(info())); } -JSTextDecoder* JSTextDecoder::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSTextDecoder* ptr = new (NotNull, JSC::allocateCell<JSTextDecoder>(vm)) JSTextDecoder(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} -extern "C" void* TextDecoder__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; +JSTextDecoder* JSTextDecoder::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) { + JSTextDecoder* ptr = new (NotNull, JSC::allocateCell<JSTextDecoder>(vm)) JSTextDecoder(vm, structure, ctx); + ptr->finishCreation(vm); + return ptr; +} - JSC::JSCell* cell = decodedValue.asCell(); - JSTextDecoder* object = JSC::jsDynamicCast<JSTextDecoder*>(cell); +extern "C" void* TextDecoder__fromJS(JSC::EncodedJSValue value) { + JSC::JSValue decodedValue = JSC::JSValue::decode(value); + if (decodedValue.isEmpty() || !decodedValue.isCell()) + return nullptr; - if (!object) - return nullptr; + JSC::JSCell* cell = decodedValue.asCell(); + JSTextDecoder* object = JSC::jsDynamicCast<JSTextDecoder*>(cell); - return object->wrapped(); + if (!object) + return nullptr; + + return object->wrapped(); } -extern "C" bool TextDecoder__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSTextDecoder* object = JSC::jsDynamicCast<JSTextDecoder*>(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; +extern "C" bool TextDecoder__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) { + JSTextDecoder* object = JSC::jsDynamicCast<JSTextDecoder*>(JSValue::decode(value)); + if (!object) + return false; + + object->m_ctx = ptr; + return true; } + extern "C" const size_t TextDecoder__ptrOffset = JSTextDecoder::offsetOfWrapped(); void JSTextDecoder::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) @@ -12786,7 +13879,7 @@ void JSTextDecoder::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) JSObject* JSTextDecoder::createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype) { - return WebCore::JSTextDecoderConstructor::create(vm, globalObject, WebCore::JSTextDecoderConstructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast<WebCore::JSTextDecoderPrototype*>(prototype)); + return WebCore::JSTextDecoderConstructor::create(vm, globalObject, WebCore::JSTextDecoderConstructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast<WebCore::JSTextDecoderPrototype*>(prototype)); } JSObject* JSTextDecoder::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) @@ -12794,13 +13887,12 @@ JSObject* JSTextDecoder::createPrototype(VM& vm, JSDOMGlobalObject* globalObject return JSTextDecoderPrototype::create(vm, globalObject, JSTextDecoderPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); } -extern "C" EncodedJSValue TextDecoder__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSTextDecoderStructure(); - JSTextDecoder* instance = JSTextDecoder::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); +extern "C" EncodedJSValue TextDecoder__create(Zig::GlobalObject* globalObject, void* ptr) { + auto &vm = globalObject->vm(); + JSC::Structure* structure = globalObject->JSTextDecoderStructure(); + JSTextDecoder* instance = JSTextDecoder::create(vm, globalObject, structure, ptr); + + return JSValue::encode(instance); } template<typename Visitor> @@ -12809,8 +13901,10 @@ void JSTextDecoder::visitChildrenImpl(JSCell* cell, Visitor& visitor) JSTextDecoder* thisObject = jsCast<JSTextDecoder*>(cell); ASSERT_GC_OBJECT_INHERITS(thisObject, info()); Base::visitChildren(thisObject, visitor); - + + visitor.append(thisObject->m_encoding); + } DEFINE_VISIT_CHILDREN(JSTextDecoder); @@ -12818,17 +13912,17 @@ DEFINE_VISIT_CHILDREN(JSTextDecoder); template<typename Visitor> void JSTextDecoder::visitAdditionalChildren(Visitor& visitor) { - JSTextDecoder* thisObject = this; + JSTextDecoder* thisObject = this; ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - - visitor.append(thisObject->m_encoding); + + visitor.append(thisObject->m_encoding); ; } DEFINE_VISIT_ADDITIONAL_CHILDREN(JSTextDecoder); template<typename Visitor> -void JSTextDecoder::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) +void JSTextDecoder::visitOutputConstraintsImpl(JSCell *cell, Visitor& visitor) { JSTextDecoder* thisObject = jsCast<JSTextDecoder*>(cell); ASSERT_GC_OBJECT_INHERITS(thisObject, info()); @@ -12836,124 +13930,137 @@ void JSTextDecoder::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) } DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSTextDecoder); -class JSTimeoutPrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSTimeoutPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSTimeoutPrototype* ptr = new (NotNull, JSC::allocateCell<JSTimeoutPrototype>(vm)) JSTimeoutPrototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template<typename CellType, JSC::SubspaceAccess> - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSTimeoutPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; + class JSTimeoutPrototype final : public JSC::JSNonFinalObject { + public: + using Base = JSC::JSNonFinalObject; + + static JSTimeoutPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) + { + JSTimeoutPrototype* ptr = new (NotNull, JSC::allocateCell<JSTimeoutPrototype>(vm)) JSTimeoutPrototype(vm, globalObject, structure); + ptr->finishCreation(vm, globalObject); + return ptr; + } + + DECLARE_INFO; + template<typename CellType, JSC::SubspaceAccess> + static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + return &vm.plainObjectSpace(); + } + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); + } + + private: + JSTimeoutPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) + : Base(vm, structure) + { + } + + void finishCreation(JSC::VM&, JSC::JSGlobalObject*); + }; extern "C" void TimeoutClass__finalize(void*); + extern "C" EncodedJSValue TimeoutPrototype__toPrimitive(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(TimeoutPrototype__toPrimitiveCallback); + extern "C" EncodedJSValue TimeoutPrototype__hasRef(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(TimeoutPrototype__hasRefCallback); + extern "C" EncodedJSValue TimeoutPrototype__doRef(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(TimeoutPrototype__refCallback); + extern "C" EncodedJSValue TimeoutPrototype__doUnref(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(TimeoutPrototype__unrefCallback); + STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSTimeoutPrototype, JSTimeoutPrototype::Base); -static const HashTableValue JSTimeoutPrototypeTableValues[] = { - { "hasRef"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TimeoutPrototype__hasRefCallback, 0 } }, - { "ref"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TimeoutPrototype__refCallback, 0 } }, - { "unref"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TimeoutPrototype__unrefCallback, 0 } } + + static const HashTableValue JSTimeoutPrototypeTableValues[] = { +{ "hasRef"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TimeoutPrototype__hasRefCallback, 0 } } , +{ "ref"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TimeoutPrototype__refCallback, 0 } } , +{ "unref"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TimeoutPrototype__unrefCallback, 0 } } }; -const ClassInfo JSTimeoutPrototype::s_info = { "Timeout"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTimeoutPrototype) }; -JSC_DEFINE_HOST_FUNCTION(TimeoutPrototype__toPrimitiveCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - JSTimeout* thisObject = jsDynamicCast<JSTimeout*>(callFrame->thisValue()); +const ClassInfo JSTimeoutPrototype::s_info = { "Timeout"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTimeoutPrototype) }; - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(TimeoutPrototype__toPrimitiveCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return TimeoutPrototype__toPrimitive(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSTimeout* thisObject = jsDynamicCast<JSTimeout*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(TimeoutPrototype__hasRefCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSTimeout* thisObject = jsDynamicCast<JSTimeout*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return TimeoutPrototype__toPrimitive(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(TimeoutPrototype__hasRefCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return TimeoutPrototype__hasRef(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSTimeout* thisObject = jsDynamicCast<JSTimeout*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(TimeoutPrototype__refCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSTimeout* thisObject = jsDynamicCast<JSTimeout*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return TimeoutPrototype__hasRef(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(TimeoutPrototype__refCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return TimeoutPrototype__doRef(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSTimeout* thisObject = jsDynamicCast<JSTimeout*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(TimeoutPrototype__unrefCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSTimeout* thisObject = jsDynamicCast<JSTimeout*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return TimeoutPrototype__doRef(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(TimeoutPrototype__unrefCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return TimeoutPrototype__doUnref(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSTimeout* thisObject = jsDynamicCast<JSTimeout*>(callFrame->thisValue()); + + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } + + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + + return TimeoutPrototype__doUnref(thisObject->wrapped(), lexicalGlobalObject, callFrame); + } + void JSTimeoutPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) { @@ -12973,7 +14080,7 @@ void JSTimeout::destroy(JSCell* cell) { static_cast<JSTimeout*>(cell)->JSTimeout::~JSTimeout(); } - + const ClassInfo JSTimeout::s_info = { "Timeout"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTimeout) }; void JSTimeout::finishCreation(VM& vm) @@ -12982,38 +14089,37 @@ void JSTimeout::finishCreation(VM& vm) ASSERT(inherits(info())); } -JSTimeout* JSTimeout::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSTimeout* ptr = new (NotNull, JSC::allocateCell<JSTimeout>(vm)) JSTimeout(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} -extern "C" void* Timeout__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; +JSTimeout* JSTimeout::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) { + JSTimeout* ptr = new (NotNull, JSC::allocateCell<JSTimeout>(vm)) JSTimeout(vm, structure, ctx); + ptr->finishCreation(vm); + return ptr; +} - JSC::JSCell* cell = decodedValue.asCell(); - JSTimeout* object = JSC::jsDynamicCast<JSTimeout*>(cell); +extern "C" void* Timeout__fromJS(JSC::EncodedJSValue value) { + JSC::JSValue decodedValue = JSC::JSValue::decode(value); + if (decodedValue.isEmpty() || !decodedValue.isCell()) + return nullptr; - if (!object) - return nullptr; + JSC::JSCell* cell = decodedValue.asCell(); + JSTimeout* object = JSC::jsDynamicCast<JSTimeout*>(cell); - return object->wrapped(); + if (!object) + return nullptr; + + return object->wrapped(); } -extern "C" bool Timeout__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSTimeout* object = JSC::jsDynamicCast<JSTimeout*>(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; +extern "C" bool Timeout__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) { + JSTimeout* object = JSC::jsDynamicCast<JSTimeout*>(JSValue::decode(value)); + if (!object) + return false; + + object->m_ctx = ptr; + return true; } + extern "C" const size_t Timeout__ptrOffset = JSTimeout::offsetOfWrapped(); void JSTimeout::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) @@ -13026,114 +14132,126 @@ void JSTimeout::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) Base::analyzeHeap(cell, analyzer); } + + JSObject* JSTimeout::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) { return JSTimeoutPrototype::create(vm, globalObject, JSTimeoutPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); } -extern "C" EncodedJSValue Timeout__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSTimeoutStructure(); - JSTimeout* instance = JSTimeout::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} -class JSTranspilerPrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; - - static JSTranspilerPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) - { - JSTranspilerPrototype* ptr = new (NotNull, JSC::allocateCell<JSTranspilerPrototype>(vm)) JSTranspilerPrototype(vm, globalObject, structure); - ptr->finishCreation(vm, globalObject); - return ptr; - } - - DECLARE_INFO; - template<typename CellType, JSC::SubspaceAccess> - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - return &vm.plainObjectSpace(); - } - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); - } - -private: - JSTranspilerPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { - } - - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; +extern "C" EncodedJSValue Timeout__create(Zig::GlobalObject* globalObject, void* ptr) { + auto &vm = globalObject->vm(); + JSC::Structure* structure = globalObject->JSTimeoutStructure(); + JSTimeout* instance = JSTimeout::create(vm, globalObject, structure, ptr); + + return JSValue::encode(instance); +} + class JSTranspilerPrototype final : public JSC::JSNonFinalObject { + public: + using Base = JSC::JSNonFinalObject; + + static JSTranspilerPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) + { + JSTranspilerPrototype* ptr = new (NotNull, JSC::allocateCell<JSTranspilerPrototype>(vm)) JSTranspilerPrototype(vm, globalObject, structure); + ptr->finishCreation(vm, globalObject); + return ptr; + } + + DECLARE_INFO; + template<typename CellType, JSC::SubspaceAccess> + static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + return &vm.plainObjectSpace(); + } + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); + } + + private: + JSTranspilerPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) + : Base(vm, structure) + { + } + + void finishCreation(JSC::VM&, JSC::JSGlobalObject*); + }; class JSTranspilerConstructor final : public JSC::InternalFunction { -public: - using Base = JSC::InternalFunction; - static JSTranspilerConstructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSTranspilerPrototype* prototype); - - static constexpr unsigned StructureFlags = Base::StructureFlags; - static constexpr bool needsDestruction = false; - - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); - } - - template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl<JSTranspilerConstructor, WebCore::UseCustomHeapCellType::No>( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForTranspilerConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForTranspilerConstructor = std::forward<decltype(space)>(space); }, - [](auto& spaces) { return spaces.m_subspaceForTranspilerConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForTranspilerConstructor = std::forward<decltype(space)>(space); }); - } - - void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSTranspilerPrototype* prototype); + public: + using Base = JSC::InternalFunction; + static JSTranspilerConstructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSTranspilerPrototype* prototype); + + static constexpr unsigned StructureFlags = Base::StructureFlags; + static constexpr bool needsDestruction = false; + + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); + } + + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return WebCore::subspaceForImpl<JSTranspilerConstructor, WebCore::UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForTranspilerConstructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForTranspilerConstructor = std::forward<decltype(space)>(space); }, + [](auto& spaces) { return spaces.m_subspaceForTranspilerConstructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForTranspilerConstructor = std::forward<decltype(space)>(space); }); + } + + + void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSTranspilerPrototype* prototype); + + // Must be defined for each specialization class. + static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); + + DECLARE_EXPORT_INFO; + private: + JSTranspilerConstructor(JSC::VM& vm, JSC::Structure* structure); + void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSTranspilerPrototype* prototype); + }; - // Must be defined for each specialization class. - static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); - - DECLARE_EXPORT_INFO; - -private: - JSTranspilerConstructor(JSC::VM& vm, JSC::Structure* structure); - void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSTranspilerPrototype* prototype); -}; extern "C" void* TranspilerClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); JSC_DECLARE_CUSTOM_GETTER(jsTranspilerConstructor); extern "C" void TranspilerClass__finalize(void*); + extern "C" EncodedJSValue TranspilerPrototype__scan(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(TranspilerPrototype__scanCallback); + extern "C" EncodedJSValue TranspilerPrototype__scanImports(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(TranspilerPrototype__scanImportsCallback); + extern "C" EncodedJSValue TranspilerPrototype__transform(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(TranspilerPrototype__transformCallback); + extern "C" EncodedJSValue TranspilerPrototype__transformSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(TranspilerPrototype__transformSyncCallback); + STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSTranspilerPrototype, JSTranspilerPrototype::Base); -static const HashTableValue JSTranspilerPrototypeTableValues[] = { - { "scan"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TranspilerPrototype__scanCallback, 2 } }, - { "scanImports"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TranspilerPrototype__scanImportsCallback, 2 } }, - { "transform"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TranspilerPrototype__transformCallback, 2 } }, - { "transformSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TranspilerPrototype__transformSyncCallback, 2 } } + + static const HashTableValue JSTranspilerPrototypeTableValues[] = { +{ "scan"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TranspilerPrototype__scanCallback, 2 } } , +{ "scanImports"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TranspilerPrototype__scanImportsCallback, 2 } } , +{ "transform"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TranspilerPrototype__transformCallback, 2 } } , +{ "transformSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, TranspilerPrototype__transformSyncCallback, 2 } } }; + + const ClassInfo JSTranspilerPrototype::s_info = { "Transpiler"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTranspilerPrototype) }; + + JSC_DEFINE_CUSTOM_GETTER(jsTranspilerConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); @@ -13144,71 +14262,77 @@ JSC_DEFINE_CUSTOM_GETTER(jsTranspilerConstructor, (JSGlobalObject * lexicalGloba if (UNLIKELY(!prototype)) return throwVMTypeError(lexicalGlobalObject, throwScope); return JSValue::encode(globalObject->JSTranspilerConstructor()); -} +} + -JSC_DEFINE_HOST_FUNCTION(TranspilerPrototype__scanCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - JSTranspiler* thisObject = jsDynamicCast<JSTranspiler*>(callFrame->thisValue()); + JSC_DEFINE_HOST_FUNCTION(TranspilerPrototype__scanCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + JSTranspiler* thisObject = jsDynamicCast<JSTranspiler*>(callFrame->thisValue()); + + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } + + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + + return TranspilerPrototype__scan(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(TranspilerPrototype__scanImportsCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return TranspilerPrototype__scan(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSTranspiler* thisObject = jsDynamicCast<JSTranspiler*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(TranspilerPrototype__scanImportsCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSTranspiler* thisObject = jsDynamicCast<JSTranspiler*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return TranspilerPrototype__scanImports(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(TranspilerPrototype__transformCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return TranspilerPrototype__scanImports(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSTranspiler* thisObject = jsDynamicCast<JSTranspiler*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(TranspilerPrototype__transformCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSTranspiler* thisObject = jsDynamicCast<JSTranspiler*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return TranspilerPrototype__transform(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC_DEFINE_HOST_FUNCTION(TranspilerPrototype__transformSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) + { + auto& vm = lexicalGlobalObject->vm(); - return TranspilerPrototype__transform(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + JSTranspiler* thisObject = jsDynamicCast<JSTranspiler*>(callFrame->thisValue()); -JSC_DEFINE_HOST_FUNCTION(TranspilerPrototype__transformSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - JSTranspiler* thisObject = jsDynamicCast<JSTranspiler*>(callFrame->thisValue()); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + return TranspilerPrototype__transformSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - return TranspilerPrototype__transformSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} + void JSTranspilerPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) { @@ -13220,64 +14344,67 @@ void JSTranspilerPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* glo void JSTranspilerConstructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSTranspilerPrototype* prototype) { Base::finishCreation(vm, 0, "Transpiler"_s, PropertyAdditionMode::WithoutStructureTransition); - + putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly); ASSERT(inherits(info())); } -JSTranspilerConstructor::JSTranspilerConstructor(JSC::VM& vm, JSC::Structure* structure) - : Base(vm, structure, construct, construct) -{ -} +JSTranspilerConstructor::JSTranspilerConstructor(JSC::VM& vm, JSC::Structure* structure) : Base(vm, structure, construct, construct) { -JSTranspilerConstructor* JSTranspilerConstructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSTranspilerPrototype* prototype) -{ + } + +JSTranspilerConstructor* JSTranspilerConstructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSTranspilerPrototype* prototype) { JSTranspilerConstructor* ptr = new (NotNull, JSC::allocateCell<JSTranspilerConstructor>(vm)) JSTranspilerConstructor(vm, structure); ptr->finishCreation(vm, globalObject, prototype); return ptr; } + JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSTranspilerConstructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) { - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); - JSC::VM& vm = globalObject->vm(); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + JSC::VM &vm = globalObject->vm(); JSObject* newTarget = asObject(callFrame->newTarget()); auto* constructor = globalObject->JSTranspilerConstructor(); Structure* structure = globalObject->JSTranspilerStructure(); if (constructor != newTarget) { - auto scope = DECLARE_THROW_SCOPE(vm); + auto scope = DECLARE_THROW_SCOPE(vm); - auto* functionGlobalObject = reinterpret_cast<Zig::GlobalObject*>( - // ShadowRealm functions belong to a different global object. - getFunctionRealm(globalObject, newTarget)); - RETURN_IF_EXCEPTION(scope, {}); - structure = InternalFunction::createSubclassStructure( - globalObject, - newTarget, - functionGlobalObject->JSTranspilerStructure()); + auto* functionGlobalObject = reinterpret_cast<Zig::GlobalObject*>( + // ShadowRealm functions belong to a different global object. + getFunctionRealm(globalObject, newTarget) + ); + RETURN_IF_EXCEPTION(scope, {}); + structure = InternalFunction::createSubclassStructure( + globalObject, + newTarget, + functionGlobalObject->JSTranspilerStructure() + ); } void* ptr = TranspilerClass__construct(globalObject, callFrame); if (UNLIKELY(!ptr)) { - return JSValue::encode(JSC::jsUndefined()); + return JSValue::encode(JSC::jsUndefined()); } JSTranspiler* instance = JSTranspiler::create(vm, globalObject, structure, ptr); + return JSValue::encode(instance); } void JSTranspilerConstructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSTranspilerPrototype* prototype) { + } const ClassInfo JSTranspilerConstructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTranspilerConstructor) }; -extern "C" EncodedJSValue Transpiler__getConstructor(Zig::GlobalObject* globalObject) -{ + + extern "C" EncodedJSValue Transpiler__getConstructor(Zig::GlobalObject* globalObject) { return JSValue::encode(globalObject->JSTranspilerConstructor()); -} + } #include "JSTranspiler+BunPlugin-impl.h"; @@ -13291,7 +14418,7 @@ void JSTranspiler::destroy(JSCell* cell) { static_cast<JSTranspiler*>(cell)->JSTranspiler::~JSTranspiler(); } - + const ClassInfo JSTranspiler::s_info = { "Transpiler"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTranspiler) }; void JSTranspiler::finishCreation(VM& vm) @@ -13300,38 +14427,37 @@ void JSTranspiler::finishCreation(VM& vm) ASSERT(inherits(info())); } -JSTranspiler* JSTranspiler::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSTranspiler* ptr = new (NotNull, JSC::allocateCell<JSTranspiler>(vm)) JSTranspiler(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} -extern "C" void* Transpiler__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; +JSTranspiler* JSTranspiler::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) { + JSTranspiler* ptr = new (NotNull, JSC::allocateCell<JSTranspiler>(vm)) JSTranspiler(vm, structure, ctx); + ptr->finishCreation(vm); + return ptr; +} - JSC::JSCell* cell = decodedValue.asCell(); - JSTranspiler* object = JSC::jsDynamicCast<JSTranspiler*>(cell); +extern "C" void* Transpiler__fromJS(JSC::EncodedJSValue value) { + JSC::JSValue decodedValue = JSC::JSValue::decode(value); + if (decodedValue.isEmpty() || !decodedValue.isCell()) + return nullptr; - if (!object) - return nullptr; + JSC::JSCell* cell = decodedValue.asCell(); + JSTranspiler* object = JSC::jsDynamicCast<JSTranspiler*>(cell); - return object->wrapped(); + if (!object) + return nullptr; + + return object->wrapped(); } -extern "C" bool Transpiler__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSTranspiler* object = JSC::jsDynamicCast<JSTranspiler*>(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; +extern "C" bool Transpiler__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) { + JSTranspiler* object = JSC::jsDynamicCast<JSTranspiler*>(JSValue::decode(value)); + if (!object) + return false; + + object->m_ctx = ptr; + return true; } + extern "C" const size_t Transpiler__ptrOffset = JSTranspiler::offsetOfWrapped(); void JSTranspiler::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) @@ -13346,7 +14472,7 @@ void JSTranspiler::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) JSObject* JSTranspiler::createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype) { - return WebCore::JSTranspilerConstructor::create(vm, globalObject, WebCore::JSTranspilerConstructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast<WebCore::JSTranspilerPrototype*>(prototype)); + return WebCore::JSTranspilerConstructor::create(vm, globalObject, WebCore::JSTranspilerConstructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast<WebCore::JSTranspilerPrototype*>(prototype)); } JSObject* JSTranspiler::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) @@ -13354,13 +14480,13 @@ JSObject* JSTranspiler::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) return JSTranspilerPrototype::create(vm, globalObject, JSTranspilerPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); } -extern "C" EncodedJSValue Transpiler__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSTranspilerStructure(); - JSTranspiler* instance = JSTranspiler::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); +extern "C" EncodedJSValue Transpiler__create(Zig::GlobalObject* globalObject, void* ptr) { + auto &vm = globalObject->vm(); + JSC::Structure* structure = globalObject->JSTranspilerStructure(); + JSTranspiler* instance = JSTranspiler::create(vm, globalObject, structure, ptr); + + return JSValue::encode(instance); } } // namespace WebCore + diff --git a/src/bun.js/bindings/ZigGeneratedClasses.h b/src/bun.js/bindings/ZigGeneratedClasses.h index 76420193a..ed0532ce3 100644 --- a/src/bun.js/bindings/ZigGeneratedClasses.h +++ b/src/bun.js/bindings/ZigGeneratedClasses.h @@ -12,1556 +12,1782 @@ namespace Zig { #include <wtf/NeverDestroyed.h> #include "BunPlugin.h"; + namespace WebCore { using namespace Zig; using namespace JSC; class JSBlob final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSBlob* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl<JSBlob, WebCore::UseCustomHeapCellType::No>( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForBlob.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForBlob = std::forward<decltype(space)>(space); }, - [](auto& spaces) { return spaces.m_subspaceForBlob.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForBlob = std::forward<decltype(space)>(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast<JSC::JSType>(0b11101110), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); - - ~JSBlob(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSBlob, m_ctx); } - - void* m_ctx { nullptr }; - - JSBlob(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - } - - void finishCreation(JSC::VM&); -}; + public: + using Base = JSC::JSDestructibleObject; + static JSBlob* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); + + DECLARE_EXPORT_INFO; + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return WebCore::subspaceForImpl<JSBlob, WebCore::UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForBlob.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForBlob = std::forward<decltype(space)>(space); }, + [](auto& spaces) { return spaces.m_subspaceForBlob.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForBlob = std::forward<decltype(space)>(space); }); + } + + static void destroy(JSC::JSCell*); + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast<JSC::JSType>(0b11101110), StructureFlags), info()); + } + + static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); + static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); + + ~JSBlob(); + + void* wrapped() const { return m_ctx; } + + void detach() + { + m_ctx = nullptr; + } + + static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); + static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSBlob, m_ctx); } + + void* m_ctx { nullptr }; + + + JSBlob(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) + : Base(vm, structure) + { + m_ctx = sinkPtr; + + } + + void finishCreation(JSC::VM&); -class JSCryptoHasher final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSCryptoHasher* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl<JSCryptoHasher, WebCore::UseCustomHeapCellType::No>( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForCryptoHasher.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForCryptoHasher = std::forward<decltype(space)>(space); }, - [](auto& spaces) { return spaces.m_subspaceForCryptoHasher.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForCryptoHasher = std::forward<decltype(space)>(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast<JSC::JSType>(0b11101110), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); - - ~JSCryptoHasher(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSCryptoHasher, m_ctx); } - - void* m_ctx { nullptr }; - - JSCryptoHasher(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - } - - void finishCreation(JSC::VM&); - - DECLARE_VISIT_CHILDREN; - template<typename Visitor> void visitAdditionalChildren(Visitor&); - DECLARE_VISIT_OUTPUT_CONSTRAINTS; - - mutable JSC::WriteBarrier<JSC::Unknown> m_algorithms; - mutable JSC::WriteBarrier<JSC::Unknown> m_algorithm; -}; + -class JSDirent final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSDirent* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); + - DECLARE_EXPORT_INFO; - template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl<JSDirent, WebCore::UseCustomHeapCellType::No>( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForDirent.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForDirent = std::forward<decltype(space)>(space); }, - [](auto& spaces) { return spaces.m_subspaceForDirent.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForDirent = std::forward<decltype(space)>(space); }); - } + - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast<JSC::JSType>(ObjectType), StructureFlags), info()); - } + + }; - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); +class JSCryptoHasher final : public JSC::JSDestructibleObject { + public: + using Base = JSC::JSDestructibleObject; + static JSCryptoHasher* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); + + DECLARE_EXPORT_INFO; + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return WebCore::subspaceForImpl<JSCryptoHasher, WebCore::UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForCryptoHasher.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForCryptoHasher = std::forward<decltype(space)>(space); }, + [](auto& spaces) { return spaces.m_subspaceForCryptoHasher.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForCryptoHasher = std::forward<decltype(space)>(space); }); + } + + static void destroy(JSC::JSCell*); + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast<JSC::JSType>(0b11101110), StructureFlags), info()); + } + + static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); + static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); + + ~JSCryptoHasher(); + + void* wrapped() const { return m_ctx; } + + void detach() + { + m_ctx = nullptr; + } + + static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); + static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSCryptoHasher, m_ctx); } + + void* m_ctx { nullptr }; + + + JSCryptoHasher(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) + : Base(vm, structure) + { + m_ctx = sinkPtr; + + } + + void finishCreation(JSC::VM&); - ~JSDirent(); + - void* wrapped() const { return m_ctx; } + - void detach() - { - m_ctx = nullptr; - } + DECLARE_VISIT_CHILDREN; +template<typename Visitor> void visitAdditionalChildren(Visitor&); +DECLARE_VISIT_OUTPUT_CONSTRAINTS; - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSDirent, m_ctx); } - void* m_ctx { nullptr }; + mutable JSC::WriteBarrier<JSC::Unknown> m_algorithms; +mutable JSC::WriteBarrier<JSC::Unknown> m_algorithm; + }; - JSDirent(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - } +class JSDirent final : public JSC::JSDestructibleObject { + public: + using Base = JSC::JSDestructibleObject; + static JSDirent* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); + + DECLARE_EXPORT_INFO; + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return WebCore::subspaceForImpl<JSDirent, WebCore::UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForDirent.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForDirent = std::forward<decltype(space)>(space); }, + [](auto& spaces) { return spaces.m_subspaceForDirent.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForDirent = std::forward<decltype(space)>(space); }); + } + + static void destroy(JSC::JSCell*); + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast<JSC::JSType>(ObjectType), StructureFlags), info()); + } + + static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); + static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); + + ~JSDirent(); + + void* wrapped() const { return m_ctx; } + + void detach() + { + m_ctx = nullptr; + } + + static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); + static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSDirent, m_ctx); } + + void* m_ctx { nullptr }; + + + JSDirent(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) + : Base(vm, structure) + { + m_ctx = sinkPtr; + + } + + void finishCreation(JSC::VM&); - void finishCreation(JSC::VM&); + - DECLARE_VISIT_CHILDREN; - template<typename Visitor> void visitAdditionalChildren(Visitor&); - DECLARE_VISIT_OUTPUT_CONSTRAINTS; + - mutable JSC::WriteBarrier<JSC::Unknown> m_name; -}; + DECLARE_VISIT_CHILDREN; +template<typename Visitor> void visitAdditionalChildren(Visitor&); +DECLARE_VISIT_OUTPUT_CONSTRAINTS; -class JSExpect final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSExpect* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl<JSExpect, WebCore::UseCustomHeapCellType::No>( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForExpect.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForExpect = std::forward<decltype(space)>(space); }, - [](auto& spaces) { return spaces.m_subspaceForExpect.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForExpect = std::forward<decltype(space)>(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast<JSC::JSType>(0b11101110), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); - - ~JSExpect(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSExpect, m_ctx); } - - void* m_ctx { nullptr }; - - JSExpect(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - } - - void finishCreation(JSC::VM&); - - DECLARE_VISIT_CHILDREN; - template<typename Visitor> void visitAdditionalChildren(Visitor&); - DECLARE_VISIT_OUTPUT_CONSTRAINTS; - - mutable JSC::WriteBarrier<JSC::Unknown> m_capturedValue; - mutable JSC::WriteBarrier<JSC::Unknown> m_resultValue; -}; -class JSExpectAny final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSExpectAny* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); + mutable JSC::WriteBarrier<JSC::Unknown> m_name; + }; - DECLARE_EXPORT_INFO; - template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl<JSExpectAny, WebCore::UseCustomHeapCellType::No>( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForExpectAny.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForExpectAny = std::forward<decltype(space)>(space); }, - [](auto& spaces) { return spaces.m_subspaceForExpectAny.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForExpectAny = std::forward<decltype(space)>(space); }); - } +class JSExpect final : public JSC::JSDestructibleObject { + public: + using Base = JSC::JSDestructibleObject; + static JSExpect* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); + + DECLARE_EXPORT_INFO; + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return WebCore::subspaceForImpl<JSExpect, WebCore::UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForExpect.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForExpect = std::forward<decltype(space)>(space); }, + [](auto& spaces) { return spaces.m_subspaceForExpect.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForExpect = std::forward<decltype(space)>(space); }); + } + + static void destroy(JSC::JSCell*); + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast<JSC::JSType>(0b11101110), StructureFlags), info()); + } + + static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); + static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); + + ~JSExpect(); + + void* wrapped() const { return m_ctx; } + + void detach() + { + m_ctx = nullptr; + } + + static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); + static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSExpect, m_ctx); } + + void* m_ctx { nullptr }; + + + JSExpect(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) + : Base(vm, structure) + { + m_ctx = sinkPtr; + + } + + void finishCreation(JSC::VM&); - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast<JSC::JSType>(0b11101110), StructureFlags), info()); - } + - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - ; + - ~JSExpectAny(); + DECLARE_VISIT_CHILDREN; +template<typename Visitor> void visitAdditionalChildren(Visitor&); +DECLARE_VISIT_OUTPUT_CONSTRAINTS; - void* wrapped() const { return m_ctx; } - void detach() - { - m_ctx = nullptr; - } + mutable JSC::WriteBarrier<JSC::Unknown> m_capturedValue; +mutable JSC::WriteBarrier<JSC::Unknown> m_resultValue; + }; - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSExpectAny, m_ctx); } +class JSExpectAny final : public JSC::JSDestructibleObject { + public: + using Base = JSC::JSDestructibleObject; + static JSExpectAny* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); + + DECLARE_EXPORT_INFO; + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return WebCore::subspaceForImpl<JSExpectAny, WebCore::UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForExpectAny.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForExpectAny = std::forward<decltype(space)>(space); }, + [](auto& spaces) { return spaces.m_subspaceForExpectAny.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForExpectAny = std::forward<decltype(space)>(space); }); + } + + static void destroy(JSC::JSCell*); + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast<JSC::JSType>(0b11101110), StructureFlags), info()); + } + + static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); + ; + + ~JSExpectAny(); + + void* wrapped() const { return m_ctx; } + + void detach() + { + m_ctx = nullptr; + } + + static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); + static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSExpectAny, m_ctx); } + + void* m_ctx { nullptr }; + + + JSExpectAny(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) + : Base(vm, structure) + { + m_ctx = sinkPtr; + + } + + void finishCreation(JSC::VM&); - void* m_ctx { nullptr }; + - JSExpectAny(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - } + - void finishCreation(JSC::VM&); + DECLARE_VISIT_CHILDREN; +template<typename Visitor> void visitAdditionalChildren(Visitor&); +DECLARE_VISIT_OUTPUT_CONSTRAINTS; - DECLARE_VISIT_CHILDREN; - template<typename Visitor> void visitAdditionalChildren(Visitor&); - DECLARE_VISIT_OUTPUT_CONSTRAINTS; - mutable JSC::WriteBarrier<JSC::Unknown> m_constructorValue; -}; + mutable JSC::WriteBarrier<JSC::Unknown> m_constructorValue; + }; class JSFileSystemRouter final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSFileSystemRouter* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl<JSFileSystemRouter, WebCore::UseCustomHeapCellType::No>( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForFileSystemRouter.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForFileSystemRouter = std::forward<decltype(space)>(space); }, - [](auto& spaces) { return spaces.m_subspaceForFileSystemRouter.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForFileSystemRouter = std::forward<decltype(space)>(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast<JSC::JSType>(0b11101110), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); - - ~JSFileSystemRouter(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSFileSystemRouter, m_ctx); } - - void* m_ctx { nullptr }; - - JSFileSystemRouter(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - } - - void finishCreation(JSC::VM&); - - DECLARE_VISIT_CHILDREN; - template<typename Visitor> void visitAdditionalChildren(Visitor&); - DECLARE_VISIT_OUTPUT_CONSTRAINTS; - - mutable JSC::WriteBarrier<JSC::Unknown> m_origin; - mutable JSC::WriteBarrier<JSC::Unknown> m_routes; - mutable JSC::WriteBarrier<JSC::Unknown> m_style; -}; + public: + using Base = JSC::JSDestructibleObject; + static JSFileSystemRouter* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); + + DECLARE_EXPORT_INFO; + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return WebCore::subspaceForImpl<JSFileSystemRouter, WebCore::UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForFileSystemRouter.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForFileSystemRouter = std::forward<decltype(space)>(space); }, + [](auto& spaces) { return spaces.m_subspaceForFileSystemRouter.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForFileSystemRouter = std::forward<decltype(space)>(space); }); + } + + static void destroy(JSC::JSCell*); + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast<JSC::JSType>(0b11101110), StructureFlags), info()); + } + + static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); + static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); + + ~JSFileSystemRouter(); + + void* wrapped() const { return m_ctx; } + + void detach() + { + m_ctx = nullptr; + } + + static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); + static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSFileSystemRouter, m_ctx); } + + void* m_ctx { nullptr }; + + + JSFileSystemRouter(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) + : Base(vm, structure) + { + m_ctx = sinkPtr; + + } + + void finishCreation(JSC::VM&); + + + + + + DECLARE_VISIT_CHILDREN; +template<typename Visitor> void visitAdditionalChildren(Visitor&); +DECLARE_VISIT_OUTPUT_CONSTRAINTS; + + + mutable JSC::WriteBarrier<JSC::Unknown> m_origin; +mutable JSC::WriteBarrier<JSC::Unknown> m_routes; +mutable JSC::WriteBarrier<JSC::Unknown> m_style; + }; class JSListener final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSListener* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl<JSListener, WebCore::UseCustomHeapCellType::No>( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForListener.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForListener = std::forward<decltype(space)>(space); }, - [](auto& spaces) { return spaces.m_subspaceForListener.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForListener = std::forward<decltype(space)>(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast<JSC::JSType>(0b11101110), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - ; - - ~JSListener(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSListener, m_ctx); } - - void* m_ctx { nullptr }; - - JSListener(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - } - - void finishCreation(JSC::VM&); - - DECLARE_VISIT_CHILDREN; - template<typename Visitor> void visitAdditionalChildren(Visitor&); - DECLARE_VISIT_OUTPUT_CONSTRAINTS; - - mutable JSC::WriteBarrier<JSC::Unknown> m_hostname; - mutable JSC::WriteBarrier<JSC::Unknown> m_unix; -}; + public: + using Base = JSC::JSDestructibleObject; + static JSListener* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); + + DECLARE_EXPORT_INFO; + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return WebCore::subspaceForImpl<JSListener, WebCore::UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForListener.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForListener = std::forward<decltype(space)>(space); }, + [](auto& spaces) { return spaces.m_subspaceForListener.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForListener = std::forward<decltype(space)>(space); }); + } + + static void destroy(JSC::JSCell*); + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast<JSC::JSType>(0b11101110), StructureFlags), info()); + } + + static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); + ; + + ~JSListener(); + + void* wrapped() const { return m_ctx; } + + void detach() + { + m_ctx = nullptr; + } + + static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); + static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSListener, m_ctx); } + + void* m_ctx { nullptr }; + + + JSListener(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) + : Base(vm, structure) + { + m_ctx = sinkPtr; + + } + + void finishCreation(JSC::VM&); + + + + + + DECLARE_VISIT_CHILDREN; +template<typename Visitor> void visitAdditionalChildren(Visitor&); +DECLARE_VISIT_OUTPUT_CONSTRAINTS; + + + mutable JSC::WriteBarrier<JSC::Unknown> m_hostname; +mutable JSC::WriteBarrier<JSC::Unknown> m_unix; + }; class JSMD4 final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSMD4* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl<JSMD4, WebCore::UseCustomHeapCellType::No>( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForMD4.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForMD4 = std::forward<decltype(space)>(space); }, - [](auto& spaces) { return spaces.m_subspaceForMD4.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForMD4 = std::forward<decltype(space)>(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast<JSC::JSType>(0b11101110), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); - - ~JSMD4(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSMD4, m_ctx); } - - void* m_ctx { nullptr }; - - JSMD4(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - } - - void finishCreation(JSC::VM&); -}; + public: + using Base = JSC::JSDestructibleObject; + static JSMD4* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); + + DECLARE_EXPORT_INFO; + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return WebCore::subspaceForImpl<JSMD4, WebCore::UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForMD4.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForMD4 = std::forward<decltype(space)>(space); }, + [](auto& spaces) { return spaces.m_subspaceForMD4.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForMD4 = std::forward<decltype(space)>(space); }); + } + + static void destroy(JSC::JSCell*); + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast<JSC::JSType>(0b11101110), StructureFlags), info()); + } + + static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); + static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); + + ~JSMD4(); + + void* wrapped() const { return m_ctx; } + + void detach() + { + m_ctx = nullptr; + } + + static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); + static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSMD4, m_ctx); } + + void* m_ctx { nullptr }; + + + JSMD4(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) + : Base(vm, structure) + { + m_ctx = sinkPtr; + + } + + void finishCreation(JSC::VM&); + + + + + + + + + }; class JSMD5 final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSMD5* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl<JSMD5, WebCore::UseCustomHeapCellType::No>( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForMD5.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForMD5 = std::forward<decltype(space)>(space); }, - [](auto& spaces) { return spaces.m_subspaceForMD5.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForMD5 = std::forward<decltype(space)>(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast<JSC::JSType>(0b11101110), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); - - ~JSMD5(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSMD5, m_ctx); } - - void* m_ctx { nullptr }; - - JSMD5(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - } - - void finishCreation(JSC::VM&); -}; + public: + using Base = JSC::JSDestructibleObject; + static JSMD5* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); + + DECLARE_EXPORT_INFO; + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return WebCore::subspaceForImpl<JSMD5, WebCore::UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForMD5.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForMD5 = std::forward<decltype(space)>(space); }, + [](auto& spaces) { return spaces.m_subspaceForMD5.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForMD5 = std::forward<decltype(space)>(space); }); + } + + static void destroy(JSC::JSCell*); + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast<JSC::JSType>(0b11101110), StructureFlags), info()); + } + + static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); + static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); + + ~JSMD5(); + + void* wrapped() const { return m_ctx; } + + void detach() + { + m_ctx = nullptr; + } + + static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); + static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSMD5, m_ctx); } + + void* m_ctx { nullptr }; + + + JSMD5(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) + : Base(vm, structure) + { + m_ctx = sinkPtr; + + } + + void finishCreation(JSC::VM&); + + + + + + + + + }; class JSMatchedRoute final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSMatchedRoute* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl<JSMatchedRoute, WebCore::UseCustomHeapCellType::No>( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForMatchedRoute.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForMatchedRoute = std::forward<decltype(space)>(space); }, - [](auto& spaces) { return spaces.m_subspaceForMatchedRoute.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForMatchedRoute = std::forward<decltype(space)>(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast<JSC::JSType>(0b11101110), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - ; - - ~JSMatchedRoute(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSMatchedRoute, m_ctx); } - - void* m_ctx { nullptr }; - - JSMatchedRoute(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - } - - void finishCreation(JSC::VM&); - - DECLARE_VISIT_CHILDREN; - template<typename Visitor> void visitAdditionalChildren(Visitor&); - DECLARE_VISIT_OUTPUT_CONSTRAINTS; - - mutable JSC::WriteBarrier<JSC::Unknown> m_filePath; - mutable JSC::WriteBarrier<JSC::Unknown> m_kind; - mutable JSC::WriteBarrier<JSC::Unknown> m_name; - mutable JSC::WriteBarrier<JSC::Unknown> m_params; - mutable JSC::WriteBarrier<JSC::Unknown> m_pathname; - mutable JSC::WriteBarrier<JSC::Unknown> m_query; - mutable JSC::WriteBarrier<JSC::Unknown> m_scriptSrc; -}; + public: + using Base = JSC::JSDestructibleObject; + static JSMatchedRoute* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); + + DECLARE_EXPORT_INFO; + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return WebCore::subspaceForImpl<JSMatchedRoute, WebCore::UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForMatchedRoute.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForMatchedRoute = std::forward<decltype(space)>(space); }, + [](auto& spaces) { return spaces.m_subspaceForMatchedRoute.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForMatchedRoute = std::forward<decltype(space)>(space); }); + } + + static void destroy(JSC::JSCell*); + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast<JSC::JSType>(0b11101110), StructureFlags), info()); + } + + static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); + ; + + ~JSMatchedRoute(); + + void* wrapped() const { return m_ctx; } + + void detach() + { + m_ctx = nullptr; + } + + static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); + static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSMatchedRoute, m_ctx); } + + void* m_ctx { nullptr }; + + + JSMatchedRoute(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) + : Base(vm, structure) + { + m_ctx = sinkPtr; + + } + + void finishCreation(JSC::VM&); + + + + + + DECLARE_VISIT_CHILDREN; +template<typename Visitor> void visitAdditionalChildren(Visitor&); +DECLARE_VISIT_OUTPUT_CONSTRAINTS; + + + mutable JSC::WriteBarrier<JSC::Unknown> m_filePath; +mutable JSC::WriteBarrier<JSC::Unknown> m_kind; +mutable JSC::WriteBarrier<JSC::Unknown> m_name; +mutable JSC::WriteBarrier<JSC::Unknown> m_params; +mutable JSC::WriteBarrier<JSC::Unknown> m_pathname; +mutable JSC::WriteBarrier<JSC::Unknown> m_query; +mutable JSC::WriteBarrier<JSC::Unknown> m_scriptSrc; + }; class JSNodeJSFS final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSNodeJSFS* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl<JSNodeJSFS, WebCore::UseCustomHeapCellType::No>( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForNodeJSFS.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForNodeJSFS = std::forward<decltype(space)>(space); }, - [](auto& spaces) { return spaces.m_subspaceForNodeJSFS.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForNodeJSFS = std::forward<decltype(space)>(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast<JSC::JSType>(ObjectType), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); - - ~JSNodeJSFS(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSNodeJSFS, m_ctx); } - - void* m_ctx { nullptr }; - - JSNodeJSFS(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - } - - void finishCreation(JSC::VM&); -}; + public: + using Base = JSC::JSDestructibleObject; + static JSNodeJSFS* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); + + DECLARE_EXPORT_INFO; + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return WebCore::subspaceForImpl<JSNodeJSFS, WebCore::UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForNodeJSFS.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForNodeJSFS = std::forward<decltype(space)>(space); }, + [](auto& spaces) { return spaces.m_subspaceForNodeJSFS.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForNodeJSFS = std::forward<decltype(space)>(space); }); + } + + static void destroy(JSC::JSCell*); + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast<JSC::JSType>(ObjectType), StructureFlags), info()); + } + + static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); + static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); + + ~JSNodeJSFS(); + + void* wrapped() const { return m_ctx; } + + void detach() + { + m_ctx = nullptr; + } + + static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); + static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSNodeJSFS, m_ctx); } + + void* m_ctx { nullptr }; + + + JSNodeJSFS(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) + : Base(vm, structure) + { + m_ctx = sinkPtr; + + } + + void finishCreation(JSC::VM&); + + + + + + + + + }; class JSRequest final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSRequest* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl<JSRequest, WebCore::UseCustomHeapCellType::No>( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForRequest.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForRequest = std::forward<decltype(space)>(space); }, - [](auto& spaces) { return spaces.m_subspaceForRequest.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForRequest = std::forward<decltype(space)>(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast<JSC::JSType>(0b11101110), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); - - ~JSRequest(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSRequest, m_ctx); } - - void* m_ctx { nullptr }; - - JSRequest(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - } - - void finishCreation(JSC::VM&); - - DECLARE_VISIT_CHILDREN; - template<typename Visitor> void visitAdditionalChildren(Visitor&); - DECLARE_VISIT_OUTPUT_CONSTRAINTS; - - mutable JSC::WriteBarrier<JSC::Unknown> m_body; - mutable JSC::WriteBarrier<JSC::Unknown> m_headers; - mutable JSC::WriteBarrier<JSC::Unknown> m_signal; - mutable JSC::WriteBarrier<JSC::Unknown> m_url; -}; + public: + using Base = JSC::JSDestructibleObject; + static JSRequest* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); + + DECLARE_EXPORT_INFO; + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return WebCore::subspaceForImpl<JSRequest, WebCore::UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForRequest.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForRequest = std::forward<decltype(space)>(space); }, + [](auto& spaces) { return spaces.m_subspaceForRequest.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForRequest = std::forward<decltype(space)>(space); }); + } + + static void destroy(JSC::JSCell*); + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast<JSC::JSType>(0b11101110), StructureFlags), info()); + } + + static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); + static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); + + ~JSRequest(); + + void* wrapped() const { return m_ctx; } + + void detach() + { + m_ctx = nullptr; + } + + static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); + static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSRequest, m_ctx); } + + void* m_ctx { nullptr }; + + + JSRequest(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) + : Base(vm, structure) + { + m_ctx = sinkPtr; + + } + + void finishCreation(JSC::VM&); + + + + + + DECLARE_VISIT_CHILDREN; +template<typename Visitor> void visitAdditionalChildren(Visitor&); +DECLARE_VISIT_OUTPUT_CONSTRAINTS; + + + mutable JSC::WriteBarrier<JSC::Unknown> m_body; +mutable JSC::WriteBarrier<JSC::Unknown> m_headers; +mutable JSC::WriteBarrier<JSC::Unknown> m_signal; +mutable JSC::WriteBarrier<JSC::Unknown> m_url; + }; class JSResponse final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSResponse* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl<JSResponse, WebCore::UseCustomHeapCellType::No>( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForResponse.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForResponse = std::forward<decltype(space)>(space); }, - [](auto& spaces) { return spaces.m_subspaceForResponse.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForResponse = std::forward<decltype(space)>(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast<JSC::JSType>(0b11101110), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); - - ~JSResponse(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSResponse, m_ctx); } - - void* m_ctx { nullptr }; - - JSResponse(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - } - - void finishCreation(JSC::VM&); - - DECLARE_VISIT_CHILDREN; - template<typename Visitor> void visitAdditionalChildren(Visitor&); - DECLARE_VISIT_OUTPUT_CONSTRAINTS; - - mutable JSC::WriteBarrier<JSC::Unknown> m_body; - mutable JSC::WriteBarrier<JSC::Unknown> m_headers; - mutable JSC::WriteBarrier<JSC::Unknown> m_statusText; - mutable JSC::WriteBarrier<JSC::Unknown> m_url; -}; + public: + using Base = JSC::JSDestructibleObject; + static JSResponse* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); + + DECLARE_EXPORT_INFO; + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return WebCore::subspaceForImpl<JSResponse, WebCore::UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForResponse.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForResponse = std::forward<decltype(space)>(space); }, + [](auto& spaces) { return spaces.m_subspaceForResponse.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForResponse = std::forward<decltype(space)>(space); }); + } + + static void destroy(JSC::JSCell*); + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast<JSC::JSType>(0b11101110), StructureFlags), info()); + } + + static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); + static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); + + ~JSResponse(); + + void* wrapped() const { return m_ctx; } + + void detach() + { + m_ctx = nullptr; + } + + static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); + static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSResponse, m_ctx); } + + void* m_ctx { nullptr }; + + + JSResponse(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) + : Base(vm, structure) + { + m_ctx = sinkPtr; + + } + + void finishCreation(JSC::VM&); + + + + + + DECLARE_VISIT_CHILDREN; +template<typename Visitor> void visitAdditionalChildren(Visitor&); +DECLARE_VISIT_OUTPUT_CONSTRAINTS; + + + mutable JSC::WriteBarrier<JSC::Unknown> m_body; +mutable JSC::WriteBarrier<JSC::Unknown> m_headers; +mutable JSC::WriteBarrier<JSC::Unknown> m_statusText; +mutable JSC::WriteBarrier<JSC::Unknown> m_url; + }; class JSSHA1 final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSSHA1* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl<JSSHA1, WebCore::UseCustomHeapCellType::No>( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForSHA1.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForSHA1 = std::forward<decltype(space)>(space); }, - [](auto& spaces) { return spaces.m_subspaceForSHA1.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForSHA1 = std::forward<decltype(space)>(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast<JSC::JSType>(0b11101110), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); - - ~JSSHA1(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSSHA1, m_ctx); } - - void* m_ctx { nullptr }; - - JSSHA1(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - } - - void finishCreation(JSC::VM&); -}; + public: + using Base = JSC::JSDestructibleObject; + static JSSHA1* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); + + DECLARE_EXPORT_INFO; + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return WebCore::subspaceForImpl<JSSHA1, WebCore::UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForSHA1.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForSHA1 = std::forward<decltype(space)>(space); }, + [](auto& spaces) { return spaces.m_subspaceForSHA1.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForSHA1 = std::forward<decltype(space)>(space); }); + } + + static void destroy(JSC::JSCell*); + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast<JSC::JSType>(0b11101110), StructureFlags), info()); + } + + static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); + static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); + + ~JSSHA1(); + + void* wrapped() const { return m_ctx; } + + void detach() + { + m_ctx = nullptr; + } + + static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); + static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSSHA1, m_ctx); } + + void* m_ctx { nullptr }; + + + JSSHA1(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) + : Base(vm, structure) + { + m_ctx = sinkPtr; + + } + + void finishCreation(JSC::VM&); + + + + + + + + + }; class JSSHA224 final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSSHA224* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl<JSSHA224, WebCore::UseCustomHeapCellType::No>( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForSHA224.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForSHA224 = std::forward<decltype(space)>(space); }, - [](auto& spaces) { return spaces.m_subspaceForSHA224.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForSHA224 = std::forward<decltype(space)>(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast<JSC::JSType>(0b11101110), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); - - ~JSSHA224(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSSHA224, m_ctx); } - - void* m_ctx { nullptr }; - - JSSHA224(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - } - - void finishCreation(JSC::VM&); -}; + public: + using Base = JSC::JSDestructibleObject; + static JSSHA224* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); + + DECLARE_EXPORT_INFO; + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return WebCore::subspaceForImpl<JSSHA224, WebCore::UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForSHA224.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForSHA224 = std::forward<decltype(space)>(space); }, + [](auto& spaces) { return spaces.m_subspaceForSHA224.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForSHA224 = std::forward<decltype(space)>(space); }); + } + + static void destroy(JSC::JSCell*); + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast<JSC::JSType>(0b11101110), StructureFlags), info()); + } + + static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); + static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); + + ~JSSHA224(); + + void* wrapped() const { return m_ctx; } + + void detach() + { + m_ctx = nullptr; + } + + static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); + static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSSHA224, m_ctx); } + + void* m_ctx { nullptr }; + + + JSSHA224(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) + : Base(vm, structure) + { + m_ctx = sinkPtr; + + } + + void finishCreation(JSC::VM&); + + + + + + + + + }; class JSSHA256 final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSSHA256* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl<JSSHA256, WebCore::UseCustomHeapCellType::No>( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForSHA256.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForSHA256 = std::forward<decltype(space)>(space); }, - [](auto& spaces) { return spaces.m_subspaceForSHA256.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForSHA256 = std::forward<decltype(space)>(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast<JSC::JSType>(0b11101110), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); - - ~JSSHA256(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSSHA256, m_ctx); } - - void* m_ctx { nullptr }; - - JSSHA256(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - } - - void finishCreation(JSC::VM&); -}; + public: + using Base = JSC::JSDestructibleObject; + static JSSHA256* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); + + DECLARE_EXPORT_INFO; + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return WebCore::subspaceForImpl<JSSHA256, WebCore::UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForSHA256.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForSHA256 = std::forward<decltype(space)>(space); }, + [](auto& spaces) { return spaces.m_subspaceForSHA256.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForSHA256 = std::forward<decltype(space)>(space); }); + } + + static void destroy(JSC::JSCell*); + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast<JSC::JSType>(0b11101110), StructureFlags), info()); + } + + static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); + static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); + + ~JSSHA256(); + + void* wrapped() const { return m_ctx; } + + void detach() + { + m_ctx = nullptr; + } + + static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); + static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSSHA256, m_ctx); } + + void* m_ctx { nullptr }; + + + JSSHA256(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) + : Base(vm, structure) + { + m_ctx = sinkPtr; + + } + + void finishCreation(JSC::VM&); + + + + + + + + + }; class JSSHA384 final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSSHA384* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl<JSSHA384, WebCore::UseCustomHeapCellType::No>( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForSHA384.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForSHA384 = std::forward<decltype(space)>(space); }, - [](auto& spaces) { return spaces.m_subspaceForSHA384.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForSHA384 = std::forward<decltype(space)>(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast<JSC::JSType>(0b11101110), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); - - ~JSSHA384(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSSHA384, m_ctx); } - - void* m_ctx { nullptr }; - - JSSHA384(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - } - - void finishCreation(JSC::VM&); -}; + public: + using Base = JSC::JSDestructibleObject; + static JSSHA384* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); + + DECLARE_EXPORT_INFO; + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return WebCore::subspaceForImpl<JSSHA384, WebCore::UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForSHA384.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForSHA384 = std::forward<decltype(space)>(space); }, + [](auto& spaces) { return spaces.m_subspaceForSHA384.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForSHA384 = std::forward<decltype(space)>(space); }); + } + + static void destroy(JSC::JSCell*); + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast<JSC::JSType>(0b11101110), StructureFlags), info()); + } + + static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); + static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); + + ~JSSHA384(); + + void* wrapped() const { return m_ctx; } + + void detach() + { + m_ctx = nullptr; + } + + static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); + static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSSHA384, m_ctx); } + + void* m_ctx { nullptr }; + + + JSSHA384(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) + : Base(vm, structure) + { + m_ctx = sinkPtr; + + } + + void finishCreation(JSC::VM&); + + + + + + + + + }; class JSSHA512 final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSSHA512* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl<JSSHA512, WebCore::UseCustomHeapCellType::No>( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForSHA512.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForSHA512 = std::forward<decltype(space)>(space); }, - [](auto& spaces) { return spaces.m_subspaceForSHA512.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForSHA512 = std::forward<decltype(space)>(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast<JSC::JSType>(0b11101110), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); - - ~JSSHA512(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSSHA512, m_ctx); } - - void* m_ctx { nullptr }; - - JSSHA512(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - } - - void finishCreation(JSC::VM&); -}; + public: + using Base = JSC::JSDestructibleObject; + static JSSHA512* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); + + DECLARE_EXPORT_INFO; + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return WebCore::subspaceForImpl<JSSHA512, WebCore::UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForSHA512.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForSHA512 = std::forward<decltype(space)>(space); }, + [](auto& spaces) { return spaces.m_subspaceForSHA512.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForSHA512 = std::forward<decltype(space)>(space); }); + } + + static void destroy(JSC::JSCell*); + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast<JSC::JSType>(0b11101110), StructureFlags), info()); + } + + static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); + static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); + + ~JSSHA512(); + + void* wrapped() const { return m_ctx; } + + void detach() + { + m_ctx = nullptr; + } + + static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); + static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSSHA512, m_ctx); } + + void* m_ctx { nullptr }; + + + JSSHA512(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) + : Base(vm, structure) + { + m_ctx = sinkPtr; + + } + + void finishCreation(JSC::VM&); + + + + + + + + + }; class JSSHA512_256 final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSSHA512_256* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl<JSSHA512_256, WebCore::UseCustomHeapCellType::No>( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForSHA512_256.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForSHA512_256 = std::forward<decltype(space)>(space); }, - [](auto& spaces) { return spaces.m_subspaceForSHA512_256.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForSHA512_256 = std::forward<decltype(space)>(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast<JSC::JSType>(0b11101110), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); - - ~JSSHA512_256(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSSHA512_256, m_ctx); } - - void* m_ctx { nullptr }; - - JSSHA512_256(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - } - - void finishCreation(JSC::VM&); -}; + public: + using Base = JSC::JSDestructibleObject; + static JSSHA512_256* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); + + DECLARE_EXPORT_INFO; + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return WebCore::subspaceForImpl<JSSHA512_256, WebCore::UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForSHA512_256.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForSHA512_256 = std::forward<decltype(space)>(space); }, + [](auto& spaces) { return spaces.m_subspaceForSHA512_256.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForSHA512_256 = std::forward<decltype(space)>(space); }); + } + + static void destroy(JSC::JSCell*); + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast<JSC::JSType>(0b11101110), StructureFlags), info()); + } + + static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); + static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); + + ~JSSHA512_256(); + + void* wrapped() const { return m_ctx; } + + void detach() + { + m_ctx = nullptr; + } + + static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); + static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSSHA512_256, m_ctx); } + + void* m_ctx { nullptr }; + + + JSSHA512_256(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) + : Base(vm, structure) + { + m_ctx = sinkPtr; + + } + + void finishCreation(JSC::VM&); + + + + + + + + + }; class JSServerWebSocket final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSServerWebSocket* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl<JSServerWebSocket, WebCore::UseCustomHeapCellType::No>( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForServerWebSocket.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForServerWebSocket = std::forward<decltype(space)>(space); }, - [](auto& spaces) { return spaces.m_subspaceForServerWebSocket.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForServerWebSocket = std::forward<decltype(space)>(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast<JSC::JSType>(0b11101110), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); - - ~JSServerWebSocket(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSServerWebSocket, m_ctx); } - - void* m_ctx { nullptr }; - - JSServerWebSocket(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - } - - void finishCreation(JSC::VM&); - - DECLARE_VISIT_CHILDREN; - template<typename Visitor> void visitAdditionalChildren(Visitor&); - DECLARE_VISIT_OUTPUT_CONSTRAINTS; - - mutable JSC::WriteBarrier<JSC::Unknown> m_data; - mutable JSC::WriteBarrier<JSC::Unknown> m_remoteAddress; -}; + public: + using Base = JSC::JSDestructibleObject; + static JSServerWebSocket* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); + + DECLARE_EXPORT_INFO; + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return WebCore::subspaceForImpl<JSServerWebSocket, WebCore::UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForServerWebSocket.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForServerWebSocket = std::forward<decltype(space)>(space); }, + [](auto& spaces) { return spaces.m_subspaceForServerWebSocket.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForServerWebSocket = std::forward<decltype(space)>(space); }); + } + + static void destroy(JSC::JSCell*); + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast<JSC::JSType>(0b11101110), StructureFlags), info()); + } + + static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); + static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); + + ~JSServerWebSocket(); + + void* wrapped() const { return m_ctx; } + + void detach() + { + m_ctx = nullptr; + } + + static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); + static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSServerWebSocket, m_ctx); } + + void* m_ctx { nullptr }; + + + JSServerWebSocket(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) + : Base(vm, structure) + { + m_ctx = sinkPtr; + + } + + void finishCreation(JSC::VM&); -class JSStats final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSStats* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl<JSStats, WebCore::UseCustomHeapCellType::No>( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForStats.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForStats = std::forward<decltype(space)>(space); }, - [](auto& spaces) { return spaces.m_subspaceForStats.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForStats = std::forward<decltype(space)>(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast<JSC::JSType>(0b11101110), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); - - ~JSStats(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSStats, m_ctx); } - - void* m_ctx { nullptr }; - - JSStats(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - } - - void finishCreation(JSC::VM&); - - DECLARE_VISIT_CHILDREN; - template<typename Visitor> void visitAdditionalChildren(Visitor&); - DECLARE_VISIT_OUTPUT_CONSTRAINTS; - - mutable JSC::WriteBarrier<JSC::Unknown> m_atime; - mutable JSC::WriteBarrier<JSC::Unknown> m_ctime; - mutable JSC::WriteBarrier<JSC::Unknown> m_mtime; -}; + -class JSSubprocess final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSSubprocess* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl<JSSubprocess, WebCore::UseCustomHeapCellType::No>( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForSubprocess.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForSubprocess = std::forward<decltype(space)>(space); }, - [](auto& spaces) { return spaces.m_subspaceForSubprocess.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForSubprocess = std::forward<decltype(space)>(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast<JSC::JSType>(0b11101110), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - ; - - ~JSSubprocess(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSSubprocess, m_ctx); } - - void* m_ctx { nullptr }; - - JSSubprocess(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - m_weakThis = JSC::Weak<JSSubprocess>(this, getOwner()); - } - - void finishCreation(JSC::VM&); + - JSC::Weak<JSSubprocess> m_weakThis; + DECLARE_VISIT_CHILDREN; +template<typename Visitor> void visitAdditionalChildren(Visitor&); +DECLARE_VISIT_OUTPUT_CONSTRAINTS; - static bool hasPendingActivity(void* ctx); - class Owner final : public JSC::WeakHandleOwner { + mutable JSC::WriteBarrier<JSC::Unknown> m_data; +mutable JSC::WriteBarrier<JSC::Unknown> m_remoteAddress; + }; + +class JSStats final : public JSC::JSDestructibleObject { public: - bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void* context, JSC::AbstractSlotVisitor& visitor, const char** reason) final + using Base = JSC::JSDestructibleObject; + static JSStats* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); + + DECLARE_EXPORT_INFO; + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) { - auto* controller = JSC::jsCast<JSSubprocess*>(handle.slot()->asCell()); - if (JSSubprocess::hasPendingActivity(controller->wrapped())) { - if (UNLIKELY(reason)) - *reason = "has pending activity"; - return true; - } - - return visitor.containsOpaqueRoot(context); + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return WebCore::subspaceForImpl<JSStats, WebCore::UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForStats.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForStats = std::forward<decltype(space)>(space); }, + [](auto& spaces) { return spaces.m_subspaceForStats.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForStats = std::forward<decltype(space)>(space); }); } - void finalize(JSC::Handle<JSC::Unknown>, void* context) final {} - }; + + static void destroy(JSC::JSCell*); + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast<JSC::JSType>(0b11101110), StructureFlags), info()); + } + + static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); + static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); + + ~JSStats(); + + void* wrapped() const { return m_ctx; } + + void detach() + { + m_ctx = nullptr; + } + + static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); + static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSStats, m_ctx); } + + void* m_ctx { nullptr }; + + + JSStats(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) + : Base(vm, structure) + { + m_ctx = sinkPtr; + + } + + void finishCreation(JSC::VM&); - static JSC::WeakHandleOwner* getOwner() - { - static NeverDestroyed<Owner> m_owner; - return &m_owner.get(); - } + - DECLARE_VISIT_CHILDREN; - template<typename Visitor> void visitAdditionalChildren(Visitor&); - DECLARE_VISIT_OUTPUT_CONSTRAINTS; + - mutable JSC::WriteBarrier<JSC::Unknown> m_stderr; - mutable JSC::WriteBarrier<JSC::Unknown> m_stdin; - mutable JSC::WriteBarrier<JSC::Unknown> m_stdout; -}; + DECLARE_VISIT_CHILDREN; +template<typename Visitor> void visitAdditionalChildren(Visitor&); +DECLARE_VISIT_OUTPUT_CONSTRAINTS; -class JSTCPSocket final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSTCPSocket* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl<JSTCPSocket, WebCore::UseCustomHeapCellType::No>( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForTCPSocket.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForTCPSocket = std::forward<decltype(space)>(space); }, - [](auto& spaces) { return spaces.m_subspaceForTCPSocket.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForTCPSocket = std::forward<decltype(space)>(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast<JSC::JSType>(0b11101110), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - ; - - ~JSTCPSocket(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSTCPSocket, m_ctx); } - - void* m_ctx { nullptr }; - - JSTCPSocket(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - m_weakThis = JSC::Weak<JSTCPSocket>(this, getOwner()); - } - - void finishCreation(JSC::VM&); - JSC::Weak<JSTCPSocket> m_weakThis; + mutable JSC::WriteBarrier<JSC::Unknown> m_atime; +mutable JSC::WriteBarrier<JSC::Unknown> m_ctime; +mutable JSC::WriteBarrier<JSC::Unknown> m_mtime; + }; + +class JSSubprocess final : public JSC::JSDestructibleObject { + public: + using Base = JSC::JSDestructibleObject; + static JSSubprocess* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); + + DECLARE_EXPORT_INFO; + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return WebCore::subspaceForImpl<JSSubprocess, WebCore::UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForSubprocess.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForSubprocess = std::forward<decltype(space)>(space); }, + [](auto& spaces) { return spaces.m_subspaceForSubprocess.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForSubprocess = std::forward<decltype(space)>(space); }); + } + + static void destroy(JSC::JSCell*); + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast<JSC::JSType>(0b11101110), StructureFlags), info()); + } + + static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); + ; + + ~JSSubprocess(); + + void* wrapped() const { return m_ctx; } + + void detach() + { + m_ctx = nullptr; + } + + static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); + static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSSubprocess, m_ctx); } + + void* m_ctx { nullptr }; + + + JSSubprocess(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) + : Base(vm, structure) + { + m_ctx = sinkPtr; + m_weakThis = JSC::Weak<JSSubprocess>(this, getOwner()); + } + + void finishCreation(JSC::VM&); + + + + + JSC::Weak<JSSubprocess> m_weakThis; + static bool hasPendingActivity(void* ctx); class Owner final : public JSC::WeakHandleOwner { - public: - bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void* context, JSC::AbstractSlotVisitor& visitor, const char** reason) final - { - auto* controller = JSC::jsCast<JSTCPSocket*>(handle.slot()->asCell()); - if (JSTCPSocket::hasPendingActivity(controller->wrapped())) { - if (UNLIKELY(reason)) + public: + bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void* context, JSC::AbstractSlotVisitor& visitor, const char** reason) final + { + auto* controller = JSC::jsCast<JSSubprocess*>(handle.slot()->asCell()); + if (JSSubprocess::hasPendingActivity(controller->wrapped())) { + if (UNLIKELY(reason)) *reason = "has pending activity"; - return true; - } + return true; + } + + return visitor.containsOpaqueRoot(context); + } + void finalize(JSC::Handle<JSC::Unknown>, void* context) final {} + }; + + static JSC::WeakHandleOwner* getOwner() + { + static NeverDestroyed<Owner> m_owner; + return &m_owner.get(); + } + + + DECLARE_VISIT_CHILDREN; +template<typename Visitor> void visitAdditionalChildren(Visitor&); +DECLARE_VISIT_OUTPUT_CONSTRAINTS; + + + mutable JSC::WriteBarrier<JSC::Unknown> m_stderr; +mutable JSC::WriteBarrier<JSC::Unknown> m_stdin; +mutable JSC::WriteBarrier<JSC::Unknown> m_stdout; + }; - return visitor.containsOpaqueRoot(context); +class JSTCPSocket final : public JSC::JSDestructibleObject { + public: + using Base = JSC::JSDestructibleObject; + static JSTCPSocket* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); + + DECLARE_EXPORT_INFO; + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return WebCore::subspaceForImpl<JSTCPSocket, WebCore::UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForTCPSocket.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForTCPSocket = std::forward<decltype(space)>(space); }, + [](auto& spaces) { return spaces.m_subspaceForTCPSocket.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForTCPSocket = std::forward<decltype(space)>(space); }); } - void finalize(JSC::Handle<JSC::Unknown>, void* context) final {} - }; + + static void destroy(JSC::JSCell*); + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast<JSC::JSType>(0b11101110), StructureFlags), info()); + } + + static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); + ; + + ~JSTCPSocket(); + + void* wrapped() const { return m_ctx; } + + void detach() + { + m_ctx = nullptr; + } + + static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); + static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSTCPSocket, m_ctx); } + + void* m_ctx { nullptr }; + + + JSTCPSocket(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) + : Base(vm, structure) + { + m_ctx = sinkPtr; + m_weakThis = JSC::Weak<JSTCPSocket>(this, getOwner()); + } + + void finishCreation(JSC::VM&); - static JSC::WeakHandleOwner* getOwner() - { - static NeverDestroyed<Owner> m_owner; - return &m_owner.get(); - } + - DECLARE_VISIT_CHILDREN; - template<typename Visitor> void visitAdditionalChildren(Visitor&); - DECLARE_VISIT_OUTPUT_CONSTRAINTS; + + JSC::Weak<JSTCPSocket> m_weakThis; + - mutable JSC::WriteBarrier<JSC::Unknown> m_data; - mutable JSC::WriteBarrier<JSC::Unknown> m_remoteAddress; -}; + static bool hasPendingActivity(void* ctx); + + class Owner final : public JSC::WeakHandleOwner { + public: + bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void* context, JSC::AbstractSlotVisitor& visitor, const char** reason) final + { + auto* controller = JSC::jsCast<JSTCPSocket*>(handle.slot()->asCell()); + if (JSTCPSocket::hasPendingActivity(controller->wrapped())) { + if (UNLIKELY(reason)) + *reason = "has pending activity"; + return true; + } + + return visitor.containsOpaqueRoot(context); + } + void finalize(JSC::Handle<JSC::Unknown>, void* context) final {} + }; + + static JSC::WeakHandleOwner* getOwner() + { + static NeverDestroyed<Owner> m_owner; + return &m_owner.get(); + } + + + DECLARE_VISIT_CHILDREN; +template<typename Visitor> void visitAdditionalChildren(Visitor&); +DECLARE_VISIT_OUTPUT_CONSTRAINTS; + + + mutable JSC::WriteBarrier<JSC::Unknown> m_data; +mutable JSC::WriteBarrier<JSC::Unknown> m_remoteAddress; + }; class JSTLSSocket final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSTLSSocket* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl<JSTLSSocket, WebCore::UseCustomHeapCellType::No>( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForTLSSocket.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForTLSSocket = std::forward<decltype(space)>(space); }, - [](auto& spaces) { return spaces.m_subspaceForTLSSocket.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForTLSSocket = std::forward<decltype(space)>(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast<JSC::JSType>(0b11101110), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - ; - - ~JSTLSSocket(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSTLSSocket, m_ctx); } - - void* m_ctx { nullptr }; - - JSTLSSocket(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - m_weakThis = JSC::Weak<JSTLSSocket>(this, getOwner()); - } - - void finishCreation(JSC::VM&); + public: + using Base = JSC::JSDestructibleObject; + static JSTLSSocket* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); + + DECLARE_EXPORT_INFO; + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return WebCore::subspaceForImpl<JSTLSSocket, WebCore::UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForTLSSocket.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForTLSSocket = std::forward<decltype(space)>(space); }, + [](auto& spaces) { return spaces.m_subspaceForTLSSocket.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForTLSSocket = std::forward<decltype(space)>(space); }); + } + + static void destroy(JSC::JSCell*); + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast<JSC::JSType>(0b11101110), StructureFlags), info()); + } + + static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); + ; + + ~JSTLSSocket(); + + void* wrapped() const { return m_ctx; } + + void detach() + { + m_ctx = nullptr; + } + + static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); + static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSTLSSocket, m_ctx); } + + void* m_ctx { nullptr }; + + + JSTLSSocket(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) + : Base(vm, structure) + { + m_ctx = sinkPtr; + m_weakThis = JSC::Weak<JSTLSSocket>(this, getOwner()); + } + + void finishCreation(JSC::VM&); + + + JSC::Weak<JSTLSSocket> m_weakThis; + static bool hasPendingActivity(void* ctx); class Owner final : public JSC::WeakHandleOwner { - public: - bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void* context, JSC::AbstractSlotVisitor& visitor, const char** reason) final - { - auto* controller = JSC::jsCast<JSTLSSocket*>(handle.slot()->asCell()); - if (JSTLSSocket::hasPendingActivity(controller->wrapped())) { - if (UNLIKELY(reason)) + public: + bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void* context, JSC::AbstractSlotVisitor& visitor, const char** reason) final + { + auto* controller = JSC::jsCast<JSTLSSocket*>(handle.slot()->asCell()); + if (JSTLSSocket::hasPendingActivity(controller->wrapped())) { + if (UNLIKELY(reason)) *reason = "has pending activity"; - return true; - } - - return visitor.containsOpaqueRoot(context); - } - void finalize(JSC::Handle<JSC::Unknown>, void* context) final {} + return true; + } + + return visitor.containsOpaqueRoot(context); + } + void finalize(JSC::Handle<JSC::Unknown>, void* context) final {} + }; + + static JSC::WeakHandleOwner* getOwner() + { + static NeverDestroyed<Owner> m_owner; + return &m_owner.get(); + } + + + DECLARE_VISIT_CHILDREN; +template<typename Visitor> void visitAdditionalChildren(Visitor&); +DECLARE_VISIT_OUTPUT_CONSTRAINTS; + + + mutable JSC::WriteBarrier<JSC::Unknown> m_data; +mutable JSC::WriteBarrier<JSC::Unknown> m_remoteAddress; }; - static JSC::WeakHandleOwner* getOwner() - { - static NeverDestroyed<Owner> m_owner; - return &m_owner.get(); - } - - DECLARE_VISIT_CHILDREN; - template<typename Visitor> void visitAdditionalChildren(Visitor&); - DECLARE_VISIT_OUTPUT_CONSTRAINTS; +class JSTextDecoder final : public JSC::JSDestructibleObject { + public: + using Base = JSC::JSDestructibleObject; + static JSTextDecoder* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); + + DECLARE_EXPORT_INFO; + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return WebCore::subspaceForImpl<JSTextDecoder, WebCore::UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForTextDecoder.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForTextDecoder = std::forward<decltype(space)>(space); }, + [](auto& spaces) { return spaces.m_subspaceForTextDecoder.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForTextDecoder = std::forward<decltype(space)>(space); }); + } + + static void destroy(JSC::JSCell*); + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast<JSC::JSType>(0b11101110), StructureFlags), info()); + } + + static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); + static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); + + ~JSTextDecoder(); + + void* wrapped() const { return m_ctx; } + + void detach() + { + m_ctx = nullptr; + } + + static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); + static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSTextDecoder, m_ctx); } + + void* m_ctx { nullptr }; + + + JSTextDecoder(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) + : Base(vm, structure) + { + m_ctx = sinkPtr; + + } + + void finishCreation(JSC::VM&); - mutable JSC::WriteBarrier<JSC::Unknown> m_data; - mutable JSC::WriteBarrier<JSC::Unknown> m_remoteAddress; -}; + -class JSTextDecoder final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSTextDecoder* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); + - DECLARE_EXPORT_INFO; - template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl<JSTextDecoder, WebCore::UseCustomHeapCellType::No>( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForTextDecoder.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForTextDecoder = std::forward<decltype(space)>(space); }, - [](auto& spaces) { return spaces.m_subspaceForTextDecoder.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForTextDecoder = std::forward<decltype(space)>(space); }); - } + DECLARE_VISIT_CHILDREN; +template<typename Visitor> void visitAdditionalChildren(Visitor&); +DECLARE_VISIT_OUTPUT_CONSTRAINTS; - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast<JSC::JSType>(0b11101110), StructureFlags), info()); - } - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); + mutable JSC::WriteBarrier<JSC::Unknown> m_encoding; + }; - ~JSTextDecoder(); +class JSTimeout final : public JSC::JSDestructibleObject { + public: + using Base = JSC::JSDestructibleObject; + static JSTimeout* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); + + DECLARE_EXPORT_INFO; + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return WebCore::subspaceForImpl<JSTimeout, WebCore::UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForTimeout.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForTimeout = std::forward<decltype(space)>(space); }, + [](auto& spaces) { return spaces.m_subspaceForTimeout.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForTimeout = std::forward<decltype(space)>(space); }); + } + + static void destroy(JSC::JSCell*); + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast<JSC::JSType>(0b11101110), StructureFlags), info()); + } + + static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); + ; + + ~JSTimeout(); + + void* wrapped() const { return m_ctx; } + + void detach() + { + m_ctx = nullptr; + } + + static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); + static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSTimeout, m_ctx); } + + void* m_ctx { nullptr }; + + + JSTimeout(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) + : Base(vm, structure) + { + m_ctx = sinkPtr; + + } + + void finishCreation(JSC::VM&); - void* wrapped() const { return m_ctx; } + - void detach() - { - m_ctx = nullptr; - } + - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSTextDecoder, m_ctx); } + - void* m_ctx { nullptr }; + + }; - JSTextDecoder(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - } +class JSTranspiler final : public JSC::JSDestructibleObject { + public: + using Base = JSC::JSDestructibleObject; + static JSTranspiler* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); + + DECLARE_EXPORT_INFO; + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return WebCore::subspaceForImpl<JSTranspiler, WebCore::UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForTranspiler.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForTranspiler = std::forward<decltype(space)>(space); }, + [](auto& spaces) { return spaces.m_subspaceForTranspiler.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForTranspiler = std::forward<decltype(space)>(space); }); + } + + static void destroy(JSC::JSCell*); + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast<JSC::JSType>(0b11101110), StructureFlags), info()); + } + + static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); + static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); + + ~JSTranspiler(); + + void* wrapped() const { return m_ctx; } + + void detach() + { + m_ctx = nullptr; + } + + static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); + static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSTranspiler, m_ctx); } + + void* m_ctx { nullptr }; + + + JSTranspiler(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) + : Base(vm, structure) + { + m_ctx = sinkPtr; + + } + + void finishCreation(JSC::VM&); - void finishCreation(JSC::VM&); + WTF::Vector<std::unique_ptr<BunPlugin::OnLoad>> onLoadPlugins; +WTF::Vector<std::unique_ptr<BunPlugin::OnResolve>> onResolvePlugins; - DECLARE_VISIT_CHILDREN; - template<typename Visitor> void visitAdditionalChildren(Visitor&); - DECLARE_VISIT_OUTPUT_CONSTRAINTS; + - mutable JSC::WriteBarrier<JSC::Unknown> m_encoding; -}; + -class JSTimeout final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSTimeout* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl<JSTimeout, WebCore::UseCustomHeapCellType::No>( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForTimeout.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForTimeout = std::forward<decltype(space)>(space); }, - [](auto& spaces) { return spaces.m_subspaceForTimeout.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForTimeout = std::forward<decltype(space)>(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast<JSC::JSType>(0b11101110), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - ; - - ~JSTimeout(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSTimeout, m_ctx); } - - void* m_ctx { nullptr }; - - JSTimeout(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - } - - void finishCreation(JSC::VM&); -}; + + }; -class JSTranspiler final : public JSC::JSDestructibleObject { -public: - using Base = JSC::JSDestructibleObject; - static JSTranspiler* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); - - DECLARE_EXPORT_INFO; - template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - if constexpr (mode == JSC::SubspaceAccess::Concurrently) - return nullptr; - return WebCore::subspaceForImpl<JSTranspiler, WebCore::UseCustomHeapCellType::No>( - vm, - [](auto& spaces) { return spaces.m_clientSubspaceForTranspiler.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForTranspiler = std::forward<decltype(space)>(space); }, - [](auto& spaces) { return spaces.m_subspaceForTranspiler.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForTranspiler = std::forward<decltype(space)>(space); }); - } - - static void destroy(JSC::JSCell*); - static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) - { - return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(static_cast<JSC::JSType>(0b11101110), StructureFlags), info()); - } - - static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); - - ~JSTranspiler(); - - void* wrapped() const { return m_ctx; } - - void detach() - { - m_ctx = nullptr; - } - - static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSTranspiler, m_ctx); } - - void* m_ctx { nullptr }; - - JSTranspiler(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) - : Base(vm, structure) - { - m_ctx = sinkPtr; - } - - void finishCreation(JSC::VM&); - - WTF::Vector<std::unique_ptr<BunPlugin::OnLoad>> onLoadPlugins; - WTF::Vector<std::unique_ptr<BunPlugin::OnResolve>> onResolvePlugins; -}; } + diff --git a/src/bun.js/bindings/bindings.zig b/src/bun.js/bindings/bindings.zig index a5a12650d..0ef81f487 100644 --- a/src/bun.js/bindings/bindings.zig +++ b/src/bun.js/bindings/bindings.zig @@ -3062,6 +3062,10 @@ pub const JSValue = enum(JSValueReprInt) { return cppFn("coerceToInt64", .{ this, globalThis }); } + pub fn getIndex(this: JSValue, globalThis: *JSGlobalObject, i: u32) JSValue { + return JSC.JSObject.getIndex(this, globalThis, i); + } + const PropertyIteratorFn = *const fn ( globalObject_: *JSGlobalObject, ctx_ptr: ?*anyopaque, @@ -3799,6 +3803,10 @@ pub const JSValue = enum(JSValueReprInt) { return getZigString(this, global).toSlice(allocator); } + pub inline fn toSliceZ(this: JSValue, global: *JSGlobalObject, allocator: std.mem.Allocator) ZigString.Slice { + return getZigString(this, global).toSliceZ(allocator); + } + // On exception, this returns the empty string. pub fn toString(this: JSValue, globalThis: *JSGlobalObject) *JSString { return cppFn("toString", .{ this, globalThis }); diff --git a/src/bun.js/bindings/generated_classes.zig b/src/bun.js/bindings/generated_classes.zig index 6602309ab..191f6c0d4 100644 --- a/src/bun.js/bindings/generated_classes.zig +++ b/src/bun.js/bindings/generated_classes.zig @@ -1,3 +1,4 @@ + /// Generated code! To regenerate, run: /// /// make codegen @@ -12,23 +13,25 @@ /// - Add it to generated_classes_list.zig /// - pub usingnamespace JSC.Codegen.JSMyClassName; /// 5. make clean-bindings && make bindings -j10 -/// +/// const JSC = @import("bun").JSC; const Classes = @import("./generated_classes_list.zig").Classes; const Environment = @import("../../env.zig"); const std = @import("std"); -pub const StaticGetterType = fn (*JSC.JSGlobalObject, JSC.JSValue, JSC.JSValue) callconv(.C) JSC.JSValue; -pub const StaticSetterType = fn (*JSC.JSGlobalObject, JSC.JSValue, JSC.JSValue, JSC.JSValue) callconv(.C) bool; -pub const StaticCallbackType = fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; +pub const StaticGetterType = fn(*JSC.JSGlobalObject, JSC.JSValue, JSC.JSValue) callconv(.C) JSC.JSValue; +pub const StaticSetterType = fn(*JSC.JSGlobalObject, JSC.JSValue, JSC.JSValue, JSC.JSValue) callconv(.C) bool; +pub const StaticCallbackType = fn(*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; + + pub const JSBlob = struct { const Blob = Classes.Blob; - const GetterType = fn (*Blob, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*Blob, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*Blob, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*Blob, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*Blob, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; + const GetterType = fn(*Blob, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const GetterTypeWithThisValue = fn(*Blob, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const SetterType = fn(*Blob, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const SetterTypeWithThisValue = fn(*Blob, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const CallbackType = fn(*Blob, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; /// Return the pointer to the wrapped object. /// If the object does not match the type, return null. @@ -37,13 +40,16 @@ pub const JSBlob = struct { return Blob__fromJS(value); } + + + /// Get the Blob constructor value. /// This loads lazily from the global object. pub fn getConstructor(globalObject: *JSC.JSGlobalObject) JSC.JSValue { JSC.markBinding(@src()); return Blob__getConstructor(globalObject); } - + /// Create a new instance of Blob pub fn toJS(this: *Blob, globalObject: *JSC.JSGlobalObject) JSC.JSValue { JSC.markBinding(@src()); @@ -58,14 +64,14 @@ pub const JSBlob = struct { /// Modify the internal ptr to point to a new instance of Blob. pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*Blob) bool { - JSC.markBinding(@src()); - return Blob__dangerouslySetPtr(value, ptr); + JSC.markBinding(@src()); + return Blob__dangerouslySetPtr(value, ptr); } /// Detach the ptr from the thisValue pub fn detachPtr(_: *Blob, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(Blob__dangerouslySetPtr(value, null)); + JSC.markBinding(@src()); + std.debug.assert(Blob__dangerouslySetPtr(value, null)); } extern fn Blob__fromJS(JSC.JSValue) ?*Blob; @@ -76,60 +82,81 @@ pub const JSBlob = struct { extern fn Blob__dangerouslySetPtr(JSC.JSValue, ?*Blob) bool; comptime { - if (@TypeOf(Blob.constructor) != (fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*Blob)) { - @compileLog("Blob.constructor is not a constructor"); + + if (@TypeOf(Blob.constructor) != (fn(*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*Blob)) { + @compileLog("Blob.constructor is not a constructor"); } - - if (@TypeOf(Blob.finalize) != (fn (*Blob) callconv(.C) void)) { - @compileLog("Blob.finalize is not a finalizer"); + + if (@TypeOf(Blob.finalize) != (fn(*Blob) callconv(.C) void)) { + @compileLog("Blob.finalize is not a finalizer"); } - - if (@TypeOf(Blob.getArrayBuffer) != CallbackType) - @compileLog("Expected Blob.getArrayBuffer to be a callback but received " ++ @typeName(@TypeOf(Blob.getArrayBuffer))); - if (@TypeOf(Blob.getFormData) != CallbackType) - @compileLog("Expected Blob.getFormData to be a callback but received " ++ @typeName(@TypeOf(Blob.getFormData))); - if (@TypeOf(Blob.getJSON) != CallbackType) - @compileLog("Expected Blob.getJSON to be a callback but received " ++ @typeName(@TypeOf(Blob.getJSON))); - if (@TypeOf(Blob.getLastModified) != GetterType) - @compileLog("Expected Blob.getLastModified to be a getter"); - - if (@TypeOf(Blob.getSize) != GetterType) - @compileLog("Expected Blob.getSize to be a getter"); - - if (@TypeOf(Blob.getSlice) != CallbackType) - @compileLog("Expected Blob.getSlice to be a callback but received " ++ @typeName(@TypeOf(Blob.getSlice))); - if (@TypeOf(Blob.getStream) != CallbackType) - @compileLog("Expected Blob.getStream to be a callback but received " ++ @typeName(@TypeOf(Blob.getStream))); - if (@TypeOf(Blob.getText) != CallbackType) - @compileLog("Expected Blob.getText to be a callback but received " ++ @typeName(@TypeOf(Blob.getText))); - if (@TypeOf(Blob.getType) != GetterType) - @compileLog("Expected Blob.getType to be a getter"); - - if (@TypeOf(Blob.getWriter) != CallbackType) - @compileLog("Expected Blob.getWriter to be a callback but received " ++ @typeName(@TypeOf(Blob.getWriter))); + + if (@TypeOf(Blob.getArrayBuffer) != CallbackType) + @compileLog( + "Expected Blob.getArrayBuffer to be a callback but received " ++ @typeName(@TypeOf(Blob.getArrayBuffer)) + ); + if (@TypeOf(Blob.getFormData) != CallbackType) + @compileLog( + "Expected Blob.getFormData to be a callback but received " ++ @typeName(@TypeOf(Blob.getFormData)) + ); + if (@TypeOf(Blob.getJSON) != CallbackType) + @compileLog( + "Expected Blob.getJSON to be a callback but received " ++ @typeName(@TypeOf(Blob.getJSON)) + ); + if (@TypeOf(Blob.getLastModified) != GetterType) + @compileLog( + "Expected Blob.getLastModified to be a getter" + ); + + if (@TypeOf(Blob.getSize) != GetterType) + @compileLog( + "Expected Blob.getSize to be a getter" + ); + + if (@TypeOf(Blob.getSlice) != CallbackType) + @compileLog( + "Expected Blob.getSlice to be a callback but received " ++ @typeName(@TypeOf(Blob.getSlice)) + ); + if (@TypeOf(Blob.getStream) != CallbackType) + @compileLog( + "Expected Blob.getStream to be a callback but received " ++ @typeName(@TypeOf(Blob.getStream)) + ); + if (@TypeOf(Blob.getText) != CallbackType) + @compileLog( + "Expected Blob.getText to be a callback but received " ++ @typeName(@TypeOf(Blob.getText)) + ); + if (@TypeOf(Blob.getType) != GetterType) + @compileLog( + "Expected Blob.getType to be a getter" + ); + + if (@TypeOf(Blob.getWriter) != CallbackType) + @compileLog( + "Expected Blob.getWriter to be a callback but received " ++ @typeName(@TypeOf(Blob.getWriter)) + ); if (!JSC.is_bindgen) { - @export(Blob.constructor, .{ .name = "BlobClass__construct" }); - @export(Blob.finalize, .{ .name = "BlobClass__finalize" }); - @export(Blob.getArrayBuffer, .{ .name = "BlobPrototype__getArrayBuffer" }); - @export(Blob.getFormData, .{ .name = "BlobPrototype__getFormData" }); - @export(Blob.getJSON, .{ .name = "BlobPrototype__getJSON" }); - @export(Blob.getLastModified, .{ .name = "BlobPrototype__getLastModified" }); - @export(Blob.getSize, .{ .name = "BlobPrototype__getSize" }); - @export(Blob.getSlice, .{ .name = "BlobPrototype__getSlice" }); - @export(Blob.getStream, .{ .name = "BlobPrototype__getStream" }); - @export(Blob.getText, .{ .name = "BlobPrototype__getText" }); - @export(Blob.getType, .{ .name = "BlobPrototype__getType" }); - @export(Blob.getWriter, .{ .name = "BlobPrototype__getWriter" }); +@export(Blob.constructor, .{.name = "BlobClass__construct"}); + @export(Blob.finalize, .{.name = "BlobClass__finalize"}); + @export(Blob.getArrayBuffer, .{.name = "BlobPrototype__getArrayBuffer"}); + @export(Blob.getFormData, .{.name = "BlobPrototype__getFormData"}); + @export(Blob.getJSON, .{.name = "BlobPrototype__getJSON"}); + @export(Blob.getLastModified, .{.name = "BlobPrototype__getLastModified"}); + @export(Blob.getSize, .{.name = "BlobPrototype__getSize"}); + @export(Blob.getSlice, .{.name = "BlobPrototype__getSlice"}); + @export(Blob.getStream, .{.name = "BlobPrototype__getStream"}); + @export(Blob.getText, .{.name = "BlobPrototype__getText"}); + @export(Blob.getType, .{.name = "BlobPrototype__getType"}); + @export(Blob.getWriter, .{.name = "BlobPrototype__getWriter"}); } } }; pub const JSCryptoHasher = struct { const CryptoHasher = Classes.CryptoHasher; - const GetterType = fn (*CryptoHasher, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*CryptoHasher, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*CryptoHasher, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*CryptoHasher, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*CryptoHasher, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; + const GetterType = fn(*CryptoHasher, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const GetterTypeWithThisValue = fn(*CryptoHasher, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const SetterType = fn(*CryptoHasher, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const SetterTypeWithThisValue = fn(*CryptoHasher, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const CallbackType = fn(*CryptoHasher, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; /// Return the pointer to the wrapped object. /// If the object does not match the type, return null. @@ -140,33 +167,35 @@ pub const JSCryptoHasher = struct { extern fn CryptoHasherPrototype__algorithmSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - extern fn CryptoHasherPrototype__algorithmGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `CryptoHasher.algorithm` setter - /// This value will be visited by the garbage collector. - pub fn algorithmSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - CryptoHasherPrototype__algorithmSetCachedValue(thisValue, globalObject, value); - } + extern fn CryptoHasherPrototype__algorithmGetCachedValue(JSC.JSValue) JSC.JSValue; + + /// `CryptoHasher.algorithm` setter + /// This value will be visited by the garbage collector. + pub fn algorithmSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { + JSC.markBinding(@src()); + CryptoHasherPrototype__algorithmSetCachedValue(thisValue, globalObject, value); + } - /// `CryptoHasher.algorithm` getter - /// This value will be visited by the garbage collector. - pub fn algorithmGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = CryptoHasherPrototype__algorithmGetCachedValue(thisValue); - if (result == .zero) + /// `CryptoHasher.algorithm` getter + /// This value will be visited by the garbage collector. + pub fn algorithmGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { + JSC.markBinding(@src()); + const result = CryptoHasherPrototype__algorithmGetCachedValue(thisValue); + if (result == .zero) return null; + + return result; + } - return result; - } + /// Get the CryptoHasher constructor value. /// This loads lazily from the global object. pub fn getConstructor(globalObject: *JSC.JSGlobalObject) JSC.JSValue { JSC.markBinding(@src()); return CryptoHasher__getConstructor(globalObject); } - + /// Create a new instance of CryptoHasher pub fn toJS(this: *CryptoHasher, globalObject: *JSC.JSGlobalObject) JSC.JSValue { JSC.markBinding(@src()); @@ -181,14 +210,14 @@ pub const JSCryptoHasher = struct { /// Modify the internal ptr to point to a new instance of CryptoHasher. pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*CryptoHasher) bool { - JSC.markBinding(@src()); - return CryptoHasher__dangerouslySetPtr(value, ptr); + JSC.markBinding(@src()); + return CryptoHasher__dangerouslySetPtr(value, ptr); } /// Detach the ptr from the thisValue pub fn detachPtr(_: *CryptoHasher, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(CryptoHasher__dangerouslySetPtr(value, null)); + JSC.markBinding(@src()); + std.debug.assert(CryptoHasher__dangerouslySetPtr(value, null)); } extern fn CryptoHasher__fromJS(JSC.JSValue) ?*CryptoHasher; @@ -199,48 +228,61 @@ pub const JSCryptoHasher = struct { extern fn CryptoHasher__dangerouslySetPtr(JSC.JSValue, ?*CryptoHasher) bool; comptime { - if (@TypeOf(CryptoHasher.constructor) != (fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*CryptoHasher)) { - @compileLog("CryptoHasher.constructor is not a constructor"); + + if (@TypeOf(CryptoHasher.constructor) != (fn(*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*CryptoHasher)) { + @compileLog("CryptoHasher.constructor is not a constructor"); } - - if (@TypeOf(CryptoHasher.finalize) != (fn (*CryptoHasher) callconv(.C) void)) { - @compileLog("CryptoHasher.finalize is not a finalizer"); + + if (@TypeOf(CryptoHasher.finalize) != (fn(*CryptoHasher) callconv(.C) void)) { + @compileLog("CryptoHasher.finalize is not a finalizer"); } - - if (@TypeOf(CryptoHasher.getAlgorithm) != GetterType) - @compileLog("Expected CryptoHasher.getAlgorithm to be a getter"); - - if (@TypeOf(CryptoHasher.getByteLength) != GetterType) - @compileLog("Expected CryptoHasher.getByteLength to be a getter"); - - if (@TypeOf(CryptoHasher.digest) != CallbackType) - @compileLog("Expected CryptoHasher.digest to be a callback but received " ++ @typeName(@TypeOf(CryptoHasher.digest))); - if (@TypeOf(CryptoHasher.update) != CallbackType) - @compileLog("Expected CryptoHasher.update to be a callback but received " ++ @typeName(@TypeOf(CryptoHasher.update))); - if (@TypeOf(CryptoHasher.getAlgorithms) != StaticGetterType) - @compileLog("Expected CryptoHasher.getAlgorithms to be a static getter"); - - if (@TypeOf(CryptoHasher.hash) != StaticCallbackType) - @compileLog("Expected CryptoHasher.hash to be a static callback"); + + if (@TypeOf(CryptoHasher.getAlgorithm) != GetterType) + @compileLog( + "Expected CryptoHasher.getAlgorithm to be a getter" + ); + + if (@TypeOf(CryptoHasher.getByteLength) != GetterType) + @compileLog( + "Expected CryptoHasher.getByteLength to be a getter" + ); + + if (@TypeOf(CryptoHasher.digest) != CallbackType) + @compileLog( + "Expected CryptoHasher.digest to be a callback but received " ++ @typeName(@TypeOf(CryptoHasher.digest)) + ); + if (@TypeOf(CryptoHasher.update) != CallbackType) + @compileLog( + "Expected CryptoHasher.update to be a callback but received " ++ @typeName(@TypeOf(CryptoHasher.update)) + ); + if (@TypeOf(CryptoHasher.getAlgorithms) != StaticGetterType) + @compileLog( + "Expected CryptoHasher.getAlgorithms to be a static getter" + ); + + if (@TypeOf(CryptoHasher.hash) != StaticCallbackType) + @compileLog( + "Expected CryptoHasher.hash to be a static callback" + ); if (!JSC.is_bindgen) { - @export(CryptoHasher.constructor, .{ .name = "CryptoHasherClass__construct" }); - @export(CryptoHasher.digest, .{ .name = "CryptoHasherPrototype__digest" }); - @export(CryptoHasher.finalize, .{ .name = "CryptoHasherClass__finalize" }); - @export(CryptoHasher.getAlgorithm, .{ .name = "CryptoHasherPrototype__getAlgorithm" }); - @export(CryptoHasher.getAlgorithms, .{ .name = "CryptoHasherClass__getAlgorithms" }); - @export(CryptoHasher.getByteLength, .{ .name = "CryptoHasherPrototype__getByteLength" }); - @export(CryptoHasher.hash, .{ .name = "CryptoHasherClass__hash" }); - @export(CryptoHasher.update, .{ .name = "CryptoHasherPrototype__update" }); +@export(CryptoHasher.constructor, .{.name = "CryptoHasherClass__construct"}); + @export(CryptoHasher.digest, .{.name = "CryptoHasherPrototype__digest"}); + @export(CryptoHasher.finalize, .{.name = "CryptoHasherClass__finalize"}); + @export(CryptoHasher.getAlgorithm, .{.name = "CryptoHasherPrototype__getAlgorithm"}); + @export(CryptoHasher.getAlgorithms, .{.name = "CryptoHasherClass__getAlgorithms"}); + @export(CryptoHasher.getByteLength, .{.name = "CryptoHasherPrototype__getByteLength"}); + @export(CryptoHasher.hash, .{.name = "CryptoHasherClass__hash"}); + @export(CryptoHasher.update, .{.name = "CryptoHasherPrototype__update"}); } } }; pub const JSDirent = struct { const Dirent = Classes.Dirent; - const GetterType = fn (*Dirent, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*Dirent, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*Dirent, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*Dirent, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*Dirent, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; + const GetterType = fn(*Dirent, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const GetterTypeWithThisValue = fn(*Dirent, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const SetterType = fn(*Dirent, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const SetterTypeWithThisValue = fn(*Dirent, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const CallbackType = fn(*Dirent, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; /// Return the pointer to the wrapped object. /// If the object does not match the type, return null. @@ -251,33 +293,35 @@ pub const JSDirent = struct { extern fn DirentPrototype__nameSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - extern fn DirentPrototype__nameGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `Dirent.name` setter - /// This value will be visited by the garbage collector. - pub fn nameSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - DirentPrototype__nameSetCachedValue(thisValue, globalObject, value); - } + extern fn DirentPrototype__nameGetCachedValue(JSC.JSValue) JSC.JSValue; + + /// `Dirent.name` setter + /// This value will be visited by the garbage collector. + pub fn nameSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { + JSC.markBinding(@src()); + DirentPrototype__nameSetCachedValue(thisValue, globalObject, value); + } - /// `Dirent.name` getter - /// This value will be visited by the garbage collector. - pub fn nameGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = DirentPrototype__nameGetCachedValue(thisValue); - if (result == .zero) + /// `Dirent.name` getter + /// This value will be visited by the garbage collector. + pub fn nameGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { + JSC.markBinding(@src()); + const result = DirentPrototype__nameGetCachedValue(thisValue); + if (result == .zero) return null; + + return result; + } - return result; - } + /// Get the Dirent constructor value. /// This loads lazily from the global object. pub fn getConstructor(globalObject: *JSC.JSGlobalObject) JSC.JSValue { JSC.markBinding(@src()); return Dirent__getConstructor(globalObject); } - + /// Create a new instance of Dirent pub fn toJS(this: *Dirent, globalObject: *JSC.JSGlobalObject) JSC.JSValue { JSC.markBinding(@src()); @@ -292,14 +336,14 @@ pub const JSDirent = struct { /// Modify the internal ptr to point to a new instance of Dirent. pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*Dirent) bool { - JSC.markBinding(@src()); - return Dirent__dangerouslySetPtr(value, ptr); + JSC.markBinding(@src()); + return Dirent__dangerouslySetPtr(value, ptr); } /// Detach the ptr from the thisValue pub fn detachPtr(_: *Dirent, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(Dirent__dangerouslySetPtr(value, null)); + JSC.markBinding(@src()); + std.debug.assert(Dirent__dangerouslySetPtr(value, null)); } extern fn Dirent__fromJS(JSC.JSValue) ?*Dirent; @@ -310,52 +354,69 @@ pub const JSDirent = struct { extern fn Dirent__dangerouslySetPtr(JSC.JSValue, ?*Dirent) bool; comptime { - if (@TypeOf(Dirent.constructor) != (fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*Dirent)) { - @compileLog("Dirent.constructor is not a constructor"); - } - - if (@TypeOf(Dirent.finalize) != (fn (*Dirent) callconv(.C) void)) { - @compileLog("Dirent.finalize is not a finalizer"); - } - - if (@TypeOf(Dirent.isBlockDevice) != CallbackType) - @compileLog("Expected Dirent.isBlockDevice to be a callback but received " ++ @typeName(@TypeOf(Dirent.isBlockDevice))); - if (@TypeOf(Dirent.isCharacterDevice) != CallbackType) - @compileLog("Expected Dirent.isCharacterDevice to be a callback but received " ++ @typeName(@TypeOf(Dirent.isCharacterDevice))); - if (@TypeOf(Dirent.isDirectory) != CallbackType) - @compileLog("Expected Dirent.isDirectory to be a callback but received " ++ @typeName(@TypeOf(Dirent.isDirectory))); - if (@TypeOf(Dirent.isFIFO) != CallbackType) - @compileLog("Expected Dirent.isFIFO to be a callback but received " ++ @typeName(@TypeOf(Dirent.isFIFO))); - if (@TypeOf(Dirent.isFile) != CallbackType) - @compileLog("Expected Dirent.isFile to be a callback but received " ++ @typeName(@TypeOf(Dirent.isFile))); - if (@TypeOf(Dirent.isSocket) != CallbackType) - @compileLog("Expected Dirent.isSocket to be a callback but received " ++ @typeName(@TypeOf(Dirent.isSocket))); - if (@TypeOf(Dirent.isSymbolicLink) != CallbackType) - @compileLog("Expected Dirent.isSymbolicLink to be a callback but received " ++ @typeName(@TypeOf(Dirent.isSymbolicLink))); - if (@TypeOf(Dirent.getName) != GetterType) - @compileLog("Expected Dirent.getName to be a getter"); + + if (@TypeOf(Dirent.constructor) != (fn(*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*Dirent)) { + @compileLog("Dirent.constructor is not a constructor"); + } + + if (@TypeOf(Dirent.finalize) != (fn(*Dirent) callconv(.C) void)) { + @compileLog("Dirent.finalize is not a finalizer"); + } + + if (@TypeOf(Dirent.isBlockDevice) != CallbackType) + @compileLog( + "Expected Dirent.isBlockDevice to be a callback but received " ++ @typeName(@TypeOf(Dirent.isBlockDevice)) + ); + if (@TypeOf(Dirent.isCharacterDevice) != CallbackType) + @compileLog( + "Expected Dirent.isCharacterDevice to be a callback but received " ++ @typeName(@TypeOf(Dirent.isCharacterDevice)) + ); + if (@TypeOf(Dirent.isDirectory) != CallbackType) + @compileLog( + "Expected Dirent.isDirectory to be a callback but received " ++ @typeName(@TypeOf(Dirent.isDirectory)) + ); + if (@TypeOf(Dirent.isFIFO) != CallbackType) + @compileLog( + "Expected Dirent.isFIFO to be a callback but received " ++ @typeName(@TypeOf(Dirent.isFIFO)) + ); + if (@TypeOf(Dirent.isFile) != CallbackType) + @compileLog( + "Expected Dirent.isFile to be a callback but received " ++ @typeName(@TypeOf(Dirent.isFile)) + ); + if (@TypeOf(Dirent.isSocket) != CallbackType) + @compileLog( + "Expected Dirent.isSocket to be a callback but received " ++ @typeName(@TypeOf(Dirent.isSocket)) + ); + if (@TypeOf(Dirent.isSymbolicLink) != CallbackType) + @compileLog( + "Expected Dirent.isSymbolicLink to be a callback but received " ++ @typeName(@TypeOf(Dirent.isSymbolicLink)) + ); + if (@TypeOf(Dirent.getName) != GetterType) + @compileLog( + "Expected Dirent.getName to be a getter" + ); if (!JSC.is_bindgen) { - @export(Dirent.constructor, .{ .name = "DirentClass__construct" }); - @export(Dirent.finalize, .{ .name = "DirentClass__finalize" }); - @export(Dirent.getName, .{ .name = "DirentPrototype__getName" }); - @export(Dirent.isBlockDevice, .{ .name = "DirentPrototype__isBlockDevice" }); - @export(Dirent.isCharacterDevice, .{ .name = "DirentPrototype__isCharacterDevice" }); - @export(Dirent.isDirectory, .{ .name = "DirentPrototype__isDirectory" }); - @export(Dirent.isFIFO, .{ .name = "DirentPrototype__isFIFO" }); - @export(Dirent.isFile, .{ .name = "DirentPrototype__isFile" }); - @export(Dirent.isSocket, .{ .name = "DirentPrototype__isSocket" }); - @export(Dirent.isSymbolicLink, .{ .name = "DirentPrototype__isSymbolicLink" }); +@export(Dirent.constructor, .{.name = "DirentClass__construct"}); + @export(Dirent.finalize, .{.name = "DirentClass__finalize"}); + @export(Dirent.getName, .{.name = "DirentPrototype__getName"}); + @export(Dirent.isBlockDevice, .{.name = "DirentPrototype__isBlockDevice"}); + @export(Dirent.isCharacterDevice, .{.name = "DirentPrototype__isCharacterDevice"}); + @export(Dirent.isDirectory, .{.name = "DirentPrototype__isDirectory"}); + @export(Dirent.isFIFO, .{.name = "DirentPrototype__isFIFO"}); + @export(Dirent.isFile, .{.name = "DirentPrototype__isFile"}); + @export(Dirent.isSocket, .{.name = "DirentPrototype__isSocket"}); + @export(Dirent.isSymbolicLink, .{.name = "DirentPrototype__isSymbolicLink"}); } } }; pub const JSExpect = struct { const Expect = Classes.Expect; - const GetterType = fn (*Expect, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*Expect, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*Expect, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*Expect, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*Expect, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; + const GetterType = fn(*Expect, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const GetterTypeWithThisValue = fn(*Expect, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const SetterType = fn(*Expect, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const SetterTypeWithThisValue = fn(*Expect, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const CallbackType = fn(*Expect, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; /// Return the pointer to the wrapped object. /// If the object does not match the type, return null. @@ -366,55 +427,57 @@ pub const JSExpect = struct { extern fn ExpectPrototype__capturedValueSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - extern fn ExpectPrototype__capturedValueGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `Expect.capturedValue` setter - /// This value will be visited by the garbage collector. - pub fn capturedValueSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - ExpectPrototype__capturedValueSetCachedValue(thisValue, globalObject, value); - } + extern fn ExpectPrototype__capturedValueGetCachedValue(JSC.JSValue) JSC.JSValue; + + /// `Expect.capturedValue` setter + /// This value will be visited by the garbage collector. + pub fn capturedValueSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { + JSC.markBinding(@src()); + ExpectPrototype__capturedValueSetCachedValue(thisValue, globalObject, value); + } - /// `Expect.capturedValue` getter - /// This value will be visited by the garbage collector. - pub fn capturedValueGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = ExpectPrototype__capturedValueGetCachedValue(thisValue); - if (result == .zero) + /// `Expect.capturedValue` getter + /// This value will be visited by the garbage collector. + pub fn capturedValueGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { + JSC.markBinding(@src()); + const result = ExpectPrototype__capturedValueGetCachedValue(thisValue); + if (result == .zero) return null; + + return result; + } - return result; - } - - extern fn ExpectPrototype__resultValueSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn ExpectPrototype__resultValueGetCachedValue(JSC.JSValue) JSC.JSValue; +extern fn ExpectPrototype__resultValueSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - /// `Expect.resultValue` setter - /// This value will be visited by the garbage collector. - pub fn resultValueSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - ExpectPrototype__resultValueSetCachedValue(thisValue, globalObject, value); - } + extern fn ExpectPrototype__resultValueGetCachedValue(JSC.JSValue) JSC.JSValue; + + /// `Expect.resultValue` setter + /// This value will be visited by the garbage collector. + pub fn resultValueSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { + JSC.markBinding(@src()); + ExpectPrototype__resultValueSetCachedValue(thisValue, globalObject, value); + } - /// `Expect.resultValue` getter - /// This value will be visited by the garbage collector. - pub fn resultValueGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = ExpectPrototype__resultValueGetCachedValue(thisValue); - if (result == .zero) + /// `Expect.resultValue` getter + /// This value will be visited by the garbage collector. + pub fn resultValueGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { + JSC.markBinding(@src()); + const result = ExpectPrototype__resultValueGetCachedValue(thisValue); + if (result == .zero) return null; + + return result; + } - return result; - } + /// Get the Expect constructor value. /// This loads lazily from the global object. pub fn getConstructor(globalObject: *JSC.JSGlobalObject) JSC.JSValue { JSC.markBinding(@src()); return Expect__getConstructor(globalObject); } - + /// Create a new instance of Expect pub fn toJS(this: *Expect, globalObject: *JSC.JSGlobalObject) JSC.JSValue { JSC.markBinding(@src()); @@ -429,14 +492,14 @@ pub const JSExpect = struct { /// Modify the internal ptr to point to a new instance of Expect. pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*Expect) bool { - JSC.markBinding(@src()); - return Expect__dangerouslySetPtr(value, ptr); + JSC.markBinding(@src()); + return Expect__dangerouslySetPtr(value, ptr); } /// Detach the ptr from the thisValue pub fn detachPtr(_: *Expect, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(Expect__dangerouslySetPtr(value, null)); + JSC.markBinding(@src()); + std.debug.assert(Expect__dangerouslySetPtr(value, null)); } extern fn Expect__fromJS(JSC.JSValue) ?*Expect; @@ -447,183 +510,280 @@ pub const JSExpect = struct { extern fn Expect__dangerouslySetPtr(JSC.JSValue, ?*Expect) bool; comptime { - if (@TypeOf(Expect.constructor) != (fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*Expect)) { - @compileLog("Expect.constructor is not a constructor"); - } - - if (@TypeOf(Expect.finalize) != (fn (*Expect) callconv(.C) void)) { - @compileLog("Expect.finalize is not a finalizer"); - } - - if (@TypeOf(Expect.getNot) != GetterTypeWithThisValue) - @compileLog("Expected Expect.getNot to be a getter with thisValue"); - if (@TypeOf(Expect.getRejects) != GetterTypeWithThisValue) - @compileLog("Expected Expect.getRejects to be a getter with thisValue"); - if (@TypeOf(Expect.getResolves) != GetterTypeWithThisValue) - @compileLog("Expected Expect.getResolves to be a getter with thisValue"); - if (@TypeOf(Expect.toBe) != CallbackType) - @compileLog("Expected Expect.toBe to be a callback but received " ++ @typeName(@TypeOf(Expect.toBe))); - if (@TypeOf(Expect.toBeCloseTo) != CallbackType) - @compileLog("Expected Expect.toBeCloseTo to be a callback but received " ++ @typeName(@TypeOf(Expect.toBeCloseTo))); - if (@TypeOf(Expect.toBeDefined) != CallbackType) - @compileLog("Expected Expect.toBeDefined to be a callback but received " ++ @typeName(@TypeOf(Expect.toBeDefined))); - if (@TypeOf(Expect.toBeFalsy) != CallbackType) - @compileLog("Expected Expect.toBeFalsy to be a callback but received " ++ @typeName(@TypeOf(Expect.toBeFalsy))); - if (@TypeOf(Expect.toBeGreaterThan) != CallbackType) - @compileLog("Expected Expect.toBeGreaterThan to be a callback but received " ++ @typeName(@TypeOf(Expect.toBeGreaterThan))); - if (@TypeOf(Expect.toBeGreaterThanOrEqual) != CallbackType) - @compileLog("Expected Expect.toBeGreaterThanOrEqual to be a callback but received " ++ @typeName(@TypeOf(Expect.toBeGreaterThanOrEqual))); - if (@TypeOf(Expect.toBeInstanceOf) != CallbackType) - @compileLog("Expected Expect.toBeInstanceOf to be a callback but received " ++ @typeName(@TypeOf(Expect.toBeInstanceOf))); - if (@TypeOf(Expect.toBeLessThan) != CallbackType) - @compileLog("Expected Expect.toBeLessThan to be a callback but received " ++ @typeName(@TypeOf(Expect.toBeLessThan))); - if (@TypeOf(Expect.toBeLessThanOrEqual) != CallbackType) - @compileLog("Expected Expect.toBeLessThanOrEqual to be a callback but received " ++ @typeName(@TypeOf(Expect.toBeLessThanOrEqual))); - if (@TypeOf(Expect.toBeNaN) != CallbackType) - @compileLog("Expected Expect.toBeNaN to be a callback but received " ++ @typeName(@TypeOf(Expect.toBeNaN))); - if (@TypeOf(Expect.toBeNull) != CallbackType) - @compileLog("Expected Expect.toBeNull to be a callback but received " ++ @typeName(@TypeOf(Expect.toBeNull))); - if (@TypeOf(Expect.toBeTruthy) != CallbackType) - @compileLog("Expected Expect.toBeTruthy to be a callback but received " ++ @typeName(@TypeOf(Expect.toBeTruthy))); - if (@TypeOf(Expect.toBeUndefined) != CallbackType) - @compileLog("Expected Expect.toBeUndefined to be a callback but received " ++ @typeName(@TypeOf(Expect.toBeUndefined))); - if (@TypeOf(Expect.toContain) != CallbackType) - @compileLog("Expected Expect.toContain to be a callback but received " ++ @typeName(@TypeOf(Expect.toContain))); - if (@TypeOf(Expect.toContainEqual) != CallbackType) - @compileLog("Expected Expect.toContainEqual to be a callback but received " ++ @typeName(@TypeOf(Expect.toContainEqual))); - if (@TypeOf(Expect.toEqual) != CallbackType) - @compileLog("Expected Expect.toEqual to be a callback but received " ++ @typeName(@TypeOf(Expect.toEqual))); - if (@TypeOf(Expect.toHaveBeenCalledTimes) != CallbackType) - @compileLog("Expected Expect.toHaveBeenCalledTimes to be a callback but received " ++ @typeName(@TypeOf(Expect.toHaveBeenCalledTimes))); - if (@TypeOf(Expect.toHaveBeenCalledWith) != CallbackType) - @compileLog("Expected Expect.toHaveBeenCalledWith to be a callback but received " ++ @typeName(@TypeOf(Expect.toHaveBeenCalledWith))); - if (@TypeOf(Expect.toHaveBeenLastCalledWith) != CallbackType) - @compileLog("Expected Expect.toHaveBeenLastCalledWith to be a callback but received " ++ @typeName(@TypeOf(Expect.toHaveBeenLastCalledWith))); - if (@TypeOf(Expect.toHaveBeenNthCalledWith) != CallbackType) - @compileLog("Expected Expect.toHaveBeenNthCalledWith to be a callback but received " ++ @typeName(@TypeOf(Expect.toHaveBeenNthCalledWith))); - if (@TypeOf(Expect.toHaveLastReturnedWith) != CallbackType) - @compileLog("Expected Expect.toHaveLastReturnedWith to be a callback but received " ++ @typeName(@TypeOf(Expect.toHaveLastReturnedWith))); - if (@TypeOf(Expect.toHaveLength) != CallbackType) - @compileLog("Expected Expect.toHaveLength to be a callback but received " ++ @typeName(@TypeOf(Expect.toHaveLength))); - if (@TypeOf(Expect.toHaveNthReturnedWith) != CallbackType) - @compileLog("Expected Expect.toHaveNthReturnedWith to be a callback but received " ++ @typeName(@TypeOf(Expect.toHaveNthReturnedWith))); - if (@TypeOf(Expect.toHaveProperty) != CallbackType) - @compileLog("Expected Expect.toHaveProperty to be a callback but received " ++ @typeName(@TypeOf(Expect.toHaveProperty))); - if (@TypeOf(Expect.toHaveReturnedTimes) != CallbackType) - @compileLog("Expected Expect.toHaveReturnedTimes to be a callback but received " ++ @typeName(@TypeOf(Expect.toHaveReturnedTimes))); - if (@TypeOf(Expect.toHaveReturnedWith) != CallbackType) - @compileLog("Expected Expect.toHaveReturnedWith to be a callback but received " ++ @typeName(@TypeOf(Expect.toHaveReturnedWith))); - if (@TypeOf(Expect.toMatch) != CallbackType) - @compileLog("Expected Expect.toMatch to be a callback but received " ++ @typeName(@TypeOf(Expect.toMatch))); - if (@TypeOf(Expect.toMatchInlineSnapshot) != CallbackType) - @compileLog("Expected Expect.toMatchInlineSnapshot to be a callback but received " ++ @typeName(@TypeOf(Expect.toMatchInlineSnapshot))); - if (@TypeOf(Expect.toMatchObject) != CallbackType) - @compileLog("Expected Expect.toMatchObject to be a callback but received " ++ @typeName(@TypeOf(Expect.toMatchObject))); - if (@TypeOf(Expect.toMatchSnapshot) != CallbackType) - @compileLog("Expected Expect.toMatchSnapshot to be a callback but received " ++ @typeName(@TypeOf(Expect.toMatchSnapshot))); - if (@TypeOf(Expect.toStrictEqual) != CallbackType) - @compileLog("Expected Expect.toStrictEqual to be a callback but received " ++ @typeName(@TypeOf(Expect.toStrictEqual))); - if (@TypeOf(Expect.toThrow) != CallbackType) - @compileLog("Expected Expect.toThrow to be a callback but received " ++ @typeName(@TypeOf(Expect.toThrow))); - if (@TypeOf(Expect.toThrowErrorMatchingInlineSnapshot) != CallbackType) - @compileLog("Expected Expect.toThrowErrorMatchingInlineSnapshot to be a callback but received " ++ @typeName(@TypeOf(Expect.toThrowErrorMatchingInlineSnapshot))); - if (@TypeOf(Expect.toThrowErrorMatchingSnapshot) != CallbackType) - @compileLog("Expected Expect.toThrowErrorMatchingSnapshot to be a callback but received " ++ @typeName(@TypeOf(Expect.toThrowErrorMatchingSnapshot))); - if (@TypeOf(Expect.addSnapshotSerializer) != StaticCallbackType) - @compileLog("Expected Expect.addSnapshotSerializer to be a static callback"); - if (@TypeOf(Expect.any) != StaticCallbackType) - @compileLog("Expected Expect.any to be a static callback"); - if (@TypeOf(Expect.anything) != StaticCallbackType) - @compileLog("Expected Expect.anything to be a static callback"); - if (@TypeOf(Expect.arrayContaining) != StaticCallbackType) - @compileLog("Expected Expect.arrayContaining to be a static callback"); - if (@TypeOf(Expect.assertions) != StaticCallbackType) - @compileLog("Expected Expect.assertions to be a static callback"); - if (@TypeOf(Expect.extend) != StaticCallbackType) - @compileLog("Expected Expect.extend to be a static callback"); - if (@TypeOf(Expect.hasAssertions) != StaticCallbackType) - @compileLog("Expected Expect.hasAssertions to be a static callback"); - if (@TypeOf(Expect.getStaticNot) != StaticGetterType) - @compileLog("Expected Expect.getStaticNot to be a static getter"); - - if (@TypeOf(Expect.objectContaining) != StaticCallbackType) - @compileLog("Expected Expect.objectContaining to be a static callback"); - if (@TypeOf(Expect.getStaticRejects) != StaticGetterType) - @compileLog("Expected Expect.getStaticRejects to be a static getter"); - - if (@TypeOf(Expect.getStaticResolves) != StaticGetterType) - @compileLog("Expected Expect.getStaticResolves to be a static getter"); - - if (@TypeOf(Expect.stringContaining) != StaticCallbackType) - @compileLog("Expected Expect.stringContaining to be a static callback"); - if (@TypeOf(Expect.stringMatching) != StaticCallbackType) - @compileLog("Expected Expect.stringMatching to be a static callback"); - if (@TypeOf(Expect.call) != StaticCallbackType) - @compileLog("Expected Expect.call to be a static callback"); + + if (@TypeOf(Expect.constructor) != (fn(*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*Expect)) { + @compileLog("Expect.constructor is not a constructor"); + } + + if (@TypeOf(Expect.finalize) != (fn(*Expect) callconv(.C) void)) { + @compileLog("Expect.finalize is not a finalizer"); + } + + if (@TypeOf(Expect.getNot) != GetterTypeWithThisValue) + @compileLog("Expected Expect.getNot to be a getter with thisValue"); + if (@TypeOf(Expect.getRejects) != GetterTypeWithThisValue) + @compileLog("Expected Expect.getRejects to be a getter with thisValue"); + if (@TypeOf(Expect.getResolves) != GetterTypeWithThisValue) + @compileLog("Expected Expect.getResolves to be a getter with thisValue"); + if (@TypeOf(Expect.toBe) != CallbackType) + @compileLog( + "Expected Expect.toBe to be a callback but received " ++ @typeName(@TypeOf(Expect.toBe)) + ); + if (@TypeOf(Expect.toBeCloseTo) != CallbackType) + @compileLog( + "Expected Expect.toBeCloseTo to be a callback but received " ++ @typeName(@TypeOf(Expect.toBeCloseTo)) + ); + if (@TypeOf(Expect.toBeDefined) != CallbackType) + @compileLog( + "Expected Expect.toBeDefined to be a callback but received " ++ @typeName(@TypeOf(Expect.toBeDefined)) + ); + if (@TypeOf(Expect.toBeFalsy) != CallbackType) + @compileLog( + "Expected Expect.toBeFalsy to be a callback but received " ++ @typeName(@TypeOf(Expect.toBeFalsy)) + ); + if (@TypeOf(Expect.toBeGreaterThan) != CallbackType) + @compileLog( + "Expected Expect.toBeGreaterThan to be a callback but received " ++ @typeName(@TypeOf(Expect.toBeGreaterThan)) + ); + if (@TypeOf(Expect.toBeGreaterThanOrEqual) != CallbackType) + @compileLog( + "Expected Expect.toBeGreaterThanOrEqual to be a callback but received " ++ @typeName(@TypeOf(Expect.toBeGreaterThanOrEqual)) + ); + if (@TypeOf(Expect.toBeInstanceOf) != CallbackType) + @compileLog( + "Expected Expect.toBeInstanceOf to be a callback but received " ++ @typeName(@TypeOf(Expect.toBeInstanceOf)) + ); + if (@TypeOf(Expect.toBeLessThan) != CallbackType) + @compileLog( + "Expected Expect.toBeLessThan to be a callback but received " ++ @typeName(@TypeOf(Expect.toBeLessThan)) + ); + if (@TypeOf(Expect.toBeLessThanOrEqual) != CallbackType) + @compileLog( + "Expected Expect.toBeLessThanOrEqual to be a callback but received " ++ @typeName(@TypeOf(Expect.toBeLessThanOrEqual)) + ); + if (@TypeOf(Expect.toBeNaN) != CallbackType) + @compileLog( + "Expected Expect.toBeNaN to be a callback but received " ++ @typeName(@TypeOf(Expect.toBeNaN)) + ); + if (@TypeOf(Expect.toBeNull) != CallbackType) + @compileLog( + "Expected Expect.toBeNull to be a callback but received " ++ @typeName(@TypeOf(Expect.toBeNull)) + ); + if (@TypeOf(Expect.toBeTruthy) != CallbackType) + @compileLog( + "Expected Expect.toBeTruthy to be a callback but received " ++ @typeName(@TypeOf(Expect.toBeTruthy)) + ); + if (@TypeOf(Expect.toBeUndefined) != CallbackType) + @compileLog( + "Expected Expect.toBeUndefined to be a callback but received " ++ @typeName(@TypeOf(Expect.toBeUndefined)) + ); + if (@TypeOf(Expect.toContain) != CallbackType) + @compileLog( + "Expected Expect.toContain to be a callback but received " ++ @typeName(@TypeOf(Expect.toContain)) + ); + if (@TypeOf(Expect.toContainEqual) != CallbackType) + @compileLog( + "Expected Expect.toContainEqual to be a callback but received " ++ @typeName(@TypeOf(Expect.toContainEqual)) + ); + if (@TypeOf(Expect.toEqual) != CallbackType) + @compileLog( + "Expected Expect.toEqual to be a callback but received " ++ @typeName(@TypeOf(Expect.toEqual)) + ); + if (@TypeOf(Expect.toHaveBeenCalledTimes) != CallbackType) + @compileLog( + "Expected Expect.toHaveBeenCalledTimes to be a callback but received " ++ @typeName(@TypeOf(Expect.toHaveBeenCalledTimes)) + ); + if (@TypeOf(Expect.toHaveBeenCalledWith) != CallbackType) + @compileLog( + "Expected Expect.toHaveBeenCalledWith to be a callback but received " ++ @typeName(@TypeOf(Expect.toHaveBeenCalledWith)) + ); + if (@TypeOf(Expect.toHaveBeenLastCalledWith) != CallbackType) + @compileLog( + "Expected Expect.toHaveBeenLastCalledWith to be a callback but received " ++ @typeName(@TypeOf(Expect.toHaveBeenLastCalledWith)) + ); + if (@TypeOf(Expect.toHaveBeenNthCalledWith) != CallbackType) + @compileLog( + "Expected Expect.toHaveBeenNthCalledWith to be a callback but received " ++ @typeName(@TypeOf(Expect.toHaveBeenNthCalledWith)) + ); + if (@TypeOf(Expect.toHaveLastReturnedWith) != CallbackType) + @compileLog( + "Expected Expect.toHaveLastReturnedWith to be a callback but received " ++ @typeName(@TypeOf(Expect.toHaveLastReturnedWith)) + ); + if (@TypeOf(Expect.toHaveLength) != CallbackType) + @compileLog( + "Expected Expect.toHaveLength to be a callback but received " ++ @typeName(@TypeOf(Expect.toHaveLength)) + ); + if (@TypeOf(Expect.toHaveNthReturnedWith) != CallbackType) + @compileLog( + "Expected Expect.toHaveNthReturnedWith to be a callback but received " ++ @typeName(@TypeOf(Expect.toHaveNthReturnedWith)) + ); + if (@TypeOf(Expect.toHaveProperty) != CallbackType) + @compileLog( + "Expected Expect.toHaveProperty to be a callback but received " ++ @typeName(@TypeOf(Expect.toHaveProperty)) + ); + if (@TypeOf(Expect.toHaveReturnedTimes) != CallbackType) + @compileLog( + "Expected Expect.toHaveReturnedTimes to be a callback but received " ++ @typeName(@TypeOf(Expect.toHaveReturnedTimes)) + ); + if (@TypeOf(Expect.toHaveReturnedWith) != CallbackType) + @compileLog( + "Expected Expect.toHaveReturnedWith to be a callback but received " ++ @typeName(@TypeOf(Expect.toHaveReturnedWith)) + ); + if (@TypeOf(Expect.toMatch) != CallbackType) + @compileLog( + "Expected Expect.toMatch to be a callback but received " ++ @typeName(@TypeOf(Expect.toMatch)) + ); + if (@TypeOf(Expect.toMatchInlineSnapshot) != CallbackType) + @compileLog( + "Expected Expect.toMatchInlineSnapshot to be a callback but received " ++ @typeName(@TypeOf(Expect.toMatchInlineSnapshot)) + ); + if (@TypeOf(Expect.toMatchObject) != CallbackType) + @compileLog( + "Expected Expect.toMatchObject to be a callback but received " ++ @typeName(@TypeOf(Expect.toMatchObject)) + ); + if (@TypeOf(Expect.toMatchSnapshot) != CallbackType) + @compileLog( + "Expected Expect.toMatchSnapshot to be a callback but received " ++ @typeName(@TypeOf(Expect.toMatchSnapshot)) + ); + if (@TypeOf(Expect.toStrictEqual) != CallbackType) + @compileLog( + "Expected Expect.toStrictEqual to be a callback but received " ++ @typeName(@TypeOf(Expect.toStrictEqual)) + ); + if (@TypeOf(Expect.toThrow) != CallbackType) + @compileLog( + "Expected Expect.toThrow to be a callback but received " ++ @typeName(@TypeOf(Expect.toThrow)) + ); + if (@TypeOf(Expect.toThrowErrorMatchingInlineSnapshot) != CallbackType) + @compileLog( + "Expected Expect.toThrowErrorMatchingInlineSnapshot to be a callback but received " ++ @typeName(@TypeOf(Expect.toThrowErrorMatchingInlineSnapshot)) + ); + if (@TypeOf(Expect.toThrowErrorMatchingSnapshot) != CallbackType) + @compileLog( + "Expected Expect.toThrowErrorMatchingSnapshot to be a callback but received " ++ @typeName(@TypeOf(Expect.toThrowErrorMatchingSnapshot)) + ); + if (@TypeOf(Expect.addSnapshotSerializer) != StaticCallbackType) + @compileLog( + "Expected Expect.addSnapshotSerializer to be a static callback" + ); + if (@TypeOf(Expect.any) != StaticCallbackType) + @compileLog( + "Expected Expect.any to be a static callback" + ); + if (@TypeOf(Expect.anything) != StaticCallbackType) + @compileLog( + "Expected Expect.anything to be a static callback" + ); + if (@TypeOf(Expect.arrayContaining) != StaticCallbackType) + @compileLog( + "Expected Expect.arrayContaining to be a static callback" + ); + if (@TypeOf(Expect.assertions) != StaticCallbackType) + @compileLog( + "Expected Expect.assertions to be a static callback" + ); + if (@TypeOf(Expect.extend) != StaticCallbackType) + @compileLog( + "Expected Expect.extend to be a static callback" + ); + if (@TypeOf(Expect.hasAssertions) != StaticCallbackType) + @compileLog( + "Expected Expect.hasAssertions to be a static callback" + ); + if (@TypeOf(Expect.getStaticNot) != StaticGetterType) + @compileLog( + "Expected Expect.getStaticNot to be a static getter" + ); + + if (@TypeOf(Expect.objectContaining) != StaticCallbackType) + @compileLog( + "Expected Expect.objectContaining to be a static callback" + ); + if (@TypeOf(Expect.getStaticRejects) != StaticGetterType) + @compileLog( + "Expected Expect.getStaticRejects to be a static getter" + ); + + if (@TypeOf(Expect.getStaticResolves) != StaticGetterType) + @compileLog( + "Expected Expect.getStaticResolves to be a static getter" + ); + + if (@TypeOf(Expect.stringContaining) != StaticCallbackType) + @compileLog( + "Expected Expect.stringContaining to be a static callback" + ); + if (@TypeOf(Expect.stringMatching) != StaticCallbackType) + @compileLog( + "Expected Expect.stringMatching to be a static callback" + ); + if (@TypeOf(Expect.call) != StaticCallbackType) + @compileLog( + "Expected Expect.call to be a static callback" + ); if (!JSC.is_bindgen) { - @export(Expect.addSnapshotSerializer, .{ .name = "ExpectClass__addSnapshotSerializer" }); - @export(Expect.any, .{ .name = "ExpectClass__any" }); - @export(Expect.anything, .{ .name = "ExpectClass__anything" }); - @export(Expect.arrayContaining, .{ .name = "ExpectClass__arrayContaining" }); - @export(Expect.assertions, .{ .name = "ExpectClass__assertions" }); - @export(Expect.call, .{ .name = "ExpectClass__call" }); - @export(Expect.constructor, .{ .name = "ExpectClass__construct" }); - @export(Expect.extend, .{ .name = "ExpectClass__extend" }); - @export(Expect.finalize, .{ .name = "ExpectClass__finalize" }); - @export(Expect.getNot, .{ .name = "ExpectPrototype__getNot" }); - @export(Expect.getRejects, .{ .name = "ExpectPrototype__getRejects" }); - @export(Expect.getResolves, .{ .name = "ExpectPrototype__getResolves" }); - @export(Expect.getStaticNot, .{ .name = "ExpectClass__getStaticNot" }); - @export(Expect.getStaticRejects, .{ .name = "ExpectClass__getStaticRejects" }); - @export(Expect.getStaticResolves, .{ .name = "ExpectClass__getStaticResolves" }); - @export(Expect.hasAssertions, .{ .name = "ExpectClass__hasAssertions" }); - @export(Expect.objectContaining, .{ .name = "ExpectClass__objectContaining" }); - @export(Expect.stringContaining, .{ .name = "ExpectClass__stringContaining" }); - @export(Expect.stringMatching, .{ .name = "ExpectClass__stringMatching" }); - @export(Expect.toBe, .{ .name = "ExpectPrototype__toBe" }); - @export(Expect.toBeCloseTo, .{ .name = "ExpectPrototype__toBeCloseTo" }); - @export(Expect.toBeDefined, .{ .name = "ExpectPrototype__toBeDefined" }); - @export(Expect.toBeFalsy, .{ .name = "ExpectPrototype__toBeFalsy" }); - @export(Expect.toBeGreaterThan, .{ .name = "ExpectPrototype__toBeGreaterThan" }); - @export(Expect.toBeGreaterThanOrEqual, .{ .name = "ExpectPrototype__toBeGreaterThanOrEqual" }); - @export(Expect.toBeInstanceOf, .{ .name = "ExpectPrototype__toBeInstanceOf" }); - @export(Expect.toBeLessThan, .{ .name = "ExpectPrototype__toBeLessThan" }); - @export(Expect.toBeLessThanOrEqual, .{ .name = "ExpectPrototype__toBeLessThanOrEqual" }); - @export(Expect.toBeNaN, .{ .name = "ExpectPrototype__toBeNaN" }); - @export(Expect.toBeNull, .{ .name = "ExpectPrototype__toBeNull" }); - @export(Expect.toBeTruthy, .{ .name = "ExpectPrototype__toBeTruthy" }); - @export(Expect.toBeUndefined, .{ .name = "ExpectPrototype__toBeUndefined" }); - @export(Expect.toContain, .{ .name = "ExpectPrototype__toContain" }); - @export(Expect.toContainEqual, .{ .name = "ExpectPrototype__toContainEqual" }); - @export(Expect.toEqual, .{ .name = "ExpectPrototype__toEqual" }); - @export(Expect.toHaveBeenCalledTimes, .{ .name = "ExpectPrototype__toHaveBeenCalledTimes" }); - @export(Expect.toHaveBeenCalledWith, .{ .name = "ExpectPrototype__toHaveBeenCalledWith" }); - @export(Expect.toHaveBeenLastCalledWith, .{ .name = "ExpectPrototype__toHaveBeenLastCalledWith" }); - @export(Expect.toHaveBeenNthCalledWith, .{ .name = "ExpectPrototype__toHaveBeenNthCalledWith" }); - @export(Expect.toHaveLastReturnedWith, .{ .name = "ExpectPrototype__toHaveLastReturnedWith" }); - @export(Expect.toHaveLength, .{ .name = "ExpectPrototype__toHaveLength" }); - @export(Expect.toHaveNthReturnedWith, .{ .name = "ExpectPrototype__toHaveNthReturnedWith" }); - @export(Expect.toHaveProperty, .{ .name = "ExpectPrototype__toHaveProperty" }); - @export(Expect.toHaveReturnedTimes, .{ .name = "ExpectPrototype__toHaveReturnedTimes" }); - @export(Expect.toHaveReturnedWith, .{ .name = "ExpectPrototype__toHaveReturnedWith" }); - @export(Expect.toMatch, .{ .name = "ExpectPrototype__toMatch" }); - @export(Expect.toMatchInlineSnapshot, .{ .name = "ExpectPrototype__toMatchInlineSnapshot" }); - @export(Expect.toMatchObject, .{ .name = "ExpectPrototype__toMatchObject" }); - @export(Expect.toMatchSnapshot, .{ .name = "ExpectPrototype__toMatchSnapshot" }); - @export(Expect.toStrictEqual, .{ .name = "ExpectPrototype__toStrictEqual" }); - @export(Expect.toThrow, .{ .name = "ExpectPrototype__toThrow" }); - @export(Expect.toThrowErrorMatchingInlineSnapshot, .{ .name = "ExpectPrototype__toThrowErrorMatchingInlineSnapshot" }); - @export(Expect.toThrowErrorMatchingSnapshot, .{ .name = "ExpectPrototype__toThrowErrorMatchingSnapshot" }); +@export(Expect.addSnapshotSerializer, .{.name = "ExpectClass__addSnapshotSerializer"}); + @export(Expect.any, .{.name = "ExpectClass__any"}); + @export(Expect.anything, .{.name = "ExpectClass__anything"}); + @export(Expect.arrayContaining, .{.name = "ExpectClass__arrayContaining"}); + @export(Expect.assertions, .{.name = "ExpectClass__assertions"}); + @export(Expect.call, .{.name = "ExpectClass__call"}); + @export(Expect.constructor, .{.name = "ExpectClass__construct"}); + @export(Expect.extend, .{.name = "ExpectClass__extend"}); + @export(Expect.finalize, .{.name = "ExpectClass__finalize"}); + @export(Expect.getNot, .{.name = "ExpectPrototype__getNot"}); + @export(Expect.getRejects, .{.name = "ExpectPrototype__getRejects"}); + @export(Expect.getResolves, .{.name = "ExpectPrototype__getResolves"}); + @export(Expect.getStaticNot, .{.name = "ExpectClass__getStaticNot"}); + @export(Expect.getStaticRejects, .{.name = "ExpectClass__getStaticRejects"}); + @export(Expect.getStaticResolves, .{.name = "ExpectClass__getStaticResolves"}); + @export(Expect.hasAssertions, .{.name = "ExpectClass__hasAssertions"}); + @export(Expect.objectContaining, .{.name = "ExpectClass__objectContaining"}); + @export(Expect.stringContaining, .{.name = "ExpectClass__stringContaining"}); + @export(Expect.stringMatching, .{.name = "ExpectClass__stringMatching"}); + @export(Expect.toBe, .{.name = "ExpectPrototype__toBe"}); + @export(Expect.toBeCloseTo, .{.name = "ExpectPrototype__toBeCloseTo"}); + @export(Expect.toBeDefined, .{.name = "ExpectPrototype__toBeDefined"}); + @export(Expect.toBeFalsy, .{.name = "ExpectPrototype__toBeFalsy"}); + @export(Expect.toBeGreaterThan, .{.name = "ExpectPrototype__toBeGreaterThan"}); + @export(Expect.toBeGreaterThanOrEqual, .{.name = "ExpectPrototype__toBeGreaterThanOrEqual"}); + @export(Expect.toBeInstanceOf, .{.name = "ExpectPrototype__toBeInstanceOf"}); + @export(Expect.toBeLessThan, .{.name = "ExpectPrototype__toBeLessThan"}); + @export(Expect.toBeLessThanOrEqual, .{.name = "ExpectPrototype__toBeLessThanOrEqual"}); + @export(Expect.toBeNaN, .{.name = "ExpectPrototype__toBeNaN"}); + @export(Expect.toBeNull, .{.name = "ExpectPrototype__toBeNull"}); + @export(Expect.toBeTruthy, .{.name = "ExpectPrototype__toBeTruthy"}); + @export(Expect.toBeUndefined, .{.name = "ExpectPrototype__toBeUndefined"}); + @export(Expect.toContain, .{.name = "ExpectPrototype__toContain"}); + @export(Expect.toContainEqual, .{.name = "ExpectPrototype__toContainEqual"}); + @export(Expect.toEqual, .{.name = "ExpectPrototype__toEqual"}); + @export(Expect.toHaveBeenCalledTimes, .{.name = "ExpectPrototype__toHaveBeenCalledTimes"}); + @export(Expect.toHaveBeenCalledWith, .{.name = "ExpectPrototype__toHaveBeenCalledWith"}); + @export(Expect.toHaveBeenLastCalledWith, .{.name = "ExpectPrototype__toHaveBeenLastCalledWith"}); + @export(Expect.toHaveBeenNthCalledWith, .{.name = "ExpectPrototype__toHaveBeenNthCalledWith"}); + @export(Expect.toHaveLastReturnedWith, .{.name = "ExpectPrototype__toHaveLastReturnedWith"}); + @export(Expect.toHaveLength, .{.name = "ExpectPrototype__toHaveLength"}); + @export(Expect.toHaveNthReturnedWith, .{.name = "ExpectPrototype__toHaveNthReturnedWith"}); + @export(Expect.toHaveProperty, .{.name = "ExpectPrototype__toHaveProperty"}); + @export(Expect.toHaveReturnedTimes, .{.name = "ExpectPrototype__toHaveReturnedTimes"}); + @export(Expect.toHaveReturnedWith, .{.name = "ExpectPrototype__toHaveReturnedWith"}); + @export(Expect.toMatch, .{.name = "ExpectPrototype__toMatch"}); + @export(Expect.toMatchInlineSnapshot, .{.name = "ExpectPrototype__toMatchInlineSnapshot"}); + @export(Expect.toMatchObject, .{.name = "ExpectPrototype__toMatchObject"}); + @export(Expect.toMatchSnapshot, .{.name = "ExpectPrototype__toMatchSnapshot"}); + @export(Expect.toStrictEqual, .{.name = "ExpectPrototype__toStrictEqual"}); + @export(Expect.toThrow, .{.name = "ExpectPrototype__toThrow"}); + @export(Expect.toThrowErrorMatchingInlineSnapshot, .{.name = "ExpectPrototype__toThrowErrorMatchingInlineSnapshot"}); + @export(Expect.toThrowErrorMatchingSnapshot, .{.name = "ExpectPrototype__toThrowErrorMatchingSnapshot"}); } } }; pub const JSExpectAny = struct { const ExpectAny = Classes.ExpectAny; - const GetterType = fn (*ExpectAny, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*ExpectAny, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*ExpectAny, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*ExpectAny, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*ExpectAny, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; + const GetterType = fn(*ExpectAny, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const GetterTypeWithThisValue = fn(*ExpectAny, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const SetterType = fn(*ExpectAny, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const SetterTypeWithThisValue = fn(*ExpectAny, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const CallbackType = fn(*ExpectAny, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; /// Return the pointer to the wrapped object. /// If the object does not match the type, return null. @@ -634,26 +794,28 @@ pub const JSExpectAny = struct { extern fn ExpectAnyPrototype__constructorValueSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - extern fn ExpectAnyPrototype__constructorValueGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `ExpectAny.constructorValue` setter - /// This value will be visited by the garbage collector. - pub fn constructorValueSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - ExpectAnyPrototype__constructorValueSetCachedValue(thisValue, globalObject, value); - } + extern fn ExpectAnyPrototype__constructorValueGetCachedValue(JSC.JSValue) JSC.JSValue; + + /// `ExpectAny.constructorValue` setter + /// This value will be visited by the garbage collector. + pub fn constructorValueSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { + JSC.markBinding(@src()); + ExpectAnyPrototype__constructorValueSetCachedValue(thisValue, globalObject, value); + } - /// `ExpectAny.constructorValue` getter - /// This value will be visited by the garbage collector. - pub fn constructorValueGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = ExpectAnyPrototype__constructorValueGetCachedValue(thisValue); - if (result == .zero) + /// `ExpectAny.constructorValue` getter + /// This value will be visited by the garbage collector. + pub fn constructorValueGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { + JSC.markBinding(@src()); + const result = ExpectAnyPrototype__constructorValueGetCachedValue(thisValue); + if (result == .zero) return null; + + return result; + } - return result; - } + /// Create a new instance of ExpectAny pub fn toJS(this: *ExpectAny, globalObject: *JSC.JSGlobalObject) JSC.JSValue { JSC.markBinding(@src()); @@ -668,14 +830,14 @@ pub const JSExpectAny = struct { /// Modify the internal ptr to point to a new instance of ExpectAny. pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*ExpectAny) bool { - JSC.markBinding(@src()); - return ExpectAny__dangerouslySetPtr(value, ptr); + JSC.markBinding(@src()); + return ExpectAny__dangerouslySetPtr(value, ptr); } /// Detach the ptr from the thisValue pub fn detachPtr(_: *ExpectAny, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(ExpectAny__dangerouslySetPtr(value, null)); + JSC.markBinding(@src()); + std.debug.assert(ExpectAny__dangerouslySetPtr(value, null)); } extern fn ExpectAny__fromJS(JSC.JSValue) ?*ExpectAny; @@ -686,25 +848,28 @@ pub const JSExpectAny = struct { extern fn ExpectAny__dangerouslySetPtr(JSC.JSValue, ?*ExpectAny) bool; comptime { - if (@TypeOf(ExpectAny.finalize) != (fn (*ExpectAny) callconv(.C) void)) { - @compileLog("ExpectAny.finalize is not a finalizer"); + + if (@TypeOf(ExpectAny.finalize) != (fn(*ExpectAny) callconv(.C) void)) { + @compileLog("ExpectAny.finalize is not a finalizer"); } - - if (@TypeOf(ExpectAny.call) != StaticCallbackType) - @compileLog("Expected ExpectAny.call to be a static callback"); + + if (@TypeOf(ExpectAny.call) != StaticCallbackType) + @compileLog( + "Expected ExpectAny.call to be a static callback" + ); if (!JSC.is_bindgen) { - @export(ExpectAny.call, .{ .name = "ExpectAnyClass__call" }); - @export(ExpectAny.finalize, .{ .name = "ExpectAnyClass__finalize" }); +@export(ExpectAny.call, .{.name = "ExpectAnyClass__call"}); + @export(ExpectAny.finalize, .{.name = "ExpectAnyClass__finalize"}); } } }; pub const JSFileSystemRouter = struct { const FileSystemRouter = Classes.FileSystemRouter; - const GetterType = fn (*FileSystemRouter, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*FileSystemRouter, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*FileSystemRouter, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*FileSystemRouter, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*FileSystemRouter, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; + const GetterType = fn(*FileSystemRouter, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const GetterTypeWithThisValue = fn(*FileSystemRouter, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const SetterType = fn(*FileSystemRouter, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const SetterTypeWithThisValue = fn(*FileSystemRouter, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const CallbackType = fn(*FileSystemRouter, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; /// Return the pointer to the wrapped object. /// If the object does not match the type, return null. @@ -715,77 +880,79 @@ pub const JSFileSystemRouter = struct { extern fn FileSystemRouterPrototype__originSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - extern fn FileSystemRouterPrototype__originGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `FileSystemRouter.origin` setter - /// This value will be visited by the garbage collector. - pub fn originSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - FileSystemRouterPrototype__originSetCachedValue(thisValue, globalObject, value); - } + extern fn FileSystemRouterPrototype__originGetCachedValue(JSC.JSValue) JSC.JSValue; + + /// `FileSystemRouter.origin` setter + /// This value will be visited by the garbage collector. + pub fn originSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { + JSC.markBinding(@src()); + FileSystemRouterPrototype__originSetCachedValue(thisValue, globalObject, value); + } - /// `FileSystemRouter.origin` getter - /// This value will be visited by the garbage collector. - pub fn originGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = FileSystemRouterPrototype__originGetCachedValue(thisValue); - if (result == .zero) + /// `FileSystemRouter.origin` getter + /// This value will be visited by the garbage collector. + pub fn originGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { + JSC.markBinding(@src()); + const result = FileSystemRouterPrototype__originGetCachedValue(thisValue); + if (result == .zero) return null; + + return result; + } - return result; - } - - extern fn FileSystemRouterPrototype__routesSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn FileSystemRouterPrototype__routesGetCachedValue(JSC.JSValue) JSC.JSValue; +extern fn FileSystemRouterPrototype__routesSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - /// `FileSystemRouter.routes` setter - /// This value will be visited by the garbage collector. - pub fn routesSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - FileSystemRouterPrototype__routesSetCachedValue(thisValue, globalObject, value); - } + extern fn FileSystemRouterPrototype__routesGetCachedValue(JSC.JSValue) JSC.JSValue; + + /// `FileSystemRouter.routes` setter + /// This value will be visited by the garbage collector. + pub fn routesSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { + JSC.markBinding(@src()); + FileSystemRouterPrototype__routesSetCachedValue(thisValue, globalObject, value); + } - /// `FileSystemRouter.routes` getter - /// This value will be visited by the garbage collector. - pub fn routesGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = FileSystemRouterPrototype__routesGetCachedValue(thisValue); - if (result == .zero) + /// `FileSystemRouter.routes` getter + /// This value will be visited by the garbage collector. + pub fn routesGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { + JSC.markBinding(@src()); + const result = FileSystemRouterPrototype__routesGetCachedValue(thisValue); + if (result == .zero) return null; + + return result; + } - return result; - } - - extern fn FileSystemRouterPrototype__styleSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn FileSystemRouterPrototype__styleGetCachedValue(JSC.JSValue) JSC.JSValue; +extern fn FileSystemRouterPrototype__styleSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - /// `FileSystemRouter.style` setter - /// This value will be visited by the garbage collector. - pub fn styleSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - FileSystemRouterPrototype__styleSetCachedValue(thisValue, globalObject, value); - } + extern fn FileSystemRouterPrototype__styleGetCachedValue(JSC.JSValue) JSC.JSValue; + + /// `FileSystemRouter.style` setter + /// This value will be visited by the garbage collector. + pub fn styleSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { + JSC.markBinding(@src()); + FileSystemRouterPrototype__styleSetCachedValue(thisValue, globalObject, value); + } - /// `FileSystemRouter.style` getter - /// This value will be visited by the garbage collector. - pub fn styleGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = FileSystemRouterPrototype__styleGetCachedValue(thisValue); - if (result == .zero) + /// `FileSystemRouter.style` getter + /// This value will be visited by the garbage collector. + pub fn styleGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { + JSC.markBinding(@src()); + const result = FileSystemRouterPrototype__styleGetCachedValue(thisValue); + if (result == .zero) return null; + + return result; + } - return result; - } + /// Get the FileSystemRouter constructor value. /// This loads lazily from the global object. pub fn getConstructor(globalObject: *JSC.JSGlobalObject) JSC.JSValue { JSC.markBinding(@src()); return FileSystemRouter__getConstructor(globalObject); } - + /// Create a new instance of FileSystemRouter pub fn toJS(this: *FileSystemRouter, globalObject: *JSC.JSGlobalObject) JSC.JSValue { JSC.markBinding(@src()); @@ -800,14 +967,14 @@ pub const JSFileSystemRouter = struct { /// Modify the internal ptr to point to a new instance of FileSystemRouter. pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*FileSystemRouter) bool { - JSC.markBinding(@src()); - return FileSystemRouter__dangerouslySetPtr(value, ptr); + JSC.markBinding(@src()); + return FileSystemRouter__dangerouslySetPtr(value, ptr); } /// Detach the ptr from the thisValue pub fn detachPtr(_: *FileSystemRouter, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(FileSystemRouter__dangerouslySetPtr(value, null)); + JSC.markBinding(@src()); + std.debug.assert(FileSystemRouter__dangerouslySetPtr(value, null)); } extern fn FileSystemRouter__fromJS(JSC.JSValue) ?*FileSystemRouter; @@ -818,45 +985,56 @@ pub const JSFileSystemRouter = struct { extern fn FileSystemRouter__dangerouslySetPtr(JSC.JSValue, ?*FileSystemRouter) bool; comptime { - if (@TypeOf(FileSystemRouter.constructor) != (fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*FileSystemRouter)) { - @compileLog("FileSystemRouter.constructor is not a constructor"); + + if (@TypeOf(FileSystemRouter.constructor) != (fn(*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*FileSystemRouter)) { + @compileLog("FileSystemRouter.constructor is not a constructor"); } - - if (@TypeOf(FileSystemRouter.finalize) != (fn (*FileSystemRouter) callconv(.C) void)) { - @compileLog("FileSystemRouter.finalize is not a finalizer"); + + if (@TypeOf(FileSystemRouter.finalize) != (fn(*FileSystemRouter) callconv(.C) void)) { + @compileLog("FileSystemRouter.finalize is not a finalizer"); } - - if (@TypeOf(FileSystemRouter.match) != CallbackType) - @compileLog("Expected FileSystemRouter.match to be a callback but received " ++ @typeName(@TypeOf(FileSystemRouter.match))); - if (@TypeOf(FileSystemRouter.getOrigin) != GetterType) - @compileLog("Expected FileSystemRouter.getOrigin to be a getter"); - - if (@TypeOf(FileSystemRouter.reload) != CallbackType) - @compileLog("Expected FileSystemRouter.reload to be a callback but received " ++ @typeName(@TypeOf(FileSystemRouter.reload))); - if (@TypeOf(FileSystemRouter.getRoutes) != GetterType) - @compileLog("Expected FileSystemRouter.getRoutes to be a getter"); - - if (@TypeOf(FileSystemRouter.getStyle) != GetterType) - @compileLog("Expected FileSystemRouter.getStyle to be a getter"); + + if (@TypeOf(FileSystemRouter.match) != CallbackType) + @compileLog( + "Expected FileSystemRouter.match to be a callback but received " ++ @typeName(@TypeOf(FileSystemRouter.match)) + ); + if (@TypeOf(FileSystemRouter.getOrigin) != GetterType) + @compileLog( + "Expected FileSystemRouter.getOrigin to be a getter" + ); + + if (@TypeOf(FileSystemRouter.reload) != CallbackType) + @compileLog( + "Expected FileSystemRouter.reload to be a callback but received " ++ @typeName(@TypeOf(FileSystemRouter.reload)) + ); + if (@TypeOf(FileSystemRouter.getRoutes) != GetterType) + @compileLog( + "Expected FileSystemRouter.getRoutes to be a getter" + ); + + if (@TypeOf(FileSystemRouter.getStyle) != GetterType) + @compileLog( + "Expected FileSystemRouter.getStyle to be a getter" + ); if (!JSC.is_bindgen) { - @export(FileSystemRouter.constructor, .{ .name = "FileSystemRouterClass__construct" }); - @export(FileSystemRouter.finalize, .{ .name = "FileSystemRouterClass__finalize" }); - @export(FileSystemRouter.getOrigin, .{ .name = "FileSystemRouterPrototype__getOrigin" }); - @export(FileSystemRouter.getRoutes, .{ .name = "FileSystemRouterPrototype__getRoutes" }); - @export(FileSystemRouter.getStyle, .{ .name = "FileSystemRouterPrototype__getStyle" }); - @export(FileSystemRouter.match, .{ .name = "FileSystemRouterPrototype__match" }); - @export(FileSystemRouter.reload, .{ .name = "FileSystemRouterPrototype__reload" }); +@export(FileSystemRouter.constructor, .{.name = "FileSystemRouterClass__construct"}); + @export(FileSystemRouter.finalize, .{.name = "FileSystemRouterClass__finalize"}); + @export(FileSystemRouter.getOrigin, .{.name = "FileSystemRouterPrototype__getOrigin"}); + @export(FileSystemRouter.getRoutes, .{.name = "FileSystemRouterPrototype__getRoutes"}); + @export(FileSystemRouter.getStyle, .{.name = "FileSystemRouterPrototype__getStyle"}); + @export(FileSystemRouter.match, .{.name = "FileSystemRouterPrototype__match"}); + @export(FileSystemRouter.reload, .{.name = "FileSystemRouterPrototype__reload"}); } } }; pub const JSListener = struct { const Listener = Classes.Listener; - const GetterType = fn (*Listener, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*Listener, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*Listener, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*Listener, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*Listener, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; + const GetterType = fn(*Listener, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const GetterTypeWithThisValue = fn(*Listener, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const SetterType = fn(*Listener, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const SetterTypeWithThisValue = fn(*Listener, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const CallbackType = fn(*Listener, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; /// Return the pointer to the wrapped object. /// If the object does not match the type, return null. @@ -867,48 +1045,50 @@ pub const JSListener = struct { extern fn ListenerPrototype__hostnameSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - extern fn ListenerPrototype__hostnameGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `Listener.hostname` setter - /// This value will be visited by the garbage collector. - pub fn hostnameSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - ListenerPrototype__hostnameSetCachedValue(thisValue, globalObject, value); - } + extern fn ListenerPrototype__hostnameGetCachedValue(JSC.JSValue) JSC.JSValue; + + /// `Listener.hostname` setter + /// This value will be visited by the garbage collector. + pub fn hostnameSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { + JSC.markBinding(@src()); + ListenerPrototype__hostnameSetCachedValue(thisValue, globalObject, value); + } - /// `Listener.hostname` getter - /// This value will be visited by the garbage collector. - pub fn hostnameGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = ListenerPrototype__hostnameGetCachedValue(thisValue); - if (result == .zero) + /// `Listener.hostname` getter + /// This value will be visited by the garbage collector. + pub fn hostnameGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { + JSC.markBinding(@src()); + const result = ListenerPrototype__hostnameGetCachedValue(thisValue); + if (result == .zero) return null; + + return result; + } - return result; - } - - extern fn ListenerPrototype__unixSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn ListenerPrototype__unixGetCachedValue(JSC.JSValue) JSC.JSValue; +extern fn ListenerPrototype__unixSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - /// `Listener.unix` setter - /// This value will be visited by the garbage collector. - pub fn unixSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - ListenerPrototype__unixSetCachedValue(thisValue, globalObject, value); - } + extern fn ListenerPrototype__unixGetCachedValue(JSC.JSValue) JSC.JSValue; + + /// `Listener.unix` setter + /// This value will be visited by the garbage collector. + pub fn unixSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { + JSC.markBinding(@src()); + ListenerPrototype__unixSetCachedValue(thisValue, globalObject, value); + } - /// `Listener.unix` getter - /// This value will be visited by the garbage collector. - pub fn unixGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = ListenerPrototype__unixGetCachedValue(thisValue); - if (result == .zero) + /// `Listener.unix` getter + /// This value will be visited by the garbage collector. + pub fn unixGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { + JSC.markBinding(@src()); + const result = ListenerPrototype__unixGetCachedValue(thisValue); + if (result == .zero) return null; + + return result; + } - return result; - } + /// Create a new instance of Listener pub fn toJS(this: *Listener, globalObject: *JSC.JSGlobalObject) JSC.JSValue { JSC.markBinding(@src()); @@ -923,14 +1103,14 @@ pub const JSListener = struct { /// Modify the internal ptr to point to a new instance of Listener. pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*Listener) bool { - JSC.markBinding(@src()); - return Listener__dangerouslySetPtr(value, ptr); + JSC.markBinding(@src()); + return Listener__dangerouslySetPtr(value, ptr); } /// Detach the ptr from the thisValue pub fn detachPtr(_: *Listener, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(Listener__dangerouslySetPtr(value, null)); + JSC.markBinding(@src()); + std.debug.assert(Listener__dangerouslySetPtr(value, null)); } extern fn Listener__fromJS(JSC.JSValue) ?*Listener; @@ -941,53 +1121,72 @@ pub const JSListener = struct { extern fn Listener__dangerouslySetPtr(JSC.JSValue, ?*Listener) bool; comptime { - if (@TypeOf(Listener.finalize) != (fn (*Listener) callconv(.C) void)) { - @compileLog("Listener.finalize is not a finalizer"); + + if (@TypeOf(Listener.finalize) != (fn(*Listener) callconv(.C) void)) { + @compileLog("Listener.finalize is not a finalizer"); } - - if (@TypeOf(Listener.getData) != GetterType) - @compileLog("Expected Listener.getData to be a getter"); - - if (@TypeOf(Listener.setData) != SetterType) - @compileLog("Expected Listener.setData to be a setter"); - if (@TypeOf(Listener.getHostname) != GetterType) - @compileLog("Expected Listener.getHostname to be a getter"); - - if (@TypeOf(Listener.getPort) != GetterType) - @compileLog("Expected Listener.getPort to be a getter"); - - if (@TypeOf(Listener.ref) != CallbackType) - @compileLog("Expected Listener.ref to be a callback but received " ++ @typeName(@TypeOf(Listener.ref))); - if (@TypeOf(Listener.reload) != CallbackType) - @compileLog("Expected Listener.reload to be a callback but received " ++ @typeName(@TypeOf(Listener.reload))); - if (@TypeOf(Listener.stop) != CallbackType) - @compileLog("Expected Listener.stop to be a callback but received " ++ @typeName(@TypeOf(Listener.stop))); - if (@TypeOf(Listener.getUnix) != GetterType) - @compileLog("Expected Listener.getUnix to be a getter"); - - if (@TypeOf(Listener.unref) != CallbackType) - @compileLog("Expected Listener.unref to be a callback but received " ++ @typeName(@TypeOf(Listener.unref))); + + if (@TypeOf(Listener.getData) != GetterType) + @compileLog( + "Expected Listener.getData to be a getter" + ); + + if (@TypeOf(Listener.setData) != SetterType) + @compileLog( + "Expected Listener.setData to be a setter" + ); + if (@TypeOf(Listener.getHostname) != GetterType) + @compileLog( + "Expected Listener.getHostname to be a getter" + ); + + if (@TypeOf(Listener.getPort) != GetterType) + @compileLog( + "Expected Listener.getPort to be a getter" + ); + + if (@TypeOf(Listener.ref) != CallbackType) + @compileLog( + "Expected Listener.ref to be a callback but received " ++ @typeName(@TypeOf(Listener.ref)) + ); + if (@TypeOf(Listener.reload) != CallbackType) + @compileLog( + "Expected Listener.reload to be a callback but received " ++ @typeName(@TypeOf(Listener.reload)) + ); + if (@TypeOf(Listener.stop) != CallbackType) + @compileLog( + "Expected Listener.stop to be a callback but received " ++ @typeName(@TypeOf(Listener.stop)) + ); + if (@TypeOf(Listener.getUnix) != GetterType) + @compileLog( + "Expected Listener.getUnix to be a getter" + ); + + if (@TypeOf(Listener.unref) != CallbackType) + @compileLog( + "Expected Listener.unref to be a callback but received " ++ @typeName(@TypeOf(Listener.unref)) + ); if (!JSC.is_bindgen) { - @export(Listener.finalize, .{ .name = "ListenerClass__finalize" }); - @export(Listener.getData, .{ .name = "ListenerPrototype__getData" }); - @export(Listener.getHostname, .{ .name = "ListenerPrototype__getHostname" }); - @export(Listener.getPort, .{ .name = "ListenerPrototype__getPort" }); - @export(Listener.getUnix, .{ .name = "ListenerPrototype__getUnix" }); - @export(Listener.ref, .{ .name = "ListenerPrototype__ref" }); - @export(Listener.reload, .{ .name = "ListenerPrototype__reload" }); - @export(Listener.setData, .{ .name = "ListenerPrototype__setData" }); - @export(Listener.stop, .{ .name = "ListenerPrototype__stop" }); - @export(Listener.unref, .{ .name = "ListenerPrototype__unref" }); +@export(Listener.finalize, .{.name = "ListenerClass__finalize"}); + @export(Listener.getData, .{.name = "ListenerPrototype__getData"}); + @export(Listener.getHostname, .{.name = "ListenerPrototype__getHostname"}); + @export(Listener.getPort, .{.name = "ListenerPrototype__getPort"}); + @export(Listener.getUnix, .{.name = "ListenerPrototype__getUnix"}); + @export(Listener.ref, .{.name = "ListenerPrototype__ref"}); + @export(Listener.reload, .{.name = "ListenerPrototype__reload"}); + @export(Listener.setData, .{.name = "ListenerPrototype__setData"}); + @export(Listener.stop, .{.name = "ListenerPrototype__stop"}); + @export(Listener.unref, .{.name = "ListenerPrototype__unref"}); } } }; pub const JSMD4 = struct { const MD4 = Classes.MD4; - const GetterType = fn (*MD4, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*MD4, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*MD4, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*MD4, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*MD4, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; + const GetterType = fn(*MD4, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const GetterTypeWithThisValue = fn(*MD4, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const SetterType = fn(*MD4, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const SetterTypeWithThisValue = fn(*MD4, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const CallbackType = fn(*MD4, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; /// Return the pointer to the wrapped object. /// If the object does not match the type, return null. @@ -996,13 +1195,16 @@ pub const JSMD4 = struct { return MD4__fromJS(value); } + + + /// Get the MD4 constructor value. /// This loads lazily from the global object. pub fn getConstructor(globalObject: *JSC.JSGlobalObject) JSC.JSValue { JSC.markBinding(@src()); return MD4__getConstructor(globalObject); } - + /// Create a new instance of MD4 pub fn toJS(this: *MD4, globalObject: *JSC.JSGlobalObject) JSC.JSValue { JSC.markBinding(@src()); @@ -1017,14 +1219,14 @@ pub const JSMD4 = struct { /// Modify the internal ptr to point to a new instance of MD4. pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*MD4) bool { - JSC.markBinding(@src()); - return MD4__dangerouslySetPtr(value, ptr); + JSC.markBinding(@src()); + return MD4__dangerouslySetPtr(value, ptr); } /// Detach the ptr from the thisValue pub fn detachPtr(_: *MD4, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(MD4__dangerouslySetPtr(value, null)); + JSC.markBinding(@src()); + std.debug.assert(MD4__dangerouslySetPtr(value, null)); } extern fn MD4__fromJS(JSC.JSValue) ?*MD4; @@ -1035,44 +1237,55 @@ pub const JSMD4 = struct { extern fn MD4__dangerouslySetPtr(JSC.JSValue, ?*MD4) bool; comptime { - if (@TypeOf(MD4.constructor) != (fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*MD4)) { - @compileLog("MD4.constructor is not a constructor"); + + if (@TypeOf(MD4.constructor) != (fn(*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*MD4)) { + @compileLog("MD4.constructor is not a constructor"); } - - if (@TypeOf(MD4.finalize) != (fn (*MD4) callconv(.C) void)) { - @compileLog("MD4.finalize is not a finalizer"); + + if (@TypeOf(MD4.finalize) != (fn(*MD4) callconv(.C) void)) { + @compileLog("MD4.finalize is not a finalizer"); } - - if (@TypeOf(MD4.getByteLength) != GetterType) - @compileLog("Expected MD4.getByteLength to be a getter"); - - if (@TypeOf(MD4.digest) != CallbackType) - @compileLog("Expected MD4.digest to be a callback but received " ++ @typeName(@TypeOf(MD4.digest))); - if (@TypeOf(MD4.update) != CallbackType) - @compileLog("Expected MD4.update to be a callback but received " ++ @typeName(@TypeOf(MD4.update))); - if (@TypeOf(MD4.getByteLengthStatic) != StaticGetterType) - @compileLog("Expected MD4.getByteLengthStatic to be a static getter"); - - if (@TypeOf(MD4.hash) != StaticCallbackType) - @compileLog("Expected MD4.hash to be a static callback"); + + if (@TypeOf(MD4.getByteLength) != GetterType) + @compileLog( + "Expected MD4.getByteLength to be a getter" + ); + + if (@TypeOf(MD4.digest) != CallbackType) + @compileLog( + "Expected MD4.digest to be a callback but received " ++ @typeName(@TypeOf(MD4.digest)) + ); + if (@TypeOf(MD4.update) != CallbackType) + @compileLog( + "Expected MD4.update to be a callback but received " ++ @typeName(@TypeOf(MD4.update)) + ); + if (@TypeOf(MD4.getByteLengthStatic) != StaticGetterType) + @compileLog( + "Expected MD4.getByteLengthStatic to be a static getter" + ); + + if (@TypeOf(MD4.hash) != StaticCallbackType) + @compileLog( + "Expected MD4.hash to be a static callback" + ); if (!JSC.is_bindgen) { - @export(MD4.constructor, .{ .name = "MD4Class__construct" }); - @export(MD4.digest, .{ .name = "MD4Prototype__digest" }); - @export(MD4.finalize, .{ .name = "MD4Class__finalize" }); - @export(MD4.getByteLength, .{ .name = "MD4Prototype__getByteLength" }); - @export(MD4.getByteLengthStatic, .{ .name = "MD4Class__getByteLengthStatic" }); - @export(MD4.hash, .{ .name = "MD4Class__hash" }); - @export(MD4.update, .{ .name = "MD4Prototype__update" }); +@export(MD4.constructor, .{.name = "MD4Class__construct"}); + @export(MD4.digest, .{.name = "MD4Prototype__digest"}); + @export(MD4.finalize, .{.name = "MD4Class__finalize"}); + @export(MD4.getByteLength, .{.name = "MD4Prototype__getByteLength"}); + @export(MD4.getByteLengthStatic, .{.name = "MD4Class__getByteLengthStatic"}); + @export(MD4.hash, .{.name = "MD4Class__hash"}); + @export(MD4.update, .{.name = "MD4Prototype__update"}); } } }; pub const JSMD5 = struct { const MD5 = Classes.MD5; - const GetterType = fn (*MD5, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*MD5, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*MD5, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*MD5, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*MD5, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; + const GetterType = fn(*MD5, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const GetterTypeWithThisValue = fn(*MD5, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const SetterType = fn(*MD5, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const SetterTypeWithThisValue = fn(*MD5, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const CallbackType = fn(*MD5, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; /// Return the pointer to the wrapped object. /// If the object does not match the type, return null. @@ -1081,13 +1294,16 @@ pub const JSMD5 = struct { return MD5__fromJS(value); } + + + /// Get the MD5 constructor value. /// This loads lazily from the global object. pub fn getConstructor(globalObject: *JSC.JSGlobalObject) JSC.JSValue { JSC.markBinding(@src()); return MD5__getConstructor(globalObject); } - + /// Create a new instance of MD5 pub fn toJS(this: *MD5, globalObject: *JSC.JSGlobalObject) JSC.JSValue { JSC.markBinding(@src()); @@ -1102,14 +1318,14 @@ pub const JSMD5 = struct { /// Modify the internal ptr to point to a new instance of MD5. pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*MD5) bool { - JSC.markBinding(@src()); - return MD5__dangerouslySetPtr(value, ptr); + JSC.markBinding(@src()); + return MD5__dangerouslySetPtr(value, ptr); } /// Detach the ptr from the thisValue pub fn detachPtr(_: *MD5, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(MD5__dangerouslySetPtr(value, null)); + JSC.markBinding(@src()); + std.debug.assert(MD5__dangerouslySetPtr(value, null)); } extern fn MD5__fromJS(JSC.JSValue) ?*MD5; @@ -1120,44 +1336,55 @@ pub const JSMD5 = struct { extern fn MD5__dangerouslySetPtr(JSC.JSValue, ?*MD5) bool; comptime { - if (@TypeOf(MD5.constructor) != (fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*MD5)) { - @compileLog("MD5.constructor is not a constructor"); + + if (@TypeOf(MD5.constructor) != (fn(*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*MD5)) { + @compileLog("MD5.constructor is not a constructor"); } - - if (@TypeOf(MD5.finalize) != (fn (*MD5) callconv(.C) void)) { - @compileLog("MD5.finalize is not a finalizer"); + + if (@TypeOf(MD5.finalize) != (fn(*MD5) callconv(.C) void)) { + @compileLog("MD5.finalize is not a finalizer"); } - - if (@TypeOf(MD5.getByteLength) != GetterType) - @compileLog("Expected MD5.getByteLength to be a getter"); - - if (@TypeOf(MD5.digest) != CallbackType) - @compileLog("Expected MD5.digest to be a callback but received " ++ @typeName(@TypeOf(MD5.digest))); - if (@TypeOf(MD5.update) != CallbackType) - @compileLog("Expected MD5.update to be a callback but received " ++ @typeName(@TypeOf(MD5.update))); - if (@TypeOf(MD5.getByteLengthStatic) != StaticGetterType) - @compileLog("Expected MD5.getByteLengthStatic to be a static getter"); - - if (@TypeOf(MD5.hash) != StaticCallbackType) - @compileLog("Expected MD5.hash to be a static callback"); + + if (@TypeOf(MD5.getByteLength) != GetterType) + @compileLog( + "Expected MD5.getByteLength to be a getter" + ); + + if (@TypeOf(MD5.digest) != CallbackType) + @compileLog( + "Expected MD5.digest to be a callback but received " ++ @typeName(@TypeOf(MD5.digest)) + ); + if (@TypeOf(MD5.update) != CallbackType) + @compileLog( + "Expected MD5.update to be a callback but received " ++ @typeName(@TypeOf(MD5.update)) + ); + if (@TypeOf(MD5.getByteLengthStatic) != StaticGetterType) + @compileLog( + "Expected MD5.getByteLengthStatic to be a static getter" + ); + + if (@TypeOf(MD5.hash) != StaticCallbackType) + @compileLog( + "Expected MD5.hash to be a static callback" + ); if (!JSC.is_bindgen) { - @export(MD5.constructor, .{ .name = "MD5Class__construct" }); - @export(MD5.digest, .{ .name = "MD5Prototype__digest" }); - @export(MD5.finalize, .{ .name = "MD5Class__finalize" }); - @export(MD5.getByteLength, .{ .name = "MD5Prototype__getByteLength" }); - @export(MD5.getByteLengthStatic, .{ .name = "MD5Class__getByteLengthStatic" }); - @export(MD5.hash, .{ .name = "MD5Class__hash" }); - @export(MD5.update, .{ .name = "MD5Prototype__update" }); +@export(MD5.constructor, .{.name = "MD5Class__construct"}); + @export(MD5.digest, .{.name = "MD5Prototype__digest"}); + @export(MD5.finalize, .{.name = "MD5Class__finalize"}); + @export(MD5.getByteLength, .{.name = "MD5Prototype__getByteLength"}); + @export(MD5.getByteLengthStatic, .{.name = "MD5Class__getByteLengthStatic"}); + @export(MD5.hash, .{.name = "MD5Class__hash"}); + @export(MD5.update, .{.name = "MD5Prototype__update"}); } } }; pub const JSMatchedRoute = struct { const MatchedRoute = Classes.MatchedRoute; - const GetterType = fn (*MatchedRoute, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*MatchedRoute, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*MatchedRoute, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*MatchedRoute, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*MatchedRoute, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; + const GetterType = fn(*MatchedRoute, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const GetterTypeWithThisValue = fn(*MatchedRoute, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const SetterType = fn(*MatchedRoute, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const SetterTypeWithThisValue = fn(*MatchedRoute, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const CallbackType = fn(*MatchedRoute, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; /// Return the pointer to the wrapped object. /// If the object does not match the type, return null. @@ -1168,158 +1395,160 @@ pub const JSMatchedRoute = struct { extern fn MatchedRoutePrototype__filePathSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - extern fn MatchedRoutePrototype__filePathGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `MatchedRoute.filePath` setter - /// This value will be visited by the garbage collector. - pub fn filePathSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - MatchedRoutePrototype__filePathSetCachedValue(thisValue, globalObject, value); - } + extern fn MatchedRoutePrototype__filePathGetCachedValue(JSC.JSValue) JSC.JSValue; + + /// `MatchedRoute.filePath` setter + /// This value will be visited by the garbage collector. + pub fn filePathSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { + JSC.markBinding(@src()); + MatchedRoutePrototype__filePathSetCachedValue(thisValue, globalObject, value); + } - /// `MatchedRoute.filePath` getter - /// This value will be visited by the garbage collector. - pub fn filePathGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = MatchedRoutePrototype__filePathGetCachedValue(thisValue); - if (result == .zero) + /// `MatchedRoute.filePath` getter + /// This value will be visited by the garbage collector. + pub fn filePathGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { + JSC.markBinding(@src()); + const result = MatchedRoutePrototype__filePathGetCachedValue(thisValue); + if (result == .zero) return null; + + return result; + } - return result; - } - - extern fn MatchedRoutePrototype__kindSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn MatchedRoutePrototype__kindGetCachedValue(JSC.JSValue) JSC.JSValue; +extern fn MatchedRoutePrototype__kindSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - /// `MatchedRoute.kind` setter - /// This value will be visited by the garbage collector. - pub fn kindSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - MatchedRoutePrototype__kindSetCachedValue(thisValue, globalObject, value); - } + extern fn MatchedRoutePrototype__kindGetCachedValue(JSC.JSValue) JSC.JSValue; + + /// `MatchedRoute.kind` setter + /// This value will be visited by the garbage collector. + pub fn kindSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { + JSC.markBinding(@src()); + MatchedRoutePrototype__kindSetCachedValue(thisValue, globalObject, value); + } - /// `MatchedRoute.kind` getter - /// This value will be visited by the garbage collector. - pub fn kindGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = MatchedRoutePrototype__kindGetCachedValue(thisValue); - if (result == .zero) + /// `MatchedRoute.kind` getter + /// This value will be visited by the garbage collector. + pub fn kindGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { + JSC.markBinding(@src()); + const result = MatchedRoutePrototype__kindGetCachedValue(thisValue); + if (result == .zero) return null; + + return result; + } - return result; - } - - extern fn MatchedRoutePrototype__nameSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn MatchedRoutePrototype__nameGetCachedValue(JSC.JSValue) JSC.JSValue; +extern fn MatchedRoutePrototype__nameSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - /// `MatchedRoute.name` setter - /// This value will be visited by the garbage collector. - pub fn nameSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - MatchedRoutePrototype__nameSetCachedValue(thisValue, globalObject, value); - } + extern fn MatchedRoutePrototype__nameGetCachedValue(JSC.JSValue) JSC.JSValue; + + /// `MatchedRoute.name` setter + /// This value will be visited by the garbage collector. + pub fn nameSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { + JSC.markBinding(@src()); + MatchedRoutePrototype__nameSetCachedValue(thisValue, globalObject, value); + } - /// `MatchedRoute.name` getter - /// This value will be visited by the garbage collector. - pub fn nameGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = MatchedRoutePrototype__nameGetCachedValue(thisValue); - if (result == .zero) + /// `MatchedRoute.name` getter + /// This value will be visited by the garbage collector. + pub fn nameGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { + JSC.markBinding(@src()); + const result = MatchedRoutePrototype__nameGetCachedValue(thisValue); + if (result == .zero) return null; + + return result; + } - return result; - } - - extern fn MatchedRoutePrototype__paramsSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn MatchedRoutePrototype__paramsGetCachedValue(JSC.JSValue) JSC.JSValue; +extern fn MatchedRoutePrototype__paramsSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - /// `MatchedRoute.params` setter - /// This value will be visited by the garbage collector. - pub fn paramsSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - MatchedRoutePrototype__paramsSetCachedValue(thisValue, globalObject, value); - } + extern fn MatchedRoutePrototype__paramsGetCachedValue(JSC.JSValue) JSC.JSValue; + + /// `MatchedRoute.params` setter + /// This value will be visited by the garbage collector. + pub fn paramsSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { + JSC.markBinding(@src()); + MatchedRoutePrototype__paramsSetCachedValue(thisValue, globalObject, value); + } - /// `MatchedRoute.params` getter - /// This value will be visited by the garbage collector. - pub fn paramsGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = MatchedRoutePrototype__paramsGetCachedValue(thisValue); - if (result == .zero) + /// `MatchedRoute.params` getter + /// This value will be visited by the garbage collector. + pub fn paramsGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { + JSC.markBinding(@src()); + const result = MatchedRoutePrototype__paramsGetCachedValue(thisValue); + if (result == .zero) return null; + + return result; + } - return result; - } - - extern fn MatchedRoutePrototype__pathnameSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn MatchedRoutePrototype__pathnameGetCachedValue(JSC.JSValue) JSC.JSValue; +extern fn MatchedRoutePrototype__pathnameSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - /// `MatchedRoute.pathname` setter - /// This value will be visited by the garbage collector. - pub fn pathnameSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - MatchedRoutePrototype__pathnameSetCachedValue(thisValue, globalObject, value); - } + extern fn MatchedRoutePrototype__pathnameGetCachedValue(JSC.JSValue) JSC.JSValue; + + /// `MatchedRoute.pathname` setter + /// This value will be visited by the garbage collector. + pub fn pathnameSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { + JSC.markBinding(@src()); + MatchedRoutePrototype__pathnameSetCachedValue(thisValue, globalObject, value); + } - /// `MatchedRoute.pathname` getter - /// This value will be visited by the garbage collector. - pub fn pathnameGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = MatchedRoutePrototype__pathnameGetCachedValue(thisValue); - if (result == .zero) + /// `MatchedRoute.pathname` getter + /// This value will be visited by the garbage collector. + pub fn pathnameGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { + JSC.markBinding(@src()); + const result = MatchedRoutePrototype__pathnameGetCachedValue(thisValue); + if (result == .zero) return null; + + return result; + } - return result; - } - - extern fn MatchedRoutePrototype__querySetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn MatchedRoutePrototype__queryGetCachedValue(JSC.JSValue) JSC.JSValue; +extern fn MatchedRoutePrototype__querySetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - /// `MatchedRoute.query` setter - /// This value will be visited by the garbage collector. - pub fn querySetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - MatchedRoutePrototype__querySetCachedValue(thisValue, globalObject, value); - } + extern fn MatchedRoutePrototype__queryGetCachedValue(JSC.JSValue) JSC.JSValue; + + /// `MatchedRoute.query` setter + /// This value will be visited by the garbage collector. + pub fn querySetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { + JSC.markBinding(@src()); + MatchedRoutePrototype__querySetCachedValue(thisValue, globalObject, value); + } - /// `MatchedRoute.query` getter - /// This value will be visited by the garbage collector. - pub fn queryGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = MatchedRoutePrototype__queryGetCachedValue(thisValue); - if (result == .zero) + /// `MatchedRoute.query` getter + /// This value will be visited by the garbage collector. + pub fn queryGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { + JSC.markBinding(@src()); + const result = MatchedRoutePrototype__queryGetCachedValue(thisValue); + if (result == .zero) return null; + + return result; + } - return result; - } - - extern fn MatchedRoutePrototype__scriptSrcSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn MatchedRoutePrototype__scriptSrcGetCachedValue(JSC.JSValue) JSC.JSValue; +extern fn MatchedRoutePrototype__scriptSrcSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - /// `MatchedRoute.scriptSrc` setter - /// This value will be visited by the garbage collector. - pub fn scriptSrcSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - MatchedRoutePrototype__scriptSrcSetCachedValue(thisValue, globalObject, value); - } + extern fn MatchedRoutePrototype__scriptSrcGetCachedValue(JSC.JSValue) JSC.JSValue; + + /// `MatchedRoute.scriptSrc` setter + /// This value will be visited by the garbage collector. + pub fn scriptSrcSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { + JSC.markBinding(@src()); + MatchedRoutePrototype__scriptSrcSetCachedValue(thisValue, globalObject, value); + } - /// `MatchedRoute.scriptSrc` getter - /// This value will be visited by the garbage collector. - pub fn scriptSrcGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = MatchedRoutePrototype__scriptSrcGetCachedValue(thisValue); - if (result == .zero) + /// `MatchedRoute.scriptSrc` getter + /// This value will be visited by the garbage collector. + pub fn scriptSrcGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { + JSC.markBinding(@src()); + const result = MatchedRoutePrototype__scriptSrcGetCachedValue(thisValue); + if (result == .zero) return null; + + return result; + } - return result; - } + /// Create a new instance of MatchedRoute pub fn toJS(this: *MatchedRoute, globalObject: *JSC.JSGlobalObject) JSC.JSValue { JSC.markBinding(@src()); @@ -1334,14 +1563,14 @@ pub const JSMatchedRoute = struct { /// Modify the internal ptr to point to a new instance of MatchedRoute. pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*MatchedRoute) bool { - JSC.markBinding(@src()); - return MatchedRoute__dangerouslySetPtr(value, ptr); + JSC.markBinding(@src()); + return MatchedRoute__dangerouslySetPtr(value, ptr); } /// Detach the ptr from the thisValue pub fn detachPtr(_: *MatchedRoute, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(MatchedRoute__dangerouslySetPtr(value, null)); + JSC.markBinding(@src()); + std.debug.assert(MatchedRoute__dangerouslySetPtr(value, null)); } extern fn MatchedRoute__fromJS(JSC.JSValue) ?*MatchedRoute; @@ -1352,53 +1581,70 @@ pub const JSMatchedRoute = struct { extern fn MatchedRoute__dangerouslySetPtr(JSC.JSValue, ?*MatchedRoute) bool; comptime { - if (@TypeOf(MatchedRoute.finalize) != (fn (*MatchedRoute) callconv(.C) void)) { - @compileLog("MatchedRoute.finalize is not a finalizer"); + + if (@TypeOf(MatchedRoute.finalize) != (fn(*MatchedRoute) callconv(.C) void)) { + @compileLog("MatchedRoute.finalize is not a finalizer"); } - - if (@TypeOf(MatchedRoute.getFilePath) != GetterType) - @compileLog("Expected MatchedRoute.getFilePath to be a getter"); - - if (@TypeOf(MatchedRoute.getKind) != GetterType) - @compileLog("Expected MatchedRoute.getKind to be a getter"); - - if (@TypeOf(MatchedRoute.getName) != GetterType) - @compileLog("Expected MatchedRoute.getName to be a getter"); - - if (@TypeOf(MatchedRoute.getParams) != GetterType) - @compileLog("Expected MatchedRoute.getParams to be a getter"); - - if (@TypeOf(MatchedRoute.getPathname) != GetterType) - @compileLog("Expected MatchedRoute.getPathname to be a getter"); - - if (@TypeOf(MatchedRoute.getQuery) != GetterType) - @compileLog("Expected MatchedRoute.getQuery to be a getter"); - - if (@TypeOf(MatchedRoute.getScriptSrc) != GetterType) - @compileLog("Expected MatchedRoute.getScriptSrc to be a getter"); - - if (@TypeOf(MatchedRoute.getScriptSrc) != GetterType) - @compileLog("Expected MatchedRoute.getScriptSrc to be a getter"); + + if (@TypeOf(MatchedRoute.getFilePath) != GetterType) + @compileLog( + "Expected MatchedRoute.getFilePath to be a getter" + ); + + if (@TypeOf(MatchedRoute.getKind) != GetterType) + @compileLog( + "Expected MatchedRoute.getKind to be a getter" + ); + + if (@TypeOf(MatchedRoute.getName) != GetterType) + @compileLog( + "Expected MatchedRoute.getName to be a getter" + ); + + if (@TypeOf(MatchedRoute.getParams) != GetterType) + @compileLog( + "Expected MatchedRoute.getParams to be a getter" + ); + + if (@TypeOf(MatchedRoute.getPathname) != GetterType) + @compileLog( + "Expected MatchedRoute.getPathname to be a getter" + ); + + if (@TypeOf(MatchedRoute.getQuery) != GetterType) + @compileLog( + "Expected MatchedRoute.getQuery to be a getter" + ); + + if (@TypeOf(MatchedRoute.getScriptSrc) != GetterType) + @compileLog( + "Expected MatchedRoute.getScriptSrc to be a getter" + ); + + if (@TypeOf(MatchedRoute.getScriptSrc) != GetterType) + @compileLog( + "Expected MatchedRoute.getScriptSrc to be a getter" + ); if (!JSC.is_bindgen) { - @export(MatchedRoute.finalize, .{ .name = "MatchedRouteClass__finalize" }); - @export(MatchedRoute.getFilePath, .{ .name = "MatchedRoutePrototype__getFilePath" }); - @export(MatchedRoute.getKind, .{ .name = "MatchedRoutePrototype__getKind" }); - @export(MatchedRoute.getName, .{ .name = "MatchedRoutePrototype__getName" }); - @export(MatchedRoute.getParams, .{ .name = "MatchedRoutePrototype__getParams" }); - @export(MatchedRoute.getPathname, .{ .name = "MatchedRoutePrototype__getPathname" }); - @export(MatchedRoute.getQuery, .{ .name = "MatchedRoutePrototype__getQuery" }); - @export(MatchedRoute.getScriptSrc, .{ .name = "MatchedRoutePrototype__getScriptSrc" }); +@export(MatchedRoute.finalize, .{.name = "MatchedRouteClass__finalize"}); + @export(MatchedRoute.getFilePath, .{.name = "MatchedRoutePrototype__getFilePath"}); + @export(MatchedRoute.getKind, .{.name = "MatchedRoutePrototype__getKind"}); + @export(MatchedRoute.getName, .{.name = "MatchedRoutePrototype__getName"}); + @export(MatchedRoute.getParams, .{.name = "MatchedRoutePrototype__getParams"}); + @export(MatchedRoute.getPathname, .{.name = "MatchedRoutePrototype__getPathname"}); + @export(MatchedRoute.getQuery, .{.name = "MatchedRoutePrototype__getQuery"}); + @export(MatchedRoute.getScriptSrc, .{.name = "MatchedRoutePrototype__getScriptSrc"}); } } }; pub const JSNodeJSFS = struct { const NodeJSFS = Classes.NodeJSFS; - const GetterType = fn (*NodeJSFS, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*NodeJSFS, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*NodeJSFS, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*NodeJSFS, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*NodeJSFS, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; + const GetterType = fn(*NodeJSFS, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const GetterTypeWithThisValue = fn(*NodeJSFS, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const SetterType = fn(*NodeJSFS, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const SetterTypeWithThisValue = fn(*NodeJSFS, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const CallbackType = fn(*NodeJSFS, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; /// Return the pointer to the wrapped object. /// If the object does not match the type, return null. @@ -1407,13 +1653,16 @@ pub const JSNodeJSFS = struct { return NodeJSFS__fromJS(value); } + + + /// Get the NodeJSFS constructor value. /// This loads lazily from the global object. pub fn getConstructor(globalObject: *JSC.JSGlobalObject) JSC.JSValue { JSC.markBinding(@src()); return NodeJSFS__getConstructor(globalObject); } - + /// Create a new instance of NodeJSFS pub fn toJS(this: *NodeJSFS, globalObject: *JSC.JSGlobalObject) JSC.JSValue { JSC.markBinding(@src()); @@ -1428,14 +1677,14 @@ pub const JSNodeJSFS = struct { /// Modify the internal ptr to point to a new instance of NodeJSFS. pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*NodeJSFS) bool { - JSC.markBinding(@src()); - return NodeJSFS__dangerouslySetPtr(value, ptr); + JSC.markBinding(@src()); + return NodeJSFS__dangerouslySetPtr(value, ptr); } /// Detach the ptr from the thisValue pub fn detachPtr(_: *NodeJSFS, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(NodeJSFS__dangerouslySetPtr(value, null)); + JSC.markBinding(@src()); + std.debug.assert(NodeJSFS__dangerouslySetPtr(value, null)); } extern fn NodeJSFS__fromJS(JSC.JSValue) ?*NodeJSFS; @@ -1446,270 +1695,435 @@ pub const JSNodeJSFS = struct { extern fn NodeJSFS__dangerouslySetPtr(JSC.JSValue, ?*NodeJSFS) bool; comptime { - if (@TypeOf(NodeJSFS.constructor) != (fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*NodeJSFS)) { - @compileLog("NodeJSFS.constructor is not a constructor"); - } - - if (@TypeOf(NodeJSFS.access) != CallbackType) - @compileLog("Expected NodeJSFS.access to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.access))); - if (@TypeOf(NodeJSFS.accessSync) != CallbackType) - @compileLog("Expected NodeJSFS.accessSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.accessSync))); - if (@TypeOf(NodeJSFS.appendFile) != CallbackType) - @compileLog("Expected NodeJSFS.appendFile to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.appendFile))); - if (@TypeOf(NodeJSFS.appendFileSync) != CallbackType) - @compileLog("Expected NodeJSFS.appendFileSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.appendFileSync))); - if (@TypeOf(NodeJSFS.chmod) != CallbackType) - @compileLog("Expected NodeJSFS.chmod to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.chmod))); - if (@TypeOf(NodeJSFS.chmodSync) != CallbackType) - @compileLog("Expected NodeJSFS.chmodSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.chmodSync))); - if (@TypeOf(NodeJSFS.chown) != CallbackType) - @compileLog("Expected NodeJSFS.chown to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.chown))); - if (@TypeOf(NodeJSFS.chownSync) != CallbackType) - @compileLog("Expected NodeJSFS.chownSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.chownSync))); - if (@TypeOf(NodeJSFS.close) != CallbackType) - @compileLog("Expected NodeJSFS.close to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.close))); - if (@TypeOf(NodeJSFS.closeSync) != CallbackType) - @compileLog("Expected NodeJSFS.closeSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.closeSync))); - if (@TypeOf(NodeJSFS.copyFile) != CallbackType) - @compileLog("Expected NodeJSFS.copyFile to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.copyFile))); - if (@TypeOf(NodeJSFS.copyFileSync) != CallbackType) - @compileLog("Expected NodeJSFS.copyFileSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.copyFileSync))); - if (@TypeOf(NodeJSFS.getDirent) != GetterType) - @compileLog("Expected NodeJSFS.getDirent to be a getter"); - - if (@TypeOf(NodeJSFS.exists) != CallbackType) - @compileLog("Expected NodeJSFS.exists to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.exists))); - if (@TypeOf(NodeJSFS.existsSync) != CallbackType) - @compileLog("Expected NodeJSFS.existsSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.existsSync))); - if (@TypeOf(NodeJSFS.fchmod) != CallbackType) - @compileLog("Expected NodeJSFS.fchmod to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.fchmod))); - if (@TypeOf(NodeJSFS.fchmodSync) != CallbackType) - @compileLog("Expected NodeJSFS.fchmodSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.fchmodSync))); - if (@TypeOf(NodeJSFS.fchown) != CallbackType) - @compileLog("Expected NodeJSFS.fchown to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.fchown))); - if (@TypeOf(NodeJSFS.fchownSync) != CallbackType) - @compileLog("Expected NodeJSFS.fchownSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.fchownSync))); - if (@TypeOf(NodeJSFS.fdatasync) != CallbackType) - @compileLog("Expected NodeJSFS.fdatasync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.fdatasync))); - if (@TypeOf(NodeJSFS.fdatasyncSync) != CallbackType) - @compileLog("Expected NodeJSFS.fdatasyncSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.fdatasyncSync))); - if (@TypeOf(NodeJSFS.fstat) != CallbackType) - @compileLog("Expected NodeJSFS.fstat to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.fstat))); - if (@TypeOf(NodeJSFS.fstatSync) != CallbackType) - @compileLog("Expected NodeJSFS.fstatSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.fstatSync))); - if (@TypeOf(NodeJSFS.fsync) != CallbackType) - @compileLog("Expected NodeJSFS.fsync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.fsync))); - if (@TypeOf(NodeJSFS.fsyncSync) != CallbackType) - @compileLog("Expected NodeJSFS.fsyncSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.fsyncSync))); - if (@TypeOf(NodeJSFS.ftruncate) != CallbackType) - @compileLog("Expected NodeJSFS.ftruncate to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.ftruncate))); - if (@TypeOf(NodeJSFS.ftruncateSync) != CallbackType) - @compileLog("Expected NodeJSFS.ftruncateSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.ftruncateSync))); - if (@TypeOf(NodeJSFS.futimes) != CallbackType) - @compileLog("Expected NodeJSFS.futimes to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.futimes))); - if (@TypeOf(NodeJSFS.futimesSync) != CallbackType) - @compileLog("Expected NodeJSFS.futimesSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.futimesSync))); - if (@TypeOf(NodeJSFS.lchmod) != CallbackType) - @compileLog("Expected NodeJSFS.lchmod to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.lchmod))); - if (@TypeOf(NodeJSFS.lchmodSync) != CallbackType) - @compileLog("Expected NodeJSFS.lchmodSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.lchmodSync))); - if (@TypeOf(NodeJSFS.lchown) != CallbackType) - @compileLog("Expected NodeJSFS.lchown to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.lchown))); - if (@TypeOf(NodeJSFS.lchownSync) != CallbackType) - @compileLog("Expected NodeJSFS.lchownSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.lchownSync))); - if (@TypeOf(NodeJSFS.link) != CallbackType) - @compileLog("Expected NodeJSFS.link to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.link))); - if (@TypeOf(NodeJSFS.linkSync) != CallbackType) - @compileLog("Expected NodeJSFS.linkSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.linkSync))); - if (@TypeOf(NodeJSFS.lstat) != CallbackType) - @compileLog("Expected NodeJSFS.lstat to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.lstat))); - if (@TypeOf(NodeJSFS.lstatSync) != CallbackType) - @compileLog("Expected NodeJSFS.lstatSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.lstatSync))); - if (@TypeOf(NodeJSFS.lutimes) != CallbackType) - @compileLog("Expected NodeJSFS.lutimes to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.lutimes))); - if (@TypeOf(NodeJSFS.lutimesSync) != CallbackType) - @compileLog("Expected NodeJSFS.lutimesSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.lutimesSync))); - if (@TypeOf(NodeJSFS.mkdir) != CallbackType) - @compileLog("Expected NodeJSFS.mkdir to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.mkdir))); - if (@TypeOf(NodeJSFS.mkdirSync) != CallbackType) - @compileLog("Expected NodeJSFS.mkdirSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.mkdirSync))); - if (@TypeOf(NodeJSFS.mkdtemp) != CallbackType) - @compileLog("Expected NodeJSFS.mkdtemp to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.mkdtemp))); - if (@TypeOf(NodeJSFS.mkdtempSync) != CallbackType) - @compileLog("Expected NodeJSFS.mkdtempSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.mkdtempSync))); - if (@TypeOf(NodeJSFS.open) != CallbackType) - @compileLog("Expected NodeJSFS.open to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.open))); - if (@TypeOf(NodeJSFS.opendir) != CallbackType) - @compileLog("Expected NodeJSFS.opendir to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.opendir))); - if (@TypeOf(NodeJSFS.opendirSync) != CallbackType) - @compileLog("Expected NodeJSFS.opendirSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.opendirSync))); - if (@TypeOf(NodeJSFS.openSync) != CallbackType) - @compileLog("Expected NodeJSFS.openSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.openSync))); - if (@TypeOf(NodeJSFS.read) != CallbackType) - @compileLog("Expected NodeJSFS.read to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.read))); - if (@TypeOf(NodeJSFS.readdir) != CallbackType) - @compileLog("Expected NodeJSFS.readdir to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.readdir))); - if (@TypeOf(NodeJSFS.readdirSync) != CallbackType) - @compileLog("Expected NodeJSFS.readdirSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.readdirSync))); - if (@TypeOf(NodeJSFS.readFile) != CallbackType) - @compileLog("Expected NodeJSFS.readFile to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.readFile))); - if (@TypeOf(NodeJSFS.readFileSync) != CallbackType) - @compileLog("Expected NodeJSFS.readFileSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.readFileSync))); - if (@TypeOf(NodeJSFS.readlink) != CallbackType) - @compileLog("Expected NodeJSFS.readlink to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.readlink))); - if (@TypeOf(NodeJSFS.readlinkSync) != CallbackType) - @compileLog("Expected NodeJSFS.readlinkSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.readlinkSync))); - if (@TypeOf(NodeJSFS.readSync) != CallbackType) - @compileLog("Expected NodeJSFS.readSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.readSync))); - if (@TypeOf(NodeJSFS.readv) != CallbackType) - @compileLog("Expected NodeJSFS.readv to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.readv))); - if (@TypeOf(NodeJSFS.readvSync) != CallbackType) - @compileLog("Expected NodeJSFS.readvSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.readvSync))); - if (@TypeOf(NodeJSFS.realpath) != CallbackType) - @compileLog("Expected NodeJSFS.realpath to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.realpath))); - if (@TypeOf(NodeJSFS.realpathSync) != CallbackType) - @compileLog("Expected NodeJSFS.realpathSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.realpathSync))); - if (@TypeOf(NodeJSFS.rename) != CallbackType) - @compileLog("Expected NodeJSFS.rename to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.rename))); - if (@TypeOf(NodeJSFS.renameSync) != CallbackType) - @compileLog("Expected NodeJSFS.renameSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.renameSync))); - if (@TypeOf(NodeJSFS.rm) != CallbackType) - @compileLog("Expected NodeJSFS.rm to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.rm))); - if (@TypeOf(NodeJSFS.rmdir) != CallbackType) - @compileLog("Expected NodeJSFS.rmdir to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.rmdir))); - if (@TypeOf(NodeJSFS.rmdirSync) != CallbackType) - @compileLog("Expected NodeJSFS.rmdirSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.rmdirSync))); - if (@TypeOf(NodeJSFS.rmSync) != CallbackType) - @compileLog("Expected NodeJSFS.rmSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.rmSync))); - if (@TypeOf(NodeJSFS.stat) != CallbackType) - @compileLog("Expected NodeJSFS.stat to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.stat))); - if (@TypeOf(NodeJSFS.getStats) != GetterType) - @compileLog("Expected NodeJSFS.getStats to be a getter"); - - if (@TypeOf(NodeJSFS.statSync) != CallbackType) - @compileLog("Expected NodeJSFS.statSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.statSync))); - if (@TypeOf(NodeJSFS.symlink) != CallbackType) - @compileLog("Expected NodeJSFS.symlink to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.symlink))); - if (@TypeOf(NodeJSFS.symlinkSync) != CallbackType) - @compileLog("Expected NodeJSFS.symlinkSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.symlinkSync))); - if (@TypeOf(NodeJSFS.truncate) != CallbackType) - @compileLog("Expected NodeJSFS.truncate to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.truncate))); - if (@TypeOf(NodeJSFS.truncateSync) != CallbackType) - @compileLog("Expected NodeJSFS.truncateSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.truncateSync))); - if (@TypeOf(NodeJSFS.unlink) != CallbackType) - @compileLog("Expected NodeJSFS.unlink to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.unlink))); - if (@TypeOf(NodeJSFS.unlinkSync) != CallbackType) - @compileLog("Expected NodeJSFS.unlinkSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.unlinkSync))); - if (@TypeOf(NodeJSFS.utimes) != CallbackType) - @compileLog("Expected NodeJSFS.utimes to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.utimes))); - if (@TypeOf(NodeJSFS.utimesSync) != CallbackType) - @compileLog("Expected NodeJSFS.utimesSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.utimesSync))); - if (@TypeOf(NodeJSFS.write) != CallbackType) - @compileLog("Expected NodeJSFS.write to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.write))); - if (@TypeOf(NodeJSFS.writeFile) != CallbackType) - @compileLog("Expected NodeJSFS.writeFile to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.writeFile))); - if (@TypeOf(NodeJSFS.writeFileSync) != CallbackType) - @compileLog("Expected NodeJSFS.writeFileSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.writeFileSync))); - if (@TypeOf(NodeJSFS.writeSync) != CallbackType) - @compileLog("Expected NodeJSFS.writeSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.writeSync))); - if (@TypeOf(NodeJSFS.writev) != CallbackType) - @compileLog("Expected NodeJSFS.writev to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.writev))); - if (@TypeOf(NodeJSFS.writevSync) != CallbackType) - @compileLog("Expected NodeJSFS.writevSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.writevSync))); + + if (@TypeOf(NodeJSFS.constructor) != (fn(*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*NodeJSFS)) { + @compileLog("NodeJSFS.constructor is not a constructor"); + } + + if (@TypeOf(NodeJSFS.access) != CallbackType) + @compileLog( + "Expected NodeJSFS.access to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.access)) + ); + if (@TypeOf(NodeJSFS.accessSync) != CallbackType) + @compileLog( + "Expected NodeJSFS.accessSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.accessSync)) + ); + if (@TypeOf(NodeJSFS.appendFile) != CallbackType) + @compileLog( + "Expected NodeJSFS.appendFile to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.appendFile)) + ); + if (@TypeOf(NodeJSFS.appendFileSync) != CallbackType) + @compileLog( + "Expected NodeJSFS.appendFileSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.appendFileSync)) + ); + if (@TypeOf(NodeJSFS.chmod) != CallbackType) + @compileLog( + "Expected NodeJSFS.chmod to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.chmod)) + ); + if (@TypeOf(NodeJSFS.chmodSync) != CallbackType) + @compileLog( + "Expected NodeJSFS.chmodSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.chmodSync)) + ); + if (@TypeOf(NodeJSFS.chown) != CallbackType) + @compileLog( + "Expected NodeJSFS.chown to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.chown)) + ); + if (@TypeOf(NodeJSFS.chownSync) != CallbackType) + @compileLog( + "Expected NodeJSFS.chownSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.chownSync)) + ); + if (@TypeOf(NodeJSFS.close) != CallbackType) + @compileLog( + "Expected NodeJSFS.close to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.close)) + ); + if (@TypeOf(NodeJSFS.closeSync) != CallbackType) + @compileLog( + "Expected NodeJSFS.closeSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.closeSync)) + ); + if (@TypeOf(NodeJSFS.copyFile) != CallbackType) + @compileLog( + "Expected NodeJSFS.copyFile to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.copyFile)) + ); + if (@TypeOf(NodeJSFS.copyFileSync) != CallbackType) + @compileLog( + "Expected NodeJSFS.copyFileSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.copyFileSync)) + ); + if (@TypeOf(NodeJSFS.getDirent) != GetterType) + @compileLog( + "Expected NodeJSFS.getDirent to be a getter" + ); + + if (@TypeOf(NodeJSFS.exists) != CallbackType) + @compileLog( + "Expected NodeJSFS.exists to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.exists)) + ); + if (@TypeOf(NodeJSFS.existsSync) != CallbackType) + @compileLog( + "Expected NodeJSFS.existsSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.existsSync)) + ); + if (@TypeOf(NodeJSFS.fchmod) != CallbackType) + @compileLog( + "Expected NodeJSFS.fchmod to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.fchmod)) + ); + if (@TypeOf(NodeJSFS.fchmodSync) != CallbackType) + @compileLog( + "Expected NodeJSFS.fchmodSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.fchmodSync)) + ); + if (@TypeOf(NodeJSFS.fchown) != CallbackType) + @compileLog( + "Expected NodeJSFS.fchown to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.fchown)) + ); + if (@TypeOf(NodeJSFS.fchownSync) != CallbackType) + @compileLog( + "Expected NodeJSFS.fchownSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.fchownSync)) + ); + if (@TypeOf(NodeJSFS.fdatasync) != CallbackType) + @compileLog( + "Expected NodeJSFS.fdatasync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.fdatasync)) + ); + if (@TypeOf(NodeJSFS.fdatasyncSync) != CallbackType) + @compileLog( + "Expected NodeJSFS.fdatasyncSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.fdatasyncSync)) + ); + if (@TypeOf(NodeJSFS.fstat) != CallbackType) + @compileLog( + "Expected NodeJSFS.fstat to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.fstat)) + ); + if (@TypeOf(NodeJSFS.fstatSync) != CallbackType) + @compileLog( + "Expected NodeJSFS.fstatSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.fstatSync)) + ); + if (@TypeOf(NodeJSFS.fsync) != CallbackType) + @compileLog( + "Expected NodeJSFS.fsync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.fsync)) + ); + if (@TypeOf(NodeJSFS.fsyncSync) != CallbackType) + @compileLog( + "Expected NodeJSFS.fsyncSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.fsyncSync)) + ); + if (@TypeOf(NodeJSFS.ftruncate) != CallbackType) + @compileLog( + "Expected NodeJSFS.ftruncate to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.ftruncate)) + ); + if (@TypeOf(NodeJSFS.ftruncateSync) != CallbackType) + @compileLog( + "Expected NodeJSFS.ftruncateSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.ftruncateSync)) + ); + if (@TypeOf(NodeJSFS.futimes) != CallbackType) + @compileLog( + "Expected NodeJSFS.futimes to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.futimes)) + ); + if (@TypeOf(NodeJSFS.futimesSync) != CallbackType) + @compileLog( + "Expected NodeJSFS.futimesSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.futimesSync)) + ); + if (@TypeOf(NodeJSFS.lchmod) != CallbackType) + @compileLog( + "Expected NodeJSFS.lchmod to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.lchmod)) + ); + if (@TypeOf(NodeJSFS.lchmodSync) != CallbackType) + @compileLog( + "Expected NodeJSFS.lchmodSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.lchmodSync)) + ); + if (@TypeOf(NodeJSFS.lchown) != CallbackType) + @compileLog( + "Expected NodeJSFS.lchown to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.lchown)) + ); + if (@TypeOf(NodeJSFS.lchownSync) != CallbackType) + @compileLog( + "Expected NodeJSFS.lchownSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.lchownSync)) + ); + if (@TypeOf(NodeJSFS.link) != CallbackType) + @compileLog( + "Expected NodeJSFS.link to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.link)) + ); + if (@TypeOf(NodeJSFS.linkSync) != CallbackType) + @compileLog( + "Expected NodeJSFS.linkSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.linkSync)) + ); + if (@TypeOf(NodeJSFS.lstat) != CallbackType) + @compileLog( + "Expected NodeJSFS.lstat to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.lstat)) + ); + if (@TypeOf(NodeJSFS.lstatSync) != CallbackType) + @compileLog( + "Expected NodeJSFS.lstatSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.lstatSync)) + ); + if (@TypeOf(NodeJSFS.lutimes) != CallbackType) + @compileLog( + "Expected NodeJSFS.lutimes to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.lutimes)) + ); + if (@TypeOf(NodeJSFS.lutimesSync) != CallbackType) + @compileLog( + "Expected NodeJSFS.lutimesSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.lutimesSync)) + ); + if (@TypeOf(NodeJSFS.mkdir) != CallbackType) + @compileLog( + "Expected NodeJSFS.mkdir to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.mkdir)) + ); + if (@TypeOf(NodeJSFS.mkdirSync) != CallbackType) + @compileLog( + "Expected NodeJSFS.mkdirSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.mkdirSync)) + ); + if (@TypeOf(NodeJSFS.mkdtemp) != CallbackType) + @compileLog( + "Expected NodeJSFS.mkdtemp to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.mkdtemp)) + ); + if (@TypeOf(NodeJSFS.mkdtempSync) != CallbackType) + @compileLog( + "Expected NodeJSFS.mkdtempSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.mkdtempSync)) + ); + if (@TypeOf(NodeJSFS.open) != CallbackType) + @compileLog( + "Expected NodeJSFS.open to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.open)) + ); + if (@TypeOf(NodeJSFS.opendir) != CallbackType) + @compileLog( + "Expected NodeJSFS.opendir to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.opendir)) + ); + if (@TypeOf(NodeJSFS.opendirSync) != CallbackType) + @compileLog( + "Expected NodeJSFS.opendirSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.opendirSync)) + ); + if (@TypeOf(NodeJSFS.openSync) != CallbackType) + @compileLog( + "Expected NodeJSFS.openSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.openSync)) + ); + if (@TypeOf(NodeJSFS.read) != CallbackType) + @compileLog( + "Expected NodeJSFS.read to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.read)) + ); + if (@TypeOf(NodeJSFS.readdir) != CallbackType) + @compileLog( + "Expected NodeJSFS.readdir to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.readdir)) + ); + if (@TypeOf(NodeJSFS.readdirSync) != CallbackType) + @compileLog( + "Expected NodeJSFS.readdirSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.readdirSync)) + ); + if (@TypeOf(NodeJSFS.readFile) != CallbackType) + @compileLog( + "Expected NodeJSFS.readFile to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.readFile)) + ); + if (@TypeOf(NodeJSFS.readFileSync) != CallbackType) + @compileLog( + "Expected NodeJSFS.readFileSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.readFileSync)) + ); + if (@TypeOf(NodeJSFS.readlink) != CallbackType) + @compileLog( + "Expected NodeJSFS.readlink to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.readlink)) + ); + if (@TypeOf(NodeJSFS.readlinkSync) != CallbackType) + @compileLog( + "Expected NodeJSFS.readlinkSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.readlinkSync)) + ); + if (@TypeOf(NodeJSFS.readSync) != CallbackType) + @compileLog( + "Expected NodeJSFS.readSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.readSync)) + ); + if (@TypeOf(NodeJSFS.readv) != CallbackType) + @compileLog( + "Expected NodeJSFS.readv to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.readv)) + ); + if (@TypeOf(NodeJSFS.readvSync) != CallbackType) + @compileLog( + "Expected NodeJSFS.readvSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.readvSync)) + ); + if (@TypeOf(NodeJSFS.realpath) != CallbackType) + @compileLog( + "Expected NodeJSFS.realpath to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.realpath)) + ); + if (@TypeOf(NodeJSFS.realpathSync) != CallbackType) + @compileLog( + "Expected NodeJSFS.realpathSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.realpathSync)) + ); + if (@TypeOf(NodeJSFS.rename) != CallbackType) + @compileLog( + "Expected NodeJSFS.rename to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.rename)) + ); + if (@TypeOf(NodeJSFS.renameSync) != CallbackType) + @compileLog( + "Expected NodeJSFS.renameSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.renameSync)) + ); + if (@TypeOf(NodeJSFS.rm) != CallbackType) + @compileLog( + "Expected NodeJSFS.rm to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.rm)) + ); + if (@TypeOf(NodeJSFS.rmdir) != CallbackType) + @compileLog( + "Expected NodeJSFS.rmdir to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.rmdir)) + ); + if (@TypeOf(NodeJSFS.rmdirSync) != CallbackType) + @compileLog( + "Expected NodeJSFS.rmdirSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.rmdirSync)) + ); + if (@TypeOf(NodeJSFS.rmSync) != CallbackType) + @compileLog( + "Expected NodeJSFS.rmSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.rmSync)) + ); + if (@TypeOf(NodeJSFS.stat) != CallbackType) + @compileLog( + "Expected NodeJSFS.stat to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.stat)) + ); + if (@TypeOf(NodeJSFS.getStats) != GetterType) + @compileLog( + "Expected NodeJSFS.getStats to be a getter" + ); + + if (@TypeOf(NodeJSFS.statSync) != CallbackType) + @compileLog( + "Expected NodeJSFS.statSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.statSync)) + ); + if (@TypeOf(NodeJSFS.symlink) != CallbackType) + @compileLog( + "Expected NodeJSFS.symlink to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.symlink)) + ); + if (@TypeOf(NodeJSFS.symlinkSync) != CallbackType) + @compileLog( + "Expected NodeJSFS.symlinkSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.symlinkSync)) + ); + if (@TypeOf(NodeJSFS.truncate) != CallbackType) + @compileLog( + "Expected NodeJSFS.truncate to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.truncate)) + ); + if (@TypeOf(NodeJSFS.truncateSync) != CallbackType) + @compileLog( + "Expected NodeJSFS.truncateSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.truncateSync)) + ); + if (@TypeOf(NodeJSFS.unlink) != CallbackType) + @compileLog( + "Expected NodeJSFS.unlink to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.unlink)) + ); + if (@TypeOf(NodeJSFS.unlinkSync) != CallbackType) + @compileLog( + "Expected NodeJSFS.unlinkSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.unlinkSync)) + ); + if (@TypeOf(NodeJSFS.utimes) != CallbackType) + @compileLog( + "Expected NodeJSFS.utimes to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.utimes)) + ); + if (@TypeOf(NodeJSFS.utimesSync) != CallbackType) + @compileLog( + "Expected NodeJSFS.utimesSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.utimesSync)) + ); + if (@TypeOf(NodeJSFS.write) != CallbackType) + @compileLog( + "Expected NodeJSFS.write to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.write)) + ); + if (@TypeOf(NodeJSFS.writeFile) != CallbackType) + @compileLog( + "Expected NodeJSFS.writeFile to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.writeFile)) + ); + if (@TypeOf(NodeJSFS.writeFileSync) != CallbackType) + @compileLog( + "Expected NodeJSFS.writeFileSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.writeFileSync)) + ); + if (@TypeOf(NodeJSFS.writeSync) != CallbackType) + @compileLog( + "Expected NodeJSFS.writeSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.writeSync)) + ); + if (@TypeOf(NodeJSFS.writev) != CallbackType) + @compileLog( + "Expected NodeJSFS.writev to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.writev)) + ); + if (@TypeOf(NodeJSFS.writevSync) != CallbackType) + @compileLog( + "Expected NodeJSFS.writevSync to be a callback but received " ++ @typeName(@TypeOf(NodeJSFS.writevSync)) + ); if (!JSC.is_bindgen) { - @export(NodeJSFS.access, .{ .name = "NodeJSFSPrototype__access" }); - @export(NodeJSFS.accessSync, .{ .name = "NodeJSFSPrototype__accessSync" }); - @export(NodeJSFS.appendFile, .{ .name = "NodeJSFSPrototype__appendFile" }); - @export(NodeJSFS.appendFileSync, .{ .name = "NodeJSFSPrototype__appendFileSync" }); - @export(NodeJSFS.chmod, .{ .name = "NodeJSFSPrototype__chmod" }); - @export(NodeJSFS.chmodSync, .{ .name = "NodeJSFSPrototype__chmodSync" }); - @export(NodeJSFS.chown, .{ .name = "NodeJSFSPrototype__chown" }); - @export(NodeJSFS.chownSync, .{ .name = "NodeJSFSPrototype__chownSync" }); - @export(NodeJSFS.close, .{ .name = "NodeJSFSPrototype__close" }); - @export(NodeJSFS.closeSync, .{ .name = "NodeJSFSPrototype__closeSync" }); - @export(NodeJSFS.constructor, .{ .name = "NodeJSFSClass__construct" }); - @export(NodeJSFS.copyFile, .{ .name = "NodeJSFSPrototype__copyFile" }); - @export(NodeJSFS.copyFileSync, .{ .name = "NodeJSFSPrototype__copyFileSync" }); - @export(NodeJSFS.exists, .{ .name = "NodeJSFSPrototype__exists" }); - @export(NodeJSFS.existsSync, .{ .name = "NodeJSFSPrototype__existsSync" }); - @export(NodeJSFS.fchmod, .{ .name = "NodeJSFSPrototype__fchmod" }); - @export(NodeJSFS.fchmodSync, .{ .name = "NodeJSFSPrototype__fchmodSync" }); - @export(NodeJSFS.fchown, .{ .name = "NodeJSFSPrototype__fchown" }); - @export(NodeJSFS.fchownSync, .{ .name = "NodeJSFSPrototype__fchownSync" }); - @export(NodeJSFS.fdatasync, .{ .name = "NodeJSFSPrototype__fdatasync" }); - @export(NodeJSFS.fdatasyncSync, .{ .name = "NodeJSFSPrototype__fdatasyncSync" }); - @export(NodeJSFS.fstat, .{ .name = "NodeJSFSPrototype__fstat" }); - @export(NodeJSFS.fstatSync, .{ .name = "NodeJSFSPrototype__fstatSync" }); - @export(NodeJSFS.fsync, .{ .name = "NodeJSFSPrototype__fsync" }); - @export(NodeJSFS.fsyncSync, .{ .name = "NodeJSFSPrototype__fsyncSync" }); - @export(NodeJSFS.ftruncate, .{ .name = "NodeJSFSPrototype__ftruncate" }); - @export(NodeJSFS.ftruncateSync, .{ .name = "NodeJSFSPrototype__ftruncateSync" }); - @export(NodeJSFS.futimes, .{ .name = "NodeJSFSPrototype__futimes" }); - @export(NodeJSFS.futimesSync, .{ .name = "NodeJSFSPrototype__futimesSync" }); - @export(NodeJSFS.getDirent, .{ .name = "NodeJSFSPrototype__getDirent" }); - @export(NodeJSFS.getStats, .{ .name = "NodeJSFSPrototype__getStats" }); - @export(NodeJSFS.lchmod, .{ .name = "NodeJSFSPrototype__lchmod" }); - @export(NodeJSFS.lchmodSync, .{ .name = "NodeJSFSPrototype__lchmodSync" }); - @export(NodeJSFS.lchown, .{ .name = "NodeJSFSPrototype__lchown" }); - @export(NodeJSFS.lchownSync, .{ .name = "NodeJSFSPrototype__lchownSync" }); - @export(NodeJSFS.link, .{ .name = "NodeJSFSPrototype__link" }); - @export(NodeJSFS.linkSync, .{ .name = "NodeJSFSPrototype__linkSync" }); - @export(NodeJSFS.lstat, .{ .name = "NodeJSFSPrototype__lstat" }); - @export(NodeJSFS.lstatSync, .{ .name = "NodeJSFSPrototype__lstatSync" }); - @export(NodeJSFS.lutimes, .{ .name = "NodeJSFSPrototype__lutimes" }); - @export(NodeJSFS.lutimesSync, .{ .name = "NodeJSFSPrototype__lutimesSync" }); - @export(NodeJSFS.mkdir, .{ .name = "NodeJSFSPrototype__mkdir" }); - @export(NodeJSFS.mkdirSync, .{ .name = "NodeJSFSPrototype__mkdirSync" }); - @export(NodeJSFS.mkdtemp, .{ .name = "NodeJSFSPrototype__mkdtemp" }); - @export(NodeJSFS.mkdtempSync, .{ .name = "NodeJSFSPrototype__mkdtempSync" }); - @export(NodeJSFS.open, .{ .name = "NodeJSFSPrototype__open" }); - @export(NodeJSFS.opendir, .{ .name = "NodeJSFSPrototype__opendir" }); - @export(NodeJSFS.opendirSync, .{ .name = "NodeJSFSPrototype__opendirSync" }); - @export(NodeJSFS.openSync, .{ .name = "NodeJSFSPrototype__openSync" }); - @export(NodeJSFS.read, .{ .name = "NodeJSFSPrototype__read" }); - @export(NodeJSFS.readdir, .{ .name = "NodeJSFSPrototype__readdir" }); - @export(NodeJSFS.readdirSync, .{ .name = "NodeJSFSPrototype__readdirSync" }); - @export(NodeJSFS.readFile, .{ .name = "NodeJSFSPrototype__readFile" }); - @export(NodeJSFS.readFileSync, .{ .name = "NodeJSFSPrototype__readFileSync" }); - @export(NodeJSFS.readlink, .{ .name = "NodeJSFSPrototype__readlink" }); - @export(NodeJSFS.readlinkSync, .{ .name = "NodeJSFSPrototype__readlinkSync" }); - @export(NodeJSFS.readSync, .{ .name = "NodeJSFSPrototype__readSync" }); - @export(NodeJSFS.readv, .{ .name = "NodeJSFSPrototype__readv" }); - @export(NodeJSFS.readvSync, .{ .name = "NodeJSFSPrototype__readvSync" }); - @export(NodeJSFS.realpath, .{ .name = "NodeJSFSPrototype__realpath" }); - @export(NodeJSFS.realpathSync, .{ .name = "NodeJSFSPrototype__realpathSync" }); - @export(NodeJSFS.rename, .{ .name = "NodeJSFSPrototype__rename" }); - @export(NodeJSFS.renameSync, .{ .name = "NodeJSFSPrototype__renameSync" }); - @export(NodeJSFS.rm, .{ .name = "NodeJSFSPrototype__rm" }); - @export(NodeJSFS.rmdir, .{ .name = "NodeJSFSPrototype__rmdir" }); - @export(NodeJSFS.rmdirSync, .{ .name = "NodeJSFSPrototype__rmdirSync" }); - @export(NodeJSFS.rmSync, .{ .name = "NodeJSFSPrototype__rmSync" }); - @export(NodeJSFS.stat, .{ .name = "NodeJSFSPrototype__stat" }); - @export(NodeJSFS.statSync, .{ .name = "NodeJSFSPrototype__statSync" }); - @export(NodeJSFS.symlink, .{ .name = "NodeJSFSPrototype__symlink" }); - @export(NodeJSFS.symlinkSync, .{ .name = "NodeJSFSPrototype__symlinkSync" }); - @export(NodeJSFS.truncate, .{ .name = "NodeJSFSPrototype__truncate" }); - @export(NodeJSFS.truncateSync, .{ .name = "NodeJSFSPrototype__truncateSync" }); - @export(NodeJSFS.unlink, .{ .name = "NodeJSFSPrototype__unlink" }); - @export(NodeJSFS.unlinkSync, .{ .name = "NodeJSFSPrototype__unlinkSync" }); - @export(NodeJSFS.utimes, .{ .name = "NodeJSFSPrototype__utimes" }); - @export(NodeJSFS.utimesSync, .{ .name = "NodeJSFSPrototype__utimesSync" }); - @export(NodeJSFS.write, .{ .name = "NodeJSFSPrototype__write" }); - @export(NodeJSFS.writeFile, .{ .name = "NodeJSFSPrototype__writeFile" }); - @export(NodeJSFS.writeFileSync, .{ .name = "NodeJSFSPrototype__writeFileSync" }); - @export(NodeJSFS.writeSync, .{ .name = "NodeJSFSPrototype__writeSync" }); - @export(NodeJSFS.writev, .{ .name = "NodeJSFSPrototype__writev" }); - @export(NodeJSFS.writevSync, .{ .name = "NodeJSFSPrototype__writevSync" }); +@export(NodeJSFS.access, .{.name = "NodeJSFSPrototype__access"}); + @export(NodeJSFS.accessSync, .{.name = "NodeJSFSPrototype__accessSync"}); + @export(NodeJSFS.appendFile, .{.name = "NodeJSFSPrototype__appendFile"}); + @export(NodeJSFS.appendFileSync, .{.name = "NodeJSFSPrototype__appendFileSync"}); + @export(NodeJSFS.chmod, .{.name = "NodeJSFSPrototype__chmod"}); + @export(NodeJSFS.chmodSync, .{.name = "NodeJSFSPrototype__chmodSync"}); + @export(NodeJSFS.chown, .{.name = "NodeJSFSPrototype__chown"}); + @export(NodeJSFS.chownSync, .{.name = "NodeJSFSPrototype__chownSync"}); + @export(NodeJSFS.close, .{.name = "NodeJSFSPrototype__close"}); + @export(NodeJSFS.closeSync, .{.name = "NodeJSFSPrototype__closeSync"}); + @export(NodeJSFS.constructor, .{.name = "NodeJSFSClass__construct"}); + @export(NodeJSFS.copyFile, .{.name = "NodeJSFSPrototype__copyFile"}); + @export(NodeJSFS.copyFileSync, .{.name = "NodeJSFSPrototype__copyFileSync"}); + @export(NodeJSFS.exists, .{.name = "NodeJSFSPrototype__exists"}); + @export(NodeJSFS.existsSync, .{.name = "NodeJSFSPrototype__existsSync"}); + @export(NodeJSFS.fchmod, .{.name = "NodeJSFSPrototype__fchmod"}); + @export(NodeJSFS.fchmodSync, .{.name = "NodeJSFSPrototype__fchmodSync"}); + @export(NodeJSFS.fchown, .{.name = "NodeJSFSPrototype__fchown"}); + @export(NodeJSFS.fchownSync, .{.name = "NodeJSFSPrototype__fchownSync"}); + @export(NodeJSFS.fdatasync, .{.name = "NodeJSFSPrototype__fdatasync"}); + @export(NodeJSFS.fdatasyncSync, .{.name = "NodeJSFSPrototype__fdatasyncSync"}); + @export(NodeJSFS.fstat, .{.name = "NodeJSFSPrototype__fstat"}); + @export(NodeJSFS.fstatSync, .{.name = "NodeJSFSPrototype__fstatSync"}); + @export(NodeJSFS.fsync, .{.name = "NodeJSFSPrototype__fsync"}); + @export(NodeJSFS.fsyncSync, .{.name = "NodeJSFSPrototype__fsyncSync"}); + @export(NodeJSFS.ftruncate, .{.name = "NodeJSFSPrototype__ftruncate"}); + @export(NodeJSFS.ftruncateSync, .{.name = "NodeJSFSPrototype__ftruncateSync"}); + @export(NodeJSFS.futimes, .{.name = "NodeJSFSPrototype__futimes"}); + @export(NodeJSFS.futimesSync, .{.name = "NodeJSFSPrototype__futimesSync"}); + @export(NodeJSFS.getDirent, .{.name = "NodeJSFSPrototype__getDirent"}); + @export(NodeJSFS.getStats, .{.name = "NodeJSFSPrototype__getStats"}); + @export(NodeJSFS.lchmod, .{.name = "NodeJSFSPrototype__lchmod"}); + @export(NodeJSFS.lchmodSync, .{.name = "NodeJSFSPrototype__lchmodSync"}); + @export(NodeJSFS.lchown, .{.name = "NodeJSFSPrototype__lchown"}); + @export(NodeJSFS.lchownSync, .{.name = "NodeJSFSPrototype__lchownSync"}); + @export(NodeJSFS.link, .{.name = "NodeJSFSPrototype__link"}); + @export(NodeJSFS.linkSync, .{.name = "NodeJSFSPrototype__linkSync"}); + @export(NodeJSFS.lstat, .{.name = "NodeJSFSPrototype__lstat"}); + @export(NodeJSFS.lstatSync, .{.name = "NodeJSFSPrototype__lstatSync"}); + @export(NodeJSFS.lutimes, .{.name = "NodeJSFSPrototype__lutimes"}); + @export(NodeJSFS.lutimesSync, .{.name = "NodeJSFSPrototype__lutimesSync"}); + @export(NodeJSFS.mkdir, .{.name = "NodeJSFSPrototype__mkdir"}); + @export(NodeJSFS.mkdirSync, .{.name = "NodeJSFSPrototype__mkdirSync"}); + @export(NodeJSFS.mkdtemp, .{.name = "NodeJSFSPrototype__mkdtemp"}); + @export(NodeJSFS.mkdtempSync, .{.name = "NodeJSFSPrototype__mkdtempSync"}); + @export(NodeJSFS.open, .{.name = "NodeJSFSPrototype__open"}); + @export(NodeJSFS.opendir, .{.name = "NodeJSFSPrototype__opendir"}); + @export(NodeJSFS.opendirSync, .{.name = "NodeJSFSPrototype__opendirSync"}); + @export(NodeJSFS.openSync, .{.name = "NodeJSFSPrototype__openSync"}); + @export(NodeJSFS.read, .{.name = "NodeJSFSPrototype__read"}); + @export(NodeJSFS.readdir, .{.name = "NodeJSFSPrototype__readdir"}); + @export(NodeJSFS.readdirSync, .{.name = "NodeJSFSPrototype__readdirSync"}); + @export(NodeJSFS.readFile, .{.name = "NodeJSFSPrototype__readFile"}); + @export(NodeJSFS.readFileSync, .{.name = "NodeJSFSPrototype__readFileSync"}); + @export(NodeJSFS.readlink, .{.name = "NodeJSFSPrototype__readlink"}); + @export(NodeJSFS.readlinkSync, .{.name = "NodeJSFSPrototype__readlinkSync"}); + @export(NodeJSFS.readSync, .{.name = "NodeJSFSPrototype__readSync"}); + @export(NodeJSFS.readv, .{.name = "NodeJSFSPrototype__readv"}); + @export(NodeJSFS.readvSync, .{.name = "NodeJSFSPrototype__readvSync"}); + @export(NodeJSFS.realpath, .{.name = "NodeJSFSPrototype__realpath"}); + @export(NodeJSFS.realpathSync, .{.name = "NodeJSFSPrototype__realpathSync"}); + @export(NodeJSFS.rename, .{.name = "NodeJSFSPrototype__rename"}); + @export(NodeJSFS.renameSync, .{.name = "NodeJSFSPrototype__renameSync"}); + @export(NodeJSFS.rm, .{.name = "NodeJSFSPrototype__rm"}); + @export(NodeJSFS.rmdir, .{.name = "NodeJSFSPrototype__rmdir"}); + @export(NodeJSFS.rmdirSync, .{.name = "NodeJSFSPrototype__rmdirSync"}); + @export(NodeJSFS.rmSync, .{.name = "NodeJSFSPrototype__rmSync"}); + @export(NodeJSFS.stat, .{.name = "NodeJSFSPrototype__stat"}); + @export(NodeJSFS.statSync, .{.name = "NodeJSFSPrototype__statSync"}); + @export(NodeJSFS.symlink, .{.name = "NodeJSFSPrototype__symlink"}); + @export(NodeJSFS.symlinkSync, .{.name = "NodeJSFSPrototype__symlinkSync"}); + @export(NodeJSFS.truncate, .{.name = "NodeJSFSPrototype__truncate"}); + @export(NodeJSFS.truncateSync, .{.name = "NodeJSFSPrototype__truncateSync"}); + @export(NodeJSFS.unlink, .{.name = "NodeJSFSPrototype__unlink"}); + @export(NodeJSFS.unlinkSync, .{.name = "NodeJSFSPrototype__unlinkSync"}); + @export(NodeJSFS.utimes, .{.name = "NodeJSFSPrototype__utimes"}); + @export(NodeJSFS.utimesSync, .{.name = "NodeJSFSPrototype__utimesSync"}); + @export(NodeJSFS.write, .{.name = "NodeJSFSPrototype__write"}); + @export(NodeJSFS.writeFile, .{.name = "NodeJSFSPrototype__writeFile"}); + @export(NodeJSFS.writeFileSync, .{.name = "NodeJSFSPrototype__writeFileSync"}); + @export(NodeJSFS.writeSync, .{.name = "NodeJSFSPrototype__writeSync"}); + @export(NodeJSFS.writev, .{.name = "NodeJSFSPrototype__writev"}); + @export(NodeJSFS.writevSync, .{.name = "NodeJSFSPrototype__writevSync"}); } } }; pub const JSRequest = struct { const Request = Classes.Request; - const GetterType = fn (*Request, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*Request, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*Request, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*Request, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*Request, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; + const GetterType = fn(*Request, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const GetterTypeWithThisValue = fn(*Request, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const SetterType = fn(*Request, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const SetterTypeWithThisValue = fn(*Request, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const CallbackType = fn(*Request, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; /// Return the pointer to the wrapped object. /// If the object does not match the type, return null. @@ -1720,99 +2134,101 @@ pub const JSRequest = struct { extern fn RequestPrototype__bodySetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - extern fn RequestPrototype__bodyGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `Request.body` setter - /// This value will be visited by the garbage collector. - pub fn bodySetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - RequestPrototype__bodySetCachedValue(thisValue, globalObject, value); - } + extern fn RequestPrototype__bodyGetCachedValue(JSC.JSValue) JSC.JSValue; + + /// `Request.body` setter + /// This value will be visited by the garbage collector. + pub fn bodySetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { + JSC.markBinding(@src()); + RequestPrototype__bodySetCachedValue(thisValue, globalObject, value); + } - /// `Request.body` getter - /// This value will be visited by the garbage collector. - pub fn bodyGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = RequestPrototype__bodyGetCachedValue(thisValue); - if (result == .zero) + /// `Request.body` getter + /// This value will be visited by the garbage collector. + pub fn bodyGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { + JSC.markBinding(@src()); + const result = RequestPrototype__bodyGetCachedValue(thisValue); + if (result == .zero) return null; + + return result; + } - return result; - } - - extern fn RequestPrototype__headersSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn RequestPrototype__headersGetCachedValue(JSC.JSValue) JSC.JSValue; +extern fn RequestPrototype__headersSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - /// `Request.headers` setter - /// This value will be visited by the garbage collector. - pub fn headersSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - RequestPrototype__headersSetCachedValue(thisValue, globalObject, value); - } + extern fn RequestPrototype__headersGetCachedValue(JSC.JSValue) JSC.JSValue; + + /// `Request.headers` setter + /// This value will be visited by the garbage collector. + pub fn headersSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { + JSC.markBinding(@src()); + RequestPrototype__headersSetCachedValue(thisValue, globalObject, value); + } - /// `Request.headers` getter - /// This value will be visited by the garbage collector. - pub fn headersGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = RequestPrototype__headersGetCachedValue(thisValue); - if (result == .zero) + /// `Request.headers` getter + /// This value will be visited by the garbage collector. + pub fn headersGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { + JSC.markBinding(@src()); + const result = RequestPrototype__headersGetCachedValue(thisValue); + if (result == .zero) return null; + + return result; + } - return result; - } - - extern fn RequestPrototype__signalSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn RequestPrototype__signalGetCachedValue(JSC.JSValue) JSC.JSValue; +extern fn RequestPrototype__signalSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - /// `Request.signal` setter - /// This value will be visited by the garbage collector. - pub fn signalSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - RequestPrototype__signalSetCachedValue(thisValue, globalObject, value); - } + extern fn RequestPrototype__signalGetCachedValue(JSC.JSValue) JSC.JSValue; + + /// `Request.signal` setter + /// This value will be visited by the garbage collector. + pub fn signalSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { + JSC.markBinding(@src()); + RequestPrototype__signalSetCachedValue(thisValue, globalObject, value); + } - /// `Request.signal` getter - /// This value will be visited by the garbage collector. - pub fn signalGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = RequestPrototype__signalGetCachedValue(thisValue); - if (result == .zero) + /// `Request.signal` getter + /// This value will be visited by the garbage collector. + pub fn signalGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { + JSC.markBinding(@src()); + const result = RequestPrototype__signalGetCachedValue(thisValue); + if (result == .zero) return null; + + return result; + } - return result; - } - - extern fn RequestPrototype__urlSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn RequestPrototype__urlGetCachedValue(JSC.JSValue) JSC.JSValue; +extern fn RequestPrototype__urlSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - /// `Request.url` setter - /// This value will be visited by the garbage collector. - pub fn urlSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - RequestPrototype__urlSetCachedValue(thisValue, globalObject, value); - } + extern fn RequestPrototype__urlGetCachedValue(JSC.JSValue) JSC.JSValue; + + /// `Request.url` setter + /// This value will be visited by the garbage collector. + pub fn urlSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { + JSC.markBinding(@src()); + RequestPrototype__urlSetCachedValue(thisValue, globalObject, value); + } - /// `Request.url` getter - /// This value will be visited by the garbage collector. - pub fn urlGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = RequestPrototype__urlGetCachedValue(thisValue); - if (result == .zero) + /// `Request.url` getter + /// This value will be visited by the garbage collector. + pub fn urlGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { + JSC.markBinding(@src()); + const result = RequestPrototype__urlGetCachedValue(thisValue); + if (result == .zero) return null; + + return result; + } - return result; - } + /// Get the Request constructor value. /// This loads lazily from the global object. pub fn getConstructor(globalObject: *JSC.JSGlobalObject) JSC.JSValue { JSC.markBinding(@src()); return Request__getConstructor(globalObject); } - + /// Create a new instance of Request pub fn toJS(this: *Request, globalObject: *JSC.JSGlobalObject) JSC.JSValue { JSC.markBinding(@src()); @@ -1827,14 +2243,14 @@ pub const JSRequest = struct { /// Modify the internal ptr to point to a new instance of Request. pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*Request) bool { - JSC.markBinding(@src()); - return Request__dangerouslySetPtr(value, ptr); + JSC.markBinding(@src()); + return Request__dangerouslySetPtr(value, ptr); } /// Detach the ptr from the thisValue pub fn detachPtr(_: *Request, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(Request__dangerouslySetPtr(value, null)); + JSC.markBinding(@src()); + std.debug.assert(Request__dangerouslySetPtr(value, null)); } extern fn Request__fromJS(JSC.JSValue) ?*Request; @@ -1845,106 +2261,147 @@ pub const JSRequest = struct { extern fn Request__dangerouslySetPtr(JSC.JSValue, ?*Request) bool; comptime { - if (@TypeOf(Request.estimatedSize) != (fn (*Request) callconv(.C) usize)) { - @compileLog("Request.estimatedSize is not a size function"); + + if (@TypeOf(Request.estimatedSize) != (fn(*Request) callconv(.C) usize)) { + @compileLog("Request.estimatedSize is not a size function"); } - - if (@TypeOf(Request.constructor) != (fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*Request)) { - @compileLog("Request.constructor is not a constructor"); + + if (@TypeOf(Request.constructor) != (fn(*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*Request)) { + @compileLog("Request.constructor is not a constructor"); } - - if (@TypeOf(Request.finalize) != (fn (*Request) callconv(.C) void)) { - @compileLog("Request.finalize is not a finalizer"); + + if (@TypeOf(Request.finalize) != (fn(*Request) callconv(.C) void)) { + @compileLog("Request.finalize is not a finalizer"); } - - if (@TypeOf(Request.getArrayBuffer) != CallbackType) - @compileLog("Expected Request.getArrayBuffer to be a callback but received " ++ @typeName(@TypeOf(Request.getArrayBuffer))); - if (@TypeOf(Request.getBlob) != CallbackType) - @compileLog("Expected Request.getBlob to be a callback but received " ++ @typeName(@TypeOf(Request.getBlob))); - if (@TypeOf(Request.getBody) != GetterType) - @compileLog("Expected Request.getBody to be a getter"); - - if (@TypeOf(Request.getBodyUsed) != GetterType) - @compileLog("Expected Request.getBodyUsed to be a getter"); - - if (@TypeOf(Request.getCache) != GetterType) - @compileLog("Expected Request.getCache to be a getter"); - - if (@TypeOf(Request.doClone) != CallbackType) - @compileLog("Expected Request.doClone to be a callback but received " ++ @typeName(@TypeOf(Request.doClone))); - if (@TypeOf(Request.getCredentials) != GetterType) - @compileLog("Expected Request.getCredentials to be a getter"); - - if (@TypeOf(Request.getDestination) != GetterType) - @compileLog("Expected Request.getDestination to be a getter"); - - if (@TypeOf(Request.getFormData) != CallbackType) - @compileLog("Expected Request.getFormData to be a callback but received " ++ @typeName(@TypeOf(Request.getFormData))); - if (@TypeOf(Request.getHeaders) != GetterType) - @compileLog("Expected Request.getHeaders to be a getter"); - - if (@TypeOf(Request.getIntegrity) != GetterType) - @compileLog("Expected Request.getIntegrity to be a getter"); - - if (@TypeOf(Request.getJSON) != CallbackType) - @compileLog("Expected Request.getJSON to be a callback but received " ++ @typeName(@TypeOf(Request.getJSON))); - if (@TypeOf(Request.getMethod) != GetterType) - @compileLog("Expected Request.getMethod to be a getter"); - - if (@TypeOf(Request.getMode) != GetterType) - @compileLog("Expected Request.getMode to be a getter"); - - if (@TypeOf(Request.getRedirect) != GetterType) - @compileLog("Expected Request.getRedirect to be a getter"); - - if (@TypeOf(Request.getReferrer) != GetterType) - @compileLog("Expected Request.getReferrer to be a getter"); - - if (@TypeOf(Request.getReferrerPolicy) != GetterType) - @compileLog("Expected Request.getReferrerPolicy to be a getter"); - - if (@TypeOf(Request.getSignal) != GetterType) - @compileLog("Expected Request.getSignal to be a getter"); - - if (@TypeOf(Request.getText) != CallbackType) - @compileLog("Expected Request.getText to be a callback but received " ++ @typeName(@TypeOf(Request.getText))); - if (@TypeOf(Request.getUrl) != GetterType) - @compileLog("Expected Request.getUrl to be a getter"); + + if (@TypeOf(Request.getArrayBuffer) != CallbackType) + @compileLog( + "Expected Request.getArrayBuffer to be a callback but received " ++ @typeName(@TypeOf(Request.getArrayBuffer)) + ); + if (@TypeOf(Request.getBlob) != CallbackType) + @compileLog( + "Expected Request.getBlob to be a callback but received " ++ @typeName(@TypeOf(Request.getBlob)) + ); + if (@TypeOf(Request.getBody) != GetterType) + @compileLog( + "Expected Request.getBody to be a getter" + ); + + if (@TypeOf(Request.getBodyUsed) != GetterType) + @compileLog( + "Expected Request.getBodyUsed to be a getter" + ); + + if (@TypeOf(Request.getCache) != GetterType) + @compileLog( + "Expected Request.getCache to be a getter" + ); + + if (@TypeOf(Request.doClone) != CallbackType) + @compileLog( + "Expected Request.doClone to be a callback but received " ++ @typeName(@TypeOf(Request.doClone)) + ); + if (@TypeOf(Request.getCredentials) != GetterType) + @compileLog( + "Expected Request.getCredentials to be a getter" + ); + + if (@TypeOf(Request.getDestination) != GetterType) + @compileLog( + "Expected Request.getDestination to be a getter" + ); + + if (@TypeOf(Request.getFormData) != CallbackType) + @compileLog( + "Expected Request.getFormData to be a callback but received " ++ @typeName(@TypeOf(Request.getFormData)) + ); + if (@TypeOf(Request.getHeaders) != GetterType) + @compileLog( + "Expected Request.getHeaders to be a getter" + ); + + if (@TypeOf(Request.getIntegrity) != GetterType) + @compileLog( + "Expected Request.getIntegrity to be a getter" + ); + + if (@TypeOf(Request.getJSON) != CallbackType) + @compileLog( + "Expected Request.getJSON to be a callback but received " ++ @typeName(@TypeOf(Request.getJSON)) + ); + if (@TypeOf(Request.getMethod) != GetterType) + @compileLog( + "Expected Request.getMethod to be a getter" + ); + + if (@TypeOf(Request.getMode) != GetterType) + @compileLog( + "Expected Request.getMode to be a getter" + ); + + if (@TypeOf(Request.getRedirect) != GetterType) + @compileLog( + "Expected Request.getRedirect to be a getter" + ); + + if (@TypeOf(Request.getReferrer) != GetterType) + @compileLog( + "Expected Request.getReferrer to be a getter" + ); + + if (@TypeOf(Request.getReferrerPolicy) != GetterType) + @compileLog( + "Expected Request.getReferrerPolicy to be a getter" + ); + + if (@TypeOf(Request.getSignal) != GetterType) + @compileLog( + "Expected Request.getSignal to be a getter" + ); + + if (@TypeOf(Request.getText) != CallbackType) + @compileLog( + "Expected Request.getText to be a callback but received " ++ @typeName(@TypeOf(Request.getText)) + ); + if (@TypeOf(Request.getUrl) != GetterType) + @compileLog( + "Expected Request.getUrl to be a getter" + ); if (!JSC.is_bindgen) { - @export(Request.constructor, .{ .name = "RequestClass__construct" }); - @export(Request.doClone, .{ .name = "RequestPrototype__doClone" }); - @export(Request.estimatedSize, .{ .name = "Request__estimatedSize" }); - @export(Request.finalize, .{ .name = "RequestClass__finalize" }); - @export(Request.getArrayBuffer, .{ .name = "RequestPrototype__getArrayBuffer" }); - @export(Request.getBlob, .{ .name = "RequestPrototype__getBlob" }); - @export(Request.getBody, .{ .name = "RequestPrototype__getBody" }); - @export(Request.getBodyUsed, .{ .name = "RequestPrototype__getBodyUsed" }); - @export(Request.getCache, .{ .name = "RequestPrototype__getCache" }); - @export(Request.getCredentials, .{ .name = "RequestPrototype__getCredentials" }); - @export(Request.getDestination, .{ .name = "RequestPrototype__getDestination" }); - @export(Request.getFormData, .{ .name = "RequestPrototype__getFormData" }); - @export(Request.getHeaders, .{ .name = "RequestPrototype__getHeaders" }); - @export(Request.getIntegrity, .{ .name = "RequestPrototype__getIntegrity" }); - @export(Request.getJSON, .{ .name = "RequestPrototype__getJSON" }); - @export(Request.getMethod, .{ .name = "RequestPrototype__getMethod" }); - @export(Request.getMode, .{ .name = "RequestPrototype__getMode" }); - @export(Request.getRedirect, .{ .name = "RequestPrototype__getRedirect" }); - @export(Request.getReferrer, .{ .name = "RequestPrototype__getReferrer" }); - @export(Request.getReferrerPolicy, .{ .name = "RequestPrototype__getReferrerPolicy" }); - @export(Request.getSignal, .{ .name = "RequestPrototype__getSignal" }); - @export(Request.getText, .{ .name = "RequestPrototype__getText" }); - @export(Request.getUrl, .{ .name = "RequestPrototype__getUrl" }); +@export(Request.constructor, .{.name = "RequestClass__construct"}); + @export(Request.doClone, .{.name = "RequestPrototype__doClone"}); + @export(Request.estimatedSize, .{.name = "Request__estimatedSize"}); + @export(Request.finalize, .{.name = "RequestClass__finalize"}); + @export(Request.getArrayBuffer, .{.name = "RequestPrototype__getArrayBuffer"}); + @export(Request.getBlob, .{.name = "RequestPrototype__getBlob"}); + @export(Request.getBody, .{.name = "RequestPrototype__getBody"}); + @export(Request.getBodyUsed, .{.name = "RequestPrototype__getBodyUsed"}); + @export(Request.getCache, .{.name = "RequestPrototype__getCache"}); + @export(Request.getCredentials, .{.name = "RequestPrototype__getCredentials"}); + @export(Request.getDestination, .{.name = "RequestPrototype__getDestination"}); + @export(Request.getFormData, .{.name = "RequestPrototype__getFormData"}); + @export(Request.getHeaders, .{.name = "RequestPrototype__getHeaders"}); + @export(Request.getIntegrity, .{.name = "RequestPrototype__getIntegrity"}); + @export(Request.getJSON, .{.name = "RequestPrototype__getJSON"}); + @export(Request.getMethod, .{.name = "RequestPrototype__getMethod"}); + @export(Request.getMode, .{.name = "RequestPrototype__getMode"}); + @export(Request.getRedirect, .{.name = "RequestPrototype__getRedirect"}); + @export(Request.getReferrer, .{.name = "RequestPrototype__getReferrer"}); + @export(Request.getReferrerPolicy, .{.name = "RequestPrototype__getReferrerPolicy"}); + @export(Request.getSignal, .{.name = "RequestPrototype__getSignal"}); + @export(Request.getText, .{.name = "RequestPrototype__getText"}); + @export(Request.getUrl, .{.name = "RequestPrototype__getUrl"}); } } }; pub const JSResponse = struct { const Response = Classes.Response; - const GetterType = fn (*Response, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*Response, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*Response, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*Response, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*Response, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; + const GetterType = fn(*Response, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const GetterTypeWithThisValue = fn(*Response, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const SetterType = fn(*Response, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const SetterTypeWithThisValue = fn(*Response, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const CallbackType = fn(*Response, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; /// Return the pointer to the wrapped object. /// If the object does not match the type, return null. @@ -1955,99 +2412,101 @@ pub const JSResponse = struct { extern fn ResponsePrototype__bodySetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - extern fn ResponsePrototype__bodyGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `Response.body` setter - /// This value will be visited by the garbage collector. - pub fn bodySetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - ResponsePrototype__bodySetCachedValue(thisValue, globalObject, value); - } + extern fn ResponsePrototype__bodyGetCachedValue(JSC.JSValue) JSC.JSValue; + + /// `Response.body` setter + /// This value will be visited by the garbage collector. + pub fn bodySetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { + JSC.markBinding(@src()); + ResponsePrototype__bodySetCachedValue(thisValue, globalObject, value); + } - /// `Response.body` getter - /// This value will be visited by the garbage collector. - pub fn bodyGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = ResponsePrototype__bodyGetCachedValue(thisValue); - if (result == .zero) + /// `Response.body` getter + /// This value will be visited by the garbage collector. + pub fn bodyGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { + JSC.markBinding(@src()); + const result = ResponsePrototype__bodyGetCachedValue(thisValue); + if (result == .zero) return null; + + return result; + } - return result; - } - - extern fn ResponsePrototype__headersSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn ResponsePrototype__headersGetCachedValue(JSC.JSValue) JSC.JSValue; +extern fn ResponsePrototype__headersSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - /// `Response.headers` setter - /// This value will be visited by the garbage collector. - pub fn headersSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - ResponsePrototype__headersSetCachedValue(thisValue, globalObject, value); - } + extern fn ResponsePrototype__headersGetCachedValue(JSC.JSValue) JSC.JSValue; + + /// `Response.headers` setter + /// This value will be visited by the garbage collector. + pub fn headersSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { + JSC.markBinding(@src()); + ResponsePrototype__headersSetCachedValue(thisValue, globalObject, value); + } - /// `Response.headers` getter - /// This value will be visited by the garbage collector. - pub fn headersGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = ResponsePrototype__headersGetCachedValue(thisValue); - if (result == .zero) + /// `Response.headers` getter + /// This value will be visited by the garbage collector. + pub fn headersGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { + JSC.markBinding(@src()); + const result = ResponsePrototype__headersGetCachedValue(thisValue); + if (result == .zero) return null; + + return result; + } - return result; - } - - extern fn ResponsePrototype__statusTextSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn ResponsePrototype__statusTextGetCachedValue(JSC.JSValue) JSC.JSValue; +extern fn ResponsePrototype__statusTextSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - /// `Response.statusText` setter - /// This value will be visited by the garbage collector. - pub fn statusTextSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - ResponsePrototype__statusTextSetCachedValue(thisValue, globalObject, value); - } + extern fn ResponsePrototype__statusTextGetCachedValue(JSC.JSValue) JSC.JSValue; + + /// `Response.statusText` setter + /// This value will be visited by the garbage collector. + pub fn statusTextSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { + JSC.markBinding(@src()); + ResponsePrototype__statusTextSetCachedValue(thisValue, globalObject, value); + } - /// `Response.statusText` getter - /// This value will be visited by the garbage collector. - pub fn statusTextGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = ResponsePrototype__statusTextGetCachedValue(thisValue); - if (result == .zero) + /// `Response.statusText` getter + /// This value will be visited by the garbage collector. + pub fn statusTextGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { + JSC.markBinding(@src()); + const result = ResponsePrototype__statusTextGetCachedValue(thisValue); + if (result == .zero) return null; + + return result; + } - return result; - } - - extern fn ResponsePrototype__urlSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn ResponsePrototype__urlGetCachedValue(JSC.JSValue) JSC.JSValue; +extern fn ResponsePrototype__urlSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - /// `Response.url` setter - /// This value will be visited by the garbage collector. - pub fn urlSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - ResponsePrototype__urlSetCachedValue(thisValue, globalObject, value); - } + extern fn ResponsePrototype__urlGetCachedValue(JSC.JSValue) JSC.JSValue; + + /// `Response.url` setter + /// This value will be visited by the garbage collector. + pub fn urlSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { + JSC.markBinding(@src()); + ResponsePrototype__urlSetCachedValue(thisValue, globalObject, value); + } - /// `Response.url` getter - /// This value will be visited by the garbage collector. - pub fn urlGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = ResponsePrototype__urlGetCachedValue(thisValue); - if (result == .zero) + /// `Response.url` getter + /// This value will be visited by the garbage collector. + pub fn urlGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { + JSC.markBinding(@src()); + const result = ResponsePrototype__urlGetCachedValue(thisValue); + if (result == .zero) return null; + + return result; + } - return result; - } + /// Get the Response constructor value. /// This loads lazily from the global object. pub fn getConstructor(globalObject: *JSC.JSGlobalObject) JSC.JSValue { JSC.markBinding(@src()); return Response__getConstructor(globalObject); } - + /// Create a new instance of Response pub fn toJS(this: *Response, globalObject: *JSC.JSGlobalObject) JSC.JSValue { JSC.markBinding(@src()); @@ -2062,14 +2521,14 @@ pub const JSResponse = struct { /// Modify the internal ptr to point to a new instance of Response. pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*Response) bool { - JSC.markBinding(@src()); - return Response__dangerouslySetPtr(value, ptr); + JSC.markBinding(@src()); + return Response__dangerouslySetPtr(value, ptr); } /// Detach the ptr from the thisValue pub fn detachPtr(_: *Response, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(Response__dangerouslySetPtr(value, null)); + JSC.markBinding(@src()); + std.debug.assert(Response__dangerouslySetPtr(value, null)); } extern fn Response__fromJS(JSC.JSValue) ?*Response; @@ -2080,95 +2539,132 @@ pub const JSResponse = struct { extern fn Response__dangerouslySetPtr(JSC.JSValue, ?*Response) bool; comptime { - if (@TypeOf(Response.estimatedSize) != (fn (*Response) callconv(.C) usize)) { - @compileLog("Response.estimatedSize is not a size function"); + + if (@TypeOf(Response.estimatedSize) != (fn(*Response) callconv(.C) usize)) { + @compileLog("Response.estimatedSize is not a size function"); } - - if (@TypeOf(Response.constructor) != (fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*Response)) { - @compileLog("Response.constructor is not a constructor"); + + if (@TypeOf(Response.constructor) != (fn(*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*Response)) { + @compileLog("Response.constructor is not a constructor"); } - - if (@TypeOf(Response.finalize) != (fn (*Response) callconv(.C) void)) { - @compileLog("Response.finalize is not a finalizer"); + + if (@TypeOf(Response.finalize) != (fn(*Response) callconv(.C) void)) { + @compileLog("Response.finalize is not a finalizer"); } - - if (@TypeOf(Response.getArrayBuffer) != CallbackType) - @compileLog("Expected Response.getArrayBuffer to be a callback but received " ++ @typeName(@TypeOf(Response.getArrayBuffer))); - if (@TypeOf(Response.getBlob) != CallbackType) - @compileLog("Expected Response.getBlob to be a callback but received " ++ @typeName(@TypeOf(Response.getBlob))); - if (@TypeOf(Response.getBody) != GetterType) - @compileLog("Expected Response.getBody to be a getter"); - - if (@TypeOf(Response.getBodyUsed) != GetterType) - @compileLog("Expected Response.getBodyUsed to be a getter"); - - if (@TypeOf(Response.doClone) != CallbackType) - @compileLog("Expected Response.doClone to be a callback but received " ++ @typeName(@TypeOf(Response.doClone))); - if (@TypeOf(Response.getFormData) != CallbackType) - @compileLog("Expected Response.getFormData to be a callback but received " ++ @typeName(@TypeOf(Response.getFormData))); - if (@TypeOf(Response.getHeaders) != GetterType) - @compileLog("Expected Response.getHeaders to be a getter"); - - if (@TypeOf(Response.getJSON) != CallbackType) - @compileLog("Expected Response.getJSON to be a callback but received " ++ @typeName(@TypeOf(Response.getJSON))); - if (@TypeOf(Response.getOK) != GetterType) - @compileLog("Expected Response.getOK to be a getter"); - - if (@TypeOf(Response.getRedirected) != GetterType) - @compileLog("Expected Response.getRedirected to be a getter"); - - if (@TypeOf(Response.getStatus) != GetterType) - @compileLog("Expected Response.getStatus to be a getter"); - - if (@TypeOf(Response.getStatusText) != GetterType) - @compileLog("Expected Response.getStatusText to be a getter"); - - if (@TypeOf(Response.getText) != CallbackType) - @compileLog("Expected Response.getText to be a callback but received " ++ @typeName(@TypeOf(Response.getText))); - if (@TypeOf(Response.getResponseType) != GetterType) - @compileLog("Expected Response.getResponseType to be a getter"); - - if (@TypeOf(Response.getURL) != GetterType) - @compileLog("Expected Response.getURL to be a getter"); - - if (@TypeOf(Response.constructError) != StaticCallbackType) - @compileLog("Expected Response.constructError to be a static callback"); - if (@TypeOf(Response.constructJSON) != StaticCallbackType) - @compileLog("Expected Response.constructJSON to be a static callback"); - if (@TypeOf(Response.constructRedirect) != StaticCallbackType) - @compileLog("Expected Response.constructRedirect to be a static callback"); + + if (@TypeOf(Response.getArrayBuffer) != CallbackType) + @compileLog( + "Expected Response.getArrayBuffer to be a callback but received " ++ @typeName(@TypeOf(Response.getArrayBuffer)) + ); + if (@TypeOf(Response.getBlob) != CallbackType) + @compileLog( + "Expected Response.getBlob to be a callback but received " ++ @typeName(@TypeOf(Response.getBlob)) + ); + if (@TypeOf(Response.getBody) != GetterType) + @compileLog( + "Expected Response.getBody to be a getter" + ); + + if (@TypeOf(Response.getBodyUsed) != GetterType) + @compileLog( + "Expected Response.getBodyUsed to be a getter" + ); + + if (@TypeOf(Response.doClone) != CallbackType) + @compileLog( + "Expected Response.doClone to be a callback but received " ++ @typeName(@TypeOf(Response.doClone)) + ); + if (@TypeOf(Response.getFormData) != CallbackType) + @compileLog( + "Expected Response.getFormData to be a callback but received " ++ @typeName(@TypeOf(Response.getFormData)) + ); + if (@TypeOf(Response.getHeaders) != GetterType) + @compileLog( + "Expected Response.getHeaders to be a getter" + ); + + if (@TypeOf(Response.getJSON) != CallbackType) + @compileLog( + "Expected Response.getJSON to be a callback but received " ++ @typeName(@TypeOf(Response.getJSON)) + ); + if (@TypeOf(Response.getOK) != GetterType) + @compileLog( + "Expected Response.getOK to be a getter" + ); + + if (@TypeOf(Response.getRedirected) != GetterType) + @compileLog( + "Expected Response.getRedirected to be a getter" + ); + + if (@TypeOf(Response.getStatus) != GetterType) + @compileLog( + "Expected Response.getStatus to be a getter" + ); + + if (@TypeOf(Response.getStatusText) != GetterType) + @compileLog( + "Expected Response.getStatusText to be a getter" + ); + + if (@TypeOf(Response.getText) != CallbackType) + @compileLog( + "Expected Response.getText to be a callback but received " ++ @typeName(@TypeOf(Response.getText)) + ); + if (@TypeOf(Response.getResponseType) != GetterType) + @compileLog( + "Expected Response.getResponseType to be a getter" + ); + + if (@TypeOf(Response.getURL) != GetterType) + @compileLog( + "Expected Response.getURL to be a getter" + ); + + if (@TypeOf(Response.constructError) != StaticCallbackType) + @compileLog( + "Expected Response.constructError to be a static callback" + ); + if (@TypeOf(Response.constructJSON) != StaticCallbackType) + @compileLog( + "Expected Response.constructJSON to be a static callback" + ); + if (@TypeOf(Response.constructRedirect) != StaticCallbackType) + @compileLog( + "Expected Response.constructRedirect to be a static callback" + ); if (!JSC.is_bindgen) { - @export(Response.constructError, .{ .name = "ResponseClass__constructError" }); - @export(Response.constructJSON, .{ .name = "ResponseClass__constructJSON" }); - @export(Response.constructor, .{ .name = "ResponseClass__construct" }); - @export(Response.constructRedirect, .{ .name = "ResponseClass__constructRedirect" }); - @export(Response.doClone, .{ .name = "ResponsePrototype__doClone" }); - @export(Response.estimatedSize, .{ .name = "Response__estimatedSize" }); - @export(Response.finalize, .{ .name = "ResponseClass__finalize" }); - @export(Response.getArrayBuffer, .{ .name = "ResponsePrototype__getArrayBuffer" }); - @export(Response.getBlob, .{ .name = "ResponsePrototype__getBlob" }); - @export(Response.getBody, .{ .name = "ResponsePrototype__getBody" }); - @export(Response.getBodyUsed, .{ .name = "ResponsePrototype__getBodyUsed" }); - @export(Response.getFormData, .{ .name = "ResponsePrototype__getFormData" }); - @export(Response.getHeaders, .{ .name = "ResponsePrototype__getHeaders" }); - @export(Response.getJSON, .{ .name = "ResponsePrototype__getJSON" }); - @export(Response.getOK, .{ .name = "ResponsePrototype__getOK" }); - @export(Response.getRedirected, .{ .name = "ResponsePrototype__getRedirected" }); - @export(Response.getResponseType, .{ .name = "ResponsePrototype__getResponseType" }); - @export(Response.getStatus, .{ .name = "ResponsePrototype__getStatus" }); - @export(Response.getStatusText, .{ .name = "ResponsePrototype__getStatusText" }); - @export(Response.getText, .{ .name = "ResponsePrototype__getText" }); - @export(Response.getURL, .{ .name = "ResponsePrototype__getURL" }); +@export(Response.constructError, .{.name = "ResponseClass__constructError"}); + @export(Response.constructJSON, .{.name = "ResponseClass__constructJSON"}); + @export(Response.constructor, .{.name = "ResponseClass__construct"}); + @export(Response.constructRedirect, .{.name = "ResponseClass__constructRedirect"}); + @export(Response.doClone, .{.name = "ResponsePrototype__doClone"}); + @export(Response.estimatedSize, .{.name = "Response__estimatedSize"}); + @export(Response.finalize, .{.name = "ResponseClass__finalize"}); + @export(Response.getArrayBuffer, .{.name = "ResponsePrototype__getArrayBuffer"}); + @export(Response.getBlob, .{.name = "ResponsePrototype__getBlob"}); + @export(Response.getBody, .{.name = "ResponsePrototype__getBody"}); + @export(Response.getBodyUsed, .{.name = "ResponsePrototype__getBodyUsed"}); + @export(Response.getFormData, .{.name = "ResponsePrototype__getFormData"}); + @export(Response.getHeaders, .{.name = "ResponsePrototype__getHeaders"}); + @export(Response.getJSON, .{.name = "ResponsePrototype__getJSON"}); + @export(Response.getOK, .{.name = "ResponsePrototype__getOK"}); + @export(Response.getRedirected, .{.name = "ResponsePrototype__getRedirected"}); + @export(Response.getResponseType, .{.name = "ResponsePrototype__getResponseType"}); + @export(Response.getStatus, .{.name = "ResponsePrototype__getStatus"}); + @export(Response.getStatusText, .{.name = "ResponsePrototype__getStatusText"}); + @export(Response.getText, .{.name = "ResponsePrototype__getText"}); + @export(Response.getURL, .{.name = "ResponsePrototype__getURL"}); } } }; pub const JSSHA1 = struct { const SHA1 = Classes.SHA1; - const GetterType = fn (*SHA1, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*SHA1, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*SHA1, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*SHA1, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*SHA1, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; + const GetterType = fn(*SHA1, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const GetterTypeWithThisValue = fn(*SHA1, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const SetterType = fn(*SHA1, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const SetterTypeWithThisValue = fn(*SHA1, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const CallbackType = fn(*SHA1, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; /// Return the pointer to the wrapped object. /// If the object does not match the type, return null. @@ -2177,13 +2673,16 @@ pub const JSSHA1 = struct { return SHA1__fromJS(value); } + + + /// Get the SHA1 constructor value. /// This loads lazily from the global object. pub fn getConstructor(globalObject: *JSC.JSGlobalObject) JSC.JSValue { JSC.markBinding(@src()); return SHA1__getConstructor(globalObject); } - + /// Create a new instance of SHA1 pub fn toJS(this: *SHA1, globalObject: *JSC.JSGlobalObject) JSC.JSValue { JSC.markBinding(@src()); @@ -2198,14 +2697,14 @@ pub const JSSHA1 = struct { /// Modify the internal ptr to point to a new instance of SHA1. pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*SHA1) bool { - JSC.markBinding(@src()); - return SHA1__dangerouslySetPtr(value, ptr); + JSC.markBinding(@src()); + return SHA1__dangerouslySetPtr(value, ptr); } /// Detach the ptr from the thisValue pub fn detachPtr(_: *SHA1, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(SHA1__dangerouslySetPtr(value, null)); + JSC.markBinding(@src()); + std.debug.assert(SHA1__dangerouslySetPtr(value, null)); } extern fn SHA1__fromJS(JSC.JSValue) ?*SHA1; @@ -2216,44 +2715,55 @@ pub const JSSHA1 = struct { extern fn SHA1__dangerouslySetPtr(JSC.JSValue, ?*SHA1) bool; comptime { - if (@TypeOf(SHA1.constructor) != (fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*SHA1)) { - @compileLog("SHA1.constructor is not a constructor"); + + if (@TypeOf(SHA1.constructor) != (fn(*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*SHA1)) { + @compileLog("SHA1.constructor is not a constructor"); } - - if (@TypeOf(SHA1.finalize) != (fn (*SHA1) callconv(.C) void)) { - @compileLog("SHA1.finalize is not a finalizer"); + + if (@TypeOf(SHA1.finalize) != (fn(*SHA1) callconv(.C) void)) { + @compileLog("SHA1.finalize is not a finalizer"); } - - if (@TypeOf(SHA1.getByteLength) != GetterType) - @compileLog("Expected SHA1.getByteLength to be a getter"); - - if (@TypeOf(SHA1.digest) != CallbackType) - @compileLog("Expected SHA1.digest to be a callback but received " ++ @typeName(@TypeOf(SHA1.digest))); - if (@TypeOf(SHA1.update) != CallbackType) - @compileLog("Expected SHA1.update to be a callback but received " ++ @typeName(@TypeOf(SHA1.update))); - if (@TypeOf(SHA1.getByteLengthStatic) != StaticGetterType) - @compileLog("Expected SHA1.getByteLengthStatic to be a static getter"); - - if (@TypeOf(SHA1.hash) != StaticCallbackType) - @compileLog("Expected SHA1.hash to be a static callback"); + + if (@TypeOf(SHA1.getByteLength) != GetterType) + @compileLog( + "Expected SHA1.getByteLength to be a getter" + ); + + if (@TypeOf(SHA1.digest) != CallbackType) + @compileLog( + "Expected SHA1.digest to be a callback but received " ++ @typeName(@TypeOf(SHA1.digest)) + ); + if (@TypeOf(SHA1.update) != CallbackType) + @compileLog( + "Expected SHA1.update to be a callback but received " ++ @typeName(@TypeOf(SHA1.update)) + ); + if (@TypeOf(SHA1.getByteLengthStatic) != StaticGetterType) + @compileLog( + "Expected SHA1.getByteLengthStatic to be a static getter" + ); + + if (@TypeOf(SHA1.hash) != StaticCallbackType) + @compileLog( + "Expected SHA1.hash to be a static callback" + ); if (!JSC.is_bindgen) { - @export(SHA1.constructor, .{ .name = "SHA1Class__construct" }); - @export(SHA1.digest, .{ .name = "SHA1Prototype__digest" }); - @export(SHA1.finalize, .{ .name = "SHA1Class__finalize" }); - @export(SHA1.getByteLength, .{ .name = "SHA1Prototype__getByteLength" }); - @export(SHA1.getByteLengthStatic, .{ .name = "SHA1Class__getByteLengthStatic" }); - @export(SHA1.hash, .{ .name = "SHA1Class__hash" }); - @export(SHA1.update, .{ .name = "SHA1Prototype__update" }); +@export(SHA1.constructor, .{.name = "SHA1Class__construct"}); + @export(SHA1.digest, .{.name = "SHA1Prototype__digest"}); + @export(SHA1.finalize, .{.name = "SHA1Class__finalize"}); + @export(SHA1.getByteLength, .{.name = "SHA1Prototype__getByteLength"}); + @export(SHA1.getByteLengthStatic, .{.name = "SHA1Class__getByteLengthStatic"}); + @export(SHA1.hash, .{.name = "SHA1Class__hash"}); + @export(SHA1.update, .{.name = "SHA1Prototype__update"}); } } }; pub const JSSHA224 = struct { const SHA224 = Classes.SHA224; - const GetterType = fn (*SHA224, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*SHA224, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*SHA224, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*SHA224, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*SHA224, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; + const GetterType = fn(*SHA224, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const GetterTypeWithThisValue = fn(*SHA224, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const SetterType = fn(*SHA224, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const SetterTypeWithThisValue = fn(*SHA224, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const CallbackType = fn(*SHA224, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; /// Return the pointer to the wrapped object. /// If the object does not match the type, return null. @@ -2262,13 +2772,16 @@ pub const JSSHA224 = struct { return SHA224__fromJS(value); } + + + /// Get the SHA224 constructor value. /// This loads lazily from the global object. pub fn getConstructor(globalObject: *JSC.JSGlobalObject) JSC.JSValue { JSC.markBinding(@src()); return SHA224__getConstructor(globalObject); } - + /// Create a new instance of SHA224 pub fn toJS(this: *SHA224, globalObject: *JSC.JSGlobalObject) JSC.JSValue { JSC.markBinding(@src()); @@ -2283,14 +2796,14 @@ pub const JSSHA224 = struct { /// Modify the internal ptr to point to a new instance of SHA224. pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*SHA224) bool { - JSC.markBinding(@src()); - return SHA224__dangerouslySetPtr(value, ptr); + JSC.markBinding(@src()); + return SHA224__dangerouslySetPtr(value, ptr); } /// Detach the ptr from the thisValue pub fn detachPtr(_: *SHA224, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(SHA224__dangerouslySetPtr(value, null)); + JSC.markBinding(@src()); + std.debug.assert(SHA224__dangerouslySetPtr(value, null)); } extern fn SHA224__fromJS(JSC.JSValue) ?*SHA224; @@ -2301,44 +2814,55 @@ pub const JSSHA224 = struct { extern fn SHA224__dangerouslySetPtr(JSC.JSValue, ?*SHA224) bool; comptime { - if (@TypeOf(SHA224.constructor) != (fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*SHA224)) { - @compileLog("SHA224.constructor is not a constructor"); + + if (@TypeOf(SHA224.constructor) != (fn(*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*SHA224)) { + @compileLog("SHA224.constructor is not a constructor"); } - - if (@TypeOf(SHA224.finalize) != (fn (*SHA224) callconv(.C) void)) { - @compileLog("SHA224.finalize is not a finalizer"); + + if (@TypeOf(SHA224.finalize) != (fn(*SHA224) callconv(.C) void)) { + @compileLog("SHA224.finalize is not a finalizer"); } - - if (@TypeOf(SHA224.getByteLength) != GetterType) - @compileLog("Expected SHA224.getByteLength to be a getter"); - - if (@TypeOf(SHA224.digest) != CallbackType) - @compileLog("Expected SHA224.digest to be a callback but received " ++ @typeName(@TypeOf(SHA224.digest))); - if (@TypeOf(SHA224.update) != CallbackType) - @compileLog("Expected SHA224.update to be a callback but received " ++ @typeName(@TypeOf(SHA224.update))); - if (@TypeOf(SHA224.getByteLengthStatic) != StaticGetterType) - @compileLog("Expected SHA224.getByteLengthStatic to be a static getter"); - - if (@TypeOf(SHA224.hash) != StaticCallbackType) - @compileLog("Expected SHA224.hash to be a static callback"); + + if (@TypeOf(SHA224.getByteLength) != GetterType) + @compileLog( + "Expected SHA224.getByteLength to be a getter" + ); + + if (@TypeOf(SHA224.digest) != CallbackType) + @compileLog( + "Expected SHA224.digest to be a callback but received " ++ @typeName(@TypeOf(SHA224.digest)) + ); + if (@TypeOf(SHA224.update) != CallbackType) + @compileLog( + "Expected SHA224.update to be a callback but received " ++ @typeName(@TypeOf(SHA224.update)) + ); + if (@TypeOf(SHA224.getByteLengthStatic) != StaticGetterType) + @compileLog( + "Expected SHA224.getByteLengthStatic to be a static getter" + ); + + if (@TypeOf(SHA224.hash) != StaticCallbackType) + @compileLog( + "Expected SHA224.hash to be a static callback" + ); if (!JSC.is_bindgen) { - @export(SHA224.constructor, .{ .name = "SHA224Class__construct" }); - @export(SHA224.digest, .{ .name = "SHA224Prototype__digest" }); - @export(SHA224.finalize, .{ .name = "SHA224Class__finalize" }); - @export(SHA224.getByteLength, .{ .name = "SHA224Prototype__getByteLength" }); - @export(SHA224.getByteLengthStatic, .{ .name = "SHA224Class__getByteLengthStatic" }); - @export(SHA224.hash, .{ .name = "SHA224Class__hash" }); - @export(SHA224.update, .{ .name = "SHA224Prototype__update" }); +@export(SHA224.constructor, .{.name = "SHA224Class__construct"}); + @export(SHA224.digest, .{.name = "SHA224Prototype__digest"}); + @export(SHA224.finalize, .{.name = "SHA224Class__finalize"}); + @export(SHA224.getByteLength, .{.name = "SHA224Prototype__getByteLength"}); + @export(SHA224.getByteLengthStatic, .{.name = "SHA224Class__getByteLengthStatic"}); + @export(SHA224.hash, .{.name = "SHA224Class__hash"}); + @export(SHA224.update, .{.name = "SHA224Prototype__update"}); } } }; pub const JSSHA256 = struct { const SHA256 = Classes.SHA256; - const GetterType = fn (*SHA256, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*SHA256, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*SHA256, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*SHA256, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*SHA256, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; + const GetterType = fn(*SHA256, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const GetterTypeWithThisValue = fn(*SHA256, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const SetterType = fn(*SHA256, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const SetterTypeWithThisValue = fn(*SHA256, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const CallbackType = fn(*SHA256, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; /// Return the pointer to the wrapped object. /// If the object does not match the type, return null. @@ -2347,13 +2871,16 @@ pub const JSSHA256 = struct { return SHA256__fromJS(value); } + + + /// Get the SHA256 constructor value. /// This loads lazily from the global object. pub fn getConstructor(globalObject: *JSC.JSGlobalObject) JSC.JSValue { JSC.markBinding(@src()); return SHA256__getConstructor(globalObject); } - + /// Create a new instance of SHA256 pub fn toJS(this: *SHA256, globalObject: *JSC.JSGlobalObject) JSC.JSValue { JSC.markBinding(@src()); @@ -2368,14 +2895,14 @@ pub const JSSHA256 = struct { /// Modify the internal ptr to point to a new instance of SHA256. pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*SHA256) bool { - JSC.markBinding(@src()); - return SHA256__dangerouslySetPtr(value, ptr); + JSC.markBinding(@src()); + return SHA256__dangerouslySetPtr(value, ptr); } /// Detach the ptr from the thisValue pub fn detachPtr(_: *SHA256, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(SHA256__dangerouslySetPtr(value, null)); + JSC.markBinding(@src()); + std.debug.assert(SHA256__dangerouslySetPtr(value, null)); } extern fn SHA256__fromJS(JSC.JSValue) ?*SHA256; @@ -2386,44 +2913,55 @@ pub const JSSHA256 = struct { extern fn SHA256__dangerouslySetPtr(JSC.JSValue, ?*SHA256) bool; comptime { - if (@TypeOf(SHA256.constructor) != (fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*SHA256)) { - @compileLog("SHA256.constructor is not a constructor"); + + if (@TypeOf(SHA256.constructor) != (fn(*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*SHA256)) { + @compileLog("SHA256.constructor is not a constructor"); } - - if (@TypeOf(SHA256.finalize) != (fn (*SHA256) callconv(.C) void)) { - @compileLog("SHA256.finalize is not a finalizer"); + + if (@TypeOf(SHA256.finalize) != (fn(*SHA256) callconv(.C) void)) { + @compileLog("SHA256.finalize is not a finalizer"); } - - if (@TypeOf(SHA256.getByteLength) != GetterType) - @compileLog("Expected SHA256.getByteLength to be a getter"); - - if (@TypeOf(SHA256.digest) != CallbackType) - @compileLog("Expected SHA256.digest to be a callback but received " ++ @typeName(@TypeOf(SHA256.digest))); - if (@TypeOf(SHA256.update) != CallbackType) - @compileLog("Expected SHA256.update to be a callback but received " ++ @typeName(@TypeOf(SHA256.update))); - if (@TypeOf(SHA256.getByteLengthStatic) != StaticGetterType) - @compileLog("Expected SHA256.getByteLengthStatic to be a static getter"); - - if (@TypeOf(SHA256.hash) != StaticCallbackType) - @compileLog("Expected SHA256.hash to be a static callback"); + + if (@TypeOf(SHA256.getByteLength) != GetterType) + @compileLog( + "Expected SHA256.getByteLength to be a getter" + ); + + if (@TypeOf(SHA256.digest) != CallbackType) + @compileLog( + "Expected SHA256.digest to be a callback but received " ++ @typeName(@TypeOf(SHA256.digest)) + ); + if (@TypeOf(SHA256.update) != CallbackType) + @compileLog( + "Expected SHA256.update to be a callback but received " ++ @typeName(@TypeOf(SHA256.update)) + ); + if (@TypeOf(SHA256.getByteLengthStatic) != StaticGetterType) + @compileLog( + "Expected SHA256.getByteLengthStatic to be a static getter" + ); + + if (@TypeOf(SHA256.hash) != StaticCallbackType) + @compileLog( + "Expected SHA256.hash to be a static callback" + ); if (!JSC.is_bindgen) { - @export(SHA256.constructor, .{ .name = "SHA256Class__construct" }); - @export(SHA256.digest, .{ .name = "SHA256Prototype__digest" }); - @export(SHA256.finalize, .{ .name = "SHA256Class__finalize" }); - @export(SHA256.getByteLength, .{ .name = "SHA256Prototype__getByteLength" }); - @export(SHA256.getByteLengthStatic, .{ .name = "SHA256Class__getByteLengthStatic" }); - @export(SHA256.hash, .{ .name = "SHA256Class__hash" }); - @export(SHA256.update, .{ .name = "SHA256Prototype__update" }); +@export(SHA256.constructor, .{.name = "SHA256Class__construct"}); + @export(SHA256.digest, .{.name = "SHA256Prototype__digest"}); + @export(SHA256.finalize, .{.name = "SHA256Class__finalize"}); + @export(SHA256.getByteLength, .{.name = "SHA256Prototype__getByteLength"}); + @export(SHA256.getByteLengthStatic, .{.name = "SHA256Class__getByteLengthStatic"}); + @export(SHA256.hash, .{.name = "SHA256Class__hash"}); + @export(SHA256.update, .{.name = "SHA256Prototype__update"}); } } }; pub const JSSHA384 = struct { const SHA384 = Classes.SHA384; - const GetterType = fn (*SHA384, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*SHA384, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*SHA384, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*SHA384, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*SHA384, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; + const GetterType = fn(*SHA384, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const GetterTypeWithThisValue = fn(*SHA384, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const SetterType = fn(*SHA384, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const SetterTypeWithThisValue = fn(*SHA384, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const CallbackType = fn(*SHA384, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; /// Return the pointer to the wrapped object. /// If the object does not match the type, return null. @@ -2432,13 +2970,16 @@ pub const JSSHA384 = struct { return SHA384__fromJS(value); } + + + /// Get the SHA384 constructor value. /// This loads lazily from the global object. pub fn getConstructor(globalObject: *JSC.JSGlobalObject) JSC.JSValue { JSC.markBinding(@src()); return SHA384__getConstructor(globalObject); } - + /// Create a new instance of SHA384 pub fn toJS(this: *SHA384, globalObject: *JSC.JSGlobalObject) JSC.JSValue { JSC.markBinding(@src()); @@ -2453,14 +2994,14 @@ pub const JSSHA384 = struct { /// Modify the internal ptr to point to a new instance of SHA384. pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*SHA384) bool { - JSC.markBinding(@src()); - return SHA384__dangerouslySetPtr(value, ptr); + JSC.markBinding(@src()); + return SHA384__dangerouslySetPtr(value, ptr); } /// Detach the ptr from the thisValue pub fn detachPtr(_: *SHA384, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(SHA384__dangerouslySetPtr(value, null)); + JSC.markBinding(@src()); + std.debug.assert(SHA384__dangerouslySetPtr(value, null)); } extern fn SHA384__fromJS(JSC.JSValue) ?*SHA384; @@ -2471,44 +3012,55 @@ pub const JSSHA384 = struct { extern fn SHA384__dangerouslySetPtr(JSC.JSValue, ?*SHA384) bool; comptime { - if (@TypeOf(SHA384.constructor) != (fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*SHA384)) { - @compileLog("SHA384.constructor is not a constructor"); + + if (@TypeOf(SHA384.constructor) != (fn(*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*SHA384)) { + @compileLog("SHA384.constructor is not a constructor"); } - - if (@TypeOf(SHA384.finalize) != (fn (*SHA384) callconv(.C) void)) { - @compileLog("SHA384.finalize is not a finalizer"); + + if (@TypeOf(SHA384.finalize) != (fn(*SHA384) callconv(.C) void)) { + @compileLog("SHA384.finalize is not a finalizer"); } - - if (@TypeOf(SHA384.getByteLength) != GetterType) - @compileLog("Expected SHA384.getByteLength to be a getter"); - - if (@TypeOf(SHA384.digest) != CallbackType) - @compileLog("Expected SHA384.digest to be a callback but received " ++ @typeName(@TypeOf(SHA384.digest))); - if (@TypeOf(SHA384.update) != CallbackType) - @compileLog("Expected SHA384.update to be a callback but received " ++ @typeName(@TypeOf(SHA384.update))); - if (@TypeOf(SHA384.getByteLengthStatic) != StaticGetterType) - @compileLog("Expected SHA384.getByteLengthStatic to be a static getter"); - - if (@TypeOf(SHA384.hash) != StaticCallbackType) - @compileLog("Expected SHA384.hash to be a static callback"); + + if (@TypeOf(SHA384.getByteLength) != GetterType) + @compileLog( + "Expected SHA384.getByteLength to be a getter" + ); + + if (@TypeOf(SHA384.digest) != CallbackType) + @compileLog( + "Expected SHA384.digest to be a callback but received " ++ @typeName(@TypeOf(SHA384.digest)) + ); + if (@TypeOf(SHA384.update) != CallbackType) + @compileLog( + "Expected SHA384.update to be a callback but received " ++ @typeName(@TypeOf(SHA384.update)) + ); + if (@TypeOf(SHA384.getByteLengthStatic) != StaticGetterType) + @compileLog( + "Expected SHA384.getByteLengthStatic to be a static getter" + ); + + if (@TypeOf(SHA384.hash) != StaticCallbackType) + @compileLog( + "Expected SHA384.hash to be a static callback" + ); if (!JSC.is_bindgen) { - @export(SHA384.constructor, .{ .name = "SHA384Class__construct" }); - @export(SHA384.digest, .{ .name = "SHA384Prototype__digest" }); - @export(SHA384.finalize, .{ .name = "SHA384Class__finalize" }); - @export(SHA384.getByteLength, .{ .name = "SHA384Prototype__getByteLength" }); - @export(SHA384.getByteLengthStatic, .{ .name = "SHA384Class__getByteLengthStatic" }); - @export(SHA384.hash, .{ .name = "SHA384Class__hash" }); - @export(SHA384.update, .{ .name = "SHA384Prototype__update" }); +@export(SHA384.constructor, .{.name = "SHA384Class__construct"}); + @export(SHA384.digest, .{.name = "SHA384Prototype__digest"}); + @export(SHA384.finalize, .{.name = "SHA384Class__finalize"}); + @export(SHA384.getByteLength, .{.name = "SHA384Prototype__getByteLength"}); + @export(SHA384.getByteLengthStatic, .{.name = "SHA384Class__getByteLengthStatic"}); + @export(SHA384.hash, .{.name = "SHA384Class__hash"}); + @export(SHA384.update, .{.name = "SHA384Prototype__update"}); } } }; pub const JSSHA512 = struct { const SHA512 = Classes.SHA512; - const GetterType = fn (*SHA512, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*SHA512, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*SHA512, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*SHA512, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*SHA512, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; + const GetterType = fn(*SHA512, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const GetterTypeWithThisValue = fn(*SHA512, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const SetterType = fn(*SHA512, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const SetterTypeWithThisValue = fn(*SHA512, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const CallbackType = fn(*SHA512, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; /// Return the pointer to the wrapped object. /// If the object does not match the type, return null. @@ -2517,13 +3069,16 @@ pub const JSSHA512 = struct { return SHA512__fromJS(value); } + + + /// Get the SHA512 constructor value. /// This loads lazily from the global object. pub fn getConstructor(globalObject: *JSC.JSGlobalObject) JSC.JSValue { JSC.markBinding(@src()); return SHA512__getConstructor(globalObject); } - + /// Create a new instance of SHA512 pub fn toJS(this: *SHA512, globalObject: *JSC.JSGlobalObject) JSC.JSValue { JSC.markBinding(@src()); @@ -2538,14 +3093,14 @@ pub const JSSHA512 = struct { /// Modify the internal ptr to point to a new instance of SHA512. pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*SHA512) bool { - JSC.markBinding(@src()); - return SHA512__dangerouslySetPtr(value, ptr); + JSC.markBinding(@src()); + return SHA512__dangerouslySetPtr(value, ptr); } /// Detach the ptr from the thisValue pub fn detachPtr(_: *SHA512, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(SHA512__dangerouslySetPtr(value, null)); + JSC.markBinding(@src()); + std.debug.assert(SHA512__dangerouslySetPtr(value, null)); } extern fn SHA512__fromJS(JSC.JSValue) ?*SHA512; @@ -2556,44 +3111,55 @@ pub const JSSHA512 = struct { extern fn SHA512__dangerouslySetPtr(JSC.JSValue, ?*SHA512) bool; comptime { - if (@TypeOf(SHA512.constructor) != (fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*SHA512)) { - @compileLog("SHA512.constructor is not a constructor"); + + if (@TypeOf(SHA512.constructor) != (fn(*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*SHA512)) { + @compileLog("SHA512.constructor is not a constructor"); } - - if (@TypeOf(SHA512.finalize) != (fn (*SHA512) callconv(.C) void)) { - @compileLog("SHA512.finalize is not a finalizer"); + + if (@TypeOf(SHA512.finalize) != (fn(*SHA512) callconv(.C) void)) { + @compileLog("SHA512.finalize is not a finalizer"); } - - if (@TypeOf(SHA512.getByteLength) != GetterType) - @compileLog("Expected SHA512.getByteLength to be a getter"); - - if (@TypeOf(SHA512.digest) != CallbackType) - @compileLog("Expected SHA512.digest to be a callback but received " ++ @typeName(@TypeOf(SHA512.digest))); - if (@TypeOf(SHA512.update) != CallbackType) - @compileLog("Expected SHA512.update to be a callback but received " ++ @typeName(@TypeOf(SHA512.update))); - if (@TypeOf(SHA512.getByteLengthStatic) != StaticGetterType) - @compileLog("Expected SHA512.getByteLengthStatic to be a static getter"); - - if (@TypeOf(SHA512.hash) != StaticCallbackType) - @compileLog("Expected SHA512.hash to be a static callback"); + + if (@TypeOf(SHA512.getByteLength) != GetterType) + @compileLog( + "Expected SHA512.getByteLength to be a getter" + ); + + if (@TypeOf(SHA512.digest) != CallbackType) + @compileLog( + "Expected SHA512.digest to be a callback but received " ++ @typeName(@TypeOf(SHA512.digest)) + ); + if (@TypeOf(SHA512.update) != CallbackType) + @compileLog( + "Expected SHA512.update to be a callback but received " ++ @typeName(@TypeOf(SHA512.update)) + ); + if (@TypeOf(SHA512.getByteLengthStatic) != StaticGetterType) + @compileLog( + "Expected SHA512.getByteLengthStatic to be a static getter" + ); + + if (@TypeOf(SHA512.hash) != StaticCallbackType) + @compileLog( + "Expected SHA512.hash to be a static callback" + ); if (!JSC.is_bindgen) { - @export(SHA512.constructor, .{ .name = "SHA512Class__construct" }); - @export(SHA512.digest, .{ .name = "SHA512Prototype__digest" }); - @export(SHA512.finalize, .{ .name = "SHA512Class__finalize" }); - @export(SHA512.getByteLength, .{ .name = "SHA512Prototype__getByteLength" }); - @export(SHA512.getByteLengthStatic, .{ .name = "SHA512Class__getByteLengthStatic" }); - @export(SHA512.hash, .{ .name = "SHA512Class__hash" }); - @export(SHA512.update, .{ .name = "SHA512Prototype__update" }); +@export(SHA512.constructor, .{.name = "SHA512Class__construct"}); + @export(SHA512.digest, .{.name = "SHA512Prototype__digest"}); + @export(SHA512.finalize, .{.name = "SHA512Class__finalize"}); + @export(SHA512.getByteLength, .{.name = "SHA512Prototype__getByteLength"}); + @export(SHA512.getByteLengthStatic, .{.name = "SHA512Class__getByteLengthStatic"}); + @export(SHA512.hash, .{.name = "SHA512Class__hash"}); + @export(SHA512.update, .{.name = "SHA512Prototype__update"}); } } }; pub const JSSHA512_256 = struct { const SHA512_256 = Classes.SHA512_256; - const GetterType = fn (*SHA512_256, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*SHA512_256, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*SHA512_256, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*SHA512_256, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*SHA512_256, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; + const GetterType = fn(*SHA512_256, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const GetterTypeWithThisValue = fn(*SHA512_256, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const SetterType = fn(*SHA512_256, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const SetterTypeWithThisValue = fn(*SHA512_256, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const CallbackType = fn(*SHA512_256, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; /// Return the pointer to the wrapped object. /// If the object does not match the type, return null. @@ -2602,13 +3168,16 @@ pub const JSSHA512_256 = struct { return SHA512_256__fromJS(value); } + + + /// Get the SHA512_256 constructor value. /// This loads lazily from the global object. pub fn getConstructor(globalObject: *JSC.JSGlobalObject) JSC.JSValue { JSC.markBinding(@src()); return SHA512_256__getConstructor(globalObject); } - + /// Create a new instance of SHA512_256 pub fn toJS(this: *SHA512_256, globalObject: *JSC.JSGlobalObject) JSC.JSValue { JSC.markBinding(@src()); @@ -2623,14 +3192,14 @@ pub const JSSHA512_256 = struct { /// Modify the internal ptr to point to a new instance of SHA512_256. pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*SHA512_256) bool { - JSC.markBinding(@src()); - return SHA512_256__dangerouslySetPtr(value, ptr); + JSC.markBinding(@src()); + return SHA512_256__dangerouslySetPtr(value, ptr); } /// Detach the ptr from the thisValue pub fn detachPtr(_: *SHA512_256, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(SHA512_256__dangerouslySetPtr(value, null)); + JSC.markBinding(@src()); + std.debug.assert(SHA512_256__dangerouslySetPtr(value, null)); } extern fn SHA512_256__fromJS(JSC.JSValue) ?*SHA512_256; @@ -2641,44 +3210,55 @@ pub const JSSHA512_256 = struct { extern fn SHA512_256__dangerouslySetPtr(JSC.JSValue, ?*SHA512_256) bool; comptime { - if (@TypeOf(SHA512_256.constructor) != (fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*SHA512_256)) { - @compileLog("SHA512_256.constructor is not a constructor"); + + if (@TypeOf(SHA512_256.constructor) != (fn(*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*SHA512_256)) { + @compileLog("SHA512_256.constructor is not a constructor"); } - - if (@TypeOf(SHA512_256.finalize) != (fn (*SHA512_256) callconv(.C) void)) { - @compileLog("SHA512_256.finalize is not a finalizer"); + + if (@TypeOf(SHA512_256.finalize) != (fn(*SHA512_256) callconv(.C) void)) { + @compileLog("SHA512_256.finalize is not a finalizer"); } - - if (@TypeOf(SHA512_256.getByteLength) != GetterType) - @compileLog("Expected SHA512_256.getByteLength to be a getter"); - - if (@TypeOf(SHA512_256.digest) != CallbackType) - @compileLog("Expected SHA512_256.digest to be a callback but received " ++ @typeName(@TypeOf(SHA512_256.digest))); - if (@TypeOf(SHA512_256.update) != CallbackType) - @compileLog("Expected SHA512_256.update to be a callback but received " ++ @typeName(@TypeOf(SHA512_256.update))); - if (@TypeOf(SHA512_256.getByteLengthStatic) != StaticGetterType) - @compileLog("Expected SHA512_256.getByteLengthStatic to be a static getter"); - - if (@TypeOf(SHA512_256.hash) != StaticCallbackType) - @compileLog("Expected SHA512_256.hash to be a static callback"); + + if (@TypeOf(SHA512_256.getByteLength) != GetterType) + @compileLog( + "Expected SHA512_256.getByteLength to be a getter" + ); + + if (@TypeOf(SHA512_256.digest) != CallbackType) + @compileLog( + "Expected SHA512_256.digest to be a callback but received " ++ @typeName(@TypeOf(SHA512_256.digest)) + ); + if (@TypeOf(SHA512_256.update) != CallbackType) + @compileLog( + "Expected SHA512_256.update to be a callback but received " ++ @typeName(@TypeOf(SHA512_256.update)) + ); + if (@TypeOf(SHA512_256.getByteLengthStatic) != StaticGetterType) + @compileLog( + "Expected SHA512_256.getByteLengthStatic to be a static getter" + ); + + if (@TypeOf(SHA512_256.hash) != StaticCallbackType) + @compileLog( + "Expected SHA512_256.hash to be a static callback" + ); if (!JSC.is_bindgen) { - @export(SHA512_256.constructor, .{ .name = "SHA512_256Class__construct" }); - @export(SHA512_256.digest, .{ .name = "SHA512_256Prototype__digest" }); - @export(SHA512_256.finalize, .{ .name = "SHA512_256Class__finalize" }); - @export(SHA512_256.getByteLength, .{ .name = "SHA512_256Prototype__getByteLength" }); - @export(SHA512_256.getByteLengthStatic, .{ .name = "SHA512_256Class__getByteLengthStatic" }); - @export(SHA512_256.hash, .{ .name = "SHA512_256Class__hash" }); - @export(SHA512_256.update, .{ .name = "SHA512_256Prototype__update" }); +@export(SHA512_256.constructor, .{.name = "SHA512_256Class__construct"}); + @export(SHA512_256.digest, .{.name = "SHA512_256Prototype__digest"}); + @export(SHA512_256.finalize, .{.name = "SHA512_256Class__finalize"}); + @export(SHA512_256.getByteLength, .{.name = "SHA512_256Prototype__getByteLength"}); + @export(SHA512_256.getByteLengthStatic, .{.name = "SHA512_256Class__getByteLengthStatic"}); + @export(SHA512_256.hash, .{.name = "SHA512_256Class__hash"}); + @export(SHA512_256.update, .{.name = "SHA512_256Prototype__update"}); } } }; pub const JSServerWebSocket = struct { const ServerWebSocket = Classes.ServerWebSocket; - const GetterType = fn (*ServerWebSocket, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*ServerWebSocket, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*ServerWebSocket, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*ServerWebSocket, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*ServerWebSocket, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; + const GetterType = fn(*ServerWebSocket, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const GetterTypeWithThisValue = fn(*ServerWebSocket, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const SetterType = fn(*ServerWebSocket, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const SetterTypeWithThisValue = fn(*ServerWebSocket, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const CallbackType = fn(*ServerWebSocket, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; /// Return the pointer to the wrapped object. /// If the object does not match the type, return null. @@ -2689,55 +3269,57 @@ pub const JSServerWebSocket = struct { extern fn ServerWebSocketPrototype__dataSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - extern fn ServerWebSocketPrototype__dataGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `ServerWebSocket.data` setter - /// This value will be visited by the garbage collector. - pub fn dataSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - ServerWebSocketPrototype__dataSetCachedValue(thisValue, globalObject, value); - } + extern fn ServerWebSocketPrototype__dataGetCachedValue(JSC.JSValue) JSC.JSValue; + + /// `ServerWebSocket.data` setter + /// This value will be visited by the garbage collector. + pub fn dataSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { + JSC.markBinding(@src()); + ServerWebSocketPrototype__dataSetCachedValue(thisValue, globalObject, value); + } - /// `ServerWebSocket.data` getter - /// This value will be visited by the garbage collector. - pub fn dataGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = ServerWebSocketPrototype__dataGetCachedValue(thisValue); - if (result == .zero) + /// `ServerWebSocket.data` getter + /// This value will be visited by the garbage collector. + pub fn dataGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { + JSC.markBinding(@src()); + const result = ServerWebSocketPrototype__dataGetCachedValue(thisValue); + if (result == .zero) return null; + + return result; + } - return result; - } - - extern fn ServerWebSocketPrototype__remoteAddressSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn ServerWebSocketPrototype__remoteAddressGetCachedValue(JSC.JSValue) JSC.JSValue; +extern fn ServerWebSocketPrototype__remoteAddressSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - /// `ServerWebSocket.remoteAddress` setter - /// This value will be visited by the garbage collector. - pub fn remoteAddressSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - ServerWebSocketPrototype__remoteAddressSetCachedValue(thisValue, globalObject, value); - } + extern fn ServerWebSocketPrototype__remoteAddressGetCachedValue(JSC.JSValue) JSC.JSValue; + + /// `ServerWebSocket.remoteAddress` setter + /// This value will be visited by the garbage collector. + pub fn remoteAddressSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { + JSC.markBinding(@src()); + ServerWebSocketPrototype__remoteAddressSetCachedValue(thisValue, globalObject, value); + } - /// `ServerWebSocket.remoteAddress` getter - /// This value will be visited by the garbage collector. - pub fn remoteAddressGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = ServerWebSocketPrototype__remoteAddressGetCachedValue(thisValue); - if (result == .zero) + /// `ServerWebSocket.remoteAddress` getter + /// This value will be visited by the garbage collector. + pub fn remoteAddressGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { + JSC.markBinding(@src()); + const result = ServerWebSocketPrototype__remoteAddressGetCachedValue(thisValue); + if (result == .zero) return null; + + return result; + } - return result; - } + /// Get the ServerWebSocket constructor value. /// This loads lazily from the global object. pub fn getConstructor(globalObject: *JSC.JSGlobalObject) JSC.JSValue { JSC.markBinding(@src()); return ServerWebSocket__getConstructor(globalObject); } - + /// Create a new instance of ServerWebSocket pub fn toJS(this: *ServerWebSocket, globalObject: *JSC.JSGlobalObject) JSC.JSValue { JSC.markBinding(@src()); @@ -2752,14 +3334,14 @@ pub const JSServerWebSocket = struct { /// Modify the internal ptr to point to a new instance of ServerWebSocket. pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*ServerWebSocket) bool { - JSC.markBinding(@src()); - return ServerWebSocket__dangerouslySetPtr(value, ptr); + JSC.markBinding(@src()); + return ServerWebSocket__dangerouslySetPtr(value, ptr); } /// Detach the ptr from the thisValue pub fn detachPtr(_: *ServerWebSocket, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(ServerWebSocket__dangerouslySetPtr(value, null)); + JSC.markBinding(@src()); + std.debug.assert(ServerWebSocket__dangerouslySetPtr(value, null)); } extern fn ServerWebSocket__fromJS(JSC.JSValue) ?*ServerWebSocket; @@ -2770,97 +3352,142 @@ pub const JSServerWebSocket = struct { extern fn ServerWebSocket__dangerouslySetPtr(JSC.JSValue, ?*ServerWebSocket) bool; comptime { - if (@TypeOf(ServerWebSocket.constructor) != (fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*ServerWebSocket)) { - @compileLog("ServerWebSocket.constructor is not a constructor"); - } - - if (@TypeOf(ServerWebSocket.finalize) != (fn (*ServerWebSocket) callconv(.C) void)) { - @compileLog("ServerWebSocket.finalize is not a finalizer"); - } - - if (@TypeOf(ServerWebSocket.getBinaryType) != GetterType) - @compileLog("Expected ServerWebSocket.getBinaryType to be a getter"); - - if (@TypeOf(ServerWebSocket.setBinaryType) != SetterType) - @compileLog("Expected ServerWebSocket.setBinaryType to be a setter"); - if (@TypeOf(ServerWebSocket.close) != CallbackType) - @compileLog("Expected ServerWebSocket.close to be a callback but received " ++ @typeName(@TypeOf(ServerWebSocket.close))); - if (@TypeOf(ServerWebSocket.cork) != CallbackType) - @compileLog("Expected ServerWebSocket.cork to be a callback but received " ++ @typeName(@TypeOf(ServerWebSocket.cork))); - if (@TypeOf(ServerWebSocket.getData) != GetterType) - @compileLog("Expected ServerWebSocket.getData to be a getter"); - - if (@TypeOf(ServerWebSocket.setData) != SetterType) - @compileLog("Expected ServerWebSocket.setData to be a setter"); - if (@TypeOf(ServerWebSocket.getBufferedAmount) != CallbackType) - @compileLog("Expected ServerWebSocket.getBufferedAmount to be a callback but received " ++ @typeName(@TypeOf(ServerWebSocket.getBufferedAmount))); - if (@TypeOf(ServerWebSocket.isSubscribed) != CallbackType) - @compileLog("Expected ServerWebSocket.isSubscribed to be a callback but received " ++ @typeName(@TypeOf(ServerWebSocket.isSubscribed))); - if (@TypeOf(ServerWebSocket.publish) != CallbackType) - @compileLog("Expected ServerWebSocket.publish to be a callback but received " ++ @typeName(@TypeOf(ServerWebSocket.publish))); - if (@TypeOf(ServerWebSocket.publishBinaryWithoutTypeChecks) != fn (*ServerWebSocket, *JSC.JSGlobalObject, *JSC.JSString, *JSC.JSUint8Array) callconv(.C) JSC.JSValue) - @compileLog("Expected ServerWebSocket.publishBinaryWithoutTypeChecks to be a DOMJIT function"); - if (@TypeOf(ServerWebSocket.publishBinary) != CallbackType) - @compileLog("Expected ServerWebSocket.publishBinary to be a callback but received " ++ @typeName(@TypeOf(ServerWebSocket.publishBinary))); - if (@TypeOf(ServerWebSocket.publishTextWithoutTypeChecks) != fn (*ServerWebSocket, *JSC.JSGlobalObject, *JSC.JSString, *JSC.JSString) callconv(.C) JSC.JSValue) - @compileLog("Expected ServerWebSocket.publishTextWithoutTypeChecks to be a DOMJIT function"); - if (@TypeOf(ServerWebSocket.publishText) != CallbackType) - @compileLog("Expected ServerWebSocket.publishText to be a callback but received " ++ @typeName(@TypeOf(ServerWebSocket.publishText))); - if (@TypeOf(ServerWebSocket.getReadyState) != GetterType) - @compileLog("Expected ServerWebSocket.getReadyState to be a getter"); - - if (@TypeOf(ServerWebSocket.getRemoteAddress) != GetterType) - @compileLog("Expected ServerWebSocket.getRemoteAddress to be a getter"); - - if (@TypeOf(ServerWebSocket.send) != CallbackType) - @compileLog("Expected ServerWebSocket.send to be a callback but received " ++ @typeName(@TypeOf(ServerWebSocket.send))); - if (@TypeOf(ServerWebSocket.sendBinaryWithoutTypeChecks) != fn (*ServerWebSocket, *JSC.JSGlobalObject, *JSC.JSUint8Array, bool) callconv(.C) JSC.JSValue) - @compileLog("Expected ServerWebSocket.sendBinaryWithoutTypeChecks to be a DOMJIT function"); - if (@TypeOf(ServerWebSocket.sendBinary) != CallbackType) - @compileLog("Expected ServerWebSocket.sendBinary to be a callback but received " ++ @typeName(@TypeOf(ServerWebSocket.sendBinary))); - if (@TypeOf(ServerWebSocket.sendTextWithoutTypeChecks) != fn (*ServerWebSocket, *JSC.JSGlobalObject, *JSC.JSString, bool) callconv(.C) JSC.JSValue) - @compileLog("Expected ServerWebSocket.sendTextWithoutTypeChecks to be a DOMJIT function"); - if (@TypeOf(ServerWebSocket.sendText) != CallbackType) - @compileLog("Expected ServerWebSocket.sendText to be a callback but received " ++ @typeName(@TypeOf(ServerWebSocket.sendText))); - if (@TypeOf(ServerWebSocket.subscribe) != CallbackType) - @compileLog("Expected ServerWebSocket.subscribe to be a callback but received " ++ @typeName(@TypeOf(ServerWebSocket.subscribe))); - if (@TypeOf(ServerWebSocket.unsubscribe) != CallbackType) - @compileLog("Expected ServerWebSocket.unsubscribe to be a callback but received " ++ @typeName(@TypeOf(ServerWebSocket.unsubscribe))); + + if (@TypeOf(ServerWebSocket.constructor) != (fn(*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*ServerWebSocket)) { + @compileLog("ServerWebSocket.constructor is not a constructor"); + } + + if (@TypeOf(ServerWebSocket.finalize) != (fn(*ServerWebSocket) callconv(.C) void)) { + @compileLog("ServerWebSocket.finalize is not a finalizer"); + } + + if (@TypeOf(ServerWebSocket.getBinaryType) != GetterType) + @compileLog( + "Expected ServerWebSocket.getBinaryType to be a getter" + ); + + if (@TypeOf(ServerWebSocket.setBinaryType) != SetterType) + @compileLog( + "Expected ServerWebSocket.setBinaryType to be a setter" + ); + if (@TypeOf(ServerWebSocket.close) != CallbackType) + @compileLog( + "Expected ServerWebSocket.close to be a callback but received " ++ @typeName(@TypeOf(ServerWebSocket.close)) + ); + if (@TypeOf(ServerWebSocket.cork) != CallbackType) + @compileLog( + "Expected ServerWebSocket.cork to be a callback but received " ++ @typeName(@TypeOf(ServerWebSocket.cork)) + ); + if (@TypeOf(ServerWebSocket.getData) != GetterType) + @compileLog( + "Expected ServerWebSocket.getData to be a getter" + ); + + if (@TypeOf(ServerWebSocket.setData) != SetterType) + @compileLog( + "Expected ServerWebSocket.setData to be a setter" + ); + if (@TypeOf(ServerWebSocket.getBufferedAmount) != CallbackType) + @compileLog( + "Expected ServerWebSocket.getBufferedAmount to be a callback but received " ++ @typeName(@TypeOf(ServerWebSocket.getBufferedAmount)) + ); + if (@TypeOf(ServerWebSocket.isSubscribed) != CallbackType) + @compileLog( + "Expected ServerWebSocket.isSubscribed to be a callback but received " ++ @typeName(@TypeOf(ServerWebSocket.isSubscribed)) + ); + if (@TypeOf(ServerWebSocket.publish) != CallbackType) + @compileLog( + "Expected ServerWebSocket.publish to be a callback but received " ++ @typeName(@TypeOf(ServerWebSocket.publish)) + ); + if (@TypeOf(ServerWebSocket.publishBinaryWithoutTypeChecks) != fn (*ServerWebSocket, *JSC.JSGlobalObject, *JSC.JSString, *JSC.JSUint8Array) callconv(.C) JSC.JSValue) + @compileLog( + "Expected ServerWebSocket.publishBinaryWithoutTypeChecks to be a DOMJIT function" + ); + if (@TypeOf(ServerWebSocket.publishBinary) != CallbackType) + @compileLog( + "Expected ServerWebSocket.publishBinary to be a callback but received " ++ @typeName(@TypeOf(ServerWebSocket.publishBinary)) + ); + if (@TypeOf(ServerWebSocket.publishTextWithoutTypeChecks) != fn (*ServerWebSocket, *JSC.JSGlobalObject, *JSC.JSString, *JSC.JSString) callconv(.C) JSC.JSValue) + @compileLog( + "Expected ServerWebSocket.publishTextWithoutTypeChecks to be a DOMJIT function" + ); + if (@TypeOf(ServerWebSocket.publishText) != CallbackType) + @compileLog( + "Expected ServerWebSocket.publishText to be a callback but received " ++ @typeName(@TypeOf(ServerWebSocket.publishText)) + ); + if (@TypeOf(ServerWebSocket.getReadyState) != GetterType) + @compileLog( + "Expected ServerWebSocket.getReadyState to be a getter" + ); + + if (@TypeOf(ServerWebSocket.getRemoteAddress) != GetterType) + @compileLog( + "Expected ServerWebSocket.getRemoteAddress to be a getter" + ); + + if (@TypeOf(ServerWebSocket.send) != CallbackType) + @compileLog( + "Expected ServerWebSocket.send to be a callback but received " ++ @typeName(@TypeOf(ServerWebSocket.send)) + ); + if (@TypeOf(ServerWebSocket.sendBinaryWithoutTypeChecks) != fn (*ServerWebSocket, *JSC.JSGlobalObject, *JSC.JSUint8Array, bool) callconv(.C) JSC.JSValue) + @compileLog( + "Expected ServerWebSocket.sendBinaryWithoutTypeChecks to be a DOMJIT function" + ); + if (@TypeOf(ServerWebSocket.sendBinary) != CallbackType) + @compileLog( + "Expected ServerWebSocket.sendBinary to be a callback but received " ++ @typeName(@TypeOf(ServerWebSocket.sendBinary)) + ); + if (@TypeOf(ServerWebSocket.sendTextWithoutTypeChecks) != fn (*ServerWebSocket, *JSC.JSGlobalObject, *JSC.JSString, bool) callconv(.C) JSC.JSValue) + @compileLog( + "Expected ServerWebSocket.sendTextWithoutTypeChecks to be a DOMJIT function" + ); + if (@TypeOf(ServerWebSocket.sendText) != CallbackType) + @compileLog( + "Expected ServerWebSocket.sendText to be a callback but received " ++ @typeName(@TypeOf(ServerWebSocket.sendText)) + ); + if (@TypeOf(ServerWebSocket.subscribe) != CallbackType) + @compileLog( + "Expected ServerWebSocket.subscribe to be a callback but received " ++ @typeName(@TypeOf(ServerWebSocket.subscribe)) + ); + if (@TypeOf(ServerWebSocket.unsubscribe) != CallbackType) + @compileLog( + "Expected ServerWebSocket.unsubscribe to be a callback but received " ++ @typeName(@TypeOf(ServerWebSocket.unsubscribe)) + ); if (!JSC.is_bindgen) { - @export(ServerWebSocket.close, .{ .name = "ServerWebSocketPrototype__close" }); - @export(ServerWebSocket.constructor, .{ .name = "ServerWebSocketClass__construct" }); - @export(ServerWebSocket.cork, .{ .name = "ServerWebSocketPrototype__cork" }); - @export(ServerWebSocket.finalize, .{ .name = "ServerWebSocketClass__finalize" }); - @export(ServerWebSocket.getBinaryType, .{ .name = "ServerWebSocketPrototype__getBinaryType" }); - @export(ServerWebSocket.getBufferedAmount, .{ .name = "ServerWebSocketPrototype__getBufferedAmount" }); - @export(ServerWebSocket.getData, .{ .name = "ServerWebSocketPrototype__getData" }); - @export(ServerWebSocket.getReadyState, .{ .name = "ServerWebSocketPrototype__getReadyState" }); - @export(ServerWebSocket.getRemoteAddress, .{ .name = "ServerWebSocketPrototype__getRemoteAddress" }); - @export(ServerWebSocket.isSubscribed, .{ .name = "ServerWebSocketPrototype__isSubscribed" }); - @export(ServerWebSocket.publish, .{ .name = "ServerWebSocketPrototype__publish" }); - @export(ServerWebSocket.publishBinary, .{ .name = "ServerWebSocketPrototype__publishBinary" }); - @export(ServerWebSocket.publishBinaryWithoutTypeChecks, .{ .name = "ServerWebSocketPrototype__publishBinaryWithoutTypeChecks" }); - @export(ServerWebSocket.publishText, .{ .name = "ServerWebSocketPrototype__publishText" }); - @export(ServerWebSocket.publishTextWithoutTypeChecks, .{ .name = "ServerWebSocketPrototype__publishTextWithoutTypeChecks" }); - @export(ServerWebSocket.send, .{ .name = "ServerWebSocketPrototype__send" }); - @export(ServerWebSocket.sendBinary, .{ .name = "ServerWebSocketPrototype__sendBinary" }); - @export(ServerWebSocket.sendBinaryWithoutTypeChecks, .{ .name = "ServerWebSocketPrototype__sendBinaryWithoutTypeChecks" }); - @export(ServerWebSocket.sendText, .{ .name = "ServerWebSocketPrototype__sendText" }); - @export(ServerWebSocket.sendTextWithoutTypeChecks, .{ .name = "ServerWebSocketPrototype__sendTextWithoutTypeChecks" }); - @export(ServerWebSocket.setBinaryType, .{ .name = "ServerWebSocketPrototype__setBinaryType" }); - @export(ServerWebSocket.setData, .{ .name = "ServerWebSocketPrototype__setData" }); - @export(ServerWebSocket.subscribe, .{ .name = "ServerWebSocketPrototype__subscribe" }); - @export(ServerWebSocket.unsubscribe, .{ .name = "ServerWebSocketPrototype__unsubscribe" }); +@export(ServerWebSocket.close, .{.name = "ServerWebSocketPrototype__close"}); + @export(ServerWebSocket.constructor, .{.name = "ServerWebSocketClass__construct"}); + @export(ServerWebSocket.cork, .{.name = "ServerWebSocketPrototype__cork"}); + @export(ServerWebSocket.finalize, .{.name = "ServerWebSocketClass__finalize"}); + @export(ServerWebSocket.getBinaryType, .{.name = "ServerWebSocketPrototype__getBinaryType"}); + @export(ServerWebSocket.getBufferedAmount, .{.name = "ServerWebSocketPrototype__getBufferedAmount"}); + @export(ServerWebSocket.getData, .{.name = "ServerWebSocketPrototype__getData"}); + @export(ServerWebSocket.getReadyState, .{.name = "ServerWebSocketPrototype__getReadyState"}); + @export(ServerWebSocket.getRemoteAddress, .{.name = "ServerWebSocketPrototype__getRemoteAddress"}); + @export(ServerWebSocket.isSubscribed, .{.name = "ServerWebSocketPrototype__isSubscribed"}); + @export(ServerWebSocket.publish, .{.name = "ServerWebSocketPrototype__publish"}); + @export(ServerWebSocket.publishBinary, .{.name = "ServerWebSocketPrototype__publishBinary"}); + @export(ServerWebSocket.publishBinaryWithoutTypeChecks, .{.name = "ServerWebSocketPrototype__publishBinaryWithoutTypeChecks"}); + @export(ServerWebSocket.publishText, .{.name = "ServerWebSocketPrototype__publishText"}); + @export(ServerWebSocket.publishTextWithoutTypeChecks, .{.name = "ServerWebSocketPrototype__publishTextWithoutTypeChecks"}); + @export(ServerWebSocket.send, .{.name = "ServerWebSocketPrototype__send"}); + @export(ServerWebSocket.sendBinary, .{.name = "ServerWebSocketPrototype__sendBinary"}); + @export(ServerWebSocket.sendBinaryWithoutTypeChecks, .{.name = "ServerWebSocketPrototype__sendBinaryWithoutTypeChecks"}); + @export(ServerWebSocket.sendText, .{.name = "ServerWebSocketPrototype__sendText"}); + @export(ServerWebSocket.sendTextWithoutTypeChecks, .{.name = "ServerWebSocketPrototype__sendTextWithoutTypeChecks"}); + @export(ServerWebSocket.setBinaryType, .{.name = "ServerWebSocketPrototype__setBinaryType"}); + @export(ServerWebSocket.setData, .{.name = "ServerWebSocketPrototype__setData"}); + @export(ServerWebSocket.subscribe, .{.name = "ServerWebSocketPrototype__subscribe"}); + @export(ServerWebSocket.unsubscribe, .{.name = "ServerWebSocketPrototype__unsubscribe"}); } } }; pub const JSStats = struct { const Stats = Classes.Stats; - const GetterType = fn (*Stats, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*Stats, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*Stats, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*Stats, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*Stats, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; + const GetterType = fn(*Stats, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const GetterTypeWithThisValue = fn(*Stats, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const SetterType = fn(*Stats, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const SetterTypeWithThisValue = fn(*Stats, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const CallbackType = fn(*Stats, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; /// Return the pointer to the wrapped object. /// If the object does not match the type, return null. @@ -2871,77 +3498,79 @@ pub const JSStats = struct { extern fn StatsPrototype__atimeSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - extern fn StatsPrototype__atimeGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `Stats.atime` setter - /// This value will be visited by the garbage collector. - pub fn atimeSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - StatsPrototype__atimeSetCachedValue(thisValue, globalObject, value); - } + extern fn StatsPrototype__atimeGetCachedValue(JSC.JSValue) JSC.JSValue; + + /// `Stats.atime` setter + /// This value will be visited by the garbage collector. + pub fn atimeSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { + JSC.markBinding(@src()); + StatsPrototype__atimeSetCachedValue(thisValue, globalObject, value); + } - /// `Stats.atime` getter - /// This value will be visited by the garbage collector. - pub fn atimeGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = StatsPrototype__atimeGetCachedValue(thisValue); - if (result == .zero) + /// `Stats.atime` getter + /// This value will be visited by the garbage collector. + pub fn atimeGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { + JSC.markBinding(@src()); + const result = StatsPrototype__atimeGetCachedValue(thisValue); + if (result == .zero) return null; + + return result; + } - return result; - } - - extern fn StatsPrototype__ctimeSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn StatsPrototype__ctimeGetCachedValue(JSC.JSValue) JSC.JSValue; +extern fn StatsPrototype__ctimeSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - /// `Stats.ctime` setter - /// This value will be visited by the garbage collector. - pub fn ctimeSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - StatsPrototype__ctimeSetCachedValue(thisValue, globalObject, value); - } + extern fn StatsPrototype__ctimeGetCachedValue(JSC.JSValue) JSC.JSValue; + + /// `Stats.ctime` setter + /// This value will be visited by the garbage collector. + pub fn ctimeSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { + JSC.markBinding(@src()); + StatsPrototype__ctimeSetCachedValue(thisValue, globalObject, value); + } - /// `Stats.ctime` getter - /// This value will be visited by the garbage collector. - pub fn ctimeGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = StatsPrototype__ctimeGetCachedValue(thisValue); - if (result == .zero) + /// `Stats.ctime` getter + /// This value will be visited by the garbage collector. + pub fn ctimeGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { + JSC.markBinding(@src()); + const result = StatsPrototype__ctimeGetCachedValue(thisValue); + if (result == .zero) return null; + + return result; + } - return result; - } - - extern fn StatsPrototype__mtimeSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn StatsPrototype__mtimeGetCachedValue(JSC.JSValue) JSC.JSValue; +extern fn StatsPrototype__mtimeSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - /// `Stats.mtime` setter - /// This value will be visited by the garbage collector. - pub fn mtimeSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - StatsPrototype__mtimeSetCachedValue(thisValue, globalObject, value); - } + extern fn StatsPrototype__mtimeGetCachedValue(JSC.JSValue) JSC.JSValue; + + /// `Stats.mtime` setter + /// This value will be visited by the garbage collector. + pub fn mtimeSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { + JSC.markBinding(@src()); + StatsPrototype__mtimeSetCachedValue(thisValue, globalObject, value); + } - /// `Stats.mtime` getter - /// This value will be visited by the garbage collector. - pub fn mtimeGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = StatsPrototype__mtimeGetCachedValue(thisValue); - if (result == .zero) + /// `Stats.mtime` getter + /// This value will be visited by the garbage collector. + pub fn mtimeGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { + JSC.markBinding(@src()); + const result = StatsPrototype__mtimeGetCachedValue(thisValue); + if (result == .zero) return null; + + return result; + } - return result; - } + /// Get the Stats constructor value. /// This loads lazily from the global object. pub fn getConstructor(globalObject: *JSC.JSGlobalObject) JSC.JSValue { JSC.markBinding(@src()); return Stats__getConstructor(globalObject); } - + /// Create a new instance of Stats pub fn toJS(this: *Stats, globalObject: *JSC.JSGlobalObject) JSC.JSValue { JSC.markBinding(@src()); @@ -2956,14 +3585,14 @@ pub const JSStats = struct { /// Modify the internal ptr to point to a new instance of Stats. pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*Stats) bool { - JSC.markBinding(@src()); - return Stats__dangerouslySetPtr(value, ptr); + JSC.markBinding(@src()); + return Stats__dangerouslySetPtr(value, ptr); } /// Detach the ptr from the thisValue pub fn detachPtr(_: *Stats, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(Stats__dangerouslySetPtr(value, null)); + JSC.markBinding(@src()); + std.debug.assert(Stats__dangerouslySetPtr(value, null)); } extern fn Stats__fromJS(JSC.JSValue) ?*Stats; @@ -2974,162 +3603,206 @@ pub const JSStats = struct { extern fn Stats__dangerouslySetPtr(JSC.JSValue, ?*Stats) bool; comptime { - if (@TypeOf(Stats.constructor) != (fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*Stats)) { - @compileLog("Stats.constructor is not a constructor"); - } - - if (@TypeOf(Stats.finalize) != (fn (*Stats) callconv(.C) void)) { - @compileLog("Stats.finalize is not a finalizer"); - } - - if (@TypeOf(Stats.atime) != GetterType) - @compileLog("Expected Stats.atime to be a getter"); - - if (@TypeOf(Stats.atimeMs) != GetterType) - @compileLog("Expected Stats.atimeMs to be a getter"); - - if (@TypeOf(Stats.birthtime) != GetterType) - @compileLog("Expected Stats.birthtime to be a getter"); - - if (@TypeOf(Stats.birthtimeMs) != GetterType) - @compileLog("Expected Stats.birthtimeMs to be a getter"); - - if (@TypeOf(Stats.blksize) != GetterType) - @compileLog("Expected Stats.blksize to be a getter"); - - if (@TypeOf(Stats.blocks) != GetterType) - @compileLog("Expected Stats.blocks to be a getter"); - - if (@TypeOf(Stats.ctime) != GetterType) - @compileLog("Expected Stats.ctime to be a getter"); - - if (@TypeOf(Stats.ctimeMs) != GetterType) - @compileLog("Expected Stats.ctimeMs to be a getter"); - - if (@TypeOf(Stats.dev) != GetterType) - @compileLog("Expected Stats.dev to be a getter"); - - if (@TypeOf(Stats.gid) != GetterType) - @compileLog("Expected Stats.gid to be a getter"); - - if (@TypeOf(Stats.ino) != GetterType) - @compileLog("Expected Stats.ino to be a getter"); - - if (@TypeOf(Stats.isBlockDevice_WithoutTypeChecks) != fn ( - *Stats, - *JSC.JSGlobalObject, - ) callconv(.C) JSC.JSValue) - @compileLog("Expected Stats.isBlockDevice_WithoutTypeChecks to be a DOMJIT function"); - if (@TypeOf(Stats.isBlockDevice_) != CallbackType) - @compileLog("Expected Stats.isBlockDevice_ to be a callback but received " ++ @typeName(@TypeOf(Stats.isBlockDevice_))); - if (@TypeOf(Stats.isCharacterDevice_WithoutTypeChecks) != fn ( - *Stats, - *JSC.JSGlobalObject, - ) callconv(.C) JSC.JSValue) - @compileLog("Expected Stats.isCharacterDevice_WithoutTypeChecks to be a DOMJIT function"); - if (@TypeOf(Stats.isCharacterDevice_) != CallbackType) - @compileLog("Expected Stats.isCharacterDevice_ to be a callback but received " ++ @typeName(@TypeOf(Stats.isCharacterDevice_))); - if (@TypeOf(Stats.isDirectory_WithoutTypeChecks) != fn ( - *Stats, - *JSC.JSGlobalObject, - ) callconv(.C) JSC.JSValue) - @compileLog("Expected Stats.isDirectory_WithoutTypeChecks to be a DOMJIT function"); - if (@TypeOf(Stats.isDirectory_) != CallbackType) - @compileLog("Expected Stats.isDirectory_ to be a callback but received " ++ @typeName(@TypeOf(Stats.isDirectory_))); - if (@TypeOf(Stats.isFIFO_WithoutTypeChecks) != fn ( - *Stats, - *JSC.JSGlobalObject, - ) callconv(.C) JSC.JSValue) - @compileLog("Expected Stats.isFIFO_WithoutTypeChecks to be a DOMJIT function"); - if (@TypeOf(Stats.isFIFO_) != CallbackType) - @compileLog("Expected Stats.isFIFO_ to be a callback but received " ++ @typeName(@TypeOf(Stats.isFIFO_))); - if (@TypeOf(Stats.isFile_WithoutTypeChecks) != fn ( - *Stats, - *JSC.JSGlobalObject, - ) callconv(.C) JSC.JSValue) - @compileLog("Expected Stats.isFile_WithoutTypeChecks to be a DOMJIT function"); - if (@TypeOf(Stats.isFile_) != CallbackType) - @compileLog("Expected Stats.isFile_ to be a callback but received " ++ @typeName(@TypeOf(Stats.isFile_))); - if (@TypeOf(Stats.isSocket_WithoutTypeChecks) != fn ( - *Stats, - *JSC.JSGlobalObject, - ) callconv(.C) JSC.JSValue) - @compileLog("Expected Stats.isSocket_WithoutTypeChecks to be a DOMJIT function"); - if (@TypeOf(Stats.isSocket_) != CallbackType) - @compileLog("Expected Stats.isSocket_ to be a callback but received " ++ @typeName(@TypeOf(Stats.isSocket_))); - if (@TypeOf(Stats.isSymbolicLink_WithoutTypeChecks) != fn ( - *Stats, - *JSC.JSGlobalObject, - ) callconv(.C) JSC.JSValue) - @compileLog("Expected Stats.isSymbolicLink_WithoutTypeChecks to be a DOMJIT function"); - if (@TypeOf(Stats.isSymbolicLink_) != CallbackType) - @compileLog("Expected Stats.isSymbolicLink_ to be a callback but received " ++ @typeName(@TypeOf(Stats.isSymbolicLink_))); - if (@TypeOf(Stats.mode) != GetterType) - @compileLog("Expected Stats.mode to be a getter"); - - if (@TypeOf(Stats.mtime) != GetterType) - @compileLog("Expected Stats.mtime to be a getter"); - - if (@TypeOf(Stats.mtimeMs) != GetterType) - @compileLog("Expected Stats.mtimeMs to be a getter"); - - if (@TypeOf(Stats.nlink) != GetterType) - @compileLog("Expected Stats.nlink to be a getter"); - - if (@TypeOf(Stats.rdev) != GetterType) - @compileLog("Expected Stats.rdev to be a getter"); - - if (@TypeOf(Stats.size) != GetterType) - @compileLog("Expected Stats.size to be a getter"); - - if (@TypeOf(Stats.uid) != GetterType) - @compileLog("Expected Stats.uid to be a getter"); + + if (@TypeOf(Stats.constructor) != (fn(*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*Stats)) { + @compileLog("Stats.constructor is not a constructor"); + } + + if (@TypeOf(Stats.finalize) != (fn(*Stats) callconv(.C) void)) { + @compileLog("Stats.finalize is not a finalizer"); + } + + if (@TypeOf(Stats.atime) != GetterType) + @compileLog( + "Expected Stats.atime to be a getter" + ); + + if (@TypeOf(Stats.atimeMs) != GetterType) + @compileLog( + "Expected Stats.atimeMs to be a getter" + ); + + if (@TypeOf(Stats.birthtime) != GetterType) + @compileLog( + "Expected Stats.birthtime to be a getter" + ); + + if (@TypeOf(Stats.birthtimeMs) != GetterType) + @compileLog( + "Expected Stats.birthtimeMs to be a getter" + ); + + if (@TypeOf(Stats.blksize) != GetterType) + @compileLog( + "Expected Stats.blksize to be a getter" + ); + + if (@TypeOf(Stats.blocks) != GetterType) + @compileLog( + "Expected Stats.blocks to be a getter" + ); + + if (@TypeOf(Stats.ctime) != GetterType) + @compileLog( + "Expected Stats.ctime to be a getter" + ); + + if (@TypeOf(Stats.ctimeMs) != GetterType) + @compileLog( + "Expected Stats.ctimeMs to be a getter" + ); + + if (@TypeOf(Stats.dev) != GetterType) + @compileLog( + "Expected Stats.dev to be a getter" + ); + + if (@TypeOf(Stats.gid) != GetterType) + @compileLog( + "Expected Stats.gid to be a getter" + ); + + if (@TypeOf(Stats.ino) != GetterType) + @compileLog( + "Expected Stats.ino to be a getter" + ); + + if (@TypeOf(Stats.isBlockDevice_WithoutTypeChecks) != fn (*Stats, *JSC.JSGlobalObject, ) callconv(.C) JSC.JSValue) + @compileLog( + "Expected Stats.isBlockDevice_WithoutTypeChecks to be a DOMJIT function" + ); + if (@TypeOf(Stats.isBlockDevice_) != CallbackType) + @compileLog( + "Expected Stats.isBlockDevice_ to be a callback but received " ++ @typeName(@TypeOf(Stats.isBlockDevice_)) + ); + if (@TypeOf(Stats.isCharacterDevice_WithoutTypeChecks) != fn (*Stats, *JSC.JSGlobalObject, ) callconv(.C) JSC.JSValue) + @compileLog( + "Expected Stats.isCharacterDevice_WithoutTypeChecks to be a DOMJIT function" + ); + if (@TypeOf(Stats.isCharacterDevice_) != CallbackType) + @compileLog( + "Expected Stats.isCharacterDevice_ to be a callback but received " ++ @typeName(@TypeOf(Stats.isCharacterDevice_)) + ); + if (@TypeOf(Stats.isDirectory_WithoutTypeChecks) != fn (*Stats, *JSC.JSGlobalObject, ) callconv(.C) JSC.JSValue) + @compileLog( + "Expected Stats.isDirectory_WithoutTypeChecks to be a DOMJIT function" + ); + if (@TypeOf(Stats.isDirectory_) != CallbackType) + @compileLog( + "Expected Stats.isDirectory_ to be a callback but received " ++ @typeName(@TypeOf(Stats.isDirectory_)) + ); + if (@TypeOf(Stats.isFIFO_WithoutTypeChecks) != fn (*Stats, *JSC.JSGlobalObject, ) callconv(.C) JSC.JSValue) + @compileLog( + "Expected Stats.isFIFO_WithoutTypeChecks to be a DOMJIT function" + ); + if (@TypeOf(Stats.isFIFO_) != CallbackType) + @compileLog( + "Expected Stats.isFIFO_ to be a callback but received " ++ @typeName(@TypeOf(Stats.isFIFO_)) + ); + if (@TypeOf(Stats.isFile_WithoutTypeChecks) != fn (*Stats, *JSC.JSGlobalObject, ) callconv(.C) JSC.JSValue) + @compileLog( + "Expected Stats.isFile_WithoutTypeChecks to be a DOMJIT function" + ); + if (@TypeOf(Stats.isFile_) != CallbackType) + @compileLog( + "Expected Stats.isFile_ to be a callback but received " ++ @typeName(@TypeOf(Stats.isFile_)) + ); + if (@TypeOf(Stats.isSocket_WithoutTypeChecks) != fn (*Stats, *JSC.JSGlobalObject, ) callconv(.C) JSC.JSValue) + @compileLog( + "Expected Stats.isSocket_WithoutTypeChecks to be a DOMJIT function" + ); + if (@TypeOf(Stats.isSocket_) != CallbackType) + @compileLog( + "Expected Stats.isSocket_ to be a callback but received " ++ @typeName(@TypeOf(Stats.isSocket_)) + ); + if (@TypeOf(Stats.isSymbolicLink_WithoutTypeChecks) != fn (*Stats, *JSC.JSGlobalObject, ) callconv(.C) JSC.JSValue) + @compileLog( + "Expected Stats.isSymbolicLink_WithoutTypeChecks to be a DOMJIT function" + ); + if (@TypeOf(Stats.isSymbolicLink_) != CallbackType) + @compileLog( + "Expected Stats.isSymbolicLink_ to be a callback but received " ++ @typeName(@TypeOf(Stats.isSymbolicLink_)) + ); + if (@TypeOf(Stats.mode) != GetterType) + @compileLog( + "Expected Stats.mode to be a getter" + ); + + if (@TypeOf(Stats.mtime) != GetterType) + @compileLog( + "Expected Stats.mtime to be a getter" + ); + + if (@TypeOf(Stats.mtimeMs) != GetterType) + @compileLog( + "Expected Stats.mtimeMs to be a getter" + ); + + if (@TypeOf(Stats.nlink) != GetterType) + @compileLog( + "Expected Stats.nlink to be a getter" + ); + + if (@TypeOf(Stats.rdev) != GetterType) + @compileLog( + "Expected Stats.rdev to be a getter" + ); + + if (@TypeOf(Stats.size) != GetterType) + @compileLog( + "Expected Stats.size to be a getter" + ); + + if (@TypeOf(Stats.uid) != GetterType) + @compileLog( + "Expected Stats.uid to be a getter" + ); if (!JSC.is_bindgen) { - @export(Stats.atime, .{ .name = "StatsPrototype__atime" }); - @export(Stats.atimeMs, .{ .name = "StatsPrototype__atimeMs" }); - @export(Stats.birthtime, .{ .name = "StatsPrototype__birthtime" }); - @export(Stats.birthtimeMs, .{ .name = "StatsPrototype__birthtimeMs" }); - @export(Stats.blksize, .{ .name = "StatsPrototype__blksize" }); - @export(Stats.blocks, .{ .name = "StatsPrototype__blocks" }); - @export(Stats.constructor, .{ .name = "StatsClass__construct" }); - @export(Stats.ctime, .{ .name = "StatsPrototype__ctime" }); - @export(Stats.ctimeMs, .{ .name = "StatsPrototype__ctimeMs" }); - @export(Stats.dev, .{ .name = "StatsPrototype__dev" }); - @export(Stats.finalize, .{ .name = "StatsClass__finalize" }); - @export(Stats.gid, .{ .name = "StatsPrototype__gid" }); - @export(Stats.ino, .{ .name = "StatsPrototype__ino" }); - @export(Stats.isBlockDevice_, .{ .name = "StatsPrototype__isBlockDevice_" }); - @export(Stats.isBlockDevice_WithoutTypeChecks, .{ .name = "StatsPrototype__isBlockDevice_WithoutTypeChecks" }); - @export(Stats.isCharacterDevice_, .{ .name = "StatsPrototype__isCharacterDevice_" }); - @export(Stats.isCharacterDevice_WithoutTypeChecks, .{ .name = "StatsPrototype__isCharacterDevice_WithoutTypeChecks" }); - @export(Stats.isDirectory_, .{ .name = "StatsPrototype__isDirectory_" }); - @export(Stats.isDirectory_WithoutTypeChecks, .{ .name = "StatsPrototype__isDirectory_WithoutTypeChecks" }); - @export(Stats.isFIFO_, .{ .name = "StatsPrototype__isFIFO_" }); - @export(Stats.isFIFO_WithoutTypeChecks, .{ .name = "StatsPrototype__isFIFO_WithoutTypeChecks" }); - @export(Stats.isFile_, .{ .name = "StatsPrototype__isFile_" }); - @export(Stats.isFile_WithoutTypeChecks, .{ .name = "StatsPrototype__isFile_WithoutTypeChecks" }); - @export(Stats.isSocket_, .{ .name = "StatsPrototype__isSocket_" }); - @export(Stats.isSocket_WithoutTypeChecks, .{ .name = "StatsPrototype__isSocket_WithoutTypeChecks" }); - @export(Stats.isSymbolicLink_, .{ .name = "StatsPrototype__isSymbolicLink_" }); - @export(Stats.isSymbolicLink_WithoutTypeChecks, .{ .name = "StatsPrototype__isSymbolicLink_WithoutTypeChecks" }); - @export(Stats.mode, .{ .name = "StatsPrototype__mode" }); - @export(Stats.mtime, .{ .name = "StatsPrototype__mtime" }); - @export(Stats.mtimeMs, .{ .name = "StatsPrototype__mtimeMs" }); - @export(Stats.nlink, .{ .name = "StatsPrototype__nlink" }); - @export(Stats.rdev, .{ .name = "StatsPrototype__rdev" }); - @export(Stats.size, .{ .name = "StatsPrototype__size" }); - @export(Stats.uid, .{ .name = "StatsPrototype__uid" }); +@export(Stats.atime, .{.name = "StatsPrototype__atime"}); + @export(Stats.atimeMs, .{.name = "StatsPrototype__atimeMs"}); + @export(Stats.birthtime, .{.name = "StatsPrototype__birthtime"}); + @export(Stats.birthtimeMs, .{.name = "StatsPrototype__birthtimeMs"}); + @export(Stats.blksize, .{.name = "StatsPrototype__blksize"}); + @export(Stats.blocks, .{.name = "StatsPrototype__blocks"}); + @export(Stats.constructor, .{.name = "StatsClass__construct"}); + @export(Stats.ctime, .{.name = "StatsPrototype__ctime"}); + @export(Stats.ctimeMs, .{.name = "StatsPrototype__ctimeMs"}); + @export(Stats.dev, .{.name = "StatsPrototype__dev"}); + @export(Stats.finalize, .{.name = "StatsClass__finalize"}); + @export(Stats.gid, .{.name = "StatsPrototype__gid"}); + @export(Stats.ino, .{.name = "StatsPrototype__ino"}); + @export(Stats.isBlockDevice_, .{.name = "StatsPrototype__isBlockDevice_"}); + @export(Stats.isBlockDevice_WithoutTypeChecks, .{.name = "StatsPrototype__isBlockDevice_WithoutTypeChecks"}); + @export(Stats.isCharacterDevice_, .{.name = "StatsPrototype__isCharacterDevice_"}); + @export(Stats.isCharacterDevice_WithoutTypeChecks, .{.name = "StatsPrototype__isCharacterDevice_WithoutTypeChecks"}); + @export(Stats.isDirectory_, .{.name = "StatsPrototype__isDirectory_"}); + @export(Stats.isDirectory_WithoutTypeChecks, .{.name = "StatsPrototype__isDirectory_WithoutTypeChecks"}); + @export(Stats.isFIFO_, .{.name = "StatsPrototype__isFIFO_"}); + @export(Stats.isFIFO_WithoutTypeChecks, .{.name = "StatsPrototype__isFIFO_WithoutTypeChecks"}); + @export(Stats.isFile_, .{.name = "StatsPrototype__isFile_"}); + @export(Stats.isFile_WithoutTypeChecks, .{.name = "StatsPrototype__isFile_WithoutTypeChecks"}); + @export(Stats.isSocket_, .{.name = "StatsPrototype__isSocket_"}); + @export(Stats.isSocket_WithoutTypeChecks, .{.name = "StatsPrototype__isSocket_WithoutTypeChecks"}); + @export(Stats.isSymbolicLink_, .{.name = "StatsPrototype__isSymbolicLink_"}); + @export(Stats.isSymbolicLink_WithoutTypeChecks, .{.name = "StatsPrototype__isSymbolicLink_WithoutTypeChecks"}); + @export(Stats.mode, .{.name = "StatsPrototype__mode"}); + @export(Stats.mtime, .{.name = "StatsPrototype__mtime"}); + @export(Stats.mtimeMs, .{.name = "StatsPrototype__mtimeMs"}); + @export(Stats.nlink, .{.name = "StatsPrototype__nlink"}); + @export(Stats.rdev, .{.name = "StatsPrototype__rdev"}); + @export(Stats.size, .{.name = "StatsPrototype__size"}); + @export(Stats.uid, .{.name = "StatsPrototype__uid"}); } } }; pub const JSSubprocess = struct { const Subprocess = Classes.Subprocess; - const GetterType = fn (*Subprocess, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*Subprocess, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*Subprocess, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*Subprocess, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*Subprocess, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; + const GetterType = fn(*Subprocess, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const GetterTypeWithThisValue = fn(*Subprocess, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const SetterType = fn(*Subprocess, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const SetterTypeWithThisValue = fn(*Subprocess, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const CallbackType = fn(*Subprocess, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; /// Return the pointer to the wrapped object. /// If the object does not match the type, return null. @@ -3140,70 +3813,72 @@ pub const JSSubprocess = struct { extern fn SubprocessPrototype__stderrSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - extern fn SubprocessPrototype__stderrGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `Subprocess.stderr` setter - /// This value will be visited by the garbage collector. - pub fn stderrSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - SubprocessPrototype__stderrSetCachedValue(thisValue, globalObject, value); - } + extern fn SubprocessPrototype__stderrGetCachedValue(JSC.JSValue) JSC.JSValue; + + /// `Subprocess.stderr` setter + /// This value will be visited by the garbage collector. + pub fn stderrSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { + JSC.markBinding(@src()); + SubprocessPrototype__stderrSetCachedValue(thisValue, globalObject, value); + } - /// `Subprocess.stderr` getter - /// This value will be visited by the garbage collector. - pub fn stderrGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = SubprocessPrototype__stderrGetCachedValue(thisValue); - if (result == .zero) + /// `Subprocess.stderr` getter + /// This value will be visited by the garbage collector. + pub fn stderrGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { + JSC.markBinding(@src()); + const result = SubprocessPrototype__stderrGetCachedValue(thisValue); + if (result == .zero) return null; + + return result; + } - return result; - } - - extern fn SubprocessPrototype__stdinSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn SubprocessPrototype__stdinGetCachedValue(JSC.JSValue) JSC.JSValue; +extern fn SubprocessPrototype__stdinSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - /// `Subprocess.stdin` setter - /// This value will be visited by the garbage collector. - pub fn stdinSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - SubprocessPrototype__stdinSetCachedValue(thisValue, globalObject, value); - } + extern fn SubprocessPrototype__stdinGetCachedValue(JSC.JSValue) JSC.JSValue; + + /// `Subprocess.stdin` setter + /// This value will be visited by the garbage collector. + pub fn stdinSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { + JSC.markBinding(@src()); + SubprocessPrototype__stdinSetCachedValue(thisValue, globalObject, value); + } - /// `Subprocess.stdin` getter - /// This value will be visited by the garbage collector. - pub fn stdinGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = SubprocessPrototype__stdinGetCachedValue(thisValue); - if (result == .zero) + /// `Subprocess.stdin` getter + /// This value will be visited by the garbage collector. + pub fn stdinGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { + JSC.markBinding(@src()); + const result = SubprocessPrototype__stdinGetCachedValue(thisValue); + if (result == .zero) return null; + + return result; + } - return result; - } - - extern fn SubprocessPrototype__stdoutSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn SubprocessPrototype__stdoutGetCachedValue(JSC.JSValue) JSC.JSValue; +extern fn SubprocessPrototype__stdoutSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - /// `Subprocess.stdout` setter - /// This value will be visited by the garbage collector. - pub fn stdoutSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - SubprocessPrototype__stdoutSetCachedValue(thisValue, globalObject, value); - } + extern fn SubprocessPrototype__stdoutGetCachedValue(JSC.JSValue) JSC.JSValue; + + /// `Subprocess.stdout` setter + /// This value will be visited by the garbage collector. + pub fn stdoutSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { + JSC.markBinding(@src()); + SubprocessPrototype__stdoutSetCachedValue(thisValue, globalObject, value); + } - /// `Subprocess.stdout` getter - /// This value will be visited by the garbage collector. - pub fn stdoutGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = SubprocessPrototype__stdoutGetCachedValue(thisValue); - if (result == .zero) + /// `Subprocess.stdout` getter + /// This value will be visited by the garbage collector. + pub fn stdoutGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { + JSC.markBinding(@src()); + const result = SubprocessPrototype__stdoutGetCachedValue(thisValue); + if (result == .zero) return null; + + return result; + } - return result; - } + /// Create a new instance of Subprocess pub fn toJS(this: *Subprocess, globalObject: *JSC.JSGlobalObject) JSC.JSValue { JSC.markBinding(@src()); @@ -3218,14 +3893,14 @@ pub const JSSubprocess = struct { /// Modify the internal ptr to point to a new instance of Subprocess. pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*Subprocess) bool { - JSC.markBinding(@src()); - return Subprocess__dangerouslySetPtr(value, ptr); + JSC.markBinding(@src()); + return Subprocess__dangerouslySetPtr(value, ptr); } /// Detach the ptr from the thisValue pub fn detachPtr(_: *Subprocess, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(Subprocess__dangerouslySetPtr(value, null)); + JSC.markBinding(@src()); + std.debug.assert(Subprocess__dangerouslySetPtr(value, null)); } extern fn Subprocess__fromJS(JSC.JSValue) ?*Subprocess; @@ -3236,70 +3911,97 @@ pub const JSSubprocess = struct { extern fn Subprocess__dangerouslySetPtr(JSC.JSValue, ?*Subprocess) bool; comptime { - if (@TypeOf(Subprocess.finalize) != (fn (*Subprocess) callconv(.C) void)) { - @compileLog("Subprocess.finalize is not a finalizer"); + + if (@TypeOf(Subprocess.finalize) != (fn(*Subprocess) callconv(.C) void)) { + @compileLog("Subprocess.finalize is not a finalizer"); } - - if (@TypeOf(Subprocess.getExitCode) != GetterType) - @compileLog("Expected Subprocess.getExitCode to be a getter"); - - if (@TypeOf(Subprocess.getExited) != GetterType) - @compileLog("Expected Subprocess.getExited to be a getter"); - - if (@TypeOf(Subprocess.kill) != CallbackType) - @compileLog("Expected Subprocess.kill to be a callback but received " ++ @typeName(@TypeOf(Subprocess.kill))); - if (@TypeOf(Subprocess.getKilled) != GetterType) - @compileLog("Expected Subprocess.getKilled to be a getter"); - - if (@TypeOf(Subprocess.getPid) != GetterType) - @compileLog("Expected Subprocess.getPid to be a getter"); - - if (@TypeOf(Subprocess.getStdout) != GetterType) - @compileLog("Expected Subprocess.getStdout to be a getter"); - - if (@TypeOf(Subprocess.doRef) != CallbackType) - @compileLog("Expected Subprocess.doRef to be a callback but received " ++ @typeName(@TypeOf(Subprocess.doRef))); - if (@TypeOf(Subprocess.getSignalCode) != GetterType) - @compileLog("Expected Subprocess.getSignalCode to be a getter"); - - if (@TypeOf(Subprocess.getStderr) != GetterType) - @compileLog("Expected Subprocess.getStderr to be a getter"); - - if (@TypeOf(Subprocess.getStdin) != GetterType) - @compileLog("Expected Subprocess.getStdin to be a getter"); - - if (@TypeOf(Subprocess.getStdout) != GetterType) - @compileLog("Expected Subprocess.getStdout to be a getter"); - - if (@TypeOf(Subprocess.doUnref) != CallbackType) - @compileLog("Expected Subprocess.doUnref to be a callback but received " ++ @typeName(@TypeOf(Subprocess.doUnref))); - if (@TypeOf(Subprocess.getStdin) != GetterType) - @compileLog("Expected Subprocess.getStdin to be a getter"); + + if (@TypeOf(Subprocess.getExitCode) != GetterType) + @compileLog( + "Expected Subprocess.getExitCode to be a getter" + ); + + if (@TypeOf(Subprocess.getExited) != GetterType) + @compileLog( + "Expected Subprocess.getExited to be a getter" + ); + + if (@TypeOf(Subprocess.kill) != CallbackType) + @compileLog( + "Expected Subprocess.kill to be a callback but received " ++ @typeName(@TypeOf(Subprocess.kill)) + ); + if (@TypeOf(Subprocess.getKilled) != GetterType) + @compileLog( + "Expected Subprocess.getKilled to be a getter" + ); + + if (@TypeOf(Subprocess.getPid) != GetterType) + @compileLog( + "Expected Subprocess.getPid to be a getter" + ); + + if (@TypeOf(Subprocess.getStdout) != GetterType) + @compileLog( + "Expected Subprocess.getStdout to be a getter" + ); + + if (@TypeOf(Subprocess.doRef) != CallbackType) + @compileLog( + "Expected Subprocess.doRef to be a callback but received " ++ @typeName(@TypeOf(Subprocess.doRef)) + ); + if (@TypeOf(Subprocess.getSignalCode) != GetterType) + @compileLog( + "Expected Subprocess.getSignalCode to be a getter" + ); + + if (@TypeOf(Subprocess.getStderr) != GetterType) + @compileLog( + "Expected Subprocess.getStderr to be a getter" + ); + + if (@TypeOf(Subprocess.getStdin) != GetterType) + @compileLog( + "Expected Subprocess.getStdin to be a getter" + ); + + if (@TypeOf(Subprocess.getStdout) != GetterType) + @compileLog( + "Expected Subprocess.getStdout to be a getter" + ); + + if (@TypeOf(Subprocess.doUnref) != CallbackType) + @compileLog( + "Expected Subprocess.doUnref to be a callback but received " ++ @typeName(@TypeOf(Subprocess.doUnref)) + ); + if (@TypeOf(Subprocess.getStdin) != GetterType) + @compileLog( + "Expected Subprocess.getStdin to be a getter" + ); if (!JSC.is_bindgen) { - @export(Subprocess.doRef, .{ .name = "SubprocessPrototype__doRef" }); - @export(Subprocess.doUnref, .{ .name = "SubprocessPrototype__doUnref" }); - @export(Subprocess.finalize, .{ .name = "SubprocessClass__finalize" }); - @export(Subprocess.getExitCode, .{ .name = "SubprocessPrototype__getExitCode" }); - @export(Subprocess.getExited, .{ .name = "SubprocessPrototype__getExited" }); - @export(Subprocess.getKilled, .{ .name = "SubprocessPrototype__getKilled" }); - @export(Subprocess.getPid, .{ .name = "SubprocessPrototype__getPid" }); - @export(Subprocess.getSignalCode, .{ .name = "SubprocessPrototype__getSignalCode" }); - @export(Subprocess.getStderr, .{ .name = "SubprocessPrototype__getStderr" }); - @export(Subprocess.getStdin, .{ .name = "SubprocessPrototype__getStdin" }); - @export(Subprocess.getStdout, .{ .name = "SubprocessPrototype__getStdout" }); - @export(Subprocess.hasPendingActivity, .{ .name = "Subprocess__hasPendingActivity" }); - @export(Subprocess.kill, .{ .name = "SubprocessPrototype__kill" }); +@export(Subprocess.doRef, .{.name = "SubprocessPrototype__doRef"}); + @export(Subprocess.doUnref, .{.name = "SubprocessPrototype__doUnref"}); + @export(Subprocess.finalize, .{.name = "SubprocessClass__finalize"}); + @export(Subprocess.getExitCode, .{.name = "SubprocessPrototype__getExitCode"}); + @export(Subprocess.getExited, .{.name = "SubprocessPrototype__getExited"}); + @export(Subprocess.getKilled, .{.name = "SubprocessPrototype__getKilled"}); + @export(Subprocess.getPid, .{.name = "SubprocessPrototype__getPid"}); + @export(Subprocess.getSignalCode, .{.name = "SubprocessPrototype__getSignalCode"}); + @export(Subprocess.getStderr, .{.name = "SubprocessPrototype__getStderr"}); + @export(Subprocess.getStdin, .{.name = "SubprocessPrototype__getStdin"}); + @export(Subprocess.getStdout, .{.name = "SubprocessPrototype__getStdout"}); + @export(Subprocess.hasPendingActivity, .{.name = "Subprocess__hasPendingActivity"}); + @export(Subprocess.kill, .{.name = "SubprocessPrototype__kill"}); } } }; pub const JSTCPSocket = struct { const TCPSocket = Classes.TCPSocket; - const GetterType = fn (*TCPSocket, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*TCPSocket, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*TCPSocket, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*TCPSocket, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*TCPSocket, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; + const GetterType = fn(*TCPSocket, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const GetterTypeWithThisValue = fn(*TCPSocket, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const SetterType = fn(*TCPSocket, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const SetterTypeWithThisValue = fn(*TCPSocket, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const CallbackType = fn(*TCPSocket, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; /// Return the pointer to the wrapped object. /// If the object does not match the type, return null. @@ -3310,48 +4012,50 @@ pub const JSTCPSocket = struct { extern fn TCPSocketPrototype__dataSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - extern fn TCPSocketPrototype__dataGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `TCPSocket.data` setter - /// This value will be visited by the garbage collector. - pub fn dataSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - TCPSocketPrototype__dataSetCachedValue(thisValue, globalObject, value); - } + extern fn TCPSocketPrototype__dataGetCachedValue(JSC.JSValue) JSC.JSValue; + + /// `TCPSocket.data` setter + /// This value will be visited by the garbage collector. + pub fn dataSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { + JSC.markBinding(@src()); + TCPSocketPrototype__dataSetCachedValue(thisValue, globalObject, value); + } - /// `TCPSocket.data` getter - /// This value will be visited by the garbage collector. - pub fn dataGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = TCPSocketPrototype__dataGetCachedValue(thisValue); - if (result == .zero) + /// `TCPSocket.data` getter + /// This value will be visited by the garbage collector. + pub fn dataGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { + JSC.markBinding(@src()); + const result = TCPSocketPrototype__dataGetCachedValue(thisValue); + if (result == .zero) return null; + + return result; + } - return result; - } - - extern fn TCPSocketPrototype__remoteAddressSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn TCPSocketPrototype__remoteAddressGetCachedValue(JSC.JSValue) JSC.JSValue; +extern fn TCPSocketPrototype__remoteAddressSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - /// `TCPSocket.remoteAddress` setter - /// This value will be visited by the garbage collector. - pub fn remoteAddressSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - TCPSocketPrototype__remoteAddressSetCachedValue(thisValue, globalObject, value); - } + extern fn TCPSocketPrototype__remoteAddressGetCachedValue(JSC.JSValue) JSC.JSValue; + + /// `TCPSocket.remoteAddress` setter + /// This value will be visited by the garbage collector. + pub fn remoteAddressSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { + JSC.markBinding(@src()); + TCPSocketPrototype__remoteAddressSetCachedValue(thisValue, globalObject, value); + } - /// `TCPSocket.remoteAddress` getter - /// This value will be visited by the garbage collector. - pub fn remoteAddressGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = TCPSocketPrototype__remoteAddressGetCachedValue(thisValue); - if (result == .zero) + /// `TCPSocket.remoteAddress` getter + /// This value will be visited by the garbage collector. + pub fn remoteAddressGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { + JSC.markBinding(@src()); + const result = TCPSocketPrototype__remoteAddressGetCachedValue(thisValue); + if (result == .zero) return null; + + return result; + } - return result; - } + /// Create a new instance of TCPSocket pub fn toJS(this: *TCPSocket, globalObject: *JSC.JSGlobalObject) JSC.JSValue { JSC.markBinding(@src()); @@ -3366,14 +4070,14 @@ pub const JSTCPSocket = struct { /// Modify the internal ptr to point to a new instance of TCPSocket. pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*TCPSocket) bool { - JSC.markBinding(@src()); - return TCPSocket__dangerouslySetPtr(value, ptr); + JSC.markBinding(@src()); + return TCPSocket__dangerouslySetPtr(value, ptr); } /// Detach the ptr from the thisValue pub fn detachPtr(_: *TCPSocket, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(TCPSocket__dangerouslySetPtr(value, null)); + JSC.markBinding(@src()); + std.debug.assert(TCPSocket__dangerouslySetPtr(value, null)); } extern fn TCPSocket__fromJS(JSC.JSValue) ?*TCPSocket; @@ -3384,70 +4088,110 @@ pub const JSTCPSocket = struct { extern fn TCPSocket__dangerouslySetPtr(JSC.JSValue, ?*TCPSocket) bool; comptime { - if (@TypeOf(TCPSocket.finalize) != (fn (*TCPSocket) callconv(.C) void)) { - @compileLog("TCPSocket.finalize is not a finalizer"); - } - - if (@TypeOf(TCPSocket.getData) != GetterType) - @compileLog("Expected TCPSocket.getData to be a getter"); - - if (@TypeOf(TCPSocket.setData) != SetterType) - @compileLog("Expected TCPSocket.setData to be a setter"); - if (@TypeOf(TCPSocket.end) != CallbackType) - @compileLog("Expected TCPSocket.end to be a callback but received " ++ @typeName(@TypeOf(TCPSocket.end))); - if (@TypeOf(TCPSocket.flush) != CallbackType) - @compileLog("Expected TCPSocket.flush to be a callback but received " ++ @typeName(@TypeOf(TCPSocket.flush))); - if (@TypeOf(TCPSocket.getListener) != GetterType) - @compileLog("Expected TCPSocket.getListener to be a getter"); - - if (@TypeOf(TCPSocket.getLocalPort) != GetterType) - @compileLog("Expected TCPSocket.getLocalPort to be a getter"); - - if (@TypeOf(TCPSocket.getReadyState) != GetterType) - @compileLog("Expected TCPSocket.getReadyState to be a getter"); - - if (@TypeOf(TCPSocket.ref) != CallbackType) - @compileLog("Expected TCPSocket.ref to be a callback but received " ++ @typeName(@TypeOf(TCPSocket.ref))); - if (@TypeOf(TCPSocket.reload) != CallbackType) - @compileLog("Expected TCPSocket.reload to be a callback but received " ++ @typeName(@TypeOf(TCPSocket.reload))); - if (@TypeOf(TCPSocket.getRemoteAddress) != GetterType) - @compileLog("Expected TCPSocket.getRemoteAddress to be a getter"); - - if (@TypeOf(TCPSocket.shutdown) != CallbackType) - @compileLog("Expected TCPSocket.shutdown to be a callback but received " ++ @typeName(@TypeOf(TCPSocket.shutdown))); - if (@TypeOf(TCPSocket.timeout) != CallbackType) - @compileLog("Expected TCPSocket.timeout to be a callback but received " ++ @typeName(@TypeOf(TCPSocket.timeout))); - if (@TypeOf(TCPSocket.unref) != CallbackType) - @compileLog("Expected TCPSocket.unref to be a callback but received " ++ @typeName(@TypeOf(TCPSocket.unref))); - if (@TypeOf(TCPSocket.write) != CallbackType) - @compileLog("Expected TCPSocket.write to be a callback but received " ++ @typeName(@TypeOf(TCPSocket.write))); + + if (@TypeOf(TCPSocket.finalize) != (fn(*TCPSocket) callconv(.C) void)) { + @compileLog("TCPSocket.finalize is not a finalizer"); + } + + if (@TypeOf(TCPSocket.getAuthorized) != GetterType) + @compileLog( + "Expected TCPSocket.getAuthorized to be a getter" + ); + + if (@TypeOf(TCPSocket.getData) != GetterType) + @compileLog( + "Expected TCPSocket.getData to be a getter" + ); + + if (@TypeOf(TCPSocket.setData) != SetterType) + @compileLog( + "Expected TCPSocket.setData to be a setter" + ); + if (@TypeOf(TCPSocket.end) != CallbackType) + @compileLog( + "Expected TCPSocket.end to be a callback but received " ++ @typeName(@TypeOf(TCPSocket.end)) + ); + if (@TypeOf(TCPSocket.flush) != CallbackType) + @compileLog( + "Expected TCPSocket.flush to be a callback but received " ++ @typeName(@TypeOf(TCPSocket.flush)) + ); + if (@TypeOf(TCPSocket.getAuthorizationError) != CallbackType) + @compileLog( + "Expected TCPSocket.getAuthorizationError to be a callback but received " ++ @typeName(@TypeOf(TCPSocket.getAuthorizationError)) + ); + if (@TypeOf(TCPSocket.getListener) != GetterType) + @compileLog( + "Expected TCPSocket.getListener to be a getter" + ); + + if (@TypeOf(TCPSocket.getLocalPort) != GetterType) + @compileLog( + "Expected TCPSocket.getLocalPort to be a getter" + ); + + if (@TypeOf(TCPSocket.getReadyState) != GetterType) + @compileLog( + "Expected TCPSocket.getReadyState to be a getter" + ); + + if (@TypeOf(TCPSocket.ref) != CallbackType) + @compileLog( + "Expected TCPSocket.ref to be a callback but received " ++ @typeName(@TypeOf(TCPSocket.ref)) + ); + if (@TypeOf(TCPSocket.reload) != CallbackType) + @compileLog( + "Expected TCPSocket.reload to be a callback but received " ++ @typeName(@TypeOf(TCPSocket.reload)) + ); + if (@TypeOf(TCPSocket.getRemoteAddress) != GetterType) + @compileLog( + "Expected TCPSocket.getRemoteAddress to be a getter" + ); + + if (@TypeOf(TCPSocket.shutdown) != CallbackType) + @compileLog( + "Expected TCPSocket.shutdown to be a callback but received " ++ @typeName(@TypeOf(TCPSocket.shutdown)) + ); + if (@TypeOf(TCPSocket.timeout) != CallbackType) + @compileLog( + "Expected TCPSocket.timeout to be a callback but received " ++ @typeName(@TypeOf(TCPSocket.timeout)) + ); + if (@TypeOf(TCPSocket.unref) != CallbackType) + @compileLog( + "Expected TCPSocket.unref to be a callback but received " ++ @typeName(@TypeOf(TCPSocket.unref)) + ); + if (@TypeOf(TCPSocket.write) != CallbackType) + @compileLog( + "Expected TCPSocket.write to be a callback but received " ++ @typeName(@TypeOf(TCPSocket.write)) + ); if (!JSC.is_bindgen) { - @export(TCPSocket.end, .{ .name = "TCPSocketPrototype__end" }); - @export(TCPSocket.finalize, .{ .name = "TCPSocketClass__finalize" }); - @export(TCPSocket.flush, .{ .name = "TCPSocketPrototype__flush" }); - @export(TCPSocket.getData, .{ .name = "TCPSocketPrototype__getData" }); - @export(TCPSocket.getListener, .{ .name = "TCPSocketPrototype__getListener" }); - @export(TCPSocket.getLocalPort, .{ .name = "TCPSocketPrototype__getLocalPort" }); - @export(TCPSocket.getReadyState, .{ .name = "TCPSocketPrototype__getReadyState" }); - @export(TCPSocket.getRemoteAddress, .{ .name = "TCPSocketPrototype__getRemoteAddress" }); - @export(TCPSocket.hasPendingActivity, .{ .name = "TCPSocket__hasPendingActivity" }); - @export(TCPSocket.ref, .{ .name = "TCPSocketPrototype__ref" }); - @export(TCPSocket.reload, .{ .name = "TCPSocketPrototype__reload" }); - @export(TCPSocket.setData, .{ .name = "TCPSocketPrototype__setData" }); - @export(TCPSocket.shutdown, .{ .name = "TCPSocketPrototype__shutdown" }); - @export(TCPSocket.timeout, .{ .name = "TCPSocketPrototype__timeout" }); - @export(TCPSocket.unref, .{ .name = "TCPSocketPrototype__unref" }); - @export(TCPSocket.write, .{ .name = "TCPSocketPrototype__write" }); +@export(TCPSocket.end, .{.name = "TCPSocketPrototype__end"}); + @export(TCPSocket.finalize, .{.name = "TCPSocketClass__finalize"}); + @export(TCPSocket.flush, .{.name = "TCPSocketPrototype__flush"}); + @export(TCPSocket.getAuthorizationError, .{.name = "TCPSocketPrototype__getAuthorizationError"}); + @export(TCPSocket.getAuthorized, .{.name = "TCPSocketPrototype__getAuthorized"}); + @export(TCPSocket.getData, .{.name = "TCPSocketPrototype__getData"}); + @export(TCPSocket.getListener, .{.name = "TCPSocketPrototype__getListener"}); + @export(TCPSocket.getLocalPort, .{.name = "TCPSocketPrototype__getLocalPort"}); + @export(TCPSocket.getReadyState, .{.name = "TCPSocketPrototype__getReadyState"}); + @export(TCPSocket.getRemoteAddress, .{.name = "TCPSocketPrototype__getRemoteAddress"}); + @export(TCPSocket.hasPendingActivity, .{.name = "TCPSocket__hasPendingActivity"}); + @export(TCPSocket.ref, .{.name = "TCPSocketPrototype__ref"}); + @export(TCPSocket.reload, .{.name = "TCPSocketPrototype__reload"}); + @export(TCPSocket.setData, .{.name = "TCPSocketPrototype__setData"}); + @export(TCPSocket.shutdown, .{.name = "TCPSocketPrototype__shutdown"}); + @export(TCPSocket.timeout, .{.name = "TCPSocketPrototype__timeout"}); + @export(TCPSocket.unref, .{.name = "TCPSocketPrototype__unref"}); + @export(TCPSocket.write, .{.name = "TCPSocketPrototype__write"}); } } }; pub const JSTLSSocket = struct { const TLSSocket = Classes.TLSSocket; - const GetterType = fn (*TLSSocket, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*TLSSocket, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*TLSSocket, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*TLSSocket, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*TLSSocket, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; + const GetterType = fn(*TLSSocket, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const GetterTypeWithThisValue = fn(*TLSSocket, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const SetterType = fn(*TLSSocket, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const SetterTypeWithThisValue = fn(*TLSSocket, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const CallbackType = fn(*TLSSocket, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; /// Return the pointer to the wrapped object. /// If the object does not match the type, return null. @@ -3458,48 +4202,50 @@ pub const JSTLSSocket = struct { extern fn TLSSocketPrototype__dataSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - extern fn TLSSocketPrototype__dataGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `TLSSocket.data` setter - /// This value will be visited by the garbage collector. - pub fn dataSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - TLSSocketPrototype__dataSetCachedValue(thisValue, globalObject, value); - } + extern fn TLSSocketPrototype__dataGetCachedValue(JSC.JSValue) JSC.JSValue; + + /// `TLSSocket.data` setter + /// This value will be visited by the garbage collector. + pub fn dataSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { + JSC.markBinding(@src()); + TLSSocketPrototype__dataSetCachedValue(thisValue, globalObject, value); + } - /// `TLSSocket.data` getter - /// This value will be visited by the garbage collector. - pub fn dataGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = TLSSocketPrototype__dataGetCachedValue(thisValue); - if (result == .zero) + /// `TLSSocket.data` getter + /// This value will be visited by the garbage collector. + pub fn dataGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { + JSC.markBinding(@src()); + const result = TLSSocketPrototype__dataGetCachedValue(thisValue); + if (result == .zero) return null; + + return result; + } - return result; - } - - extern fn TLSSocketPrototype__remoteAddressSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - extern fn TLSSocketPrototype__remoteAddressGetCachedValue(JSC.JSValue) JSC.JSValue; +extern fn TLSSocketPrototype__remoteAddressSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - /// `TLSSocket.remoteAddress` setter - /// This value will be visited by the garbage collector. - pub fn remoteAddressSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - TLSSocketPrototype__remoteAddressSetCachedValue(thisValue, globalObject, value); - } + extern fn TLSSocketPrototype__remoteAddressGetCachedValue(JSC.JSValue) JSC.JSValue; + + /// `TLSSocket.remoteAddress` setter + /// This value will be visited by the garbage collector. + pub fn remoteAddressSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { + JSC.markBinding(@src()); + TLSSocketPrototype__remoteAddressSetCachedValue(thisValue, globalObject, value); + } - /// `TLSSocket.remoteAddress` getter - /// This value will be visited by the garbage collector. - pub fn remoteAddressGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = TLSSocketPrototype__remoteAddressGetCachedValue(thisValue); - if (result == .zero) + /// `TLSSocket.remoteAddress` getter + /// This value will be visited by the garbage collector. + pub fn remoteAddressGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { + JSC.markBinding(@src()); + const result = TLSSocketPrototype__remoteAddressGetCachedValue(thisValue); + if (result == .zero) return null; + + return result; + } - return result; - } + /// Create a new instance of TLSSocket pub fn toJS(this: *TLSSocket, globalObject: *JSC.JSGlobalObject) JSC.JSValue { JSC.markBinding(@src()); @@ -3514,14 +4260,14 @@ pub const JSTLSSocket = struct { /// Modify the internal ptr to point to a new instance of TLSSocket. pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*TLSSocket) bool { - JSC.markBinding(@src()); - return TLSSocket__dangerouslySetPtr(value, ptr); + JSC.markBinding(@src()); + return TLSSocket__dangerouslySetPtr(value, ptr); } /// Detach the ptr from the thisValue pub fn detachPtr(_: *TLSSocket, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(TLSSocket__dangerouslySetPtr(value, null)); + JSC.markBinding(@src()); + std.debug.assert(TLSSocket__dangerouslySetPtr(value, null)); } extern fn TLSSocket__fromJS(JSC.JSValue) ?*TLSSocket; @@ -3532,70 +4278,110 @@ pub const JSTLSSocket = struct { extern fn TLSSocket__dangerouslySetPtr(JSC.JSValue, ?*TLSSocket) bool; comptime { - if (@TypeOf(TLSSocket.finalize) != (fn (*TLSSocket) callconv(.C) void)) { - @compileLog("TLSSocket.finalize is not a finalizer"); - } - - if (@TypeOf(TLSSocket.getData) != GetterType) - @compileLog("Expected TLSSocket.getData to be a getter"); - - if (@TypeOf(TLSSocket.setData) != SetterType) - @compileLog("Expected TLSSocket.setData to be a setter"); - if (@TypeOf(TLSSocket.end) != CallbackType) - @compileLog("Expected TLSSocket.end to be a callback but received " ++ @typeName(@TypeOf(TLSSocket.end))); - if (@TypeOf(TLSSocket.flush) != CallbackType) - @compileLog("Expected TLSSocket.flush to be a callback but received " ++ @typeName(@TypeOf(TLSSocket.flush))); - if (@TypeOf(TLSSocket.getListener) != GetterType) - @compileLog("Expected TLSSocket.getListener to be a getter"); - - if (@TypeOf(TLSSocket.getLocalPort) != GetterType) - @compileLog("Expected TLSSocket.getLocalPort to be a getter"); - - if (@TypeOf(TLSSocket.getReadyState) != GetterType) - @compileLog("Expected TLSSocket.getReadyState to be a getter"); - - if (@TypeOf(TLSSocket.ref) != CallbackType) - @compileLog("Expected TLSSocket.ref to be a callback but received " ++ @typeName(@TypeOf(TLSSocket.ref))); - if (@TypeOf(TLSSocket.reload) != CallbackType) - @compileLog("Expected TLSSocket.reload to be a callback but received " ++ @typeName(@TypeOf(TLSSocket.reload))); - if (@TypeOf(TLSSocket.getRemoteAddress) != GetterType) - @compileLog("Expected TLSSocket.getRemoteAddress to be a getter"); - - if (@TypeOf(TLSSocket.shutdown) != CallbackType) - @compileLog("Expected TLSSocket.shutdown to be a callback but received " ++ @typeName(@TypeOf(TLSSocket.shutdown))); - if (@TypeOf(TLSSocket.timeout) != CallbackType) - @compileLog("Expected TLSSocket.timeout to be a callback but received " ++ @typeName(@TypeOf(TLSSocket.timeout))); - if (@TypeOf(TLSSocket.unref) != CallbackType) - @compileLog("Expected TLSSocket.unref to be a callback but received " ++ @typeName(@TypeOf(TLSSocket.unref))); - if (@TypeOf(TLSSocket.write) != CallbackType) - @compileLog("Expected TLSSocket.write to be a callback but received " ++ @typeName(@TypeOf(TLSSocket.write))); + + if (@TypeOf(TLSSocket.finalize) != (fn(*TLSSocket) callconv(.C) void)) { + @compileLog("TLSSocket.finalize is not a finalizer"); + } + + if (@TypeOf(TLSSocket.getAuthorized) != GetterType) + @compileLog( + "Expected TLSSocket.getAuthorized to be a getter" + ); + + if (@TypeOf(TLSSocket.getData) != GetterType) + @compileLog( + "Expected TLSSocket.getData to be a getter" + ); + + if (@TypeOf(TLSSocket.setData) != SetterType) + @compileLog( + "Expected TLSSocket.setData to be a setter" + ); + if (@TypeOf(TLSSocket.end) != CallbackType) + @compileLog( + "Expected TLSSocket.end to be a callback but received " ++ @typeName(@TypeOf(TLSSocket.end)) + ); + if (@TypeOf(TLSSocket.flush) != CallbackType) + @compileLog( + "Expected TLSSocket.flush to be a callback but received " ++ @typeName(@TypeOf(TLSSocket.flush)) + ); + if (@TypeOf(TLSSocket.getAuthorizationError) != CallbackType) + @compileLog( + "Expected TLSSocket.getAuthorizationError to be a callback but received " ++ @typeName(@TypeOf(TLSSocket.getAuthorizationError)) + ); + if (@TypeOf(TLSSocket.getListener) != GetterType) + @compileLog( + "Expected TLSSocket.getListener to be a getter" + ); + + if (@TypeOf(TLSSocket.getLocalPort) != GetterType) + @compileLog( + "Expected TLSSocket.getLocalPort to be a getter" + ); + + if (@TypeOf(TLSSocket.getReadyState) != GetterType) + @compileLog( + "Expected TLSSocket.getReadyState to be a getter" + ); + + if (@TypeOf(TLSSocket.ref) != CallbackType) + @compileLog( + "Expected TLSSocket.ref to be a callback but received " ++ @typeName(@TypeOf(TLSSocket.ref)) + ); + if (@TypeOf(TLSSocket.reload) != CallbackType) + @compileLog( + "Expected TLSSocket.reload to be a callback but received " ++ @typeName(@TypeOf(TLSSocket.reload)) + ); + if (@TypeOf(TLSSocket.getRemoteAddress) != GetterType) + @compileLog( + "Expected TLSSocket.getRemoteAddress to be a getter" + ); + + if (@TypeOf(TLSSocket.shutdown) != CallbackType) + @compileLog( + "Expected TLSSocket.shutdown to be a callback but received " ++ @typeName(@TypeOf(TLSSocket.shutdown)) + ); + if (@TypeOf(TLSSocket.timeout) != CallbackType) + @compileLog( + "Expected TLSSocket.timeout to be a callback but received " ++ @typeName(@TypeOf(TLSSocket.timeout)) + ); + if (@TypeOf(TLSSocket.unref) != CallbackType) + @compileLog( + "Expected TLSSocket.unref to be a callback but received " ++ @typeName(@TypeOf(TLSSocket.unref)) + ); + if (@TypeOf(TLSSocket.write) != CallbackType) + @compileLog( + "Expected TLSSocket.write to be a callback but received " ++ @typeName(@TypeOf(TLSSocket.write)) + ); if (!JSC.is_bindgen) { - @export(TLSSocket.end, .{ .name = "TLSSocketPrototype__end" }); - @export(TLSSocket.finalize, .{ .name = "TLSSocketClass__finalize" }); - @export(TLSSocket.flush, .{ .name = "TLSSocketPrototype__flush" }); - @export(TLSSocket.getData, .{ .name = "TLSSocketPrototype__getData" }); - @export(TLSSocket.getListener, .{ .name = "TLSSocketPrototype__getListener" }); - @export(TLSSocket.getLocalPort, .{ .name = "TLSSocketPrototype__getLocalPort" }); - @export(TLSSocket.getReadyState, .{ .name = "TLSSocketPrototype__getReadyState" }); - @export(TLSSocket.getRemoteAddress, .{ .name = "TLSSocketPrototype__getRemoteAddress" }); - @export(TLSSocket.hasPendingActivity, .{ .name = "TLSSocket__hasPendingActivity" }); - @export(TLSSocket.ref, .{ .name = "TLSSocketPrototype__ref" }); - @export(TLSSocket.reload, .{ .name = "TLSSocketPrototype__reload" }); - @export(TLSSocket.setData, .{ .name = "TLSSocketPrototype__setData" }); - @export(TLSSocket.shutdown, .{ .name = "TLSSocketPrototype__shutdown" }); - @export(TLSSocket.timeout, .{ .name = "TLSSocketPrototype__timeout" }); - @export(TLSSocket.unref, .{ .name = "TLSSocketPrototype__unref" }); - @export(TLSSocket.write, .{ .name = "TLSSocketPrototype__write" }); +@export(TLSSocket.end, .{.name = "TLSSocketPrototype__end"}); + @export(TLSSocket.finalize, .{.name = "TLSSocketClass__finalize"}); + @export(TLSSocket.flush, .{.name = "TLSSocketPrototype__flush"}); + @export(TLSSocket.getAuthorizationError, .{.name = "TLSSocketPrototype__getAuthorizationError"}); + @export(TLSSocket.getAuthorized, .{.name = "TLSSocketPrototype__getAuthorized"}); + @export(TLSSocket.getData, .{.name = "TLSSocketPrototype__getData"}); + @export(TLSSocket.getListener, .{.name = "TLSSocketPrototype__getListener"}); + @export(TLSSocket.getLocalPort, .{.name = "TLSSocketPrototype__getLocalPort"}); + @export(TLSSocket.getReadyState, .{.name = "TLSSocketPrototype__getReadyState"}); + @export(TLSSocket.getRemoteAddress, .{.name = "TLSSocketPrototype__getRemoteAddress"}); + @export(TLSSocket.hasPendingActivity, .{.name = "TLSSocket__hasPendingActivity"}); + @export(TLSSocket.ref, .{.name = "TLSSocketPrototype__ref"}); + @export(TLSSocket.reload, .{.name = "TLSSocketPrototype__reload"}); + @export(TLSSocket.setData, .{.name = "TLSSocketPrototype__setData"}); + @export(TLSSocket.shutdown, .{.name = "TLSSocketPrototype__shutdown"}); + @export(TLSSocket.timeout, .{.name = "TLSSocketPrototype__timeout"}); + @export(TLSSocket.unref, .{.name = "TLSSocketPrototype__unref"}); + @export(TLSSocket.write, .{.name = "TLSSocketPrototype__write"}); } } }; pub const JSTextDecoder = struct { const TextDecoder = Classes.TextDecoder; - const GetterType = fn (*TextDecoder, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*TextDecoder, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*TextDecoder, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*TextDecoder, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*TextDecoder, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; + const GetterType = fn(*TextDecoder, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const GetterTypeWithThisValue = fn(*TextDecoder, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const SetterType = fn(*TextDecoder, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const SetterTypeWithThisValue = fn(*TextDecoder, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const CallbackType = fn(*TextDecoder, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; /// Return the pointer to the wrapped object. /// If the object does not match the type, return null. @@ -3606,33 +4392,35 @@ pub const JSTextDecoder = struct { extern fn TextDecoderPrototype__encodingSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - extern fn TextDecoderPrototype__encodingGetCachedValue(JSC.JSValue) JSC.JSValue; - - /// `TextDecoder.encoding` setter - /// This value will be visited by the garbage collector. - pub fn encodingSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { - JSC.markBinding(@src()); - TextDecoderPrototype__encodingSetCachedValue(thisValue, globalObject, value); - } + extern fn TextDecoderPrototype__encodingGetCachedValue(JSC.JSValue) JSC.JSValue; + + /// `TextDecoder.encoding` setter + /// This value will be visited by the garbage collector. + pub fn encodingSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { + JSC.markBinding(@src()); + TextDecoderPrototype__encodingSetCachedValue(thisValue, globalObject, value); + } - /// `TextDecoder.encoding` getter - /// This value will be visited by the garbage collector. - pub fn encodingGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { - JSC.markBinding(@src()); - const result = TextDecoderPrototype__encodingGetCachedValue(thisValue); - if (result == .zero) + /// `TextDecoder.encoding` getter + /// This value will be visited by the garbage collector. + pub fn encodingGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { + JSC.markBinding(@src()); + const result = TextDecoderPrototype__encodingGetCachedValue(thisValue); + if (result == .zero) return null; + + return result; + } - return result; - } + /// Get the TextDecoder constructor value. /// This loads lazily from the global object. pub fn getConstructor(globalObject: *JSC.JSGlobalObject) JSC.JSValue { JSC.markBinding(@src()); return TextDecoder__getConstructor(globalObject); } - + /// Create a new instance of TextDecoder pub fn toJS(this: *TextDecoder, globalObject: *JSC.JSGlobalObject) JSC.JSValue { JSC.markBinding(@src()); @@ -3647,14 +4435,14 @@ pub const JSTextDecoder = struct { /// Modify the internal ptr to point to a new instance of TextDecoder. pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*TextDecoder) bool { - JSC.markBinding(@src()); - return TextDecoder__dangerouslySetPtr(value, ptr); + JSC.markBinding(@src()); + return TextDecoder__dangerouslySetPtr(value, ptr); } /// Detach the ptr from the thisValue pub fn detachPtr(_: *TextDecoder, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(TextDecoder__dangerouslySetPtr(value, null)); + JSC.markBinding(@src()); + std.debug.assert(TextDecoder__dangerouslySetPtr(value, null)); } extern fn TextDecoder__fromJS(JSC.JSValue) ?*TextDecoder; @@ -3665,41 +4453,50 @@ pub const JSTextDecoder = struct { extern fn TextDecoder__dangerouslySetPtr(JSC.JSValue, ?*TextDecoder) bool; comptime { - if (@TypeOf(TextDecoder.constructor) != (fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*TextDecoder)) { - @compileLog("TextDecoder.constructor is not a constructor"); + + if (@TypeOf(TextDecoder.constructor) != (fn(*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*TextDecoder)) { + @compileLog("TextDecoder.constructor is not a constructor"); } - - if (@TypeOf(TextDecoder.finalize) != (fn (*TextDecoder) callconv(.C) void)) { - @compileLog("TextDecoder.finalize is not a finalizer"); + + if (@TypeOf(TextDecoder.finalize) != (fn(*TextDecoder) callconv(.C) void)) { + @compileLog("TextDecoder.finalize is not a finalizer"); } - - if (@TypeOf(TextDecoder.decodeWithoutTypeChecks) != fn (*TextDecoder, *JSC.JSGlobalObject, *JSC.JSUint8Array) callconv(.C) JSC.JSValue) - @compileLog("Expected TextDecoder.decodeWithoutTypeChecks to be a DOMJIT function"); - if (@TypeOf(TextDecoder.decode) != CallbackType) - @compileLog("Expected TextDecoder.decode to be a callback but received " ++ @typeName(@TypeOf(TextDecoder.decode))); - if (@TypeOf(TextDecoder.getEncoding) != GetterType) - @compileLog("Expected TextDecoder.getEncoding to be a getter"); - - if (@TypeOf(TextDecoder.getFatal) != GetterType) - @compileLog("Expected TextDecoder.getFatal to be a getter"); + + if (@TypeOf(TextDecoder.decodeWithoutTypeChecks) != fn (*TextDecoder, *JSC.JSGlobalObject, *JSC.JSUint8Array) callconv(.C) JSC.JSValue) + @compileLog( + "Expected TextDecoder.decodeWithoutTypeChecks to be a DOMJIT function" + ); + if (@TypeOf(TextDecoder.decode) != CallbackType) + @compileLog( + "Expected TextDecoder.decode to be a callback but received " ++ @typeName(@TypeOf(TextDecoder.decode)) + ); + if (@TypeOf(TextDecoder.getEncoding) != GetterType) + @compileLog( + "Expected TextDecoder.getEncoding to be a getter" + ); + + if (@TypeOf(TextDecoder.getFatal) != GetterType) + @compileLog( + "Expected TextDecoder.getFatal to be a getter" + ); if (!JSC.is_bindgen) { - @export(TextDecoder.constructor, .{ .name = "TextDecoderClass__construct" }); - @export(TextDecoder.decode, .{ .name = "TextDecoderPrototype__decode" }); - @export(TextDecoder.decodeWithoutTypeChecks, .{ .name = "TextDecoderPrototype__decodeWithoutTypeChecks" }); - @export(TextDecoder.finalize, .{ .name = "TextDecoderClass__finalize" }); - @export(TextDecoder.getEncoding, .{ .name = "TextDecoderPrototype__getEncoding" }); - @export(TextDecoder.getFatal, .{ .name = "TextDecoderPrototype__getFatal" }); +@export(TextDecoder.constructor, .{.name = "TextDecoderClass__construct"}); + @export(TextDecoder.decode, .{.name = "TextDecoderPrototype__decode"}); + @export(TextDecoder.decodeWithoutTypeChecks, .{.name = "TextDecoderPrototype__decodeWithoutTypeChecks"}); + @export(TextDecoder.finalize, .{.name = "TextDecoderClass__finalize"}); + @export(TextDecoder.getEncoding, .{.name = "TextDecoderPrototype__getEncoding"}); + @export(TextDecoder.getFatal, .{.name = "TextDecoderPrototype__getFatal"}); } } }; pub const JSTimeout = struct { const Timeout = Classes.Timeout; - const GetterType = fn (*Timeout, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*Timeout, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*Timeout, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*Timeout, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*Timeout, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; + const GetterType = fn(*Timeout, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const GetterTypeWithThisValue = fn(*Timeout, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const SetterType = fn(*Timeout, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const SetterTypeWithThisValue = fn(*Timeout, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const CallbackType = fn(*Timeout, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; /// Return the pointer to the wrapped object. /// If the object does not match the type, return null. @@ -3708,6 +4505,9 @@ pub const JSTimeout = struct { return Timeout__fromJS(value); } + + + /// Create a new instance of Timeout pub fn toJS(this: *Timeout, globalObject: *JSC.JSGlobalObject) JSC.JSValue { JSC.markBinding(@src()); @@ -3722,14 +4522,14 @@ pub const JSTimeout = struct { /// Modify the internal ptr to point to a new instance of Timeout. pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*Timeout) bool { - JSC.markBinding(@src()); - return Timeout__dangerouslySetPtr(value, ptr); + JSC.markBinding(@src()); + return Timeout__dangerouslySetPtr(value, ptr); } /// Detach the ptr from the thisValue pub fn detachPtr(_: *Timeout, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(Timeout__dangerouslySetPtr(value, null)); + JSC.markBinding(@src()); + std.debug.assert(Timeout__dangerouslySetPtr(value, null)); } extern fn Timeout__fromJS(JSC.JSValue) ?*Timeout; @@ -3740,34 +4540,43 @@ pub const JSTimeout = struct { extern fn Timeout__dangerouslySetPtr(JSC.JSValue, ?*Timeout) bool; comptime { - if (@TypeOf(Timeout.finalize) != (fn (*Timeout) callconv(.C) void)) { - @compileLog("Timeout.finalize is not a finalizer"); - } - - if (@TypeOf(Timeout.toPrimitive) != CallbackType) - @compileLog("Expected Timeout.toPrimitive to be a callback but received " ++ @typeName(@TypeOf(Timeout.toPrimitive))); - if (@TypeOf(Timeout.hasRef) != CallbackType) - @compileLog("Expected Timeout.hasRef to be a callback but received " ++ @typeName(@TypeOf(Timeout.hasRef))); - if (@TypeOf(Timeout.doRef) != CallbackType) - @compileLog("Expected Timeout.doRef to be a callback but received " ++ @typeName(@TypeOf(Timeout.doRef))); - if (@TypeOf(Timeout.doUnref) != CallbackType) - @compileLog("Expected Timeout.doUnref to be a callback but received " ++ @typeName(@TypeOf(Timeout.doUnref))); + + if (@TypeOf(Timeout.finalize) != (fn(*Timeout) callconv(.C) void)) { + @compileLog("Timeout.finalize is not a finalizer"); + } + + if (@TypeOf(Timeout.toPrimitive) != CallbackType) + @compileLog( + "Expected Timeout.toPrimitive to be a callback but received " ++ @typeName(@TypeOf(Timeout.toPrimitive)) + ); + if (@TypeOf(Timeout.hasRef) != CallbackType) + @compileLog( + "Expected Timeout.hasRef to be a callback but received " ++ @typeName(@TypeOf(Timeout.hasRef)) + ); + if (@TypeOf(Timeout.doRef) != CallbackType) + @compileLog( + "Expected Timeout.doRef to be a callback but received " ++ @typeName(@TypeOf(Timeout.doRef)) + ); + if (@TypeOf(Timeout.doUnref) != CallbackType) + @compileLog( + "Expected Timeout.doUnref to be a callback but received " ++ @typeName(@TypeOf(Timeout.doUnref)) + ); if (!JSC.is_bindgen) { - @export(Timeout.doRef, .{ .name = "TimeoutPrototype__doRef" }); - @export(Timeout.doUnref, .{ .name = "TimeoutPrototype__doUnref" }); - @export(Timeout.finalize, .{ .name = "TimeoutClass__finalize" }); - @export(Timeout.hasRef, .{ .name = "TimeoutPrototype__hasRef" }); - @export(Timeout.toPrimitive, .{ .name = "TimeoutPrototype__toPrimitive" }); +@export(Timeout.doRef, .{.name = "TimeoutPrototype__doRef"}); + @export(Timeout.doUnref, .{.name = "TimeoutPrototype__doUnref"}); + @export(Timeout.finalize, .{.name = "TimeoutClass__finalize"}); + @export(Timeout.hasRef, .{.name = "TimeoutPrototype__hasRef"}); + @export(Timeout.toPrimitive, .{.name = "TimeoutPrototype__toPrimitive"}); } } }; pub const JSTranspiler = struct { const Transpiler = Classes.Transpiler; - const GetterType = fn (*Transpiler, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*Transpiler, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*Transpiler, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*Transpiler, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*Transpiler, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; + const GetterType = fn(*Transpiler, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const GetterTypeWithThisValue = fn(*Transpiler, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const SetterType = fn(*Transpiler, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const SetterTypeWithThisValue = fn(*Transpiler, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const CallbackType = fn(*Transpiler, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; /// Return the pointer to the wrapped object. /// If the object does not match the type, return null. @@ -3776,13 +4585,16 @@ pub const JSTranspiler = struct { return Transpiler__fromJS(value); } + + + /// Get the Transpiler constructor value. /// This loads lazily from the global object. pub fn getConstructor(globalObject: *JSC.JSGlobalObject) JSC.JSValue { JSC.markBinding(@src()); return Transpiler__getConstructor(globalObject); } - + /// Create a new instance of Transpiler pub fn toJS(this: *Transpiler, globalObject: *JSC.JSGlobalObject) JSC.JSValue { JSC.markBinding(@src()); @@ -3797,14 +4609,14 @@ pub const JSTranspiler = struct { /// Modify the internal ptr to point to a new instance of Transpiler. pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*Transpiler) bool { - JSC.markBinding(@src()); - return Transpiler__dangerouslySetPtr(value, ptr); + JSC.markBinding(@src()); + return Transpiler__dangerouslySetPtr(value, ptr); } /// Detach the ptr from the thisValue pub fn detachPtr(_: *Transpiler, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(Transpiler__dangerouslySetPtr(value, null)); + JSC.markBinding(@src()); + std.debug.assert(Transpiler__dangerouslySetPtr(value, null)); } extern fn Transpiler__fromJS(JSC.JSValue) ?*Transpiler; @@ -3815,59 +4627,70 @@ pub const JSTranspiler = struct { extern fn Transpiler__dangerouslySetPtr(JSC.JSValue, ?*Transpiler) bool; comptime { - if (@TypeOf(Transpiler.constructor) != (fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*Transpiler)) { - @compileLog("Transpiler.constructor is not a constructor"); + + if (@TypeOf(Transpiler.constructor) != (fn(*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*Transpiler)) { + @compileLog("Transpiler.constructor is not a constructor"); } - - if (@TypeOf(Transpiler.finalize) != (fn (*Transpiler) callconv(.C) void)) { - @compileLog("Transpiler.finalize is not a finalizer"); + + if (@TypeOf(Transpiler.finalize) != (fn(*Transpiler) callconv(.C) void)) { + @compileLog("Transpiler.finalize is not a finalizer"); } - - if (@TypeOf(Transpiler.scan) != CallbackType) - @compileLog("Expected Transpiler.scan to be a callback but received " ++ @typeName(@TypeOf(Transpiler.scan))); - if (@TypeOf(Transpiler.scanImports) != CallbackType) - @compileLog("Expected Transpiler.scanImports to be a callback but received " ++ @typeName(@TypeOf(Transpiler.scanImports))); - if (@TypeOf(Transpiler.transform) != CallbackType) - @compileLog("Expected Transpiler.transform to be a callback but received " ++ @typeName(@TypeOf(Transpiler.transform))); - if (@TypeOf(Transpiler.transformSync) != CallbackType) - @compileLog("Expected Transpiler.transformSync to be a callback but received " ++ @typeName(@TypeOf(Transpiler.transformSync))); + + if (@TypeOf(Transpiler.scan) != CallbackType) + @compileLog( + "Expected Transpiler.scan to be a callback but received " ++ @typeName(@TypeOf(Transpiler.scan)) + ); + if (@TypeOf(Transpiler.scanImports) != CallbackType) + @compileLog( + "Expected Transpiler.scanImports to be a callback but received " ++ @typeName(@TypeOf(Transpiler.scanImports)) + ); + if (@TypeOf(Transpiler.transform) != CallbackType) + @compileLog( + "Expected Transpiler.transform to be a callback but received " ++ @typeName(@TypeOf(Transpiler.transform)) + ); + if (@TypeOf(Transpiler.transformSync) != CallbackType) + @compileLog( + "Expected Transpiler.transformSync to be a callback but received " ++ @typeName(@TypeOf(Transpiler.transformSync)) + ); if (!JSC.is_bindgen) { - @export(Transpiler.constructor, .{ .name = "TranspilerClass__construct" }); - @export(Transpiler.finalize, .{ .name = "TranspilerClass__finalize" }); - @export(Transpiler.scan, .{ .name = "TranspilerPrototype__scan" }); - @export(Transpiler.scanImports, .{ .name = "TranspilerPrototype__scanImports" }); - @export(Transpiler.transform, .{ .name = "TranspilerPrototype__transform" }); - @export(Transpiler.transformSync, .{ .name = "TranspilerPrototype__transformSync" }); +@export(Transpiler.constructor, .{.name = "TranspilerClass__construct"}); + @export(Transpiler.finalize, .{.name = "TranspilerClass__finalize"}); + @export(Transpiler.scan, .{.name = "TranspilerPrototype__scan"}); + @export(Transpiler.scanImports, .{.name = "TranspilerPrototype__scanImports"}); + @export(Transpiler.transform, .{.name = "TranspilerPrototype__transform"}); + @export(Transpiler.transformSync, .{.name = "TranspilerPrototype__transformSync"}); } } }; comptime { - _ = JSBlob; - _ = JSCryptoHasher; - _ = JSDirent; - _ = JSExpect; - _ = JSExpectAny; - _ = JSFileSystemRouter; - _ = JSListener; - _ = JSMD4; - _ = JSMD5; - _ = JSMatchedRoute; - _ = JSNodeJSFS; - _ = JSRequest; - _ = JSResponse; - _ = JSSHA1; - _ = JSSHA224; - _ = JSSHA256; - _ = JSSHA384; - _ = JSSHA512; - _ = JSSHA512_256; - _ = JSServerWebSocket; - _ = JSStats; - _ = JSSubprocess; - _ = JSTCPSocket; - _ = JSTLSSocket; - _ = JSTextDecoder; - _ = JSTimeout; - _ = JSTranspiler; + _ = JSBlob; + _ = JSCryptoHasher; + _ = JSDirent; + _ = JSExpect; + _ = JSExpectAny; + _ = JSFileSystemRouter; + _ = JSListener; + _ = JSMD4; + _ = JSMD5; + _ = JSMatchedRoute; + _ = JSNodeJSFS; + _ = JSRequest; + _ = JSResponse; + _ = JSSHA1; + _ = JSSHA224; + _ = JSSHA256; + _ = JSSHA384; + _ = JSSHA512; + _ = JSSHA512_256; + _ = JSServerWebSocket; + _ = JSStats; + _ = JSSubprocess; + _ = JSTCPSocket; + _ = JSTLSSocket; + _ = JSTextDecoder; + _ = JSTimeout; + _ = JSTranspiler; } + +
\ No newline at end of file diff --git a/src/bun.js/net.exports.js b/src/bun.js/net.exports.js index 423aae362..139bac0f3 100644 --- a/src/bun.js/net.exports.js +++ b/src/bun.js/net.exports.js @@ -110,7 +110,6 @@ const Socket = (function (InternalSocket) { self.#writeCallback = null; callback(error); } - console.error(error); self.emit("error", error); }, open(socket) { @@ -119,12 +118,42 @@ const Socket = (function (InternalSocket) { socket.ref(); self.#socket = socket; self.connecting = false; - self.emit("connect"); + self.emit("connect", self); Socket.#Drain(socket); }, + handshake(socket, success, verifyError) { + const { data: self } = socket; + self._securePending = false; + self.secureConnecting = false; + self._secureEstablished = !!success; + + // Needs getPeerCertificate support (not implemented yet) + // if (!verifyError && !this.isSessionReused()) { + // const hostname = options.servername || + // options.host || + // (options.socket && options.socket._host) || + // 'localhost'; + // const cert = this.getPeerCertificate(true); + // verifyError = options.checkServerIdentity(hostname, cert); + // } + + if (self._requestCert || self._rejectUnauthorized) { + if (verifyError) { + self.authorized = false; + self.authorizationError = verifyError.code || verifyError.message; + if (self._rejectUnauthorized) { + self.destroy(verifyError); + return; + } + } + } else { + self.authorized = true; + } + self.emit("secureConnect", verifyError); + }, timeout(socket) { const self = socket.data; - self.emit("timeout"); + self.emit("timeout", self); }, binaryType: "buffer", }; @@ -133,6 +162,8 @@ const Socket = (function (InternalSocket) { const self = socket.data; if (self.#closed) return; self.#closed = true; + //socket cannot be used after close + self.#socket = null; const queue = self.#readQueue; if (queue.isEmpty()) { if (self.push(null)) return; @@ -142,6 +173,7 @@ const Socket = (function (InternalSocket) { static #Drain(socket) { const self = socket.data; + const callback = self.#writeCallback; if (callback) { const chunk = self.#writeChunk; @@ -171,8 +203,12 @@ const Socket = (function (InternalSocket) { open(socket) { const self = this.data; const options = self[bunSocketServerOptions]; - const { pauseOnConnect, connectionListener } = options; - const _socket = new Socket(options); + const { pauseOnConnect, connectionListener, InternalSocketClass, requestCert, rejectUnauthorized } = options; + const _socket = new InternalSocketClass({}); + _socket.isServer = true; + _socket._requestCert = requestCert; + _socket._rejectUnauthorized = rejectUnauthorized; + _socket.#attach(this.localPort, socket); if (self.maxConnections && self[bunSocketServerConnections] >= self.maxConnections) { const data = { @@ -183,6 +219,7 @@ const Socket = (function (InternalSocket) { remotePort: _socket.remotePort, remoteFamily: _socket.remoteFamily || "IPv4", }; + socket.end(); self.emit("drop", data); @@ -194,11 +231,47 @@ const Socket = (function (InternalSocket) { } self[bunSocketServerConnections]++; + if (typeof connectionListener == "function") { - connectionListener(_socket); + if (InternalSocketClass.name === "TLSSocket") { + // add secureConnection event handler + self.once("secureConnection", () => connectionListener(_socket)); + } else { + connectionListener(_socket); + } } + self.emit("connection", _socket); }, + handshake({ data: self }, success, verifyError) { + self._securePending = false; + self.secureConnecting = false; + self._secureEstablished = !!success; + + // Needs getPeerCertificate support (not implemented yet) + // if (!verifyError && !this.isSessionReused()) { + // const hostname = options.servername || + // options.host || + // (options.socket && options.socket._host) || + // 'localhost'; + // const cert = this.getPeerCertificate(true); + // verifyError = options.checkServerIdentity(hostname, cert); + // } + + if (self._requestCert || self._rejectUnauthorized) { + if (verifyError) { + self.authorized = false; + self.authorizationError = verifyError.code || verifyError.message; + if (self._rejectUnauthorized) { + self.destroy(verifyError); + return; + } + } + } else { + self.authorized = true; + } + self.emit("secureConnect", verifyError); + }, error(socket, error) { Socket.#Handlers.error(socket, error); this.data.emit("error", error); @@ -222,6 +295,8 @@ const Socket = (function (InternalSocket) { #writeChunk; #pendingRead; + isServer = false; + constructor(options) { const { signal, write, read, allowHalfOpen = false, ...opts } = options || {}; super({ @@ -254,7 +329,7 @@ const Socket = (function (InternalSocket) { socket.ref(); this.#socket = socket; this.connecting = false; - this.emit("connect"); + this.emit("connect", this); Socket.#Drain(socket); } @@ -290,16 +365,31 @@ const Socket = (function (InternalSocket) { noDelay, keepAlive, keepAliveInitialDelay, + requestCert, + rejectUnauthorized, + pauseOnConnect, } = port; } + + if (!pauseOnConnect) { + this.resume(); + } this.connecting = true; this.remotePort = port; - if (connectListener) this.on("connect", connectListener); + const bunTLS = this[bunTlsSymbol]; var tls = undefined; if (typeof bunTLS === "function") { - tls = bunTLS.call(this, port, host); - } + tls = bunTLS.call(this, port, host, true); + //Client always request Cert + this._requestCert = true; + this._rejectUnauthorized = rejectUnauthorized; + this.authorized = false; + this.secureConnecting = true; + this._secureEstablished = false; + this._securePending = true; + if (connectListener) this.on("secureConnect", connectListener); + } else if (connectListener) this.on("connect", connectListener); bunConnect( path @@ -326,7 +416,7 @@ const Socket = (function (InternalSocket) { } _final(callback) { - this.#socket.end(); + this.#socket?.end(); callback(); } @@ -613,19 +703,28 @@ class Server extends EventEmitter { } try { + var tls = undefined; + var TLSSocketClass = undefined; + const bunTLS = this[bunTlsSymbol]; + if (typeof bunTLS === "function") { + [tls, TLSSocketClass] = bunTLS.call(this, port, hostname, false); + } + + this[bunSocketServerOptions].InternalSocketClass = TLSSocketClass || SocketClass; + this.#server = Bun.listen( path ? { exclusive, unix: path, - tls: false, + tls, socket: SocketClass[bunSocketServerHandlers], } : { exclusive, port, hostname, - tls: false, + tls, socket: SocketClass[bunSocketServerHandlers], }, ); @@ -645,7 +744,7 @@ class Server extends EventEmitter { setTimeout(emitListeningNextTick, 1, this, onListen); } catch (err) { this.#listening = false; - process.nextTick(emitErrorNextTick, this, err); + setTimeout(emitErrorNextTick, 1, this, err); } return this; } diff --git a/src/bun.js/node-tls.exports.js b/src/bun.js/node-tls.exports.js index 46301ae77..a29020a3d 100644 --- a/src/bun.js/node-tls.exports.js +++ b/src/bun.js/node-tls.exports.js @@ -2,16 +2,49 @@ function parseCertString() { throw Error("Not implemented"); } -var InternalSecureContext = class SecureContext {}; +function mapStringArray(item) { + return item.toString(); +} + +var InternalSecureContext = class SecureContext { + context; + + constructor(options) { + const context = {}; + if (options) { + if (options.key) { + context.key = (Array.isArray(options.key) ? options.key : [options.key]).map(mapStringArray); + } else context.key = undefined; + + if (options.passphrase) context.passphrase = options.passphrase; + else context.passphrase = undefined; + + if (options.cert) { + context.cert = (Array.isArray(options.cert) ? options.cert : [options.cert]).map(mapStringArray); + } else context.cert = undefined; + + if (options.ca) { + context.ca = (Array.isArray(options.ca) ? options.ca : [options.ca]).map(mapStringArray); + } else context.ca = undefined; + + const secureOptions = options.secureOptions || 0; + + if (secureOptions) context.secureOptions = secureOptions; + else context.secureOptions = undefined; + } + this.context = context; + } +}; + function SecureContext() { return new InternalSecureContext(); } function createSecureContext(options) { - return new SecureContext(); + return new SecureContext(options); } -const { [Symbol.for("::bunternal::")]: InternalTCPSocket } = import.meta.require("net"); +const { [Symbol.for("::bunternal::")]: InternalTCPSocket, Server: NetServer } = import.meta.require("net"); const buntls = Symbol.for("::buntls::"); @@ -36,8 +69,14 @@ const TLSSocket = (function (InternalTLSSocket) { ); })( class TLSSocket extends InternalTCPSocket { + #secureContext; constructor(options) { super(options); + this.#secureContext = options.secureContext || createSecureContext(options); + this.authorized = false; + this.secureConnecting = true; + this._secureEstablished = false; + this._securePending = true; } _secureEstablished = false; @@ -48,7 +87,7 @@ const TLSSocket = (function (InternalTLSSocket) { _SNICallback; servername; alpnProtocol; - authorized = true; + authorized = false; authorizationError; encrypted = true; @@ -78,24 +117,12 @@ const TLSSocket = (function (InternalTLSSocket) { throw Error("Not implented in Bun yet"); } - emit(event, args) { - super.emit(event, args); - - if (event === "connect" && !this._readableState?.destroyed) { - this.authorized = true; - this.secureConnecting = false; - this._secureEstablished = true; - this._securePending = false; - - super.emit("secureConnect", args); - } - } - [buntls](port, host) { var { servername } = this; if (servername) { return { serverName: typeof servername === "string" ? servername : host, + ...this.#secureContext, }; } @@ -103,6 +130,97 @@ const TLSSocket = (function (InternalTLSSocket) { } }, ); + +class Server extends NetServer { + key; + cert; + ca; + passphrase; + secureOptions; + _rejectUnauthorized; + _requestCert; + + constructor(options, secureConnectionListener) { + super(options, secureConnectionListener); + this.setSecureContext(options); + } + emit(event, args) { + super.emit(event, args); + + if (event === "connection") { + // grabs secureConnect to emit secureConnection + args.once("secureConnect", () => { + super.emit("secureConnection", args); + }); + } + } + setSecureContext(options) { + if (options instanceof InternalSecureContext) { + options = options.context; + } + if (options) { + if (options.key) { + this.key = (Array.isArray(options.key) ? options.key : [options.key]).map(mapStringArray); + } else this.key = undefined; + + if (options.passphrase) this.passphrase = options.passphrase; + else this.passphrase = undefined; + + if (options.cert) { + this.cert = (Array.isArray(options.cert) ? options.cert : [options.cert]).map(mapStringArray); + } else this.cert = undefined; + + if (options.ca) { + this.ca = (Array.isArray(options.ca) ? options.ca : [options.ca]).map(mapStringArray); + } else this.ca = undefined; + + const secureOptions = options.secureOptions || 0; + + if (secureOptions) this.secureOptions = secureOptions; + else this.secureOptions = undefined; + + const requestCert = options.requestCert || false; + + if (requestCert) this._requestCert = requestCert; + else this._requestCert = undefined; + + const rejectUnauthorized = options.rejectUnauthorized || false; + + if (rejectUnauthorized) { + this._rejectUnauthorized = rejectUnauthorized; + } else this._rejectUnauthorized = undefined; + } + } + + getTicketKeys() { + throw Error("Not implented in Bun yet"); + } + + setTicketKeys() { + throw Error("Not implented in Bun yet"); + } + + [buntls](port, host, isClient) { + return [ + { + serverName: host || "localhost", + key: this.key, + cert: this.cert, + ca: this.ca, + passphrase: this.passphrase, + secureOptions: this.secureOptions, + // Client always is NONE on set_verify + rejectUnauthorized: isClient ? false : this._rejectUnauthorized, + requestCert: isClient ? false : this._requestCert, + }, + SocketClass, + ]; + } +} + +function createServer(options, connectionListener) { + return new Server(options, connectionListener); +} export const CLIENT_RENEG_LIMIT = 3, CLIENT_RENEG_WINDOW = 600, DEFAULT_ECDH_CURVE = "auto", @@ -123,6 +241,7 @@ export const CLIENT_RENEG_LIMIT = 3, host: host, port: port, }; + return new TLSSocket(options).connect(options, connectListener); }, connect = createConnection; @@ -151,6 +270,8 @@ var exports = { [Symbol.for("CommonJS")]: 0, connect, createConnection, + Server, + createServer, }; export default exports; diff --git a/src/bun.js/webcore/response.zig b/src/bun.js/webcore/response.zig index 5b6d23a16..154a2c627 100644 --- a/src/bun.js/webcore/response.zig +++ b/src/bun.js/webcore/response.zig @@ -644,7 +644,8 @@ pub const Fetch = struct { // must be stored because AbortSignal stores reason weakly abort_reason: JSValue = JSValue.zero, - + // Custom Hostname + hostname: ?[]u8 = null, pub fn init(_: std.mem.Allocator) anyerror!FetchTasklet { return FetchTasklet{}; } @@ -655,6 +656,11 @@ pub const Fetch = struct { this.url_proxy_buffer.len = 0; } + if (this.hostname) |hostname| { + bun.default_allocator.free(hostname); + this.hostname = null; + } + this.request_headers.entries.deinit(bun.default_allocator); this.request_headers.buf.deinit(bun.default_allocator); this.request_headers = Headers{ .allocator = undefined }; @@ -824,6 +830,7 @@ pub const Fetch = struct { .ref = JSC.napi.Ref.create(globalThis, promise), .url_proxy_buffer = fetch_options.url_proxy_buffer, .signal = fetch_options.signal, + .hostname = fetch_options.hostname, }; if (fetch_tasklet.request_body.store()) |store| { @@ -844,7 +851,7 @@ pub const Fetch = struct { FetchTasklet.callback, ).init( fetch_tasklet, - ), proxy, if (fetch_tasklet.signal != null) &fetch_tasklet.aborted else null); + ), proxy, if (fetch_tasklet.signal != null) &fetch_tasklet.aborted else null, fetch_options.hostname); if (!fetch_options.follow_redirects) { fetch_tasklet.http.?.client.remaining_redirect_count = 0; @@ -886,6 +893,8 @@ pub const Fetch = struct { url_proxy_buffer: []const u8 = "", signal: ?*JSC.WebCore.AbortSignal = null, globalThis: ?*JSGlobalObject, + // Custom Hostname + hostname: ?[]u8 = null, }; pub fn queue( @@ -949,6 +958,8 @@ pub const Fetch = struct { var proxy: ?ZigURL = null; var follow_redirects = true; var signal: ?*JSC.WebCore.AbortSignal = null; + // Custom Hostname + var hostname: ?[]u8 = null; var url_proxy_buffer: []const u8 = undefined; @@ -966,12 +977,21 @@ pub const Fetch = struct { if (options.fastGet(ctx.ptr(), .headers)) |headers_| { if (headers_.as(FetchHeaders)) |headers__| { + if (headers__.fastGet(JSC.FetchHeaders.HTTPHeaderName.Host)) |_hostname| { + hostname = _hostname.toOwnedSliceZ(bun.default_allocator) catch unreachable; + } headers = Headers.from(headers__, bun.default_allocator) catch unreachable; // TODO: make this one pass } else if (FetchHeaders.createFromJS(ctx.ptr(), headers_)) |headers__| { + if (headers__.fastGet(JSC.FetchHeaders.HTTPHeaderName.Host)) |_hostname| { + hostname = _hostname.toOwnedSliceZ(bun.default_allocator) catch unreachable; + } headers = Headers.from(headers__, bun.default_allocator) catch unreachable; headers__.deref(); } else if (request.headers) |head| { + if (head.fastGet(JSC.FetchHeaders.HTTPHeaderName.Host)) |_hostname| { + hostname = _hostname.toOwnedSliceZ(bun.default_allocator) catch unreachable; + } headers = Headers.from(head, bun.default_allocator) catch unreachable; } } else if (request.headers) |head| { @@ -986,6 +1006,10 @@ pub const Fetch = struct { body = body_value.useAsAnyBlob(); } else { + // clean hostname if any + if (hostname) |host| { + bun.default_allocator.free(host); + } // an error was thrown return JSC.JSValue.jsUndefined().asObjectRef(); } @@ -1064,6 +1088,9 @@ pub const Fetch = struct { } else { method = request.method; if (request.headers) |head| { + if (head.fastGet(JSC.FetchHeaders.HTTPHeaderName.Host)) |_hostname| { + hostname = _hostname.toOwnedSliceZ(bun.default_allocator) catch unreachable; + } headers = Headers.from(head, bun.default_allocator) catch unreachable; } body = request.body.useAsAnyBlob(); @@ -1087,10 +1114,16 @@ pub const Fetch = struct { if (options.fastGet(ctx.ptr(), .headers)) |headers_| { if (headers_.as(FetchHeaders)) |headers__| { + if (headers__.fastGet(JSC.FetchHeaders.HTTPHeaderName.Host)) |_hostname| { + hostname = _hostname.toOwnedSliceZ(bun.default_allocator) catch unreachable; + } headers = Headers.from(headers__, bun.default_allocator) catch unreachable; // TODO: make this one pass } else if (FetchHeaders.createFromJS(ctx.ptr(), headers_)) |headers__| { defer headers__.deref(); + if (headers__.fastGet(JSC.FetchHeaders.HTTPHeaderName.Host)) |_hostname| { + hostname = _hostname.toOwnedSliceZ(bun.default_allocator) catch unreachable; + } headers = Headers.from(headers__, bun.default_allocator) catch unreachable; } else { // Converting the headers failed; return null and @@ -1106,6 +1139,10 @@ pub const Fetch = struct { // we have to explicitly check for InternalBlob body = body_value.useAsAnyBlob(); } else { + // clean hostname if any + if (hostname) |host| { + bun.default_allocator.free(host); + } // an error was thrown return JSC.JSValue.jsUndefined().asObjectRef(); } @@ -1149,6 +1186,10 @@ pub const Fetch = struct { if (url_zig.len == 0) { const err = JSC.toTypeError(.ERR_INVALID_ARG_VALUE, fetch_error_blank_url, .{}, ctx); + // clean hostname if any + if (hostname) |host| { + bun.default_allocator.free(host); + } return JSPromise.rejectedPromiseValue(globalThis, err).asRef(); } @@ -1156,6 +1197,10 @@ pub const Fetch = struct { //if null we add an empty proxy to be ignore all proxy //only allocate url const url_slice = url_zig.toSlice(bun.default_allocator).cloneIfNeeded(bun.default_allocator) catch { + // clean hostname if any + if (hostname) |host| { + bun.default_allocator.free(host); + } JSC.JSError(bun.default_allocator, "Out of memory", .{}, ctx, exception); return null; }; @@ -1207,12 +1252,20 @@ pub const Fetch = struct { } else { //no proxy only url var url_slice = jsstring.toSlice(globalThis, bun.default_allocator).cloneIfNeeded(bun.default_allocator) catch { + // clean hostname if any + if (hostname) |host| { + bun.default_allocator.free(host); + } JSC.JSError(bun.default_allocator, "Out of memory", .{}, ctx, exception); return null; }; if (url_slice.len == 0) { const err = JSC.toTypeError(.ERR_INVALID_ARG_VALUE, fetch_error_blank_url, .{}, ctx); + // clean hostname if any + if (hostname) |host| { + bun.default_allocator.free(host); + } return JSPromise.rejectedPromiseValue(globalThis, err).asRef(); } @@ -1270,6 +1323,7 @@ pub const Fetch = struct { .url_proxy_buffer = url_proxy_buffer, .signal = signal, .globalThis = globalThis, + .hostname = hostname, }, promise_val, ) catch unreachable; diff --git a/src/cli/create_command.zig b/src/cli/create_command.zig index 0c76a9c01..f68cb454a 100644 --- a/src/cli/create_command.zig +++ b/src/cli/create_command.zig @@ -1852,7 +1852,7 @@ pub const Example = struct { // ensure very stable memory address var async_http: *HTTP.AsyncHTTP = ctx.allocator.create(HTTP.AsyncHTTP) catch unreachable; - async_http.* = HTTP.AsyncHTTP.initSync(ctx.allocator, .GET, api_url, header_entries, headers_buf, mutable, "", 60 * std.time.ns_per_min, http_proxy); + async_http.* = HTTP.AsyncHTTP.initSync(ctx.allocator, .GET, api_url, header_entries, headers_buf, mutable, "", 60 * std.time.ns_per_min, http_proxy, null); async_http.client.progress_node = progress; const response = try async_http.sendSync(true); @@ -1916,7 +1916,7 @@ pub const Example = struct { // ensure very stable memory address var async_http: *HTTP.AsyncHTTP = ctx.allocator.create(HTTP.AsyncHTTP) catch unreachable; - async_http.* = HTTP.AsyncHTTP.initSync(ctx.allocator, .GET, url, .{}, "", mutable, "", 60 * std.time.ns_per_min, http_proxy); + async_http.* = HTTP.AsyncHTTP.initSync(ctx.allocator, .GET, url, .{}, "", mutable, "", 60 * std.time.ns_per_min, http_proxy, null); async_http.client.progress_node = progress; var response = try async_http.sendSync(true); @@ -1992,7 +1992,7 @@ pub const Example = struct { http_proxy = env_loader.getHttpProxy(parsed_tarball_url); - async_http.* = HTTP.AsyncHTTP.initSync(ctx.allocator, .GET, parsed_tarball_url, .{}, "", mutable, "", 60 * std.time.ns_per_min, http_proxy); + async_http.* = HTTP.AsyncHTTP.initSync(ctx.allocator, .GET, parsed_tarball_url, .{}, "", mutable, "", 60 * std.time.ns_per_min, http_proxy, null); async_http.client.progress_node = progress; refresher.maybeRefresh(); @@ -2022,7 +2022,7 @@ pub const Example = struct { var mutable = try ctx.allocator.create(MutableString); mutable.* = try MutableString.init(ctx.allocator, 2048); - async_http.* = HTTP.AsyncHTTP.initSync(ctx.allocator, .GET, url, .{}, "", mutable, "", 60 * std.time.ns_per_min, http_proxy); + async_http.* = HTTP.AsyncHTTP.initSync(ctx.allocator, .GET, url, .{}, "", mutable, "", 60 * std.time.ns_per_min, http_proxy, null); if (Output.enable_ansi_colors) { async_http.client.progress_node = progress_node; diff --git a/src/cli/upgrade_command.zig b/src/cli/upgrade_command.zig index a9bf340b9..8bcb91771 100644 --- a/src/cli/upgrade_command.zig +++ b/src/cli/upgrade_command.zig @@ -223,7 +223,7 @@ pub const UpgradeCommand = struct { // ensure very stable memory address var async_http: *HTTP.AsyncHTTP = allocator.create(HTTP.AsyncHTTP) catch unreachable; - async_http.* = HTTP.AsyncHTTP.initSync(allocator, .GET, api_url, header_entries, headers_buf, &metadata_body, "", 60 * std.time.ns_per_min, http_proxy); + async_http.* = HTTP.AsyncHTTP.initSync(allocator, .GET, api_url, header_entries, headers_buf, &metadata_body, "", 60 * std.time.ns_per_min, http_proxy, null); if (!silent) async_http.client.progress_node = progress; const response = try async_http.sendSync(true); @@ -454,7 +454,7 @@ pub const UpgradeCommand = struct { var zip_file_buffer = try ctx.allocator.create(MutableString); zip_file_buffer.* = try MutableString.init(ctx.allocator, @max(version.size, 1024)); - async_http.* = HTTP.AsyncHTTP.initSync(ctx.allocator, .GET, zip_url, .{}, "", zip_file_buffer, "", timeout, http_proxy); + async_http.* = HTTP.AsyncHTTP.initSync(ctx.allocator, .GET, zip_url, .{}, "", zip_file_buffer, "", timeout, http_proxy, null); async_http.client.timeout = timeout; async_http.client.progress_node = progress; const response = try async_http.sendSync(true); diff --git a/src/deps/uws b/src/deps/uws -Subproject 98bc9f273230b608a3301ef6555488b404c331f +Subproject 13fa21b8d7301e961b14047ef075b6968292c57 diff --git a/src/deps/uws.zig b/src/deps/uws.zig index bee88f657..af2027b63 100644 --- a/src/deps/uws.zig +++ b/src/deps/uws.zig @@ -27,6 +27,11 @@ pub fn NewSocketHandler(comptime ssl: bool) type { socket: *Socket, const ThisSocket = @This(); + pub fn verifyError(this: ThisSocket) us_bun_verify_error_t { + const ssl_error: us_bun_verify_error_t = uws.us_socket_verify_error(comptime ssl_int, this.socket); + return ssl_error; + } + pub fn isEstablished(this: ThisSocket) bool { return us_socket_is_established(comptime ssl_int, this.socket) > 0; } @@ -300,6 +305,9 @@ pub fn NewSocketHandler(comptime ssl: bool) type { ); return socket; } + pub fn on_handshake(socket: *Socket, success: i32, verify_error: us_bun_verify_error_t, _: ?*anyopaque) callconv(.C) void { + Fields.onHandshake(getValue(socket), ThisSocket{ .socket = socket }, success, verify_error); + } }; if (comptime @hasDecl(@"type", "onOpen") and @typeInfo(@TypeOf(@"type".onOpen)) != .Null) @@ -316,6 +324,8 @@ pub fn NewSocketHandler(comptime ssl: bool) type { us_socket_context_on_connect_error(ssl_int, ctx, SocketHandler.on_connect_error); if (comptime @hasDecl(@"type", "onEnd") and @typeInfo(@TypeOf(@"type".onEnd)) != .Null) us_socket_context_on_end(ssl_int, ctx, SocketHandler.on_end); + if (comptime @hasDecl(@"type", "onHandshake") and @typeInfo(@TypeOf(@"type".onHandshake)) != .Null) + us_socket_context_on_handshake(ssl_int, ctx, SocketHandler.on_handshake, null); } pub fn from(socket: *Socket) ThisSocket { @@ -581,17 +591,48 @@ pub const us_socket_context_options_t = extern struct { ssl_prefer_low_memory_usage: i32 = 0, }; +pub const us_bun_socket_context_options_t = extern struct { + key_file_name: [*c]const u8 = null, + cert_file_name: [*c]const u8 = null, + passphrase: [*c]const u8 = null, + dh_params_file_name: [*c]const u8 = null, + ca_file_name: [*c]const u8 = null, + ssl_ciphers: [*c]const u8 = null, + ssl_prefer_low_memory_usage: i32 = 0, + key: [*c][*c]const u8 = null, + key_count: u32 = 0, + cert: [*c][*c]const u8 = null, + cert_count: u32 = 0, + ca: [*c][*c]const u8 = null, + ca_count: u32 = 0, + secure_options: u32 = 0, + reject_unauthorized: i32 = 0, + request_cert: i32 = 0, +}; + +pub const us_bun_verify_error_t = extern struct { + error_no: i32 = 0, + code: [*c]const u8 = null, + reason: [*c]const u8 = null, +}; + +extern fn us_socket_verify_error(ssl: i32, context: *Socket) us_bun_verify_error_t; extern fn SocketContextimestamp(ssl: i32, context: ?*SocketContext) c_ushort; pub extern fn us_socket_context_add_server_name(ssl: i32, context: ?*SocketContext, hostname_pattern: [*c]const u8, options: us_socket_context_options_t, ?*anyopaque) void; extern fn us_socket_context_remove_server_name(ssl: i32, context: ?*SocketContext, hostname_pattern: [*c]const u8) void; extern fn us_socket_context_on_server_name(ssl: i32, context: ?*SocketContext, cb: ?*const fn (?*SocketContext, [*c]const u8) callconv(.C) void) void; extern fn us_socket_context_get_native_handle(ssl: i32, context: ?*SocketContext) ?*anyopaque; pub extern fn us_create_socket_context(ssl: i32, loop: ?*Loop, ext_size: i32, options: us_socket_context_options_t) ?*SocketContext; +pub extern fn us_create_bun_socket_context(ssl: i32, loop: ?*Loop, ext_size: i32, options: us_bun_socket_context_options_t) ?*SocketContext; +pub extern fn us_bun_socket_context_add_server_name(ssl: i32, context: ?*SocketContext, hostname_pattern: [*c]const u8, options: us_bun_socket_context_options_t, ?*anyopaque) void; pub extern fn us_socket_context_free(ssl: i32, context: ?*SocketContext) void; extern fn us_socket_context_on_open(ssl: i32, context: ?*SocketContext, on_open: *const fn (*Socket, i32, [*c]u8, i32) callconv(.C) ?*Socket) void; extern fn us_socket_context_on_close(ssl: i32, context: ?*SocketContext, on_close: *const fn (*Socket, i32, ?*anyopaque) callconv(.C) ?*Socket) void; extern fn us_socket_context_on_data(ssl: i32, context: ?*SocketContext, on_data: *const fn (*Socket, [*c]u8, i32) callconv(.C) ?*Socket) void; extern fn us_socket_context_on_writable(ssl: i32, context: ?*SocketContext, on_writable: *const fn (*Socket) callconv(.C) ?*Socket) void; + +extern fn us_socket_context_on_handshake(ssl: i32, context: ?*SocketContext, on_handshake: *const fn (*Socket, i32, us_bun_verify_error_t, ?*anyopaque) callconv(.C) void, ?*anyopaque) void; + extern fn us_socket_context_on_timeout(ssl: i32, context: ?*SocketContext, on_timeout: *const fn (*Socket) callconv(.C) ?*Socket) void; extern fn us_socket_context_on_connect_error(ssl: i32, context: ?*SocketContext, on_connect_error: *const fn (*Socket, i32) callconv(.C) ?*Socket) void; extern fn us_socket_context_on_end(ssl: i32, context: ?*SocketContext, on_end: *const fn (*Socket) callconv(.C) ?*Socket) void; diff --git a/src/http_client_async.zig b/src/http_client_async.zig index 4702c8b62..c75883ad7 100644 --- a/src/http_client_async.zig +++ b/src/http_client_async.zig @@ -124,7 +124,7 @@ const ProxyTunnel = struct { _ = BoringSSL.BIO_set_mem_eof_return(in_bio, -1); ssl.setBIO(in_bio, out_bio); - const hostname = bun.default_allocator.dupeZ(u8, client.url.hostname) catch unreachable; + const hostname = bun.default_allocator.dupeZ(u8, client.hostname orelse client.url.hostname) catch unreachable; defer bun.default_allocator.free(hostname); ssl.configureHTTPClient(hostname); @@ -674,7 +674,7 @@ pub fn onOpen( if (comptime is_ssl) { var ssl: *BoringSSL.SSL = @ptrCast(*BoringSSL.SSL, socket.getNativeHandle()); if (!ssl.isInitFinished()) { - var _hostname = client.url.hostname; + var _hostname = client.hostname orelse client.url.hostname; if (client.http_proxy) |proxy| { _hostname = proxy.hostname; } @@ -1037,8 +1037,8 @@ proxy_tunneling: bool = false, proxy_tunnel: ?ProxyTunnel = null, aborted: ?*std.atomic.Atomic(bool) = null, async_http_id: u32 = 0, - -pub fn init(allocator: std.mem.Allocator, method: Method, url: URL, header_entries: Headers.Entries, header_buf: string, signal: ?*std.atomic.Atomic(bool)) HTTPClient { +hostname: ?[]u8 = null, +pub fn init(allocator: std.mem.Allocator, method: Method, url: URL, header_entries: Headers.Entries, header_buf: string, signal: ?*std.atomic.Atomic(bool), hostname: ?[]u8) HTTPClient { return HTTPClient{ .allocator = allocator, .method = method, @@ -1046,6 +1046,7 @@ pub fn init(allocator: std.mem.Allocator, method: Method, url: URL, header_entri .header_entries = header_entries, .header_buf = header_buf, .aborted = signal, + .hostname = hostname, }; } @@ -1261,10 +1262,11 @@ pub const AsyncHTTP = struct { callback: HTTPClientResult.Callback, http_proxy: ?URL, signal: ?*std.atomic.Atomic(bool), + hostname: ?[]u8, ) AsyncHTTP { var this = AsyncHTTP{ .allocator = allocator, .url = url, .method = method, .request_headers = headers, .request_header_buf = headers_buf, .request_body = request_body, .response_buffer = response_buffer, .completion_callback = callback, .http_proxy = http_proxy, .async_http_id = if (signal != null) async_http_id.fetchAdd(1, .Monotonic) else 0 }; - this.client = HTTPClient.init(allocator, method, url, headers, headers_buf, signal); + this.client = HTTPClient.init(allocator, method, url, headers, headers_buf, signal, hostname); this.client.async_http_id = this.async_http_id; this.client.timeout = timeout; this.client.http_proxy = this.http_proxy; @@ -1334,8 +1336,8 @@ pub const AsyncHTTP = struct { return this; } - pub fn initSync(allocator: std.mem.Allocator, method: Method, url: URL, headers: Headers.Entries, headers_buf: string, response_buffer: *MutableString, request_body: []const u8, timeout: usize, http_proxy: ?URL) AsyncHTTP { - return @This().init(allocator, method, url, headers, headers_buf, response_buffer, request_body, timeout, undefined, http_proxy, null); + pub fn initSync(allocator: std.mem.Allocator, method: Method, url: URL, headers: Headers.Entries, headers_buf: string, response_buffer: *MutableString, request_body: []const u8, timeout: usize, http_proxy: ?URL, hostname: ?[]u8) AsyncHTTP { + return @This().init(allocator, method, url, headers, headers_buf, response_buffer, request_body, timeout, undefined, http_proxy, null, hostname); } fn reset(this: *AsyncHTTP) !void { diff --git a/src/install/install.zig b/src/install/install.zig index 97e3640a0..69a39fd7a 100644 --- a/src/install/install.zig +++ b/src/install/install.zig @@ -339,6 +339,7 @@ const NetworkTask = struct { this.getCompletionCallback(), this.package_manager.httpProxy(url), null, + null, ); this.callback = .{ .package_manifest = .{ @@ -415,6 +416,7 @@ const NetworkTask = struct { this.getCompletionCallback(), this.package_manager.httpProxy(url), null, + null, ); this.callback = .{ .extract = tarball }; } diff --git a/test/js/node/tls/fixtures/rsa_cert.crt b/test/js/node/tls/fixtures/rsa_cert.crt new file mode 100644 index 000000000..3bcf90e2a --- /dev/null +++ b/test/js/node/tls/fixtures/rsa_cert.crt @@ -0,0 +1,24 @@ +-----BEGIN CERTIFICATE----- +MIIEAjCCAuqgAwIBAgIUVaZoDmyyS79pzShST5zhsKbvWR0wDQYJKoZIhvcNAQEL +BQAwgbAxCzAJBgNVBAYTAlVLMRQwEgYDVQQIDAtBY2tuYWNrIEx0ZDETMBEGA1UE +BwwKUmh5cyBKb25lczEQMA4GA1UECgwHbm9kZS5qczEdMBsGA1UECwwUVGVzdCBU +TFMgQ2VydGlmaWNhdGUxFDASBgNVBAsMC0VuZ2luZWVyaW5nMRIwEAYDVQQDDAls +b2NhbGhvc3QxGzAZBgkqhkiG9w0BCQEWDGFsZXhAYXViLmRldjAgFw0yMjA5MDMx +NDQ2NTRaGA8yMjk2MDYxNzE0NDY1NFowgbAxCzAJBgNVBAYTAlVLMRQwEgYDVQQI +DAtBY2tuYWNrIEx0ZDETMBEGA1UEBwwKUmh5cyBKb25lczEQMA4GA1UECgwHbm9k +ZS5qczEdMBsGA1UECwwUVGVzdCBUTFMgQ2VydGlmaWNhdGUxFDASBgNVBAsMC0Vu +Z2luZWVyaW5nMRIwEAYDVQQDDAlsb2NhbGhvc3QxGzAZBgkqhkiG9w0BCQEWDGFs +ZXhAYXViLmRldjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALfcWIiK +J7HAt78/wNnHkeyoWWZQ7v+W8nud5wlU3Cp1ndrHmOlAHSnq7F+p46/Nw3eTlXtQ +Vv8Cb6eRI1kwBmGxbMJTZng+OHnRBjPd/Qei6vv/IgZK04vJhjeGAsrYrxNuGCNA ++F2TD35C0qWm9svx8uA40CgatU4WdFAZyvvSIV9+ybv2aBmEpUyBiIc8momAYe8K +2QaD3MyBLunrf5DdlZ520VLZGExfe4IHL+YfoQ6VEI0FtGYDjHE3PJ/kZBqSLdP4 +jP204yN08/4LBXYuoR3KWYG6KTy+t9NveogcsooEAjyVc3brBa0DeQ3gvs0/5xsq +UJGWpy2+GbKUsfUCAwEAAaMQMA4wDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQsF +AAOCAQEALcyUnR9nUaKtYwomY5nf7GzaVLGiprbN2irZgfrbdBRIbNGTaOOzzoDW +31pmrppYT5P8e1ORN+eHaD7h1mVhT6b2tix3xPxKasuu6iYYGRRu4SiKEfHKwYtU +g/Q/eFI1MquhitOYEZA7C/6TK6Stx4ot5sNPAmgbYRLz6ljUCMeGHM/JHIMlrAbt +2R3Wyo0UWQINqAT11miJcL0a9UCGScCZxmz90Hs+uk6MtiY8kNSXHL5So4tg7qFz +nFWSMhIu+1f4hbxD9inOTJczzw1iCXuWRe3+rvqPDxJyHGMiriiXrdBY6CXa20jx +P1lIqHSThAkWfOgOhmQ0OdvSWlKvNA== +-----END CERTIFICATE----- diff --git a/test/js/node/tls/fixtures/rsa_private.pem b/test/js/node/tls/fixtures/rsa_private.pem new file mode 100644 index 000000000..215e5cc51 --- /dev/null +++ b/test/js/node/tls/fixtures/rsa_private.pem @@ -0,0 +1,27 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIEpQIBAAKCAQEAt9xYiIonscC3vz/A2ceR7KhZZlDu/5bye53nCVTcKnWd2seY +6UAdKersX6njr83Dd5OVe1BW/wJvp5EjWTAGYbFswlNmeD44edEGM939B6Lq+/8i +BkrTi8mGN4YCytivE24YI0D4XZMPfkLSpab2y/Hy4DjQKBq1ThZ0UBnK+9IhX37J +u/ZoGYSlTIGIhzyaiYBh7wrZBoPczIEu6et/kN2VnnbRUtkYTF97ggcv5h+hDpUQ +jQW0ZgOMcTc8n+RkGpIt0/iM/bTjI3Tz/gsFdi6hHcpZgbopPL630296iByyigQC +PJVzdusFrQN5DeC+zT/nGypQkZanLb4ZspSx9QIDAQABAoIBAQCS2erYu8gyoGPi +3E/zYgQ6ishFAZWzDWSFubwD5wSm4SSAzvViL/RbO6kqS25xR569DmLRiHzD17VI +mJMsNECUnPrqR2TL256OJZaXrNHh3I1lUwVhEzjeKMsL4/ys+d70XPXoiocVblVs +moDXEIGEqa48ywPvVE3Fngeuxrsq3/GCVBNiwtt0YjAOZxmKEh31UZdHO+YI+wNF +/Z8KQCPscN5HGlR0SIQOlqMANz49aKStrevdvjS1UcpabzDEkuK84g3saJhcpAhb +pGFmAf5GTjkkhE0rE1qDF15dSqrKGfCFtOjUeK17SIEN7E322ChmTReZ1hYGfoSV +cdFntUINAoGBAPFKL5QeJ6wZu8R/ru11wTG6sQA0Jub2hGccPXpbnPrT+3CACOLI +JTCLy/xTKW3dqRHj/wZEe+jUw88w7jwGb1BkWr4BI8tDvY9jQLP1jyuLWRfrxXbp +4Z0oeBBwBeCI/ZG7FIvdDTqWxn1aj3Tmh6s4ByqEdtwrrrJPcBUNl01fAoGBAMMR +3RGE/ca6X6xz6kgUD6TtHVhiiRJK1jm/u+q0n7i/MBkeDgTZkHYS7lPc0yIdtqaI +Plz5yzwHnAvuMrv8LSdkjwioig2yQa3tAij8kXxqs7wN5418DMV2s1OJBrPthYPs +bv4im2iI8V63JQS4ZMYQbckq8ABYccTpOnxXDy0rAoGBAKkvzHa+QjERhjB9GyoT +1FhLQIsVBmYSWrp1+cGO9V6HPxoeHJzvm+wTSf/uS/FmaINL6+j4Ii4a6gWgmJts +I6cqBtqNsAx5vjQJczf8KdxthBYa0sXTrsfktXNJKUXMqIgDtp9vazQ2vozs8AQX +FPAAhD3SzgkJdCBBRSTt97ZfAoGAWAziKpxLKL7LnL4dzDcx8JIPIuwnTxh0plCD +dCffyLaT8WJ9lXbXHFTjOvt8WfPrlDP/Ylxmfkw5BbGZOP1VLGjZn2DkH9aMiwNm +bDXFPdG0G3hzQovx/9fajiRV4DWghLHeT9wzJfZabRRiI0VQR472300AVEeX4vgb +rDBn600CgYEAk7czBCT9rHn/PNwCa17hlTy88C4vXkwbz83Oa+aX5L4e5gw5lhcR +2ZuZHLb2r6oMt9rlD7EIDItSs+u21LOXWPTAlazdnpYUyw/CzogM/PN+qNwMRXn5 +uXFFhmlP2mVg2EdELTahXch8kWqHaCSX53yvqCtRKu/j76V31TfQZGM= +-----END RSA PRIVATE KEY----- diff --git a/test/js/node/tls/fixtures/rsa_private_encrypted.pem b/test/js/node/tls/fixtures/rsa_private_encrypted.pem new file mode 100644 index 000000000..f1914289e --- /dev/null +++ b/test/js/node/tls/fixtures/rsa_private_encrypted.pem @@ -0,0 +1,30 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: AES-256-CBC,DB3D20E60E8FDC3356BD79712FF8EF7E + +K+vu0U3IFTJBBi6zW5Zng80O1jXq/ZmlOFs/j/SQpPwfW1Do9i/Dwa7ntBlTwrCm +sd3IIPgu2ikfLwxvbxsZN540oCaCqaZ/bmmyzH3MyVDA9MllUu+X8+Q3ATzcYa9R +U5XfF5DAXsSRnstCbmKagWVQpO0oX8k3ratfny6Ixq86Y82tK8+o5YiBFq1kqa+9 +4yat7IWQbqV5ifUtUPCHZwEqBt+WKazX05BqERjkckHdpfaDrBvSSPXTwoLm6uRR +ktkUVpO4tHMZ4VlcTfFtpz8gdYYod0nM6vz26hvbESHSwztSgMhmKdsE5eqmYfgu +F4WkEN4bqAiPjKK3jnUKPt/vg2oKYFQlVYFl9QnBjiRqcQTi3e9lwn1hI7uoMb6g +HuaCc57JJHPN/ZLP3ts4ZxFbwUjTGioh5Zh6WozG3L3+Ujwq/sDrAskRyzdcuP7I +Rs3oLbHY03OHyg8IbxR5Iu89l6FLqnR45yvbxXtZ7ImGOPM5Z9pB1CzDhGDx2F6g +J/Kf/7ZF2DmYUVbVKDfESEDhRfuMAVzhasDPTRqipSA5QvJVQY+J/6QDPrNNmHVB +4e4ouHIDWERUf0t1Be7THvP3X8OJozj2HApzqa5ZCaJDo8eaL8TCD5uH75ID5URJ +VscGHaUXT8/sxfHi1x8BibW5W5J/akFsnrnJU/1BZgGznIxjf5tKfHGppSIVdlKP +3ghYNmEIFPNJ6cxuUA0D2IOV4uO3FTCU6seIzvJhYkmXnticcZYGtmGxXKrodtzS +J1YuaNkkO/YRZah285lQ6QCIhCFo4Oa4ILjgoTQISuw7nQj5ESyncauzLUBXKX0c +XDUej64KNTvVF9UXdG48fYvNmSZWCnTye4UmPu17FmwpVra38U+EdoLyWyMIAI5t +rP6Hhgc9BxOo41Im9QpTcAPfKAknP8Rbm3ACJG5T9FKq/c29d1E//eFR6SL51e/a +yWdCgJN/FJOAX60+erPwoVoRFEttAeDPkklgFGdc8F4LIYAig9gEZ92ykFFz3fWz +jIcUVLrL+IokFbPVUBoMihqVyMQsWH+5Qq9wjxf6EDIf0BVtm9U4BJoOkPStFIfF +Kof7OVv7izyL8R/GIil9VQs9ftwkIUPeXx2Hw0bE3HJ3C8K4+mbLg3tKhGnBDU5Z +Xm5mLHoCRBa3ZRFWZtigX7POszdLAzftYo8o65Be4OtPS+tQAORk9gHsXATv7dDB +OGw61x5KA55LHVHhWaRvu3J8E7nhxw0q/HskyZhDC+Y+Xs6vmQSb4nO4ET4NYX1P +m3PMdgGoqRDJ2jZw4eoQdRKCM0EHSepSAYpO1tcAXhPZS4ITogoRgPpVgOebEQUL +nKNeNu/BxMSH/IH15jjDLF3TiEoguF9xdTaCxIBzE1SFpVO0u9m9vXpWdPThVgsb +VcEI487p7v9iImP3BYPT8ZYvytC26EH0hyOrwhahTvTb4vXghkLIyvPUg1lZHc6e +aPHb2AzYAHLnp/ehDQGKWrCOJ1JE2vBv8ZkLa+XZo7YASXBRZitPOMlvykEyzxmR +QAmNhKGvFmeM2mmHAp0aC03rgF3lxNsXQ1CyfEdq3UV9ReSnttq8gtrJfCwxV+wY +-----END RSA PRIVATE KEY----- diff --git a/test/js/node/tls/node-tls-server.test.ts b/test/js/node/tls/node-tls-server.test.ts new file mode 100644 index 000000000..a82f8cde2 --- /dev/null +++ b/test/js/node/tls/node-tls-server.test.ts @@ -0,0 +1,627 @@ +import { createServer, Server, TLSSocket } from "tls"; +import { realpathSync, readFileSync } from "fs"; +import { tmpdir } from "os"; +import { join } from "path"; +import { createTest } from "node-harness"; +import { AddressInfo } from "net"; + +const { describe, expect, it, createCallCheckCtx } = createTest(import.meta.path); + +const passKeyFile = join(import.meta.dir, "fixtures", "rsa_private_encrypted.pem"); +const passKey = readFileSync(passKeyFile); +const rawKeyFile = join(import.meta.dir, "fixtures", "rsa_private.pem"); +const rawKey = readFileSync(rawKeyFile); +const certFile = join(import.meta.dir, "fixtures", "rsa_cert.crt"); +const cert = readFileSync(certFile); + +const COMMON_CERT: object = { + cert: "-----BEGIN CERTIFICATE-----\nMIIDXTCCAkWgAwIBAgIJAKLdQVPy90jjMA0GCSqGSIb3DQEBCwUAMEUxCzAJBgNV\nBAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEwHwYDVQQKDBhJbnRlcm5ldCBX\naWRnaXRzIFB0eSBMdGQwHhcNMTkwMjAzMTQ0OTM1WhcNMjAwMjAzMTQ0OTM1WjBF\nMQswCQYDVQQGEwJBVTETMBEGA1UECAwKU29tZS1TdGF0ZTEhMB8GA1UECgwYSW50\nZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB\nCgKCAQEA7i7IIEdICTiSTVx+ma6xHxOtcbd6wGW3nkxlCkJ1UuV8NmY5ovMsGnGD\nhJJtUQ2j5ig5BcJUf3tezqCNW4tKnSOgSISfEAKvpn2BPvaFq3yx2Yjz0ruvcGKp\nDMZBXmB/AAtGyN/UFXzkrcfppmLHJTaBYGG6KnmU43gPkSDy4iw46CJFUOupc51A\nFIz7RsE7mbT1plCM8e75gfqaZSn2k+Wmy+8n1HGyYHhVISRVvPqkS7gVLSVEdTea\nUtKP1Vx/818/HDWk3oIvDVWI9CFH73elNxBkMH5zArSNIBTehdnehyAevjY4RaC/\nkK8rslO3e4EtJ9SnA4swOjCiqAIQEwIDAQABo1AwTjAdBgNVHQ4EFgQUv5rc9Smm\n9c4YnNf3hR49t4rH4yswHwYDVR0jBBgwFoAUv5rc9Smm9c4YnNf3hR49t4rH4ysw\nDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAQEATcL9CAAXg0u//eYUAlQa\nL+l8yKHS1rsq1sdmx7pvsmfZ2g8ONQGfSF3TkzkI2OOnCBokeqAYuyT8awfdNUtE\nEHOihv4ZzhK2YZVuy0fHX2d4cCFeQpdxno7aN6B37qtsLIRZxkD8PU60Dfu9ea5F\nDDynnD0TUabna6a0iGn77yD8GPhjaJMOz3gMYjQFqsKL252isDVHEDbpVxIzxPmN\nw1+WK8zRNdunAcHikeoKCuAPvlZ83gDQHp07dYdbuZvHwGj0nfxBLc9qt90XsBtC\n4IYR7c/bcLMmKXYf0qoQ4OzngsnPI5M+v9QEHvYWaKVwFY4CTcSNJEwfXw+BAeO5\nOA==\n-----END CERTIFICATE-----", + key: "-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDuLsggR0gJOJJN\nXH6ZrrEfE61xt3rAZbeeTGUKQnVS5Xw2Zjmi8ywacYOEkm1RDaPmKDkFwlR/e17O\noI1bi0qdI6BIhJ8QAq+mfYE+9oWrfLHZiPPSu69wYqkMxkFeYH8AC0bI39QVfOSt\nx+mmYsclNoFgYboqeZTjeA+RIPLiLDjoIkVQ66lznUAUjPtGwTuZtPWmUIzx7vmB\n+pplKfaT5abL7yfUcbJgeFUhJFW8+qRLuBUtJUR1N5pS0o/VXH/zXz8cNaTegi8N\nVYj0IUfvd6U3EGQwfnMCtI0gFN6F2d6HIB6+NjhFoL+QryuyU7d7gS0n1KcDizA6\nMKKoAhATAgMBAAECggEAd5g/3o1MK20fcP7PhsVDpHIR9faGCVNJto9vcI5cMMqP\n6xS7PgnSDFkRC6EmiLtLn8Z0k2K3YOeGfEP7lorDZVG9KoyE/doLbpK4MfBAwBG1\nj6AHpbmd5tVzQrnNmuDjBBelbDmPWVbD0EqAFI6mphXPMqD/hFJWIz1mu52Kt2s6\n++MkdqLO0ORDNhKmzu6SADQEcJ9Suhcmv8nccMmwCsIQAUrfg3qOyqU4//8QB8ZM\njosO3gMUesihVeuF5XpptFjrAliPgw9uIG0aQkhVbf/17qy0XRi8dkqXj3efxEDp\n1LSqZjBFiqJlFchbz19clwavMF/FhxHpKIhhmkkRSQKBgQD9blaWSg/2AGNhRfpX\nYq+6yKUkUD4jL7pmX1BVca6dXqILWtHl2afWeUorgv2QaK1/MJDH9Gz9Gu58hJb3\nymdeAISwPyHp8euyLIfiXSAi+ibKXkxkl1KQSweBM2oucnLsNne6Iv6QmXPpXtro\nnTMoGQDS7HVRy1on5NQLMPbUBQKBgQDwmN+um8F3CW6ZV1ZljJm7BFAgNyJ7m/5Q\nYUcOO5rFbNsHexStrx/h8jYnpdpIVlxACjh1xIyJ3lOCSAWfBWCS6KpgeO1Y484k\nEYhGjoUsKNQia8UWVt+uWnwjVSDhQjy5/pSH9xyFrUfDg8JnSlhsy0oC0C/PBjxn\nhxmADSLnNwKBgQD2A51USVMTKC9Q50BsgeU6+bmt9aNMPvHAnPf76d5q78l4IlKt\nwMs33QgOExuYirUZSgjRwknmrbUi9QckRbxwOSqVeMOwOWLm1GmYaXRf39u2CTI5\nV9gTMHJ5jnKd4gYDnaA99eiOcBhgS+9PbgKSAyuUlWwR2ciL/4uDzaVeDQKBgDym\nvRSeTRn99bSQMMZuuD5N6wkD/RxeCbEnpKrw2aZVN63eGCtkj0v9LCu4gptjseOu\n7+a4Qplqw3B/SXN5/otqPbEOKv8Shl/PT6RBv06PiFKZClkEU2T3iH27sws2EGru\nw3C3GaiVMxcVewdg1YOvh5vH8ZVlxApxIzuFlDvnAoGAN5w+gukxd5QnP/7hcLDZ\nF+vesAykJX71AuqFXB4Wh/qFY92CSm7ImexWA/L9z461+NKeJwb64Nc53z59oA10\n/3o2OcIe44kddZXQVP6KTZBd7ySVhbtOiK3/pCy+BQRsrC7d71W914DxNWadwZ+a\njtwwKjDzmPwdIXDSQarCx0U=\n-----END PRIVATE KEY-----", + passphrase: "1234", +}; + +const socket_domain = join(realpathSync(tmpdir()), "node-tls-server.sock"); + +describe("tls.createServer listen", () => { + it("should throw when no port or path when using options", done => { + expect(() => createServer(COMMON_CERT).listen({ exclusive: true })).toThrow( + 'The argument \'options\' must have the property "port" or "path". Received {"exclusive":true}', + ); + done(); + }); + + it("should listen on IPv6 by default", done => { + const { mustCall, mustNotCall } = createCallCheckCtx(done); + + const server: Server = createServer(COMMON_CERT); + let timeout: Timer; + const closeAndFail = () => { + clearTimeout(timeout); + server.close(); + mustNotCall()(); + }; + server.on("error", closeAndFail); + timeout = setTimeout(closeAndFail, 100); + + server.listen( + 0, + mustCall(() => { + const address = server.address() as AddressInfo; + expect(address.address).toStrictEqual("::"); + //system should provide an port when 0 or no port is passed + expect(address.port).toBeGreaterThan(100); + expect(address.family).toStrictEqual("IPv6"); + server.close(); + done(); + }), + ); + }); + + it("should listen on IPv4", done => { + const { mustCall, mustNotCall } = createCallCheckCtx(done); + + const server: Server = createServer(COMMON_CERT); + + let timeout: Timer; + const closeAndFail = () => { + clearTimeout(timeout); + server.close(); + mustNotCall()(); + }; + server.on("error", closeAndFail); + timeout = setTimeout(closeAndFail, 100); + + server.listen( + 0, + "0.0.0.0", + mustCall(() => { + const address = server.address() as AddressInfo; + expect(address.address).toStrictEqual("0.0.0.0"); + //system should provide an port when 0 or no port is passed + expect(address.port).toBeGreaterThan(100); + expect(address.family).toStrictEqual("IPv4"); + server.close(); + done(); + }), + ); + }); + + it("should call listening", done => { + const { mustCall, mustNotCall } = createCallCheckCtx(done); + + const server: Server = createServer(COMMON_CERT); + + let timeout: Timer; + const closeAndFail = () => { + clearTimeout(timeout); + server.close(); + mustNotCall()(); + }; + + server.on("error", closeAndFail).on( + "listening", + mustCall(() => { + clearTimeout(timeout); + server.close(); + done(); + }), + ); + + timeout = setTimeout(closeAndFail, 100); + + server.listen(0, "0.0.0.0"); + }); + + it("should listen on localhost", done => { + const { mustCall, mustNotCall } = createCallCheckCtx(done); + + const server: Server = createServer(COMMON_CERT); + + let timeout: Timer; + const closeAndFail = () => { + clearTimeout(timeout); + server.close(); + mustNotCall()(); + }; + server.on("error", closeAndFail); + timeout = setTimeout(closeAndFail, 100); + + server.listen( + 0, + "::1", + mustCall(() => { + const address = server.address() as AddressInfo; + expect(address.address).toStrictEqual("::1"); + //system should provide an port when 0 or no port is passed + expect(address.port).toBeGreaterThan(100); + expect(address.family).toStrictEqual("IPv6"); + server.close(); + done(); + }), + ); + }); + + it("should listen on localhost", done => { + const { mustCall, mustNotCall } = createCallCheckCtx(done); + + const server: Server = createServer(COMMON_CERT); + + let timeout: Timer; + const closeAndFail = () => { + clearTimeout(timeout); + server.close(); + mustNotCall()(); + }; + server.on("error", closeAndFail); + timeout = setTimeout(closeAndFail, 100); + + server.listen( + 0, + "::1", + mustCall(() => { + const address = server.address() as AddressInfo; + expect(address.address).toStrictEqual("::1"); + expect(address.family).toStrictEqual("IPv6"); + server.close(); + done(); + }), + ); + }); + + it("should listen without port or host", done => { + const { mustCall, mustNotCall } = createCallCheckCtx(done); + + const server: Server = createServer(COMMON_CERT); + + let timeout: Timer; + const closeAndFail = () => { + clearTimeout(timeout); + server.close(); + mustNotCall()(); + }; + server.on("error", closeAndFail); + timeout = setTimeout(closeAndFail, 100); + + server.listen( + mustCall(() => { + const address = server.address() as AddressInfo; + expect(address.address).toStrictEqual("::"); + //system should provide an port when 0 or no port is passed + expect(address.port).toBeGreaterThan(100); + expect(address.family).toStrictEqual("IPv6"); + server.close(); + done(); + }), + ); + }); + + it("should listen on the correct port", done => { + const { mustCall, mustNotCall } = createCallCheckCtx(done); + + const server: Server = createServer(COMMON_CERT); + + let timeout: Timer; + const closeAndFail = () => { + clearTimeout(timeout); + server.close(); + mustNotCall()(); + }; + server.on("error", closeAndFail); + timeout = setTimeout(closeAndFail, 100); + + server.listen( + 49027, + mustCall(() => { + const address = server.address() as AddressInfo; + expect(address.address).toStrictEqual("::"); + expect(address.port).toStrictEqual(49027); + expect(address.family).toStrictEqual("IPv6"); + server.close(); + done(); + }), + ); + }); + + it("should listen on the correct port with IPV4", done => { + const { mustCall, mustNotCall } = createCallCheckCtx(done); + + const server: Server = createServer(COMMON_CERT); + + let timeout: Timer; + const closeAndFail = () => { + clearTimeout(timeout); + server.close(); + mustNotCall()(); + }; + server.on("error", closeAndFail); + timeout = setTimeout(closeAndFail, 100); + + server.listen( + 49026, + "0.0.0.0", + mustCall(() => { + const address = server.address() as AddressInfo; + expect(address.address).toStrictEqual("0.0.0.0"); + expect(address.port).toStrictEqual(49026); + expect(address.family).toStrictEqual("IPv4"); + server.close(); + done(); + }), + ); + }); + + it("should listen on unix domain socket", done => { + const { mustCall, mustNotCall } = createCallCheckCtx(done); + + const server: Server = createServer(COMMON_CERT); + + let timeout: Timer; + const closeAndFail = () => { + clearTimeout(timeout); + server.close(); + mustNotCall()(); + }; + server.on("error", closeAndFail); + timeout = setTimeout(closeAndFail, 100); + + server.listen( + socket_domain, + mustCall(() => { + const address = server.address(); + expect(address).toStrictEqual(socket_domain); + server.close(); + done(); + }), + ); + }); + + it("should not listen with wrong password", done => { + const { mustCall, mustNotCall } = createCallCheckCtx(done); + + const server: Server = createServer({ + key: passKey, + passphrase: "invalid", + cert: cert, + }); + + server.on("error", mustCall()); + let timeout: Timer; + function closeAndFail() { + clearTimeout(timeout); + server.close(); + mustNotCall()(); + } + + timeout = setTimeout(closeAndFail, 100); + + server.listen(0, "0.0.0.0", closeAndFail); + }); + + it("should not listen without cert", done => { + const { mustCall, mustNotCall } = createCallCheckCtx(done); + + const server: Server = createServer({ + key: passKey, + passphrase: "invalid", + }); + + server.on("error", mustCall()); + + let timeout: Timer; + function closeAndFail() { + clearTimeout(timeout); + server.close(); + mustNotCall()(); + } + + timeout = setTimeout(closeAndFail, 100); + + server.listen(0, "0.0.0.0", closeAndFail); + }); + + it("should not listen without password", done => { + const { mustCall, mustNotCall } = createCallCheckCtx(done); + + const server: Server = createServer({ + key: passKey, + cert: cert, + }); + + server.on("error", mustCall()); + + let timeout: Timer; + function closeAndFail() { + clearTimeout(timeout); + server.close(); + mustNotCall()(); + } + + timeout = setTimeout(closeAndFail, 100); + + server.listen(0, "0.0.0.0", closeAndFail); + }); +}); + +describe("tls.createServer events", () => { + it("should receive data", done => { + const { mustCall, mustNotCall } = createCallCheckCtx(done); + let timeout: Timer; + let client: any = null; + let is_done = false; + const onData = mustCall(data => { + is_done = true; + clearTimeout(timeout); + server.close(); + expect(data.byteLength).toBe(5); + expect(data.toString("utf8")).toBe("Hello"); + done(); + }); + + const server: Server = createServer(COMMON_CERT, (socket: TLSSocket) => { + socket.on("data", onData); + }); + + const closeAndFail = () => { + if (is_done) return; + clearTimeout(timeout); + server.close(); + client?.end(); + mustNotCall("no data received")(); + }; + + server.on("error", closeAndFail); + + //should be faster than 100ms + timeout = setTimeout(closeAndFail, 100); + + server.listen( + mustCall(async () => { + const address = server.address() as AddressInfo; + client = await Bun.connect({ + tls: true, + hostname: address.address, + port: address.port, + socket: { + data(socket) {}, + handshake(socket, success, verifyError) { + if (socket.write("Hello")) { + socket.end(); + } + }, + connectError: closeAndFail, // connection failed + }, + }).catch(closeAndFail); + }), + ); + }); + + it("should call end", done => { + const { mustCall, mustNotCall } = createCallCheckCtx(done); + let timeout: Timer; + let is_done = false; + const onEnd = mustCall(() => { + is_done = true; + clearTimeout(timeout); + server.close(); + done(); + }); + + const server: Server = createServer(COMMON_CERT, (socket: TLSSocket) => { + socket.on("end", onEnd); + socket.end(); + }); + + const closeAndFail = () => { + if (is_done) return; + clearTimeout(timeout); + server.close(); + mustNotCall("end not called")(); + }; + server.on("error", closeAndFail); + + //should be faster than 100ms + timeout = setTimeout(closeAndFail, 100); + + server.listen( + mustCall(async () => { + const address = server.address() as AddressInfo; + await Bun.connect({ + tls: true, + hostname: address.address, + port: address.port, + socket: { + data(socket) {}, + open(socket) {}, + connectError: closeAndFail, // connection failed + }, + }).catch(closeAndFail); + }), + ); + }); + + it("should call close", done => { + let closed = false; + const server: Server = createServer(COMMON_CERT); + server.listen().on("close", () => { + closed = true; + }); + server.close(); + expect(closed).toBe(true); + done(); + }); + + it("should call connection and drop", done => { + const { mustCall, mustNotCall } = createCallCheckCtx(done); + + let timeout: Timer; + let is_done = false; + const server = createServer(); + let maxClients = 2; + server.maxConnections = maxClients - 1; + + const closeAndFail = () => { + if (is_done) return; + clearTimeout(timeout); + server.close(); + mustNotCall("drop not called")(); + }; + + //should be faster than 100ms + timeout = setTimeout(closeAndFail, 100); + let connection_called = false; + server + .on( + "connection", + mustCall(() => { + connection_called = true; + }), + ) + .on( + "drop", + mustCall(data => { + is_done = true; + server.close(); + clearTimeout(timeout); + expect(data.localPort).toBeDefined(); + expect(data.remotePort).toBeDefined(); + expect(data.remoteFamily).toBeDefined(); + expect(data.localFamily).toBeDefined(); + expect(data.localAddress).toBeDefined(); + expect(connection_called).toBe(true); + done(); + }), + ) + .listen(async () => { + const address = server.address() as AddressInfo; + + async function spawnClient() { + await Bun.connect({ + tls: true, + port: address?.port, + hostname: address?.address, + socket: { + data(socket) {}, + handshake(socket, success, verifyError) {}, + open(socket) { + socket.end(); + }, + }, + }); + } + + const promises = []; + for (let i = 0; i < maxClients; i++) { + promises.push(spawnClient()); + } + await Promise.all(promises).catch(closeAndFail); + }); + }); + + it("should call error", done => { + const { mustCall, mustNotCall } = createCallCheckCtx(done); + + let timeout: Timer; + const server: Server = createServer(COMMON_CERT); + + const closeAndFail = () => { + clearTimeout(timeout); + server.close(); + mustNotCall("error not called")(); + }; + + //should be faster than 100ms + timeout = setTimeout(closeAndFail, 100); + + server + .on( + "error", + mustCall(err => { + server.close(); + clearTimeout(timeout); + expect(err).toBeDefined(); + done(); + }), + ) + .listen(123456); + }); + + it("should call abort with signal", done => { + const { mustCall, mustNotCall } = createCallCheckCtx(done); + + const controller = new AbortController(); + let timeout: Timer; + const server = createServer(COMMON_CERT); + + const closeAndFail = () => { + clearTimeout(timeout); + server.close(); + mustNotCall("close not called")(); + }; + + //should be faster than 100ms + timeout = setTimeout(closeAndFail, 100); + + server + .on( + "close", + mustCall(() => { + clearTimeout(timeout); + done(); + }), + ) + .listen({ port: 0, signal: controller.signal }, () => { + controller.abort(); + }); + }); + + it("should echo data", done => { + const { mustCall, mustNotCall } = createCallCheckCtx(done); + let timeout: Timer; + let client: any = null; + const server: Server = createServer(COMMON_CERT, (socket: TLSSocket) => { + socket.pipe(socket); + }); + let is_done = false; + const closeAndFail = () => { + if (is_done) return; + clearTimeout(timeout); + server.close(); + client?.end(); + mustNotCall("no data received")(); + }; + + server.on("error", closeAndFail); + + //should be faster than 100ms + timeout = setTimeout(closeAndFail, 100); + + server.listen( + mustCall(async () => { + const address = server.address() as AddressInfo; + client = await Bun.connect({ + tls: true, + hostname: address.address, + port: address.port, + socket: { + drain(socket) { + socket.write("Hello"); + }, + data(socket, data) { + is_done = true; + clearTimeout(timeout); + server.close(); + socket.end(); + expect(data.byteLength).toBe(5); + expect(data.toString("utf8")).toBe("Hello"); + done(); + }, + handshake(socket) { + socket.write("Hello"); + }, + connectError: closeAndFail, // connection failed + }, + }).catch(closeAndFail); + }), + ); + }); +}); |