diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/bun.js/api/server.zig | 13 | ||||
-rw-r--r-- | src/bun.js/api/transpiler.zig | 2 | ||||
-rw-r--r-- | src/bun.js/bindings/JSTranspiler+BunPlugin-impl.h | 0 | ||||
-rw-r--r-- | src/bun.js/bindings/ZigGeneratedClasses+DOMClientIsoSubspaces.h | 45 | ||||
-rw-r--r-- | src/bun.js/bindings/ZigGeneratedClasses+DOMIsoSubspaces.h | 45 | ||||
-rw-r--r-- | src/bun.js/bindings/ZigGeneratedClasses+lazyStructureHeader.h | 198 | ||||
-rw-r--r-- | src/bun.js/bindings/ZigGeneratedClasses+lazyStructureImpl.h | 189 | ||||
-rw-r--r-- | src/bun.js/bindings/ZigGeneratedClasses.cpp | 11020 | ||||
-rw-r--r-- | src/bun.js/bindings/ZigGeneratedClasses.h | 808 | ||||
-rw-r--r-- | src/bun.js/bindings/bindings.cpp | 17 | ||||
-rw-r--r-- | src/bun.js/bindings/generated_classes.zig | 4064 | ||||
-rw-r--r-- | src/bun.js/bindings/generated_classes_list.zig | 1 | ||||
-rw-r--r-- | src/jsc.zig | 15 | ||||
-rw-r--r-- | src/options.zig | 2 |
14 files changed, 8453 insertions, 7966 deletions
diff --git a/src/bun.js/api/server.zig b/src/bun.js/api/server.zig index 3612e7d3e..f4f4907f1 100644 --- a/src/bun.js/api/server.zig +++ b/src/bun.js/api/server.zig @@ -704,14 +704,16 @@ fn NewRequestContext(comptime ssl_enabled: bool, comptime debug_mode: bool, comp const arguments = callframe.arguments(2); var ctx = arguments.ptr[1].asPromisePtr(@This()); const result = arguments.ptr[0]; + result.ensureStillAlive(); + ctx.pending_promises_for_abort -|= 1; if (ctx.aborted) { ctx.finalizeForAbort(); return JSValue.jsUndefined(); } - if (result.isEmptyOrUndefinedOrNull()) { - ctx.renderMissing(); + if (ctx.didUpgradeWebSocket()) { + ctx.finalize(); return JSValue.jsUndefined(); } @@ -720,12 +722,7 @@ fn NewRequestContext(comptime ssl_enabled: bool, comptime debug_mode: bool, comp } fn handleResolve(ctx: *RequestContext, value: JSC.JSValue) void { - if (ctx.didUpgradeWebSocket()) { - ctx.finalize(); - return; - } - - if (value.isEmptyOrUndefinedOrNull()) { + if (value.isEmptyOrUndefinedOrNull() or !value.isCell()) { ctx.renderMissing(); return; } diff --git a/src/bun.js/api/transpiler.zig b/src/bun.js/api/transpiler.zig index eb070b6bc..d4f6cedb7 100644 --- a/src/bun.js/api/transpiler.zig +++ b/src/bun.js/api/transpiler.zig @@ -1107,7 +1107,7 @@ pub fn transformSync( globalThis.throwValue(this.bundler.log.toJS(globalThis, globalThis.allocator(), "Parse error")); return .zero; } - +JSC.Codegen var buffer_writer = this.buffer_writer orelse brk: { var writer = JSPrinter.BufferWriter.init(arena.backingAllocator()) catch { globalThis.throw("Failed to create BufferWriter", .{}); diff --git a/src/bun.js/bindings/JSTranspiler+BunPlugin-impl.h b/src/bun.js/bindings/JSTranspiler+BunPlugin-impl.h new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/src/bun.js/bindings/JSTranspiler+BunPlugin-impl.h diff --git a/src/bun.js/bindings/ZigGeneratedClasses+DOMClientIsoSubspaces.h b/src/bun.js/bindings/ZigGeneratedClasses+DOMClientIsoSubspaces.h index f74d54b02..cdb22cb38 100644 --- a/src/bun.js/bindings/ZigGeneratedClasses+DOMClientIsoSubspaces.h +++ b/src/bun.js/bindings/ZigGeneratedClasses+DOMClientIsoSubspaces.h @@ -1,24 +1,25 @@ +std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForBlob; +std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForBlobConstructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCryptoHasher; +std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCryptoHasherConstructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForDirent; +std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForDirentConstructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForExpect; +std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForExpectConstructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForFileSystemRouter; +std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForFileSystemRouterConstructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForListener; +std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForMD4; +std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForMD4Constructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForMD5; +std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForMD5Constructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForMatchedRoute; +std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForNodeJSFS; +std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForNodeJSFSConstructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForRequest; +std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForRequestConstructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForResponse; +std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForResponseConstructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSHA1; +std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSHA1Constructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSHA224; +std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSHA224Constructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSHA256; +std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSHA256Constructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSHA384; +std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSHA384Constructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSHA512; +std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSHA512Constructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSHA512_256; +std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSHA512_256Constructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForServerWebSocket; +std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForServerWebSocketConstructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSubprocess; std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForTCPSocket; std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForTLSSocket; -std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForListener; -std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSubprocess; -std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSHA1; -std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSHA1Constructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForMD5; -std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForMD5Constructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForMD4; -std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForMD4Constructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSHA224; -std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSHA224Constructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSHA512; -std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSHA512Constructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSHA384; -std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSHA384Constructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSHA256; -std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSHA256Constructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSHA512_256; -std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSHA512_256Constructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCryptoHasher; -std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCryptoHasherConstructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForServerWebSocket; -std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForServerWebSocketConstructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForFileSystemRouter; -std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForFileSystemRouterConstructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForMatchedRoute; -std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForExpect; -std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForExpectConstructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForTextDecoder; -std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForTextDecoderConstructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForRequest; -std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForRequestConstructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForResponse; -std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForResponseConstructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForBlob; -std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForBlobConstructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForDirent; -std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForDirentConstructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForNodeJSFS; -std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForNodeJSFSConstructor;
\ No newline at end of file +std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForTextDecoder; +std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForTextDecoderConstructor;std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForTranspiler; +std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForTranspilerConstructor;
\ No newline at end of file diff --git a/src/bun.js/bindings/ZigGeneratedClasses+DOMIsoSubspaces.h b/src/bun.js/bindings/ZigGeneratedClasses+DOMIsoSubspaces.h index cda555fa9..291fa4e3b 100644 --- a/src/bun.js/bindings/ZigGeneratedClasses+DOMIsoSubspaces.h +++ b/src/bun.js/bindings/ZigGeneratedClasses+DOMIsoSubspaces.h @@ -1,24 +1,25 @@ +std::unique_ptr<IsoSubspace> m_subspaceForBlob; +std::unique_ptr<IsoSubspace> m_subspaceForBlobConstructor;std::unique_ptr<IsoSubspace> m_subspaceForCryptoHasher; +std::unique_ptr<IsoSubspace> m_subspaceForCryptoHasherConstructor;std::unique_ptr<IsoSubspace> m_subspaceForDirent; +std::unique_ptr<IsoSubspace> m_subspaceForDirentConstructor;std::unique_ptr<IsoSubspace> m_subspaceForExpect; +std::unique_ptr<IsoSubspace> m_subspaceForExpectConstructor;std::unique_ptr<IsoSubspace> m_subspaceForFileSystemRouter; +std::unique_ptr<IsoSubspace> m_subspaceForFileSystemRouterConstructor;std::unique_ptr<IsoSubspace> m_subspaceForListener; +std::unique_ptr<IsoSubspace> m_subspaceForMD4; +std::unique_ptr<IsoSubspace> m_subspaceForMD4Constructor;std::unique_ptr<IsoSubspace> m_subspaceForMD5; +std::unique_ptr<IsoSubspace> m_subspaceForMD5Constructor;std::unique_ptr<IsoSubspace> m_subspaceForMatchedRoute; +std::unique_ptr<IsoSubspace> m_subspaceForNodeJSFS; +std::unique_ptr<IsoSubspace> m_subspaceForNodeJSFSConstructor;std::unique_ptr<IsoSubspace> m_subspaceForRequest; +std::unique_ptr<IsoSubspace> m_subspaceForRequestConstructor;std::unique_ptr<IsoSubspace> m_subspaceForResponse; +std::unique_ptr<IsoSubspace> m_subspaceForResponseConstructor;std::unique_ptr<IsoSubspace> m_subspaceForSHA1; +std::unique_ptr<IsoSubspace> m_subspaceForSHA1Constructor;std::unique_ptr<IsoSubspace> m_subspaceForSHA224; +std::unique_ptr<IsoSubspace> m_subspaceForSHA224Constructor;std::unique_ptr<IsoSubspace> m_subspaceForSHA256; +std::unique_ptr<IsoSubspace> m_subspaceForSHA256Constructor;std::unique_ptr<IsoSubspace> m_subspaceForSHA384; +std::unique_ptr<IsoSubspace> m_subspaceForSHA384Constructor;std::unique_ptr<IsoSubspace> m_subspaceForSHA512; +std::unique_ptr<IsoSubspace> m_subspaceForSHA512Constructor;std::unique_ptr<IsoSubspace> m_subspaceForSHA512_256; +std::unique_ptr<IsoSubspace> m_subspaceForSHA512_256Constructor;std::unique_ptr<IsoSubspace> m_subspaceForServerWebSocket; +std::unique_ptr<IsoSubspace> m_subspaceForServerWebSocketConstructor;std::unique_ptr<IsoSubspace> m_subspaceForSubprocess; std::unique_ptr<IsoSubspace> m_subspaceForTCPSocket; std::unique_ptr<IsoSubspace> m_subspaceForTLSSocket; -std::unique_ptr<IsoSubspace> m_subspaceForListener; -std::unique_ptr<IsoSubspace> m_subspaceForSubprocess; -std::unique_ptr<IsoSubspace> m_subspaceForSHA1; -std::unique_ptr<IsoSubspace> m_subspaceForSHA1Constructor;std::unique_ptr<IsoSubspace> m_subspaceForMD5; -std::unique_ptr<IsoSubspace> m_subspaceForMD5Constructor;std::unique_ptr<IsoSubspace> m_subspaceForMD4; -std::unique_ptr<IsoSubspace> m_subspaceForMD4Constructor;std::unique_ptr<IsoSubspace> m_subspaceForSHA224; -std::unique_ptr<IsoSubspace> m_subspaceForSHA224Constructor;std::unique_ptr<IsoSubspace> m_subspaceForSHA512; -std::unique_ptr<IsoSubspace> m_subspaceForSHA512Constructor;std::unique_ptr<IsoSubspace> m_subspaceForSHA384; -std::unique_ptr<IsoSubspace> m_subspaceForSHA384Constructor;std::unique_ptr<IsoSubspace> m_subspaceForSHA256; -std::unique_ptr<IsoSubspace> m_subspaceForSHA256Constructor;std::unique_ptr<IsoSubspace> m_subspaceForSHA512_256; -std::unique_ptr<IsoSubspace> m_subspaceForSHA512_256Constructor;std::unique_ptr<IsoSubspace> m_subspaceForCryptoHasher; -std::unique_ptr<IsoSubspace> m_subspaceForCryptoHasherConstructor;std::unique_ptr<IsoSubspace> m_subspaceForServerWebSocket; -std::unique_ptr<IsoSubspace> m_subspaceForServerWebSocketConstructor;std::unique_ptr<IsoSubspace> m_subspaceForFileSystemRouter; -std::unique_ptr<IsoSubspace> m_subspaceForFileSystemRouterConstructor;std::unique_ptr<IsoSubspace> m_subspaceForMatchedRoute; -std::unique_ptr<IsoSubspace> m_subspaceForExpect; -std::unique_ptr<IsoSubspace> m_subspaceForExpectConstructor;std::unique_ptr<IsoSubspace> m_subspaceForTextDecoder; -std::unique_ptr<IsoSubspace> m_subspaceForTextDecoderConstructor;std::unique_ptr<IsoSubspace> m_subspaceForRequest; -std::unique_ptr<IsoSubspace> m_subspaceForRequestConstructor;std::unique_ptr<IsoSubspace> m_subspaceForResponse; -std::unique_ptr<IsoSubspace> m_subspaceForResponseConstructor;std::unique_ptr<IsoSubspace> m_subspaceForBlob; -std::unique_ptr<IsoSubspace> m_subspaceForBlobConstructor;std::unique_ptr<IsoSubspace> m_subspaceForDirent; -std::unique_ptr<IsoSubspace> m_subspaceForDirentConstructor;std::unique_ptr<IsoSubspace> m_subspaceForNodeJSFS; -std::unique_ptr<IsoSubspace> m_subspaceForNodeJSFSConstructor;
\ No newline at end of file +std::unique_ptr<IsoSubspace> m_subspaceForTextDecoder; +std::unique_ptr<IsoSubspace> m_subspaceForTextDecoderConstructor;std::unique_ptr<IsoSubspace> m_subspaceForTranspiler; +std::unique_ptr<IsoSubspace> m_subspaceForTranspilerConstructor;
\ No newline at end of file diff --git a/src/bun.js/bindings/ZigGeneratedClasses+lazyStructureHeader.h b/src/bun.js/bindings/ZigGeneratedClasses+lazyStructureHeader.h index 2c0cf9929..ffd6fde0d 100644 --- a/src/bun.js/bindings/ZigGeneratedClasses+lazyStructureHeader.h +++ b/src/bun.js/bindings/ZigGeneratedClasses+lazyStructureHeader.h @@ -1,138 +1,144 @@ -JSC::Structure* JSTCPSocketStructure() { return m_JSTCPSocket.getInitializedOnMainThread(this); } - JSC::JSObject* JSTCPSocketConstructor() { return m_JSTCPSocket.constructorInitializedOnMainThread(this); } - JSC::JSValue JSTCPSocketPrototype() { return m_JSTCPSocket.prototypeInitializedOnMainThread(this); } - JSC::LazyClassStructure m_JSTCPSocket; - bool hasJSTCPSocketSetterValue { false }; - mutable JSC::WriteBarrier<JSC::Unknown> m_JSTCPSocketSetterValue; -JSC::Structure* JSTLSSocketStructure() { return m_JSTLSSocket.getInitializedOnMainThread(this); } - JSC::JSObject* JSTLSSocketConstructor() { return m_JSTLSSocket.constructorInitializedOnMainThread(this); } - JSC::JSValue JSTLSSocketPrototype() { return m_JSTLSSocket.prototypeInitializedOnMainThread(this); } - JSC::LazyClassStructure m_JSTLSSocket; - bool hasJSTLSSocketSetterValue { false }; - mutable JSC::WriteBarrier<JSC::Unknown> m_JSTLSSocketSetterValue; +JSC::Structure* JSBlobStructure() { return m_JSBlob.getInitializedOnMainThread(this); } + JSC::JSObject* JSBlobConstructor() { return m_JSBlob.constructorInitializedOnMainThread(this); } + JSC::JSValue JSBlobPrototype() { return m_JSBlob.prototypeInitializedOnMainThread(this); } + JSC::LazyClassStructure m_JSBlob; + bool hasJSBlobSetterValue { false }; + mutable JSC::WriteBarrier<JSC::Unknown> m_JSBlobSetterValue; +JSC::Structure* JSCryptoHasherStructure() { return m_JSCryptoHasher.getInitializedOnMainThread(this); } + JSC::JSObject* JSCryptoHasherConstructor() { return m_JSCryptoHasher.constructorInitializedOnMainThread(this); } + JSC::JSValue JSCryptoHasherPrototype() { return m_JSCryptoHasher.prototypeInitializedOnMainThread(this); } + JSC::LazyClassStructure m_JSCryptoHasher; + bool hasJSCryptoHasherSetterValue { false }; + mutable JSC::WriteBarrier<JSC::Unknown> m_JSCryptoHasherSetterValue; +JSC::Structure* JSDirentStructure() { return m_JSDirent.getInitializedOnMainThread(this); } + JSC::JSObject* JSDirentConstructor() { return m_JSDirent.constructorInitializedOnMainThread(this); } + JSC::JSValue JSDirentPrototype() { return m_JSDirent.prototypeInitializedOnMainThread(this); } + JSC::LazyClassStructure m_JSDirent; + bool hasJSDirentSetterValue { false }; + mutable JSC::WriteBarrier<JSC::Unknown> m_JSDirentSetterValue; +JSC::Structure* JSExpectStructure() { return m_JSExpect.getInitializedOnMainThread(this); } + JSC::JSObject* JSExpectConstructor() { return m_JSExpect.constructorInitializedOnMainThread(this); } + JSC::JSValue JSExpectPrototype() { return m_JSExpect.prototypeInitializedOnMainThread(this); } + JSC::LazyClassStructure m_JSExpect; + bool hasJSExpectSetterValue { false }; + mutable JSC::WriteBarrier<JSC::Unknown> m_JSExpectSetterValue; +JSC::Structure* JSFileSystemRouterStructure() { return m_JSFileSystemRouter.getInitializedOnMainThread(this); } + JSC::JSObject* JSFileSystemRouterConstructor() { return m_JSFileSystemRouter.constructorInitializedOnMainThread(this); } + JSC::JSValue JSFileSystemRouterPrototype() { return m_JSFileSystemRouter.prototypeInitializedOnMainThread(this); } + JSC::LazyClassStructure m_JSFileSystemRouter; + bool hasJSFileSystemRouterSetterValue { false }; + mutable JSC::WriteBarrier<JSC::Unknown> m_JSFileSystemRouterSetterValue; JSC::Structure* JSListenerStructure() { return m_JSListener.getInitializedOnMainThread(this); } JSC::JSObject* JSListenerConstructor() { return m_JSListener.constructorInitializedOnMainThread(this); } JSC::JSValue JSListenerPrototype() { return m_JSListener.prototypeInitializedOnMainThread(this); } JSC::LazyClassStructure m_JSListener; bool hasJSListenerSetterValue { false }; mutable JSC::WriteBarrier<JSC::Unknown> m_JSListenerSetterValue; -JSC::Structure* JSSubprocessStructure() { return m_JSSubprocess.getInitializedOnMainThread(this); } - JSC::JSObject* JSSubprocessConstructor() { return m_JSSubprocess.constructorInitializedOnMainThread(this); } - JSC::JSValue JSSubprocessPrototype() { return m_JSSubprocess.prototypeInitializedOnMainThread(this); } - JSC::LazyClassStructure m_JSSubprocess; - bool hasJSSubprocessSetterValue { false }; - mutable JSC::WriteBarrier<JSC::Unknown> m_JSSubprocessSetterValue; -JSC::Structure* JSSHA1Structure() { return m_JSSHA1.getInitializedOnMainThread(this); } - JSC::JSObject* JSSHA1Constructor() { return m_JSSHA1.constructorInitializedOnMainThread(this); } - JSC::JSValue JSSHA1Prototype() { return m_JSSHA1.prototypeInitializedOnMainThread(this); } - JSC::LazyClassStructure m_JSSHA1; - bool hasJSSHA1SetterValue { false }; - mutable JSC::WriteBarrier<JSC::Unknown> m_JSSHA1SetterValue; -JSC::Structure* JSMD5Structure() { return m_JSMD5.getInitializedOnMainThread(this); } - JSC::JSObject* JSMD5Constructor() { return m_JSMD5.constructorInitializedOnMainThread(this); } - JSC::JSValue JSMD5Prototype() { return m_JSMD5.prototypeInitializedOnMainThread(this); } - JSC::LazyClassStructure m_JSMD5; - bool hasJSMD5SetterValue { false }; - mutable JSC::WriteBarrier<JSC::Unknown> m_JSMD5SetterValue; JSC::Structure* JSMD4Structure() { return m_JSMD4.getInitializedOnMainThread(this); } JSC::JSObject* JSMD4Constructor() { return m_JSMD4.constructorInitializedOnMainThread(this); } JSC::JSValue JSMD4Prototype() { return m_JSMD4.prototypeInitializedOnMainThread(this); } JSC::LazyClassStructure m_JSMD4; bool hasJSMD4SetterValue { false }; mutable JSC::WriteBarrier<JSC::Unknown> m_JSMD4SetterValue; +JSC::Structure* JSMD5Structure() { return m_JSMD5.getInitializedOnMainThread(this); } + JSC::JSObject* JSMD5Constructor() { return m_JSMD5.constructorInitializedOnMainThread(this); } + JSC::JSValue JSMD5Prototype() { return m_JSMD5.prototypeInitializedOnMainThread(this); } + JSC::LazyClassStructure m_JSMD5; + bool hasJSMD5SetterValue { false }; + mutable JSC::WriteBarrier<JSC::Unknown> m_JSMD5SetterValue; +JSC::Structure* JSMatchedRouteStructure() { return m_JSMatchedRoute.getInitializedOnMainThread(this); } + JSC::JSObject* JSMatchedRouteConstructor() { return m_JSMatchedRoute.constructorInitializedOnMainThread(this); } + JSC::JSValue JSMatchedRoutePrototype() { return m_JSMatchedRoute.prototypeInitializedOnMainThread(this); } + JSC::LazyClassStructure m_JSMatchedRoute; + bool hasJSMatchedRouteSetterValue { false }; + mutable JSC::WriteBarrier<JSC::Unknown> m_JSMatchedRouteSetterValue; +JSC::Structure* JSNodeJSFSStructure() { return m_JSNodeJSFS.getInitializedOnMainThread(this); } + JSC::JSObject* JSNodeJSFSConstructor() { return m_JSNodeJSFS.constructorInitializedOnMainThread(this); } + JSC::JSValue JSNodeJSFSPrototype() { return m_JSNodeJSFS.prototypeInitializedOnMainThread(this); } + JSC::LazyClassStructure m_JSNodeJSFS; + bool hasJSNodeJSFSSetterValue { false }; + mutable JSC::WriteBarrier<JSC::Unknown> m_JSNodeJSFSSetterValue; +JSC::Structure* JSRequestStructure() { return m_JSRequest.getInitializedOnMainThread(this); } + JSC::JSObject* JSRequestConstructor() { return m_JSRequest.constructorInitializedOnMainThread(this); } + JSC::JSValue JSRequestPrototype() { return m_JSRequest.prototypeInitializedOnMainThread(this); } + JSC::LazyClassStructure m_JSRequest; + bool hasJSRequestSetterValue { false }; + mutable JSC::WriteBarrier<JSC::Unknown> m_JSRequestSetterValue; +JSC::Structure* JSResponseStructure() { return m_JSResponse.getInitializedOnMainThread(this); } + JSC::JSObject* JSResponseConstructor() { return m_JSResponse.constructorInitializedOnMainThread(this); } + JSC::JSValue JSResponsePrototype() { return m_JSResponse.prototypeInitializedOnMainThread(this); } + JSC::LazyClassStructure m_JSResponse; + bool hasJSResponseSetterValue { false }; + mutable JSC::WriteBarrier<JSC::Unknown> m_JSResponseSetterValue; +JSC::Structure* JSSHA1Structure() { return m_JSSHA1.getInitializedOnMainThread(this); } + JSC::JSObject* JSSHA1Constructor() { return m_JSSHA1.constructorInitializedOnMainThread(this); } + JSC::JSValue JSSHA1Prototype() { return m_JSSHA1.prototypeInitializedOnMainThread(this); } + JSC::LazyClassStructure m_JSSHA1; + bool hasJSSHA1SetterValue { false }; + mutable JSC::WriteBarrier<JSC::Unknown> m_JSSHA1SetterValue; JSC::Structure* JSSHA224Structure() { return m_JSSHA224.getInitializedOnMainThread(this); } JSC::JSObject* JSSHA224Constructor() { return m_JSSHA224.constructorInitializedOnMainThread(this); } JSC::JSValue JSSHA224Prototype() { return m_JSSHA224.prototypeInitializedOnMainThread(this); } JSC::LazyClassStructure m_JSSHA224; bool hasJSSHA224SetterValue { false }; mutable JSC::WriteBarrier<JSC::Unknown> m_JSSHA224SetterValue; -JSC::Structure* JSSHA512Structure() { return m_JSSHA512.getInitializedOnMainThread(this); } - JSC::JSObject* JSSHA512Constructor() { return m_JSSHA512.constructorInitializedOnMainThread(this); } - JSC::JSValue JSSHA512Prototype() { return m_JSSHA512.prototypeInitializedOnMainThread(this); } - JSC::LazyClassStructure m_JSSHA512; - bool hasJSSHA512SetterValue { false }; - mutable JSC::WriteBarrier<JSC::Unknown> m_JSSHA512SetterValue; -JSC::Structure* JSSHA384Structure() { return m_JSSHA384.getInitializedOnMainThread(this); } - JSC::JSObject* JSSHA384Constructor() { return m_JSSHA384.constructorInitializedOnMainThread(this); } - JSC::JSValue JSSHA384Prototype() { return m_JSSHA384.prototypeInitializedOnMainThread(this); } - JSC::LazyClassStructure m_JSSHA384; - bool hasJSSHA384SetterValue { false }; - mutable JSC::WriteBarrier<JSC::Unknown> m_JSSHA384SetterValue; JSC::Structure* JSSHA256Structure() { return m_JSSHA256.getInitializedOnMainThread(this); } JSC::JSObject* JSSHA256Constructor() { return m_JSSHA256.constructorInitializedOnMainThread(this); } JSC::JSValue JSSHA256Prototype() { return m_JSSHA256.prototypeInitializedOnMainThread(this); } JSC::LazyClassStructure m_JSSHA256; bool hasJSSHA256SetterValue { false }; mutable JSC::WriteBarrier<JSC::Unknown> m_JSSHA256SetterValue; +JSC::Structure* JSSHA384Structure() { return m_JSSHA384.getInitializedOnMainThread(this); } + JSC::JSObject* JSSHA384Constructor() { return m_JSSHA384.constructorInitializedOnMainThread(this); } + JSC::JSValue JSSHA384Prototype() { return m_JSSHA384.prototypeInitializedOnMainThread(this); } + JSC::LazyClassStructure m_JSSHA384; + bool hasJSSHA384SetterValue { false }; + mutable JSC::WriteBarrier<JSC::Unknown> m_JSSHA384SetterValue; +JSC::Structure* JSSHA512Structure() { return m_JSSHA512.getInitializedOnMainThread(this); } + JSC::JSObject* JSSHA512Constructor() { return m_JSSHA512.constructorInitializedOnMainThread(this); } + JSC::JSValue JSSHA512Prototype() { return m_JSSHA512.prototypeInitializedOnMainThread(this); } + JSC::LazyClassStructure m_JSSHA512; + bool hasJSSHA512SetterValue { false }; + mutable JSC::WriteBarrier<JSC::Unknown> m_JSSHA512SetterValue; JSC::Structure* JSSHA512_256Structure() { return m_JSSHA512_256.getInitializedOnMainThread(this); } JSC::JSObject* JSSHA512_256Constructor() { return m_JSSHA512_256.constructorInitializedOnMainThread(this); } JSC::JSValue JSSHA512_256Prototype() { return m_JSSHA512_256.prototypeInitializedOnMainThread(this); } JSC::LazyClassStructure m_JSSHA512_256; bool hasJSSHA512_256SetterValue { false }; mutable JSC::WriteBarrier<JSC::Unknown> m_JSSHA512_256SetterValue; -JSC::Structure* JSCryptoHasherStructure() { return m_JSCryptoHasher.getInitializedOnMainThread(this); } - JSC::JSObject* JSCryptoHasherConstructor() { return m_JSCryptoHasher.constructorInitializedOnMainThread(this); } - JSC::JSValue JSCryptoHasherPrototype() { return m_JSCryptoHasher.prototypeInitializedOnMainThread(this); } - JSC::LazyClassStructure m_JSCryptoHasher; - bool hasJSCryptoHasherSetterValue { false }; - mutable JSC::WriteBarrier<JSC::Unknown> m_JSCryptoHasherSetterValue; JSC::Structure* JSServerWebSocketStructure() { return m_JSServerWebSocket.getInitializedOnMainThread(this); } JSC::JSObject* JSServerWebSocketConstructor() { return m_JSServerWebSocket.constructorInitializedOnMainThread(this); } JSC::JSValue JSServerWebSocketPrototype() { return m_JSServerWebSocket.prototypeInitializedOnMainThread(this); } JSC::LazyClassStructure m_JSServerWebSocket; bool hasJSServerWebSocketSetterValue { false }; mutable JSC::WriteBarrier<JSC::Unknown> m_JSServerWebSocketSetterValue; -JSC::Structure* JSFileSystemRouterStructure() { return m_JSFileSystemRouter.getInitializedOnMainThread(this); } - JSC::JSObject* JSFileSystemRouterConstructor() { return m_JSFileSystemRouter.constructorInitializedOnMainThread(this); } - JSC::JSValue JSFileSystemRouterPrototype() { return m_JSFileSystemRouter.prototypeInitializedOnMainThread(this); } - JSC::LazyClassStructure m_JSFileSystemRouter; - bool hasJSFileSystemRouterSetterValue { false }; - mutable JSC::WriteBarrier<JSC::Unknown> m_JSFileSystemRouterSetterValue; -JSC::Structure* JSMatchedRouteStructure() { return m_JSMatchedRoute.getInitializedOnMainThread(this); } - JSC::JSObject* JSMatchedRouteConstructor() { return m_JSMatchedRoute.constructorInitializedOnMainThread(this); } - JSC::JSValue JSMatchedRoutePrototype() { return m_JSMatchedRoute.prototypeInitializedOnMainThread(this); } - JSC::LazyClassStructure m_JSMatchedRoute; - bool hasJSMatchedRouteSetterValue { false }; - mutable JSC::WriteBarrier<JSC::Unknown> m_JSMatchedRouteSetterValue; -JSC::Structure* JSExpectStructure() { return m_JSExpect.getInitializedOnMainThread(this); } - JSC::JSObject* JSExpectConstructor() { return m_JSExpect.constructorInitializedOnMainThread(this); } - JSC::JSValue JSExpectPrototype() { return m_JSExpect.prototypeInitializedOnMainThread(this); } - JSC::LazyClassStructure m_JSExpect; - bool hasJSExpectSetterValue { false }; - mutable JSC::WriteBarrier<JSC::Unknown> m_JSExpectSetterValue; +JSC::Structure* JSSubprocessStructure() { return m_JSSubprocess.getInitializedOnMainThread(this); } + JSC::JSObject* JSSubprocessConstructor() { return m_JSSubprocess.constructorInitializedOnMainThread(this); } + JSC::JSValue JSSubprocessPrototype() { return m_JSSubprocess.prototypeInitializedOnMainThread(this); } + JSC::LazyClassStructure m_JSSubprocess; + bool hasJSSubprocessSetterValue { false }; + mutable JSC::WriteBarrier<JSC::Unknown> m_JSSubprocessSetterValue; +JSC::Structure* JSTCPSocketStructure() { return m_JSTCPSocket.getInitializedOnMainThread(this); } + JSC::JSObject* JSTCPSocketConstructor() { return m_JSTCPSocket.constructorInitializedOnMainThread(this); } + JSC::JSValue JSTCPSocketPrototype() { return m_JSTCPSocket.prototypeInitializedOnMainThread(this); } + JSC::LazyClassStructure m_JSTCPSocket; + bool hasJSTCPSocketSetterValue { false }; + mutable JSC::WriteBarrier<JSC::Unknown> m_JSTCPSocketSetterValue; +JSC::Structure* JSTLSSocketStructure() { return m_JSTLSSocket.getInitializedOnMainThread(this); } + JSC::JSObject* JSTLSSocketConstructor() { return m_JSTLSSocket.constructorInitializedOnMainThread(this); } + JSC::JSValue JSTLSSocketPrototype() { return m_JSTLSSocket.prototypeInitializedOnMainThread(this); } + JSC::LazyClassStructure m_JSTLSSocket; + bool hasJSTLSSocketSetterValue { false }; + mutable JSC::WriteBarrier<JSC::Unknown> m_JSTLSSocketSetterValue; JSC::Structure* JSTextDecoderStructure() { return m_JSTextDecoder.getInitializedOnMainThread(this); } JSC::JSObject* JSTextDecoderConstructor() { return m_JSTextDecoder.constructorInitializedOnMainThread(this); } JSC::JSValue JSTextDecoderPrototype() { return m_JSTextDecoder.prototypeInitializedOnMainThread(this); } JSC::LazyClassStructure m_JSTextDecoder; bool hasJSTextDecoderSetterValue { false }; mutable JSC::WriteBarrier<JSC::Unknown> m_JSTextDecoderSetterValue; -JSC::Structure* JSRequestStructure() { return m_JSRequest.getInitializedOnMainThread(this); } - JSC::JSObject* JSRequestConstructor() { return m_JSRequest.constructorInitializedOnMainThread(this); } - JSC::JSValue JSRequestPrototype() { return m_JSRequest.prototypeInitializedOnMainThread(this); } - JSC::LazyClassStructure m_JSRequest; - bool hasJSRequestSetterValue { false }; - mutable JSC::WriteBarrier<JSC::Unknown> m_JSRequestSetterValue; -JSC::Structure* JSResponseStructure() { return m_JSResponse.getInitializedOnMainThread(this); } - JSC::JSObject* JSResponseConstructor() { return m_JSResponse.constructorInitializedOnMainThread(this); } - JSC::JSValue JSResponsePrototype() { return m_JSResponse.prototypeInitializedOnMainThread(this); } - JSC::LazyClassStructure m_JSResponse; - bool hasJSResponseSetterValue { false }; - mutable JSC::WriteBarrier<JSC::Unknown> m_JSResponseSetterValue; -JSC::Structure* JSBlobStructure() { return m_JSBlob.getInitializedOnMainThread(this); } - JSC::JSObject* JSBlobConstructor() { return m_JSBlob.constructorInitializedOnMainThread(this); } - JSC::JSValue JSBlobPrototype() { return m_JSBlob.prototypeInitializedOnMainThread(this); } - JSC::LazyClassStructure m_JSBlob; - bool hasJSBlobSetterValue { false }; - mutable JSC::WriteBarrier<JSC::Unknown> m_JSBlobSetterValue; -JSC::Structure* JSDirentStructure() { return m_JSDirent.getInitializedOnMainThread(this); } - JSC::JSObject* JSDirentConstructor() { return m_JSDirent.constructorInitializedOnMainThread(this); } - JSC::JSValue JSDirentPrototype() { return m_JSDirent.prototypeInitializedOnMainThread(this); } - JSC::LazyClassStructure m_JSDirent; - bool hasJSDirentSetterValue { false }; - mutable JSC::WriteBarrier<JSC::Unknown> m_JSDirentSetterValue; -JSC::Structure* JSNodeJSFSStructure() { return m_JSNodeJSFS.getInitializedOnMainThread(this); } - JSC::JSObject* JSNodeJSFSConstructor() { return m_JSNodeJSFS.constructorInitializedOnMainThread(this); } - JSC::JSValue JSNodeJSFSPrototype() { return m_JSNodeJSFS.prototypeInitializedOnMainThread(this); } - JSC::LazyClassStructure m_JSNodeJSFS; - bool hasJSNodeJSFSSetterValue { false }; - mutable JSC::WriteBarrier<JSC::Unknown> m_JSNodeJSFSSetterValue;
\ No newline at end of file +JSC::Structure* JSTranspilerStructure() { return m_JSTranspiler.getInitializedOnMainThread(this); } + JSC::JSObject* JSTranspilerConstructor() { return m_JSTranspiler.constructorInitializedOnMainThread(this); } + JSC::JSValue JSTranspilerPrototype() { return m_JSTranspiler.prototypeInitializedOnMainThread(this); } + JSC::LazyClassStructure m_JSTranspiler; + bool hasJSTranspilerSetterValue { false }; + mutable JSC::WriteBarrier<JSC::Unknown> m_JSTranspilerSetterValue;
\ No newline at end of file diff --git a/src/bun.js/bindings/ZigGeneratedClasses+lazyStructureImpl.h b/src/bun.js/bindings/ZigGeneratedClasses+lazyStructureImpl.h index 8b4240876..a0d2ff844 100644 --- a/src/bun.js/bindings/ZigGeneratedClasses+lazyStructureImpl.h +++ b/src/bun.js/bindings/ZigGeneratedClasses+lazyStructureImpl.h @@ -1,15 +1,33 @@ void GlobalObject::initGeneratedLazyClasses() { - m_JSTCPSocket.initLater( + m_JSBlob.initLater( [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSTCPSocket::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); - init.setStructure(WebCore::JSTCPSocket::createStructure(init.vm, init.global, init.prototype)); - + init.setPrototype(WebCore::JSBlob::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); + init.setStructure(WebCore::JSBlob::createStructure(init.vm, init.global, init.prototype)); + init.setConstructor(WebCore::JSBlob::createConstructor(init.vm, init.global, init.prototype)); }); - m_JSTLSSocket.initLater( + m_JSCryptoHasher.initLater( [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSTLSSocket::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); - init.setStructure(WebCore::JSTLSSocket::createStructure(init.vm, init.global, init.prototype)); - + init.setPrototype(WebCore::JSCryptoHasher::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); + init.setStructure(WebCore::JSCryptoHasher::createStructure(init.vm, init.global, init.prototype)); + init.setConstructor(WebCore::JSCryptoHasher::createConstructor(init.vm, init.global, init.prototype)); + }); + m_JSDirent.initLater( + [](LazyClassStructure::Initializer& init) { + init.setPrototype(WebCore::JSDirent::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); + init.setStructure(WebCore::JSDirent::createStructure(init.vm, init.global, init.prototype)); + init.setConstructor(WebCore::JSDirent::createConstructor(init.vm, init.global, init.prototype)); + }); + m_JSExpect.initLater( + [](LazyClassStructure::Initializer& init) { + init.setPrototype(WebCore::JSExpect::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); + init.setStructure(WebCore::JSExpect::createStructure(init.vm, init.global, init.prototype)); + init.setConstructor(WebCore::JSExpect::createConstructor(init.vm, init.global, init.prototype)); + }); + m_JSFileSystemRouter.initLater( + [](LazyClassStructure::Initializer& init) { + init.setPrototype(WebCore::JSFileSystemRouter::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); + init.setStructure(WebCore::JSFileSystemRouter::createStructure(init.vm, init.global, init.prototype)); + init.setConstructor(WebCore::JSFileSystemRouter::createConstructor(init.vm, init.global, init.prototype)); }); m_JSListener.initLater( [](LazyClassStructure::Initializer& init) { @@ -17,17 +35,11 @@ void GlobalObject::initGeneratedLazyClasses() { init.setStructure(WebCore::JSListener::createStructure(init.vm, init.global, init.prototype)); }); - m_JSSubprocess.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSSubprocess::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); - init.setStructure(WebCore::JSSubprocess::createStructure(init.vm, init.global, init.prototype)); - - }); - m_JSSHA1.initLater( + m_JSMD4.initLater( [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSSHA1::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); - init.setStructure(WebCore::JSSHA1::createStructure(init.vm, init.global, init.prototype)); - init.setConstructor(WebCore::JSSHA1::createConstructor(init.vm, init.global, init.prototype)); + init.setPrototype(WebCore::JSMD4::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); + init.setStructure(WebCore::JSMD4::createStructure(init.vm, init.global, init.prototype)); + init.setConstructor(WebCore::JSMD4::createConstructor(init.vm, init.global, init.prototype)); }); m_JSMD5.initLater( [](LazyClassStructure::Initializer& init) { @@ -35,11 +47,35 @@ void GlobalObject::initGeneratedLazyClasses() { init.setStructure(WebCore::JSMD5::createStructure(init.vm, init.global, init.prototype)); init.setConstructor(WebCore::JSMD5::createConstructor(init.vm, init.global, init.prototype)); }); - m_JSMD4.initLater( + m_JSMatchedRoute.initLater( [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSMD4::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); - init.setStructure(WebCore::JSMD4::createStructure(init.vm, init.global, init.prototype)); - init.setConstructor(WebCore::JSMD4::createConstructor(init.vm, init.global, init.prototype)); + init.setPrototype(WebCore::JSMatchedRoute::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); + init.setStructure(WebCore::JSMatchedRoute::createStructure(init.vm, init.global, init.prototype)); + + }); + m_JSNodeJSFS.initLater( + [](LazyClassStructure::Initializer& init) { + init.setPrototype(WebCore::JSNodeJSFS::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); + init.setStructure(WebCore::JSNodeJSFS::createStructure(init.vm, init.global, init.prototype)); + init.setConstructor(WebCore::JSNodeJSFS::createConstructor(init.vm, init.global, init.prototype)); + }); + m_JSRequest.initLater( + [](LazyClassStructure::Initializer& init) { + init.setPrototype(WebCore::JSRequest::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); + init.setStructure(WebCore::JSRequest::createStructure(init.vm, init.global, init.prototype)); + init.setConstructor(WebCore::JSRequest::createConstructor(init.vm, init.global, init.prototype)); + }); + m_JSResponse.initLater( + [](LazyClassStructure::Initializer& init) { + init.setPrototype(WebCore::JSResponse::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); + init.setStructure(WebCore::JSResponse::createStructure(init.vm, init.global, init.prototype)); + init.setConstructor(WebCore::JSResponse::createConstructor(init.vm, init.global, init.prototype)); + }); + m_JSSHA1.initLater( + [](LazyClassStructure::Initializer& init) { + init.setPrototype(WebCore::JSSHA1::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); + init.setStructure(WebCore::JSSHA1::createStructure(init.vm, init.global, init.prototype)); + init.setConstructor(WebCore::JSSHA1::createConstructor(init.vm, init.global, init.prototype)); }); m_JSSHA224.initLater( [](LazyClassStructure::Initializer& init) { @@ -47,11 +83,11 @@ void GlobalObject::initGeneratedLazyClasses() { init.setStructure(WebCore::JSSHA224::createStructure(init.vm, init.global, init.prototype)); init.setConstructor(WebCore::JSSHA224::createConstructor(init.vm, init.global, init.prototype)); }); - m_JSSHA512.initLater( + m_JSSHA256.initLater( [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSSHA512::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); - init.setStructure(WebCore::JSSHA512::createStructure(init.vm, init.global, init.prototype)); - init.setConstructor(WebCore::JSSHA512::createConstructor(init.vm, init.global, init.prototype)); + init.setPrototype(WebCore::JSSHA256::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); + init.setStructure(WebCore::JSSHA256::createStructure(init.vm, init.global, init.prototype)); + init.setConstructor(WebCore::JSSHA256::createConstructor(init.vm, init.global, init.prototype)); }); m_JSSHA384.initLater( [](LazyClassStructure::Initializer& init) { @@ -59,11 +95,11 @@ void GlobalObject::initGeneratedLazyClasses() { init.setStructure(WebCore::JSSHA384::createStructure(init.vm, init.global, init.prototype)); init.setConstructor(WebCore::JSSHA384::createConstructor(init.vm, init.global, init.prototype)); }); - m_JSSHA256.initLater( + m_JSSHA512.initLater( [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSSHA256::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); - init.setStructure(WebCore::JSSHA256::createStructure(init.vm, init.global, init.prototype)); - init.setConstructor(WebCore::JSSHA256::createConstructor(init.vm, init.global, init.prototype)); + init.setPrototype(WebCore::JSSHA512::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); + init.setStructure(WebCore::JSSHA512::createStructure(init.vm, init.global, init.prototype)); + init.setConstructor(WebCore::JSSHA512::createConstructor(init.vm, init.global, init.prototype)); }); m_JSSHA512_256.initLater( [](LazyClassStructure::Initializer& init) { @@ -71,35 +107,29 @@ void GlobalObject::initGeneratedLazyClasses() { init.setStructure(WebCore::JSSHA512_256::createStructure(init.vm, init.global, init.prototype)); init.setConstructor(WebCore::JSSHA512_256::createConstructor(init.vm, init.global, init.prototype)); }); - m_JSCryptoHasher.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSCryptoHasher::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); - init.setStructure(WebCore::JSCryptoHasher::createStructure(init.vm, init.global, init.prototype)); - init.setConstructor(WebCore::JSCryptoHasher::createConstructor(init.vm, init.global, init.prototype)); - }); m_JSServerWebSocket.initLater( [](LazyClassStructure::Initializer& init) { init.setPrototype(WebCore::JSServerWebSocket::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); init.setStructure(WebCore::JSServerWebSocket::createStructure(init.vm, init.global, init.prototype)); init.setConstructor(WebCore::JSServerWebSocket::createConstructor(init.vm, init.global, init.prototype)); }); - m_JSFileSystemRouter.initLater( + m_JSSubprocess.initLater( [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSFileSystemRouter::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); - init.setStructure(WebCore::JSFileSystemRouter::createStructure(init.vm, init.global, init.prototype)); - init.setConstructor(WebCore::JSFileSystemRouter::createConstructor(init.vm, init.global, init.prototype)); + init.setPrototype(WebCore::JSSubprocess::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); + init.setStructure(WebCore::JSSubprocess::createStructure(init.vm, init.global, init.prototype)); + }); - m_JSMatchedRoute.initLater( + m_JSTCPSocket.initLater( [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSMatchedRoute::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); - init.setStructure(WebCore::JSMatchedRoute::createStructure(init.vm, init.global, init.prototype)); + init.setPrototype(WebCore::JSTCPSocket::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); + init.setStructure(WebCore::JSTCPSocket::createStructure(init.vm, init.global, init.prototype)); }); - m_JSExpect.initLater( + m_JSTLSSocket.initLater( [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSExpect::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); - init.setStructure(WebCore::JSExpect::createStructure(init.vm, init.global, init.prototype)); - init.setConstructor(WebCore::JSExpect::createConstructor(init.vm, init.global, init.prototype)); + init.setPrototype(WebCore::JSTLSSocket::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); + init.setStructure(WebCore::JSTLSSocket::createStructure(init.vm, init.global, init.prototype)); + }); m_JSTextDecoder.initLater( [](LazyClassStructure::Initializer& init) { @@ -107,61 +137,38 @@ void GlobalObject::initGeneratedLazyClasses() { init.setStructure(WebCore::JSTextDecoder::createStructure(init.vm, init.global, init.prototype)); init.setConstructor(WebCore::JSTextDecoder::createConstructor(init.vm, init.global, init.prototype)); }); - m_JSRequest.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSRequest::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); - init.setStructure(WebCore::JSRequest::createStructure(init.vm, init.global, init.prototype)); - init.setConstructor(WebCore::JSRequest::createConstructor(init.vm, init.global, init.prototype)); - }); - m_JSResponse.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSResponse::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); - init.setStructure(WebCore::JSResponse::createStructure(init.vm, init.global, init.prototype)); - init.setConstructor(WebCore::JSResponse::createConstructor(init.vm, init.global, init.prototype)); - }); - m_JSBlob.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSBlob::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); - init.setStructure(WebCore::JSBlob::createStructure(init.vm, init.global, init.prototype)); - init.setConstructor(WebCore::JSBlob::createConstructor(init.vm, init.global, init.prototype)); - }); - m_JSDirent.initLater( + m_JSTranspiler.initLater( [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSDirent::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); - init.setStructure(WebCore::JSDirent::createStructure(init.vm, init.global, init.prototype)); - init.setConstructor(WebCore::JSDirent::createConstructor(init.vm, init.global, init.prototype)); - }); - m_JSNodeJSFS.initLater( - [](LazyClassStructure::Initializer& init) { - init.setPrototype(WebCore::JSNodeJSFS::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); - init.setStructure(WebCore::JSNodeJSFS::createStructure(init.vm, init.global, init.prototype)); - init.setConstructor(WebCore::JSNodeJSFS::createConstructor(init.vm, init.global, init.prototype)); + init.setPrototype(WebCore::JSTranspiler::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.global))); + init.setStructure(WebCore::JSTranspiler::createStructure(init.vm, init.global, init.prototype)); + init.setConstructor(WebCore::JSTranspiler::createConstructor(init.vm, init.global, init.prototype)); }); } template<typename Visitor> void GlobalObject::visitGeneratedLazyClasses(GlobalObject *thisObject, Visitor& visitor) { - thisObject->m_JSTCPSocket.visit(visitor); visitor.append(thisObject->m_JSTCPSocketSetterValue); - thisObject->m_JSTLSSocket.visit(visitor); visitor.append(thisObject->m_JSTLSSocketSetterValue); + thisObject->m_JSBlob.visit(visitor); visitor.append(thisObject->m_JSBlobSetterValue); + thisObject->m_JSCryptoHasher.visit(visitor); visitor.append(thisObject->m_JSCryptoHasherSetterValue); + thisObject->m_JSDirent.visit(visitor); visitor.append(thisObject->m_JSDirentSetterValue); + thisObject->m_JSExpect.visit(visitor); visitor.append(thisObject->m_JSExpectSetterValue); + thisObject->m_JSFileSystemRouter.visit(visitor); visitor.append(thisObject->m_JSFileSystemRouterSetterValue); thisObject->m_JSListener.visit(visitor); visitor.append(thisObject->m_JSListenerSetterValue); - thisObject->m_JSSubprocess.visit(visitor); visitor.append(thisObject->m_JSSubprocessSetterValue); - thisObject->m_JSSHA1.visit(visitor); visitor.append(thisObject->m_JSSHA1SetterValue); - thisObject->m_JSMD5.visit(visitor); visitor.append(thisObject->m_JSMD5SetterValue); thisObject->m_JSMD4.visit(visitor); visitor.append(thisObject->m_JSMD4SetterValue); + thisObject->m_JSMD5.visit(visitor); visitor.append(thisObject->m_JSMD5SetterValue); + thisObject->m_JSMatchedRoute.visit(visitor); visitor.append(thisObject->m_JSMatchedRouteSetterValue); + thisObject->m_JSNodeJSFS.visit(visitor); visitor.append(thisObject->m_JSNodeJSFSSetterValue); + thisObject->m_JSRequest.visit(visitor); visitor.append(thisObject->m_JSRequestSetterValue); + thisObject->m_JSResponse.visit(visitor); visitor.append(thisObject->m_JSResponseSetterValue); + thisObject->m_JSSHA1.visit(visitor); visitor.append(thisObject->m_JSSHA1SetterValue); thisObject->m_JSSHA224.visit(visitor); visitor.append(thisObject->m_JSSHA224SetterValue); - thisObject->m_JSSHA512.visit(visitor); visitor.append(thisObject->m_JSSHA512SetterValue); - thisObject->m_JSSHA384.visit(visitor); visitor.append(thisObject->m_JSSHA384SetterValue); thisObject->m_JSSHA256.visit(visitor); visitor.append(thisObject->m_JSSHA256SetterValue); + thisObject->m_JSSHA384.visit(visitor); visitor.append(thisObject->m_JSSHA384SetterValue); + thisObject->m_JSSHA512.visit(visitor); visitor.append(thisObject->m_JSSHA512SetterValue); thisObject->m_JSSHA512_256.visit(visitor); visitor.append(thisObject->m_JSSHA512_256SetterValue); - thisObject->m_JSCryptoHasher.visit(visitor); visitor.append(thisObject->m_JSCryptoHasherSetterValue); thisObject->m_JSServerWebSocket.visit(visitor); visitor.append(thisObject->m_JSServerWebSocketSetterValue); - thisObject->m_JSFileSystemRouter.visit(visitor); visitor.append(thisObject->m_JSFileSystemRouterSetterValue); - thisObject->m_JSMatchedRoute.visit(visitor); visitor.append(thisObject->m_JSMatchedRouteSetterValue); - thisObject->m_JSExpect.visit(visitor); visitor.append(thisObject->m_JSExpectSetterValue); + thisObject->m_JSSubprocess.visit(visitor); visitor.append(thisObject->m_JSSubprocessSetterValue); + thisObject->m_JSTCPSocket.visit(visitor); visitor.append(thisObject->m_JSTCPSocketSetterValue); + thisObject->m_JSTLSSocket.visit(visitor); visitor.append(thisObject->m_JSTLSSocketSetterValue); thisObject->m_JSTextDecoder.visit(visitor); visitor.append(thisObject->m_JSTextDecoderSetterValue); - thisObject->m_JSRequest.visit(visitor); visitor.append(thisObject->m_JSRequestSetterValue); - thisObject->m_JSResponse.visit(visitor); visitor.append(thisObject->m_JSResponseSetterValue); - thisObject->m_JSBlob.visit(visitor); visitor.append(thisObject->m_JSBlobSetterValue); - thisObject->m_JSDirent.visit(visitor); visitor.append(thisObject->m_JSDirentSetterValue); - thisObject->m_JSNodeJSFS.visit(visitor); visitor.append(thisObject->m_JSNodeJSFSSetterValue); + thisObject->m_JSTranspiler.visit(visitor); visitor.append(thisObject->m_JSTranspilerSetterValue); }
\ No newline at end of file diff --git a/src/bun.js/bindings/ZigGeneratedClasses.cpp b/src/bun.js/bindings/ZigGeneratedClasses.cpp index d49dfef97..c5112a4ad 100644 --- a/src/bun.js/bindings/ZigGeneratedClasses.cpp +++ b/src/bun.js/bindings/ZigGeneratedClasses.cpp @@ -2,6 +2,7 @@ // GENERATED CODE - DO NOT MODIFY BY HAND // Generated by make codegen #include "root.h" +#include "headers.h" #include "BunClientData.h" #include "ZigGlobalObject.h" @@ -27,13 +28,13 @@ namespace WebCore { using namespace JSC; using namespace Zig; -class JSTCPSocketPrototype final : public JSC::JSNonFinalObject { +class JSBlobPrototype final : public JSC::JSNonFinalObject { public: using Base = JSC::JSNonFinalObject; - static JSTCPSocketPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) + static JSBlobPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) { - JSTCPSocketPrototype* ptr = new (NotNull, JSC::allocateCell<JSTCPSocketPrototype>(vm)) JSTCPSocketPrototype(vm, globalObject, structure); + JSBlobPrototype* ptr = new (NotNull, JSC::allocateCell<JSBlobPrototype>(vm)) JSBlobPrototype(vm, globalObject, structure); ptr->finishCreation(vm, globalObject); return ptr; } @@ -50,7 +51,7 @@ public: } private: - JSTCPSocketPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) + JSBlobPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) : Base(vm, structure) { } @@ -58,131 +59,106 @@ private: 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*); +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); -extern "C" JSC::EncodedJSValue TCPSocketPrototype__getData(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(TCPSocketPrototype__dataGetterWrap); + static constexpr unsigned StructureFlags = Base::StructureFlags; + static constexpr bool needsDestruction = false; -extern "C" bool TCPSocketPrototype__setData(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::EncodedJSValue value); -JSC_DECLARE_CUSTOM_SETTER(TCPSocketPrototype__dataSetterWrap); + 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()); + } -extern "C" EncodedJSValue TCPSocketPrototype__end(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TCPSocketPrototype__endCallback); + 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 = WTFMove(space); }, + [](auto& spaces) { return spaces.m_subspaceForBlobConstructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForBlobConstructor = WTFMove(space); }); + } -extern "C" EncodedJSValue TCPSocketPrototype__flush(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TCPSocketPrototype__flushCallback); + void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSBlobPrototype* prototype); -extern "C" JSC::EncodedJSValue TCPSocketPrototype__getListener(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(TCPSocketPrototype__listenerGetterWrap); + // Must be defined for each specialization class. + static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); -extern "C" JSC::EncodedJSValue TCPSocketPrototype__getLocalPort(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(TCPSocketPrototype__localPortGetterWrap); + DECLARE_EXPORT_INFO; -extern "C" JSC::EncodedJSValue TCPSocketPrototype__getReadyState(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(TCPSocketPrototype__readyStateGetterWrap); +private: + JSBlobConstructor(JSC::VM& vm, JSC::Structure* structure); + void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSBlobPrototype* prototype); +}; -extern "C" EncodedJSValue TCPSocketPrototype__ref(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TCPSocketPrototype__refCallback); +extern "C" void* BlobClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); +JSC_DECLARE_CUSTOM_GETTER(jsBlobConstructor); +extern "C" void BlobClass__finalize(void*); -extern "C" EncodedJSValue TCPSocketPrototype__reload(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TCPSocketPrototype__reloadCallback); +extern "C" EncodedJSValue BlobPrototype__getArrayBuffer(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(BlobPrototype__arrayBufferCallback); -extern "C" JSC::EncodedJSValue TCPSocketPrototype__getRemoteAddress(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(TCPSocketPrototype__remoteAddressGetterWrap); +extern "C" EncodedJSValue BlobPrototype__getJSON(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(BlobPrototype__jsonCallback); -extern "C" EncodedJSValue TCPSocketPrototype__shutdown(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TCPSocketPrototype__shutdownCallback); +extern "C" JSC::EncodedJSValue BlobPrototype__getSize(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); +JSC_DECLARE_CUSTOM_GETTER(BlobPrototype__sizeGetterWrap); -extern "C" EncodedJSValue TCPSocketPrototype__timeout(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TCPSocketPrototype__timeoutCallback); +extern "C" EncodedJSValue BlobPrototype__getSlice(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(BlobPrototype__sliceCallback); -extern "C" EncodedJSValue TCPSocketPrototype__unref(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TCPSocketPrototype__unrefCallback); +extern "C" EncodedJSValue BlobPrototype__getStream(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(BlobPrototype__streamCallback); -extern "C" EncodedJSValue TCPSocketPrototype__write(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TCPSocketPrototype__writeCallback); +extern "C" EncodedJSValue BlobPrototype__getText(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(BlobPrototype__textCallback); -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSTCPSocketPrototype, JSTCPSocketPrototype::Base); +extern "C" JSC::EncodedJSValue BlobPrototype__getType(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); +JSC_DECLARE_CUSTOM_GETTER(BlobPrototype__typeGetterWrap); -static const HashTableValue JSTCPSocketPrototypeTableValues[] = { - { "data"_s, static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, TCPSocketPrototype__dataGetterWrap, TCPSocketPrototype__dataSetterWrap } }, - { "end"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__endCallback, 3 } }, - { "flush"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__flushCallback, 0 } }, - { "listener"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, TCPSocketPrototype__listenerGetterWrap, 0 } }, - { "localPort"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, TCPSocketPrototype__localPortGetterWrap, 0 } }, - { "readyState"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, TCPSocketPrototype__readyStateGetterWrap, 0 } }, - { "ref"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__refCallback, 0 } }, - { "reload"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__reloadCallback, 1 } }, - { "remoteAddress"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, TCPSocketPrototype__remoteAddressGetterWrap, 0 } }, - { "shutdown"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__shutdownCallback, 1 } }, - { "timeout"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__timeoutCallback, 1 } }, - { "unref"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__unrefCallback, 0 } }, - { "write"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__writeCallback, 3 } } +extern "C" bool BlobPrototype__setType(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::EncodedJSValue value); +JSC_DECLARE_CUSTOM_SETTER(BlobPrototype__typeSetterWrap); + +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), NoIntrinsic, { HashTableValue::NativeFunctionType, BlobPrototype__arrayBufferCallback, 0 } }, + { "json"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, BlobPrototype__jsonCallback, 0 } }, + { "size"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, BlobPrototype__sizeGetterWrap, 0 } }, + { "slice"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, BlobPrototype__sliceCallback, 2 } }, + { "stream"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, BlobPrototype__streamCallback, 1 } }, + { "text"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, BlobPrototype__textCallback, 0 } }, + { "type"_s, static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, BlobPrototype__typeGetterWrap, BlobPrototype__typeSetterWrap } }, + { "writer"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, BlobPrototype__writerCallback, 1 } } }; -const ClassInfo JSTCPSocketPrototype::s_info = { "TCPSocket"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTCPSocketPrototype) }; +const ClassInfo JSBlobPrototype::s_info = { "Blob"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSBlobPrototype) }; -JSC_DEFINE_CUSTOM_GETTER(jsTCPSocketConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) +JSC_DEFINE_CUSTOM_GETTER(jsBlobConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); auto* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); - auto* prototype = jsDynamicCast<JSTCPSocketPrototype*>(JSValue::decode(thisValue)); + auto* prototype = jsDynamicCast<JSBlobPrototype*>(JSValue::decode(thisValue)); if (UNLIKELY(!prototype)) return throwVMTypeError(lexicalGlobalObject, throwScope); - return JSValue::encode(globalObject->JSTCPSocketConstructor()); -} - -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)); - 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) -{ - 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)) -{ - auto& vm = lexicalGlobalObject->vm(); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSTCPSocket* thisObject = jsCast<JSTCPSocket*>(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - auto result = TCPSocketPrototype__setData(thisObject->wrapped(), lexicalGlobalObject, encodedValue); - - RELEASE_AND_RETURN(throwScope, result); + return JSValue::encode(globalObject->JSBlobConstructor()); } -JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__endCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(BlobPrototype__arrayBufferCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSTCPSocket* thisObject = jsDynamicCast<JSTCPSocket*>(callFrame->thisValue()); + JSBlob* thisObject = jsDynamicCast<JSBlob*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -191,14 +167,14 @@ JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__endCallback, (JSGlobalObject * lexi JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return TCPSocketPrototype__end(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return BlobPrototype__getArrayBuffer(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__flushCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(BlobPrototype__jsonCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSTCPSocket* thisObject = jsDynamicCast<JSTCPSocket*>(callFrame->thisValue()); + JSBlob* thisObject = jsDynamicCast<JSBlob*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -207,50 +183,42 @@ JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__flushCallback, (JSGlobalObject * le JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return TCPSocketPrototype__flush(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return BlobPrototype__getJSON(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_CUSTOM_GETTER(TCPSocketPrototype__listenerGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(BlobPrototype__sizeGetterWrap, (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)); + JSBlob* thisObject = jsCast<JSBlob*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = TCPSocketPrototype__getListener(thisObject->wrapped(), globalObject); + JSC::EncodedJSValue result = BlobPrototype__getSize(thisObject->wrapped(), globalObject); RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } -JSC_DEFINE_CUSTOM_GETTER(TCPSocketPrototype__localPortGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_HOST_FUNCTION(BlobPrototype__sliceCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { 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); - JSC::EncodedJSValue result = TCPSocketPrototype__getLocalPort(thisObject->wrapped(), globalObject); - 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); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSTCPSocket* thisObject = jsCast<JSTCPSocket*>(JSValue::decode(thisValue)); + 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); - JSC::EncodedJSValue result = TCPSocketPrototype__getReadyState(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); + + return BlobPrototype__getSlice(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__refCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(BlobPrototype__streamCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSTCPSocket* thisObject = jsDynamicCast<JSTCPSocket*>(callFrame->thisValue()); + JSBlob* thisObject = jsDynamicCast<JSBlob*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -259,14 +227,14 @@ JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__refCallback, (JSGlobalObject * lexi JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return TCPSocketPrototype__ref(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return BlobPrototype__getStream(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__reloadCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(BlobPrototype__textCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSTCPSocket* thisObject = jsDynamicCast<JSTCPSocket*>(callFrame->thisValue()); + JSBlob* thisObject = jsDynamicCast<JSBlob*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -275,61 +243,37 @@ JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__reloadCallback, (JSGlobalObject * l JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return TCPSocketPrototype__reload(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return BlobPrototype__getText(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_CUSTOM_GETTER(TCPSocketPrototype__remoteAddressGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(BlobPrototype__typeGetterWrap, (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)); + JSBlob* thisObject = jsCast<JSBlob*>(JSValue::decode(thisValue)); 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)); + JSC::EncodedJSValue result = BlobPrototype__getType(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) -{ - auto* thisObject = jsCast<JSTCPSocket*>(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_remoteAddress.get()); + RELEASE_AND_RETURN(throwScope, result); } -JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__shutdownCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_CUSTOM_SETTER(BlobPrototype__typeSetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - - JSTCPSocket* thisObject = jsDynamicCast<JSTCPSocket*>(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } - + auto throwScope = DECLARE_THROW_SCOPE(vm); + JSBlob* thisObject = jsCast<JSBlob*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + auto result = BlobPrototype__setType(thisObject->wrapped(), lexicalGlobalObject, encodedValue); - return TCPSocketPrototype__shutdown(thisObject->wrapped(), lexicalGlobalObject, callFrame); + RELEASE_AND_RETURN(throwScope, result); } -JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__timeoutCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(BlobPrototype__writerCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSTCPSocket* thisObject = jsDynamicCast<JSTCPSocket*>(callFrame->thisValue()); + JSBlob* thisObject = jsDynamicCast<JSBlob*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -338,88 +282,112 @@ JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__timeoutCallback, (JSGlobalObject * JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return TCPSocketPrototype__timeout(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return BlobPrototype__getWriter(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__unrefCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +void JSBlobPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) { - auto& vm = lexicalGlobalObject->vm(); + Base::finishCreation(vm); + reifyStaticProperties(vm, JSBlob::info(), JSBlobPrototypeTableValues, *this); + JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); +} - JSTCPSocket* thisObject = jsDynamicCast<JSTCPSocket*>(callFrame->thisValue()); +void JSBlobConstructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSBlobPrototype* prototype) +{ + Base::finishCreation(vm, 0, "Blob"_s, PropertyAdditionMode::WithoutStructureTransition); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } + putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly); + ASSERT(inherits(info())); +} - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); +JSBlobConstructor::JSBlobConstructor(JSC::VM& vm, JSC::Structure* structure) + : Base(vm, structure, construct, construct) +{ +} - return TCPSocketPrototype__unref(thisObject->wrapped(), lexicalGlobalObject, callFrame); +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_DEFINE_HOST_FUNCTION(TCPSocketPrototype__writeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSBlobConstructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) { - auto& vm = lexicalGlobalObject->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); - JSTCPSocket* thisObject = jsDynamicCast<JSTCPSocket*>(callFrame->thisValue()); + 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()); + } - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + void* ptr = BlobClass__construct(globalObject, callFrame); + + if (UNLIKELY(!ptr)) { + return JSValue::encode(JSC::jsUndefined()); } - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSBlob* instance = JSBlob::create(vm, globalObject, structure, ptr); - return TCPSocketPrototype__write(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return JSValue::encode(instance); } -void JSTCPSocketPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) +void JSBlobConstructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSBlobPrototype* prototype) { - Base::finishCreation(vm); - reifyStaticProperties(vm, JSTCPSocket::info(), JSTCPSocketPrototypeTableValues, *this); - JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); } -extern "C" bool TCPSocket__hasPendingActivity(void* ptr); -bool JSTCPSocket::hasPendingActivity(void* ctx) +const ClassInfo JSBlobConstructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSBlobConstructor) }; + +extern "C" EncodedJSValue Blob__getConstructor(Zig::GlobalObject* globalObject) { - return TCPSocket__hasPendingActivity(ctx); + return JSValue::encode(globalObject->JSBlobConstructor()); } -JSTCPSocket::~JSTCPSocket() +JSBlob::~JSBlob() { if (m_ctx) { - TCPSocketClass__finalize(m_ctx); + BlobClass__finalize(m_ctx); } } -void JSTCPSocket::destroy(JSCell* cell) +void JSBlob::destroy(JSCell* cell) { - static_cast<JSTCPSocket*>(cell)->JSTCPSocket::~JSTCPSocket(); + static_cast<JSBlob*>(cell)->JSBlob::~JSBlob(); } -const ClassInfo JSTCPSocket::s_info = { "TCPSocket"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTCPSocket) }; +const ClassInfo JSBlob::s_info = { "Blob"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSBlob) }; -void JSTCPSocket::finishCreation(VM& vm) +void JSBlob::finishCreation(VM& vm) { Base::finishCreation(vm); ASSERT(inherits(info())); } -JSTCPSocket* JSTCPSocket::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) +JSBlob* JSBlob::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) { - JSTCPSocket* ptr = new (NotNull, JSC::allocateCell<JSTCPSocket>(vm)) JSTCPSocket(vm, structure, ctx); + JSBlob* ptr = new (NotNull, JSC::allocateCell<JSBlob>(vm)) JSBlob(vm, structure, ctx); ptr->finishCreation(vm); return ptr; } -extern "C" void* TCPSocket__fromJS(JSC::EncodedJSValue value) +extern "C" void* Blob__fromJS(JSC::EncodedJSValue value) { JSC::JSValue decodedValue = JSC::JSValue::decode(value); if (decodedValue.isEmpty() || !decodedValue.isCell()) return nullptr; JSC::JSCell* cell = decodedValue.asCell(); - JSTCPSocket* object = JSC::jsDynamicCast<JSTCPSocket*>(cell); + JSBlob* object = JSC::jsDynamicCast<JSBlob*>(cell); if (!object) return nullptr; @@ -427,9 +395,9 @@ extern "C" void* TCPSocket__fromJS(JSC::EncodedJSValue value) return object->wrapped(); } -extern "C" bool TCPSocket__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) +extern "C" bool Blob__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) { - JSTCPSocket* object = JSC::jsDynamicCast<JSTCPSocket*>(JSValue::decode(value)); + JSBlob* object = JSC::jsDynamicCast<JSBlob*>(JSValue::decode(value)); if (!object) return false; @@ -437,11 +405,11 @@ extern "C" bool TCPSocket__dangerouslySetPtr(JSC::EncodedJSValue value, void* pt return true; } -extern "C" const size_t TCPSocket__ptrOffset = JSTCPSocket::offsetOfWrapped(); +extern "C" const size_t Blob__ptrOffset = JSBlob::offsetOfWrapped(); -void JSTCPSocket::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) +void JSBlob::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) { - auto* thisObject = jsCast<JSTCPSocket*>(cell); + auto* thisObject = jsCast<JSBlob*>(cell); if (void* wrapped = thisObject->wrapped()) { // if (thisObject->scriptExecutionContext()) // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); @@ -449,63 +417,31 @@ 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) +JSObject* JSBlob::createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype) { - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSTCPSocketStructure(); - JSTCPSocket* instance = JSTCPSocket::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); + return WebCore::JSBlobConstructor::create(vm, globalObject, WebCore::JSBlobConstructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast<WebCore::JSBlobPrototype*>(prototype)); } -template<typename Visitor> -void JSTCPSocket::visitChildrenImpl(JSCell* cell, Visitor& visitor) +JSObject* JSBlob::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) { - 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()); + return JSBlobPrototype::create(vm, globalObject, JSBlobPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); } -DEFINE_VISIT_CHILDREN(JSTCPSocket); - -template<typename Visitor> -void JSTCPSocket::visitAdditionalChildren(Visitor& visitor) +extern "C" EncodedJSValue Blob__create(Zig::GlobalObject* globalObject, void* ptr) { - JSTCPSocket* thisObject = this; - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - - visitor.append(thisObject->m_data); - visitor.append(thisObject->m_remoteAddress); - visitor.addOpaqueRoot(this->wrapped()); -} - -DEFINE_VISIT_ADDITIONAL_CHILDREN(JSTCPSocket); + auto& vm = globalObject->vm(); + JSC::Structure* structure = globalObject->JSBlobStructure(); + JSBlob* instance = JSBlob::create(vm, globalObject, structure, ptr); -template<typename Visitor> -void JSTCPSocket::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) -{ - JSTCPSocket* thisObject = jsCast<JSTCPSocket*>(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - thisObject->visitAdditionalChildren<Visitor>(visitor); + return JSValue::encode(instance); } - -DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSTCPSocket); -class JSTLSSocketPrototype final : public JSC::JSNonFinalObject { +class JSCryptoHasherPrototype final : public JSC::JSNonFinalObject { public: using Base = JSC::JSNonFinalObject; - static JSTLSSocketPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) + static JSCryptoHasherPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) { - JSTLSSocketPrototype* ptr = new (NotNull, JSC::allocateCell<JSTLSSocketPrototype>(vm)) JSTLSSocketPrototype(vm, globalObject, structure); + JSCryptoHasherPrototype* ptr = new (NotNull, JSC::allocateCell<JSCryptoHasherPrototype>(vm)) JSCryptoHasherPrototype(vm, globalObject, structure); ptr->finishCreation(vm, globalObject); return ptr; } @@ -522,7 +458,7 @@ public: } private: - JSTLSSocketPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) + JSCryptoHasherPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) : Base(vm, structure) { } @@ -530,199 +466,130 @@ private: 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__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); +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); -extern "C" EncodedJSValue TLSSocketPrototype__end(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TLSSocketPrototype__endCallback); + static constexpr unsigned StructureFlags = Base::StructureFlags; + static constexpr bool needsDestruction = false; -extern "C" EncodedJSValue TLSSocketPrototype__flush(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TLSSocketPrototype__flushCallback); + 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()); + } -extern "C" JSC::EncodedJSValue TLSSocketPrototype__getListener(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(TLSSocketPrototype__listenerGetterWrap); + 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 = WTFMove(space); }, + [](auto& spaces) { return spaces.m_subspaceForCryptoHasherConstructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForCryptoHasherConstructor = WTFMove(space); }); + } -extern "C" JSC::EncodedJSValue TLSSocketPrototype__getLocalPort(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(TLSSocketPrototype__localPortGetterWrap); + void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSCryptoHasherPrototype* prototype); -extern "C" JSC::EncodedJSValue TLSSocketPrototype__getReadyState(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(TLSSocketPrototype__readyStateGetterWrap); + // Must be defined for each specialization class. + static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); -extern "C" EncodedJSValue TLSSocketPrototype__ref(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TLSSocketPrototype__refCallback); + DECLARE_EXPORT_INFO; -extern "C" EncodedJSValue TLSSocketPrototype__reload(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TLSSocketPrototype__reloadCallback); +private: + JSCryptoHasherConstructor(JSC::VM& vm, JSC::Structure* structure); + void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSCryptoHasherPrototype* prototype); +}; -extern "C" JSC::EncodedJSValue TLSSocketPrototype__getRemoteAddress(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(TLSSocketPrototype__remoteAddressGetterWrap); +extern "C" void* CryptoHasherClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); +JSC_DECLARE_CUSTOM_GETTER(jsCryptoHasherConstructor); +extern "C" void CryptoHasherClass__finalize(void*); -extern "C" EncodedJSValue TLSSocketPrototype__shutdown(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TLSSocketPrototype__shutdownCallback); +extern "C" JSC::EncodedJSValue CryptoHasherPrototype__getAlgorithm(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); +JSC_DECLARE_CUSTOM_GETTER(CryptoHasherPrototype__algorithmGetterWrap); -extern "C" EncodedJSValue TLSSocketPrototype__timeout(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TLSSocketPrototype__timeoutCallback); +extern "C" JSC::EncodedJSValue CryptoHasherPrototype__getByteLength(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); +JSC_DECLARE_CUSTOM_GETTER(CryptoHasherPrototype__byteLengthGetterWrap); -extern "C" EncodedJSValue TLSSocketPrototype__unref(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TLSSocketPrototype__unrefCallback); +extern "C" EncodedJSValue CryptoHasherPrototype__digest(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(CryptoHasherPrototype__digestCallback); -extern "C" EncodedJSValue TLSSocketPrototype__write(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TLSSocketPrototype__writeCallback); +extern "C" EncodedJSValue CryptoHasherPrototype__update(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(CryptoHasherPrototype__updateCallback); -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSTLSSocketPrototype, JSTLSSocketPrototype::Base); +STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSCryptoHasherPrototype, JSCryptoHasherPrototype::Base); -static const HashTableValue JSTLSSocketPrototypeTableValues[] = { - { "data"_s, static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, TLSSocketPrototype__dataGetterWrap, TLSSocketPrototype__dataSetterWrap } }, - { "end"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__endCallback, 3 } }, - { "flush"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__flushCallback, 0 } }, - { "listener"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, TLSSocketPrototype__listenerGetterWrap, 0 } }, - { "localPort"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, TLSSocketPrototype__localPortGetterWrap, 0 } }, - { "readyState"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, TLSSocketPrototype__readyStateGetterWrap, 0 } }, - { "ref"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__refCallback, 0 } }, - { "reload"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__reloadCallback, 1 } }, - { "remoteAddress"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, TLSSocketPrototype__remoteAddressGetterWrap, 0 } }, - { "shutdown"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__shutdownCallback, 1 } }, - { "timeout"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__timeoutCallback, 1 } }, - { "unref"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__unrefCallback, 0 } }, - { "write"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__writeCallback, 3 } } +static const HashTableValue JSCryptoHasherPrototypeTableValues[] = { + { "algorithm"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, CryptoHasherPrototype__algorithmGetterWrap, 0 } }, + { "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, CryptoHasherPrototype__byteLengthGetterWrap, 0 } }, + { "digest"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, CryptoHasherPrototype__digestCallback, 0 } }, + { "update"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, CryptoHasherPrototype__updateCallback, 2 } } }; -const ClassInfo JSTLSSocketPrototype::s_info = { "TLSSocket"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTLSSocketPrototype) }; +const ClassInfo JSCryptoHasherPrototype::s_info = { "CryptoHasher"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSCryptoHasherPrototype) }; -JSC_DEFINE_CUSTOM_GETTER(jsTLSSocketConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) +JSC_DEFINE_CUSTOM_GETTER(jsCryptoHasherConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); auto* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); - auto* prototype = jsDynamicCast<JSTLSSocketPrototype*>(JSValue::decode(thisValue)); + auto* prototype = jsDynamicCast<JSCryptoHasherPrototype*>(JSValue::decode(thisValue)); if (UNLIKELY(!prototype)) return throwVMTypeError(lexicalGlobalObject, throwScope); - return JSValue::encode(globalObject->JSTLSSocketConstructor()); + return JSValue::encode(globalObject->JSCryptoHasherConstructor()); } -JSC_DEFINE_CUSTOM_GETTER(TLSSocketPrototype__dataGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(CryptoHasherPrototype__algorithmGetterWrap, (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)); + JSCryptoHasher* thisObject = jsCast<JSCryptoHasher*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (JSValue cachedValue = thisObject->m_data.get()) + if (JSValue cachedValue = thisObject->m_algorithm.get()) return JSValue::encode(cachedValue); JSC::JSValue result = JSC::JSValue::decode( - TLSSocketPrototype__getData(thisObject->wrapped(), globalObject)); + CryptoHasherPrototype__getAlgorithm(thisObject->wrapped(), globalObject)); RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_data.set(vm, thisObject, result); + thisObject->m_algorithm.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) +extern "C" void CryptoHasherPrototype__algorithmSetCachedValue(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)) -{ - auto& vm = lexicalGlobalObject->vm(); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSTLSSocket* thisObject = jsCast<JSTLSSocket*>(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - auto result = TLSSocketPrototype__setData(thisObject->wrapped(), lexicalGlobalObject, encodedValue); - - 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()); - - 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_DEFINE_HOST_FUNCTION(TLSSocketPrototype__flushCallback, (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); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - return TLSSocketPrototype__flush(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); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSTLSSocket* thisObject = jsCast<JSTLSSocket*>(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = TLSSocketPrototype__getListener(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); + auto* thisObject = jsCast<JSCryptoHasher*>(JSValue::decode(thisValue)); + thisObject->m_algorithm.set(vm, thisObject, JSValue::decode(value)); } -JSC_DEFINE_CUSTOM_GETTER(TLSSocketPrototype__localPortGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +extern "C" EncodedJSValue CryptoHasherPrototype__algorithmGetCachedValue(JSC::EncodedJSValue thisValue) { - 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); - JSC::EncodedJSValue result = TLSSocketPrototype__getLocalPort(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); + auto* thisObject = jsCast<JSCryptoHasher*>(JSValue::decode(thisValue)); + return JSValue::encode(thisObject->m_algorithm.get()); } -JSC_DEFINE_CUSTOM_GETTER(TLSSocketPrototype__readyStateGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(CryptoHasherPrototype__byteLengthGetterWrap, (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)); + JSCryptoHasher* thisObject = jsCast<JSCryptoHasher*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = TLSSocketPrototype__getReadyState(thisObject->wrapped(), globalObject); + JSC::EncodedJSValue result = CryptoHasherPrototype__getByteLength(thisObject->wrapped(), globalObject); RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } -JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__refCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(CryptoHasherPrototype__digestCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSTLSSocket* thisObject = jsDynamicCast<JSTLSSocket*>(callFrame->thisValue()); + JSCryptoHasher* thisObject = jsDynamicCast<JSCryptoHasher*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -731,14 +598,14 @@ JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__refCallback, (JSGlobalObject * lexi JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return TLSSocketPrototype__ref(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return CryptoHasherPrototype__digest(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__reloadCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(CryptoHasherPrototype__updateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSTLSSocket* thisObject = jsDynamicCast<JSTLSSocket*>(callFrame->thisValue()); + JSCryptoHasher* thisObject = jsDynamicCast<JSCryptoHasher*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -747,151 +614,120 @@ JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__reloadCallback, (JSGlobalObject * l JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return TLSSocketPrototype__reload(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return CryptoHasherPrototype__update(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_CUSTOM_GETTER(TLSSocketPrototype__remoteAddressGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +void JSCryptoHasherPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) { - 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); + Base::finishCreation(vm); + reifyStaticProperties(vm, JSCryptoHasher::info(), JSCryptoHasherPrototypeTableValues, *this); + JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); +} - if (JSValue cachedValue = thisObject->m_remoteAddress.get()) - return JSValue::encode(cachedValue); +extern "C" JSC_DECLARE_CUSTOM_GETTER(CryptoHasherClass__getAlgorithms); +extern "C" JSC_DECLARE_HOST_FUNCTION(CryptoHasherClass__hash); - JSC::JSValue result = JSC::JSValue::decode( - TLSSocketPrototype__getRemoteAddress(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_remoteAddress.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} +static const HashTableValue JSCryptoHasherConstructorTableValues[] = { + { "algorithms"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, CryptoHasherClass__getAlgorithms, 0 } }, + { "hash"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, CryptoHasherClass__hash, 2 } } +}; -extern "C" void TLSSocketPrototype__remoteAddressSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) +void JSCryptoHasherConstructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSCryptoHasherPrototype* prototype) { - auto& vm = globalObject->vm(); - auto* thisObject = jsCast<JSTLSSocket*>(JSValue::decode(thisValue)); - thisObject->m_remoteAddress.set(vm, thisObject, JSValue::decode(value)); + Base::finishCreation(vm, 0, "CryptoHasher"_s, PropertyAdditionMode::WithoutStructureTransition); + reifyStaticProperties(vm, &JSCryptoHasherConstructor::s_info, JSCryptoHasherConstructorTableValues, *this); + putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly); + ASSERT(inherits(info())); } -extern "C" EncodedJSValue TLSSocketPrototype__remoteAddressGetCachedValue(JSC::EncodedJSValue thisValue) +JSCryptoHasherConstructor::JSCryptoHasherConstructor(JSC::VM& vm, JSC::Structure* structure) + : Base(vm, structure, construct, construct) { - auto* thisObject = jsCast<JSTLSSocket*>(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_remoteAddress.get()); } -JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__shutdownCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSCryptoHasherConstructor* JSCryptoHasherConstructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSCryptoHasherPrototype* prototype) { - auto& vm = lexicalGlobalObject->vm(); - - 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__shutdown(thisObject->wrapped(), lexicalGlobalObject, callFrame); + JSCryptoHasherConstructor* ptr = new (NotNull, JSC::allocateCell<JSCryptoHasherConstructor>(vm)) JSCryptoHasherConstructor(vm, structure); + ptr->finishCreation(vm, globalObject, prototype); + return ptr; } -JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__timeoutCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSCryptoHasherConstructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) { - auto& vm = lexicalGlobalObject->vm(); - - JSTLSSocket* thisObject = jsDynamicCast<JSTLSSocket*>(callFrame->thisValue()); + 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); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + 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()); } - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - return TLSSocketPrototype__timeout(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__unrefCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); - - JSTLSSocket* thisObject = jsDynamicCast<JSTLSSocket*>(callFrame->thisValue()); + void* ptr = CryptoHasherClass__construct(globalObject, callFrame); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + if (UNLIKELY(!ptr)) { + return JSValue::encode(JSC::jsUndefined()); } - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSCryptoHasher* instance = JSCryptoHasher::create(vm, globalObject, structure, ptr); - return TLSSocketPrototype__unref(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return JSValue::encode(instance); } -JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__writeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +void JSCryptoHasherConstructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSCryptoHasherPrototype* prototype) { - auto& vm = lexicalGlobalObject->vm(); - - 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__write(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -void JSTLSSocketPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) -{ - Base::finishCreation(vm); - reifyStaticProperties(vm, JSTLSSocket::info(), JSTLSSocketPrototypeTableValues, *this); - JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); -} +const ClassInfo JSCryptoHasherConstructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSCryptoHasherConstructor) }; -extern "C" bool TLSSocket__hasPendingActivity(void* ptr); -bool JSTLSSocket::hasPendingActivity(void* ctx) +extern "C" EncodedJSValue CryptoHasher__getConstructor(Zig::GlobalObject* globalObject) { - return TLSSocket__hasPendingActivity(ctx); + return JSValue::encode(globalObject->JSCryptoHasherConstructor()); } -JSTLSSocket::~JSTLSSocket() +JSCryptoHasher::~JSCryptoHasher() { if (m_ctx) { - TLSSocketClass__finalize(m_ctx); + CryptoHasherClass__finalize(m_ctx); } } -void JSTLSSocket::destroy(JSCell* cell) +void JSCryptoHasher::destroy(JSCell* cell) { - static_cast<JSTLSSocket*>(cell)->JSTLSSocket::~JSTLSSocket(); + static_cast<JSCryptoHasher*>(cell)->JSCryptoHasher::~JSCryptoHasher(); } -const ClassInfo JSTLSSocket::s_info = { "TLSSocket"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTLSSocket) }; +const ClassInfo JSCryptoHasher::s_info = { "CryptoHasher"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSCryptoHasher) }; -void JSTLSSocket::finishCreation(VM& vm) +void JSCryptoHasher::finishCreation(VM& vm) { Base::finishCreation(vm); ASSERT(inherits(info())); } -JSTLSSocket* JSTLSSocket::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) +JSCryptoHasher* JSCryptoHasher::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) { - JSTLSSocket* ptr = new (NotNull, JSC::allocateCell<JSTLSSocket>(vm)) JSTLSSocket(vm, structure, ctx); + JSCryptoHasher* ptr = new (NotNull, JSC::allocateCell<JSCryptoHasher>(vm)) JSCryptoHasher(vm, structure, ctx); ptr->finishCreation(vm); return ptr; } -extern "C" void* TLSSocket__fromJS(JSC::EncodedJSValue value) +extern "C" void* CryptoHasher__fromJS(JSC::EncodedJSValue value) { JSC::JSValue decodedValue = JSC::JSValue::decode(value); if (decodedValue.isEmpty() || !decodedValue.isCell()) return nullptr; JSC::JSCell* cell = decodedValue.asCell(); - JSTLSSocket* object = JSC::jsDynamicCast<JSTLSSocket*>(cell); + JSCryptoHasher* object = JSC::jsDynamicCast<JSCryptoHasher*>(cell); if (!object) return nullptr; @@ -899,9 +735,9 @@ extern "C" void* TLSSocket__fromJS(JSC::EncodedJSValue value) return object->wrapped(); } -extern "C" bool TLSSocket__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) +extern "C" bool CryptoHasher__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) { - JSTLSSocket* object = JSC::jsDynamicCast<JSTLSSocket*>(JSValue::decode(value)); + JSCryptoHasher* object = JSC::jsDynamicCast<JSCryptoHasher*>(JSValue::decode(value)); if (!object) return false; @@ -909,11 +745,11 @@ extern "C" bool TLSSocket__dangerouslySetPtr(JSC::EncodedJSValue value, void* pt return true; } -extern "C" const size_t TLSSocket__ptrOffset = JSTLSSocket::offsetOfWrapped(); +extern "C" const size_t CryptoHasher__ptrOffset = JSCryptoHasher::offsetOfWrapped(); -void JSTLSSocket::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) +void JSCryptoHasher::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) { - auto* thisObject = jsCast<JSTLSSocket*>(cell); + auto* thisObject = jsCast<JSCryptoHasher*>(cell); if (void* wrapped = thisObject->wrapped()) { // if (thisObject->scriptExecutionContext()) // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); @@ -921,63 +757,67 @@ void JSTLSSocket::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) Base::analyzeHeap(cell, analyzer); } -JSObject* JSTLSSocket::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) +JSObject* JSCryptoHasher::createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype) { - return JSTLSSocketPrototype::create(vm, globalObject, JSTLSSocketPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); + return WebCore::JSCryptoHasherConstructor::create(vm, globalObject, WebCore::JSCryptoHasherConstructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast<WebCore::JSCryptoHasherPrototype*>(prototype)); } -extern "C" EncodedJSValue TLSSocket__create(Zig::GlobalObject* globalObject, void* ptr) +JSObject* JSCryptoHasher::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) +{ + 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->JSTLSSocketStructure(); - JSTLSSocket* instance = JSTLSSocket::create(vm, globalObject, structure, ptr); + JSC::Structure* structure = globalObject->JSCryptoHasherStructure(); + JSCryptoHasher* instance = JSCryptoHasher::create(vm, globalObject, structure, ptr); return JSValue::encode(instance); } template<typename Visitor> -void JSTLSSocket::visitChildrenImpl(JSCell* cell, Visitor& visitor) +void JSCryptoHasher::visitChildrenImpl(JSCell* cell, Visitor& visitor) { - JSTLSSocket* thisObject = jsCast<JSTLSSocket*>(cell); + JSCryptoHasher* thisObject = jsCast<JSCryptoHasher*>(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.append(thisObject->m_algorithms); + visitor.append(thisObject->m_algorithm); } -DEFINE_VISIT_CHILDREN(JSTLSSocket); +DEFINE_VISIT_CHILDREN(JSCryptoHasher); template<typename Visitor> -void JSTLSSocket::visitAdditionalChildren(Visitor& visitor) +void JSCryptoHasher::visitAdditionalChildren(Visitor& visitor) { - JSTLSSocket* thisObject = this; + JSCryptoHasher* thisObject = this; ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - visitor.append(thisObject->m_data); - visitor.append(thisObject->m_remoteAddress); - visitor.addOpaqueRoot(this->wrapped()); + visitor.append(thisObject->m_algorithms); + visitor.append(thisObject->m_algorithm); + ; } -DEFINE_VISIT_ADDITIONAL_CHILDREN(JSTLSSocket); +DEFINE_VISIT_ADDITIONAL_CHILDREN(JSCryptoHasher); template<typename Visitor> -void JSTLSSocket::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) +void JSCryptoHasher::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) { - JSTLSSocket* thisObject = jsCast<JSTLSSocket*>(cell); + JSCryptoHasher* thisObject = jsCast<JSCryptoHasher*>(cell); ASSERT_GC_OBJECT_INHERITS(thisObject, info()); thisObject->visitAdditionalChildren<Visitor>(visitor); } -DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSTLSSocket); -class JSListenerPrototype final : public JSC::JSNonFinalObject { +DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSCryptoHasher); +class JSDirentPrototype final : public JSC::JSNonFinalObject { public: using Base = JSC::JSNonFinalObject; - static JSListenerPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) + static JSDirentPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) { - JSListenerPrototype* ptr = new (NotNull, JSC::allocateCell<JSListenerPrototype>(vm)) JSListenerPrototype(vm, globalObject, structure); + JSDirentPrototype* ptr = new (NotNull, JSC::allocateCell<JSDirentPrototype>(vm)) JSDirentPrototype(vm, globalObject, structure); ptr->finishCreation(vm, globalObject); return ptr; } @@ -994,7 +834,7 @@ public: } private: - JSListenerPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) + JSDirentPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) : Base(vm, structure) { } @@ -1002,135 +842,103 @@ private: 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); +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); -extern "C" EncodedJSValue ListenerPrototype__ref(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ListenerPrototype__refCallback); + static constexpr unsigned StructureFlags = Base::StructureFlags; + static constexpr bool needsDestruction = false; -extern "C" EncodedJSValue ListenerPrototype__reload(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ListenerPrototype__reloadCallback); + 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()); + } -extern "C" EncodedJSValue ListenerPrototype__stop(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ListenerPrototype__stopCallback); + 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 = WTFMove(space); }, + [](auto& spaces) { return spaces.m_subspaceForDirentConstructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForDirentConstructor = WTFMove(space); }); + } -extern "C" JSC::EncodedJSValue ListenerPrototype__getUnix(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(ListenerPrototype__unixGetterWrap); + void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSDirentPrototype* prototype); -extern "C" EncodedJSValue ListenerPrototype__unref(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ListenerPrototype__unrefCallback); + // Must be defined for each specialization class. + static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSListenerPrototype, JSListenerPrototype::Base); + DECLARE_EXPORT_INFO; -static const HashTableValue JSListenerPrototypeTableValues[] = { - { "data"_s, static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, ListenerPrototype__dataGetterWrap, ListenerPrototype__dataSetterWrap } }, - { "hostname"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, ListenerPrototype__hostnameGetterWrap, 0 } }, - { "port"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, ListenerPrototype__portGetterWrap, 0 } }, - { "ref"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ListenerPrototype__refCallback, 0 } }, - { "reload"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ListenerPrototype__reloadCallback, 1 } }, - { "stop"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ListenerPrototype__stopCallback, 1 } }, - { "unix"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, ListenerPrototype__unixGetterWrap, 0 } }, - { "unref"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ListenerPrototype__unrefCallback, 0 } } +private: + JSDirentConstructor(JSC::VM& vm, JSC::Structure* structure); + void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSDirentPrototype* prototype); }; -const ClassInfo JSListenerPrototype::s_info = { "Listener"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSListenerPrototype) }; +extern "C" void* DirentClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); +JSC_DECLARE_CUSTOM_GETTER(jsDirentConstructor); +extern "C" void DirentClass__finalize(void*); -JSC_DEFINE_CUSTOM_GETTER(jsListenerConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - auto* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); - auto* prototype = jsDynamicCast<JSListenerPrototype*>(JSValue::decode(thisValue)); +extern "C" EncodedJSValue DirentPrototype__isBlockDevice(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(DirentPrototype__isBlockDeviceCallback); - if (UNLIKELY(!prototype)) - return throwVMTypeError(lexicalGlobalObject, throwScope); - return JSValue::encode(globalObject->JSListenerConstructor()); -} +extern "C" EncodedJSValue DirentPrototype__isCharacterDevice(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(DirentPrototype__isCharacterDeviceCallback); -JSC_DEFINE_CUSTOM_GETTER(ListenerPrototype__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); - JSListener* thisObject = jsCast<JSListener*>(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = ListenerPrototype__getData(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} +extern "C" EncodedJSValue DirentPrototype__isDirectory(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(DirentPrototype__isDirectoryCallback); -JSC_DEFINE_CUSTOM_SETTER(ListenerPrototype__dataSetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSListener* thisObject = jsCast<JSListener*>(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - auto result = ListenerPrototype__setData(thisObject->wrapped(), lexicalGlobalObject, encodedValue); +extern "C" EncodedJSValue DirentPrototype__isFIFO(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(DirentPrototype__isFIFOCallback); - RELEASE_AND_RETURN(throwScope, result); -} +extern "C" EncodedJSValue DirentPrototype__isFile(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(DirentPrototype__isFileCallback); -JSC_DEFINE_CUSTOM_GETTER(ListenerPrototype__hostnameGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - 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); +extern "C" EncodedJSValue DirentPrototype__isSocket(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(DirentPrototype__isSocketCallback); - if (JSValue cachedValue = thisObject->m_hostname.get()) - return JSValue::encode(cachedValue); +extern "C" EncodedJSValue DirentPrototype__isSymbolicLink(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(DirentPrototype__isSymbolicLinkCallback); - JSC::JSValue result = JSC::JSValue::decode( - 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" JSC::EncodedJSValue DirentPrototype__getName(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); +JSC_DECLARE_CUSTOM_GETTER(DirentPrototype__nameGetterWrap); -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)); -} +STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSDirentPrototype, JSDirentPrototype::Base); -extern "C" EncodedJSValue ListenerPrototype__hostnameGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast<JSListener*>(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_hostname.get()); -} +static const HashTableValue JSDirentPrototypeTableValues[] = { + { "isBlockDevice"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, DirentPrototype__isBlockDeviceCallback, 0 } }, + { "isCharacterDevice"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, DirentPrototype__isCharacterDeviceCallback, 0 } }, + { "isDirectory"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, DirentPrototype__isDirectoryCallback, 0 } }, + { "isFIFO"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, DirentPrototype__isFIFOCallback, 0 } }, + { "isFile"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, DirentPrototype__isFileCallback, 0 } }, + { "isSocket"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, DirentPrototype__isSocketCallback, 0 } }, + { "isSymbolicLink"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, DirentPrototype__isSymbolicLinkCallback, 0 } }, + { "name"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, DirentPrototype__nameGetterWrap, 0 } } +}; -JSC_DEFINE_CUSTOM_GETTER(ListenerPrototype__portGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +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)) { - auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + VM& vm = JSC::getVM(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); - JSListener* thisObject = jsCast<JSListener*>(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = ListenerPrototype__getPort(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); + auto* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + auto* prototype = jsDynamicCast<JSDirentPrototype*>(JSValue::decode(thisValue)); + + if (UNLIKELY(!prototype)) + return throwVMTypeError(lexicalGlobalObject, throwScope); + return JSValue::encode(globalObject->JSDirentConstructor()); } -JSC_DEFINE_HOST_FUNCTION(ListenerPrototype__refCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(DirentPrototype__isBlockDeviceCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSListener* thisObject = jsDynamicCast<JSListener*>(callFrame->thisValue()); + JSDirent* thisObject = jsDynamicCast<JSDirent*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -1139,14 +947,14 @@ JSC_DEFINE_HOST_FUNCTION(ListenerPrototype__refCallback, (JSGlobalObject * lexic JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return ListenerPrototype__ref(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return DirentPrototype__isBlockDevice(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(ListenerPrototype__reloadCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(DirentPrototype__isCharacterDeviceCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSListener* thisObject = jsDynamicCast<JSListener*>(callFrame->thisValue()); + JSDirent* thisObject = jsDynamicCast<JSDirent*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -1155,14 +963,14 @@ JSC_DEFINE_HOST_FUNCTION(ListenerPrototype__reloadCallback, (JSGlobalObject * le JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return ListenerPrototype__reload(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return DirentPrototype__isCharacterDevice(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(ListenerPrototype__stopCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(DirentPrototype__isDirectoryCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSListener* thisObject = jsDynamicCast<JSListener*>(callFrame->thisValue()); + JSDirent* thisObject = jsDynamicCast<JSDirent*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -1171,45 +979,14 @@ JSC_DEFINE_HOST_FUNCTION(ListenerPrototype__stopCallback, (JSGlobalObject * lexi 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); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSListener* thisObject = jsCast<JSListener*>(JSValue::decode(thisValue)); - 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)); - 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) -{ - auto* thisObject = jsCast<JSListener*>(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_unix.get()); + return DirentPrototype__isDirectory(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(ListenerPrototype__unrefCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(DirentPrototype__isFIFOCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSListener* thisObject = jsDynamicCast<JSListener*>(callFrame->thisValue()); + JSDirent* thisObject = jsDynamicCast<JSDirent*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -1218,263 +995,30 @@ JSC_DEFINE_HOST_FUNCTION(ListenerPrototype__unrefCallback, (JSGlobalObject * lex JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return ListenerPrototype__unref(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -void JSListenerPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) -{ - Base::finishCreation(vm); - reifyStaticProperties(vm, JSListener::info(), JSListenerPrototypeTableValues, *this); - JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); -} - -JSListener::~JSListener() -{ - if (m_ctx) { - ListenerClass__finalize(m_ctx); - } -} -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) -{ - Base::finishCreation(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; - - JSC::JSCell* cell = decodedValue.asCell(); - JSListener* object = JSC::jsDynamicCast<JSListener*>(cell); - - 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" const size_t Listener__ptrOffset = JSListener::offsetOfWrapped(); - -void JSListener::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) -{ - auto* thisObject = jsCast<JSListener*>(cell); - if (void* wrapped = thisObject->wrapped()) { - // if (thisObject->scriptExecutionContext()) - // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); - } - 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); -} - -template<typename Visitor> -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); - -template<typename Visitor> -void JSListener::visitAdditionalChildren(Visitor& visitor) -{ - JSListener* thisObject = this; - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - - visitor.append(thisObject->m_hostname); - visitor.append(thisObject->m_unix); - ; + return DirentPrototype__isFIFO(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -DEFINE_VISIT_ADDITIONAL_CHILDREN(JSListener); - -template<typename Visitor> -void JSListener::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) +JSC_DEFINE_HOST_FUNCTION(DirentPrototype__isFileCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { - JSListener* thisObject = jsCast<JSListener*>(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - thisObject->visitAdditionalChildren<Visitor>(visitor); -} - -DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSListener); -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), NoIntrinsic, { HashTableValue::GetterSetterType, SubprocessPrototype__exitCodeGetterWrap, 0 } }, - { "exited"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, SubprocessPrototype__exitedGetterWrap, 0 } }, - { "kill"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, SubprocessPrototype__killCallback, 1 } }, - { "killed"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, SubprocessPrototype__killedGetterWrap, 0 } }, - { "pid"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, SubprocessPrototype__pidGetterWrap, 0 } }, - { "readable"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, SubprocessPrototype__readableGetterWrap, 0 } }, - { "ref"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, SubprocessPrototype__refCallback, 0 } }, - { "signalCode"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, SubprocessPrototype__signalCodeGetterWrap, 0 } }, - { "stderr"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, SubprocessPrototype__stderrGetterWrap, 0 } }, - { "stdin"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, SubprocessPrototype__stdinGetterWrap, 0 } }, - { "stdout"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, SubprocessPrototype__stdoutGetterWrap, 0 } }, - { "unref"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, SubprocessPrototype__unrefCallback, 0 } }, - { "writable"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, SubprocessPrototype__writableGetterWrap, 0 } } -}; - -const ClassInfo JSSubprocessPrototype::s_info = { "Subprocess"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSubprocessPrototype) }; + auto& vm = lexicalGlobalObject->vm(); -JSC_DEFINE_CUSTOM_GETTER(jsSubprocessConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - auto* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); - auto* prototype = jsDynamicCast<JSSubprocessPrototype*>(JSValue::decode(thisValue)); + JSDirent* thisObject = jsDynamicCast<JSDirent*>(callFrame->thisValue()); - if (UNLIKELY(!prototype)) + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); 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); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSSubprocess* thisObject = jsCast<JSSubprocess*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = SubprocessPrototype__getExitCode(thisObject->wrapped(), globalObject); - 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); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSSubprocess* thisObject = jsCast<JSSubprocess*>(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = SubprocessPrototype__getExited(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); + return DirentPrototype__isFile(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(SubprocessPrototype__killCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(DirentPrototype__isSocketCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSSubprocess* thisObject = jsDynamicCast<JSSubprocess*>(callFrame->thisValue()); + JSDirent* thisObject = jsDynamicCast<JSDirent*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -1483,69 +1027,14 @@ JSC_DEFINE_HOST_FUNCTION(SubprocessPrototype__killCallback, (JSGlobalObject * le JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - 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); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSSubprocess* thisObject = jsCast<JSSubprocess*>(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = SubprocessPrototype__getKilled(thisObject->wrapped(), globalObject); - 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); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSSubprocess* thisObject = jsCast<JSSubprocess*>(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = SubprocessPrototype__getPid(thisObject->wrapped(), globalObject); - 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); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSSubprocess* thisObject = jsCast<JSSubprocess*>(JSValue::decode(thisValue)); - 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)); - 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) -{ - auto* thisObject = jsCast<JSSubprocess*>(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_stdout.get()); + return DirentPrototype__isSocket(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(SubprocessPrototype__refCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(DirentPrototype__isSymbolicLinkCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSSubprocess* thisObject = jsDynamicCast<JSSubprocess*>(callFrame->thisValue()); + JSDirent* thisObject = jsDynamicCast<JSDirent*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -1554,208 +1043,143 @@ JSC_DEFINE_HOST_FUNCTION(SubprocessPrototype__refCallback, (JSGlobalObject * lex JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - 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); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSSubprocess* thisObject = jsCast<JSSubprocess*>(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = SubprocessPrototype__getSignalCode(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); + return DirentPrototype__isSymbolicLink(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_CUSTOM_GETTER(SubprocessPrototype__stderrGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(DirentPrototype__nameGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); - JSSubprocess* thisObject = jsCast<JSSubprocess*>(JSValue::decode(thisValue)); + JSDirent* thisObject = jsCast<JSDirent*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (JSValue cachedValue = thisObject->m_stderr.get()) + if (JSValue cachedValue = thisObject->m_name.get()) return JSValue::encode(cachedValue); JSC::JSValue result = JSC::JSValue::decode( - SubprocessPrototype__getStderr(thisObject->wrapped(), globalObject)); + DirentPrototype__getName(thisObject->wrapped(), globalObject)); RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_stderr.set(vm, thisObject, result); + thisObject->m_name.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) +extern "C" void DirentPrototype__nameSetCachedValue(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); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSSubprocess* thisObject = jsCast<JSSubprocess*>(JSValue::decode(thisValue)); - 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)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_stdin.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); + auto* thisObject = jsCast<JSDirent*>(JSValue::decode(thisValue)); + thisObject->m_name.set(vm, thisObject, JSValue::decode(value)); } -extern "C" void SubprocessPrototype__stdinSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) +extern "C" EncodedJSValue DirentPrototype__nameGetCachedValue(JSC::EncodedJSValue thisValue) { - auto& vm = globalObject->vm(); - auto* thisObject = jsCast<JSSubprocess*>(JSValue::decode(thisValue)); - thisObject->m_stdin.set(vm, thisObject, JSValue::decode(value)); + auto* thisObject = jsCast<JSDirent*>(JSValue::decode(thisValue)); + return JSValue::encode(thisObject->m_name.get()); } -extern "C" EncodedJSValue SubprocessPrototype__stdinGetCachedValue(JSC::EncodedJSValue thisValue) +void JSDirentPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) { - auto* thisObject = jsCast<JSSubprocess*>(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_stdin.get()); + Base::finishCreation(vm); + reifyStaticProperties(vm, JSDirent::info(), JSDirentPrototypeTableValues, *this); + JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); } -JSC_DEFINE_CUSTOM_GETTER(SubprocessPrototype__stdoutGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +void JSDirentConstructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSDirentPrototype* prototype) { - auto& vm = lexicalGlobalObject->vm(); - 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); - - if (JSValue cachedValue = thisObject->m_stdout.get()) - return JSValue::encode(cachedValue); + Base::finishCreation(vm, 0, "Dirent"_s, PropertyAdditionMode::WithoutStructureTransition); - JSC::JSValue result = JSC::JSValue::decode( - SubprocessPrototype__getStdout(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_stdout.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); + putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly); + ASSERT(inherits(info())); } -extern "C" void SubprocessPrototype__stdoutSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) +JSDirentConstructor::JSDirentConstructor(JSC::VM& vm, JSC::Structure* structure) + : Base(vm, structure, construct, construct) { - 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) +JSDirentConstructor* JSDirentConstructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSDirentPrototype* prototype) { - auto* thisObject = jsCast<JSSubprocess*>(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_stdout.get()); + JSDirentConstructor* ptr = new (NotNull, JSC::allocateCell<JSDirentConstructor>(vm)) JSDirentConstructor(vm, structure); + ptr->finishCreation(vm, globalObject, prototype); + return ptr; } -JSC_DEFINE_HOST_FUNCTION(SubprocessPrototype__unrefCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSDirentConstructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) { - auto& vm = lexicalGlobalObject->vm(); - - JSSubprocess* thisObject = jsDynamicCast<JSSubprocess*>(callFrame->thisValue()); + 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); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + 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()); } - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - 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); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSSubprocess* thisObject = jsCast<JSSubprocess*>(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + void* ptr = DirentClass__construct(globalObject, callFrame); - if (JSValue cachedValue = thisObject->m_stdin.get()) - return JSValue::encode(cachedValue); + if (UNLIKELY(!ptr)) { + return JSValue::encode(JSC::jsUndefined()); + } - JSC::JSValue result = JSC::JSValue::decode( - SubprocessPrototype__getStdin(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_stdin.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); -} + JSDirent* instance = JSDirent::create(vm, globalObject, structure, ptr); -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)); + return JSValue::encode(instance); } -extern "C" EncodedJSValue SubprocessPrototype__writableGetCachedValue(JSC::EncodedJSValue thisValue) +void JSDirentConstructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSDirentPrototype* prototype) { - auto* thisObject = jsCast<JSSubprocess*>(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_stdin.get()); } -void JSSubprocessPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) -{ - Base::finishCreation(vm); - reifyStaticProperties(vm, JSSubprocess::info(), JSSubprocessPrototypeTableValues, *this); - JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); -} +const ClassInfo JSDirentConstructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSDirentConstructor) }; -extern "C" bool Subprocess__hasPendingActivity(void* ptr); -bool JSSubprocess::hasPendingActivity(void* ctx) +extern "C" EncodedJSValue Dirent__getConstructor(Zig::GlobalObject* globalObject) { - return Subprocess__hasPendingActivity(ctx); + return JSValue::encode(globalObject->JSDirentConstructor()); } -JSSubprocess::~JSSubprocess() +JSDirent::~JSDirent() { if (m_ctx) { - SubprocessClass__finalize(m_ctx); + DirentClass__finalize(m_ctx); } } -void JSSubprocess::destroy(JSCell* cell) +void JSDirent::destroy(JSCell* cell) { - static_cast<JSSubprocess*>(cell)->JSSubprocess::~JSSubprocess(); + static_cast<JSDirent*>(cell)->JSDirent::~JSDirent(); } -const ClassInfo JSSubprocess::s_info = { "Subprocess"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSubprocess) }; +const ClassInfo JSDirent::s_info = { "Dirent"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSDirent) }; -void JSSubprocess::finishCreation(VM& vm) +void JSDirent::finishCreation(VM& vm) { Base::finishCreation(vm); ASSERT(inherits(info())); } -JSSubprocess* JSSubprocess::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) +JSDirent* JSDirent::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) { - JSSubprocess* ptr = new (NotNull, JSC::allocateCell<JSSubprocess>(vm)) JSSubprocess(vm, structure, ctx); + JSDirent* ptr = new (NotNull, JSC::allocateCell<JSDirent>(vm)) JSDirent(vm, structure, ctx); ptr->finishCreation(vm); return ptr; } -extern "C" void* Subprocess__fromJS(JSC::EncodedJSValue value) +extern "C" void* Dirent__fromJS(JSC::EncodedJSValue value) { JSC::JSValue decodedValue = JSC::JSValue::decode(value); if (decodedValue.isEmpty() || !decodedValue.isCell()) return nullptr; JSC::JSCell* cell = decodedValue.asCell(); - JSSubprocess* object = JSC::jsDynamicCast<JSSubprocess*>(cell); + JSDirent* object = JSC::jsDynamicCast<JSDirent*>(cell); if (!object) return nullptr; @@ -1763,9 +1187,9 @@ extern "C" void* Subprocess__fromJS(JSC::EncodedJSValue value) return object->wrapped(); } -extern "C" bool Subprocess__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) +extern "C" bool Dirent__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) { - JSSubprocess* object = JSC::jsDynamicCast<JSSubprocess*>(JSValue::decode(value)); + JSDirent* object = JSC::jsDynamicCast<JSDirent*>(JSValue::decode(value)); if (!object) return false; @@ -1773,11 +1197,11 @@ extern "C" bool Subprocess__dangerouslySetPtr(JSC::EncodedJSValue value, void* p return true; } -extern "C" const size_t Subprocess__ptrOffset = JSSubprocess::offsetOfWrapped(); +extern "C" const size_t Dirent__ptrOffset = JSDirent::offsetOfWrapped(); -void JSSubprocess::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) +void JSDirent::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) { - auto* thisObject = jsCast<JSSubprocess*>(cell); + auto* thisObject = jsCast<JSDirent*>(cell); if (void* wrapped = thisObject->wrapped()) { // if (thisObject->scriptExecutionContext()) // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); @@ -1785,65 +1209,65 @@ void JSSubprocess::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) Base::analyzeHeap(cell, analyzer); } -JSObject* JSSubprocess::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) +JSObject* JSDirent::createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype) { - return JSSubprocessPrototype::create(vm, globalObject, JSSubprocessPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); + return WebCore::JSDirentConstructor::create(vm, globalObject, WebCore::JSDirentConstructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast<WebCore::JSDirentPrototype*>(prototype)); } -extern "C" EncodedJSValue Subprocess__create(Zig::GlobalObject* globalObject, void* ptr) +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->JSSubprocessStructure(); - JSSubprocess* instance = JSSubprocess::create(vm, globalObject, structure, ptr); + JSC::Structure* structure = globalObject->JSDirentStructure(); + JSDirent* instance = JSDirent::create(vm, globalObject, structure, ptr); return JSValue::encode(instance); } template<typename Visitor> -void JSSubprocess::visitChildrenImpl(JSCell* cell, Visitor& visitor) +void JSDirent::visitChildrenImpl(JSCell* cell, Visitor& visitor) { - JSSubprocess* thisObject = jsCast<JSSubprocess*>(cell); + JSDirent* thisObject = jsCast<JSDirent*>(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.append(thisObject->m_name); } -DEFINE_VISIT_CHILDREN(JSSubprocess); +DEFINE_VISIT_CHILDREN(JSDirent); template<typename Visitor> -void JSSubprocess::visitAdditionalChildren(Visitor& visitor) +void JSDirent::visitAdditionalChildren(Visitor& visitor) { - JSSubprocess* thisObject = this; + JSDirent* thisObject = this; ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - visitor.append(thisObject->m_stderr); - visitor.append(thisObject->m_stdin); - visitor.append(thisObject->m_stdout); - visitor.addOpaqueRoot(this->wrapped()); + visitor.append(thisObject->m_name); + ; } -DEFINE_VISIT_ADDITIONAL_CHILDREN(JSSubprocess); +DEFINE_VISIT_ADDITIONAL_CHILDREN(JSDirent); template<typename Visitor> -void JSSubprocess::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) +void JSDirent::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) { - JSSubprocess* thisObject = jsCast<JSSubprocess*>(cell); + JSDirent* thisObject = jsCast<JSDirent*>(cell); ASSERT_GC_OBJECT_INHERITS(thisObject, info()); thisObject->visitAdditionalChildren<Visitor>(visitor); } -DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSSubprocess); -class JSSHA1Prototype final : public JSC::JSNonFinalObject { +DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSDirent); +class JSExpectPrototype final : public JSC::JSNonFinalObject { public: using Base = JSC::JSNonFinalObject; - static JSSHA1Prototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) + static JSExpectPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) { - JSSHA1Prototype* ptr = new (NotNull, JSC::allocateCell<JSSHA1Prototype>(vm)) JSSHA1Prototype(vm, globalObject, structure); + JSExpectPrototype* ptr = new (NotNull, JSC::allocateCell<JSExpectPrototype>(vm)) JSExpectPrototype(vm, globalObject, structure); ptr->finishCreation(vm, globalObject); return ptr; } @@ -1860,7 +1284,7 @@ public: } private: - JSSHA1Prototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) + JSExpectPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) : Base(vm, structure) { } @@ -1868,10 +1292,10 @@ private: void finishCreation(JSC::VM&, JSC::JSGlobalObject*); }; -class JSSHA1Constructor final : public JSC::InternalFunction { +class JSExpectConstructor final : public JSC::InternalFunction { public: using Base = JSC::InternalFunction; - static JSSHA1Constructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSSHA1Prototype* prototype); + 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; @@ -1885,15 +1309,15 @@ public: { if constexpr (mode == JSC::SubspaceAccess::Concurrently) return nullptr; - return WebCore::subspaceForImpl<JSSHA1Constructor, WebCore::UseCustomHeapCellType::No>( + return WebCore::subspaceForImpl<JSExpectConstructor, WebCore::UseCustomHeapCellType::No>( vm, - [](auto& spaces) { return spaces.m_clientSubspaceForSHA1Constructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForSHA1Constructor = WTFMove(space); }, - [](auto& spaces) { return spaces.m_subspaceForSHA1Constructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForSHA1Constructor = WTFMove(space); }); + [](auto& spaces) { return spaces.m_clientSubspaceForExpectConstructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForExpectConstructor = WTFMove(space); }, + [](auto& spaces) { return spaces.m_subspaceForExpectConstructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForExpectConstructor = WTFMove(space); }); } - void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSSHA1Prototype* prototype); + 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*); @@ -1901,367 +1325,223 @@ public: 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), NoIntrinsic, { HashTableValue::GetterSetterType, SHA1Prototype__byteLengthGetterWrap, 0 } }, - { "digest"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA1Prototype__digestCallback, 0 } }, - { "update"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA1Prototype__updateCallback, 1 } } + JSExpectConstructor(JSC::VM& vm, JSC::Structure* structure); + void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSExpectPrototype* prototype); }; -const ClassInfo JSSHA1Prototype::s_info = { "SHA1"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA1Prototype) }; +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); -JSC_DEFINE_CUSTOM_GETTER(jsSHA1Constructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - auto* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); - auto* prototype = jsDynamicCast<JSSHA1Prototype*>(JSValue::decode(thisValue)); +extern "C" JSC::EncodedJSValue ExpectPrototype__getNot(void* ptr, JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* lexicalGlobalObject); +JSC_DECLARE_CUSTOM_GETTER(ExpectPrototype__notGetterWrap); - if (UNLIKELY(!prototype)) - return throwVMTypeError(lexicalGlobalObject, throwScope); - return JSValue::encode(globalObject->JSSHA1Constructor()); -} +extern "C" JSC::EncodedJSValue ExpectPrototype__getRejects(void* ptr, JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* lexicalGlobalObject); +JSC_DECLARE_CUSTOM_GETTER(ExpectPrototype__rejectsGetterWrap); -JSC_DEFINE_CUSTOM_GETTER(SHA1Prototype__byteLengthGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - 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); - JSC::EncodedJSValue result = SHA1Prototype__getByteLength(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} +extern "C" JSC::EncodedJSValue ExpectPrototype__getResolves(void* ptr, JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* lexicalGlobalObject); +JSC_DECLARE_CUSTOM_GETTER(ExpectPrototype__resolvesGetterWrap); -JSC_DEFINE_HOST_FUNCTION(SHA1Prototype__digestCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); +extern "C" EncodedJSValue ExpectPrototype__toBe(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toBeCallback); - JSSHA1* thisObject = jsDynamicCast<JSSHA1*>(callFrame->thisValue()); +extern "C" EncodedJSValue ExpectPrototype__toBeCloseTo(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toBeCloseToCallback); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } +extern "C" EncodedJSValue ExpectPrototype__toBeDefined(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toBeDefinedCallback); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); +extern "C" EncodedJSValue ExpectPrototype__toBeFalsy(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toBeFalsyCallback); - return SHA1Prototype__digest(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} +extern "C" EncodedJSValue ExpectPrototype__toBeGreaterThan(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toBeGreaterThanCallback); -JSC_DEFINE_HOST_FUNCTION(SHA1Prototype__updateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) -{ - auto& vm = lexicalGlobalObject->vm(); +extern "C" EncodedJSValue ExpectPrototype__toBeGreaterThanOrEqual(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toBeGreaterThanOrEqualCallback); - JSSHA1* thisObject = jsDynamicCast<JSSHA1*>(callFrame->thisValue()); +extern "C" EncodedJSValue ExpectPrototype__toBeInstanceOf(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toBeInstanceOfCallback); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } +extern "C" EncodedJSValue ExpectPrototype__toBeLessThan(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toBeLessThanCallback); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); +extern "C" EncodedJSValue ExpectPrototype__toBeLessThanOrEqual(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toBeLessThanOrEqualCallback); - return SHA1Prototype__update(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} +extern "C" EncodedJSValue ExpectPrototype__toBeNaN(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toBeNaNCallback); -void JSSHA1Prototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) -{ - Base::finishCreation(vm); - reifyStaticProperties(vm, JSSHA1::info(), JSSHA1PrototypeTableValues, *this); - JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); -} +extern "C" EncodedJSValue ExpectPrototype__toBeNull(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toBeNullCallback); -extern "C" JSC_DECLARE_CUSTOM_GETTER(SHA1Class__getByteLengthStatic); -extern "C" JSC_DECLARE_HOST_FUNCTION(SHA1Class__hash); +extern "C" EncodedJSValue ExpectPrototype__toBeTruthy(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toBeTruthyCallback); -static const HashTableValue JSSHA1ConstructorTableValues[] = { - { "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, SHA1Class__getByteLengthStatic, 0 } }, - { "hash"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA1Class__hash, 2 } } -}; +extern "C" EncodedJSValue ExpectPrototype__toBeUndefined(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toBeUndefinedCallback); -void JSSHA1Constructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSSHA1Prototype* prototype) -{ - Base::finishCreation(vm, 0, "SHA1"_s, PropertyAdditionMode::WithoutStructureTransition); - reifyStaticProperties(vm, &JSSHA1Constructor::s_info, JSSHA1ConstructorTableValues, *this); - putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly); - ASSERT(inherits(info())); -} +extern "C" EncodedJSValue ExpectPrototype__toContain(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toContainCallback); -JSSHA1Constructor::JSSHA1Constructor(JSC::VM& vm, JSC::Structure* structure) - : Base(vm, structure, construct, construct) -{ -} +extern "C" EncodedJSValue ExpectPrototype__toContainEqual(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toContainEqualCallback); -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; -} +extern "C" EncodedJSValue ExpectPrototype__toEqual(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toEqualCallback); -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(); - JSObject* newTarget = asObject(callFrame->newTarget()); - auto* constructor = globalObject->JSSHA1Constructor(); - Structure* structure = globalObject->JSSHA1Structure(); - if (constructor != newTarget) { - auto scope = DECLARE_THROW_SCOPE(vm); +extern "C" EncodedJSValue ExpectPrototype__toHaveBeenCalledTimes(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toHaveBeenCalledTimesCallback); - 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()); - } +extern "C" EncodedJSValue ExpectPrototype__toHaveBeenCalledWith(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toHaveBeenCalledWithCallback); - void* ptr = SHA1Class__construct(globalObject, callFrame); +extern "C" EncodedJSValue ExpectPrototype__toHaveBeenLastCalledWith(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toHaveBeenLastCalledWithCallback); - if (UNLIKELY(!ptr)) { - return JSValue::encode(JSC::jsUndefined()); - } +extern "C" EncodedJSValue ExpectPrototype__toHaveBeenNthCalledWith(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toHaveBeenNthCalledWithCallback); - JSSHA1* instance = JSSHA1::create(vm, globalObject, structure, ptr); +extern "C" EncodedJSValue ExpectPrototype__toHaveLastReturnedWith(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toHaveLastReturnedWithCallback); - return JSValue::encode(instance); -} +extern "C" EncodedJSValue ExpectPrototype__toHaveLength(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toHaveLengthCallback); -void JSSHA1Constructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSSHA1Prototype* prototype) -{ -} +extern "C" EncodedJSValue ExpectPrototype__toHaveNthReturnedWith(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toHaveNthReturnedWithCallback); -const ClassInfo JSSHA1Constructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA1Constructor) }; +extern "C" EncodedJSValue ExpectPrototype__toHaveProperty(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toHavePropertyCallback); -extern "C" EncodedJSValue SHA1__getConstructor(Zig::GlobalObject* globalObject) -{ - return JSValue::encode(globalObject->JSSHA1Constructor()); -} +extern "C" EncodedJSValue ExpectPrototype__toHaveReturnedTimes(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toHaveReturnedTimesCallback); -JSSHA1::~JSSHA1() -{ - if (m_ctx) { - SHA1Class__finalize(m_ctx); - } -} -void JSSHA1::destroy(JSCell* cell) -{ - static_cast<JSSHA1*>(cell)->JSSHA1::~JSSHA1(); -} +extern "C" EncodedJSValue ExpectPrototype__toHaveReturnedWith(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toHaveReturnedWithCallback); -const ClassInfo JSSHA1::s_info = { "SHA1"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA1) }; +extern "C" EncodedJSValue ExpectPrototype__toMatch(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toMatchCallback); -void JSSHA1::finishCreation(VM& vm) -{ - Base::finishCreation(vm); - ASSERT(inherits(info())); -} +extern "C" EncodedJSValue ExpectPrototype__toMatchInlineSnapshot(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toMatchInlineSnapshotCallback); -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" EncodedJSValue ExpectPrototype__toMatchObject(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toMatchObjectCallback); -extern "C" void* SHA1__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; +extern "C" EncodedJSValue ExpectPrototype__toMatchSnapshot(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toMatchSnapshotCallback); - JSC::JSCell* cell = decodedValue.asCell(); - JSSHA1* object = JSC::jsDynamicCast<JSSHA1*>(cell); +extern "C" EncodedJSValue ExpectPrototype__toStrictEqual(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toStrictEqualCallback); - if (!object) - return nullptr; +extern "C" EncodedJSValue ExpectPrototype__toThrow(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toThrowCallback); - return object->wrapped(); -} +extern "C" EncodedJSValue ExpectPrototype__toThrowErrorMatchingInlineSnapshot(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toThrowErrorMatchingInlineSnapshotCallback); -extern "C" bool SHA1__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSSHA1* object = JSC::jsDynamicCast<JSSHA1*>(JSValue::decode(value)); - if (!object) - return false; +extern "C" EncodedJSValue ExpectPrototype__toThrowErrorMatchingSnapshot(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toThrowErrorMatchingSnapshotCallback); - object->m_ctx = ptr; - return true; -} +STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSExpectPrototype, JSExpectPrototype::Base); -extern "C" const size_t SHA1__ptrOffset = JSSHA1::offsetOfWrapped(); +static const HashTableValue JSExpectPrototypeTableValues[] = { + { "not"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, ExpectPrototype__notGetterWrap, 0 } }, + { "rejects"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, ExpectPrototype__rejectsGetterWrap, 0 } }, + { "resolves"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, ExpectPrototype__resolvesGetterWrap, 0 } }, + { "toBe"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeCallback, 1 } }, + { "toBeCloseTo"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeCloseToCallback, 1 } }, + { "toBeDefined"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeDefinedCallback, 0 } }, + { "toBeFalsy"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeFalsyCallback, 0 } }, + { "toBeGreaterThan"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeGreaterThanCallback, 1 } }, + { "toBeGreaterThanOrEqual"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeGreaterThanOrEqualCallback, 1 } }, + { "toBeInstanceOf"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeInstanceOfCallback, 1 } }, + { "toBeLessThan"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeLessThanCallback, 1 } }, + { "toBeLessThanOrEqual"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeLessThanOrEqualCallback, 1 } }, + { "toBeNaN"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeNaNCallback, 0 } }, + { "toBeNull"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeNullCallback, 0 } }, + { "toBeTruthy"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeTruthyCallback, 0 } }, + { "toBeUndefined"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeUndefinedCallback, 0 } }, + { "toContain"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toContainCallback, 1 } }, + { "toContainEqual"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toContainEqualCallback, 1 } }, + { "toEqual"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toEqualCallback, 1 } }, + { "toHaveBeenCalledTimes"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toHaveBeenCalledTimesCallback, 1 } }, + { "toHaveBeenCalledWith"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toHaveBeenCalledWithCallback, 1 } }, + { "toHaveBeenLastCalledWith"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toHaveBeenLastCalledWithCallback, 1 } }, + { "toHaveBeenNthCalledWith"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toHaveBeenNthCalledWithCallback, 1 } }, + { "toHaveLastReturnedWith"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toHaveLastReturnedWithCallback, 1 } }, + { "toHaveLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toHaveLengthCallback, 1 } }, + { "toHaveNthReturnedWith"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toHaveNthReturnedWithCallback, 1 } }, + { "toHaveProperty"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toHavePropertyCallback, 2 } }, + { "toHaveReturnedTimes"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toHaveReturnedTimesCallback, 1 } }, + { "toHaveReturnedWith"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toHaveReturnedWithCallback, 1 } }, + { "toMatch"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toMatchCallback, 1 } }, + { "toMatchInlineSnapshot"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toMatchInlineSnapshotCallback, 1 } }, + { "toMatchObject"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toMatchObjectCallback, 1 } }, + { "toMatchSnapshot"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toMatchSnapshotCallback, 1 } }, + { "toStrictEqual"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toStrictEqualCallback, 1 } }, + { "toThrow"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toThrowCallback, 1 } }, + { "toThrowErrorMatchingInlineSnapshot"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toThrowErrorMatchingInlineSnapshotCallback, 1 } }, + { "toThrowErrorMatchingSnapshot"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toThrowErrorMatchingSnapshotCallback, 1 } } +}; -void JSSHA1::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) -{ - auto* thisObject = jsCast<JSSHA1*>(cell); - if (void* wrapped = thisObject->wrapped()) { - // if (thisObject->scriptExecutionContext()) - // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); - } - Base::analyzeHeap(cell, analyzer); -} +const ClassInfo JSExpectPrototype::s_info = { "Expect"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSExpectPrototype) }; -JSObject* JSSHA1::createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype) +JSC_DEFINE_CUSTOM_GETTER(jsExpectConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) { - return WebCore::JSSHA1Constructor::create(vm, globalObject, WebCore::JSSHA1Constructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast<WebCore::JSSHA1Prototype*>(prototype)); -} + VM& vm = JSC::getVM(lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + auto* prototype = jsDynamicCast<JSExpectPrototype*>(JSValue::decode(thisValue)); -JSObject* JSSHA1::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) -{ - return JSSHA1Prototype::create(vm, globalObject, JSSHA1Prototype::createStructure(vm, globalObject, globalObject->objectPrototype())); + if (UNLIKELY(!prototype)) + return throwVMTypeError(lexicalGlobalObject, throwScope); + return JSValue::encode(globalObject->JSExpectConstructor()); } -extern "C" EncodedJSValue SHA1__create(Zig::GlobalObject* globalObject, void* ptr) +JSC_DEFINE_CUSTOM_GETTER(ExpectPrototype__notGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSSHA1Structure(); - JSSHA1* instance = JSSHA1::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); + auto& vm = lexicalGlobalObject->vm(); + 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); + RETURN_IF_EXCEPTION(throwScope, {}); + RELEASE_AND_RETURN(throwScope, result); } -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 = WTFMove(space); }, - [](auto& spaces) { return spaces.m_subspaceForMD5Constructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForMD5Constructor = WTFMove(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); -}; - -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), NoIntrinsic, { HashTableValue::GetterSetterType, MD5Prototype__byteLengthGetterWrap, 0 } }, - { "digest"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, MD5Prototype__digestCallback, 0 } }, - { "update"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), 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)) +JSC_DEFINE_CUSTOM_GETTER(ExpectPrototype__rejectsGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { - VM& vm = JSC::getVM(lexicalGlobalObject); + auto& vm = lexicalGlobalObject->vm(); + Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); - auto* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); - auto* prototype = jsDynamicCast<JSMD5Prototype*>(JSValue::decode(thisValue)); - - if (UNLIKELY(!prototype)) - return throwVMTypeError(lexicalGlobalObject, throwScope); - return JSValue::encode(globalObject->JSMD5Constructor()); + JSExpect* thisObject = jsCast<JSExpect*>(JSValue::decode(thisValue)); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC::EncodedJSValue result = ExpectPrototype__getRejects(thisObject->wrapped(), thisValue, globalObject); + RETURN_IF_EXCEPTION(throwScope, {}); + RELEASE_AND_RETURN(throwScope, result); } -JSC_DEFINE_CUSTOM_GETTER(MD5Prototype__byteLengthGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(ExpectPrototype__resolvesGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); - JSMD5* thisObject = jsCast<JSMD5*>(JSValue::decode(thisValue)); + JSExpect* thisObject = jsCast<JSExpect*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = MD5Prototype__getByteLength(thisObject->wrapped(), globalObject); + JSC::EncodedJSValue result = ExpectPrototype__getResolves(thisObject->wrapped(), thisValue, globalObject); RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } -JSC_DEFINE_HOST_FUNCTION(MD5Prototype__digestCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSMD5* thisObject = jsDynamicCast<JSMD5*>(callFrame->thisValue()); + JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -2270,14 +1550,14 @@ JSC_DEFINE_HOST_FUNCTION(MD5Prototype__digestCallback, (JSGlobalObject * lexical JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return MD5Prototype__digest(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return ExpectPrototype__toBe(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(MD5Prototype__updateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeCloseToCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSMD5* thisObject = jsDynamicCast<JSMD5*>(callFrame->thisValue()); + JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -2286,287 +1566,110 @@ JSC_DEFINE_HOST_FUNCTION(MD5Prototype__updateCallback, (JSGlobalObject * lexical JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return MD5Prototype__update(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return ExpectPrototype__toBeCloseTo(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -void JSMD5Prototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) +JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeDefinedCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { - Base::finishCreation(vm); - reifyStaticProperties(vm, JSMD5::info(), JSMD5PrototypeTableValues, *this); - JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); -} - -extern "C" JSC_DECLARE_CUSTOM_GETTER(MD5Class__getByteLengthStatic); -extern "C" JSC_DECLARE_HOST_FUNCTION(MD5Class__hash); + auto& vm = lexicalGlobalObject->vm(); -static const HashTableValue JSMD5ConstructorTableValues[] = { - { "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, MD5Class__getByteLengthStatic, 0 } }, - { "hash"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, MD5Class__hash, 2 } } -}; + JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); -void JSMD5Constructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSMD5Prototype* prototype) -{ - Base::finishCreation(vm, 0, "MD5"_s, PropertyAdditionMode::WithoutStructureTransition); - reifyStaticProperties(vm, &JSMD5Constructor::s_info, JSMD5ConstructorTableValues, *this); - putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly); - ASSERT(inherits(info())); -} + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } -JSMD5Constructor::JSMD5Constructor(JSC::VM& vm, JSC::Structure* structure) - : Base(vm, structure, construct, construct) -{ -} + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); -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; + return ExpectPrototype__toBeDefined(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSMD5Constructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) +JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeFalsyCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { - 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* 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& vm = lexicalGlobalObject->vm(); - void* ptr = MD5Class__construct(globalObject, callFrame); + JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); - if (UNLIKELY(!ptr)) { - return JSValue::encode(JSC::jsUndefined()); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); } - JSMD5* instance = JSMD5::create(vm, globalObject, structure, ptr); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return JSValue::encode(instance); + return ExpectPrototype__toBeFalsy(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -void JSMD5Constructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSMD5Prototype* prototype) +JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeGreaterThanCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { -} - -const ClassInfo JSMD5Constructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSMD5Constructor) }; + auto& vm = lexicalGlobalObject->vm(); -extern "C" EncodedJSValue MD5__getConstructor(Zig::GlobalObject* globalObject) -{ - return JSValue::encode(globalObject->JSMD5Constructor()); -} + JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); -JSMD5::~JSMD5() -{ - if (m_ctx) { - MD5Class__finalize(m_ctx); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); } -} -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) }; + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); -void JSMD5::finishCreation(VM& vm) -{ - Base::finishCreation(vm); - ASSERT(inherits(info())); + return ExpectPrototype__toBeGreaterThan(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSMD5* JSMD5::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) +JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeGreaterThanOrEqualCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { - JSMD5* ptr = new (NotNull, JSC::allocateCell<JSMD5>(vm)) JSMD5(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} + auto& vm = lexicalGlobalObject->vm(); -extern "C" void* MD5__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; + JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); - JSC::JSCell* cell = decodedValue.asCell(); - JSMD5* object = JSC::jsDynamicCast<JSMD5*>(cell); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - if (!object) - return nullptr; + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return object->wrapped(); + return ExpectPrototype__toBeGreaterThanOrEqual(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -extern "C" bool MD5__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) +JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeInstanceOfCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { - JSMD5* object = JSC::jsDynamicCast<JSMD5*>(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; -} + auto& vm = lexicalGlobalObject->vm(); -extern "C" const size_t MD5__ptrOffset = JSMD5::offsetOfWrapped(); + JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); -void JSMD5::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) -{ - auto* thisObject = jsCast<JSMD5*>(cell); - if (void* wrapped = thisObject->wrapped()) { - // if (thisObject->scriptExecutionContext()) - // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); } - Base::analyzeHeap(cell, 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)); -} + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); -JSObject* JSMD5::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) -{ - return JSMD5Prototype::create(vm, globalObject, JSMD5Prototype::createStructure(vm, globalObject, globalObject->objectPrototype())); + return ExpectPrototype__toBeInstanceOf(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -extern "C" EncodedJSValue MD5__create(Zig::GlobalObject* globalObject, void* ptr) +JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeLessThanCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSMD5Structure(); - JSMD5* instance = JSMD5::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} -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 = WTFMove(space); }, - [](auto& spaces) { return spaces.m_subspaceForMD4Constructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForMD4Constructor = WTFMove(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); -}; - -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), NoIntrinsic, { HashTableValue::GetterSetterType, MD4Prototype__byteLengthGetterWrap, 0 } }, - { "digest"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, MD4Prototype__digestCallback, 0 } }, - { "update"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, MD4Prototype__updateCallback, 1 } } -}; - -const ClassInfo JSMD4Prototype::s_info = { "MD4"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSMD4Prototype) }; + auto& vm = lexicalGlobalObject->vm(); -JSC_DEFINE_CUSTOM_GETTER(jsMD4Constructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - auto* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); - auto* prototype = jsDynamicCast<JSMD4Prototype*>(JSValue::decode(thisValue)); + JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); - if (UNLIKELY(!prototype)) + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); 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); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSMD4* thisObject = jsCast<JSMD4*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = MD4Prototype__getByteLength(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); + + return ExpectPrototype__toBeLessThan(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(MD4Prototype__digestCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeLessThanOrEqualCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSMD4* thisObject = jsDynamicCast<JSMD4*>(callFrame->thisValue()); + JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -2575,14 +1678,14 @@ JSC_DEFINE_HOST_FUNCTION(MD4Prototype__digestCallback, (JSGlobalObject * lexical JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return MD4Prototype__digest(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return ExpectPrototype__toBeLessThanOrEqual(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(MD4Prototype__updateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeNaNCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSMD4* thisObject = jsDynamicCast<JSMD4*>(callFrame->thisValue()); + JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -2591,287 +1694,110 @@ JSC_DEFINE_HOST_FUNCTION(MD4Prototype__updateCallback, (JSGlobalObject * lexical JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return MD4Prototype__update(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return ExpectPrototype__toBeNaN(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -void JSMD4Prototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) +JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeNullCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { - Base::finishCreation(vm); - reifyStaticProperties(vm, JSMD4::info(), JSMD4PrototypeTableValues, *this); - JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); -} - -extern "C" JSC_DECLARE_CUSTOM_GETTER(MD4Class__getByteLengthStatic); -extern "C" JSC_DECLARE_HOST_FUNCTION(MD4Class__hash); + auto& vm = lexicalGlobalObject->vm(); -static const HashTableValue JSMD4ConstructorTableValues[] = { - { "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, MD4Class__getByteLengthStatic, 0 } }, - { "hash"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, MD4Class__hash, 2 } } -}; + JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); -void JSMD4Constructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSMD4Prototype* prototype) -{ - Base::finishCreation(vm, 0, "MD4"_s, PropertyAdditionMode::WithoutStructureTransition); - reifyStaticProperties(vm, &JSMD4Constructor::s_info, JSMD4ConstructorTableValues, *this); - putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly); - ASSERT(inherits(info())); -} + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } -JSMD4Constructor::JSMD4Constructor(JSC::VM& vm, JSC::Structure* structure) - : Base(vm, structure, construct, construct) -{ -} + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); -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; + return ExpectPrototype__toBeNull(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSMD4Constructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) +JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeTruthyCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { - 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* 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& vm = lexicalGlobalObject->vm(); - void* ptr = MD4Class__construct(globalObject, callFrame); + JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); - if (UNLIKELY(!ptr)) { - return JSValue::encode(JSC::jsUndefined()); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); } - JSMD4* instance = JSMD4::create(vm, globalObject, structure, ptr); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return JSValue::encode(instance); + return ExpectPrototype__toBeTruthy(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -void JSMD4Constructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSMD4Prototype* prototype) +JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeUndefinedCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { -} - -const ClassInfo JSMD4Constructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSMD4Constructor) }; + auto& vm = lexicalGlobalObject->vm(); -extern "C" EncodedJSValue MD4__getConstructor(Zig::GlobalObject* globalObject) -{ - return JSValue::encode(globalObject->JSMD4Constructor()); -} + JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); -JSMD4::~JSMD4() -{ - if (m_ctx) { - MD4Class__finalize(m_ctx); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); } -} -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) }; + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); -void JSMD4::finishCreation(VM& vm) -{ - Base::finishCreation(vm); - ASSERT(inherits(info())); + return ExpectPrototype__toBeUndefined(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSMD4* JSMD4::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) +JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toContainCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { - JSMD4* ptr = new (NotNull, JSC::allocateCell<JSMD4>(vm)) JSMD4(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} + auto& vm = lexicalGlobalObject->vm(); -extern "C" void* MD4__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; + JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); - JSC::JSCell* cell = decodedValue.asCell(); - JSMD4* object = JSC::jsDynamicCast<JSMD4*>(cell); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - if (!object) - return nullptr; + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return object->wrapped(); + return ExpectPrototype__toContain(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -extern "C" bool MD4__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) +JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toContainEqualCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { - JSMD4* object = JSC::jsDynamicCast<JSMD4*>(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; -} + auto& vm = lexicalGlobalObject->vm(); -extern "C" const size_t MD4__ptrOffset = JSMD4::offsetOfWrapped(); + JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); -void JSMD4::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) -{ - auto* thisObject = jsCast<JSMD4*>(cell); - if (void* wrapped = thisObject->wrapped()) { - // if (thisObject->scriptExecutionContext()) - // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); } - Base::analyzeHeap(cell, 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)); -} + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); -JSObject* JSMD4::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) -{ - return JSMD4Prototype::create(vm, globalObject, JSMD4Prototype::createStructure(vm, globalObject, globalObject->objectPrototype())); + return ExpectPrototype__toContainEqual(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -extern "C" EncodedJSValue MD4__create(Zig::GlobalObject* globalObject, void* ptr) +JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toEqualCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSMD4Structure(); - JSMD4* instance = JSMD4::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; - - 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 = WTFMove(space); }, - [](auto& spaces) { return spaces.m_subspaceForSHA224Constructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForSHA224Constructor = WTFMove(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), NoIntrinsic, { HashTableValue::GetterSetterType, SHA224Prototype__byteLengthGetterWrap, 0 } }, - { "digest"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA224Prototype__digestCallback, 0 } }, - { "update"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA224Prototype__updateCallback, 1 } } -}; - -const ClassInfo JSSHA224Prototype::s_info = { "SHA224"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA224Prototype) }; + auto& vm = lexicalGlobalObject->vm(); -JSC_DEFINE_CUSTOM_GETTER(jsSHA224Constructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - auto* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); - auto* prototype = jsDynamicCast<JSSHA224Prototype*>(JSValue::decode(thisValue)); + JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); - if (UNLIKELY(!prototype)) + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); 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); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSSHA224* thisObject = jsCast<JSSHA224*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = SHA224Prototype__getByteLength(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); + + return ExpectPrototype__toEqual(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(SHA224Prototype__digestCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toHaveBeenCalledTimesCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSSHA224* thisObject = jsDynamicCast<JSSHA224*>(callFrame->thisValue()); + JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -2880,14 +1806,14 @@ JSC_DEFINE_HOST_FUNCTION(SHA224Prototype__digestCallback, (JSGlobalObject * lexi JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return SHA224Prototype__digest(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return ExpectPrototype__toHaveBeenCalledTimes(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(SHA224Prototype__updateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toHaveBeenCalledWithCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSSHA224* thisObject = jsDynamicCast<JSSHA224*>(callFrame->thisValue()); + JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -2896,287 +1822,110 @@ JSC_DEFINE_HOST_FUNCTION(SHA224Prototype__updateCallback, (JSGlobalObject * lexi JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return SHA224Prototype__update(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return ExpectPrototype__toHaveBeenCalledWith(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -void JSSHA224Prototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) +JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toHaveBeenLastCalledWithCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { - Base::finishCreation(vm); - reifyStaticProperties(vm, JSSHA224::info(), JSSHA224PrototypeTableValues, *this); - JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); -} - -extern "C" JSC_DECLARE_CUSTOM_GETTER(SHA224Class__getByteLengthStatic); -extern "C" JSC_DECLARE_HOST_FUNCTION(SHA224Class__hash); + auto& vm = lexicalGlobalObject->vm(); -static const HashTableValue JSSHA224ConstructorTableValues[] = { - { "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, SHA224Class__getByteLengthStatic, 0 } }, - { "hash"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA224Class__hash, 2 } } -}; + JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); -void JSSHA224Constructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSSHA224Prototype* prototype) -{ - Base::finishCreation(vm, 0, "SHA224"_s, PropertyAdditionMode::WithoutStructureTransition); - reifyStaticProperties(vm, &JSSHA224Constructor::s_info, JSSHA224ConstructorTableValues, *this); - putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly); - ASSERT(inherits(info())); -} + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } -JSSHA224Constructor::JSSHA224Constructor(JSC::VM& vm, JSC::Structure* structure) - : Base(vm, structure, construct, construct) -{ -} + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); -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; + return ExpectPrototype__toHaveBeenLastCalledWith(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSSHA224Constructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) +JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toHaveBeenNthCalledWithCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { - 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* 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& vm = lexicalGlobalObject->vm(); - void* ptr = SHA224Class__construct(globalObject, callFrame); + JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); - if (UNLIKELY(!ptr)) { - return JSValue::encode(JSC::jsUndefined()); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); } - JSSHA224* instance = JSSHA224::create(vm, globalObject, structure, ptr); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return JSValue::encode(instance); + return ExpectPrototype__toHaveBeenNthCalledWith(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -void JSSHA224Constructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSSHA224Prototype* prototype) +JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toHaveLastReturnedWithCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { -} - -const ClassInfo JSSHA224Constructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA224Constructor) }; + auto& vm = lexicalGlobalObject->vm(); -extern "C" EncodedJSValue SHA224__getConstructor(Zig::GlobalObject* globalObject) -{ - return JSValue::encode(globalObject->JSSHA224Constructor()); -} + JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); -JSSHA224::~JSSHA224() -{ - if (m_ctx) { - SHA224Class__finalize(m_ctx); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); } -} -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) }; + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); -void JSSHA224::finishCreation(VM& vm) -{ - Base::finishCreation(vm); - ASSERT(inherits(info())); + return ExpectPrototype__toHaveLastReturnedWith(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSSHA224* JSSHA224::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) +JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toHaveLengthCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { - JSSHA224* ptr = new (NotNull, JSC::allocateCell<JSSHA224>(vm)) JSSHA224(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} + auto& vm = lexicalGlobalObject->vm(); -extern "C" void* SHA224__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; + JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); - JSC::JSCell* cell = decodedValue.asCell(); - JSSHA224* object = JSC::jsDynamicCast<JSSHA224*>(cell); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - if (!object) - return nullptr; + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return object->wrapped(); + return ExpectPrototype__toHaveLength(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -extern "C" bool SHA224__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) +JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toHaveNthReturnedWithCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { - JSSHA224* object = JSC::jsDynamicCast<JSSHA224*>(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; -} + auto& vm = lexicalGlobalObject->vm(); -extern "C" const size_t SHA224__ptrOffset = JSSHA224::offsetOfWrapped(); + JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); -void JSSHA224::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) -{ - auto* thisObject = jsCast<JSSHA224*>(cell); - if (void* wrapped = thisObject->wrapped()) { - // if (thisObject->scriptExecutionContext()) - // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); } - Base::analyzeHeap(cell, 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)); -} + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); -JSObject* JSSHA224::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) -{ - return JSSHA224Prototype::create(vm, globalObject, JSSHA224Prototype::createStructure(vm, globalObject, globalObject->objectPrototype())); + return ExpectPrototype__toHaveNthReturnedWith(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -extern "C" EncodedJSValue SHA224__create(Zig::GlobalObject* globalObject, void* ptr) +JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toHavePropertyCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSSHA224Structure(); - JSSHA224* instance = JSSHA224::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); - - 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 = WTFMove(space); }, - [](auto& spaces) { return spaces.m_subspaceForSHA512Constructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForSHA512Constructor = WTFMove(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), NoIntrinsic, { HashTableValue::GetterSetterType, SHA512Prototype__byteLengthGetterWrap, 0 } }, - { "digest"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA512Prototype__digestCallback, 0 } }, - { "update"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA512Prototype__updateCallback, 1 } } -}; - -const ClassInfo JSSHA512Prototype::s_info = { "SHA512"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA512Prototype) }; + auto& vm = lexicalGlobalObject->vm(); -JSC_DEFINE_CUSTOM_GETTER(jsSHA512Constructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - auto* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); - auto* prototype = jsDynamicCast<JSSHA512Prototype*>(JSValue::decode(thisValue)); + JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); - if (UNLIKELY(!prototype)) + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); 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); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSSHA512* thisObject = jsCast<JSSHA512*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = SHA512Prototype__getByteLength(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); + + return ExpectPrototype__toHaveProperty(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(SHA512Prototype__digestCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toHaveReturnedTimesCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSSHA512* thisObject = jsDynamicCast<JSSHA512*>(callFrame->thisValue()); + JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -3185,14 +1934,14 @@ JSC_DEFINE_HOST_FUNCTION(SHA512Prototype__digestCallback, (JSGlobalObject * lexi JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return SHA512Prototype__digest(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return ExpectPrototype__toHaveReturnedTimes(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(SHA512Prototype__updateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toHaveReturnedWithCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSSHA512* thisObject = jsDynamicCast<JSSHA512*>(callFrame->thisValue()); + JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -3201,287 +1950,110 @@ JSC_DEFINE_HOST_FUNCTION(SHA512Prototype__updateCallback, (JSGlobalObject * lexi JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return SHA512Prototype__update(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return ExpectPrototype__toHaveReturnedWith(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -void JSSHA512Prototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) +JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toMatchCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { - Base::finishCreation(vm); - reifyStaticProperties(vm, JSSHA512::info(), JSSHA512PrototypeTableValues, *this); - JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); -} - -extern "C" JSC_DECLARE_CUSTOM_GETTER(SHA512Class__getByteLengthStatic); -extern "C" JSC_DECLARE_HOST_FUNCTION(SHA512Class__hash); + auto& vm = lexicalGlobalObject->vm(); -static const HashTableValue JSSHA512ConstructorTableValues[] = { - { "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, SHA512Class__getByteLengthStatic, 0 } }, - { "hash"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA512Class__hash, 2 } } -}; + JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); -void JSSHA512Constructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSSHA512Prototype* prototype) -{ - Base::finishCreation(vm, 0, "SHA512"_s, PropertyAdditionMode::WithoutStructureTransition); - reifyStaticProperties(vm, &JSSHA512Constructor::s_info, JSSHA512ConstructorTableValues, *this); - putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly); - ASSERT(inherits(info())); -} + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } -JSSHA512Constructor::JSSHA512Constructor(JSC::VM& vm, JSC::Structure* structure) - : Base(vm, structure, construct, construct) -{ -} + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); -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; + return ExpectPrototype__toMatch(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSSHA512Constructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) +JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toMatchInlineSnapshotCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { - 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* 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& vm = lexicalGlobalObject->vm(); - void* ptr = SHA512Class__construct(globalObject, callFrame); + JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); - if (UNLIKELY(!ptr)) { - return JSValue::encode(JSC::jsUndefined()); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); } - JSSHA512* instance = JSSHA512::create(vm, globalObject, structure, ptr); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return JSValue::encode(instance); + return ExpectPrototype__toMatchInlineSnapshot(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -void JSSHA512Constructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSSHA512Prototype* prototype) +JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toMatchObjectCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { -} - -const ClassInfo JSSHA512Constructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA512Constructor) }; + auto& vm = lexicalGlobalObject->vm(); -extern "C" EncodedJSValue SHA512__getConstructor(Zig::GlobalObject* globalObject) -{ - return JSValue::encode(globalObject->JSSHA512Constructor()); -} + JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); -JSSHA512::~JSSHA512() -{ - if (m_ctx) { - SHA512Class__finalize(m_ctx); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); } -} -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) }; + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); -void JSSHA512::finishCreation(VM& vm) -{ - Base::finishCreation(vm); - ASSERT(inherits(info())); + return ExpectPrototype__toMatchObject(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSSHA512* JSSHA512::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) +JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toMatchSnapshotCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { - JSSHA512* ptr = new (NotNull, JSC::allocateCell<JSSHA512>(vm)) JSSHA512(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; -} + auto& vm = lexicalGlobalObject->vm(); -extern "C" void* SHA512__fromJS(JSC::EncodedJSValue value) -{ - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; + JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); - JSC::JSCell* cell = decodedValue.asCell(); - JSSHA512* object = JSC::jsDynamicCast<JSSHA512*>(cell); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - if (!object) - return nullptr; + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return object->wrapped(); + return ExpectPrototype__toMatchSnapshot(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -extern "C" bool SHA512__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) +JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toStrictEqualCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { - JSSHA512* object = JSC::jsDynamicCast<JSSHA512*>(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; -} + auto& vm = lexicalGlobalObject->vm(); -extern "C" const size_t SHA512__ptrOffset = JSSHA512::offsetOfWrapped(); + JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); -void JSSHA512::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) -{ - auto* thisObject = jsCast<JSSHA512*>(cell); - if (void* wrapped = thisObject->wrapped()) { - // if (thisObject->scriptExecutionContext()) - // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); } - Base::analyzeHeap(cell, 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)); -} + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); -JSObject* JSSHA512::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) -{ - return JSSHA512Prototype::create(vm, globalObject, JSSHA512Prototype::createStructure(vm, globalObject, globalObject->objectPrototype())); + return ExpectPrototype__toStrictEqual(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -extern "C" EncodedJSValue SHA512__create(Zig::GlobalObject* globalObject, void* ptr) +JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toThrowCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSSHA512Structure(); - JSSHA512* instance = JSSHA512::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 = WTFMove(space); }, - [](auto& spaces) { return spaces.m_subspaceForSHA384Constructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForSHA384Constructor = WTFMove(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); -}; - -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), NoIntrinsic, { HashTableValue::GetterSetterType, SHA384Prototype__byteLengthGetterWrap, 0 } }, - { "digest"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA384Prototype__digestCallback, 0 } }, - { "update"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA384Prototype__updateCallback, 1 } } -}; - -const ClassInfo JSSHA384Prototype::s_info = { "SHA384"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA384Prototype) }; + auto& vm = lexicalGlobalObject->vm(); -JSC_DEFINE_CUSTOM_GETTER(jsSHA384Constructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - auto* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); - auto* prototype = jsDynamicCast<JSSHA384Prototype*>(JSValue::decode(thisValue)); + JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); - if (UNLIKELY(!prototype)) + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); 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); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSSHA384* thisObject = jsCast<JSSHA384*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = SHA384Prototype__getByteLength(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); + + return ExpectPrototype__toThrow(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(SHA384Prototype__digestCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toThrowErrorMatchingInlineSnapshotCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSSHA384* thisObject = jsDynamicCast<JSSHA384*>(callFrame->thisValue()); + JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -3490,14 +2062,14 @@ JSC_DEFINE_HOST_FUNCTION(SHA384Prototype__digestCallback, (JSGlobalObject * lexi JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return SHA384Prototype__digest(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return ExpectPrototype__toThrowErrorMatchingInlineSnapshot(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(SHA384Prototype__updateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toThrowErrorMatchingSnapshotCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSSHA384* thisObject = jsDynamicCast<JSSHA384*>(callFrame->thisValue()); + JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -3506,51 +2078,99 @@ JSC_DEFINE_HOST_FUNCTION(SHA384Prototype__updateCallback, (JSGlobalObject * lexi JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return SHA384Prototype__update(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return ExpectPrototype__toThrowErrorMatchingSnapshot(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -void JSSHA384Prototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) +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) +{ + auto* thisObject = jsCast<JSExpect*>(JSValue::decode(thisValue)); + return JSValue::encode(thisObject->m_resultValue.get()); +} + +void JSExpectPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) { Base::finishCreation(vm); - reifyStaticProperties(vm, JSSHA384::info(), JSSHA384PrototypeTableValues, *this); + reifyStaticProperties(vm, JSExpect::info(), JSExpectPrototypeTableValues, *this); JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); } -extern "C" JSC_DECLARE_CUSTOM_GETTER(SHA384Class__getByteLengthStatic); -extern "C" JSC_DECLARE_HOST_FUNCTION(SHA384Class__hash); +extern "C" JSC_DECLARE_HOST_FUNCTION(ExpectClass__addSnapshotSerializer); +extern "C" JSC_DECLARE_HOST_FUNCTION(ExpectClass__any); +extern "C" JSC_DECLARE_HOST_FUNCTION(ExpectClass__anything); +extern "C" JSC_DECLARE_HOST_FUNCTION(ExpectClass__arrayContaining); +extern "C" JSC_DECLARE_HOST_FUNCTION(ExpectClass__assertions); +extern "C" JSC_DECLARE_HOST_FUNCTION(ExpectClass__extend); +extern "C" JSC_DECLARE_HOST_FUNCTION(ExpectClass__hasAssertions); +extern "C" JSC_DECLARE_CUSTOM_GETTER(ExpectClass__getStaticNot); +extern "C" JSC_DECLARE_HOST_FUNCTION(ExpectClass__objectContaining); +extern "C" JSC_DECLARE_CUSTOM_GETTER(ExpectClass__getStaticRejects); +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 JSSHA384ConstructorTableValues[] = { - { "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, SHA384Class__getByteLengthStatic, 0 } }, - { "hash"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA384Class__hash, 2 } } +static const HashTableValue JSExpectConstructorTableValues[] = { + { "addSnapshotSerializer"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectClass__addSnapshotSerializer, 1 } }, + { "any"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectClass__any, 1 } }, + { "anything"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectClass__anything, 1 } }, + { "arrayContaining"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectClass__arrayContaining, 1 } }, + { "assertions"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectClass__assertions, 1 } }, + { "extend"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectClass__extend, 1 } }, + { "hasAssertions"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectClass__hasAssertions, 1 } }, + { "not"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, ExpectClass__getStaticNot, 0 } }, + { "objectContaining"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectClass__objectContaining, 1 } }, + { "rejects"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, ExpectClass__getStaticRejects, 0 } }, + { "resolves"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, ExpectClass__getStaticResolves, 0 } }, + { "stringContaining"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectClass__stringContaining, 1 } }, + { "stringMatching"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectClass__stringMatching, 1 } } }; -void JSSHA384Constructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSSHA384Prototype* prototype) +void JSExpectConstructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSExpectPrototype* prototype) { - Base::finishCreation(vm, 0, "SHA384"_s, PropertyAdditionMode::WithoutStructureTransition); - reifyStaticProperties(vm, &JSSHA384Constructor::s_info, JSSHA384ConstructorTableValues, *this); + Base::finishCreation(vm, 0, "Expect"_s, PropertyAdditionMode::WithoutStructureTransition); + reifyStaticProperties(vm, &JSExpectConstructor::s_info, JSExpectConstructorTableValues, *this); putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly); ASSERT(inherits(info())); } -JSSHA384Constructor::JSSHA384Constructor(JSC::VM& vm, JSC::Structure* structure) - : Base(vm, structure, construct, construct) +JSExpectConstructor::JSExpectConstructor(JSC::VM& vm, JSC::Structure* structure) + : Base(vm, structure, ExpectClass__call, construct) { } -JSSHA384Constructor* JSSHA384Constructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSSHA384Prototype* prototype) +JSExpectConstructor* JSExpectConstructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSExpectPrototype* prototype) { - JSSHA384Constructor* ptr = new (NotNull, JSC::allocateCell<JSSHA384Constructor>(vm)) JSSHA384Constructor(vm, structure); + JSExpectConstructor* ptr = new (NotNull, JSC::allocateCell<JSExpectConstructor>(vm)) JSExpectConstructor(vm, structure); ptr->finishCreation(vm, globalObject, prototype); return ptr; } -JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSSHA384Constructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) +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(); JSObject* newTarget = asObject(callFrame->newTarget()); - auto* constructor = globalObject->JSSHA384Constructor(); - Structure* structure = globalObject->JSSHA384Structure(); + auto* constructor = globalObject->JSExpectConstructor(); + Structure* structure = globalObject->JSExpectStructure(); if (constructor != newTarget) { auto scope = DECLARE_THROW_SCOPE(vm); @@ -3561,65 +2181,65 @@ JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSSHA384Constructor::construct(JSC: structure = InternalFunction::createSubclassStructure( globalObject, newTarget, - functionGlobalObject->JSSHA384Structure()); + functionGlobalObject->JSExpectStructure()); } - void* ptr = SHA384Class__construct(globalObject, callFrame); + void* ptr = ExpectClass__construct(globalObject, callFrame); if (UNLIKELY(!ptr)) { return JSValue::encode(JSC::jsUndefined()); } - JSSHA384* instance = JSSHA384::create(vm, globalObject, structure, ptr); + JSExpect* instance = JSExpect::create(vm, globalObject, structure, ptr); return JSValue::encode(instance); } -void JSSHA384Constructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSSHA384Prototype* prototype) +void JSExpectConstructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSExpectPrototype* prototype) { } -const ClassInfo JSSHA384Constructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA384Constructor) }; +const ClassInfo JSExpectConstructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSExpectConstructor) }; -extern "C" EncodedJSValue SHA384__getConstructor(Zig::GlobalObject* globalObject) +extern "C" EncodedJSValue Expect__getConstructor(Zig::GlobalObject* globalObject) { - return JSValue::encode(globalObject->JSSHA384Constructor()); + return JSValue::encode(globalObject->JSExpectConstructor()); } -JSSHA384::~JSSHA384() +JSExpect::~JSExpect() { if (m_ctx) { - SHA384Class__finalize(m_ctx); + ExpectClass__finalize(m_ctx); } } -void JSSHA384::destroy(JSCell* cell) +void JSExpect::destroy(JSCell* cell) { - static_cast<JSSHA384*>(cell)->JSSHA384::~JSSHA384(); + static_cast<JSExpect*>(cell)->JSExpect::~JSExpect(); } -const ClassInfo JSSHA384::s_info = { "SHA384"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA384) }; +const ClassInfo JSExpect::s_info = { "Expect"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSExpect) }; -void JSSHA384::finishCreation(VM& vm) +void JSExpect::finishCreation(VM& vm) { Base::finishCreation(vm); ASSERT(inherits(info())); } -JSSHA384* JSSHA384::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) +JSExpect* JSExpect::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) { - JSSHA384* ptr = new (NotNull, JSC::allocateCell<JSSHA384>(vm)) JSSHA384(vm, structure, ctx); + JSExpect* ptr = new (NotNull, JSC::allocateCell<JSExpect>(vm)) JSExpect(vm, structure, ctx); ptr->finishCreation(vm); return ptr; } -extern "C" void* SHA384__fromJS(JSC::EncodedJSValue value) +extern "C" void* Expect__fromJS(JSC::EncodedJSValue value) { JSC::JSValue decodedValue = JSC::JSValue::decode(value); if (decodedValue.isEmpty() || !decodedValue.isCell()) return nullptr; JSC::JSCell* cell = decodedValue.asCell(); - JSSHA384* object = JSC::jsDynamicCast<JSSHA384*>(cell); + JSExpect* object = JSC::jsDynamicCast<JSExpect*>(cell); if (!object) return nullptr; @@ -3627,9 +2247,9 @@ extern "C" void* SHA384__fromJS(JSC::EncodedJSValue value) return object->wrapped(); } -extern "C" bool SHA384__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) +extern "C" bool Expect__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) { - JSSHA384* object = JSC::jsDynamicCast<JSSHA384*>(JSValue::decode(value)); + JSExpect* object = JSC::jsDynamicCast<JSExpect*>(JSValue::decode(value)); if (!object) return false; @@ -3637,11 +2257,11 @@ extern "C" bool SHA384__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) return true; } -extern "C" const size_t SHA384__ptrOffset = JSSHA384::offsetOfWrapped(); +extern "C" const size_t Expect__ptrOffset = JSExpect::offsetOfWrapped(); -void JSSHA384::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) +void JSExpect::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) { - auto* thisObject = jsCast<JSSHA384*>(cell); + auto* thisObject = jsCast<JSExpect*>(cell); if (void* wrapped = thisObject->wrapped()) { // if (thisObject->scriptExecutionContext()) // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); @@ -3649,31 +2269,66 @@ void JSSHA384::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) Base::analyzeHeap(cell, analyzer); } -JSObject* JSSHA384::createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype) +JSObject* JSExpect::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::JSExpectConstructor::create(vm, globalObject, WebCore::JSExpectConstructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast<WebCore::JSExpectPrototype*>(prototype)); } -JSObject* JSSHA384::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) +JSObject* JSExpect::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) { - return JSSHA384Prototype::create(vm, globalObject, JSSHA384Prototype::createStructure(vm, globalObject, globalObject->objectPrototype())); + return JSExpectPrototype::create(vm, globalObject, JSExpectPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); } -extern "C" EncodedJSValue SHA384__create(Zig::GlobalObject* globalObject, void* ptr) +extern "C" EncodedJSValue Expect__create(Zig::GlobalObject* globalObject, void* ptr) { auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSSHA384Structure(); - JSSHA384* instance = JSSHA384::create(vm, globalObject, structure, ptr); + JSC::Structure* structure = globalObject->JSExpectStructure(); + JSExpect* instance = JSExpect::create(vm, globalObject, structure, ptr); return JSValue::encode(instance); } -class JSSHA256Prototype final : public JSC::JSNonFinalObject { + +template<typename Visitor> +void JSExpect::visitChildrenImpl(JSCell* cell, Visitor& visitor) +{ + JSExpect* thisObject = jsCast<JSExpect*>(cell); + ASSERT_GC_OBJECT_INHERITS(thisObject, info()); + Base::visitChildren(thisObject, visitor); + visitor.append(thisObject->m_capturedValue); + visitor.append(thisObject->m_resultValue); +} + +DEFINE_VISIT_CHILDREN(JSExpect); + +template<typename Visitor> +void JSExpect::visitAdditionalChildren(Visitor& visitor) +{ + JSExpect* thisObject = this; + ASSERT_GC_OBJECT_INHERITS(thisObject, info()); + visitor.append(thisObject->m_capturedValue); + visitor.append(thisObject->m_resultValue); + + ; +} + +DEFINE_VISIT_ADDITIONAL_CHILDREN(JSExpect); + +template<typename Visitor> +void JSExpect::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) +{ + JSExpect* thisObject = jsCast<JSExpect*>(cell); + ASSERT_GC_OBJECT_INHERITS(thisObject, info()); + thisObject->visitAdditionalChildren<Visitor>(visitor); +} + +DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSExpect); +class JSFileSystemRouterPrototype final : public JSC::JSNonFinalObject { public: using Base = JSC::JSNonFinalObject; - static JSSHA256Prototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) + static JSFileSystemRouterPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) { - JSSHA256Prototype* ptr = new (NotNull, JSC::allocateCell<JSSHA256Prototype>(vm)) JSSHA256Prototype(vm, globalObject, structure); + JSFileSystemRouterPrototype* ptr = new (NotNull, JSC::allocateCell<JSFileSystemRouterPrototype>(vm)) JSFileSystemRouterPrototype(vm, globalObject, structure); ptr->finishCreation(vm, globalObject); return ptr; } @@ -3690,7 +2345,7 @@ public: } private: - JSSHA256Prototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) + JSFileSystemRouterPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) : Base(vm, structure) { } @@ -3698,10 +2353,10 @@ private: void finishCreation(JSC::VM&, JSC::JSGlobalObject*); }; -class JSSHA256Constructor final : public JSC::InternalFunction { +class JSFileSystemRouterConstructor final : public JSC::InternalFunction { public: using Base = JSC::InternalFunction; - static JSSHA256Constructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSSHA256Prototype* prototype); + 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; @@ -3715,15 +2370,15 @@ public: { if constexpr (mode == JSC::SubspaceAccess::Concurrently) return nullptr; - return WebCore::subspaceForImpl<JSSHA256Constructor, WebCore::UseCustomHeapCellType::No>( + return WebCore::subspaceForImpl<JSFileSystemRouterConstructor, WebCore::UseCustomHeapCellType::No>( vm, - [](auto& spaces) { return spaces.m_clientSubspaceForSHA256Constructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForSHA256Constructor = WTFMove(space); }, - [](auto& spaces) { return spaces.m_subspaceForSHA256Constructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForSHA256Constructor = WTFMove(space); }); + [](auto& spaces) { return spaces.m_clientSubspaceForFileSystemRouterConstructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForFileSystemRouterConstructor = WTFMove(space); }, + [](auto& spaces) { return spaces.m_subspaceForFileSystemRouterConstructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForFileSystemRouterConstructor = WTFMove(space); }); } - void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSSHA256Prototype* 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*); @@ -3731,62 +2386,58 @@ public: DECLARE_EXPORT_INFO; private: - JSSHA256Constructor(JSC::VM& vm, JSC::Structure* structure); - void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSSHA256Prototype* prototype); + JSFileSystemRouterConstructor(JSC::VM& vm, JSC::Structure* structure); + void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSFileSystemRouterPrototype* prototype); }; -extern "C" void* SHA256Class__construct(JSC::JSGlobalObject*, JSC::CallFrame*); -JSC_DECLARE_CUSTOM_GETTER(jsSHA256Constructor); -extern "C" void SHA256Class__finalize(void*); +extern "C" void* FileSystemRouterClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); +JSC_DECLARE_CUSTOM_GETTER(jsFileSystemRouterConstructor); +extern "C" void FileSystemRouterClass__finalize(void*); -extern "C" JSC::EncodedJSValue SHA256Prototype__getByteLength(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(SHA256Prototype__byteLengthGetterWrap); +extern "C" EncodedJSValue FileSystemRouterPrototype__match(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(FileSystemRouterPrototype__matchCallback); -extern "C" EncodedJSValue SHA256Prototype__digest(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(SHA256Prototype__digestCallback); +extern "C" JSC::EncodedJSValue FileSystemRouterPrototype__getOrigin(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); +JSC_DECLARE_CUSTOM_GETTER(FileSystemRouterPrototype__originGetterWrap); -extern "C" EncodedJSValue SHA256Prototype__update(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(SHA256Prototype__updateCallback); +extern "C" EncodedJSValue FileSystemRouterPrototype__reload(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(FileSystemRouterPrototype__reloadCallback); -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSSHA256Prototype, JSSHA256Prototype::Base); +extern "C" JSC::EncodedJSValue FileSystemRouterPrototype__getRoutes(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); +JSC_DECLARE_CUSTOM_GETTER(FileSystemRouterPrototype__routesGetterWrap); -static const HashTableValue JSSHA256PrototypeTableValues[] = { - { "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, SHA256Prototype__byteLengthGetterWrap, 0 } }, - { "digest"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA256Prototype__digestCallback, 0 } }, - { "update"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA256Prototype__updateCallback, 1 } } +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), NoIntrinsic, { HashTableValue::NativeFunctionType, FileSystemRouterPrototype__matchCallback, 1 } }, + { "origin"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, FileSystemRouterPrototype__originGetterWrap, 0 } }, + { "reload"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, FileSystemRouterPrototype__reloadCallback, 0 } }, + { "routes"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, FileSystemRouterPrototype__routesGetterWrap, 0 } }, + { "style"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, FileSystemRouterPrototype__styleGetterWrap, 0 } } }; -const ClassInfo JSSHA256Prototype::s_info = { "SHA256"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA256Prototype) }; +const ClassInfo JSFileSystemRouterPrototype::s_info = { "FileSystemRouter"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSFileSystemRouterPrototype) }; -JSC_DEFINE_CUSTOM_GETTER(jsSHA256Constructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) +JSC_DEFINE_CUSTOM_GETTER(jsFileSystemRouterConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); auto* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); - auto* prototype = jsDynamicCast<JSSHA256Prototype*>(JSValue::decode(thisValue)); + auto* prototype = jsDynamicCast<JSFileSystemRouterPrototype*>(JSValue::decode(thisValue)); 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); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSSHA256* thisObject = jsCast<JSSHA256*>(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = SHA256Prototype__getByteLength(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); + return JSValue::encode(globalObject->JSFileSystemRouterConstructor()); } -JSC_DEFINE_HOST_FUNCTION(SHA256Prototype__digestCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(FileSystemRouterPrototype__matchCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSSHA256* thisObject = jsDynamicCast<JSSHA256*>(callFrame->thisValue()); + JSFileSystemRouter* thisObject = jsDynamicCast<JSFileSystemRouter*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -3795,372 +2446,152 @@ JSC_DEFINE_HOST_FUNCTION(SHA256Prototype__digestCallback, (JSGlobalObject * lexi JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return SHA256Prototype__digest(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return FileSystemRouterPrototype__match(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(SHA256Prototype__updateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_CUSTOM_GETTER(FileSystemRouterPrototype__originGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - - JSSHA256* thisObject = jsDynamicCast<JSSHA256*>(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } - + 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); - return SHA256Prototype__update(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -void JSSHA256Prototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) -{ - Base::finishCreation(vm); - reifyStaticProperties(vm, JSSHA256::info(), JSSHA256PrototypeTableValues, *this); - JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); -} - -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), NoIntrinsic, { HashTableValue::GetterSetterType, SHA256Class__getByteLengthStatic, 0 } }, - { "hash"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA256Class__hash, 2 } } -}; - -void JSSHA256Constructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSSHA256Prototype* prototype) -{ - Base::finishCreation(vm, 0, "SHA256"_s, PropertyAdditionMode::WithoutStructureTransition); - reifyStaticProperties(vm, &JSSHA256Constructor::s_info, JSSHA256ConstructorTableValues, *this); - putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly); - ASSERT(inherits(info())); -} + if (JSValue cachedValue = thisObject->m_origin.get()) + return JSValue::encode(cachedValue); -JSSHA256Constructor::JSSHA256Constructor(JSC::VM& vm, JSC::Structure* structure) - : Base(vm, structure, construct, construct) -{ + JSC::JSValue result = JSC::JSValue::decode( + FileSystemRouterPrototype__getOrigin(thisObject->wrapped(), globalObject)); + RETURN_IF_EXCEPTION(throwScope, {}); + thisObject->m_origin.set(vm, thisObject, result); + RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); } -JSSHA256Constructor* JSSHA256Constructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSSHA256Prototype* prototype) +extern "C" void FileSystemRouterPrototype__originSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) { - JSSHA256Constructor* ptr = new (NotNull, JSC::allocateCell<JSSHA256Constructor>(vm)) JSSHA256Constructor(vm, structure); - ptr->finishCreation(vm, globalObject, prototype); - return ptr; + auto& vm = globalObject->vm(); + auto* thisObject = jsCast<JSFileSystemRouter*>(JSValue::decode(thisValue)); + thisObject->m_origin.set(vm, thisObject, JSValue::decode(value)); } -JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSSHA256Constructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) +extern "C" EncodedJSValue FileSystemRouterPrototype__originGetCachedValue(JSC::EncodedJSValue thisValue) { - 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* 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()); - } - - JSSHA256* instance = JSSHA256::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); + auto* thisObject = jsCast<JSFileSystemRouter*>(JSValue::decode(thisValue)); + return JSValue::encode(thisObject->m_origin.get()); } -void JSSHA256Constructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSSHA256Prototype* prototype) +JSC_DEFINE_HOST_FUNCTION(FileSystemRouterPrototype__reloadCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { -} - -const ClassInfo JSSHA256Constructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA256Constructor) }; + auto& vm = lexicalGlobalObject->vm(); -extern "C" EncodedJSValue SHA256__getConstructor(Zig::GlobalObject* globalObject) -{ - return JSValue::encode(globalObject->JSSHA256Constructor()); -} + JSFileSystemRouter* thisObject = jsDynamicCast<JSFileSystemRouter*>(callFrame->thisValue()); -JSSHA256::~JSSHA256() -{ - if (m_ctx) { - SHA256Class__finalize(m_ctx); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); } -} -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) -{ - Base::finishCreation(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; - - JSC::JSCell* cell = decodedValue.asCell(); - JSSHA256* object = JSC::jsDynamicCast<JSSHA256*>(cell); - - 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; + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - object->m_ctx = ptr; - return true; + return FileSystemRouterPrototype__reload(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -extern "C" const size_t SHA256__ptrOffset = JSSHA256::offsetOfWrapped(); - -void JSSHA256::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) +JSC_DEFINE_CUSTOM_GETTER(FileSystemRouterPrototype__routesGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { - auto* thisObject = jsCast<JSSHA256*>(cell); - if (void* wrapped = thisObject->wrapped()) { - // if (thisObject->scriptExecutionContext()) - // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); - } - Base::analyzeHeap(cell, analyzer); -} + auto& vm = lexicalGlobalObject->vm(); + 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); -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)); -} + if (JSValue cachedValue = thisObject->m_routes.get()) + return JSValue::encode(cachedValue); -JSObject* JSSHA256::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) -{ - return JSSHA256Prototype::create(vm, globalObject, JSSHA256Prototype::createStructure(vm, globalObject, globalObject->objectPrototype())); + JSC::JSValue result = JSC::JSValue::decode( + 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" EncodedJSValue SHA256__create(Zig::GlobalObject* globalObject, void* ptr) +extern "C" void FileSystemRouterPrototype__routesSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) { auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSSHA256Structure(); - JSSHA256* instance = JSSHA256::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); + auto* thisObject = jsCast<JSFileSystemRouter*>(JSValue::decode(thisValue)); + thisObject->m_routes.set(vm, thisObject, JSValue::decode(value)); } -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 = WTFMove(space); }, - [](auto& spaces) { return spaces.m_subspaceForSHA512_256Constructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForSHA512_256Constructor = WTFMove(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); -}; - -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), NoIntrinsic, { HashTableValue::GetterSetterType, SHA512_256Prototype__byteLengthGetterWrap, 0 } }, - { "digest"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA512_256Prototype__digestCallback, 0 } }, - { "update"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), 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)) +extern "C" EncodedJSValue FileSystemRouterPrototype__routesGetCachedValue(JSC::EncodedJSValue thisValue) { - VM& vm = JSC::getVM(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - auto* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); - auto* prototype = jsDynamicCast<JSSHA512_256Prototype*>(JSValue::decode(thisValue)); - - if (UNLIKELY(!prototype)) - return throwVMTypeError(lexicalGlobalObject, throwScope); - return JSValue::encode(globalObject->JSSHA512_256Constructor()); + auto* thisObject = jsCast<JSFileSystemRouter*>(JSValue::decode(thisValue)); + return JSValue::encode(thisObject->m_routes.get()); } -JSC_DEFINE_CUSTOM_GETTER(SHA512_256Prototype__byteLengthGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(FileSystemRouterPrototype__styleGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); - JSSHA512_256* thisObject = jsCast<JSSHA512_256*>(JSValue::decode(thisValue)); + JSFileSystemRouter* thisObject = jsCast<JSFileSystemRouter*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = SHA512_256Prototype__getByteLength(thisObject->wrapped(), globalObject); + + if (JSValue cachedValue = thisObject->m_style.get()) + return JSValue::encode(cachedValue); + + JSC::JSValue result = JSC::JSValue::decode( + FileSystemRouterPrototype__getStyle(thisObject->wrapped(), globalObject)); RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); + thisObject->m_style.set(vm, thisObject, result); + RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); } -JSC_DEFINE_HOST_FUNCTION(SHA512_256Prototype__digestCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +extern "C" void FileSystemRouterPrototype__styleSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) { - auto& vm = lexicalGlobalObject->vm(); - - JSSHA512_256* thisObject = jsDynamicCast<JSSHA512_256*>(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - return SHA512_256Prototype__digest(thisObject->wrapped(), lexicalGlobalObject, callFrame); + auto& vm = globalObject->vm(); + auto* thisObject = jsCast<JSFileSystemRouter*>(JSValue::decode(thisValue)); + thisObject->m_style.set(vm, thisObject, JSValue::decode(value)); } -JSC_DEFINE_HOST_FUNCTION(SHA512_256Prototype__updateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +extern "C" EncodedJSValue FileSystemRouterPrototype__styleGetCachedValue(JSC::EncodedJSValue thisValue) { - auto& vm = lexicalGlobalObject->vm(); - - JSSHA512_256* thisObject = jsDynamicCast<JSSHA512_256*>(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - return SHA512_256Prototype__update(thisObject->wrapped(), lexicalGlobalObject, callFrame); + auto* thisObject = jsCast<JSFileSystemRouter*>(JSValue::decode(thisValue)); + return JSValue::encode(thisObject->m_style.get()); } -void JSSHA512_256Prototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) +void JSFileSystemRouterPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) { Base::finishCreation(vm); - reifyStaticProperties(vm, JSSHA512_256::info(), JSSHA512_256PrototypeTableValues, *this); + reifyStaticProperties(vm, JSFileSystemRouter::info(), JSFileSystemRouterPrototypeTableValues, *this); JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); } -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), NoIntrinsic, { HashTableValue::GetterSetterType, SHA512_256Class__getByteLengthStatic, 0 } }, - { "hash"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA512_256Class__hash, 2 } } -}; - -void JSSHA512_256Constructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSSHA512_256Prototype* prototype) +void JSFileSystemRouterConstructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSFileSystemRouterPrototype* prototype) { - Base::finishCreation(vm, 0, "SHA512_256"_s, PropertyAdditionMode::WithoutStructureTransition); - reifyStaticProperties(vm, &JSSHA512_256Constructor::s_info, JSSHA512_256ConstructorTableValues, *this); + Base::finishCreation(vm, 0, "FileSystemRouter"_s, PropertyAdditionMode::WithoutStructureTransition); + putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly); ASSERT(inherits(info())); } -JSSHA512_256Constructor::JSSHA512_256Constructor(JSC::VM& vm, JSC::Structure* structure) +JSFileSystemRouterConstructor::JSFileSystemRouterConstructor(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) +JSFileSystemRouterConstructor* JSFileSystemRouterConstructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSFileSystemRouterPrototype* prototype) { - JSSHA512_256Constructor* ptr = new (NotNull, JSC::allocateCell<JSSHA512_256Constructor>(vm)) JSSHA512_256Constructor(vm, structure); + JSFileSystemRouterConstructor* ptr = new (NotNull, JSC::allocateCell<JSFileSystemRouterConstructor>(vm)) JSFileSystemRouterConstructor(vm, structure); ptr->finishCreation(vm, globalObject, prototype); return ptr; } -JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSSHA512_256Constructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) +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(); JSObject* newTarget = asObject(callFrame->newTarget()); - auto* constructor = globalObject->JSSHA512_256Constructor(); - Structure* structure = globalObject->JSSHA512_256Structure(); + auto* constructor = globalObject->JSFileSystemRouterConstructor(); + Structure* structure = globalObject->JSFileSystemRouterStructure(); if (constructor != newTarget) { auto scope = DECLARE_THROW_SCOPE(vm); @@ -4171,65 +2602,65 @@ JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSSHA512_256Constructor::construct( structure = InternalFunction::createSubclassStructure( globalObject, newTarget, - functionGlobalObject->JSSHA512_256Structure()); + functionGlobalObject->JSFileSystemRouterStructure()); } - void* ptr = SHA512_256Class__construct(globalObject, callFrame); + void* ptr = FileSystemRouterClass__construct(globalObject, callFrame); if (UNLIKELY(!ptr)) { return JSValue::encode(JSC::jsUndefined()); } - JSSHA512_256* instance = JSSHA512_256::create(vm, globalObject, structure, ptr); + JSFileSystemRouter* instance = JSFileSystemRouter::create(vm, globalObject, structure, ptr); return JSValue::encode(instance); } -void JSSHA512_256Constructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSSHA512_256Prototype* prototype) +void JSFileSystemRouterConstructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSFileSystemRouterPrototype* prototype) { } -const ClassInfo JSSHA512_256Constructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA512_256Constructor) }; +const ClassInfo JSFileSystemRouterConstructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSFileSystemRouterConstructor) }; -extern "C" EncodedJSValue SHA512_256__getConstructor(Zig::GlobalObject* globalObject) +extern "C" EncodedJSValue FileSystemRouter__getConstructor(Zig::GlobalObject* globalObject) { - return JSValue::encode(globalObject->JSSHA512_256Constructor()); + return JSValue::encode(globalObject->JSFileSystemRouterConstructor()); } -JSSHA512_256::~JSSHA512_256() +JSFileSystemRouter::~JSFileSystemRouter() { if (m_ctx) { - SHA512_256Class__finalize(m_ctx); + FileSystemRouterClass__finalize(m_ctx); } } -void JSSHA512_256::destroy(JSCell* cell) +void JSFileSystemRouter::destroy(JSCell* cell) { - static_cast<JSSHA512_256*>(cell)->JSSHA512_256::~JSSHA512_256(); + static_cast<JSFileSystemRouter*>(cell)->JSFileSystemRouter::~JSFileSystemRouter(); } -const ClassInfo JSSHA512_256::s_info = { "SHA512_256"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA512_256) }; +const ClassInfo JSFileSystemRouter::s_info = { "FileSystemRouter"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSFileSystemRouter) }; -void JSSHA512_256::finishCreation(VM& vm) +void JSFileSystemRouter::finishCreation(VM& vm) { Base::finishCreation(vm); ASSERT(inherits(info())); } -JSSHA512_256* JSSHA512_256::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) +JSFileSystemRouter* JSFileSystemRouter::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); + JSFileSystemRouter* ptr = new (NotNull, JSC::allocateCell<JSFileSystemRouter>(vm)) JSFileSystemRouter(vm, structure, ctx); ptr->finishCreation(vm); return ptr; } -extern "C" void* SHA512_256__fromJS(JSC::EncodedJSValue value) +extern "C" void* FileSystemRouter__fromJS(JSC::EncodedJSValue value) { JSC::JSValue decodedValue = JSC::JSValue::decode(value); if (decodedValue.isEmpty() || !decodedValue.isCell()) return nullptr; JSC::JSCell* cell = decodedValue.asCell(); - JSSHA512_256* object = JSC::jsDynamicCast<JSSHA512_256*>(cell); + JSFileSystemRouter* object = JSC::jsDynamicCast<JSFileSystemRouter*>(cell); if (!object) return nullptr; @@ -4237,9 +2668,9 @@ extern "C" void* SHA512_256__fromJS(JSC::EncodedJSValue value) return object->wrapped(); } -extern "C" bool SHA512_256__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) +extern "C" bool FileSystemRouter__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) { - JSSHA512_256* object = JSC::jsDynamicCast<JSSHA512_256*>(JSValue::decode(value)); + JSFileSystemRouter* object = JSC::jsDynamicCast<JSFileSystemRouter*>(JSValue::decode(value)); if (!object) return false; @@ -4247,11 +2678,11 @@ extern "C" bool SHA512_256__dangerouslySetPtr(JSC::EncodedJSValue value, void* p return true; } -extern "C" const size_t SHA512_256__ptrOffset = JSSHA512_256::offsetOfWrapped(); +extern "C" const size_t FileSystemRouter__ptrOffset = JSFileSystemRouter::offsetOfWrapped(); -void JSSHA512_256::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) +void JSFileSystemRouter::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) { - auto* thisObject = jsCast<JSSHA512_256*>(cell); + auto* thisObject = jsCast<JSFileSystemRouter*>(cell); if (void* wrapped = thisObject->wrapped()) { // if (thisObject->scriptExecutionContext()) // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); @@ -4259,31 +2690,69 @@ void JSSHA512_256::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) Base::analyzeHeap(cell, analyzer); } -JSObject* JSSHA512_256::createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype) +JSObject* JSFileSystemRouter::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::JSFileSystemRouterConstructor::create(vm, globalObject, WebCore::JSFileSystemRouterConstructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast<WebCore::JSFileSystemRouterPrototype*>(prototype)); } -JSObject* JSSHA512_256::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) +JSObject* JSFileSystemRouter::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) { - return JSSHA512_256Prototype::create(vm, globalObject, JSSHA512_256Prototype::createStructure(vm, globalObject, globalObject->objectPrototype())); + return JSFileSystemRouterPrototype::create(vm, globalObject, JSFileSystemRouterPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); } -extern "C" EncodedJSValue SHA512_256__create(Zig::GlobalObject* globalObject, void* ptr) +extern "C" EncodedJSValue FileSystemRouter__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); + JSC::Structure* structure = globalObject->JSFileSystemRouterStructure(); + JSFileSystemRouter* instance = JSFileSystemRouter::create(vm, globalObject, structure, ptr); return JSValue::encode(instance); } -class JSCryptoHasherPrototype final : public JSC::JSNonFinalObject { + +template<typename Visitor> +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); + +template<typename Visitor> +void JSFileSystemRouter::visitAdditionalChildren(Visitor& visitor) +{ + JSFileSystemRouter* thisObject = this; + ASSERT_GC_OBJECT_INHERITS(thisObject, info()); + + visitor.append(thisObject->m_origin); + visitor.append(thisObject->m_routes); + visitor.append(thisObject->m_style); + ; +} + +DEFINE_VISIT_ADDITIONAL_CHILDREN(JSFileSystemRouter); + +template<typename Visitor> +void JSFileSystemRouter::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) +{ + JSFileSystemRouter* thisObject = jsCast<JSFileSystemRouter*>(cell); + ASSERT_GC_OBJECT_INHERITS(thisObject, info()); + thisObject->visitAdditionalChildren<Visitor>(visitor); +} + +DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSFileSystemRouter); +class JSListenerPrototype final : public JSC::JSNonFinalObject { public: using Base = JSC::JSNonFinalObject; - static JSCryptoHasherPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) + static JSListenerPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) { - JSCryptoHasherPrototype* ptr = new (NotNull, JSC::allocateCell<JSCryptoHasherPrototype>(vm)) JSCryptoHasherPrototype(vm, globalObject, structure); + JSListenerPrototype* ptr = new (NotNull, JSC::allocateCell<JSListenerPrototype>(vm)) JSListenerPrototype(vm, globalObject, structure); ptr->finishCreation(vm, globalObject); return ptr; } @@ -4300,7 +2769,7 @@ public: } private: - JSCryptoHasherPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) + JSListenerPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) : Base(vm, structure) { } @@ -4308,130 +2777,135 @@ private: 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); - - 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 = WTFMove(space); }, - [](auto& spaces) { return spaces.m_subspaceForCryptoHasherConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForCryptoHasherConstructor = WTFMove(space); }); - } +extern "C" void* ListenerClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); +JSC_DECLARE_CUSTOM_GETTER(jsListenerConstructor); +extern "C" void ListenerClass__finalize(void*); - void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSCryptoHasherPrototype* prototype); +extern "C" JSC::EncodedJSValue ListenerPrototype__getData(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); +JSC_DECLARE_CUSTOM_GETTER(ListenerPrototype__dataGetterWrap); - // Must be defined for each specialization class. - static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); +extern "C" bool ListenerPrototype__setData(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::EncodedJSValue value); +JSC_DECLARE_CUSTOM_SETTER(ListenerPrototype__dataSetterWrap); - DECLARE_EXPORT_INFO; +extern "C" JSC::EncodedJSValue ListenerPrototype__getHostname(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); +JSC_DECLARE_CUSTOM_GETTER(ListenerPrototype__hostnameGetterWrap); -private: - JSCryptoHasherConstructor(JSC::VM& vm, JSC::Structure* structure); - void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSCryptoHasherPrototype* prototype); -}; +extern "C" JSC::EncodedJSValue ListenerPrototype__getPort(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); +JSC_DECLARE_CUSTOM_GETTER(ListenerPrototype__portGetterWrap); -extern "C" void* CryptoHasherClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); -JSC_DECLARE_CUSTOM_GETTER(jsCryptoHasherConstructor); -extern "C" void CryptoHasherClass__finalize(void*); +extern "C" EncodedJSValue ListenerPrototype__ref(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(ListenerPrototype__refCallback); -extern "C" JSC::EncodedJSValue CryptoHasherPrototype__getAlgorithm(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(CryptoHasherPrototype__algorithmGetterWrap); +extern "C" EncodedJSValue ListenerPrototype__reload(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(ListenerPrototype__reloadCallback); -extern "C" JSC::EncodedJSValue CryptoHasherPrototype__getByteLength(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(CryptoHasherPrototype__byteLengthGetterWrap); +extern "C" EncodedJSValue ListenerPrototype__stop(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(ListenerPrototype__stopCallback); -extern "C" EncodedJSValue CryptoHasherPrototype__digest(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(CryptoHasherPrototype__digestCallback); +extern "C" JSC::EncodedJSValue ListenerPrototype__getUnix(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); +JSC_DECLARE_CUSTOM_GETTER(ListenerPrototype__unixGetterWrap); -extern "C" EncodedJSValue CryptoHasherPrototype__update(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(CryptoHasherPrototype__updateCallback); +extern "C" EncodedJSValue ListenerPrototype__unref(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(ListenerPrototype__unrefCallback); -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSCryptoHasherPrototype, JSCryptoHasherPrototype::Base); +STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSListenerPrototype, JSListenerPrototype::Base); -static const HashTableValue JSCryptoHasherPrototypeTableValues[] = { - { "algorithm"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, CryptoHasherPrototype__algorithmGetterWrap, 0 } }, - { "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, CryptoHasherPrototype__byteLengthGetterWrap, 0 } }, - { "digest"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, CryptoHasherPrototype__digestCallback, 0 } }, - { "update"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, CryptoHasherPrototype__updateCallback, 2 } } +static const HashTableValue JSListenerPrototypeTableValues[] = { + { "data"_s, static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, ListenerPrototype__dataGetterWrap, ListenerPrototype__dataSetterWrap } }, + { "hostname"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, ListenerPrototype__hostnameGetterWrap, 0 } }, + { "port"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, ListenerPrototype__portGetterWrap, 0 } }, + { "ref"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ListenerPrototype__refCallback, 0 } }, + { "reload"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ListenerPrototype__reloadCallback, 1 } }, + { "stop"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ListenerPrototype__stopCallback, 1 } }, + { "unix"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, ListenerPrototype__unixGetterWrap, 0 } }, + { "unref"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ListenerPrototype__unrefCallback, 0 } } }; -const ClassInfo JSCryptoHasherPrototype::s_info = { "CryptoHasher"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSCryptoHasherPrototype) }; +const ClassInfo JSListenerPrototype::s_info = { "Listener"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSListenerPrototype) }; -JSC_DEFINE_CUSTOM_GETTER(jsCryptoHasherConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) +JSC_DEFINE_CUSTOM_GETTER(jsListenerConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); auto* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); - auto* prototype = jsDynamicCast<JSCryptoHasherPrototype*>(JSValue::decode(thisValue)); + auto* prototype = jsDynamicCast<JSListenerPrototype*>(JSValue::decode(thisValue)); if (UNLIKELY(!prototype)) return throwVMTypeError(lexicalGlobalObject, throwScope); - return JSValue::encode(globalObject->JSCryptoHasherConstructor()); + return JSValue::encode(globalObject->JSListenerConstructor()); } -JSC_DEFINE_CUSTOM_GETTER(CryptoHasherPrototype__algorithmGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(ListenerPrototype__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); - JSCryptoHasher* thisObject = jsCast<JSCryptoHasher*>(JSValue::decode(thisValue)); + JSListener* thisObject = jsCast<JSListener*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC::EncodedJSValue result = ListenerPrototype__getData(thisObject->wrapped(), globalObject); + RETURN_IF_EXCEPTION(throwScope, {}); + RELEASE_AND_RETURN(throwScope, result); +} - if (JSValue cachedValue = thisObject->m_algorithm.get()) +JSC_DEFINE_CUSTOM_SETTER(ListenerPrototype__dataSetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue, PropertyName attributeName)) +{ + auto& vm = lexicalGlobalObject->vm(); + auto throwScope = DECLARE_THROW_SCOPE(vm); + JSListener* thisObject = jsCast<JSListener*>(JSValue::decode(thisValue)); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + auto result = ListenerPrototype__setData(thisObject->wrapped(), lexicalGlobalObject, encodedValue); + + 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); + auto throwScope = DECLARE_THROW_SCOPE(vm); + JSListener* thisObject = jsCast<JSListener*>(JSValue::decode(thisValue)); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + + if (JSValue cachedValue = thisObject->m_hostname.get()) return JSValue::encode(cachedValue); JSC::JSValue result = JSC::JSValue::decode( - CryptoHasherPrototype__getAlgorithm(thisObject->wrapped(), globalObject)); + ListenerPrototype__getHostname(thisObject->wrapped(), globalObject)); RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_algorithm.set(vm, thisObject, result); + thisObject->m_hostname.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) +extern "C" void ListenerPrototype__hostnameSetCachedValue(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)); + auto* thisObject = jsCast<JSListener*>(JSValue::decode(thisValue)); + thisObject->m_hostname.set(vm, thisObject, JSValue::decode(value)); } -extern "C" EncodedJSValue CryptoHasherPrototype__algorithmGetCachedValue(JSC::EncodedJSValue thisValue) +extern "C" EncodedJSValue ListenerPrototype__hostnameGetCachedValue(JSC::EncodedJSValue thisValue) { - auto* thisObject = jsCast<JSCryptoHasher*>(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_algorithm.get()); + auto* thisObject = jsCast<JSListener*>(JSValue::decode(thisValue)); + return JSValue::encode(thisObject->m_hostname.get()); } -JSC_DEFINE_CUSTOM_GETTER(CryptoHasherPrototype__byteLengthGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(ListenerPrototype__portGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); - JSCryptoHasher* thisObject = jsCast<JSCryptoHasher*>(JSValue::decode(thisValue)); + JSListener* thisObject = jsCast<JSListener*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = CryptoHasherPrototype__getByteLength(thisObject->wrapped(), globalObject); + JSC::EncodedJSValue result = ListenerPrototype__getPort(thisObject->wrapped(), globalObject); RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } -JSC_DEFINE_HOST_FUNCTION(CryptoHasherPrototype__digestCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(ListenerPrototype__refCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSCryptoHasher* thisObject = jsDynamicCast<JSCryptoHasher*>(callFrame->thisValue()); + JSListener* thisObject = jsDynamicCast<JSListener*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -4440,14 +2914,14 @@ JSC_DEFINE_HOST_FUNCTION(CryptoHasherPrototype__digestCallback, (JSGlobalObject JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return CryptoHasherPrototype__digest(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return ListenerPrototype__ref(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(CryptoHasherPrototype__updateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(ListenerPrototype__reloadCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSCryptoHasher* thisObject = jsDynamicCast<JSCryptoHasher*>(callFrame->thisValue()); + JSListener* thisObject = jsDynamicCast<JSListener*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -4456,120 +2930,113 @@ JSC_DEFINE_HOST_FUNCTION(CryptoHasherPrototype__updateCallback, (JSGlobalObject JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return CryptoHasherPrototype__update(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return ListenerPrototype__reload(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -void JSCryptoHasherPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) +JSC_DEFINE_HOST_FUNCTION(ListenerPrototype__stopCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { - Base::finishCreation(vm); - reifyStaticProperties(vm, JSCryptoHasher::info(), JSCryptoHasherPrototypeTableValues, *this); - JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); -} + auto& vm = lexicalGlobalObject->vm(); -extern "C" JSC_DECLARE_CUSTOM_GETTER(CryptoHasherClass__getAlgorithms); -extern "C" JSC_DECLARE_HOST_FUNCTION(CryptoHasherClass__hash); + JSListener* thisObject = jsDynamicCast<JSListener*>(callFrame->thisValue()); -static const HashTableValue JSCryptoHasherConstructorTableValues[] = { - { "algorithms"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, CryptoHasherClass__getAlgorithms, 0 } }, - { "hash"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, CryptoHasherClass__hash, 2 } } -}; + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } -void JSCryptoHasherConstructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSCryptoHasherPrototype* prototype) -{ - Base::finishCreation(vm, 0, "CryptoHasher"_s, PropertyAdditionMode::WithoutStructureTransition); - reifyStaticProperties(vm, &JSCryptoHasherConstructor::s_info, JSCryptoHasherConstructorTableValues, *this); - putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly); - ASSERT(inherits(info())); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + + return ListenerPrototype__stop(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSCryptoHasherConstructor::JSCryptoHasherConstructor(JSC::VM& vm, JSC::Structure* structure) - : Base(vm, structure, construct, construct) +JSC_DEFINE_CUSTOM_GETTER(ListenerPrototype__unixGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { + auto& vm = lexicalGlobalObject->vm(); + 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); + + if (JSValue cachedValue = thisObject->m_unix.get()) + return JSValue::encode(cachedValue); + + JSC::JSValue result = JSC::JSValue::decode( + ListenerPrototype__getUnix(thisObject->wrapped(), globalObject)); + RETURN_IF_EXCEPTION(throwScope, {}); + thisObject->m_unix.set(vm, thisObject, result); + RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); } -JSCryptoHasherConstructor* JSCryptoHasherConstructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSCryptoHasherPrototype* prototype) +extern "C" void ListenerPrototype__unixSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) { - JSCryptoHasherConstructor* ptr = new (NotNull, JSC::allocateCell<JSCryptoHasherConstructor>(vm)) JSCryptoHasherConstructor(vm, structure); - ptr->finishCreation(vm, globalObject, prototype); - return ptr; + auto& vm = globalObject->vm(); + auto* thisObject = jsCast<JSListener*>(JSValue::decode(thisValue)); + thisObject->m_unix.set(vm, thisObject, JSValue::decode(value)); } -JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSCryptoHasherConstructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) +extern "C" EncodedJSValue ListenerPrototype__unixGetCachedValue(JSC::EncodedJSValue thisValue) { - 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* thisObject = jsCast<JSListener*>(JSValue::decode(thisValue)); + return JSValue::encode(thisObject->m_unix.get()); +} - 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()); - } +JSC_DEFINE_HOST_FUNCTION(ListenerPrototype__unrefCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + auto& vm = lexicalGlobalObject->vm(); - void* ptr = CryptoHasherClass__construct(globalObject, callFrame); + JSListener* thisObject = jsDynamicCast<JSListener*>(callFrame->thisValue()); - if (UNLIKELY(!ptr)) { - return JSValue::encode(JSC::jsUndefined()); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); } - JSCryptoHasher* instance = JSCryptoHasher::create(vm, globalObject, structure, ptr); - - return JSValue::encode(instance); -} + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); -void JSCryptoHasherConstructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSCryptoHasherPrototype* prototype) -{ + return ListenerPrototype__unref(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -const ClassInfo JSCryptoHasherConstructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSCryptoHasherConstructor) }; - -extern "C" EncodedJSValue CryptoHasher__getConstructor(Zig::GlobalObject* globalObject) +void JSListenerPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) { - return JSValue::encode(globalObject->JSCryptoHasherConstructor()); + Base::finishCreation(vm); + reifyStaticProperties(vm, JSListener::info(), JSListenerPrototypeTableValues, *this); + JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); } -JSCryptoHasher::~JSCryptoHasher() +JSListener::~JSListener() { if (m_ctx) { - CryptoHasherClass__finalize(m_ctx); + ListenerClass__finalize(m_ctx); } } -void JSCryptoHasher::destroy(JSCell* cell) +void JSListener::destroy(JSCell* cell) { - static_cast<JSCryptoHasher*>(cell)->JSCryptoHasher::~JSCryptoHasher(); + static_cast<JSListener*>(cell)->JSListener::~JSListener(); } -const ClassInfo JSCryptoHasher::s_info = { "CryptoHasher"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSCryptoHasher) }; +const ClassInfo JSListener::s_info = { "Listener"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSListener) }; -void JSCryptoHasher::finishCreation(VM& vm) +void JSListener::finishCreation(VM& vm) { Base::finishCreation(vm); ASSERT(inherits(info())); } -JSCryptoHasher* JSCryptoHasher::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) +JSListener* JSListener::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) { - JSCryptoHasher* ptr = new (NotNull, JSC::allocateCell<JSCryptoHasher>(vm)) JSCryptoHasher(vm, structure, ctx); + JSListener* ptr = new (NotNull, JSC::allocateCell<JSListener>(vm)) JSListener(vm, structure, ctx); ptr->finishCreation(vm); return ptr; } -extern "C" void* CryptoHasher__fromJS(JSC::EncodedJSValue value) +extern "C" void* Listener__fromJS(JSC::EncodedJSValue value) { JSC::JSValue decodedValue = JSC::JSValue::decode(value); if (decodedValue.isEmpty() || !decodedValue.isCell()) return nullptr; JSC::JSCell* cell = decodedValue.asCell(); - JSCryptoHasher* object = JSC::jsDynamicCast<JSCryptoHasher*>(cell); + JSListener* object = JSC::jsDynamicCast<JSListener*>(cell); if (!object) return nullptr; @@ -4577,9 +3044,9 @@ extern "C" void* CryptoHasher__fromJS(JSC::EncodedJSValue value) return object->wrapped(); } -extern "C" bool CryptoHasher__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) +extern "C" bool Listener__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) { - JSCryptoHasher* object = JSC::jsDynamicCast<JSCryptoHasher*>(JSValue::decode(value)); + JSListener* object = JSC::jsDynamicCast<JSListener*>(JSValue::decode(value)); if (!object) return false; @@ -4587,11 +3054,11 @@ extern "C" bool CryptoHasher__dangerouslySetPtr(JSC::EncodedJSValue value, void* return true; } -extern "C" const size_t CryptoHasher__ptrOffset = JSCryptoHasher::offsetOfWrapped(); +extern "C" const size_t Listener__ptrOffset = JSListener::offsetOfWrapped(); -void JSCryptoHasher::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) +void JSListener::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) { - auto* thisObject = jsCast<JSCryptoHasher*>(cell); + auto* thisObject = jsCast<JSListener*>(cell); if (void* wrapped = thisObject->wrapped()) { // if (thisObject->scriptExecutionContext()) // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); @@ -4599,67 +3066,62 @@ void JSCryptoHasher::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) Base::analyzeHeap(cell, 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)); -} - -JSObject* JSCryptoHasher::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) +JSObject* JSListener::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) { - return JSCryptoHasherPrototype::create(vm, globalObject, JSCryptoHasherPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); + return JSListenerPrototype::create(vm, globalObject, JSListenerPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); } -extern "C" EncodedJSValue CryptoHasher__create(Zig::GlobalObject* globalObject, void* ptr) +extern "C" EncodedJSValue Listener__create(Zig::GlobalObject* globalObject, void* ptr) { auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSCryptoHasherStructure(); - JSCryptoHasher* instance = JSCryptoHasher::create(vm, globalObject, structure, ptr); + JSC::Structure* structure = globalObject->JSListenerStructure(); + JSListener* instance = JSListener::create(vm, globalObject, structure, ptr); return JSValue::encode(instance); } template<typename Visitor> -void JSCryptoHasher::visitChildrenImpl(JSCell* cell, Visitor& visitor) +void JSListener::visitChildrenImpl(JSCell* cell, Visitor& visitor) { - JSCryptoHasher* thisObject = jsCast<JSCryptoHasher*>(cell); + JSListener* thisObject = jsCast<JSListener*>(cell); ASSERT_GC_OBJECT_INHERITS(thisObject, info()); Base::visitChildren(thisObject, visitor); - visitor.append(thisObject->m_algorithms); - visitor.append(thisObject->m_algorithm); + visitor.append(thisObject->m_hostname); + visitor.append(thisObject->m_unix); } -DEFINE_VISIT_CHILDREN(JSCryptoHasher); +DEFINE_VISIT_CHILDREN(JSListener); template<typename Visitor> -void JSCryptoHasher::visitAdditionalChildren(Visitor& visitor) +void JSListener::visitAdditionalChildren(Visitor& visitor) { - JSCryptoHasher* thisObject = this; + JSListener* thisObject = this; ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - visitor.append(thisObject->m_algorithms); - visitor.append(thisObject->m_algorithm); + visitor.append(thisObject->m_hostname); + visitor.append(thisObject->m_unix); ; } -DEFINE_VISIT_ADDITIONAL_CHILDREN(JSCryptoHasher); +DEFINE_VISIT_ADDITIONAL_CHILDREN(JSListener); template<typename Visitor> -void JSCryptoHasher::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) +void JSListener::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) { - JSCryptoHasher* thisObject = jsCast<JSCryptoHasher*>(cell); + JSListener* thisObject = jsCast<JSListener*>(cell); ASSERT_GC_OBJECT_INHERITS(thisObject, info()); thisObject->visitAdditionalChildren<Visitor>(visitor); } -DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSCryptoHasher); -class JSServerWebSocketPrototype final : public JSC::JSNonFinalObject { +DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSListener); +class JSMD4Prototype final : public JSC::JSNonFinalObject { public: using Base = JSC::JSNonFinalObject; - static JSServerWebSocketPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) + static JSMD4Prototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) { - JSServerWebSocketPrototype* ptr = new (NotNull, JSC::allocateCell<JSServerWebSocketPrototype>(vm)) JSServerWebSocketPrototype(vm, globalObject, structure); + JSMD4Prototype* ptr = new (NotNull, JSC::allocateCell<JSMD4Prototype>(vm)) JSMD4Prototype(vm, globalObject, structure); ptr->finishCreation(vm, globalObject); return ptr; } @@ -4676,7 +3138,7 @@ public: } private: - JSServerWebSocketPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) + JSMD4Prototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) : Base(vm, structure) { } @@ -4684,10 +3146,10 @@ private: void finishCreation(JSC::VM&, JSC::JSGlobalObject*); }; -class JSServerWebSocketConstructor final : public JSC::InternalFunction { +class JSMD4Constructor final : public JSC::InternalFunction { public: using Base = JSC::InternalFunction; - static JSServerWebSocketConstructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSServerWebSocketPrototype* prototype); + 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; @@ -4701,15 +3163,15 @@ public: { if constexpr (mode == JSC::SubspaceAccess::Concurrently) return nullptr; - return WebCore::subspaceForImpl<JSServerWebSocketConstructor, WebCore::UseCustomHeapCellType::No>( + return WebCore::subspaceForImpl<JSMD4Constructor, WebCore::UseCustomHeapCellType::No>( vm, - [](auto& spaces) { return spaces.m_clientSubspaceForServerWebSocketConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForServerWebSocketConstructor = WTFMove(space); }, - [](auto& spaces) { return spaces.m_subspaceForServerWebSocketConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForServerWebSocketConstructor = WTFMove(space); }); + [](auto& spaces) { return spaces.m_clientSubspaceForMD4Constructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForMD4Constructor = WTFMove(space); }, + [](auto& spaces) { return spaces.m_subspaceForMD4Constructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForMD4Constructor = WTFMove(space); }); } - void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSServerWebSocketPrototype* prototype); + 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*); @@ -4717,448 +3179,62 @@ public: DECLARE_EXPORT_INFO; private: - JSServerWebSocketConstructor(JSC::VM& vm, JSC::Structure* structure); - void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSServerWebSocketPrototype* prototype); + JSMD4Constructor(JSC::VM& vm, JSC::Structure* structure); + void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSMD4Prototype* 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); - -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)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - IGNORE_WARNINGS_BEGIN("frame-address") - CallFrame* callFrame = DECLARE_CALL_FRAME(vm); - IGNORE_WARNINGS_END - JSC::JITOperationPrologueCallFrameTracer tracer(vm, callFrame); - return ServerWebSocketPrototype__publishBinaryWithoutTypeChecks(reinterpret_cast<JSServerWebSocket*>(thisValue)->wrapped(), lexicalGlobalObject, arg0, arg1); -} - -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); - -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)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - IGNORE_WARNINGS_BEGIN("frame-address") - CallFrame* callFrame = DECLARE_CALL_FRAME(vm); - IGNORE_WARNINGS_END - JSC::JITOperationPrologueCallFrameTracer tracer(vm, callFrame); - return ServerWebSocketPrototype__publishTextWithoutTypeChecks(reinterpret_cast<JSServerWebSocket*>(thisValue)->wrapped(), lexicalGlobalObject, arg0, arg1); -} - -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); - -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)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - IGNORE_WARNINGS_BEGIN("frame-address") - CallFrame* callFrame = DECLARE_CALL_FRAME(vm); - IGNORE_WARNINGS_END - JSC::JITOperationPrologueCallFrameTracer tracer(vm, callFrame); - return ServerWebSocketPrototype__sendBinaryWithoutTypeChecks(reinterpret_cast<JSServerWebSocket*>(thisValue)->wrapped(), lexicalGlobalObject, arg0, arg1); -} - -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); - -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); +extern "C" void* MD4Class__construct(JSC::JSGlobalObject*, JSC::CallFrame*); +JSC_DECLARE_CUSTOM_GETTER(jsMD4Constructor); +extern "C" void MD4Class__finalize(void*); -JSC_DEFINE_JIT_OPERATION(ServerWebSocketPrototype__sendTextWithoutTypeChecksWrapper, EncodedJSValue, (JSC::JSGlobalObject * lexicalGlobalObject, void* thisValue, JSC::JSString* arg0, bool arg1)) -{ - VM& vm = JSC::getVM(lexicalGlobalObject); - IGNORE_WARNINGS_BEGIN("frame-address") - CallFrame* callFrame = DECLARE_CALL_FRAME(vm); - IGNORE_WARNINGS_END - JSC::JITOperationPrologueCallFrameTracer tracer(vm, callFrame); - return ServerWebSocketPrototype__sendTextWithoutTypeChecks(reinterpret_cast<JSServerWebSocket*>(thisValue)->wrapped(), lexicalGlobalObject, arg0, arg1); -} +extern "C" JSC::EncodedJSValue MD4Prototype__getByteLength(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); +JSC_DECLARE_CUSTOM_GETTER(MD4Prototype__byteLengthGetterWrap); -extern "C" EncodedJSValue ServerWebSocketPrototype__subscribe(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ServerWebSocketPrototype__subscribeCallback); +extern "C" EncodedJSValue MD4Prototype__digest(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(MD4Prototype__digestCallback); -extern "C" EncodedJSValue ServerWebSocketPrototype__unsubscribe(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ServerWebSocketPrototype__unsubscribeCallback); +extern "C" EncodedJSValue MD4Prototype__update(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(MD4Prototype__updateCallback); -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSServerWebSocketPrototype, JSServerWebSocketPrototype::Base); +STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSMD4Prototype, JSMD4Prototype::Base); -static const HashTableValue JSServerWebSocketPrototypeTableValues[] = { - { "binaryType"_s, static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, ServerWebSocketPrototype__binaryTypeGetterWrap, ServerWebSocketPrototype__binaryTypeSetterWrap } }, - { "close"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ServerWebSocketPrototype__closeCallback, 1 } }, - { "cork"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ServerWebSocketPrototype__corkCallback, 1 } }, - { "data"_s, static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, ServerWebSocketPrototype__dataGetterWrap, ServerWebSocketPrototype__dataSetterWrap } }, - { "getBufferedAmount"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ServerWebSocketPrototype__getBufferedAmountCallback, 0 } }, - { "isSubscribed"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ServerWebSocketPrototype__isSubscribedCallback, 1 } }, - { "publish"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ServerWebSocketPrototype__publishCallback, 3 } }, - { "publishBinary"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | JSC::PropertyAttribute::DOMJITFunction), NoIntrinsic, { HashTableValue::DOMJITFunctionType, ServerWebSocketPrototype__publishBinaryCallback, &DOMJITSignatureForServerWebSocketPrototype__publishBinary } }, - { "publishText"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | JSC::PropertyAttribute::DOMJITFunction), NoIntrinsic, { HashTableValue::DOMJITFunctionType, ServerWebSocketPrototype__publishTextCallback, &DOMJITSignatureForServerWebSocketPrototype__publishText } }, - { "readyState"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, ServerWebSocketPrototype__readyStateGetterWrap, 0 } }, - { "remoteAddress"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, ServerWebSocketPrototype__remoteAddressGetterWrap, 0 } }, - { "send"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ServerWebSocketPrototype__sendCallback, 2 } }, - { "sendBinary"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | JSC::PropertyAttribute::DOMJITFunction), NoIntrinsic, { HashTableValue::DOMJITFunctionType, ServerWebSocketPrototype__sendBinaryCallback, &DOMJITSignatureForServerWebSocketPrototype__sendBinary } }, - { "sendText"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | JSC::PropertyAttribute::DOMJITFunction), NoIntrinsic, { HashTableValue::DOMJITFunctionType, ServerWebSocketPrototype__sendTextCallback, &DOMJITSignatureForServerWebSocketPrototype__sendText } }, - { "subscribe"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ServerWebSocketPrototype__subscribeCallback, 1 } }, - { "unsubscribe"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ServerWebSocketPrototype__unsubscribeCallback, 1 } } +static const HashTableValue JSMD4PrototypeTableValues[] = { + { "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, MD4Prototype__byteLengthGetterWrap, 0 } }, + { "digest"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, MD4Prototype__digestCallback, 0 } }, + { "update"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, MD4Prototype__updateCallback, 1 } } }; -const ClassInfo JSServerWebSocketPrototype::s_info = { "ServerWebSocket"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSServerWebSocketPrototype) }; +const ClassInfo JSMD4Prototype::s_info = { "MD4"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSMD4Prototype) }; -JSC_DEFINE_CUSTOM_GETTER(jsServerWebSocketConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) +JSC_DEFINE_CUSTOM_GETTER(jsMD4Constructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); auto* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); - auto* prototype = jsDynamicCast<JSServerWebSocketPrototype*>(JSValue::decode(thisValue)); + auto* prototype = jsDynamicCast<JSMD4Prototype*>(JSValue::decode(thisValue)); 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); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSServerWebSocket* thisObject = jsCast<JSServerWebSocket*>(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = ServerWebSocketPrototype__getBinaryType(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); -} - -JSC_DEFINE_CUSTOM_SETTER(ServerWebSocketPrototype__binaryTypeSetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSServerWebSocket* thisObject = jsCast<JSServerWebSocket*>(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - auto result = ServerWebSocketPrototype__setBinaryType(thisObject->wrapped(), lexicalGlobalObject, encodedValue); - - 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()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - return ServerWebSocketPrototype__close(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ServerWebSocketPrototype__corkCallback, (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); - } - - 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); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSServerWebSocket* thisObject = jsCast<JSServerWebSocket*>(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( - 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) -{ - 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)) -{ - auto& vm = lexicalGlobalObject->vm(); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSServerWebSocket* thisObject = jsCast<JSServerWebSocket*>(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - auto result = ServerWebSocketPrototype__setData(thisObject->wrapped(), lexicalGlobalObject, encodedValue); - - 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()); - - 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_DEFINE_HOST_FUNCTION(ServerWebSocketPrototype__isSubscribedCallback, (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); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - return ServerWebSocketPrototype__isSubscribed(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ServerWebSocketPrototype__publishCallback, (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); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - return ServerWebSocketPrototype__publish(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ServerWebSocketPrototype__publishBinaryCallback, (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); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - return ServerWebSocketPrototype__publishBinary(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ServerWebSocketPrototype__publishTextCallback, (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); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - return ServerWebSocketPrototype__publishText(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return JSValue::encode(globalObject->JSMD4Constructor()); } -JSC_DEFINE_CUSTOM_GETTER(ServerWebSocketPrototype__readyStateGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(MD4Prototype__byteLengthGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); - JSServerWebSocket* thisObject = jsCast<JSServerWebSocket*>(JSValue::decode(thisValue)); + JSMD4* thisObject = jsCast<JSMD4*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = ServerWebSocketPrototype__getReadyState(thisObject->wrapped(), globalObject); + JSC::EncodedJSValue result = MD4Prototype__getByteLength(thisObject->wrapped(), globalObject); 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); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSServerWebSocket* thisObject = jsCast<JSServerWebSocket*>(JSValue::decode(thisValue)); - 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)); - 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) -{ - 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(); - - JSServerWebSocket* thisObject = jsDynamicCast<JSServerWebSocket*>(callFrame->thisValue()); - - 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_DEFINE_HOST_FUNCTION(ServerWebSocketPrototype__sendBinaryCallback, (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); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - return ServerWebSocketPrototype__sendBinary(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ServerWebSocketPrototype__sendTextCallback, (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); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - return ServerWebSocketPrototype__sendText(thisObject->wrapped(), lexicalGlobalObject, callFrame); -} - -JSC_DEFINE_HOST_FUNCTION(ServerWebSocketPrototype__subscribeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(MD4Prototype__digestCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSServerWebSocket* thisObject = jsDynamicCast<JSServerWebSocket*>(callFrame->thisValue()); + JSMD4* thisObject = jsDynamicCast<JSMD4*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -5167,14 +3243,14 @@ JSC_DEFINE_HOST_FUNCTION(ServerWebSocketPrototype__subscribeCallback, (JSGlobalO JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return ServerWebSocketPrototype__subscribe(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return MD4Prototype__digest(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(ServerWebSocketPrototype__unsubscribeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(MD4Prototype__updateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSServerWebSocket* thisObject = jsDynamicCast<JSServerWebSocket*>(callFrame->thisValue()); + JSMD4* thisObject = jsDynamicCast<JSMD4*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -5183,43 +3259,51 @@ JSC_DEFINE_HOST_FUNCTION(ServerWebSocketPrototype__unsubscribeCallback, (JSGloba JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return ServerWebSocketPrototype__unsubscribe(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return MD4Prototype__update(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -void JSServerWebSocketPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) +void JSMD4Prototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) { Base::finishCreation(vm); - reifyStaticProperties(vm, JSServerWebSocket::info(), JSServerWebSocketPrototypeTableValues, *this); + reifyStaticProperties(vm, JSMD4::info(), JSMD4PrototypeTableValues, *this); JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); } -void JSServerWebSocketConstructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSServerWebSocketPrototype* prototype) -{ - Base::finishCreation(vm, 0, "ServerWebSocket"_s, PropertyAdditionMode::WithoutStructureTransition); +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), NoIntrinsic, { HashTableValue::GetterSetterType, MD4Class__getByteLengthStatic, 0 } }, + { "hash"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, MD4Class__hash, 2 } } +}; + +void JSMD4Constructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSMD4Prototype* prototype) +{ + Base::finishCreation(vm, 0, "MD4"_s, PropertyAdditionMode::WithoutStructureTransition); + reifyStaticProperties(vm, &JSMD4Constructor::s_info, JSMD4ConstructorTableValues, *this); putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly); ASSERT(inherits(info())); } -JSServerWebSocketConstructor::JSServerWebSocketConstructor(JSC::VM& vm, JSC::Structure* structure) +JSMD4Constructor::JSMD4Constructor(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) +JSMD4Constructor* JSMD4Constructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSMD4Prototype* prototype) { - JSServerWebSocketConstructor* ptr = new (NotNull, JSC::allocateCell<JSServerWebSocketConstructor>(vm)) JSServerWebSocketConstructor(vm, structure); + JSMD4Constructor* ptr = new (NotNull, JSC::allocateCell<JSMD4Constructor>(vm)) JSMD4Constructor(vm, structure); ptr->finishCreation(vm, globalObject, prototype); return ptr; } -JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSServerWebSocketConstructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) +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(); JSObject* newTarget = asObject(callFrame->newTarget()); - auto* constructor = globalObject->JSServerWebSocketConstructor(); - Structure* structure = globalObject->JSServerWebSocketStructure(); + auto* constructor = globalObject->JSMD4Constructor(); + Structure* structure = globalObject->JSMD4Structure(); if (constructor != newTarget) { auto scope = DECLARE_THROW_SCOPE(vm); @@ -5230,65 +3314,65 @@ JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSServerWebSocketConstructor::const structure = InternalFunction::createSubclassStructure( globalObject, newTarget, - functionGlobalObject->JSServerWebSocketStructure()); + functionGlobalObject->JSMD4Structure()); } - void* ptr = ServerWebSocketClass__construct(globalObject, callFrame); + void* ptr = MD4Class__construct(globalObject, callFrame); if (UNLIKELY(!ptr)) { return JSValue::encode(JSC::jsUndefined()); } - JSServerWebSocket* instance = JSServerWebSocket::create(vm, globalObject, structure, ptr); + JSMD4* instance = JSMD4::create(vm, globalObject, structure, ptr); return JSValue::encode(instance); } -void JSServerWebSocketConstructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSServerWebSocketPrototype* prototype) +void JSMD4Constructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSMD4Prototype* prototype) { } -const ClassInfo JSServerWebSocketConstructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSServerWebSocketConstructor) }; +const ClassInfo JSMD4Constructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSMD4Constructor) }; -extern "C" EncodedJSValue ServerWebSocket__getConstructor(Zig::GlobalObject* globalObject) +extern "C" EncodedJSValue MD4__getConstructor(Zig::GlobalObject* globalObject) { - return JSValue::encode(globalObject->JSServerWebSocketConstructor()); + return JSValue::encode(globalObject->JSMD4Constructor()); } -JSServerWebSocket::~JSServerWebSocket() +JSMD4::~JSMD4() { if (m_ctx) { - ServerWebSocketClass__finalize(m_ctx); + MD4Class__finalize(m_ctx); } } -void JSServerWebSocket::destroy(JSCell* cell) +void JSMD4::destroy(JSCell* cell) { - static_cast<JSServerWebSocket*>(cell)->JSServerWebSocket::~JSServerWebSocket(); + static_cast<JSMD4*>(cell)->JSMD4::~JSMD4(); } -const ClassInfo JSServerWebSocket::s_info = { "ServerWebSocket"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSServerWebSocket) }; +const ClassInfo JSMD4::s_info = { "MD4"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSMD4) }; -void JSServerWebSocket::finishCreation(VM& vm) +void JSMD4::finishCreation(VM& vm) { Base::finishCreation(vm); ASSERT(inherits(info())); } -JSServerWebSocket* JSServerWebSocket::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) +JSMD4* JSMD4::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) { - JSServerWebSocket* ptr = new (NotNull, JSC::allocateCell<JSServerWebSocket>(vm)) JSServerWebSocket(vm, structure, ctx); + JSMD4* ptr = new (NotNull, JSC::allocateCell<JSMD4>(vm)) JSMD4(vm, structure, ctx); ptr->finishCreation(vm); return ptr; } -extern "C" void* ServerWebSocket__fromJS(JSC::EncodedJSValue value) +extern "C" void* MD4__fromJS(JSC::EncodedJSValue value) { JSC::JSValue decodedValue = JSC::JSValue::decode(value); if (decodedValue.isEmpty() || !decodedValue.isCell()) return nullptr; JSC::JSCell* cell = decodedValue.asCell(); - JSServerWebSocket* object = JSC::jsDynamicCast<JSServerWebSocket*>(cell); + JSMD4* object = JSC::jsDynamicCast<JSMD4*>(cell); if (!object) return nullptr; @@ -5296,9 +3380,9 @@ extern "C" void* ServerWebSocket__fromJS(JSC::EncodedJSValue value) return object->wrapped(); } -extern "C" bool ServerWebSocket__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) +extern "C" bool MD4__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) { - JSServerWebSocket* object = JSC::jsDynamicCast<JSServerWebSocket*>(JSValue::decode(value)); + JSMD4* object = JSC::jsDynamicCast<JSMD4*>(JSValue::decode(value)); if (!object) return false; @@ -5306,11 +3390,11 @@ extern "C" bool ServerWebSocket__dangerouslySetPtr(JSC::EncodedJSValue value, vo return true; } -extern "C" const size_t ServerWebSocket__ptrOffset = JSServerWebSocket::offsetOfWrapped(); +extern "C" const size_t MD4__ptrOffset = JSMD4::offsetOfWrapped(); -void JSServerWebSocket::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) +void JSMD4::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) { - auto* thisObject = jsCast<JSServerWebSocket*>(cell); + auto* thisObject = jsCast<JSMD4*>(cell); if (void* wrapped = thisObject->wrapped()) { // if (thisObject->scriptExecutionContext()) // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); @@ -5318,67 +3402,31 @@ void JSServerWebSocket::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) Base::analyzeHeap(cell, analyzer); } -JSObject* JSServerWebSocket::createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype) +JSObject* JSMD4::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::JSMD4Constructor::create(vm, globalObject, WebCore::JSMD4Constructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast<WebCore::JSMD4Prototype*>(prototype)); } -JSObject* JSServerWebSocket::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) +JSObject* JSMD4::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) { - return JSServerWebSocketPrototype::create(vm, globalObject, JSServerWebSocketPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); + return JSMD4Prototype::create(vm, globalObject, JSMD4Prototype::createStructure(vm, globalObject, globalObject->objectPrototype())); } -extern "C" EncodedJSValue ServerWebSocket__create(Zig::GlobalObject* globalObject, void* ptr) +extern "C" EncodedJSValue MD4__create(Zig::GlobalObject* globalObject, void* ptr) { auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSServerWebSocketStructure(); - JSServerWebSocket* instance = JSServerWebSocket::create(vm, globalObject, structure, ptr); + JSC::Structure* structure = globalObject->JSMD4Structure(); + JSMD4* instance = JSMD4::create(vm, globalObject, structure, ptr); return JSValue::encode(instance); } - -template<typename Visitor> -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); - -template<typename Visitor> -void JSServerWebSocket::visitAdditionalChildren(Visitor& visitor) -{ - JSServerWebSocket* thisObject = this; - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - - visitor.append(thisObject->m_data); - visitor.append(thisObject->m_remoteAddress); - ; -} - -DEFINE_VISIT_ADDITIONAL_CHILDREN(JSServerWebSocket); - -template<typename Visitor> -void JSServerWebSocket::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) -{ - JSServerWebSocket* thisObject = jsCast<JSServerWebSocket*>(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - thisObject->visitAdditionalChildren<Visitor>(visitor); -} - -DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSServerWebSocket); -class JSFileSystemRouterPrototype final : public JSC::JSNonFinalObject { +class JSMD5Prototype final : public JSC::JSNonFinalObject { public: using Base = JSC::JSNonFinalObject; - static JSFileSystemRouterPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) + static JSMD5Prototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) { - JSFileSystemRouterPrototype* ptr = new (NotNull, JSC::allocateCell<JSFileSystemRouterPrototype>(vm)) JSFileSystemRouterPrototype(vm, globalObject, structure); + JSMD5Prototype* ptr = new (NotNull, JSC::allocateCell<JSMD5Prototype>(vm)) JSMD5Prototype(vm, globalObject, structure); ptr->finishCreation(vm, globalObject); return ptr; } @@ -5395,7 +3443,7 @@ public: } private: - JSFileSystemRouterPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) + JSMD5Prototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) : Base(vm, structure) { } @@ -5403,10 +3451,10 @@ private: void finishCreation(JSC::VM&, JSC::JSGlobalObject*); }; -class JSFileSystemRouterConstructor final : public JSC::InternalFunction { +class JSMD5Constructor final : public JSC::InternalFunction { public: using Base = JSC::InternalFunction; - static JSFileSystemRouterConstructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSFileSystemRouterPrototype* prototype); + 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; @@ -5420,15 +3468,15 @@ public: { if constexpr (mode == JSC::SubspaceAccess::Concurrently) return nullptr; - return WebCore::subspaceForImpl<JSFileSystemRouterConstructor, WebCore::UseCustomHeapCellType::No>( + return WebCore::subspaceForImpl<JSMD5Constructor, WebCore::UseCustomHeapCellType::No>( vm, - [](auto& spaces) { return spaces.m_clientSubspaceForFileSystemRouterConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForFileSystemRouterConstructor = WTFMove(space); }, - [](auto& spaces) { return spaces.m_subspaceForFileSystemRouterConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForFileSystemRouterConstructor = WTFMove(space); }); + [](auto& spaces) { return spaces.m_clientSubspaceForMD5Constructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForMD5Constructor = WTFMove(space); }, + [](auto& spaces) { return spaces.m_subspaceForMD5Constructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForMD5Constructor = WTFMove(space); }); } - void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSFileSystemRouterPrototype* 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*); @@ -5436,105 +3484,62 @@ public: DECLARE_EXPORT_INFO; private: - JSFileSystemRouterConstructor(JSC::VM& vm, JSC::Structure* structure); - void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSFileSystemRouterPrototype* prototype); + JSMD5Constructor(JSC::VM& vm, JSC::Structure* structure); + void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSMD5Prototype* 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" void* MD5Class__construct(JSC::JSGlobalObject*, JSC::CallFrame*); +JSC_DECLARE_CUSTOM_GETTER(jsMD5Constructor); +extern "C" void MD5Class__finalize(void*); -extern "C" EncodedJSValue FileSystemRouterPrototype__reload(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(FileSystemRouterPrototype__reloadCallback); +extern "C" JSC::EncodedJSValue MD5Prototype__getByteLength(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); +JSC_DECLARE_CUSTOM_GETTER(MD5Prototype__byteLengthGetterWrap); -extern "C" JSC::EncodedJSValue FileSystemRouterPrototype__getRoutes(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(FileSystemRouterPrototype__routesGetterWrap); +extern "C" EncodedJSValue MD5Prototype__digest(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(MD5Prototype__digestCallback); -extern "C" JSC::EncodedJSValue FileSystemRouterPrototype__getStyle(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(FileSystemRouterPrototype__styleGetterWrap); +extern "C" EncodedJSValue MD5Prototype__update(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(MD5Prototype__updateCallback); -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSFileSystemRouterPrototype, JSFileSystemRouterPrototype::Base); +STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSMD5Prototype, JSMD5Prototype::Base); -static const HashTableValue JSFileSystemRouterPrototypeTableValues[] = { - { "match"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, FileSystemRouterPrototype__matchCallback, 1 } }, - { "origin"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, FileSystemRouterPrototype__originGetterWrap, 0 } }, - { "reload"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, FileSystemRouterPrototype__reloadCallback, 0 } }, - { "routes"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, FileSystemRouterPrototype__routesGetterWrap, 0 } }, - { "style"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, FileSystemRouterPrototype__styleGetterWrap, 0 } } +static const HashTableValue JSMD5PrototypeTableValues[] = { + { "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, MD5Prototype__byteLengthGetterWrap, 0 } }, + { "digest"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, MD5Prototype__digestCallback, 0 } }, + { "update"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, MD5Prototype__updateCallback, 1 } } }; -const ClassInfo JSFileSystemRouterPrototype::s_info = { "FileSystemRouter"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSFileSystemRouterPrototype) }; +const ClassInfo JSMD5Prototype::s_info = { "MD5"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSMD5Prototype) }; -JSC_DEFINE_CUSTOM_GETTER(jsFileSystemRouterConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) +JSC_DEFINE_CUSTOM_GETTER(jsMD5Constructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); auto* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); - auto* prototype = jsDynamicCast<JSFileSystemRouterPrototype*>(JSValue::decode(thisValue)); + auto* prototype = jsDynamicCast<JSMD5Prototype*>(JSValue::decode(thisValue)); 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()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } - - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - - return FileSystemRouterPrototype__match(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return JSValue::encode(globalObject->JSMD5Constructor()); } -JSC_DEFINE_CUSTOM_GETTER(FileSystemRouterPrototype__originGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(MD5Prototype__byteLengthGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); - JSFileSystemRouter* thisObject = jsCast<JSFileSystemRouter*>(JSValue::decode(thisValue)); + JSMD5* thisObject = jsCast<JSMD5*>(JSValue::decode(thisValue)); 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)); + JSC::EncodedJSValue result = MD5Prototype__getByteLength(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) -{ - auto* thisObject = jsCast<JSFileSystemRouter*>(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_origin.get()); + RELEASE_AND_RETURN(throwScope, result); } -JSC_DEFINE_HOST_FUNCTION(FileSystemRouterPrototype__reloadCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(MD5Prototype__digestCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSFileSystemRouter* thisObject = jsDynamicCast<JSFileSystemRouter*>(callFrame->thisValue()); + JSMD5* thisObject = jsDynamicCast<JSMD5*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -5543,105 +3548,67 @@ JSC_DEFINE_HOST_FUNCTION(FileSystemRouterPrototype__reloadCallback, (JSGlobalObj JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return FileSystemRouterPrototype__reload(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return MD5Prototype__digest(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_CUSTOM_GETTER(FileSystemRouterPrototype__routesGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_HOST_FUNCTION(MD5Prototype__updateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - 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); - if (JSValue cachedValue = thisObject->m_routes.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - 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)); -} + JSMD5* thisObject = jsDynamicCast<JSMD5*>(callFrame->thisValue()); -extern "C" EncodedJSValue FileSystemRouterPrototype__routesGetCachedValue(JSC::EncodedJSValue thisValue) -{ - auto* thisObject = jsCast<JSFileSystemRouter*>(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_routes.get()); -} + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } -JSC_DEFINE_CUSTOM_GETTER(FileSystemRouterPrototype__styleGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) -{ - auto& vm = lexicalGlobalObject->vm(); - 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); - if (JSValue cachedValue = thisObject->m_style.get()) - return JSValue::encode(cachedValue); - - JSC::JSValue result = JSC::JSValue::decode( - 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) -{ - auto* thisObject = jsCast<JSFileSystemRouter*>(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_style.get()); + return MD5Prototype__update(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -void JSFileSystemRouterPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) +void JSMD5Prototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) { Base::finishCreation(vm); - reifyStaticProperties(vm, JSFileSystemRouter::info(), JSFileSystemRouterPrototypeTableValues, *this); + reifyStaticProperties(vm, JSMD5::info(), JSMD5PrototypeTableValues, *this); JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); } -void JSFileSystemRouterConstructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSFileSystemRouterPrototype* prototype) -{ - Base::finishCreation(vm, 0, "FileSystemRouter"_s, PropertyAdditionMode::WithoutStructureTransition); +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), NoIntrinsic, { HashTableValue::GetterSetterType, MD5Class__getByteLengthStatic, 0 } }, + { "hash"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, MD5Class__hash, 2 } } +}; +void JSMD5Constructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSMD5Prototype* prototype) +{ + Base::finishCreation(vm, 0, "MD5"_s, PropertyAdditionMode::WithoutStructureTransition); + reifyStaticProperties(vm, &JSMD5Constructor::s_info, JSMD5ConstructorTableValues, *this); putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly); ASSERT(inherits(info())); } -JSFileSystemRouterConstructor::JSFileSystemRouterConstructor(JSC::VM& vm, JSC::Structure* structure) +JSMD5Constructor::JSMD5Constructor(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) +JSMD5Constructor* JSMD5Constructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSMD5Prototype* prototype) { - JSFileSystemRouterConstructor* ptr = new (NotNull, JSC::allocateCell<JSFileSystemRouterConstructor>(vm)) JSFileSystemRouterConstructor(vm, structure); + JSMD5Constructor* ptr = new (NotNull, JSC::allocateCell<JSMD5Constructor>(vm)) JSMD5Constructor(vm, structure); ptr->finishCreation(vm, globalObject, prototype); return ptr; } -JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSFileSystemRouterConstructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) +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(); JSObject* newTarget = asObject(callFrame->newTarget()); - auto* constructor = globalObject->JSFileSystemRouterConstructor(); - Structure* structure = globalObject->JSFileSystemRouterStructure(); + auto* constructor = globalObject->JSMD5Constructor(); + Structure* structure = globalObject->JSMD5Structure(); if (constructor != newTarget) { auto scope = DECLARE_THROW_SCOPE(vm); @@ -5652,65 +3619,65 @@ JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSFileSystemRouterConstructor::cons structure = InternalFunction::createSubclassStructure( globalObject, newTarget, - functionGlobalObject->JSFileSystemRouterStructure()); + functionGlobalObject->JSMD5Structure()); } - void* ptr = FileSystemRouterClass__construct(globalObject, callFrame); + void* ptr = MD5Class__construct(globalObject, callFrame); if (UNLIKELY(!ptr)) { return JSValue::encode(JSC::jsUndefined()); } - JSFileSystemRouter* instance = JSFileSystemRouter::create(vm, globalObject, structure, ptr); + JSMD5* instance = JSMD5::create(vm, globalObject, structure, ptr); return JSValue::encode(instance); } -void JSFileSystemRouterConstructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSFileSystemRouterPrototype* prototype) +void JSMD5Constructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSMD5Prototype* prototype) { } -const ClassInfo JSFileSystemRouterConstructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSFileSystemRouterConstructor) }; +const ClassInfo JSMD5Constructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSMD5Constructor) }; -extern "C" EncodedJSValue FileSystemRouter__getConstructor(Zig::GlobalObject* globalObject) +extern "C" EncodedJSValue MD5__getConstructor(Zig::GlobalObject* globalObject) { - return JSValue::encode(globalObject->JSFileSystemRouterConstructor()); + return JSValue::encode(globalObject->JSMD5Constructor()); } -JSFileSystemRouter::~JSFileSystemRouter() +JSMD5::~JSMD5() { if (m_ctx) { - FileSystemRouterClass__finalize(m_ctx); + MD5Class__finalize(m_ctx); } } -void JSFileSystemRouter::destroy(JSCell* cell) +void JSMD5::destroy(JSCell* cell) { - static_cast<JSFileSystemRouter*>(cell)->JSFileSystemRouter::~JSFileSystemRouter(); + static_cast<JSMD5*>(cell)->JSMD5::~JSMD5(); } -const ClassInfo JSFileSystemRouter::s_info = { "FileSystemRouter"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSFileSystemRouter) }; +const ClassInfo JSMD5::s_info = { "MD5"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSMD5) }; -void JSFileSystemRouter::finishCreation(VM& vm) +void JSMD5::finishCreation(VM& vm) { Base::finishCreation(vm); ASSERT(inherits(info())); } -JSFileSystemRouter* JSFileSystemRouter::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) +JSMD5* JSMD5::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) { - JSFileSystemRouter* ptr = new (NotNull, JSC::allocateCell<JSFileSystemRouter>(vm)) JSFileSystemRouter(vm, structure, ctx); + JSMD5* ptr = new (NotNull, JSC::allocateCell<JSMD5>(vm)) JSMD5(vm, structure, ctx); ptr->finishCreation(vm); return ptr; } -extern "C" void* FileSystemRouter__fromJS(JSC::EncodedJSValue value) +extern "C" void* MD5__fromJS(JSC::EncodedJSValue value) { JSC::JSValue decodedValue = JSC::JSValue::decode(value); if (decodedValue.isEmpty() || !decodedValue.isCell()) return nullptr; JSC::JSCell* cell = decodedValue.asCell(); - JSFileSystemRouter* object = JSC::jsDynamicCast<JSFileSystemRouter*>(cell); + JSMD5* object = JSC::jsDynamicCast<JSMD5*>(cell); if (!object) return nullptr; @@ -5718,9 +3685,9 @@ extern "C" void* FileSystemRouter__fromJS(JSC::EncodedJSValue value) return object->wrapped(); } -extern "C" bool FileSystemRouter__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) +extern "C" bool MD5__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) { - JSFileSystemRouter* object = JSC::jsDynamicCast<JSFileSystemRouter*>(JSValue::decode(value)); + JSMD5* object = JSC::jsDynamicCast<JSMD5*>(JSValue::decode(value)); if (!object) return false; @@ -5728,11 +3695,11 @@ extern "C" bool FileSystemRouter__dangerouslySetPtr(JSC::EncodedJSValue value, v return true; } -extern "C" const size_t FileSystemRouter__ptrOffset = JSFileSystemRouter::offsetOfWrapped(); +extern "C" const size_t MD5__ptrOffset = JSMD5::offsetOfWrapped(); -void JSFileSystemRouter::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) +void JSMD5::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) { - auto* thisObject = jsCast<JSFileSystemRouter*>(cell); + auto* thisObject = jsCast<JSMD5*>(cell); if (void* wrapped = thisObject->wrapped()) { // if (thisObject->scriptExecutionContext()) // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); @@ -5740,62 +3707,24 @@ void JSFileSystemRouter::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) Base::analyzeHeap(cell, analyzer); } -JSObject* JSFileSystemRouter::createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype) +JSObject* JSMD5::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::JSMD5Constructor::create(vm, globalObject, WebCore::JSMD5Constructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast<WebCore::JSMD5Prototype*>(prototype)); } -JSObject* JSFileSystemRouter::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) +JSObject* JSMD5::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) { - return JSFileSystemRouterPrototype::create(vm, globalObject, JSFileSystemRouterPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); + return JSMD5Prototype::create(vm, globalObject, JSMD5Prototype::createStructure(vm, globalObject, globalObject->objectPrototype())); } -extern "C" EncodedJSValue FileSystemRouter__create(Zig::GlobalObject* globalObject, void* ptr) +extern "C" EncodedJSValue MD5__create(Zig::GlobalObject* globalObject, void* ptr) { auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSFileSystemRouterStructure(); - JSFileSystemRouter* instance = JSFileSystemRouter::create(vm, globalObject, structure, ptr); + JSC::Structure* structure = globalObject->JSMD5Structure(); + JSMD5* instance = JSMD5::create(vm, globalObject, structure, ptr); return JSValue::encode(instance); } - -template<typename Visitor> -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); - -template<typename Visitor> -void JSFileSystemRouter::visitAdditionalChildren(Visitor& visitor) -{ - JSFileSystemRouter* thisObject = this; - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - - visitor.append(thisObject->m_origin); - visitor.append(thisObject->m_routes); - visitor.append(thisObject->m_style); - ; -} - -DEFINE_VISIT_ADDITIONAL_CHILDREN(JSFileSystemRouter); - -template<typename Visitor> -void JSFileSystemRouter::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) -{ - JSFileSystemRouter* thisObject = jsCast<JSFileSystemRouter*>(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - thisObject->visitAdditionalChildren<Visitor>(visitor); -} - -DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSFileSystemRouter); class JSMatchedRoutePrototype final : public JSC::JSNonFinalObject { public: using Base = JSC::JSNonFinalObject; @@ -6259,13 +4188,13 @@ void JSMatchedRoute::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) } DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSMatchedRoute); -class JSExpectPrototype final : public JSC::JSNonFinalObject { +class JSNodeJSFSPrototype final : public JSC::JSNonFinalObject { public: using Base = JSC::JSNonFinalObject; - static JSExpectPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) + static JSNodeJSFSPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) { - JSExpectPrototype* ptr = new (NotNull, JSC::allocateCell<JSExpectPrototype>(vm)) JSExpectPrototype(vm, globalObject, structure); + JSNodeJSFSPrototype* ptr = new (NotNull, JSC::allocateCell<JSNodeJSFSPrototype>(vm)) JSNodeJSFSPrototype(vm, globalObject, structure); ptr->finishCreation(vm, globalObject); return ptr; } @@ -6282,7 +4211,7 @@ public: } private: - JSExpectPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) + JSNodeJSFSPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) : Base(vm, structure) { } @@ -6290,10 +4219,10 @@ private: void finishCreation(JSC::VM&, JSC::JSGlobalObject*); }; -class JSExpectConstructor final : public JSC::InternalFunction { +class JSNodeJSFSConstructor final : public JSC::InternalFunction { public: using Base = JSC::InternalFunction; - static JSExpectConstructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSExpectPrototype* prototype); + 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; @@ -6307,15 +4236,15 @@ public: { if constexpr (mode == JSC::SubspaceAccess::Concurrently) return nullptr; - return WebCore::subspaceForImpl<JSExpectConstructor, WebCore::UseCustomHeapCellType::No>( + return WebCore::subspaceForImpl<JSNodeJSFSConstructor, WebCore::UseCustomHeapCellType::No>( vm, - [](auto& spaces) { return spaces.m_clientSubspaceForExpectConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForExpectConstructor = WTFMove(space); }, - [](auto& spaces) { return spaces.m_subspaceForExpectConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForExpectConstructor = WTFMove(space); }); + [](auto& spaces) { return spaces.m_clientSubspaceForNodeJSFSConstructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForNodeJSFSConstructor = WTFMove(space); }, + [](auto& spaces) { return spaces.m_subspaceForNodeJSFSConstructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForNodeJSFSConstructor = WTFMove(space); }); } - void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSExpectPrototype* prototype); + 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*); @@ -6323,223 +4252,410 @@ public: DECLARE_EXPORT_INFO; private: - JSExpectConstructor(JSC::VM& vm, JSC::Structure* structure); - void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSExpectPrototype* prototype); + JSNodeJSFSConstructor(JSC::VM& vm, JSC::Structure* structure); + void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSNodeJSFSPrototype* 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" void* NodeJSFSClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); +JSC_DECLARE_CUSTOM_GETTER(jsNodeJSFSConstructor); +extern "C" void NodeJSFSClass__finalize(void*); -extern "C" JSC::EncodedJSValue ExpectPrototype__getNot(void* ptr, JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(ExpectPrototype__notGetterWrap); +extern "C" EncodedJSValue NodeJSFSPrototype__access(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__accessCallback); -extern "C" JSC::EncodedJSValue ExpectPrototype__getRejects(void* ptr, JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(ExpectPrototype__rejectsGetterWrap); +extern "C" EncodedJSValue NodeJSFSPrototype__accessSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__accessSyncCallback); -extern "C" JSC::EncodedJSValue ExpectPrototype__getResolves(void* ptr, JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(ExpectPrototype__resolvesGetterWrap); +extern "C" EncodedJSValue NodeJSFSPrototype__appendFile(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__appendFileCallback); -extern "C" EncodedJSValue ExpectPrototype__toBe(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toBeCallback); +extern "C" EncodedJSValue NodeJSFSPrototype__appendFileSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__appendFileSyncCallback); -extern "C" EncodedJSValue ExpectPrototype__toBeCloseTo(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toBeCloseToCallback); +extern "C" EncodedJSValue NodeJSFSPrototype__chmod(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__chmodCallback); -extern "C" EncodedJSValue ExpectPrototype__toBeDefined(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toBeDefinedCallback); +extern "C" EncodedJSValue NodeJSFSPrototype__chmodSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__chmodSyncCallback); -extern "C" EncodedJSValue ExpectPrototype__toBeFalsy(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toBeFalsyCallback); +extern "C" EncodedJSValue NodeJSFSPrototype__chown(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__chownCallback); -extern "C" EncodedJSValue ExpectPrototype__toBeGreaterThan(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toBeGreaterThanCallback); +extern "C" EncodedJSValue NodeJSFSPrototype__chownSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__chownSyncCallback); -extern "C" EncodedJSValue ExpectPrototype__toBeGreaterThanOrEqual(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toBeGreaterThanOrEqualCallback); +extern "C" EncodedJSValue NodeJSFSPrototype__close(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__closeCallback); -extern "C" EncodedJSValue ExpectPrototype__toBeInstanceOf(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toBeInstanceOfCallback); +extern "C" EncodedJSValue NodeJSFSPrototype__closeSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__closeSyncCallback); -extern "C" EncodedJSValue ExpectPrototype__toBeLessThan(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toBeLessThanCallback); +extern "C" EncodedJSValue NodeJSFSPrototype__copyFile(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__copyFileCallback); -extern "C" EncodedJSValue ExpectPrototype__toBeLessThanOrEqual(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toBeLessThanOrEqualCallback); +extern "C" EncodedJSValue NodeJSFSPrototype__copyFileSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__copyFileSyncCallback); -extern "C" EncodedJSValue ExpectPrototype__toBeNaN(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toBeNaNCallback); +extern "C" JSC::EncodedJSValue NodeJSFSPrototype__getDirent(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); +JSC_DECLARE_CUSTOM_GETTER(NodeJSFSPrototype__DirentGetterWrap); -extern "C" EncodedJSValue ExpectPrototype__toBeNull(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toBeNullCallback); +extern "C" EncodedJSValue NodeJSFSPrototype__exists(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__existsCallback); -extern "C" EncodedJSValue ExpectPrototype__toBeTruthy(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toBeTruthyCallback); +extern "C" EncodedJSValue NodeJSFSPrototype__existsSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__existsSyncCallback); -extern "C" EncodedJSValue ExpectPrototype__toBeUndefined(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toBeUndefinedCallback); +extern "C" EncodedJSValue NodeJSFSPrototype__fchmod(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__fchmodCallback); -extern "C" EncodedJSValue ExpectPrototype__toContain(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toContainCallback); +extern "C" EncodedJSValue NodeJSFSPrototype__fchmodSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__fchmodSyncCallback); -extern "C" EncodedJSValue ExpectPrototype__toContainEqual(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toContainEqualCallback); +extern "C" EncodedJSValue NodeJSFSPrototype__fchown(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__fchownCallback); -extern "C" EncodedJSValue ExpectPrototype__toEqual(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toEqualCallback); +extern "C" EncodedJSValue NodeJSFSPrototype__fchownSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__fchownSyncCallback); -extern "C" EncodedJSValue ExpectPrototype__toHaveBeenCalledTimes(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toHaveBeenCalledTimesCallback); +extern "C" EncodedJSValue NodeJSFSPrototype__fdatasync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__fdatasyncCallback); -extern "C" EncodedJSValue ExpectPrototype__toHaveBeenCalledWith(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toHaveBeenCalledWithCallback); +extern "C" EncodedJSValue NodeJSFSPrototype__fdatasyncSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__fdatasyncSyncCallback); -extern "C" EncodedJSValue ExpectPrototype__toHaveBeenLastCalledWith(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toHaveBeenLastCalledWithCallback); +extern "C" EncodedJSValue NodeJSFSPrototype__fstat(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__fstatCallback); -extern "C" EncodedJSValue ExpectPrototype__toHaveBeenNthCalledWith(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toHaveBeenNthCalledWithCallback); +extern "C" EncodedJSValue NodeJSFSPrototype__fstatSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__fstatSyncCallback); -extern "C" EncodedJSValue ExpectPrototype__toHaveLastReturnedWith(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toHaveLastReturnedWithCallback); +extern "C" EncodedJSValue NodeJSFSPrototype__fsync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__fsyncCallback); -extern "C" EncodedJSValue ExpectPrototype__toHaveLength(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toHaveLengthCallback); +extern "C" EncodedJSValue NodeJSFSPrototype__fsyncSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__fsyncSyncCallback); -extern "C" EncodedJSValue ExpectPrototype__toHaveNthReturnedWith(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toHaveNthReturnedWithCallback); +extern "C" EncodedJSValue NodeJSFSPrototype__ftruncate(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__ftruncateCallback); -extern "C" EncodedJSValue ExpectPrototype__toHaveProperty(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toHavePropertyCallback); +extern "C" EncodedJSValue NodeJSFSPrototype__ftruncateSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__ftruncateSyncCallback); -extern "C" EncodedJSValue ExpectPrototype__toHaveReturnedTimes(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toHaveReturnedTimesCallback); +extern "C" EncodedJSValue NodeJSFSPrototype__futimes(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__futimesCallback); -extern "C" EncodedJSValue ExpectPrototype__toHaveReturnedWith(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toHaveReturnedWithCallback); +extern "C" EncodedJSValue NodeJSFSPrototype__futimesSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__futimesSyncCallback); -extern "C" EncodedJSValue ExpectPrototype__toMatch(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toMatchCallback); +extern "C" EncodedJSValue NodeJSFSPrototype__lchmod(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__lchmodCallback); -extern "C" EncodedJSValue ExpectPrototype__toMatchInlineSnapshot(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toMatchInlineSnapshotCallback); +extern "C" EncodedJSValue NodeJSFSPrototype__lchmodSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__lchmodSyncCallback); -extern "C" EncodedJSValue ExpectPrototype__toMatchObject(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toMatchObjectCallback); +extern "C" EncodedJSValue NodeJSFSPrototype__lchown(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__lchownCallback); -extern "C" EncodedJSValue ExpectPrototype__toMatchSnapshot(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toMatchSnapshotCallback); +extern "C" EncodedJSValue NodeJSFSPrototype__lchownSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__lchownSyncCallback); -extern "C" EncodedJSValue ExpectPrototype__toStrictEqual(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toStrictEqualCallback); +extern "C" EncodedJSValue NodeJSFSPrototype__link(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__linkCallback); -extern "C" EncodedJSValue ExpectPrototype__toThrow(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toThrowCallback); +extern "C" EncodedJSValue NodeJSFSPrototype__linkSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__linkSyncCallback); -extern "C" EncodedJSValue ExpectPrototype__toThrowErrorMatchingInlineSnapshot(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toThrowErrorMatchingInlineSnapshotCallback); +extern "C" EncodedJSValue NodeJSFSPrototype__lstat(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__lstatCallback); -extern "C" EncodedJSValue ExpectPrototype__toThrowErrorMatchingSnapshot(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(ExpectPrototype__toThrowErrorMatchingSnapshotCallback); +extern "C" EncodedJSValue NodeJSFSPrototype__lstatSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__lstatSyncCallback); -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSExpectPrototype, JSExpectPrototype::Base); +extern "C" EncodedJSValue NodeJSFSPrototype__lutimes(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__lutimesCallback); -static const HashTableValue JSExpectPrototypeTableValues[] = { - { "not"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, ExpectPrototype__notGetterWrap, 0 } }, - { "rejects"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, ExpectPrototype__rejectsGetterWrap, 0 } }, - { "resolves"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, ExpectPrototype__resolvesGetterWrap, 0 } }, - { "toBe"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeCallback, 1 } }, - { "toBeCloseTo"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeCloseToCallback, 1 } }, - { "toBeDefined"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeDefinedCallback, 0 } }, - { "toBeFalsy"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeFalsyCallback, 0 } }, - { "toBeGreaterThan"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeGreaterThanCallback, 1 } }, - { "toBeGreaterThanOrEqual"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeGreaterThanOrEqualCallback, 1 } }, - { "toBeInstanceOf"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeInstanceOfCallback, 1 } }, - { "toBeLessThan"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeLessThanCallback, 1 } }, - { "toBeLessThanOrEqual"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeLessThanOrEqualCallback, 1 } }, - { "toBeNaN"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeNaNCallback, 0 } }, - { "toBeNull"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeNullCallback, 0 } }, - { "toBeTruthy"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeTruthyCallback, 0 } }, - { "toBeUndefined"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toBeUndefinedCallback, 0 } }, - { "toContain"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toContainCallback, 1 } }, - { "toContainEqual"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toContainEqualCallback, 1 } }, - { "toEqual"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toEqualCallback, 1 } }, - { "toHaveBeenCalledTimes"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toHaveBeenCalledTimesCallback, 1 } }, - { "toHaveBeenCalledWith"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toHaveBeenCalledWithCallback, 1 } }, - { "toHaveBeenLastCalledWith"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toHaveBeenLastCalledWithCallback, 1 } }, - { "toHaveBeenNthCalledWith"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toHaveBeenNthCalledWithCallback, 1 } }, - { "toHaveLastReturnedWith"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toHaveLastReturnedWithCallback, 1 } }, - { "toHaveLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toHaveLengthCallback, 1 } }, - { "toHaveNthReturnedWith"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toHaveNthReturnedWithCallback, 1 } }, - { "toHaveProperty"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toHavePropertyCallback, 2 } }, - { "toHaveReturnedTimes"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toHaveReturnedTimesCallback, 1 } }, - { "toHaveReturnedWith"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toHaveReturnedWithCallback, 1 } }, - { "toMatch"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toMatchCallback, 1 } }, - { "toMatchInlineSnapshot"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toMatchInlineSnapshotCallback, 1 } }, - { "toMatchObject"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toMatchObjectCallback, 1 } }, - { "toMatchSnapshot"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toMatchSnapshotCallback, 1 } }, - { "toStrictEqual"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toStrictEqualCallback, 1 } }, - { "toThrow"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toThrowCallback, 1 } }, - { "toThrowErrorMatchingInlineSnapshot"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toThrowErrorMatchingInlineSnapshotCallback, 1 } }, - { "toThrowErrorMatchingSnapshot"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectPrototype__toThrowErrorMatchingSnapshotCallback, 1 } } +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" 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), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__accessCallback, 3 } }, + { "accessSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__accessSyncCallback, 2 } }, + { "appendFile"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__appendFileCallback, 4 } }, + { "appendFileSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__appendFileSyncCallback, 3 } }, + { "chmod"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__chmodCallback, 3 } }, + { "chmodSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__chmodSyncCallback, 2 } }, + { "chown"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__chownCallback, 4 } }, + { "chownSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__chownSyncCallback, 3 } }, + { "close"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__closeCallback, 1 } }, + { "closeSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__closeSyncCallback, 1 } }, + { "copyFile"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__copyFileCallback, 4 } }, + { "copyFileSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__copyFileSyncCallback, 3 } }, + { "Dirent"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, NodeJSFSPrototype__DirentGetterWrap, 0 } }, + { "exists"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__existsCallback, 2 } }, + { "existsSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__existsSyncCallback, 1 } }, + { "fchmod"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__fchmodCallback, 3 } }, + { "fchmodSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__fchmodSyncCallback, 2 } }, + { "fchown"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__fchownCallback, 4 } }, + { "fchownSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__fchownSyncCallback, 3 } }, + { "fdatasync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__fdatasyncCallback, 2 } }, + { "fdatasyncSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__fdatasyncSyncCallback, 1 } }, + { "fstat"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__fstatCallback, 1 } }, + { "fstatSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__fstatSyncCallback, 1 } }, + { "fsync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__fsyncCallback, 2 } }, + { "fsyncSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__fsyncSyncCallback, 1 } }, + { "ftruncate"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__ftruncateCallback, 1 } }, + { "ftruncateSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__ftruncateSyncCallback, 1 } }, + { "futimes"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__futimesCallback, 4 } }, + { "futimesSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__futimesSyncCallback, 3 } }, + { "lchmod"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__lchmodCallback, 3 } }, + { "lchmodSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__lchmodSyncCallback, 2 } }, + { "lchown"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__lchownCallback, 4 } }, + { "lchownSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__lchownSyncCallback, 3 } }, + { "link"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__linkCallback, 3 } }, + { "linkSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__linkSyncCallback, 2 } }, + { "lstat"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__lstatCallback, 1 } }, + { "lstatSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__lstatSyncCallback, 1 } }, + { "lutimes"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__lutimesCallback, 4 } }, + { "lutimesSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__lutimesSyncCallback, 3 } }, + { "mkdir"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__mkdirCallback, 3 } }, + { "mkdirSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__mkdirSyncCallback, 2 } }, + { "mkdtemp"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__mkdtempCallback, 3 } }, + { "mkdtempSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__mkdtempSyncCallback, 2 } }, + { "open"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__openCallback, 4 } }, + { "opendir"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__opendirCallback, 3 } }, + { "opendirSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__opendirSyncCallback, 2 } }, + { "openSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__openSyncCallback, 3 } }, + { "read"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__readCallback, 6 } }, + { "readdir"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__readdirCallback, 3 } }, + { "readdirSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__readdirSyncCallback, 2 } }, + { "readFile"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__readFileCallback, 3 } }, + { "readFileSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__readFileSyncCallback, 2 } }, + { "readlink"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__readlinkCallback, 3 } }, + { "readlinkSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__readlinkSyncCallback, 2 } }, + { "readSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__readSyncCallback, 5 } }, + { "readv"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__readvCallback, 4 } }, + { "readvSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__readvSyncCallback, 3 } }, + { "realpath"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__realpathCallback, 3 } }, + { "realpathSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__realpathSyncCallback, 2 } }, + { "rename"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__renameCallback, 3 } }, + { "renameSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__renameSyncCallback, 2 } }, + { "rm"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__rmCallback, 3 } }, + { "rmdir"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__rmdirCallback, 3 } }, + { "rmdirSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__rmdirSyncCallback, 2 } }, + { "rmSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__rmSyncCallback, 2 } }, + { "stat"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__statCallback, 1 } }, + { "statSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__statSyncCallback, 1 } }, + { "symlink"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__symlinkCallback, 4 } }, + { "symlinkSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__symlinkSyncCallback, 3 } }, + { "truncate"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__truncateCallback, 3 } }, + { "truncateSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__truncateSyncCallback, 2 } }, + { "unlink"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__unlinkCallback, 2 } }, + { "unlinkSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__unlinkSyncCallback, 1 } }, + { "utimes"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__utimesCallback, 4 } }, + { "utimesSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__utimesSyncCallback, 3 } }, + { "write"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__writeCallback, 6 } }, + { "writeFile"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__writeFileCallback, 4 } }, + { "writeFileSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__writeFileSyncCallback, 3 } }, + { "writeSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__writeSyncCallback, 5 } }, + { "writev"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__writevCallback, 4 } }, + { "writevSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__writevSyncCallback, 3 } } }; -const ClassInfo JSExpectPrototype::s_info = { "Expect"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSExpectPrototype) }; +const ClassInfo JSNodeJSFSPrototype::s_info = { "NodeJSFS"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSNodeJSFSPrototype) }; -JSC_DEFINE_CUSTOM_GETTER(jsExpectConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) +JSC_DEFINE_CUSTOM_GETTER(jsNodeJSFSConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); auto* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); - auto* prototype = jsDynamicCast<JSExpectPrototype*>(JSValue::decode(thisValue)); + auto* prototype = jsDynamicCast<JSNodeJSFSPrototype*>(JSValue::decode(thisValue)); if (UNLIKELY(!prototype)) return throwVMTypeError(lexicalGlobalObject, throwScope); - return JSValue::encode(globalObject->JSExpectConstructor()); + return JSValue::encode(globalObject->JSNodeJSFSConstructor()); } -JSC_DEFINE_CUSTOM_GETTER(ExpectPrototype__notGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__accessCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSExpect* thisObject = jsCast<JSExpect*>(JSValue::decode(thisValue)); + + 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); - JSC::EncodedJSValue result = ExpectPrototype__getNot(thisObject->wrapped(), thisValue, globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); + + return NodeJSFSPrototype__access(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_CUSTOM_GETTER(ExpectPrototype__rejectsGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__accessSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSExpect* thisObject = jsCast<JSExpect*>(JSValue::decode(thisValue)); + + 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); - JSC::EncodedJSValue result = ExpectPrototype__getRejects(thisObject->wrapped(), thisValue, globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); + + return NodeJSFSPrototype__accessSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_CUSTOM_GETTER(ExpectPrototype__resolvesGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__appendFileCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSExpect* thisObject = jsCast<JSExpect*>(JSValue::decode(thisValue)); + + 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); - JSC::EncodedJSValue result = ExpectPrototype__getResolves(thisObject->wrapped(), thisValue, globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); + + return NodeJSFSPrototype__appendFile(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__appendFileSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -6548,14 +4664,14 @@ JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeCallback, (JSGlobalObject * lexica JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return ExpectPrototype__toBe(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return NodeJSFSPrototype__appendFileSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeCloseToCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__chmodCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -6564,14 +4680,14 @@ JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeCloseToCallback, (JSGlobalObject * JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return ExpectPrototype__toBeCloseTo(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return NodeJSFSPrototype__chmod(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeDefinedCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__chmodSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -6580,14 +4696,14 @@ JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeDefinedCallback, (JSGlobalObject * JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return ExpectPrototype__toBeDefined(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return NodeJSFSPrototype__chmodSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeFalsyCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__chownCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -6596,14 +4712,14 @@ JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeFalsyCallback, (JSGlobalObject * l JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return ExpectPrototype__toBeFalsy(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return NodeJSFSPrototype__chown(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeGreaterThanCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__chownSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -6612,14 +4728,14 @@ JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeGreaterThanCallback, (JSGlobalObje JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return ExpectPrototype__toBeGreaterThan(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return NodeJSFSPrototype__chownSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeGreaterThanOrEqualCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__closeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -6628,14 +4744,14 @@ JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeGreaterThanOrEqualCallback, (JSGlo JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return ExpectPrototype__toBeGreaterThanOrEqual(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return NodeJSFSPrototype__close(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeInstanceOfCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__closeSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -6644,14 +4760,14 @@ JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeInstanceOfCallback, (JSGlobalObjec JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return ExpectPrototype__toBeInstanceOf(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return NodeJSFSPrototype__closeSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeLessThanCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__copyFileCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -6660,14 +4776,14 @@ JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeLessThanCallback, (JSGlobalObject JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return ExpectPrototype__toBeLessThan(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return NodeJSFSPrototype__copyFile(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeLessThanOrEqualCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__copyFileSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -6676,14 +4792,26 @@ JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeLessThanOrEqualCallback, (JSGlobal JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return ExpectPrototype__toBeLessThanOrEqual(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return NodeJSFSPrototype__copyFileSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeNaNCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* 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); + auto throwScope = DECLARE_THROW_SCOPE(vm); + JSNodeJSFS* thisObject = jsCast<JSNodeJSFS*>(JSValue::decode(thisValue)); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC::EncodedJSValue result = NodeJSFSPrototype__getDirent(thisObject->wrapped(), globalObject); + RETURN_IF_EXCEPTION(throwScope, {}); + RELEASE_AND_RETURN(throwScope, result); +} - JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__existsCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + auto& vm = lexicalGlobalObject->vm(); + + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -6692,14 +4820,14 @@ JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeNaNCallback, (JSGlobalObject * lex JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return ExpectPrototype__toBeNaN(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return NodeJSFSPrototype__exists(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeNullCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__existsSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -6708,14 +4836,14 @@ JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeNullCallback, (JSGlobalObject * le JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return ExpectPrototype__toBeNull(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return NodeJSFSPrototype__existsSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeTruthyCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__fchmodCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -6724,14 +4852,14 @@ JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeTruthyCallback, (JSGlobalObject * JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return ExpectPrototype__toBeTruthy(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return NodeJSFSPrototype__fchmod(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeUndefinedCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__fchmodSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -6740,14 +4868,14 @@ JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toBeUndefinedCallback, (JSGlobalObject JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return ExpectPrototype__toBeUndefined(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return NodeJSFSPrototype__fchmodSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toContainCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__fchownCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -6756,14 +4884,14 @@ JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toContainCallback, (JSGlobalObject * l JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return ExpectPrototype__toContain(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return NodeJSFSPrototype__fchown(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toContainEqualCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__fchownSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -6772,14 +4900,14 @@ JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toContainEqualCallback, (JSGlobalObjec JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return ExpectPrototype__toContainEqual(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return NodeJSFSPrototype__fchownSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toEqualCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__fdatasyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -6788,14 +4916,14 @@ JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toEqualCallback, (JSGlobalObject * lex JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return ExpectPrototype__toEqual(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return NodeJSFSPrototype__fdatasync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toHaveBeenCalledTimesCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__fdatasyncSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -6804,14 +4932,14 @@ JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toHaveBeenCalledTimesCallback, (JSGlob JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return ExpectPrototype__toHaveBeenCalledTimes(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return NodeJSFSPrototype__fdatasyncSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toHaveBeenCalledWithCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__fstatCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -6820,14 +4948,14 @@ JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toHaveBeenCalledWithCallback, (JSGloba JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return ExpectPrototype__toHaveBeenCalledWith(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return NodeJSFSPrototype__fstat(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toHaveBeenLastCalledWithCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__fstatSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -6836,14 +4964,14 @@ JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toHaveBeenLastCalledWithCallback, (JSG JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return ExpectPrototype__toHaveBeenLastCalledWith(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return NodeJSFSPrototype__fstatSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toHaveBeenNthCalledWithCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__fsyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -6852,14 +4980,14 @@ JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toHaveBeenNthCalledWithCallback, (JSGl JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return ExpectPrototype__toHaveBeenNthCalledWith(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return NodeJSFSPrototype__fsync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toHaveLastReturnedWithCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__fsyncSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -6868,14 +4996,14 @@ JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toHaveLastReturnedWithCallback, (JSGlo JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return ExpectPrototype__toHaveLastReturnedWith(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return NodeJSFSPrototype__fsyncSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toHaveLengthCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__ftruncateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -6884,14 +5012,14 @@ JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toHaveLengthCallback, (JSGlobalObject JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return ExpectPrototype__toHaveLength(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return NodeJSFSPrototype__ftruncate(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toHaveNthReturnedWithCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__ftruncateSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -6900,14 +5028,14 @@ JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toHaveNthReturnedWithCallback, (JSGlob JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return ExpectPrototype__toHaveNthReturnedWith(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return NodeJSFSPrototype__ftruncateSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toHavePropertyCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__futimesCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -6916,14 +5044,14 @@ JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toHavePropertyCallback, (JSGlobalObjec JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return ExpectPrototype__toHaveProperty(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return NodeJSFSPrototype__futimes(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toHaveReturnedTimesCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__futimesSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -6932,14 +5060,14 @@ JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toHaveReturnedTimesCallback, (JSGlobal JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return ExpectPrototype__toHaveReturnedTimes(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return NodeJSFSPrototype__futimesSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toHaveReturnedWithCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__lchmodCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -6948,14 +5076,14 @@ JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toHaveReturnedWithCallback, (JSGlobalO JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return ExpectPrototype__toHaveReturnedWith(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return NodeJSFSPrototype__lchmod(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toMatchCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__lchmodSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -6964,14 +5092,14 @@ JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toMatchCallback, (JSGlobalObject * lex JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return ExpectPrototype__toMatch(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return NodeJSFSPrototype__lchmodSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toMatchInlineSnapshotCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__lchownCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -6980,14 +5108,14 @@ JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toMatchInlineSnapshotCallback, (JSGlob JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return ExpectPrototype__toMatchInlineSnapshot(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return NodeJSFSPrototype__lchown(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toMatchObjectCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__lchownSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -6996,14 +5124,14 @@ JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toMatchObjectCallback, (JSGlobalObject JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return ExpectPrototype__toMatchObject(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return NodeJSFSPrototype__lchownSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toMatchSnapshotCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__linkCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -7012,14 +5140,14 @@ JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toMatchSnapshotCallback, (JSGlobalObje JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return ExpectPrototype__toMatchSnapshot(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return NodeJSFSPrototype__link(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toStrictEqualCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__linkSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -7028,14 +5156,14 @@ JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toStrictEqualCallback, (JSGlobalObject JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return ExpectPrototype__toStrictEqual(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return NodeJSFSPrototype__linkSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toThrowCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__lstatCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -7044,14 +5172,14 @@ JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toThrowCallback, (JSGlobalObject * lex JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return ExpectPrototype__toThrow(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return NodeJSFSPrototype__lstat(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toThrowErrorMatchingInlineSnapshotCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__lstatSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -7060,14 +5188,14 @@ JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toThrowErrorMatchingInlineSnapshotCall JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return ExpectPrototype__toThrowErrorMatchingInlineSnapshot(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return NodeJSFSPrototype__lstatSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toThrowErrorMatchingSnapshotCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__lutimesCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSExpect* thisObject = jsDynamicCast<JSExpect*>(callFrame->thisValue()); + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -7076,376 +5204,606 @@ JSC_DEFINE_HOST_FUNCTION(ExpectPrototype__toThrowErrorMatchingSnapshotCallback, JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return ExpectPrototype__toThrowErrorMatchingSnapshot(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return NodeJSFSPrototype__lutimes(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -extern "C" void ExpectPrototype__capturedValueSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__lutimesSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { - auto& vm = globalObject->vm(); - auto* thisObject = jsCast<JSExpect*>(JSValue::decode(thisValue)); - thisObject->m_capturedValue.set(vm, thisObject, JSValue::decode(value)); + auto& vm = lexicalGlobalObject->vm(); + + 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__lutimesSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -extern "C" EncodedJSValue ExpectPrototype__capturedValueGetCachedValue(JSC::EncodedJSValue thisValue) +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__mkdirCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { - auto* thisObject = jsCast<JSExpect*>(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_capturedValue.get()); + auto& vm = lexicalGlobalObject->vm(); + + 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__mkdir(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -extern "C" void ExpectPrototype__resultValueSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__mkdirSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { - auto& vm = globalObject->vm(); - auto* thisObject = jsCast<JSExpect*>(JSValue::decode(thisValue)); - thisObject->m_resultValue.set(vm, thisObject, JSValue::decode(value)); + auto& vm = lexicalGlobalObject->vm(); + + 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__mkdirSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -extern "C" EncodedJSValue ExpectPrototype__resultValueGetCachedValue(JSC::EncodedJSValue thisValue) +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__mkdtempCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { - auto* thisObject = jsCast<JSExpect*>(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_resultValue.get()); + auto& vm = lexicalGlobalObject->vm(); + + 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__mkdtemp(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -void JSExpectPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__mkdtempSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { - Base::finishCreation(vm); - reifyStaticProperties(vm, JSExpect::info(), JSExpectPrototypeTableValues, *this); - JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); -} + auto& vm = lexicalGlobalObject->vm(); -extern "C" JSC_DECLARE_HOST_FUNCTION(ExpectClass__addSnapshotSerializer); -extern "C" JSC_DECLARE_HOST_FUNCTION(ExpectClass__any); -extern "C" JSC_DECLARE_HOST_FUNCTION(ExpectClass__anything); -extern "C" JSC_DECLARE_HOST_FUNCTION(ExpectClass__arrayContaining); -extern "C" JSC_DECLARE_HOST_FUNCTION(ExpectClass__assertions); -extern "C" JSC_DECLARE_HOST_FUNCTION(ExpectClass__extend); -extern "C" JSC_DECLARE_HOST_FUNCTION(ExpectClass__hasAssertions); -extern "C" JSC_DECLARE_CUSTOM_GETTER(ExpectClass__getStaticNot); -extern "C" JSC_DECLARE_HOST_FUNCTION(ExpectClass__objectContaining); -extern "C" JSC_DECLARE_CUSTOM_GETTER(ExpectClass__getStaticRejects); -extern "C" JSC_DECLARE_CUSTOM_GETTER(ExpectClass__getStaticResolves); -extern "C" JSC_DECLARE_HOST_FUNCTION(ExpectClass__stringContaining); -extern "C" JSC_DECLARE_HOST_FUNCTION(ExpectClass__stringMatching); + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -static const HashTableValue JSExpectConstructorTableValues[] = { - { "addSnapshotSerializer"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectClass__addSnapshotSerializer, 1 } }, - { "any"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectClass__any, 1 } }, - { "anything"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectClass__anything, 1 } }, - { "arrayContaining"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectClass__arrayContaining, 1 } }, - { "assertions"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectClass__assertions, 1 } }, - { "extend"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectClass__extend, 1 } }, - { "hasAssertions"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectClass__hasAssertions, 1 } }, - { "not"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, ExpectClass__getStaticNot, 0 } }, - { "objectContaining"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectClass__objectContaining, 1 } }, - { "rejects"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, ExpectClass__getStaticRejects, 0 } }, - { "resolves"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, ExpectClass__getStaticResolves, 0 } }, - { "stringContaining"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectClass__stringContaining, 1 } }, - { "stringMatching"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ExpectClass__stringMatching, 1 } } -}; + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } -void JSExpectConstructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSExpectPrototype* prototype) -{ - Base::finishCreation(vm, 0, "Expect"_s, PropertyAdditionMode::WithoutStructureTransition); - reifyStaticProperties(vm, &JSExpectConstructor::s_info, JSExpectConstructorTableValues, *this); - putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly); - ASSERT(inherits(info())); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + + return NodeJSFSPrototype__mkdtempSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSExpectConstructor::JSExpectConstructor(JSC::VM& vm, JSC::Structure* structure) - : Base(vm, structure, ExpectClass__call, construct) +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__openCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { + auto& vm = lexicalGlobalObject->vm(); + + 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__open(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSExpectConstructor* JSExpectConstructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSExpectPrototype* prototype) +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__opendirCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { - JSExpectConstructor* ptr = new (NotNull, JSC::allocateCell<JSExpectConstructor>(vm)) JSExpectConstructor(vm, structure); - ptr->finishCreation(vm, globalObject, prototype); - return ptr; + auto& vm = lexicalGlobalObject->vm(); + + 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__opendir(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSExpectConstructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__opendirSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { - 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& vm = lexicalGlobalObject->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()); + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); } - void* ptr = ExpectClass__construct(globalObject, callFrame); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - if (UNLIKELY(!ptr)) { - return JSValue::encode(JSC::jsUndefined()); + return NodeJSFSPrototype__opendirSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); +} + +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__openSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + auto& vm = lexicalGlobalObject->vm(); + + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); } - JSExpect* instance = JSExpect::create(vm, globalObject, structure, ptr); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return JSValue::encode(instance); + return NodeJSFSPrototype__openSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -void JSExpectConstructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSExpectPrototype* prototype) +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__readCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { -} + auto& vm = lexicalGlobalObject->vm(); -const ClassInfo JSExpectConstructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSExpectConstructor) }; + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -extern "C" EncodedJSValue Expect__getConstructor(Zig::GlobalObject* globalObject) -{ - return JSValue::encode(globalObject->JSExpectConstructor()); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } + + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + + return NodeJSFSPrototype__read(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSExpect::~JSExpect() +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__readdirCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { - if (m_ctx) { - ExpectClass__finalize(m_ctx); + auto& vm = lexicalGlobalObject->vm(); + + 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__readdir(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -void JSExpect::destroy(JSCell* cell) + +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__readdirSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { - static_cast<JSExpect*>(cell)->JSExpect::~JSExpect(); -} + auto& vm = lexicalGlobalObject->vm(); -const ClassInfo JSExpect::s_info = { "Expect"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSExpect) }; + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -void JSExpect::finishCreation(VM& vm) + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } + + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + + return NodeJSFSPrototype__readdirSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); +} + +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__readFileCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { - Base::finishCreation(vm); - ASSERT(inherits(info())); + auto& vm = lexicalGlobalObject->vm(); + + 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__readFile(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSExpect* JSExpect::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__readFileSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { - JSExpect* ptr = new (NotNull, JSC::allocateCell<JSExpect>(vm)) JSExpect(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; + auto& vm = lexicalGlobalObject->vm(); + + 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__readFileSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -extern "C" void* Expect__fromJS(JSC::EncodedJSValue value) +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__readlinkCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { - JSC::JSValue decodedValue = JSC::JSValue::decode(value); - if (decodedValue.isEmpty() || !decodedValue.isCell()) - return nullptr; + auto& vm = lexicalGlobalObject->vm(); - JSC::JSCell* cell = decodedValue.asCell(); - JSExpect* object = JSC::jsDynamicCast<JSExpect*>(cell); + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); - if (!object) - return nullptr; + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } - return object->wrapped(); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + + return NodeJSFSPrototype__readlink(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -extern "C" bool Expect__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__readlinkSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { - JSExpect* object = JSC::jsDynamicCast<JSExpect*>(JSValue::decode(value)); - if (!object) - return false; + auto& vm = lexicalGlobalObject->vm(); - object->m_ctx = ptr; - return true; + 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__readlinkSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -extern "C" const size_t Expect__ptrOffset = JSExpect::offsetOfWrapped(); +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__readSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + auto& vm = lexicalGlobalObject->vm(); -void JSExpect::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) + 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__readSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); +} + +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__readvCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { - auto* thisObject = jsCast<JSExpect*>(cell); - if (void* wrapped = thisObject->wrapped()) { - // if (thisObject->scriptExecutionContext()) - // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); + auto& vm = lexicalGlobalObject->vm(); + + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); } - Base::analyzeHeap(cell, analyzer); + + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + + return NodeJSFSPrototype__readv(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSObject* JSExpect::createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype) +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__readvSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { - return WebCore::JSExpectConstructor::create(vm, globalObject, WebCore::JSExpectConstructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast<WebCore::JSExpectPrototype*>(prototype)); + auto& vm = lexicalGlobalObject->vm(); + + 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__readvSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSObject* JSExpect::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__realpathCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { - return JSExpectPrototype::create(vm, globalObject, JSExpectPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); + auto& vm = lexicalGlobalObject->vm(); + + 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__realpath(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -extern "C" EncodedJSValue Expect__create(Zig::GlobalObject* globalObject, void* ptr) +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__realpathSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSExpectStructure(); - JSExpect* instance = JSExpect::create(vm, globalObject, structure, ptr); + auto& vm = lexicalGlobalObject->vm(); - return JSValue::encode(instance); + 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__realpathSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -template<typename Visitor> -void JSExpect::visitChildrenImpl(JSCell* cell, Visitor& visitor) +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__renameCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { - JSExpect* thisObject = jsCast<JSExpect*>(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - Base::visitChildren(thisObject, visitor); - visitor.append(thisObject->m_capturedValue); - visitor.append(thisObject->m_resultValue); + auto& vm = lexicalGlobalObject->vm(); + + 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__rename(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -DEFINE_VISIT_CHILDREN(JSExpect); +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__renameSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + auto& vm = lexicalGlobalObject->vm(); -template<typename Visitor> -void JSExpect::visitAdditionalChildren(Visitor& visitor) + 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__renameSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); +} + +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__rmCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { - JSExpect* thisObject = this; - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - visitor.append(thisObject->m_capturedValue); - visitor.append(thisObject->m_resultValue); + auto& vm = lexicalGlobalObject->vm(); - ; + 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__rm(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -DEFINE_VISIT_ADDITIONAL_CHILDREN(JSExpect); +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__rmdirCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + auto& vm = lexicalGlobalObject->vm(); -template<typename Visitor> -void JSExpect::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) + 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__rmdir(thisObject->wrapped(), lexicalGlobalObject, callFrame); +} + +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__rmdirSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { - JSExpect* thisObject = jsCast<JSExpect*>(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - thisObject->visitAdditionalChildren<Visitor>(visitor); + auto& vm = lexicalGlobalObject->vm(); + + 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__rmdirSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSExpect); -class JSTextDecoderPrototype final : public JSC::JSNonFinalObject { -public: - using Base = JSC::JSNonFinalObject; +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__rmSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + auto& vm = lexicalGlobalObject->vm(); - 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; + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); } - DECLARE_INFO; - template<typename CellType, JSC::SubspaceAccess> - static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) - { - return &vm.plainObjectSpace(); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + + return NodeJSFSPrototype__rmSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); +} + +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__statCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + auto& vm = lexicalGlobalObject->vm(); + + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); } - 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()); + + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + + return NodeJSFSPrototype__stat(thisObject->wrapped(), lexicalGlobalObject, callFrame); +} + +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__statSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + auto& vm = lexicalGlobalObject->vm(); + + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); } -private: - JSTextDecoderPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) - : Base(vm, structure) - { + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + + return NodeJSFSPrototype__statSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); +} + +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__symlinkCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + auto& vm = lexicalGlobalObject->vm(); + + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); } - void finishCreation(JSC::VM&, JSC::JSGlobalObject*); -}; + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); -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); + return NodeJSFSPrototype__symlink(thisObject->wrapped(), lexicalGlobalObject, callFrame); +} - static constexpr unsigned StructureFlags = Base::StructureFlags; - static constexpr bool needsDestruction = false; +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__symlinkSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + auto& vm = lexicalGlobalObject->vm(); - 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()); + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); } - 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 = WTFMove(space); }, - [](auto& spaces) { return spaces.m_subspaceForTextDecoderConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForTextDecoderConstructor = WTFMove(space); }); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + + return NodeJSFSPrototype__symlinkSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); +} + +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__truncateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + auto& vm = lexicalGlobalObject->vm(); + + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); } - void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSTextDecoderPrototype* prototype); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - // Must be defined for each specialization class. - static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); + return NodeJSFSPrototype__truncate(thisObject->wrapped(), lexicalGlobalObject, callFrame); +} - DECLARE_EXPORT_INFO; +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__truncateSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + auto& vm = lexicalGlobalObject->vm(); -private: - JSTextDecoderConstructor(JSC::VM& vm, JSC::Structure* structure); - void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSTextDecoderPrototype* prototype); -}; + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -extern "C" void* TextDecoderClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); -JSC_DECLARE_CUSTOM_GETTER(jsTextDecoderConstructor); -extern "C" void TextDecoderClass__finalize(void*); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } -extern "C" EncodedJSValue TextDecoderPrototype__decode(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(TextDecoderPrototype__decodeCallback); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); -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); + return NodeJSFSPrototype__truncateSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); +} -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_HOST_FUNCTION(NodeJSFSPrototype__unlinkCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + auto& vm = lexicalGlobalObject->vm(); -JSC_DEFINE_JIT_OPERATION(TextDecoderPrototype__decodeWithoutTypeChecksWrapper, EncodedJSValue, (JSC::JSGlobalObject * lexicalGlobalObject, void* thisValue, JSC::JSUint8Array* arg0)) + 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__unlink(thisObject->wrapped(), lexicalGlobalObject, callFrame); +} + +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__unlinkSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { - VM& vm = JSC::getVM(lexicalGlobalObject); - IGNORE_WARNINGS_BEGIN("frame-address") - CallFrame* callFrame = DECLARE_CALL_FRAME(vm); - IGNORE_WARNINGS_END - JSC::JITOperationPrologueCallFrameTracer tracer(vm, callFrame); - return TextDecoderPrototype__decodeWithoutTypeChecks(reinterpret_cast<JSTextDecoder*>(thisValue)->wrapped(), lexicalGlobalObject, arg0); + auto& vm = lexicalGlobalObject->vm(); + + 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__unlinkSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -extern "C" JSC::EncodedJSValue TextDecoderPrototype__getEncoding(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(TextDecoderPrototype__encodingGetterWrap); +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__utimesCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + auto& vm = lexicalGlobalObject->vm(); -extern "C" JSC::EncodedJSValue TextDecoderPrototype__getFatal(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(TextDecoderPrototype__fatalGetterWrap); + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSTextDecoderPrototype, JSTextDecoderPrototype::Base); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } -static const HashTableValue JSTextDecoderPrototypeTableValues[] = { - { "decode"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | JSC::PropertyAttribute::DOMJITFunction), NoIntrinsic, { HashTableValue::DOMJITFunctionType, TextDecoderPrototype__decodeCallback, &DOMJITSignatureForTextDecoderPrototype__decode } }, - { "encoding"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, TextDecoderPrototype__encodingGetterWrap, 0 } }, - { "fatal"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, TextDecoderPrototype__fatalGetterWrap, 0 } } -}; + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); -const ClassInfo JSTextDecoderPrototype::s_info = { "TextDecoder"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTextDecoderPrototype) }; + return NodeJSFSPrototype__utimes(thisObject->wrapped(), lexicalGlobalObject, callFrame); +} -JSC_DEFINE_CUSTOM_GETTER(jsTextDecoderConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__utimesSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { - VM& vm = JSC::getVM(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - auto* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); - auto* prototype = jsDynamicCast<JSTextDecoderPrototype*>(JSValue::decode(thisValue)); + auto& vm = lexicalGlobalObject->vm(); - if (UNLIKELY(!prototype)) + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); return throwVMTypeError(lexicalGlobalObject, throwScope); - return JSValue::encode(globalObject->JSTextDecoderConstructor()); + } + + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + + return NodeJSFSPrototype__utimesSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(TextDecoderPrototype__decodeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__writeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSTextDecoder* thisObject = jsDynamicCast<JSTextDecoder*>(callFrame->thisValue()); + JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -7454,86 +5812,123 @@ JSC_DEFINE_HOST_FUNCTION(TextDecoderPrototype__decodeCallback, (JSGlobalObject * JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return TextDecoderPrototype__decode(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return NodeJSFSPrototype__write(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_CUSTOM_GETTER(TextDecoderPrototype__encodingGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__writeFileCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSTextDecoder* thisObject = jsCast<JSTextDecoder*>(JSValue::decode(thisValue)); + + 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); - if (JSValue cachedValue = thisObject->m_encoding.get()) - return JSValue::encode(cachedValue); + return NodeJSFSPrototype__writeFile(thisObject->wrapped(), lexicalGlobalObject, callFrame); +} - JSC::JSValue result = JSC::JSValue::decode( - TextDecoderPrototype__getEncoding(thisObject->wrapped(), globalObject)); - RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_encoding.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__writeFileSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + auto& vm = lexicalGlobalObject->vm(); + + 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__writeFileSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -extern "C" void TextDecoderPrototype__encodingSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__writeSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { - auto& vm = globalObject->vm(); - auto* thisObject = jsCast<JSTextDecoder*>(JSValue::decode(thisValue)); - thisObject->m_encoding.set(vm, thisObject, JSValue::decode(value)); + auto& vm = lexicalGlobalObject->vm(); + + 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__writeSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -extern "C" EncodedJSValue TextDecoderPrototype__encodingGetCachedValue(JSC::EncodedJSValue thisValue) +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__writevCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { - auto* thisObject = jsCast<JSTextDecoder*>(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_encoding.get()); + auto& vm = lexicalGlobalObject->vm(); + + 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__writev(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_CUSTOM_GETTER(TextDecoderPrototype__fatalGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__writevSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSTextDecoder* thisObject = jsCast<JSTextDecoder*>(JSValue::decode(thisValue)); + + 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); - JSC::EncodedJSValue result = TextDecoderPrototype__getFatal(thisObject->wrapped(), globalObject); - RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); + + return NodeJSFSPrototype__writevSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -void JSTextDecoderPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) +void JSNodeJSFSPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) { Base::finishCreation(vm); - reifyStaticProperties(vm, JSTextDecoder::info(), JSTextDecoderPrototypeTableValues, *this); + reifyStaticProperties(vm, JSNodeJSFS::info(), JSNodeJSFSPrototypeTableValues, *this); JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); } -void JSTextDecoderConstructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSTextDecoderPrototype* prototype) +void JSNodeJSFSConstructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSNodeJSFSPrototype* prototype) { - Base::finishCreation(vm, 0, "TextDecoder"_s, PropertyAdditionMode::WithoutStructureTransition); + Base::finishCreation(vm, 0, "NodeJSFS"_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) +JSNodeJSFSConstructor::JSNodeJSFSConstructor(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) +JSNodeJSFSConstructor* JSNodeJSFSConstructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSNodeJSFSPrototype* prototype) { - JSTextDecoderConstructor* ptr = new (NotNull, JSC::allocateCell<JSTextDecoderConstructor>(vm)) JSTextDecoderConstructor(vm, structure); + JSNodeJSFSConstructor* ptr = new (NotNull, JSC::allocateCell<JSNodeJSFSConstructor>(vm)) JSNodeJSFSConstructor(vm, structure); ptr->finishCreation(vm, globalObject, prototype); return ptr; } -JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSTextDecoderConstructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) +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(); JSObject* newTarget = asObject(callFrame->newTarget()); - auto* constructor = globalObject->JSTextDecoderConstructor(); - Structure* structure = globalObject->JSTextDecoderStructure(); + auto* constructor = globalObject->JSNodeJSFSConstructor(); + Structure* structure = globalObject->JSNodeJSFSStructure(); if (constructor != newTarget) { auto scope = DECLARE_THROW_SCOPE(vm); @@ -7544,65 +5939,62 @@ JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSTextDecoderConstructor::construct structure = InternalFunction::createSubclassStructure( globalObject, newTarget, - functionGlobalObject->JSTextDecoderStructure()); + functionGlobalObject->JSNodeJSFSStructure()); } - void* ptr = TextDecoderClass__construct(globalObject, callFrame); + void* ptr = NodeJSFSClass__construct(globalObject, callFrame); if (UNLIKELY(!ptr)) { return JSValue::encode(JSC::jsUndefined()); } - JSTextDecoder* instance = JSTextDecoder::create(vm, globalObject, structure, ptr); + JSNodeJSFS* instance = JSNodeJSFS::create(vm, globalObject, structure, ptr); return JSValue::encode(instance); } -void JSTextDecoderConstructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSTextDecoderPrototype* prototype) +void JSNodeJSFSConstructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSNodeJSFSPrototype* prototype) { } -const ClassInfo JSTextDecoderConstructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTextDecoderConstructor) }; +const ClassInfo JSNodeJSFSConstructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSNodeJSFSConstructor) }; -extern "C" EncodedJSValue TextDecoder__getConstructor(Zig::GlobalObject* globalObject) +extern "C" EncodedJSValue NodeJSFS__getConstructor(Zig::GlobalObject* globalObject) { - return JSValue::encode(globalObject->JSTextDecoderConstructor()); + return JSValue::encode(globalObject->JSNodeJSFSConstructor()); } -JSTextDecoder::~JSTextDecoder() +JSNodeJSFS::~JSNodeJSFS() { - if (m_ctx) { - TextDecoderClass__finalize(m_ctx); - } } -void JSTextDecoder::destroy(JSCell* cell) +void JSNodeJSFS::destroy(JSCell* cell) { - static_cast<JSTextDecoder*>(cell)->JSTextDecoder::~JSTextDecoder(); + static_cast<JSNodeJSFS*>(cell)->JSNodeJSFS::~JSNodeJSFS(); } -const ClassInfo JSTextDecoder::s_info = { "TextDecoder"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTextDecoder) }; +const ClassInfo JSNodeJSFS::s_info = { "NodeJSFS"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSNodeJSFS) }; -void JSTextDecoder::finishCreation(VM& vm) +void JSNodeJSFS::finishCreation(VM& vm) { Base::finishCreation(vm); ASSERT(inherits(info())); } -JSTextDecoder* JSTextDecoder::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) +JSNodeJSFS* JSNodeJSFS::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) { - JSTextDecoder* ptr = new (NotNull, JSC::allocateCell<JSTextDecoder>(vm)) JSTextDecoder(vm, structure, ctx); + JSNodeJSFS* ptr = new (NotNull, JSC::allocateCell<JSNodeJSFS>(vm)) JSNodeJSFS(vm, structure, ctx); ptr->finishCreation(vm); return ptr; } -extern "C" void* TextDecoder__fromJS(JSC::EncodedJSValue value) +extern "C" void* NodeJSFS__fromJS(JSC::EncodedJSValue value) { JSC::JSValue decodedValue = JSC::JSValue::decode(value); if (decodedValue.isEmpty() || !decodedValue.isCell()) return nullptr; JSC::JSCell* cell = decodedValue.asCell(); - JSTextDecoder* object = JSC::jsDynamicCast<JSTextDecoder*>(cell); + JSNodeJSFS* object = JSC::jsDynamicCast<JSNodeJSFS*>(cell); if (!object) return nullptr; @@ -7610,9 +6002,9 @@ extern "C" void* TextDecoder__fromJS(JSC::EncodedJSValue value) return object->wrapped(); } -extern "C" bool TextDecoder__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) +extern "C" bool NodeJSFS__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) { - JSTextDecoder* object = JSC::jsDynamicCast<JSTextDecoder*>(JSValue::decode(value)); + JSNodeJSFS* object = JSC::jsDynamicCast<JSNodeJSFS*>(JSValue::decode(value)); if (!object) return false; @@ -7620,11 +6012,11 @@ extern "C" bool TextDecoder__dangerouslySetPtr(JSC::EncodedJSValue value, void* return true; } -extern "C" const size_t TextDecoder__ptrOffset = JSTextDecoder::offsetOfWrapped(); +extern "C" const size_t NodeJSFS__ptrOffset = JSNodeJSFS::offsetOfWrapped(); -void JSTextDecoder::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) +void JSNodeJSFS::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) { - auto* thisObject = jsCast<JSTextDecoder*>(cell); + auto* thisObject = jsCast<JSNodeJSFS*>(cell); if (void* wrapped = thisObject->wrapped()) { // if (thisObject->scriptExecutionContext()) // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); @@ -7632,58 +6024,24 @@ void JSTextDecoder::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) Base::analyzeHeap(cell, analyzer); } -JSObject* JSTextDecoder::createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype) +JSObject* JSNodeJSFS::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::JSNodeJSFSConstructor::create(vm, globalObject, WebCore::JSNodeJSFSConstructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast<WebCore::JSNodeJSFSPrototype*>(prototype)); } -JSObject* JSTextDecoder::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) +JSObject* JSNodeJSFS::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) { - return JSTextDecoderPrototype::create(vm, globalObject, JSTextDecoderPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); + return JSNodeJSFSPrototype::create(vm, globalObject, JSNodeJSFSPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); } -extern "C" EncodedJSValue TextDecoder__create(Zig::GlobalObject* globalObject, void* ptr) +extern "C" EncodedJSValue NodeJSFS__create(Zig::GlobalObject* globalObject, void* ptr) { auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSTextDecoderStructure(); - JSTextDecoder* instance = JSTextDecoder::create(vm, globalObject, structure, ptr); + JSC::Structure* structure = globalObject->JSNodeJSFSStructure(); + JSNodeJSFS* instance = JSNodeJSFS::create(vm, globalObject, structure, ptr); return JSValue::encode(instance); } - -template<typename Visitor> -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); - -template<typename Visitor> -void JSTextDecoder::visitAdditionalChildren(Visitor& visitor) -{ - JSTextDecoder* thisObject = this; - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - - visitor.append(thisObject->m_encoding); - ; -} - -DEFINE_VISIT_ADDITIONAL_CHILDREN(JSTextDecoder); - -template<typename Visitor> -void JSTextDecoder::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) -{ - JSTextDecoder* thisObject = jsCast<JSTextDecoder*>(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - thisObject->visitAdditionalChildren<Visitor>(visitor); -} - -DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSTextDecoder); class JSRequestPrototype final : public JSC::JSNonFinalObject { public: using Base = JSC::JSNonFinalObject; @@ -8950,13 +7308,13 @@ void JSResponse::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) } DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSResponse); -class JSBlobPrototype final : public JSC::JSNonFinalObject { +class JSSHA1Prototype final : public JSC::JSNonFinalObject { public: using Base = JSC::JSNonFinalObject; - static JSBlobPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) + static JSSHA1Prototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) { - JSBlobPrototype* ptr = new (NotNull, JSC::allocateCell<JSBlobPrototype>(vm)) JSBlobPrototype(vm, globalObject, structure); + JSSHA1Prototype* ptr = new (NotNull, JSC::allocateCell<JSSHA1Prototype>(vm)) JSSHA1Prototype(vm, globalObject, structure); ptr->finishCreation(vm, globalObject); return ptr; } @@ -8973,7 +7331,7 @@ public: } private: - JSBlobPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) + JSSHA1Prototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) : Base(vm, structure) { } @@ -8981,10 +7339,10 @@ private: void finishCreation(JSC::VM&, JSC::JSGlobalObject*); }; -class JSBlobConstructor final : public JSC::InternalFunction { +class JSSHA1Constructor final : public JSC::InternalFunction { public: using Base = JSC::InternalFunction; - static JSBlobConstructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSBlobPrototype* prototype); + 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; @@ -8998,15 +7356,15 @@ public: { if constexpr (mode == JSC::SubspaceAccess::Concurrently) return nullptr; - return WebCore::subspaceForImpl<JSBlobConstructor, WebCore::UseCustomHeapCellType::No>( + return WebCore::subspaceForImpl<JSSHA1Constructor, WebCore::UseCustomHeapCellType::No>( vm, - [](auto& spaces) { return spaces.m_clientSubspaceForBlobConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForBlobConstructor = WTFMove(space); }, - [](auto& spaces) { return spaces.m_subspaceForBlobConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForBlobConstructor = WTFMove(space); }); + [](auto& spaces) { return spaces.m_clientSubspaceForSHA1Constructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForSHA1Constructor = WTFMove(space); }, + [](auto& spaces) { return spaces.m_subspaceForSHA1Constructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForSHA1Constructor = WTFMove(space); }); } - void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSBlobPrototype* prototype); + 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*); @@ -9014,73 +7372,62 @@ public: DECLARE_EXPORT_INFO; private: - JSBlobConstructor(JSC::VM& vm, JSC::Structure* structure); - void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSBlobPrototype* prototype); + JSSHA1Constructor(JSC::VM& vm, JSC::Structure* structure); + void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSSHA1Prototype* 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__getJSON(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(BlobPrototype__jsonCallback); - -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" void* SHA1Class__construct(JSC::JSGlobalObject*, JSC::CallFrame*); +JSC_DECLARE_CUSTOM_GETTER(jsSHA1Constructor); +extern "C" void SHA1Class__finalize(void*); -extern "C" JSC::EncodedJSValue BlobPrototype__getType(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(BlobPrototype__typeGetterWrap); +extern "C" JSC::EncodedJSValue SHA1Prototype__getByteLength(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); +JSC_DECLARE_CUSTOM_GETTER(SHA1Prototype__byteLengthGetterWrap); -extern "C" bool BlobPrototype__setType(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::EncodedJSValue value); -JSC_DECLARE_CUSTOM_SETTER(BlobPrototype__typeSetterWrap); +extern "C" EncodedJSValue SHA1Prototype__digest(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(SHA1Prototype__digestCallback); -extern "C" EncodedJSValue BlobPrototype__getWriter(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(BlobPrototype__writerCallback); +extern "C" EncodedJSValue SHA1Prototype__update(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(SHA1Prototype__updateCallback); -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSBlobPrototype, JSBlobPrototype::Base); +STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSSHA1Prototype, JSSHA1Prototype::Base); -static const HashTableValue JSBlobPrototypeTableValues[] = { - { "arrayBuffer"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, BlobPrototype__arrayBufferCallback, 0 } }, - { "json"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, BlobPrototype__jsonCallback, 0 } }, - { "size"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, BlobPrototype__sizeGetterWrap, 0 } }, - { "slice"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, BlobPrototype__sliceCallback, 2 } }, - { "stream"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, BlobPrototype__streamCallback, 1 } }, - { "text"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, BlobPrototype__textCallback, 0 } }, - { "type"_s, static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, BlobPrototype__typeGetterWrap, BlobPrototype__typeSetterWrap } }, - { "writer"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, BlobPrototype__writerCallback, 1 } } +static const HashTableValue JSSHA1PrototypeTableValues[] = { + { "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, SHA1Prototype__byteLengthGetterWrap, 0 } }, + { "digest"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA1Prototype__digestCallback, 0 } }, + { "update"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA1Prototype__updateCallback, 1 } } }; -const ClassInfo JSBlobPrototype::s_info = { "Blob"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSBlobPrototype) }; +const ClassInfo JSSHA1Prototype::s_info = { "SHA1"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA1Prototype) }; -JSC_DEFINE_CUSTOM_GETTER(jsBlobConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) +JSC_DEFINE_CUSTOM_GETTER(jsSHA1Constructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); auto* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); - auto* prototype = jsDynamicCast<JSBlobPrototype*>(JSValue::decode(thisValue)); + auto* prototype = jsDynamicCast<JSSHA1Prototype*>(JSValue::decode(thisValue)); if (UNLIKELY(!prototype)) return throwVMTypeError(lexicalGlobalObject, throwScope); - return JSValue::encode(globalObject->JSBlobConstructor()); + return JSValue::encode(globalObject->JSSHA1Constructor()); } -JSC_DEFINE_HOST_FUNCTION(BlobPrototype__arrayBufferCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_CUSTOM_GETTER(SHA1Prototype__byteLengthGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); + 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); + JSC::EncodedJSValue result = SHA1Prototype__getByteLength(thisObject->wrapped(), globalObject); + RETURN_IF_EXCEPTION(throwScope, {}); + RELEASE_AND_RETURN(throwScope, result); +} - JSBlob* thisObject = jsDynamicCast<JSBlob*>(callFrame->thisValue()); +JSC_DEFINE_HOST_FUNCTION(SHA1Prototype__digestCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + auto& vm = lexicalGlobalObject->vm(); + + JSSHA1* thisObject = jsDynamicCast<JSSHA1*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -9089,14 +7436,14 @@ JSC_DEFINE_HOST_FUNCTION(BlobPrototype__arrayBufferCallback, (JSGlobalObject * l JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return BlobPrototype__getArrayBuffer(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return SHA1Prototype__digest(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(BlobPrototype__jsonCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(SHA1Prototype__updateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSBlob* thisObject = jsDynamicCast<JSBlob*>(callFrame->thisValue()); + JSSHA1* thisObject = jsDynamicCast<JSSHA1*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -9105,26 +7452,287 @@ JSC_DEFINE_HOST_FUNCTION(BlobPrototype__jsonCallback, (JSGlobalObject * lexicalG JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return BlobPrototype__getJSON(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return SHA1Prototype__update(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_CUSTOM_GETTER(BlobPrototype__sizeGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +void JSSHA1Prototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) +{ + Base::finishCreation(vm); + reifyStaticProperties(vm, JSSHA1::info(), JSSHA1PrototypeTableValues, *this); + JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); +} + +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), NoIntrinsic, { HashTableValue::GetterSetterType, SHA1Class__getByteLengthStatic, 0 } }, + { "hash"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA1Class__hash, 2 } } +}; + +void JSSHA1Constructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSSHA1Prototype* prototype) +{ + Base::finishCreation(vm, 0, "SHA1"_s, PropertyAdditionMode::WithoutStructureTransition); + reifyStaticProperties(vm, &JSSHA1Constructor::s_info, JSSHA1ConstructorTableValues, *this); + putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly); + ASSERT(inherits(info())); +} + +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* 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(); + JSObject* newTarget = asObject(callFrame->newTarget()); + auto* constructor = globalObject->JSSHA1Constructor(); + Structure* structure = globalObject->JSSHA1Structure(); + if (constructor != newTarget) { + 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()); + } + + void* ptr = SHA1Class__construct(globalObject, callFrame); + + if (UNLIKELY(!ptr)) { + 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) +{ + return JSValue::encode(globalObject->JSSHA1Constructor()); +} + +JSSHA1::~JSSHA1() +{ + if (m_ctx) { + SHA1Class__finalize(m_ctx); + } +} +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) +{ + Base::finishCreation(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; + + JSC::JSCell* cell = decodedValue.asCell(); + JSSHA1* object = JSC::jsDynamicCast<JSSHA1*>(cell); + + 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" const size_t SHA1__ptrOffset = JSSHA1::offsetOfWrapped(); + +void JSSHA1::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) +{ + auto* thisObject = jsCast<JSSHA1*>(cell); + if (void* wrapped = thisObject->wrapped()) { + // if (thisObject->scriptExecutionContext()) + // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); + } + Base::analyzeHeap(cell, 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)); +} + +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*); +}; + +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; + + 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 = WTFMove(space); }, + [](auto& spaces) { return spaces.m_subspaceForSHA224Constructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForSHA224Constructor = WTFMove(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), NoIntrinsic, { HashTableValue::GetterSetterType, SHA224Prototype__byteLengthGetterWrap, 0 } }, + { "digest"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA224Prototype__digestCallback, 0 } }, + { "update"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), 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); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + auto* prototype = jsDynamicCast<JSSHA224Prototype*>(JSValue::decode(thisValue)); + + 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); auto throwScope = DECLARE_THROW_SCOPE(vm); - JSBlob* thisObject = jsCast<JSBlob*>(JSValue::decode(thisValue)); + JSSHA224* thisObject = jsCast<JSSHA224*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = BlobPrototype__getSize(thisObject->wrapped(), globalObject); + JSC::EncodedJSValue result = SHA224Prototype__getByteLength(thisObject->wrapped(), globalObject); RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } -JSC_DEFINE_HOST_FUNCTION(BlobPrototype__sliceCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(SHA224Prototype__digestCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSBlob* thisObject = jsDynamicCast<JSBlob*>(callFrame->thisValue()); + JSSHA224* thisObject = jsDynamicCast<JSSHA224*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -9133,14 +7741,14 @@ JSC_DEFINE_HOST_FUNCTION(BlobPrototype__sliceCallback, (JSGlobalObject * lexical JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return BlobPrototype__getSlice(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return SHA224Prototype__digest(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(BlobPrototype__streamCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(SHA224Prototype__updateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSBlob* thisObject = jsDynamicCast<JSBlob*>(callFrame->thisValue()); + JSSHA224* thisObject = jsDynamicCast<JSSHA224*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -9149,53 +7757,303 @@ JSC_DEFINE_HOST_FUNCTION(BlobPrototype__streamCallback, (JSGlobalObject * lexica JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return BlobPrototype__getStream(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return SHA224Prototype__update(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(BlobPrototype__textCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +void JSSHA224Prototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) { - auto& vm = lexicalGlobalObject->vm(); + Base::finishCreation(vm); + reifyStaticProperties(vm, JSSHA224::info(), JSSHA224PrototypeTableValues, *this); + JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); +} - JSBlob* thisObject = jsDynamicCast<JSBlob*>(callFrame->thisValue()); +extern "C" JSC_DECLARE_CUSTOM_GETTER(SHA224Class__getByteLengthStatic); +extern "C" JSC_DECLARE_HOST_FUNCTION(SHA224Class__hash); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); +static const HashTableValue JSSHA224ConstructorTableValues[] = { + { "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, SHA224Class__getByteLengthStatic, 0 } }, + { "hash"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA224Class__hash, 2 } } +}; + +void JSSHA224Constructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSSHA224Prototype* prototype) +{ + Base::finishCreation(vm, 0, "SHA224"_s, PropertyAdditionMode::WithoutStructureTransition); + reifyStaticProperties(vm, &JSSHA224Constructor::s_info, JSSHA224ConstructorTableValues, *this); + putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly); + ASSERT(inherits(info())); +} + +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* 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(); + JSObject* newTarget = asObject(callFrame->newTarget()); + auto* constructor = globalObject->JSSHA224Constructor(); + Structure* structure = globalObject->JSSHA224Structure(); + if (constructor != newTarget) { + 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()); } - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + void* ptr = SHA224Class__construct(globalObject, callFrame); - return BlobPrototype__getText(thisObject->wrapped(), lexicalGlobalObject, callFrame); + if (UNLIKELY(!ptr)) { + return JSValue::encode(JSC::jsUndefined()); + } + + JSSHA224* instance = JSSHA224::create(vm, globalObject, structure, ptr); + + return JSValue::encode(instance); } -JSC_DEFINE_CUSTOM_GETTER(BlobPrototype__typeGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +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) +{ + return JSValue::encode(globalObject->JSSHA224Constructor()); +} + +JSSHA224::~JSSHA224() +{ + if (m_ctx) { + SHA224Class__finalize(m_ctx); + } +} +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) +{ + Base::finishCreation(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; + + JSC::JSCell* cell = decodedValue.asCell(); + JSSHA224* object = JSC::jsDynamicCast<JSSHA224*>(cell); + + 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" const size_t SHA224__ptrOffset = JSSHA224::offsetOfWrapped(); + +void JSSHA224::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) +{ + auto* thisObject = jsCast<JSSHA224*>(cell); + if (void* wrapped = thisObject->wrapped()) { + // if (thisObject->scriptExecutionContext()) + // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); + } + Base::analyzeHeap(cell, 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)); +} + +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*); +}; + +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 = WTFMove(space); }, + [](auto& spaces) { return spaces.m_subspaceForSHA256Constructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForSHA256Constructor = WTFMove(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); +}; + +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), NoIntrinsic, { HashTableValue::GetterSetterType, SHA256Prototype__byteLengthGetterWrap, 0 } }, + { "digest"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA256Prototype__digestCallback, 0 } }, + { "update"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), 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); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + auto* prototype = jsDynamicCast<JSSHA256Prototype*>(JSValue::decode(thisValue)); + + 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); auto throwScope = DECLARE_THROW_SCOPE(vm); - JSBlob* thisObject = jsCast<JSBlob*>(JSValue::decode(thisValue)); + JSSHA256* thisObject = jsCast<JSSHA256*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = BlobPrototype__getType(thisObject->wrapped(), globalObject); + JSC::EncodedJSValue result = SHA256Prototype__getByteLength(thisObject->wrapped(), globalObject); RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } -JSC_DEFINE_CUSTOM_SETTER(BlobPrototype__typeSetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue, PropertyName attributeName)) +JSC_DEFINE_HOST_FUNCTION(SHA256Prototype__digestCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - auto throwScope = DECLARE_THROW_SCOPE(vm); - JSBlob* thisObject = jsCast<JSBlob*>(JSValue::decode(thisValue)); + + JSSHA256* thisObject = jsDynamicCast<JSSHA256*>(callFrame->thisValue()); + + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - auto result = BlobPrototype__setType(thisObject->wrapped(), lexicalGlobalObject, encodedValue); - RELEASE_AND_RETURN(throwScope, result); + return SHA256Prototype__digest(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(BlobPrototype__writerCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(SHA256Prototype__updateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSBlob* thisObject = jsDynamicCast<JSBlob*>(callFrame->thisValue()); + JSSHA256* thisObject = jsDynamicCast<JSSHA256*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -9204,43 +8062,51 @@ JSC_DEFINE_HOST_FUNCTION(BlobPrototype__writerCallback, (JSGlobalObject * lexica JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return BlobPrototype__getWriter(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return SHA256Prototype__update(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -void JSBlobPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) +void JSSHA256Prototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) { Base::finishCreation(vm); - reifyStaticProperties(vm, JSBlob::info(), JSBlobPrototypeTableValues, *this); + reifyStaticProperties(vm, JSSHA256::info(), JSSHA256PrototypeTableValues, *this); JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); } -void JSBlobConstructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSBlobPrototype* prototype) -{ - Base::finishCreation(vm, 0, "Blob"_s, PropertyAdditionMode::WithoutStructureTransition); +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), NoIntrinsic, { HashTableValue::GetterSetterType, SHA256Class__getByteLengthStatic, 0 } }, + { "hash"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA256Class__hash, 2 } } +}; + +void JSSHA256Constructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSSHA256Prototype* prototype) +{ + Base::finishCreation(vm, 0, "SHA256"_s, PropertyAdditionMode::WithoutStructureTransition); + reifyStaticProperties(vm, &JSSHA256Constructor::s_info, JSSHA256ConstructorTableValues, *this); putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly); ASSERT(inherits(info())); } -JSBlobConstructor::JSBlobConstructor(JSC::VM& vm, JSC::Structure* structure) +JSSHA256Constructor::JSSHA256Constructor(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) +JSSHA256Constructor* JSSHA256Constructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSSHA256Prototype* prototype) { - JSBlobConstructor* ptr = new (NotNull, JSC::allocateCell<JSBlobConstructor>(vm)) JSBlobConstructor(vm, structure); + JSSHA256Constructor* ptr = new (NotNull, JSC::allocateCell<JSSHA256Constructor>(vm)) JSSHA256Constructor(vm, structure); ptr->finishCreation(vm, globalObject, prototype); return ptr; } -JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSBlobConstructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) +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(); JSObject* newTarget = asObject(callFrame->newTarget()); - auto* constructor = globalObject->JSBlobConstructor(); - Structure* structure = globalObject->JSBlobStructure(); + auto* constructor = globalObject->JSSHA256Constructor(); + Structure* structure = globalObject->JSSHA256Structure(); if (constructor != newTarget) { auto scope = DECLARE_THROW_SCOPE(vm); @@ -9251,65 +8117,65 @@ JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSBlobConstructor::construct(JSC::J structure = InternalFunction::createSubclassStructure( globalObject, newTarget, - functionGlobalObject->JSBlobStructure()); + functionGlobalObject->JSSHA256Structure()); } - void* ptr = BlobClass__construct(globalObject, callFrame); + void* ptr = SHA256Class__construct(globalObject, callFrame); if (UNLIKELY(!ptr)) { return JSValue::encode(JSC::jsUndefined()); } - JSBlob* instance = JSBlob::create(vm, globalObject, structure, ptr); + JSSHA256* instance = JSSHA256::create(vm, globalObject, structure, ptr); return JSValue::encode(instance); } -void JSBlobConstructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSBlobPrototype* prototype) +void JSSHA256Constructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSSHA256Prototype* prototype) { } -const ClassInfo JSBlobConstructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSBlobConstructor) }; +const ClassInfo JSSHA256Constructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA256Constructor) }; -extern "C" EncodedJSValue Blob__getConstructor(Zig::GlobalObject* globalObject) +extern "C" EncodedJSValue SHA256__getConstructor(Zig::GlobalObject* globalObject) { - return JSValue::encode(globalObject->JSBlobConstructor()); + return JSValue::encode(globalObject->JSSHA256Constructor()); } -JSBlob::~JSBlob() +JSSHA256::~JSSHA256() { if (m_ctx) { - BlobClass__finalize(m_ctx); + SHA256Class__finalize(m_ctx); } } -void JSBlob::destroy(JSCell* cell) +void JSSHA256::destroy(JSCell* cell) { - static_cast<JSBlob*>(cell)->JSBlob::~JSBlob(); + static_cast<JSSHA256*>(cell)->JSSHA256::~JSSHA256(); } -const ClassInfo JSBlob::s_info = { "Blob"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSBlob) }; +const ClassInfo JSSHA256::s_info = { "SHA256"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA256) }; -void JSBlob::finishCreation(VM& vm) +void JSSHA256::finishCreation(VM& vm) { Base::finishCreation(vm); ASSERT(inherits(info())); } -JSBlob* JSBlob::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) +JSSHA256* JSSHA256::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) { - JSBlob* ptr = new (NotNull, JSC::allocateCell<JSBlob>(vm)) JSBlob(vm, structure, ctx); + JSSHA256* ptr = new (NotNull, JSC::allocateCell<JSSHA256>(vm)) JSSHA256(vm, structure, ctx); ptr->finishCreation(vm); return ptr; } -extern "C" void* Blob__fromJS(JSC::EncodedJSValue value) +extern "C" void* SHA256__fromJS(JSC::EncodedJSValue value) { JSC::JSValue decodedValue = JSC::JSValue::decode(value); if (decodedValue.isEmpty() || !decodedValue.isCell()) return nullptr; JSC::JSCell* cell = decodedValue.asCell(); - JSBlob* object = JSC::jsDynamicCast<JSBlob*>(cell); + JSSHA256* object = JSC::jsDynamicCast<JSSHA256*>(cell); if (!object) return nullptr; @@ -9317,9 +8183,9 @@ extern "C" void* Blob__fromJS(JSC::EncodedJSValue value) return object->wrapped(); } -extern "C" bool Blob__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) +extern "C" bool SHA256__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) { - JSBlob* object = JSC::jsDynamicCast<JSBlob*>(JSValue::decode(value)); + JSSHA256* object = JSC::jsDynamicCast<JSSHA256*>(JSValue::decode(value)); if (!object) return false; @@ -9327,11 +8193,11 @@ extern "C" bool Blob__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) return true; } -extern "C" const size_t Blob__ptrOffset = JSBlob::offsetOfWrapped(); +extern "C" const size_t SHA256__ptrOffset = JSSHA256::offsetOfWrapped(); -void JSBlob::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) +void JSSHA256::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) { - auto* thisObject = jsCast<JSBlob*>(cell); + auto* thisObject = jsCast<JSSHA256*>(cell); if (void* wrapped = thisObject->wrapped()) { // if (thisObject->scriptExecutionContext()) // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); @@ -9339,31 +8205,31 @@ void JSBlob::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) Base::analyzeHeap(cell, analyzer); } -JSObject* JSBlob::createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype) +JSObject* JSSHA256::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::JSSHA256Constructor::create(vm, globalObject, WebCore::JSSHA256Constructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast<WebCore::JSSHA256Prototype*>(prototype)); } -JSObject* JSBlob::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) +JSObject* JSSHA256::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) { - return JSBlobPrototype::create(vm, globalObject, JSBlobPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); + return JSSHA256Prototype::create(vm, globalObject, JSSHA256Prototype::createStructure(vm, globalObject, globalObject->objectPrototype())); } -extern "C" EncodedJSValue Blob__create(Zig::GlobalObject* globalObject, void* ptr) +extern "C" EncodedJSValue SHA256__create(Zig::GlobalObject* globalObject, void* ptr) { auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSBlobStructure(); - JSBlob* instance = JSBlob::create(vm, globalObject, structure, ptr); + JSC::Structure* structure = globalObject->JSSHA256Structure(); + JSSHA256* instance = JSSHA256::create(vm, globalObject, structure, ptr); return JSValue::encode(instance); } -class JSDirentPrototype final : public JSC::JSNonFinalObject { +class JSSHA384Prototype final : public JSC::JSNonFinalObject { public: using Base = JSC::JSNonFinalObject; - static JSDirentPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) + static JSSHA384Prototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) { - JSDirentPrototype* ptr = new (NotNull, JSC::allocateCell<JSDirentPrototype>(vm)) JSDirentPrototype(vm, globalObject, structure); + JSSHA384Prototype* ptr = new (NotNull, JSC::allocateCell<JSSHA384Prototype>(vm)) JSSHA384Prototype(vm, globalObject, structure); ptr->finishCreation(vm, globalObject); return ptr; } @@ -9380,7 +8246,7 @@ public: } private: - JSDirentPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) + JSSHA384Prototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) : Base(vm, structure) { } @@ -9388,10 +8254,10 @@ private: void finishCreation(JSC::VM&, JSC::JSGlobalObject*); }; -class JSDirentConstructor final : public JSC::InternalFunction { +class JSSHA384Constructor final : public JSC::InternalFunction { public: using Base = JSC::InternalFunction; - static JSDirentConstructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSDirentPrototype* prototype); + 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; @@ -9405,15 +8271,15 @@ public: { if constexpr (mode == JSC::SubspaceAccess::Concurrently) return nullptr; - return WebCore::subspaceForImpl<JSDirentConstructor, WebCore::UseCustomHeapCellType::No>( + return WebCore::subspaceForImpl<JSSHA384Constructor, WebCore::UseCustomHeapCellType::No>( vm, - [](auto& spaces) { return spaces.m_clientSubspaceForDirentConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForDirentConstructor = WTFMove(space); }, - [](auto& spaces) { return spaces.m_subspaceForDirentConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForDirentConstructor = WTFMove(space); }); + [](auto& spaces) { return spaces.m_clientSubspaceForSHA384Constructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForSHA384Constructor = WTFMove(space); }, + [](auto& spaces) { return spaces.m_subspaceForSHA384Constructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForSHA384Constructor = WTFMove(space); }); } - void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSDirentPrototype* 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*); @@ -9421,70 +8287,62 @@ public: DECLARE_EXPORT_INFO; private: - JSDirentConstructor(JSC::VM& vm, JSC::Structure* structure); - void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSDirentPrototype* prototype); + JSSHA384Constructor(JSC::VM& vm, JSC::Structure* structure); + void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSSHA384Prototype* 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" void* SHA384Class__construct(JSC::JSGlobalObject*, JSC::CallFrame*); +JSC_DECLARE_CUSTOM_GETTER(jsSHA384Constructor); +extern "C" void SHA384Class__finalize(void*); -extern "C" EncodedJSValue DirentPrototype__isSocket(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(DirentPrototype__isSocketCallback); +extern "C" JSC::EncodedJSValue SHA384Prototype__getByteLength(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); +JSC_DECLARE_CUSTOM_GETTER(SHA384Prototype__byteLengthGetterWrap); -extern "C" EncodedJSValue DirentPrototype__isSymbolicLink(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(DirentPrototype__isSymbolicLinkCallback); +extern "C" EncodedJSValue SHA384Prototype__digest(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(SHA384Prototype__digestCallback); -extern "C" JSC::EncodedJSValue DirentPrototype__getName(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(DirentPrototype__nameGetterWrap); +extern "C" EncodedJSValue SHA384Prototype__update(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(SHA384Prototype__updateCallback); -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSDirentPrototype, JSDirentPrototype::Base); +STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSSHA384Prototype, JSSHA384Prototype::Base); -static const HashTableValue JSDirentPrototypeTableValues[] = { - { "isBlockDevice"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, DirentPrototype__isBlockDeviceCallback, 0 } }, - { "isCharacterDevice"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, DirentPrototype__isCharacterDeviceCallback, 0 } }, - { "isDirectory"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, DirentPrototype__isDirectoryCallback, 0 } }, - { "isFIFO"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, DirentPrototype__isFIFOCallback, 0 } }, - { "isFile"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, DirentPrototype__isFileCallback, 0 } }, - { "isSocket"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, DirentPrototype__isSocketCallback, 0 } }, - { "isSymbolicLink"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, DirentPrototype__isSymbolicLinkCallback, 0 } }, - { "name"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, DirentPrototype__nameGetterWrap, 0 } } +static const HashTableValue JSSHA384PrototypeTableValues[] = { + { "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, SHA384Prototype__byteLengthGetterWrap, 0 } }, + { "digest"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA384Prototype__digestCallback, 0 } }, + { "update"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA384Prototype__updateCallback, 1 } } }; -const ClassInfo JSDirentPrototype::s_info = { "Dirent"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSDirentPrototype) }; +const ClassInfo JSSHA384Prototype::s_info = { "SHA384"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA384Prototype) }; -JSC_DEFINE_CUSTOM_GETTER(jsDirentConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) +JSC_DEFINE_CUSTOM_GETTER(jsSHA384Constructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); auto* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); - auto* prototype = jsDynamicCast<JSDirentPrototype*>(JSValue::decode(thisValue)); + auto* prototype = jsDynamicCast<JSSHA384Prototype*>(JSValue::decode(thisValue)); if (UNLIKELY(!prototype)) return throwVMTypeError(lexicalGlobalObject, throwScope); - return JSValue::encode(globalObject->JSDirentConstructor()); + return JSValue::encode(globalObject->JSSHA384Constructor()); } -JSC_DEFINE_HOST_FUNCTION(DirentPrototype__isBlockDeviceCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_CUSTOM_GETTER(SHA384Prototype__byteLengthGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +{ + auto& vm = lexicalGlobalObject->vm(); + 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); + JSC::EncodedJSValue result = SHA384Prototype__getByteLength(thisObject->wrapped(), globalObject); + RETURN_IF_EXCEPTION(throwScope, {}); + RELEASE_AND_RETURN(throwScope, result); +} + +JSC_DEFINE_HOST_FUNCTION(SHA384Prototype__digestCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSDirent* thisObject = jsDynamicCast<JSDirent*>(callFrame->thisValue()); + JSSHA384* thisObject = jsDynamicCast<JSSHA384*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -9493,14 +8351,14 @@ JSC_DEFINE_HOST_FUNCTION(DirentPrototype__isBlockDeviceCallback, (JSGlobalObject JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return DirentPrototype__isBlockDevice(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return SHA384Prototype__digest(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(DirentPrototype__isCharacterDeviceCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(SHA384Prototype__updateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSDirent* thisObject = jsDynamicCast<JSDirent*>(callFrame->thisValue()); + JSSHA384* thisObject = jsDynamicCast<JSSHA384*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -9509,154 +8367,356 @@ JSC_DEFINE_HOST_FUNCTION(DirentPrototype__isCharacterDeviceCallback, (JSGlobalOb JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return DirentPrototype__isCharacterDevice(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return SHA384Prototype__update(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(DirentPrototype__isDirectoryCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +void JSSHA384Prototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) { - auto& vm = lexicalGlobalObject->vm(); + Base::finishCreation(vm); + reifyStaticProperties(vm, JSSHA384::info(), JSSHA384PrototypeTableValues, *this); + JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); +} - JSDirent* thisObject = jsDynamicCast<JSDirent*>(callFrame->thisValue()); +extern "C" JSC_DECLARE_CUSTOM_GETTER(SHA384Class__getByteLengthStatic); +extern "C" JSC_DECLARE_HOST_FUNCTION(SHA384Class__hash); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } +static const HashTableValue JSSHA384ConstructorTableValues[] = { + { "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, SHA384Class__getByteLengthStatic, 0 } }, + { "hash"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA384Class__hash, 2 } } +}; - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); +void JSSHA384Constructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSSHA384Prototype* prototype) +{ + Base::finishCreation(vm, 0, "SHA384"_s, PropertyAdditionMode::WithoutStructureTransition); + reifyStaticProperties(vm, &JSSHA384Constructor::s_info, JSSHA384ConstructorTableValues, *this); + putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly); + ASSERT(inherits(info())); +} - return DirentPrototype__isDirectory(thisObject->wrapped(), lexicalGlobalObject, callFrame); +JSSHA384Constructor::JSSHA384Constructor(JSC::VM& vm, JSC::Structure* structure) + : Base(vm, structure, construct, construct) +{ } -JSC_DEFINE_HOST_FUNCTION(DirentPrototype__isFIFOCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSSHA384Constructor* JSSHA384Constructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSSHA384Prototype* prototype) { - auto& vm = lexicalGlobalObject->vm(); + JSSHA384Constructor* ptr = new (NotNull, JSC::allocateCell<JSSHA384Constructor>(vm)) JSSHA384Constructor(vm, structure); + ptr->finishCreation(vm, globalObject, prototype); + return ptr; +} - JSDirent* thisObject = jsDynamicCast<JSDirent*>(callFrame->thisValue()); +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(); + JSObject* newTarget = asObject(callFrame->newTarget()); + auto* constructor = globalObject->JSSHA384Constructor(); + Structure* structure = globalObject->JSSHA384Structure(); + if (constructor != newTarget) { + auto scope = DECLARE_THROW_SCOPE(vm); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + 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()); } - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + void* ptr = SHA384Class__construct(globalObject, callFrame); - return DirentPrototype__isFIFO(thisObject->wrapped(), lexicalGlobalObject, callFrame); + if (UNLIKELY(!ptr)) { + return JSValue::encode(JSC::jsUndefined()); + } + + JSSHA384* instance = JSSHA384::create(vm, globalObject, structure, ptr); + + return JSValue::encode(instance); } -JSC_DEFINE_HOST_FUNCTION(DirentPrototype__isFileCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +void JSSHA384Constructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSSHA384Prototype* prototype) { - auto& vm = lexicalGlobalObject->vm(); +} - JSDirent* thisObject = jsDynamicCast<JSDirent*>(callFrame->thisValue()); +const ClassInfo JSSHA384Constructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA384Constructor) }; - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); +extern "C" EncodedJSValue SHA384__getConstructor(Zig::GlobalObject* globalObject) +{ + return JSValue::encode(globalObject->JSSHA384Constructor()); +} + +JSSHA384::~JSSHA384() +{ + if (m_ctx) { + SHA384Class__finalize(m_ctx); } +} +void JSSHA384::destroy(JSCell* cell) +{ + static_cast<JSSHA384*>(cell)->JSSHA384::~JSSHA384(); +} - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); +const ClassInfo JSSHA384::s_info = { "SHA384"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA384) }; - return DirentPrototype__isFile(thisObject->wrapped(), lexicalGlobalObject, callFrame); +void JSSHA384::finishCreation(VM& vm) +{ + Base::finishCreation(vm); + ASSERT(inherits(info())); } -JSC_DEFINE_HOST_FUNCTION(DirentPrototype__isSocketCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSSHA384* JSSHA384::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) { - auto& vm = lexicalGlobalObject->vm(); + JSSHA384* ptr = new (NotNull, JSC::allocateCell<JSSHA384>(vm)) JSSHA384(vm, structure, ctx); + ptr->finishCreation(vm); + return ptr; +} - JSDirent* thisObject = jsDynamicCast<JSDirent*>(callFrame->thisValue()); +extern "C" void* SHA384__fromJS(JSC::EncodedJSValue value) +{ + JSC::JSValue decodedValue = JSC::JSValue::decode(value); + if (decodedValue.isEmpty() || !decodedValue.isCell()) + return nullptr; - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + JSC::JSCell* cell = decodedValue.asCell(); + JSSHA384* object = JSC::jsDynamicCast<JSSHA384*>(cell); + + 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" const size_t SHA384__ptrOffset = JSSHA384::offsetOfWrapped(); + +void JSSHA384::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) +{ + auto* thisObject = jsCast<JSSHA384*>(cell); + if (void* wrapped = thisObject->wrapped()) { + // if (thisObject->scriptExecutionContext()) + // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); } + Base::analyzeHeap(cell, analyzer); +} - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); +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 DirentPrototype__isSocket(thisObject->wrapped(), lexicalGlobalObject, callFrame); +JSObject* JSSHA384::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) +{ + return JSSHA384Prototype::create(vm, globalObject, JSSHA384Prototype::createStructure(vm, globalObject, globalObject->objectPrototype())); } -JSC_DEFINE_HOST_FUNCTION(DirentPrototype__isSymbolicLinkCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +extern "C" EncodedJSValue SHA384__create(Zig::GlobalObject* globalObject, void* ptr) { - auto& vm = lexicalGlobalObject->vm(); + auto& vm = globalObject->vm(); + JSC::Structure* structure = globalObject->JSSHA384Structure(); + JSSHA384* instance = JSSHA384::create(vm, globalObject, structure, ptr); - JSDirent* thisObject = jsDynamicCast<JSDirent*>(callFrame->thisValue()); + return JSValue::encode(instance); +} +class JSSHA512Prototype final : public JSC::JSNonFinalObject { +public: + using Base = JSC::JSNonFinalObject; - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + 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; } - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + 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()); + } - return DirentPrototype__isSymbolicLink(thisObject->wrapped(), lexicalGlobalObject, callFrame); +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); + + 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 = WTFMove(space); }, + [](auto& spaces) { return spaces.m_subspaceForSHA512Constructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForSHA512Constructor = WTFMove(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), NoIntrinsic, { HashTableValue::GetterSetterType, SHA512Prototype__byteLengthGetterWrap, 0 } }, + { "digest"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA512Prototype__digestCallback, 0 } }, + { "update"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), 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); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + auto* prototype = jsDynamicCast<JSSHA512Prototype*>(JSValue::decode(thisValue)); + + if (UNLIKELY(!prototype)) + return throwVMTypeError(lexicalGlobalObject, throwScope); + return JSValue::encode(globalObject->JSSHA512Constructor()); } -JSC_DEFINE_CUSTOM_GETTER(DirentPrototype__nameGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(SHA512Prototype__byteLengthGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); - JSDirent* thisObject = jsCast<JSDirent*>(JSValue::decode(thisValue)); + JSSHA512* thisObject = jsCast<JSSHA512*>(JSValue::decode(thisValue)); 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)); + JSC::EncodedJSValue result = SHA512Prototype__getByteLength(thisObject->wrapped(), globalObject); RETURN_IF_EXCEPTION(throwScope, {}); - thisObject->m_name.set(vm, thisObject, result); - RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); + RELEASE_AND_RETURN(throwScope, result); } -extern "C" void DirentPrototype__nameSetCachedValue(JSC::EncodedJSValue thisValue, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) +JSC_DEFINE_HOST_FUNCTION(SHA512Prototype__digestCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { - auto& vm = globalObject->vm(); - auto* thisObject = jsCast<JSDirent*>(JSValue::decode(thisValue)); - thisObject->m_name.set(vm, thisObject, JSValue::decode(value)); + auto& vm = lexicalGlobalObject->vm(); + + JSSHA512* thisObject = jsDynamicCast<JSSHA512*>(callFrame->thisValue()); + + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } + + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + + return SHA512Prototype__digest(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -extern "C" EncodedJSValue DirentPrototype__nameGetCachedValue(JSC::EncodedJSValue thisValue) +JSC_DEFINE_HOST_FUNCTION(SHA512Prototype__updateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { - auto* thisObject = jsCast<JSDirent*>(JSValue::decode(thisValue)); - return JSValue::encode(thisObject->m_name.get()); + auto& vm = lexicalGlobalObject->vm(); + + JSSHA512* thisObject = jsDynamicCast<JSSHA512*>(callFrame->thisValue()); + + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } + + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + + return SHA512Prototype__update(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -void JSDirentPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) +void JSSHA512Prototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) { Base::finishCreation(vm); - reifyStaticProperties(vm, JSDirent::info(), JSDirentPrototypeTableValues, *this); + reifyStaticProperties(vm, JSSHA512::info(), JSSHA512PrototypeTableValues, *this); JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); } -void JSDirentConstructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSDirentPrototype* prototype) -{ - Base::finishCreation(vm, 0, "Dirent"_s, PropertyAdditionMode::WithoutStructureTransition); +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), NoIntrinsic, { HashTableValue::GetterSetterType, SHA512Class__getByteLengthStatic, 0 } }, + { "hash"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA512Class__hash, 2 } } +}; +void JSSHA512Constructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSSHA512Prototype* prototype) +{ + Base::finishCreation(vm, 0, "SHA512"_s, PropertyAdditionMode::WithoutStructureTransition); + reifyStaticProperties(vm, &JSSHA512Constructor::s_info, JSSHA512ConstructorTableValues, *this); putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly); ASSERT(inherits(info())); } -JSDirentConstructor::JSDirentConstructor(JSC::VM& vm, JSC::Structure* structure) +JSSHA512Constructor::JSSHA512Constructor(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) +JSSHA512Constructor* JSSHA512Constructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSSHA512Prototype* prototype) { - JSDirentConstructor* ptr = new (NotNull, JSC::allocateCell<JSDirentConstructor>(vm)) JSDirentConstructor(vm, structure); + JSSHA512Constructor* ptr = new (NotNull, JSC::allocateCell<JSSHA512Constructor>(vm)) JSSHA512Constructor(vm, structure); ptr->finishCreation(vm, globalObject, prototype); return ptr; } -JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSDirentConstructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) +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(); JSObject* newTarget = asObject(callFrame->newTarget()); - auto* constructor = globalObject->JSDirentConstructor(); - Structure* structure = globalObject->JSDirentStructure(); + auto* constructor = globalObject->JSSHA512Constructor(); + Structure* structure = globalObject->JSSHA512Structure(); if (constructor != newTarget) { auto scope = DECLARE_THROW_SCOPE(vm); @@ -9667,65 +8727,65 @@ JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSDirentConstructor::construct(JSC: structure = InternalFunction::createSubclassStructure( globalObject, newTarget, - functionGlobalObject->JSDirentStructure()); + functionGlobalObject->JSSHA512Structure()); } - void* ptr = DirentClass__construct(globalObject, callFrame); + void* ptr = SHA512Class__construct(globalObject, callFrame); if (UNLIKELY(!ptr)) { return JSValue::encode(JSC::jsUndefined()); } - JSDirent* instance = JSDirent::create(vm, globalObject, structure, ptr); + JSSHA512* instance = JSSHA512::create(vm, globalObject, structure, ptr); return JSValue::encode(instance); } -void JSDirentConstructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSDirentPrototype* prototype) +void JSSHA512Constructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSSHA512Prototype* prototype) { } -const ClassInfo JSDirentConstructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSDirentConstructor) }; +const ClassInfo JSSHA512Constructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA512Constructor) }; -extern "C" EncodedJSValue Dirent__getConstructor(Zig::GlobalObject* globalObject) +extern "C" EncodedJSValue SHA512__getConstructor(Zig::GlobalObject* globalObject) { - return JSValue::encode(globalObject->JSDirentConstructor()); + return JSValue::encode(globalObject->JSSHA512Constructor()); } -JSDirent::~JSDirent() +JSSHA512::~JSSHA512() { if (m_ctx) { - DirentClass__finalize(m_ctx); + SHA512Class__finalize(m_ctx); } } -void JSDirent::destroy(JSCell* cell) +void JSSHA512::destroy(JSCell* cell) { - static_cast<JSDirent*>(cell)->JSDirent::~JSDirent(); + static_cast<JSSHA512*>(cell)->JSSHA512::~JSSHA512(); } -const ClassInfo JSDirent::s_info = { "Dirent"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSDirent) }; +const ClassInfo JSSHA512::s_info = { "SHA512"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA512) }; -void JSDirent::finishCreation(VM& vm) +void JSSHA512::finishCreation(VM& vm) { Base::finishCreation(vm); ASSERT(inherits(info())); } -JSDirent* JSDirent::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) +JSSHA512* JSSHA512::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) { - JSDirent* ptr = new (NotNull, JSC::allocateCell<JSDirent>(vm)) JSDirent(vm, structure, ctx); + JSSHA512* ptr = new (NotNull, JSC::allocateCell<JSSHA512>(vm)) JSSHA512(vm, structure, ctx); ptr->finishCreation(vm); return ptr; } -extern "C" void* Dirent__fromJS(JSC::EncodedJSValue value) +extern "C" void* SHA512__fromJS(JSC::EncodedJSValue value) { JSC::JSValue decodedValue = JSC::JSValue::decode(value); if (decodedValue.isEmpty() || !decodedValue.isCell()) return nullptr; JSC::JSCell* cell = decodedValue.asCell(); - JSDirent* object = JSC::jsDynamicCast<JSDirent*>(cell); + JSSHA512* object = JSC::jsDynamicCast<JSSHA512*>(cell); if (!object) return nullptr; @@ -9733,9 +8793,9 @@ extern "C" void* Dirent__fromJS(JSC::EncodedJSValue value) return object->wrapped(); } -extern "C" bool Dirent__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) +extern "C" bool SHA512__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) { - JSDirent* object = JSC::jsDynamicCast<JSDirent*>(JSValue::decode(value)); + JSSHA512* object = JSC::jsDynamicCast<JSSHA512*>(JSValue::decode(value)); if (!object) return false; @@ -9743,11 +8803,11 @@ extern "C" bool Dirent__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) return true; } -extern "C" const size_t Dirent__ptrOffset = JSDirent::offsetOfWrapped(); +extern "C" const size_t SHA512__ptrOffset = JSSHA512::offsetOfWrapped(); -void JSDirent::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) +void JSSHA512::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) { - auto* thisObject = jsCast<JSDirent*>(cell); + auto* thisObject = jsCast<JSSHA512*>(cell); if (void* wrapped = thisObject->wrapped()) { // if (thisObject->scriptExecutionContext()) // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); @@ -9755,65 +8815,31 @@ void JSDirent::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) Base::analyzeHeap(cell, analyzer); } -JSObject* JSDirent::createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype) +JSObject* JSSHA512::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::JSSHA512Constructor::create(vm, globalObject, WebCore::JSSHA512Constructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast<WebCore::JSSHA512Prototype*>(prototype)); } -JSObject* JSDirent::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) +JSObject* JSSHA512::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) { - return JSDirentPrototype::create(vm, globalObject, JSDirentPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); + return JSSHA512Prototype::create(vm, globalObject, JSSHA512Prototype::createStructure(vm, globalObject, globalObject->objectPrototype())); } -extern "C" EncodedJSValue Dirent__create(Zig::GlobalObject* globalObject, void* ptr) +extern "C" EncodedJSValue SHA512__create(Zig::GlobalObject* globalObject, void* ptr) { auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSDirentStructure(); - JSDirent* instance = JSDirent::create(vm, globalObject, structure, ptr); + JSC::Structure* structure = globalObject->JSSHA512Structure(); + JSSHA512* instance = JSSHA512::create(vm, globalObject, structure, ptr); return JSValue::encode(instance); } - -template<typename Visitor> -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); - -template<typename Visitor> -void JSDirent::visitAdditionalChildren(Visitor& visitor) -{ - JSDirent* thisObject = this; - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - - visitor.append(thisObject->m_name); - ; -} - -DEFINE_VISIT_ADDITIONAL_CHILDREN(JSDirent); - -template<typename Visitor> -void JSDirent::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) -{ - JSDirent* thisObject = jsCast<JSDirent*>(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - thisObject->visitAdditionalChildren<Visitor>(visitor); -} - -DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSDirent); -class JSNodeJSFSPrototype final : public JSC::JSNonFinalObject { +class JSSHA512_256Prototype final : public JSC::JSNonFinalObject { public: using Base = JSC::JSNonFinalObject; - static JSNodeJSFSPrototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) + static JSSHA512_256Prototype* create(JSC::VM& vm, JSGlobalObject* globalObject, JSC::Structure* structure) { - JSNodeJSFSPrototype* ptr = new (NotNull, JSC::allocateCell<JSNodeJSFSPrototype>(vm)) JSNodeJSFSPrototype(vm, globalObject, structure); + JSSHA512_256Prototype* ptr = new (NotNull, JSC::allocateCell<JSSHA512_256Prototype>(vm)) JSSHA512_256Prototype(vm, globalObject, structure); ptr->finishCreation(vm, globalObject); return ptr; } @@ -9830,7 +8856,7 @@ public: } private: - JSNodeJSFSPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) + JSSHA512_256Prototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) : Base(vm, structure) { } @@ -9838,10 +8864,10 @@ private: void finishCreation(JSC::VM&, JSC::JSGlobalObject*); }; -class JSNodeJSFSConstructor final : public JSC::InternalFunction { +class JSSHA512_256Constructor final : public JSC::InternalFunction { public: using Base = JSC::InternalFunction; - static JSNodeJSFSConstructor* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSNodeJSFSPrototype* prototype); + 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; @@ -9855,15 +8881,15 @@ public: { if constexpr (mode == JSC::SubspaceAccess::Concurrently) return nullptr; - return WebCore::subspaceForImpl<JSNodeJSFSConstructor, WebCore::UseCustomHeapCellType::No>( + return WebCore::subspaceForImpl<JSSHA512_256Constructor, WebCore::UseCustomHeapCellType::No>( vm, - [](auto& spaces) { return spaces.m_clientSubspaceForNodeJSFSConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForNodeJSFSConstructor = WTFMove(space); }, - [](auto& spaces) { return spaces.m_subspaceForNodeJSFSConstructor.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForNodeJSFSConstructor = WTFMove(space); }); + [](auto& spaces) { return spaces.m_clientSubspaceForSHA512_256Constructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForSHA512_256Constructor = WTFMove(space); }, + [](auto& spaces) { return spaces.m_subspaceForSHA512_256Constructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForSHA512_256Constructor = WTFMove(space); }); } - void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSNodeJSFSPrototype* prototype); + 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*); @@ -9871,394 +8897,508 @@ public: DECLARE_EXPORT_INFO; private: - JSNodeJSFSConstructor(JSC::VM& vm, JSC::Structure* structure); - void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSNodeJSFSPrototype* prototype); + JSSHA512_256Constructor(JSC::VM& vm, JSC::Structure* structure); + void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSSHA512_256Prototype* prototype); }; -extern "C" void* NodeJSFSClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); -JSC_DECLARE_CUSTOM_GETTER(jsNodeJSFSConstructor); -extern "C" void NodeJSFSClass__finalize(void*); +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" EncodedJSValue NodeJSFSPrototype__access(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__accessCallback); +extern "C" JSC::EncodedJSValue SHA512_256Prototype__getByteLength(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); +JSC_DECLARE_CUSTOM_GETTER(SHA512_256Prototype__byteLengthGetterWrap); -extern "C" EncodedJSValue NodeJSFSPrototype__accessSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__accessSyncCallback); +extern "C" EncodedJSValue SHA512_256Prototype__digest(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(SHA512_256Prototype__digestCallback); -extern "C" EncodedJSValue NodeJSFSPrototype__appendFile(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__appendFileCallback); +extern "C" EncodedJSValue SHA512_256Prototype__update(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(SHA512_256Prototype__updateCallback); -extern "C" EncodedJSValue NodeJSFSPrototype__appendFileSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__appendFileSyncCallback); +STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSSHA512_256Prototype, JSSHA512_256Prototype::Base); -extern "C" EncodedJSValue NodeJSFSPrototype__chmod(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__chmodCallback); +static const HashTableValue JSSHA512_256PrototypeTableValues[] = { + { "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, SHA512_256Prototype__byteLengthGetterWrap, 0 } }, + { "digest"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA512_256Prototype__digestCallback, 0 } }, + { "update"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA512_256Prototype__updateCallback, 1 } } +}; -extern "C" EncodedJSValue NodeJSFSPrototype__chmodSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__chmodSyncCallback); +const ClassInfo JSSHA512_256Prototype::s_info = { "SHA512_256"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA512_256Prototype) }; -extern "C" EncodedJSValue NodeJSFSPrototype__chown(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__chownCallback); +JSC_DEFINE_CUSTOM_GETTER(jsSHA512_256Constructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) +{ + VM& vm = JSC::getVM(lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + auto* prototype = jsDynamicCast<JSSHA512_256Prototype*>(JSValue::decode(thisValue)); -extern "C" EncodedJSValue NodeJSFSPrototype__chownSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__chownSyncCallback); + if (UNLIKELY(!prototype)) + return throwVMTypeError(lexicalGlobalObject, throwScope); + return JSValue::encode(globalObject->JSSHA512_256Constructor()); +} -extern "C" EncodedJSValue NodeJSFSPrototype__close(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__closeCallback); +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); + auto throwScope = DECLARE_THROW_SCOPE(vm); + JSSHA512_256* thisObject = jsCast<JSSHA512_256*>(JSValue::decode(thisValue)); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC::EncodedJSValue result = SHA512_256Prototype__getByteLength(thisObject->wrapped(), globalObject); + RETURN_IF_EXCEPTION(throwScope, {}); + RELEASE_AND_RETURN(throwScope, result); +} -extern "C" EncodedJSValue NodeJSFSPrototype__closeSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__closeSyncCallback); +JSC_DEFINE_HOST_FUNCTION(SHA512_256Prototype__digestCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + auto& vm = lexicalGlobalObject->vm(); -extern "C" EncodedJSValue NodeJSFSPrototype__copyFile(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__copyFileCallback); + JSSHA512_256* thisObject = jsDynamicCast<JSSHA512_256*>(callFrame->thisValue()); -extern "C" EncodedJSValue NodeJSFSPrototype__copyFileSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__copyFileSyncCallback); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } -extern "C" JSC::EncodedJSValue NodeJSFSPrototype__getDirent(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); -JSC_DECLARE_CUSTOM_GETTER(NodeJSFSPrototype__DirentGetterWrap); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); -extern "C" EncodedJSValue NodeJSFSPrototype__exists(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__existsCallback); + return SHA512_256Prototype__digest(thisObject->wrapped(), lexicalGlobalObject, callFrame); +} -extern "C" EncodedJSValue NodeJSFSPrototype__existsSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__existsSyncCallback); +JSC_DEFINE_HOST_FUNCTION(SHA512_256Prototype__updateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + auto& vm = lexicalGlobalObject->vm(); -extern "C" EncodedJSValue NodeJSFSPrototype__fchmod(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__fchmodCallback); + JSSHA512_256* thisObject = jsDynamicCast<JSSHA512_256*>(callFrame->thisValue()); -extern "C" EncodedJSValue NodeJSFSPrototype__fchmodSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__fchmodSyncCallback); + if (UNLIKELY(!thisObject)) { + auto throwScope = DECLARE_THROW_SCOPE(vm); + return throwVMTypeError(lexicalGlobalObject, throwScope); + } -extern "C" EncodedJSValue NodeJSFSPrototype__fchown(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__fchownCallback); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); -extern "C" EncodedJSValue NodeJSFSPrototype__fchownSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__fchownSyncCallback); + return SHA512_256Prototype__update(thisObject->wrapped(), lexicalGlobalObject, callFrame); +} -extern "C" EncodedJSValue NodeJSFSPrototype__fdatasync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__fdatasyncCallback); +void JSSHA512_256Prototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) +{ + Base::finishCreation(vm); + reifyStaticProperties(vm, JSSHA512_256::info(), JSSHA512_256PrototypeTableValues, *this); + JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); +} -extern "C" EncodedJSValue NodeJSFSPrototype__fdatasyncSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__fdatasyncSyncCallback); +extern "C" JSC_DECLARE_CUSTOM_GETTER(SHA512_256Class__getByteLengthStatic); +extern "C" JSC_DECLARE_HOST_FUNCTION(SHA512_256Class__hash); -extern "C" EncodedJSValue NodeJSFSPrototype__fstat(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__fstatCallback); +static const HashTableValue JSSHA512_256ConstructorTableValues[] = { + { "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, SHA512_256Class__getByteLengthStatic, 0 } }, + { "hash"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, SHA512_256Class__hash, 2 } } +}; -extern "C" EncodedJSValue NodeJSFSPrototype__fstatSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__fstatSyncCallback); +void JSSHA512_256Constructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSSHA512_256Prototype* prototype) +{ + Base::finishCreation(vm, 0, "SHA512_256"_s, PropertyAdditionMode::WithoutStructureTransition); + reifyStaticProperties(vm, &JSSHA512_256Constructor::s_info, JSSHA512_256ConstructorTableValues, *this); + putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly); + ASSERT(inherits(info())); +} -extern "C" EncodedJSValue NodeJSFSPrototype__fsync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__fsyncCallback); +JSSHA512_256Constructor::JSSHA512_256Constructor(JSC::VM& vm, JSC::Structure* structure) + : Base(vm, structure, construct, construct) +{ +} -extern "C" EncodedJSValue NodeJSFSPrototype__fsyncSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__fsyncSyncCallback); +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; +} -extern "C" EncodedJSValue NodeJSFSPrototype__ftruncate(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__ftruncateCallback); +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(); + JSObject* newTarget = asObject(callFrame->newTarget()); + auto* constructor = globalObject->JSSHA512_256Constructor(); + Structure* structure = globalObject->JSSHA512_256Structure(); + if (constructor != newTarget) { + auto scope = DECLARE_THROW_SCOPE(vm); -extern "C" EncodedJSValue NodeJSFSPrototype__ftruncateSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__ftruncateSyncCallback); + 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()); + } -extern "C" EncodedJSValue NodeJSFSPrototype__futimes(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__futimesCallback); + void* ptr = SHA512_256Class__construct(globalObject, callFrame); -extern "C" EncodedJSValue NodeJSFSPrototype__futimesSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__futimesSyncCallback); + if (UNLIKELY(!ptr)) { + return JSValue::encode(JSC::jsUndefined()); + } -extern "C" EncodedJSValue NodeJSFSPrototype__lchmod(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__lchmodCallback); + JSSHA512_256* instance = JSSHA512_256::create(vm, globalObject, structure, ptr); -extern "C" EncodedJSValue NodeJSFSPrototype__lchmodSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__lchmodSyncCallback); + return JSValue::encode(instance); +} -extern "C" EncodedJSValue NodeJSFSPrototype__lchown(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__lchownCallback); +void JSSHA512_256Constructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSSHA512_256Prototype* prototype) +{ +} -extern "C" EncodedJSValue NodeJSFSPrototype__lchownSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__lchownSyncCallback); +const ClassInfo JSSHA512_256Constructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA512_256Constructor) }; -extern "C" EncodedJSValue NodeJSFSPrototype__link(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__linkCallback); +extern "C" EncodedJSValue SHA512_256__getConstructor(Zig::GlobalObject* globalObject) +{ + return JSValue::encode(globalObject->JSSHA512_256Constructor()); +} -extern "C" EncodedJSValue NodeJSFSPrototype__linkSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__linkSyncCallback); +JSSHA512_256::~JSSHA512_256() +{ + if (m_ctx) { + SHA512_256Class__finalize(m_ctx); + } +} +void JSSHA512_256::destroy(JSCell* cell) +{ + static_cast<JSSHA512_256*>(cell)->JSSHA512_256::~JSSHA512_256(); +} -extern "C" EncodedJSValue NodeJSFSPrototype__lstat(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__lstatCallback); +const ClassInfo JSSHA512_256::s_info = { "SHA512_256"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA512_256) }; -extern "C" EncodedJSValue NodeJSFSPrototype__lstatSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__lstatSyncCallback); +void JSSHA512_256::finishCreation(VM& vm) +{ + Base::finishCreation(vm); + ASSERT(inherits(info())); +} -extern "C" EncodedJSValue NodeJSFSPrototype__lutimes(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__lutimesCallback); +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" EncodedJSValue NodeJSFSPrototype__lutimesSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__lutimesSyncCallback); +extern "C" void* SHA512_256__fromJS(JSC::EncodedJSValue value) +{ + JSC::JSValue decodedValue = JSC::JSValue::decode(value); + if (decodedValue.isEmpty() || !decodedValue.isCell()) + return nullptr; -extern "C" EncodedJSValue NodeJSFSPrototype__mkdir(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__mkdirCallback); + JSC::JSCell* cell = decodedValue.asCell(); + JSSHA512_256* object = JSC::jsDynamicCast<JSSHA512_256*>(cell); -extern "C" EncodedJSValue NodeJSFSPrototype__mkdirSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__mkdirSyncCallback); + if (!object) + return nullptr; -extern "C" EncodedJSValue NodeJSFSPrototype__mkdtemp(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__mkdtempCallback); + return object->wrapped(); +} -extern "C" EncodedJSValue NodeJSFSPrototype__mkdtempSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__mkdtempSyncCallback); +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; -extern "C" EncodedJSValue NodeJSFSPrototype__open(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__openCallback); + object->m_ctx = ptr; + return true; +} -extern "C" EncodedJSValue NodeJSFSPrototype__opendir(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__opendirCallback); +extern "C" const size_t SHA512_256__ptrOffset = JSSHA512_256::offsetOfWrapped(); -extern "C" EncodedJSValue NodeJSFSPrototype__opendirSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__opendirSyncCallback); +void JSSHA512_256::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) +{ + auto* thisObject = jsCast<JSSHA512_256*>(cell); + if (void* wrapped = thisObject->wrapped()) { + // if (thisObject->scriptExecutionContext()) + // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); + } + Base::analyzeHeap(cell, analyzer); +} -extern "C" EncodedJSValue NodeJSFSPrototype__openSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__openSyncCallback); +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)); +} -extern "C" EncodedJSValue NodeJSFSPrototype__read(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__readCallback); +JSObject* JSSHA512_256::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) +{ + return JSSHA512_256Prototype::create(vm, globalObject, JSSHA512_256Prototype::createStructure(vm, globalObject, globalObject->objectPrototype())); +} -extern "C" EncodedJSValue NodeJSFSPrototype__readdir(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__readdirCallback); +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); -extern "C" EncodedJSValue NodeJSFSPrototype__readdirSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__readdirSyncCallback); + return JSValue::encode(instance); +} +class JSServerWebSocketPrototype final : public JSC::JSNonFinalObject { +public: + using Base = JSC::JSNonFinalObject; -extern "C" EncodedJSValue NodeJSFSPrototype__readFile(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__readFileCallback); + 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; + } -extern "C" EncodedJSValue NodeJSFSPrototype__readFileSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__readFileSyncCallback); + 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()); + } -extern "C" EncodedJSValue NodeJSFSPrototype__readlink(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__readlinkCallback); +private: + JSServerWebSocketPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) + : Base(vm, structure) + { + } -extern "C" EncodedJSValue NodeJSFSPrototype__readlinkSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__readlinkSyncCallback); + void finishCreation(JSC::VM&, JSC::JSGlobalObject*); +}; -extern "C" EncodedJSValue NodeJSFSPrototype__readSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__readSyncCallback); +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); -extern "C" EncodedJSValue NodeJSFSPrototype__readv(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__readvCallback); + static constexpr unsigned StructureFlags = Base::StructureFlags; + static constexpr bool needsDestruction = false; -extern "C" EncodedJSValue NodeJSFSPrototype__readvSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__readvSyncCallback); + 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()); + } -extern "C" EncodedJSValue NodeJSFSPrototype__realpath(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__realpathCallback); + 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 = WTFMove(space); }, + [](auto& spaces) { return spaces.m_subspaceForServerWebSocketConstructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForServerWebSocketConstructor = WTFMove(space); }); + } -extern "C" EncodedJSValue NodeJSFSPrototype__realpathSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__realpathSyncCallback); + void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSServerWebSocketPrototype* prototype); -extern "C" EncodedJSValue NodeJSFSPrototype__rename(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__renameCallback); + // Must be defined for each specialization class. + static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*); -extern "C" EncodedJSValue NodeJSFSPrototype__renameSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__renameSyncCallback); + DECLARE_EXPORT_INFO; -extern "C" EncodedJSValue NodeJSFSPrototype__rm(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__rmCallback); +private: + JSServerWebSocketConstructor(JSC::VM& vm, JSC::Structure* structure); + void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSServerWebSocketPrototype* prototype); +}; -extern "C" EncodedJSValue NodeJSFSPrototype__rmdir(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__rmdirCallback); +extern "C" void* ServerWebSocketClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); +JSC_DECLARE_CUSTOM_GETTER(jsServerWebSocketConstructor); +extern "C" void ServerWebSocketClass__finalize(void*); -extern "C" EncodedJSValue NodeJSFSPrototype__rmdirSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__rmdirSyncCallback); +extern "C" JSC::EncodedJSValue ServerWebSocketPrototype__getBinaryType(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); +JSC_DECLARE_CUSTOM_GETTER(ServerWebSocketPrototype__binaryTypeGetterWrap); -extern "C" EncodedJSValue NodeJSFSPrototype__rmSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__rmSyncCallback); +extern "C" bool ServerWebSocketPrototype__setBinaryType(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::EncodedJSValue value); +JSC_DECLARE_CUSTOM_SETTER(ServerWebSocketPrototype__binaryTypeSetterWrap); -extern "C" EncodedJSValue NodeJSFSPrototype__stat(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__statCallback); +extern "C" EncodedJSValue ServerWebSocketPrototype__close(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(ServerWebSocketPrototype__closeCallback); -extern "C" EncodedJSValue NodeJSFSPrototype__statSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__statSyncCallback); +extern "C" EncodedJSValue ServerWebSocketPrototype__cork(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(ServerWebSocketPrototype__corkCallback); -extern "C" EncodedJSValue NodeJSFSPrototype__symlink(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__symlinkCallback); +extern "C" JSC::EncodedJSValue ServerWebSocketPrototype__getData(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); +JSC_DECLARE_CUSTOM_GETTER(ServerWebSocketPrototype__dataGetterWrap); -extern "C" EncodedJSValue NodeJSFSPrototype__symlinkSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__symlinkSyncCallback); +extern "C" bool ServerWebSocketPrototype__setData(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::EncodedJSValue value); +JSC_DECLARE_CUSTOM_SETTER(ServerWebSocketPrototype__dataSetterWrap); -extern "C" EncodedJSValue NodeJSFSPrototype__truncate(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__truncateCallback); +extern "C" EncodedJSValue ServerWebSocketPrototype__getBufferedAmount(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(ServerWebSocketPrototype__getBufferedAmountCallback); -extern "C" EncodedJSValue NodeJSFSPrototype__truncateSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__truncateSyncCallback); +extern "C" EncodedJSValue ServerWebSocketPrototype__isSubscribed(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(ServerWebSocketPrototype__isSubscribedCallback); -extern "C" EncodedJSValue NodeJSFSPrototype__unlink(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__unlinkCallback); +extern "C" EncodedJSValue ServerWebSocketPrototype__publish(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(ServerWebSocketPrototype__publishCallback); -extern "C" EncodedJSValue NodeJSFSPrototype__unlinkSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__unlinkSyncCallback); +extern "C" EncodedJSValue ServerWebSocketPrototype__publishBinary(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(ServerWebSocketPrototype__publishBinaryCallback); -extern "C" EncodedJSValue NodeJSFSPrototype__utimes(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__utimesCallback); +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 NodeJSFSPrototype__utimesSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__utimesSyncCallback); +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); -extern "C" EncodedJSValue NodeJSFSPrototype__write(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__writeCallback); +JSC_DEFINE_JIT_OPERATION(ServerWebSocketPrototype__publishBinaryWithoutTypeChecksWrapper, EncodedJSValue, (JSC::JSGlobalObject * lexicalGlobalObject, void* thisValue, JSC::JSString* arg0, JSC::JSUint8Array* arg1)) +{ + VM& vm = JSC::getVM(lexicalGlobalObject); + IGNORE_WARNINGS_BEGIN("frame-address") + CallFrame* callFrame = DECLARE_CALL_FRAME(vm); + IGNORE_WARNINGS_END + JSC::JITOperationPrologueCallFrameTracer tracer(vm, callFrame); + return ServerWebSocketPrototype__publishBinaryWithoutTypeChecks(reinterpret_cast<JSServerWebSocket*>(thisValue)->wrapped(), lexicalGlobalObject, arg0, arg1); +} -extern "C" EncodedJSValue NodeJSFSPrototype__writeFile(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__writeFileCallback); +extern "C" EncodedJSValue ServerWebSocketPrototype__publishText(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); +JSC_DECLARE_HOST_FUNCTION(ServerWebSocketPrototype__publishTextCallback); -extern "C" EncodedJSValue NodeJSFSPrototype__writeFileSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__writeFileSyncCallback); +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 NodeJSFSPrototype__writeSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__writeSyncCallback); +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); -extern "C" EncodedJSValue NodeJSFSPrototype__writev(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__writevCallback); +JSC_DEFINE_JIT_OPERATION(ServerWebSocketPrototype__publishTextWithoutTypeChecksWrapper, EncodedJSValue, (JSC::JSGlobalObject * lexicalGlobalObject, void* thisValue, JSC::JSString* arg0, JSC::JSString* arg1)) +{ + VM& vm = JSC::getVM(lexicalGlobalObject); + IGNORE_WARNINGS_BEGIN("frame-address") + CallFrame* callFrame = DECLARE_CALL_FRAME(vm); + IGNORE_WARNINGS_END + JSC::JITOperationPrologueCallFrameTracer tracer(vm, callFrame); + return ServerWebSocketPrototype__publishTextWithoutTypeChecks(reinterpret_cast<JSServerWebSocket*>(thisValue)->wrapped(), lexicalGlobalObject, arg0, arg1); +} -extern "C" EncodedJSValue NodeJSFSPrototype__writevSync(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); -JSC_DECLARE_HOST_FUNCTION(NodeJSFSPrototype__writevSyncCallback); +extern "C" JSC::EncodedJSValue ServerWebSocketPrototype__getReadyState(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); +JSC_DECLARE_CUSTOM_GETTER(ServerWebSocketPrototype__readyStateGetterWrap); -STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSNodeJSFSPrototype, JSNodeJSFSPrototype::Base); +extern "C" JSC::EncodedJSValue ServerWebSocketPrototype__getRemoteAddress(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); +JSC_DECLARE_CUSTOM_GETTER(ServerWebSocketPrototype__remoteAddressGetterWrap); -static const HashTableValue JSNodeJSFSPrototypeTableValues[] = { - { "access"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__accessCallback, 3 } }, - { "accessSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__accessSyncCallback, 2 } }, - { "appendFile"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__appendFileCallback, 4 } }, - { "appendFileSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__appendFileSyncCallback, 3 } }, - { "chmod"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__chmodCallback, 3 } }, - { "chmodSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__chmodSyncCallback, 2 } }, - { "chown"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__chownCallback, 4 } }, - { "chownSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__chownSyncCallback, 3 } }, - { "close"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__closeCallback, 1 } }, - { "closeSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__closeSyncCallback, 1 } }, - { "copyFile"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__copyFileCallback, 4 } }, - { "copyFileSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__copyFileSyncCallback, 3 } }, - { "Dirent"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, NodeJSFSPrototype__DirentGetterWrap, 0 } }, - { "exists"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__existsCallback, 2 } }, - { "existsSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__existsSyncCallback, 1 } }, - { "fchmod"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__fchmodCallback, 3 } }, - { "fchmodSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__fchmodSyncCallback, 2 } }, - { "fchown"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__fchownCallback, 4 } }, - { "fchownSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__fchownSyncCallback, 3 } }, - { "fdatasync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__fdatasyncCallback, 2 } }, - { "fdatasyncSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__fdatasyncSyncCallback, 1 } }, - { "fstat"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__fstatCallback, 1 } }, - { "fstatSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__fstatSyncCallback, 1 } }, - { "fsync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__fsyncCallback, 2 } }, - { "fsyncSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__fsyncSyncCallback, 1 } }, - { "ftruncate"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__ftruncateCallback, 1 } }, - { "ftruncateSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__ftruncateSyncCallback, 1 } }, - { "futimes"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__futimesCallback, 4 } }, - { "futimesSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__futimesSyncCallback, 3 } }, - { "lchmod"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__lchmodCallback, 3 } }, - { "lchmodSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__lchmodSyncCallback, 2 } }, - { "lchown"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__lchownCallback, 4 } }, - { "lchownSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__lchownSyncCallback, 3 } }, - { "link"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__linkCallback, 3 } }, - { "linkSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__linkSyncCallback, 2 } }, - { "lstat"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__lstatCallback, 1 } }, - { "lstatSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__lstatSyncCallback, 1 } }, - { "lutimes"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__lutimesCallback, 4 } }, - { "lutimesSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__lutimesSyncCallback, 3 } }, - { "mkdir"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__mkdirCallback, 3 } }, - { "mkdirSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__mkdirSyncCallback, 2 } }, - { "mkdtemp"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__mkdtempCallback, 3 } }, - { "mkdtempSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__mkdtempSyncCallback, 2 } }, - { "open"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__openCallback, 4 } }, - { "opendir"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__opendirCallback, 3 } }, - { "opendirSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__opendirSyncCallback, 2 } }, - { "openSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__openSyncCallback, 3 } }, - { "read"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__readCallback, 6 } }, - { "readdir"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__readdirCallback, 3 } }, - { "readdirSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__readdirSyncCallback, 2 } }, - { "readFile"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__readFileCallback, 3 } }, - { "readFileSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__readFileSyncCallback, 2 } }, - { "readlink"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__readlinkCallback, 3 } }, - { "readlinkSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__readlinkSyncCallback, 2 } }, - { "readSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__readSyncCallback, 5 } }, - { "readv"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__readvCallback, 4 } }, - { "readvSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__readvSyncCallback, 3 } }, - { "realpath"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__realpathCallback, 3 } }, - { "realpathSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__realpathSyncCallback, 2 } }, - { "rename"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__renameCallback, 3 } }, - { "renameSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__renameSyncCallback, 2 } }, - { "rm"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__rmCallback, 3 } }, - { "rmdir"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__rmdirCallback, 3 } }, - { "rmdirSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__rmdirSyncCallback, 2 } }, - { "rmSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__rmSyncCallback, 2 } }, - { "stat"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__statCallback, 1 } }, - { "statSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__statSyncCallback, 1 } }, - { "symlink"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__symlinkCallback, 4 } }, - { "symlinkSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__symlinkSyncCallback, 3 } }, - { "truncate"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__truncateCallback, 3 } }, - { "truncateSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__truncateSyncCallback, 2 } }, - { "unlink"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__unlinkCallback, 2 } }, - { "unlinkSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__unlinkSyncCallback, 1 } }, - { "utimes"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__utimesCallback, 4 } }, - { "utimesSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__utimesSyncCallback, 3 } }, - { "write"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__writeCallback, 6 } }, - { "writeFile"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__writeFileCallback, 4 } }, - { "writeFileSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__writeFileSyncCallback, 3 } }, - { "writeSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__writeSyncCallback, 5 } }, - { "writev"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__writevCallback, 4 } }, - { "writevSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, NodeJSFSPrototype__writevSyncCallback, 3 } } +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); + +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)) +{ + VM& vm = JSC::getVM(lexicalGlobalObject); + IGNORE_WARNINGS_BEGIN("frame-address") + CallFrame* callFrame = DECLARE_CALL_FRAME(vm); + IGNORE_WARNINGS_END + JSC::JITOperationPrologueCallFrameTracer tracer(vm, callFrame); + return ServerWebSocketPrototype__sendBinaryWithoutTypeChecks(reinterpret_cast<JSServerWebSocket*>(thisValue)->wrapped(), lexicalGlobalObject, arg0, arg1); +} + +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); + +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)) +{ + VM& vm = JSC::getVM(lexicalGlobalObject); + IGNORE_WARNINGS_BEGIN("frame-address") + CallFrame* callFrame = DECLARE_CALL_FRAME(vm); + IGNORE_WARNINGS_END + JSC::JITOperationPrologueCallFrameTracer tracer(vm, callFrame); + return ServerWebSocketPrototype__sendTextWithoutTypeChecks(reinterpret_cast<JSServerWebSocket*>(thisValue)->wrapped(), lexicalGlobalObject, arg0, arg1); +} + +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), NoIntrinsic, { HashTableValue::GetterSetterType, ServerWebSocketPrototype__binaryTypeGetterWrap, ServerWebSocketPrototype__binaryTypeSetterWrap } }, + { "close"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ServerWebSocketPrototype__closeCallback, 1 } }, + { "cork"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ServerWebSocketPrototype__corkCallback, 1 } }, + { "data"_s, static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, ServerWebSocketPrototype__dataGetterWrap, ServerWebSocketPrototype__dataSetterWrap } }, + { "getBufferedAmount"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ServerWebSocketPrototype__getBufferedAmountCallback, 0 } }, + { "isSubscribed"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ServerWebSocketPrototype__isSubscribedCallback, 1 } }, + { "publish"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ServerWebSocketPrototype__publishCallback, 3 } }, + { "publishBinary"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | JSC::PropertyAttribute::DOMJITFunction), NoIntrinsic, { HashTableValue::DOMJITFunctionType, ServerWebSocketPrototype__publishBinaryCallback, &DOMJITSignatureForServerWebSocketPrototype__publishBinary } }, + { "publishText"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | JSC::PropertyAttribute::DOMJITFunction), NoIntrinsic, { HashTableValue::DOMJITFunctionType, ServerWebSocketPrototype__publishTextCallback, &DOMJITSignatureForServerWebSocketPrototype__publishText } }, + { "readyState"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, ServerWebSocketPrototype__readyStateGetterWrap, 0 } }, + { "remoteAddress"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, ServerWebSocketPrototype__remoteAddressGetterWrap, 0 } }, + { "send"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ServerWebSocketPrototype__sendCallback, 2 } }, + { "sendBinary"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | JSC::PropertyAttribute::DOMJITFunction), NoIntrinsic, { HashTableValue::DOMJITFunctionType, ServerWebSocketPrototype__sendBinaryCallback, &DOMJITSignatureForServerWebSocketPrototype__sendBinary } }, + { "sendText"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function | JSC::PropertyAttribute::DOMJITFunction), NoIntrinsic, { HashTableValue::DOMJITFunctionType, ServerWebSocketPrototype__sendTextCallback, &DOMJITSignatureForServerWebSocketPrototype__sendText } }, + { "subscribe"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ServerWebSocketPrototype__subscribeCallback, 1 } }, + { "unsubscribe"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, ServerWebSocketPrototype__unsubscribeCallback, 1 } } }; -const ClassInfo JSNodeJSFSPrototype::s_info = { "NodeJSFS"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSNodeJSFSPrototype) }; +const ClassInfo JSServerWebSocketPrototype::s_info = { "ServerWebSocket"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSServerWebSocketPrototype) }; -JSC_DEFINE_CUSTOM_GETTER(jsNodeJSFSConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) +JSC_DEFINE_CUSTOM_GETTER(jsServerWebSocketConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); auto* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); - auto* prototype = jsDynamicCast<JSNodeJSFSPrototype*>(JSValue::decode(thisValue)); + auto* prototype = jsDynamicCast<JSServerWebSocketPrototype*>(JSValue::decode(thisValue)); if (UNLIKELY(!prototype)) return throwVMTypeError(lexicalGlobalObject, throwScope); - return JSValue::encode(globalObject->JSNodeJSFSConstructor()); + return JSValue::encode(globalObject->JSServerWebSocketConstructor()); } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__accessCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_CUSTOM_GETTER(ServerWebSocketPrototype__binaryTypeGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } - + 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); - - return NodeJSFSPrototype__access(thisObject->wrapped(), lexicalGlobalObject, callFrame); + JSC::EncodedJSValue result = ServerWebSocketPrototype__getBinaryType(thisObject->wrapped(), globalObject); + RETURN_IF_EXCEPTION(throwScope, {}); + RELEASE_AND_RETURN(throwScope, result); } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__accessSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_CUSTOM_SETTER(ServerWebSocketPrototype__binaryTypeSetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } - + auto throwScope = DECLARE_THROW_SCOPE(vm); + JSServerWebSocket* thisObject = jsCast<JSServerWebSocket*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + auto result = ServerWebSocketPrototype__setBinaryType(thisObject->wrapped(), lexicalGlobalObject, encodedValue); - return NodeJSFSPrototype__accessSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); + RELEASE_AND_RETURN(throwScope, result); } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__appendFileCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(ServerWebSocketPrototype__closeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSServerWebSocket* thisObject = jsDynamicCast<JSServerWebSocket*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -10267,14 +9407,14 @@ JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__appendFileCallback, (JSGlobalObject JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return NodeJSFSPrototype__appendFile(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return ServerWebSocketPrototype__close(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__appendFileSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(ServerWebSocketPrototype__corkCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSServerWebSocket* thisObject = jsDynamicCast<JSServerWebSocket*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -10283,46 +9423,56 @@ JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__appendFileSyncCallback, (JSGlobalObj JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return NodeJSFSPrototype__appendFileSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return ServerWebSocketPrototype__cork(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__chmodCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* 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); + auto throwScope = DECLARE_THROW_SCOPE(vm); + JSServerWebSocket* thisObject = jsCast<JSServerWebSocket*>(JSValue::decode(thisValue)); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + if (JSValue cachedValue = thisObject->m_data.get()) + return JSValue::encode(cachedValue); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } + JSC::JSValue result = JSC::JSValue::decode( + ServerWebSocketPrototype__getData(thisObject->wrapped(), globalObject)); + RETURN_IF_EXCEPTION(throwScope, {}); + thisObject->m_data.set(vm, thisObject, result); + RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); +} - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); +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)); +} - return NodeJSFSPrototype__chmod(thisObject->wrapped(), lexicalGlobalObject, callFrame); +extern "C" EncodedJSValue ServerWebSocketPrototype__dataGetCachedValue(JSC::EncodedJSValue thisValue) +{ + auto* thisObject = jsCast<JSServerWebSocket*>(JSValue::decode(thisValue)); + return JSValue::encode(thisObject->m_data.get()); } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__chmodSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_CUSTOM_SETTER(ServerWebSocketPrototype__dataSetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } - + auto throwScope = DECLARE_THROW_SCOPE(vm); + JSServerWebSocket* thisObject = jsCast<JSServerWebSocket*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + auto result = ServerWebSocketPrototype__setData(thisObject->wrapped(), lexicalGlobalObject, encodedValue); - return NodeJSFSPrototype__chmodSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); + RELEASE_AND_RETURN(throwScope, result); } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__chownCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(ServerWebSocketPrototype__getBufferedAmountCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSServerWebSocket* thisObject = jsDynamicCast<JSServerWebSocket*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -10331,14 +9481,14 @@ JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__chownCallback, (JSGlobalObject * lex JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return NodeJSFSPrototype__chown(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return ServerWebSocketPrototype__getBufferedAmount(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__chownSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(ServerWebSocketPrototype__isSubscribedCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSServerWebSocket* thisObject = jsDynamicCast<JSServerWebSocket*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -10347,14 +9497,14 @@ JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__chownSyncCallback, (JSGlobalObject * JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return NodeJSFSPrototype__chownSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return ServerWebSocketPrototype__isSubscribed(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__closeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(ServerWebSocketPrototype__publishCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSServerWebSocket* thisObject = jsDynamicCast<JSServerWebSocket*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -10363,14 +9513,14 @@ JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__closeCallback, (JSGlobalObject * lex JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return NodeJSFSPrototype__close(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return ServerWebSocketPrototype__publish(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__closeSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(ServerWebSocketPrototype__publishBinaryCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSServerWebSocket* thisObject = jsDynamicCast<JSServerWebSocket*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -10379,14 +9529,14 @@ JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__closeSyncCallback, (JSGlobalObject * JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return NodeJSFSPrototype__closeSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return ServerWebSocketPrototype__publishBinary(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__copyFileCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(ServerWebSocketPrototype__publishTextCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSServerWebSocket* thisObject = jsDynamicCast<JSServerWebSocket*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -10395,42 +9545,57 @@ JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__copyFileCallback, (JSGlobalObject * JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return NodeJSFSPrototype__copyFile(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return ServerWebSocketPrototype__publishText(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__copyFileSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_CUSTOM_GETTER(ServerWebSocketPrototype__readyStateGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } - + 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); - - return NodeJSFSPrototype__copyFileSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); + JSC::EncodedJSValue result = ServerWebSocketPrototype__getReadyState(thisObject->wrapped(), globalObject); + RETURN_IF_EXCEPTION(throwScope, {}); + RELEASE_AND_RETURN(throwScope, result); } -JSC_DEFINE_CUSTOM_GETTER(NodeJSFSPrototype__DirentGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +JSC_DEFINE_CUSTOM_GETTER(ServerWebSocketPrototype__remoteAddressGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); - JSNodeJSFS* thisObject = jsCast<JSNodeJSFS*>(JSValue::decode(thisValue)); + JSServerWebSocket* thisObject = jsCast<JSServerWebSocket*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSC::EncodedJSValue result = NodeJSFSPrototype__getDirent(thisObject->wrapped(), globalObject); + + if (JSValue cachedValue = thisObject->m_remoteAddress.get()) + return JSValue::encode(cachedValue); + + JSC::JSValue result = JSC::JSValue::decode( + ServerWebSocketPrototype__getRemoteAddress(thisObject->wrapped(), globalObject)); RETURN_IF_EXCEPTION(throwScope, {}); - RELEASE_AND_RETURN(throwScope, result); + thisObject->m_remoteAddress.set(vm, thisObject, result); + RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__existsCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +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(); - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSServerWebSocket* thisObject = jsDynamicCast<JSServerWebSocket*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -10439,14 +9604,14 @@ JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__existsCallback, (JSGlobalObject * le JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return NodeJSFSPrototype__exists(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return ServerWebSocketPrototype__send(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__existsSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(ServerWebSocketPrototype__sendBinaryCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSServerWebSocket* thisObject = jsDynamicCast<JSServerWebSocket*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -10455,14 +9620,14 @@ JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__existsSyncCallback, (JSGlobalObject JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return NodeJSFSPrototype__existsSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return ServerWebSocketPrototype__sendBinary(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__fchmodCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(ServerWebSocketPrototype__sendTextCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSServerWebSocket* thisObject = jsDynamicCast<JSServerWebSocket*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -10471,14 +9636,14 @@ JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__fchmodCallback, (JSGlobalObject * le JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return NodeJSFSPrototype__fchmod(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return ServerWebSocketPrototype__sendText(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__fchmodSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(ServerWebSocketPrototype__subscribeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSServerWebSocket* thisObject = jsDynamicCast<JSServerWebSocket*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -10487,14 +9652,14 @@ JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__fchmodSyncCallback, (JSGlobalObject JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return NodeJSFSPrototype__fchmodSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return ServerWebSocketPrototype__subscribe(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__fchownCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(ServerWebSocketPrototype__unsubscribeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSServerWebSocket* thisObject = jsDynamicCast<JSServerWebSocket*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -10503,126 +9668,330 @@ JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__fchownCallback, (JSGlobalObject * le JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return NodeJSFSPrototype__fchown(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return ServerWebSocketPrototype__unsubscribe(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__fchownSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +void JSServerWebSocketPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) { - auto& vm = lexicalGlobalObject->vm(); + Base::finishCreation(vm); + reifyStaticProperties(vm, JSServerWebSocket::info(), JSServerWebSocketPrototypeTableValues, *this); + JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); +} - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); +void JSServerWebSocketConstructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSServerWebSocketPrototype* prototype) +{ + Base::finishCreation(vm, 0, "ServerWebSocket"_s, PropertyAdditionMode::WithoutStructureTransition); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } + putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly); + ASSERT(inherits(info())); +} - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); +JSServerWebSocketConstructor::JSServerWebSocketConstructor(JSC::VM& vm, JSC::Structure* structure) + : Base(vm, structure, construct, construct) +{ +} - return NodeJSFSPrototype__fchownSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); +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_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__fdatasyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSServerWebSocketConstructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) { - auto& vm = lexicalGlobalObject->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); - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + 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()); + } - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + void* ptr = ServerWebSocketClass__construct(globalObject, callFrame); + + if (UNLIKELY(!ptr)) { + return JSValue::encode(JSC::jsUndefined()); } - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSServerWebSocket* instance = JSServerWebSocket::create(vm, globalObject, structure, ptr); - return NodeJSFSPrototype__fdatasync(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return JSValue::encode(instance); } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__fdatasyncSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +void JSServerWebSocketConstructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSServerWebSocketPrototype* prototype) { - auto& vm = lexicalGlobalObject->vm(); +} - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); +const ClassInfo JSServerWebSocketConstructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSServerWebSocketConstructor) }; - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); +extern "C" EncodedJSValue ServerWebSocket__getConstructor(Zig::GlobalObject* globalObject) +{ + return JSValue::encode(globalObject->JSServerWebSocketConstructor()); +} + +JSServerWebSocket::~JSServerWebSocket() +{ + if (m_ctx) { + ServerWebSocketClass__finalize(m_ctx); } +} +void JSServerWebSocket::destroy(JSCell* cell) +{ + static_cast<JSServerWebSocket*>(cell)->JSServerWebSocket::~JSServerWebSocket(); +} - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); +const ClassInfo JSServerWebSocket::s_info = { "ServerWebSocket"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSServerWebSocket) }; - return NodeJSFSPrototype__fdatasyncSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); +void JSServerWebSocket::finishCreation(VM& vm) +{ + Base::finishCreation(vm); + ASSERT(inherits(info())); } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__fstatCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSServerWebSocket* JSServerWebSocket::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) { - auto& vm = lexicalGlobalObject->vm(); + JSServerWebSocket* ptr = new (NotNull, JSC::allocateCell<JSServerWebSocket>(vm)) JSServerWebSocket(vm, structure, ctx); + ptr->finishCreation(vm); + return ptr; +} - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); +extern "C" void* ServerWebSocket__fromJS(JSC::EncodedJSValue value) +{ + JSC::JSValue decodedValue = JSC::JSValue::decode(value); + if (decodedValue.isEmpty() || !decodedValue.isCell()) + return nullptr; - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } + JSC::JSCell* cell = decodedValue.asCell(); + JSServerWebSocket* object = JSC::jsDynamicCast<JSServerWebSocket*>(cell); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + if (!object) + return nullptr; - return NodeJSFSPrototype__fstat(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return object->wrapped(); } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__fstatSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +extern "C" bool ServerWebSocket__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) { - auto& vm = lexicalGlobalObject->vm(); + JSServerWebSocket* object = JSC::jsDynamicCast<JSServerWebSocket*>(JSValue::decode(value)); + if (!object) + return false; - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + object->m_ctx = ptr; + return true; +} - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); +extern "C" const size_t ServerWebSocket__ptrOffset = JSServerWebSocket::offsetOfWrapped(); + +void JSServerWebSocket::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) +{ + auto* thisObject = jsCast<JSServerWebSocket*>(cell); + if (void* wrapped = thisObject->wrapped()) { + // if (thisObject->scriptExecutionContext()) + // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); } + Base::analyzeHeap(cell, analyzer); +} - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); +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 NodeJSFSPrototype__fstatSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); +JSObject* JSServerWebSocket::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) +{ + return JSServerWebSocketPrototype::create(vm, globalObject, JSServerWebSocketPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__fsyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +extern "C" EncodedJSValue ServerWebSocket__create(Zig::GlobalObject* globalObject, void* ptr) { - auto& vm = lexicalGlobalObject->vm(); + auto& vm = globalObject->vm(); + JSC::Structure* structure = globalObject->JSServerWebSocketStructure(); + JSServerWebSocket* instance = JSServerWebSocket::create(vm, globalObject, structure, ptr); - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + return JSValue::encode(instance); +} - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } +template<typename Visitor> +void JSServerWebSocket::visitChildrenImpl(JSCell* cell, Visitor& visitor) +{ + JSServerWebSocket* thisObject = jsCast<JSServerWebSocket*>(cell); + ASSERT_GC_OBJECT_INHERITS(thisObject, info()); + Base::visitChildren(thisObject, visitor); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + visitor.append(thisObject->m_data); + visitor.append(thisObject->m_remoteAddress); +} - return NodeJSFSPrototype__fsync(thisObject->wrapped(), lexicalGlobalObject, callFrame); +DEFINE_VISIT_CHILDREN(JSServerWebSocket); + +template<typename Visitor> +void JSServerWebSocket::visitAdditionalChildren(Visitor& visitor) +{ + JSServerWebSocket* thisObject = this; + ASSERT_GC_OBJECT_INHERITS(thisObject, info()); + + visitor.append(thisObject->m_data); + visitor.append(thisObject->m_remoteAddress); + ; } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__fsyncSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +DEFINE_VISIT_ADDITIONAL_CHILDREN(JSServerWebSocket); + +template<typename Visitor> +void JSServerWebSocket::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) { - auto& vm = lexicalGlobalObject->vm(); + JSServerWebSocket* thisObject = jsCast<JSServerWebSocket*>(cell); + ASSERT_GC_OBJECT_INHERITS(thisObject, info()); + thisObject->visitAdditionalChildren<Visitor>(visitor); +} - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); +DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSServerWebSocket); +class JSSubprocessPrototype final : public JSC::JSNonFinalObject { +public: + using Base = JSC::JSNonFinalObject; - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + 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), NoIntrinsic, { HashTableValue::GetterSetterType, SubprocessPrototype__exitCodeGetterWrap, 0 } }, + { "exited"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, SubprocessPrototype__exitedGetterWrap, 0 } }, + { "kill"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, SubprocessPrototype__killCallback, 1 } }, + { "killed"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, SubprocessPrototype__killedGetterWrap, 0 } }, + { "pid"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, SubprocessPrototype__pidGetterWrap, 0 } }, + { "readable"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, SubprocessPrototype__readableGetterWrap, 0 } }, + { "ref"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, SubprocessPrototype__refCallback, 0 } }, + { "signalCode"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, SubprocessPrototype__signalCodeGetterWrap, 0 } }, + { "stderr"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, SubprocessPrototype__stderrGetterWrap, 0 } }, + { "stdin"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, SubprocessPrototype__stdinGetterWrap, 0 } }, + { "stdout"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, SubprocessPrototype__stdoutGetterWrap, 0 } }, + { "unref"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, SubprocessPrototype__unrefCallback, 0 } }, + { "writable"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), 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); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + auto* prototype = jsDynamicCast<JSSubprocessPrototype*>(JSValue::decode(thisValue)); + + 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); + auto throwScope = DECLARE_THROW_SCOPE(vm); + JSSubprocess* thisObject = jsCast<JSSubprocess*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC::EncodedJSValue result = SubprocessPrototype__getExitCode(thisObject->wrapped(), globalObject); + RETURN_IF_EXCEPTION(throwScope, {}); + RELEASE_AND_RETURN(throwScope, result); +} - return NodeJSFSPrototype__fsyncSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); +JSC_DEFINE_CUSTOM_GETTER(SubprocessPrototype__exitedGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +{ + auto& vm = lexicalGlobalObject->vm(); + 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::EncodedJSValue result = SubprocessPrototype__getExited(thisObject->wrapped(), globalObject); + RETURN_IF_EXCEPTION(throwScope, {}); + RELEASE_AND_RETURN(throwScope, result); } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__ftruncateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(SubprocessPrototype__killCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSSubprocess* thisObject = jsDynamicCast<JSSubprocess*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -10631,30 +10000,69 @@ JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__ftruncateCallback, (JSGlobalObject * JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return NodeJSFSPrototype__ftruncate(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return SubprocessPrototype__kill(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__ftruncateSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* 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); + auto throwScope = DECLARE_THROW_SCOPE(vm); + JSSubprocess* thisObject = jsCast<JSSubprocess*>(JSValue::decode(thisValue)); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC::EncodedJSValue result = SubprocessPrototype__getKilled(thisObject->wrapped(), globalObject); + RETURN_IF_EXCEPTION(throwScope, {}); + RELEASE_AND_RETURN(throwScope, result); +} - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } +JSC_DEFINE_CUSTOM_GETTER(SubprocessPrototype__pidGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +{ + auto& vm = lexicalGlobalObject->vm(); + 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::EncodedJSValue result = SubprocessPrototype__getPid(thisObject->wrapped(), globalObject); + 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); + auto throwScope = DECLARE_THROW_SCOPE(vm); + JSSubprocess* thisObject = jsCast<JSSubprocess*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return NodeJSFSPrototype__ftruncateSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); + if (JSValue cachedValue = thisObject->m_stdout.get()) + return JSValue::encode(cachedValue); + + JSC::JSValue result = JSC::JSValue::decode( + SubprocessPrototype__getStdout(thisObject->wrapped(), globalObject)); + RETURN_IF_EXCEPTION(throwScope, {}); + thisObject->m_stdout.set(vm, thisObject, result); + RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__futimesCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +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(); - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSSubprocess* thisObject = jsDynamicCast<JSSubprocess*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -10663,62 +10071,119 @@ JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__futimesCallback, (JSGlobalObject * l JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return NodeJSFSPrototype__futimes(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return SubprocessPrototype__doRef(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__futimesSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* 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); + auto throwScope = DECLARE_THROW_SCOPE(vm); + JSSubprocess* thisObject = jsCast<JSSubprocess*>(JSValue::decode(thisValue)); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC::EncodedJSValue result = SubprocessPrototype__getSignalCode(thisObject->wrapped(), globalObject); + RETURN_IF_EXCEPTION(throwScope, {}); + RELEASE_AND_RETURN(throwScope, result); +} - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); +JSC_DEFINE_CUSTOM_GETTER(SubprocessPrototype__stderrGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +{ + auto& vm = lexicalGlobalObject->vm(); + 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); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } + if (JSValue cachedValue = thisObject->m_stderr.get()) + return JSValue::encode(cachedValue); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC::JSValue result = JSC::JSValue::decode( + SubprocessPrototype__getStderr(thisObject->wrapped(), globalObject)); + RETURN_IF_EXCEPTION(throwScope, {}); + thisObject->m_stderr.set(vm, thisObject, result); + RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); +} - return NodeJSFSPrototype__futimesSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); +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)); } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__lchmodCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +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); + auto throwScope = DECLARE_THROW_SCOPE(vm); + JSSubprocess* thisObject = jsCast<JSSubprocess*>(JSValue::decode(thisValue)); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + if (JSValue cachedValue = thisObject->m_stdin.get()) + return JSValue::encode(cachedValue); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } + JSC::JSValue result = JSC::JSValue::decode( + SubprocessPrototype__getStdin(thisObject->wrapped(), globalObject)); + RETURN_IF_EXCEPTION(throwScope, {}); + thisObject->m_stdin.set(vm, thisObject, result); + RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); +} - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); +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)); +} - return NodeJSFSPrototype__lchmod(thisObject->wrapped(), lexicalGlobalObject, callFrame); +extern "C" EncodedJSValue SubprocessPrototype__stdinGetCachedValue(JSC::EncodedJSValue thisValue) +{ + auto* thisObject = jsCast<JSSubprocess*>(JSValue::decode(thisValue)); + return JSValue::encode(thisObject->m_stdin.get()); } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__lchmodSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_CUSTOM_GETTER(SubprocessPrototype__stdoutGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); + 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); - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + if (JSValue cachedValue = thisObject->m_stdout.get()) + return JSValue::encode(cachedValue); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } + JSC::JSValue result = JSC::JSValue::decode( + SubprocessPrototype__getStdout(thisObject->wrapped(), globalObject)); + RETURN_IF_EXCEPTION(throwScope, {}); + thisObject->m_stdout.set(vm, thisObject, result); + RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); +} - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); +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)); +} - return NodeJSFSPrototype__lchmodSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); +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(NodeJSFSPrototype__lchownCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(SubprocessPrototype__unrefCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSSubprocess* thisObject = jsDynamicCast<JSSubprocess*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -10727,126 +10192,324 @@ JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__lchownCallback, (JSGlobalObject * le JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return NodeJSFSPrototype__lchown(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return SubprocessPrototype__doUnref(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__lchownSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* 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); + auto throwScope = DECLARE_THROW_SCOPE(vm); + JSSubprocess* thisObject = jsCast<JSSubprocess*>(JSValue::decode(thisValue)); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + if (JSValue cachedValue = thisObject->m_stdin.get()) + return JSValue::encode(cachedValue); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } + JSC::JSValue result = JSC::JSValue::decode( + SubprocessPrototype__getStdin(thisObject->wrapped(), globalObject)); + RETURN_IF_EXCEPTION(throwScope, {}); + thisObject->m_stdin.set(vm, thisObject, result); + RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); +} - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); +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)); +} - return NodeJSFSPrototype__lchownSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); +extern "C" EncodedJSValue SubprocessPrototype__writableGetCachedValue(JSC::EncodedJSValue thisValue) +{ + auto* thisObject = jsCast<JSSubprocess*>(JSValue::decode(thisValue)); + return JSValue::encode(thisObject->m_stdin.get()); } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__linkCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +void JSSubprocessPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) { - auto& vm = lexicalGlobalObject->vm(); + Base::finishCreation(vm); + reifyStaticProperties(vm, JSSubprocess::info(), JSSubprocessPrototypeTableValues, *this); + JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); +} - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); +extern "C" bool Subprocess__hasPendingActivity(void* ptr); +bool JSSubprocess::hasPendingActivity(void* ctx) +{ + return Subprocess__hasPendingActivity(ctx); +} - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); +JSSubprocess::~JSSubprocess() +{ + if (m_ctx) { + SubprocessClass__finalize(m_ctx); } +} +void JSSubprocess::destroy(JSCell* cell) +{ + static_cast<JSSubprocess*>(cell)->JSSubprocess::~JSSubprocess(); +} - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); +const ClassInfo JSSubprocess::s_info = { "Subprocess"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSubprocess) }; - return NodeJSFSPrototype__link(thisObject->wrapped(), lexicalGlobalObject, callFrame); +void JSSubprocess::finishCreation(VM& vm) +{ + Base::finishCreation(vm); + ASSERT(inherits(info())); } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__linkSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSSubprocess* JSSubprocess::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) { - auto& vm = lexicalGlobalObject->vm(); + JSSubprocess* ptr = new (NotNull, JSC::allocateCell<JSSubprocess>(vm)) JSSubprocess(vm, structure, ctx); + ptr->finishCreation(vm); + return ptr; +} - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); +extern "C" void* Subprocess__fromJS(JSC::EncodedJSValue value) +{ + JSC::JSValue decodedValue = JSC::JSValue::decode(value); + if (decodedValue.isEmpty() || !decodedValue.isCell()) + return nullptr; - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } + JSC::JSCell* cell = decodedValue.asCell(); + JSSubprocess* object = JSC::jsDynamicCast<JSSubprocess*>(cell); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + if (!object) + return nullptr; - return NodeJSFSPrototype__linkSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return object->wrapped(); } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__lstatCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +extern "C" bool Subprocess__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) { - auto& vm = lexicalGlobalObject->vm(); + JSSubprocess* object = JSC::jsDynamicCast<JSSubprocess*>(JSValue::decode(value)); + if (!object) + return false; - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + object->m_ctx = ptr; + return true; +} - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); +extern "C" const size_t Subprocess__ptrOffset = JSSubprocess::offsetOfWrapped(); + +void JSSubprocess::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) +{ + auto* thisObject = jsCast<JSSubprocess*>(cell); + if (void* wrapped = thisObject->wrapped()) { + // if (thisObject->scriptExecutionContext()) + // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); } + Base::analyzeHeap(cell, analyzer); +} - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); +JSObject* JSSubprocess::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) +{ + return JSSubprocessPrototype::create(vm, globalObject, JSSubprocessPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); +} - return NodeJSFSPrototype__lstat(thisObject->wrapped(), lexicalGlobalObject, callFrame); +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); } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__lstatSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +template<typename Visitor> +void JSSubprocess::visitChildrenImpl(JSCell* cell, Visitor& visitor) { - auto& vm = lexicalGlobalObject->vm(); + JSSubprocess* thisObject = jsCast<JSSubprocess*>(cell); + ASSERT_GC_OBJECT_INHERITS(thisObject, info()); + Base::visitChildren(thisObject, visitor); - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + visitor.append(thisObject->m_stderr); + visitor.append(thisObject->m_stdin); + visitor.append(thisObject->m_stdout); + visitor.addOpaqueRoot(thisObject->wrapped()); +} - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } +DEFINE_VISIT_CHILDREN(JSSubprocess); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); +template<typename Visitor> +void JSSubprocess::visitAdditionalChildren(Visitor& visitor) +{ + JSSubprocess* thisObject = this; + ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - return NodeJSFSPrototype__lstatSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); + visitor.append(thisObject->m_stderr); + visitor.append(thisObject->m_stdin); + visitor.append(thisObject->m_stdout); + visitor.addOpaqueRoot(this->wrapped()); } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__lutimesCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +DEFINE_VISIT_ADDITIONAL_CHILDREN(JSSubprocess); + +template<typename Visitor> +void JSSubprocess::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) { - auto& vm = lexicalGlobalObject->vm(); + JSSubprocess* thisObject = jsCast<JSSubprocess*>(cell); + ASSERT_GC_OBJECT_INHERITS(thisObject, info()); + thisObject->visitAdditionalChildren<Visitor>(visitor); +} - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); +DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSSubprocess); +class JSTCPSocketPrototype final : public JSC::JSNonFinalObject { +public: + using Base = JSC::JSNonFinalObject; - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + 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; } - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + 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()); + } - return NodeJSFSPrototype__lutimes(thisObject->wrapped(), lexicalGlobalObject, callFrame); +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__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" 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), NoIntrinsic, { HashTableValue::GetterSetterType, TCPSocketPrototype__dataGetterWrap, TCPSocketPrototype__dataSetterWrap } }, + { "end"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__endCallback, 3 } }, + { "flush"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__flushCallback, 0 } }, + { "listener"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, TCPSocketPrototype__listenerGetterWrap, 0 } }, + { "localPort"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, TCPSocketPrototype__localPortGetterWrap, 0 } }, + { "readyState"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, TCPSocketPrototype__readyStateGetterWrap, 0 } }, + { "ref"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__refCallback, 0 } }, + { "reload"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__reloadCallback, 1 } }, + { "remoteAddress"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, TCPSocketPrototype__remoteAddressGetterWrap, 0 } }, + { "shutdown"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__shutdownCallback, 1 } }, + { "timeout"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__timeoutCallback, 1 } }, + { "unref"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, TCPSocketPrototype__unrefCallback, 0 } }, + { "write"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), 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); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + auto* prototype = jsDynamicCast<JSTCPSocketPrototype*>(JSValue::decode(thisValue)); + + if (UNLIKELY(!prototype)) + return throwVMTypeError(lexicalGlobalObject, throwScope); + return JSValue::encode(globalObject->JSTCPSocketConstructor()); } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__lutimesSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +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); - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + if (JSValue cachedValue = thisObject->m_data.get()) + return JSValue::encode(cachedValue); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } + JSC::JSValue result = JSC::JSValue::decode( + 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) +{ + 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)) +{ + auto& vm = lexicalGlobalObject->vm(); + auto throwScope = DECLARE_THROW_SCOPE(vm); + JSTCPSocket* thisObject = jsCast<JSTCPSocket*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + auto result = TCPSocketPrototype__setData(thisObject->wrapped(), lexicalGlobalObject, encodedValue); - return NodeJSFSPrototype__lutimesSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); + RELEASE_AND_RETURN(throwScope, result); } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__mkdirCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__endCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSTCPSocket* thisObject = jsDynamicCast<JSTCPSocket*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -10855,14 +10518,14 @@ JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__mkdirCallback, (JSGlobalObject * lex JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return NodeJSFSPrototype__mkdir(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return TCPSocketPrototype__end(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__mkdirSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__flushCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSTCPSocket* thisObject = jsDynamicCast<JSTCPSocket*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -10871,30 +10534,50 @@ JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__mkdirSyncCallback, (JSGlobalObject * JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return NodeJSFSPrototype__mkdirSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return TCPSocketPrototype__flush(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__mkdtempCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* 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); + auto throwScope = DECLARE_THROW_SCOPE(vm); + JSTCPSocket* thisObject = jsCast<JSTCPSocket*>(JSValue::decode(thisValue)); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC::EncodedJSValue result = TCPSocketPrototype__getListener(thisObject->wrapped(), globalObject); + RETURN_IF_EXCEPTION(throwScope, {}); + RELEASE_AND_RETURN(throwScope, result); +} - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } - +JSC_DEFINE_CUSTOM_GETTER(TCPSocketPrototype__localPortGetterWrap, (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); + JSC::EncodedJSValue result = TCPSocketPrototype__getLocalPort(thisObject->wrapped(), globalObject); + RETURN_IF_EXCEPTION(throwScope, {}); + RELEASE_AND_RETURN(throwScope, result); +} - return NodeJSFSPrototype__mkdtemp(thisObject->wrapped(), lexicalGlobalObject, callFrame); +JSC_DEFINE_CUSTOM_GETTER(TCPSocketPrototype__readyStateGetterWrap, (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); + JSC::EncodedJSValue result = TCPSocketPrototype__getReadyState(thisObject->wrapped(), globalObject); + RETURN_IF_EXCEPTION(throwScope, {}); + RELEASE_AND_RETURN(throwScope, result); } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__mkdtempSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__refCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSTCPSocket* thisObject = jsDynamicCast<JSTCPSocket*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -10903,14 +10586,14 @@ JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__mkdtempSyncCallback, (JSGlobalObject JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return NodeJSFSPrototype__mkdtempSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return TCPSocketPrototype__ref(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__openCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__reloadCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSTCPSocket* thisObject = jsDynamicCast<JSTCPSocket*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -10919,30 +10602,45 @@ JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__openCallback, (JSGlobalObject * lexi JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return NodeJSFSPrototype__open(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return TCPSocketPrototype__reload(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__opendirCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* 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); + auto throwScope = DECLARE_THROW_SCOPE(vm); + JSTCPSocket* thisObject = jsCast<JSTCPSocket*>(JSValue::decode(thisValue)); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + if (JSValue cachedValue = thisObject->m_remoteAddress.get()) + return JSValue::encode(cachedValue); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } + JSC::JSValue result = JSC::JSValue::decode( + TCPSocketPrototype__getRemoteAddress(thisObject->wrapped(), globalObject)); + RETURN_IF_EXCEPTION(throwScope, {}); + thisObject->m_remoteAddress.set(vm, thisObject, result); + RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); +} - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); +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)); +} - return NodeJSFSPrototype__opendir(thisObject->wrapped(), lexicalGlobalObject, callFrame); +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(NodeJSFSPrototype__opendirSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__shutdownCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSTCPSocket* thisObject = jsDynamicCast<JSTCPSocket*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -10951,14 +10649,14 @@ JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__opendirSyncCallback, (JSGlobalObject JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return NodeJSFSPrototype__opendirSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return TCPSocketPrototype__shutdown(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__openSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__timeoutCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSTCPSocket* thisObject = jsDynamicCast<JSTCPSocket*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -10967,14 +10665,14 @@ JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__openSyncCallback, (JSGlobalObject * JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return NodeJSFSPrototype__openSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return TCPSocketPrototype__timeout(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__readCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__unrefCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSTCPSocket* thisObject = jsDynamicCast<JSTCPSocket*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -10983,14 +10681,14 @@ JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__readCallback, (JSGlobalObject * lexi JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return NodeJSFSPrototype__read(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return TCPSocketPrototype__unref(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__readdirCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(TCPSocketPrototype__writeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSTCPSocket* thisObject = jsDynamicCast<JSTCPSocket*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -10999,110 +10697,291 @@ JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__readdirCallback, (JSGlobalObject * l JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return NodeJSFSPrototype__readdir(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return TCPSocketPrototype__write(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__readdirSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +void JSTCPSocketPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) { - auto& vm = lexicalGlobalObject->vm(); + Base::finishCreation(vm); + reifyStaticProperties(vm, JSTCPSocket::info(), JSTCPSocketPrototypeTableValues, *this); + JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); +} - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); +extern "C" bool TCPSocket__hasPendingActivity(void* ptr); +bool JSTCPSocket::hasPendingActivity(void* ctx) +{ + return TCPSocket__hasPendingActivity(ctx); +} - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); +JSTCPSocket::~JSTCPSocket() +{ + if (m_ctx) { + TCPSocketClass__finalize(m_ctx); } +} +void JSTCPSocket::destroy(JSCell* cell) +{ + static_cast<JSTCPSocket*>(cell)->JSTCPSocket::~JSTCPSocket(); +} - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); +const ClassInfo JSTCPSocket::s_info = { "TCPSocket"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTCPSocket) }; - return NodeJSFSPrototype__readdirSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); +void JSTCPSocket::finishCreation(VM& vm) +{ + Base::finishCreation(vm); + ASSERT(inherits(info())); } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__readFileCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSTCPSocket* JSTCPSocket::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) { - auto& vm = lexicalGlobalObject->vm(); + JSTCPSocket* ptr = new (NotNull, JSC::allocateCell<JSTCPSocket>(vm)) JSTCPSocket(vm, structure, ctx); + ptr->finishCreation(vm); + return ptr; +} - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); +extern "C" void* TCPSocket__fromJS(JSC::EncodedJSValue value) +{ + JSC::JSValue decodedValue = JSC::JSValue::decode(value); + if (decodedValue.isEmpty() || !decodedValue.isCell()) + return nullptr; - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } + JSC::JSCell* cell = decodedValue.asCell(); + JSTCPSocket* object = JSC::jsDynamicCast<JSTCPSocket*>(cell); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + if (!object) + return nullptr; - return NodeJSFSPrototype__readFile(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return object->wrapped(); } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__readFileSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +extern "C" bool TCPSocket__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) { - auto& vm = lexicalGlobalObject->vm(); + JSTCPSocket* object = JSC::jsDynamicCast<JSTCPSocket*>(JSValue::decode(value)); + if (!object) + return false; - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + object->m_ctx = ptr; + return true; +} - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); +extern "C" const size_t TCPSocket__ptrOffset = JSTCPSocket::offsetOfWrapped(); + +void JSTCPSocket::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) +{ + auto* thisObject = jsCast<JSTCPSocket*>(cell); + if (void* wrapped = thisObject->wrapped()) { + // if (thisObject->scriptExecutionContext()) + // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); } + Base::analyzeHeap(cell, analyzer); +} - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); +JSObject* JSTCPSocket::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) +{ + return JSTCPSocketPrototype::create(vm, globalObject, JSTCPSocketPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); +} - return NodeJSFSPrototype__readFileSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); +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); } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__readlinkCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +template<typename Visitor> +void JSTCPSocket::visitChildrenImpl(JSCell* cell, Visitor& visitor) { - auto& vm = lexicalGlobalObject->vm(); + JSTCPSocket* thisObject = jsCast<JSTCPSocket*>(cell); + ASSERT_GC_OBJECT_INHERITS(thisObject, info()); + Base::visitChildren(thisObject, visitor); - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + visitor.append(thisObject->m_data); + visitor.append(thisObject->m_remoteAddress); + visitor.addOpaqueRoot(thisObject->wrapped()); +} - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } +DEFINE_VISIT_CHILDREN(JSTCPSocket); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); +template<typename Visitor> +void JSTCPSocket::visitAdditionalChildren(Visitor& visitor) +{ + JSTCPSocket* thisObject = this; + ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - return NodeJSFSPrototype__readlink(thisObject->wrapped(), lexicalGlobalObject, callFrame); + visitor.append(thisObject->m_data); + visitor.append(thisObject->m_remoteAddress); + visitor.addOpaqueRoot(this->wrapped()); } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__readlinkSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +DEFINE_VISIT_ADDITIONAL_CHILDREN(JSTCPSocket); + +template<typename Visitor> +void JSTCPSocket::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) { - auto& vm = lexicalGlobalObject->vm(); + JSTCPSocket* thisObject = jsCast<JSTCPSocket*>(cell); + ASSERT_GC_OBJECT_INHERITS(thisObject, info()); + thisObject->visitAdditionalChildren<Visitor>(visitor); +} - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); +DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSTCPSocket); +class JSTLSSocketPrototype final : public JSC::JSNonFinalObject { +public: + using Base = JSC::JSNonFinalObject; - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + 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; } - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + 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()); + } - return NodeJSFSPrototype__readlinkSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); +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__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" 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), NoIntrinsic, { HashTableValue::GetterSetterType, TLSSocketPrototype__dataGetterWrap, TLSSocketPrototype__dataSetterWrap } }, + { "end"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__endCallback, 3 } }, + { "flush"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__flushCallback, 0 } }, + { "listener"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, TLSSocketPrototype__listenerGetterWrap, 0 } }, + { "localPort"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, TLSSocketPrototype__localPortGetterWrap, 0 } }, + { "readyState"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, TLSSocketPrototype__readyStateGetterWrap, 0 } }, + { "ref"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__refCallback, 0 } }, + { "reload"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__reloadCallback, 1 } }, + { "remoteAddress"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, TLSSocketPrototype__remoteAddressGetterWrap, 0 } }, + { "shutdown"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__shutdownCallback, 1 } }, + { "timeout"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__timeoutCallback, 1 } }, + { "unref"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, TLSSocketPrototype__unrefCallback, 0 } }, + { "write"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), 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); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + auto* prototype = jsDynamicCast<JSTLSSocketPrototype*>(JSValue::decode(thisValue)); + + if (UNLIKELY(!prototype)) + return throwVMTypeError(lexicalGlobalObject, throwScope); + return JSValue::encode(globalObject->JSTLSSocketConstructor()); } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__readSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +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); - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + if (JSValue cachedValue = thisObject->m_data.get()) + return JSValue::encode(cachedValue); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } + JSC::JSValue result = JSC::JSValue::decode( + 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) +{ + 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)) +{ + auto& vm = lexicalGlobalObject->vm(); + auto throwScope = DECLARE_THROW_SCOPE(vm); + JSTLSSocket* thisObject = jsCast<JSTLSSocket*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + auto result = TLSSocketPrototype__setData(thisObject->wrapped(), lexicalGlobalObject, encodedValue); - return NodeJSFSPrototype__readSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); + RELEASE_AND_RETURN(throwScope, result); } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__readvCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__endCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSTLSSocket* thisObject = jsDynamicCast<JSTLSSocket*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -11111,14 +10990,14 @@ JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__readvCallback, (JSGlobalObject * lex JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return NodeJSFSPrototype__readv(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return TLSSocketPrototype__end(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__readvSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__flushCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSTLSSocket* thisObject = jsDynamicCast<JSTLSSocket*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -11127,30 +11006,50 @@ JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__readvSyncCallback, (JSGlobalObject * JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return NodeJSFSPrototype__readvSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return TLSSocketPrototype__flush(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__realpathCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* 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); + auto throwScope = DECLARE_THROW_SCOPE(vm); + JSTLSSocket* thisObject = jsCast<JSTLSSocket*>(JSValue::decode(thisValue)); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + JSC::EncodedJSValue result = TLSSocketPrototype__getListener(thisObject->wrapped(), globalObject); + RETURN_IF_EXCEPTION(throwScope, {}); + RELEASE_AND_RETURN(throwScope, result); +} - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); - - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } - +JSC_DEFINE_CUSTOM_GETTER(TLSSocketPrototype__localPortGetterWrap, (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); + JSC::EncodedJSValue result = TLSSocketPrototype__getLocalPort(thisObject->wrapped(), globalObject); + RETURN_IF_EXCEPTION(throwScope, {}); + RELEASE_AND_RETURN(throwScope, result); +} - return NodeJSFSPrototype__realpath(thisObject->wrapped(), lexicalGlobalObject, callFrame); +JSC_DEFINE_CUSTOM_GETTER(TLSSocketPrototype__readyStateGetterWrap, (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); + JSC::EncodedJSValue result = TLSSocketPrototype__getReadyState(thisObject->wrapped(), globalObject); + RETURN_IF_EXCEPTION(throwScope, {}); + RELEASE_AND_RETURN(throwScope, result); } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__realpathSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__refCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSTLSSocket* thisObject = jsDynamicCast<JSTLSSocket*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -11159,14 +11058,14 @@ JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__realpathSyncCallback, (JSGlobalObjec JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return NodeJSFSPrototype__realpathSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return TLSSocketPrototype__ref(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__renameCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__reloadCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSTLSSocket* thisObject = jsDynamicCast<JSTLSSocket*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -11175,30 +11074,45 @@ JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__renameCallback, (JSGlobalObject * le JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return NodeJSFSPrototype__rename(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return TLSSocketPrototype__reload(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__renameSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* 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); + auto throwScope = DECLARE_THROW_SCOPE(vm); + JSTLSSocket* thisObject = jsCast<JSTLSSocket*>(JSValue::decode(thisValue)); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + if (JSValue cachedValue = thisObject->m_remoteAddress.get()) + return JSValue::encode(cachedValue); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } + JSC::JSValue result = JSC::JSValue::decode( + TLSSocketPrototype__getRemoteAddress(thisObject->wrapped(), globalObject)); + RETURN_IF_EXCEPTION(throwScope, {}); + thisObject->m_remoteAddress.set(vm, thisObject, result); + RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); +} - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); +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)); +} - return NodeJSFSPrototype__renameSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); +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(NodeJSFSPrototype__rmCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__shutdownCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSTLSSocket* thisObject = jsDynamicCast<JSTLSSocket*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -11207,14 +11121,14 @@ JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__rmCallback, (JSGlobalObject * lexica JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return NodeJSFSPrototype__rm(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return TLSSocketPrototype__shutdown(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__rmdirCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__timeoutCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSTLSSocket* thisObject = jsDynamicCast<JSTLSSocket*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -11223,14 +11137,14 @@ JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__rmdirCallback, (JSGlobalObject * lex JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return NodeJSFSPrototype__rmdir(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return TLSSocketPrototype__timeout(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__rmdirSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__unrefCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSTLSSocket* thisObject = jsDynamicCast<JSTLSSocket*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -11239,14 +11153,14 @@ JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__rmdirSyncCallback, (JSGlobalObject * JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return NodeJSFSPrototype__rmdirSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return TLSSocketPrototype__unref(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__rmSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(TLSSocketPrototype__writeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSTLSSocket* thisObject = jsDynamicCast<JSTLSSocket*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -11255,94 +11169,261 @@ JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__rmSyncCallback, (JSGlobalObject * le JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return NodeJSFSPrototype__rmSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return TLSSocketPrototype__write(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__statCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +void JSTLSSocketPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) { - auto& vm = lexicalGlobalObject->vm(); + Base::finishCreation(vm); + reifyStaticProperties(vm, JSTLSSocket::info(), JSTLSSocketPrototypeTableValues, *this); + JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); +} - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); +extern "C" bool TLSSocket__hasPendingActivity(void* ptr); +bool JSTLSSocket::hasPendingActivity(void* ctx) +{ + return TLSSocket__hasPendingActivity(ctx); +} - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); +JSTLSSocket::~JSTLSSocket() +{ + if (m_ctx) { + TLSSocketClass__finalize(m_ctx); } +} +void JSTLSSocket::destroy(JSCell* cell) +{ + static_cast<JSTLSSocket*>(cell)->JSTLSSocket::~JSTLSSocket(); +} - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); +const ClassInfo JSTLSSocket::s_info = { "TLSSocket"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTLSSocket) }; - return NodeJSFSPrototype__stat(thisObject->wrapped(), lexicalGlobalObject, callFrame); +void JSTLSSocket::finishCreation(VM& vm) +{ + Base::finishCreation(vm); + ASSERT(inherits(info())); } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__statSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSTLSSocket* JSTLSSocket::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) { - auto& vm = lexicalGlobalObject->vm(); + JSTLSSocket* ptr = new (NotNull, JSC::allocateCell<JSTLSSocket>(vm)) JSTLSSocket(vm, structure, ctx); + ptr->finishCreation(vm); + return ptr; +} - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); +extern "C" void* TLSSocket__fromJS(JSC::EncodedJSValue value) +{ + JSC::JSValue decodedValue = JSC::JSValue::decode(value); + if (decodedValue.isEmpty() || !decodedValue.isCell()) + return nullptr; - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } + JSC::JSCell* cell = decodedValue.asCell(); + JSTLSSocket* object = JSC::jsDynamicCast<JSTLSSocket*>(cell); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + if (!object) + return nullptr; - return NodeJSFSPrototype__statSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return object->wrapped(); } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__symlinkCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +extern "C" bool TLSSocket__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) { - auto& vm = lexicalGlobalObject->vm(); + JSTLSSocket* object = JSC::jsDynamicCast<JSTLSSocket*>(JSValue::decode(value)); + if (!object) + return false; - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + object->m_ctx = ptr; + return true; +} - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); +extern "C" const size_t TLSSocket__ptrOffset = JSTLSSocket::offsetOfWrapped(); + +void JSTLSSocket::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) +{ + auto* thisObject = jsCast<JSTLSSocket*>(cell); + if (void* wrapped = thisObject->wrapped()) { + // if (thisObject->scriptExecutionContext()) + // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); } + Base::analyzeHeap(cell, analyzer); +} - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); +JSObject* JSTLSSocket::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) +{ + return JSTLSSocketPrototype::create(vm, globalObject, JSTLSSocketPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); +} - return NodeJSFSPrototype__symlink(thisObject->wrapped(), lexicalGlobalObject, callFrame); +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); } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__symlinkSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +template<typename Visitor> +void JSTLSSocket::visitChildrenImpl(JSCell* cell, Visitor& visitor) { - auto& vm = lexicalGlobalObject->vm(); + JSTLSSocket* thisObject = jsCast<JSTLSSocket*>(cell); + ASSERT_GC_OBJECT_INHERITS(thisObject, info()); + Base::visitChildren(thisObject, visitor); - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + visitor.append(thisObject->m_data); + visitor.append(thisObject->m_remoteAddress); + visitor.addOpaqueRoot(thisObject->wrapped()); +} - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } +DEFINE_VISIT_CHILDREN(JSTLSSocket); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); +template<typename Visitor> +void JSTLSSocket::visitAdditionalChildren(Visitor& visitor) +{ + JSTLSSocket* thisObject = this; + ASSERT_GC_OBJECT_INHERITS(thisObject, info()); - return NodeJSFSPrototype__symlinkSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); + visitor.append(thisObject->m_data); + visitor.append(thisObject->m_remoteAddress); + visitor.addOpaqueRoot(this->wrapped()); } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__truncateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +DEFINE_VISIT_ADDITIONAL_CHILDREN(JSTLSSocket); + +template<typename Visitor> +void JSTLSSocket::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) { - auto& vm = lexicalGlobalObject->vm(); + JSTLSSocket* thisObject = jsCast<JSTLSSocket*>(cell); + ASSERT_GC_OBJECT_INHERITS(thisObject, info()); + thisObject->visitAdditionalChildren<Visitor>(visitor); +} - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); +DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSTLSSocket); +class JSTextDecoderPrototype final : public JSC::JSNonFinalObject { +public: + using Base = JSC::JSNonFinalObject; - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + 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; } - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + 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()); + } - return NodeJSFSPrototype__truncate(thisObject->wrapped(), lexicalGlobalObject, callFrame); +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 = WTFMove(space); }, + [](auto& spaces) { return spaces.m_subspaceForTextDecoderConstructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForTextDecoderConstructor = WTFMove(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); +}; + +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); + +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)) +{ + VM& vm = JSC::getVM(lexicalGlobalObject); + IGNORE_WARNINGS_BEGIN("frame-address") + CallFrame* callFrame = DECLARE_CALL_FRAME(vm); + IGNORE_WARNINGS_END + JSC::JITOperationPrologueCallFrameTracer tracer(vm, callFrame); + return TextDecoderPrototype__decodeWithoutTypeChecks(reinterpret_cast<JSTextDecoder*>(thisValue)->wrapped(), lexicalGlobalObject, arg0); } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__truncateSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +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), NoIntrinsic, { HashTableValue::DOMJITFunctionType, TextDecoderPrototype__decodeCallback, &DOMJITSignatureForTextDecoderPrototype__decode } }, + { "encoding"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { HashTableValue::GetterSetterType, TextDecoderPrototype__encodingGetterWrap, 0 } }, + { "fatal"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), 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); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + auto* prototype = jsDynamicCast<JSTextDecoderPrototype*>(JSValue::decode(thisValue)); + + 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(); - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSTextDecoder* thisObject = jsDynamicCast<JSTextDecoder*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -11351,110 +11432,348 @@ JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__truncateSyncCallback, (JSGlobalObjec JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return NodeJSFSPrototype__truncateSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return TextDecoderPrototype__decode(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__unlinkCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* 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); + auto throwScope = DECLARE_THROW_SCOPE(vm); + JSTextDecoder* thisObject = jsCast<JSTextDecoder*>(JSValue::decode(thisValue)); + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + if (JSValue cachedValue = thisObject->m_encoding.get()) + return JSValue::encode(cachedValue); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } + JSC::JSValue result = JSC::JSValue::decode( + TextDecoderPrototype__getEncoding(thisObject->wrapped(), globalObject)); + RETURN_IF_EXCEPTION(throwScope, {}); + thisObject->m_encoding.set(vm, thisObject, result); + RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); +} - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); +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)); +} - return NodeJSFSPrototype__unlink(thisObject->wrapped(), lexicalGlobalObject, callFrame); +extern "C" EncodedJSValue TextDecoderPrototype__encodingGetCachedValue(JSC::EncodedJSValue thisValue) +{ + auto* thisObject = jsCast<JSTextDecoder*>(JSValue::decode(thisValue)); + return JSValue::encode(thisObject->m_encoding.get()); } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__unlinkSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_CUSTOM_GETTER(TextDecoderPrototype__fatalGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); + 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::EncodedJSValue result = TextDecoderPrototype__getFatal(thisObject->wrapped(), globalObject); + RETURN_IF_EXCEPTION(throwScope, {}); + RELEASE_AND_RETURN(throwScope, result); +} - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); +void JSTextDecoderPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) +{ + Base::finishCreation(vm); + reifyStaticProperties(vm, JSTextDecoder::info(), JSTextDecoderPrototypeTableValues, *this); + JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); +} - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); - } +void JSTextDecoderConstructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSTextDecoderPrototype* prototype) +{ + Base::finishCreation(vm, 0, "TextDecoder"_s, PropertyAdditionMode::WithoutStructureTransition); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly); + ASSERT(inherits(info())); +} - return NodeJSFSPrototype__unlinkSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); +JSTextDecoderConstructor::JSTextDecoderConstructor(JSC::VM& vm, JSC::Structure* structure) + : Base(vm, structure, construct, construct) +{ } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__utimesCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSTextDecoderConstructor* JSTextDecoderConstructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSTextDecoderPrototype* prototype) { - auto& vm = lexicalGlobalObject->vm(); + JSTextDecoderConstructor* ptr = new (NotNull, JSC::allocateCell<JSTextDecoderConstructor>(vm)) JSTextDecoderConstructor(vm, structure); + ptr->finishCreation(vm, globalObject, prototype); + return ptr; +} - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); +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(); + JSObject* newTarget = asObject(callFrame->newTarget()); + auto* constructor = globalObject->JSTextDecoderConstructor(); + Structure* structure = globalObject->JSTextDecoderStructure(); + if (constructor != newTarget) { + auto scope = DECLARE_THROW_SCOPE(vm); - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + 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()); } - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + void* ptr = TextDecoderClass__construct(globalObject, callFrame); - return NodeJSFSPrototype__utimes(thisObject->wrapped(), lexicalGlobalObject, callFrame); + if (UNLIKELY(!ptr)) { + return JSValue::encode(JSC::jsUndefined()); + } + + JSTextDecoder* instance = JSTextDecoder::create(vm, globalObject, structure, ptr); + + return JSValue::encode(instance); } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__utimesSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +void JSTextDecoderConstructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSTextDecoderPrototype* prototype) { - auto& vm = lexicalGlobalObject->vm(); +} - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); +const ClassInfo JSTextDecoderConstructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTextDecoderConstructor) }; - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); +extern "C" EncodedJSValue TextDecoder__getConstructor(Zig::GlobalObject* globalObject) +{ + return JSValue::encode(globalObject->JSTextDecoderConstructor()); +} + +JSTextDecoder::~JSTextDecoder() +{ + if (m_ctx) { + TextDecoderClass__finalize(m_ctx); } +} +void JSTextDecoder::destroy(JSCell* cell) +{ + static_cast<JSTextDecoder*>(cell)->JSTextDecoder::~JSTextDecoder(); +} - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); +const ClassInfo JSTextDecoder::s_info = { "TextDecoder"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTextDecoder) }; - return NodeJSFSPrototype__utimesSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); +void JSTextDecoder::finishCreation(VM& vm) +{ + Base::finishCreation(vm); + ASSERT(inherits(info())); } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__writeCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSTextDecoder* JSTextDecoder::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) { - auto& vm = lexicalGlobalObject->vm(); + JSTextDecoder* ptr = new (NotNull, JSC::allocateCell<JSTextDecoder>(vm)) JSTextDecoder(vm, structure, ctx); + ptr->finishCreation(vm); + return ptr; +} - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); +extern "C" void* TextDecoder__fromJS(JSC::EncodedJSValue value) +{ + JSC::JSValue decodedValue = JSC::JSValue::decode(value); + if (decodedValue.isEmpty() || !decodedValue.isCell()) + return nullptr; - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); + JSC::JSCell* cell = decodedValue.asCell(); + JSTextDecoder* object = JSC::jsDynamicCast<JSTextDecoder*>(cell); + + 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" const size_t TextDecoder__ptrOffset = JSTextDecoder::offsetOfWrapped(); + +void JSTextDecoder::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) +{ + auto* thisObject = jsCast<JSTextDecoder*>(cell); + if (void* wrapped = thisObject->wrapped()) { + // if (thisObject->scriptExecutionContext()) + // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); } + Base::analyzeHeap(cell, analyzer); +} - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); +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 NodeJSFSPrototype__write(thisObject->wrapped(), lexicalGlobalObject, callFrame); +JSObject* JSTextDecoder::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) +{ + return JSTextDecoderPrototype::create(vm, globalObject, JSTextDecoderPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__writeFileCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +extern "C" EncodedJSValue TextDecoder__create(Zig::GlobalObject* globalObject, void* ptr) { - auto& vm = lexicalGlobalObject->vm(); + auto& vm = globalObject->vm(); + JSC::Structure* structure = globalObject->JSTextDecoderStructure(); + JSTextDecoder* instance = JSTextDecoder::create(vm, globalObject, structure, ptr); - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + return JSValue::encode(instance); +} - if (UNLIKELY(!thisObject)) { - auto throwScope = DECLARE_THROW_SCOPE(vm); - return throwVMTypeError(lexicalGlobalObject, throwScope); +template<typename Visitor> +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); + +template<typename Visitor> +void JSTextDecoder::visitAdditionalChildren(Visitor& visitor) +{ + JSTextDecoder* thisObject = this; + ASSERT_GC_OBJECT_INHERITS(thisObject, info()); + + visitor.append(thisObject->m_encoding); + ; +} + +DEFINE_VISIT_ADDITIONAL_CHILDREN(JSTextDecoder); + +template<typename Visitor> +void JSTextDecoder::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor) +{ + JSTextDecoder* thisObject = jsCast<JSTextDecoder*>(cell); + ASSERT_GC_OBJECT_INHERITS(thisObject, info()); + thisObject->visitAdditionalChildren<Visitor>(visitor); +} + +DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSTextDecoder); +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; } - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + 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()); + } - return NodeJSFSPrototype__writeFile(thisObject->wrapped(), lexicalGlobalObject, callFrame); +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 = WTFMove(space); }, + [](auto& spaces) { return spaces.m_subspaceForTranspilerConstructor.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForTranspilerConstructor = WTFMove(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); +}; + +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), NoIntrinsic, { HashTableValue::NativeFunctionType, TranspilerPrototype__scanCallback, 2 } }, + { "scanImports"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, TranspilerPrototype__scanImportsCallback, 2 } }, + { "transform"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, TranspilerPrototype__transformCallback, 2 } }, + { "transformSync"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), 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); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + auto* prototype = jsDynamicCast<JSTranspilerPrototype*>(JSValue::decode(thisValue)); + + if (UNLIKELY(!prototype)) + return throwVMTypeError(lexicalGlobalObject, throwScope); + return JSValue::encode(globalObject->JSTranspilerConstructor()); } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__writeFileSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(TranspilerPrototype__scanCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSTranspiler* thisObject = jsDynamicCast<JSTranspiler*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -11463,14 +11782,14 @@ JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__writeFileSyncCallback, (JSGlobalObje JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return NodeJSFSPrototype__writeFileSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return TranspilerPrototype__scan(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__writeSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(TranspilerPrototype__scanImportsCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSTranspiler* thisObject = jsDynamicCast<JSTranspiler*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -11479,14 +11798,14 @@ JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__writeSyncCallback, (JSGlobalObject * JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return NodeJSFSPrototype__writeSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return TranspilerPrototype__scanImports(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__writevCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(TranspilerPrototype__transformCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSTranspiler* thisObject = jsDynamicCast<JSTranspiler*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -11495,14 +11814,14 @@ JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__writevCallback, (JSGlobalObject * le JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return NodeJSFSPrototype__writev(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return TranspilerPrototype__transform(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__writevSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +JSC_DEFINE_HOST_FUNCTION(TranspilerPrototype__transformSyncCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - JSNodeJSFS* thisObject = jsDynamicCast<JSNodeJSFS*>(callFrame->thisValue()); + JSTranspiler* thisObject = jsDynamicCast<JSTranspiler*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -11511,43 +11830,43 @@ JSC_DEFINE_HOST_FUNCTION(NodeJSFSPrototype__writevSyncCallback, (JSGlobalObject JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - return NodeJSFSPrototype__writevSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); + return TranspilerPrototype__transformSync(thisObject->wrapped(), lexicalGlobalObject, callFrame); } -void JSNodeJSFSPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) +void JSTranspilerPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) { Base::finishCreation(vm); - reifyStaticProperties(vm, JSNodeJSFS::info(), JSNodeJSFSPrototypeTableValues, *this); + reifyStaticProperties(vm, JSTranspiler::info(), JSTranspilerPrototypeTableValues, *this); JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); } -void JSNodeJSFSConstructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSNodeJSFSPrototype* prototype) +void JSTranspilerConstructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSTranspilerPrototype* prototype) { - Base::finishCreation(vm, 0, "NodeJSFS"_s, PropertyAdditionMode::WithoutStructureTransition); + Base::finishCreation(vm, 0, "Transpiler"_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) +JSTranspilerConstructor::JSTranspilerConstructor(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) +JSTranspilerConstructor* JSTranspilerConstructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSTranspilerPrototype* prototype) { - JSNodeJSFSConstructor* ptr = new (NotNull, JSC::allocateCell<JSNodeJSFSConstructor>(vm)) JSNodeJSFSConstructor(vm, structure); + JSTranspilerConstructor* ptr = new (NotNull, JSC::allocateCell<JSTranspilerConstructor>(vm)) JSTranspilerConstructor(vm, structure); ptr->finishCreation(vm, globalObject, prototype); return ptr; } -JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSNodeJSFSConstructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) +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(); JSObject* newTarget = asObject(callFrame->newTarget()); - auto* constructor = globalObject->JSNodeJSFSConstructor(); - Structure* structure = globalObject->JSNodeJSFSStructure(); + auto* constructor = globalObject->JSTranspilerConstructor(); + Structure* structure = globalObject->JSTranspilerStructure(); if (constructor != newTarget) { auto scope = DECLARE_THROW_SCOPE(vm); @@ -11558,62 +11877,67 @@ JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSNodeJSFSConstructor::construct(JS structure = InternalFunction::createSubclassStructure( globalObject, newTarget, - functionGlobalObject->JSNodeJSFSStructure()); + functionGlobalObject->JSTranspilerStructure()); } - void* ptr = NodeJSFSClass__construct(globalObject, callFrame); + void* ptr = TranspilerClass__construct(globalObject, callFrame); if (UNLIKELY(!ptr)) { return JSValue::encode(JSC::jsUndefined()); } - JSNodeJSFS* instance = JSNodeJSFS::create(vm, globalObject, structure, ptr); + JSTranspiler* instance = JSTranspiler::create(vm, globalObject, structure, ptr); return JSValue::encode(instance); } -void JSNodeJSFSConstructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSNodeJSFSPrototype* prototype) +void JSTranspilerConstructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSTranspilerPrototype* prototype) { } -const ClassInfo JSNodeJSFSConstructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSNodeJSFSConstructor) }; +const ClassInfo JSTranspilerConstructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTranspilerConstructor) }; -extern "C" EncodedJSValue NodeJSFS__getConstructor(Zig::GlobalObject* globalObject) +extern "C" EncodedJSValue Transpiler__getConstructor(Zig::GlobalObject* globalObject) { - return JSValue::encode(globalObject->JSNodeJSFSConstructor()); + return JSValue::encode(globalObject->JSTranspilerConstructor()); } -JSNodeJSFS::~JSNodeJSFS() +#include "JSTranspiler+BunPlugin-impl.h"; + +JSTranspiler::~JSTranspiler() { + if (m_ctx) { + TranspilerClass__finalize(m_ctx); + } } -void JSNodeJSFS::destroy(JSCell* cell) +void JSTranspiler::destroy(JSCell* cell) { - static_cast<JSNodeJSFS*>(cell)->JSNodeJSFS::~JSNodeJSFS(); + static_cast<JSTranspiler*>(cell)->JSTranspiler::~JSTranspiler(); } -const ClassInfo JSNodeJSFS::s_info = { "NodeJSFS"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSNodeJSFS) }; +const ClassInfo JSTranspiler::s_info = { "Transpiler"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTranspiler) }; -void JSNodeJSFS::finishCreation(VM& vm) +void JSTranspiler::finishCreation(VM& vm) { Base::finishCreation(vm); ASSERT(inherits(info())); } -JSNodeJSFS* JSNodeJSFS::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) +JSTranspiler* JSTranspiler::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) { - JSNodeJSFS* ptr = new (NotNull, JSC::allocateCell<JSNodeJSFS>(vm)) JSNodeJSFS(vm, structure, ctx); + JSTranspiler* ptr = new (NotNull, JSC::allocateCell<JSTranspiler>(vm)) JSTranspiler(vm, structure, ctx); ptr->finishCreation(vm); return ptr; } -extern "C" void* NodeJSFS__fromJS(JSC::EncodedJSValue value) +extern "C" void* Transpiler__fromJS(JSC::EncodedJSValue value) { JSC::JSValue decodedValue = JSC::JSValue::decode(value); if (decodedValue.isEmpty() || !decodedValue.isCell()) return nullptr; JSC::JSCell* cell = decodedValue.asCell(); - JSNodeJSFS* object = JSC::jsDynamicCast<JSNodeJSFS*>(cell); + JSTranspiler* object = JSC::jsDynamicCast<JSTranspiler*>(cell); if (!object) return nullptr; @@ -11621,9 +11945,9 @@ extern "C" void* NodeJSFS__fromJS(JSC::EncodedJSValue value) return object->wrapped(); } -extern "C" bool NodeJSFS__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) +extern "C" bool Transpiler__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) { - JSNodeJSFS* object = JSC::jsDynamicCast<JSNodeJSFS*>(JSValue::decode(value)); + JSTranspiler* object = JSC::jsDynamicCast<JSTranspiler*>(JSValue::decode(value)); if (!object) return false; @@ -11631,11 +11955,11 @@ extern "C" bool NodeJSFS__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr return true; } -extern "C" const size_t NodeJSFS__ptrOffset = JSNodeJSFS::offsetOfWrapped(); +extern "C" const size_t Transpiler__ptrOffset = JSTranspiler::offsetOfWrapped(); -void JSNodeJSFS::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) +void JSTranspiler::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) { - auto* thisObject = jsCast<JSNodeJSFS*>(cell); + auto* thisObject = jsCast<JSTranspiler*>(cell); if (void* wrapped = thisObject->wrapped()) { // if (thisObject->scriptExecutionContext()) // analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); @@ -11643,21 +11967,21 @@ void JSNodeJSFS::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) Base::analyzeHeap(cell, analyzer); } -JSObject* JSNodeJSFS::createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype) +JSObject* JSTranspiler::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::JSTranspilerConstructor::create(vm, globalObject, WebCore::JSTranspilerConstructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast<WebCore::JSTranspilerPrototype*>(prototype)); } -JSObject* JSNodeJSFS::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) +JSObject* JSTranspiler::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) { - return JSNodeJSFSPrototype::create(vm, globalObject, JSNodeJSFSPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); + return JSTranspilerPrototype::create(vm, globalObject, JSTranspilerPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); } -extern "C" EncodedJSValue NodeJSFS__create(Zig::GlobalObject* globalObject, void* ptr) +extern "C" EncodedJSValue Transpiler__create(Zig::GlobalObject* globalObject, void* ptr) { auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSNodeJSFSStructure(); - JSNodeJSFS* instance = JSNodeJSFS::create(vm, globalObject, structure, ptr); + JSC::Structure* structure = globalObject->JSTranspilerStructure(); + JSTranspiler* instance = JSTranspiler::create(vm, globalObject, structure, ptr); return JSValue::encode(instance); } diff --git a/src/bun.js/bindings/ZigGeneratedClasses.h b/src/bun.js/bindings/ZigGeneratedClasses.h index aee32a315..05c919eeb 100644 --- a/src/bun.js/bindings/ZigGeneratedClasses.h +++ b/src/bun.js/bindings/ZigGeneratedClasses.h @@ -10,27 +10,28 @@ namespace Zig { #include "JSDOMWrapper.h" #include <wtf/NeverDestroyed.h> +#include "BunPlugin.h"; namespace WebCore { using namespace Zig; using namespace JSC; -class JSTCPSocket final : public JSC::JSDestructibleObject { +class JSBlob final : public JSC::JSDestructibleObject { public: using Base = JSC::JSDestructibleObject; - static JSTCPSocket* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); + 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<JSTCPSocket, WebCore::UseCustomHeapCellType::No>( + return WebCore::subspaceForImpl<JSBlob, WebCore::UseCustomHeapCellType::No>( vm, - [](auto& spaces) { return spaces.m_clientSubspaceForTCPSocket.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForTCPSocket = WTFMove(space); }, - [](auto& spaces) { return spaces.m_subspaceForTCPSocket.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForTCPSocket = WTFMove(space); }); + [](auto& spaces) { return spaces.m_clientSubspaceForBlob.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForBlob = WTFMove(space); }, + [](auto& spaces) { return spaces.m_subspaceForBlob.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForBlob = WTFMove(space); }); } static void destroy(JSC::JSCell*); @@ -40,9 +41,9 @@ public: } static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - ; + static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); - ~JSTCPSocket(); + ~JSBlob(); void* wrapped() const { return m_ctx; } @@ -52,69 +53,35 @@ public: } static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSTCPSocket, m_ctx); } + static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSBlob, m_ctx); } void* m_ctx { nullptr }; - JSTCPSocket(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) + JSBlob(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; - - 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 { +class JSCryptoHasher final : public JSC::JSDestructibleObject { public: using Base = JSC::JSDestructibleObject; - static JSTLSSocket* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); + 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<JSTLSSocket, WebCore::UseCustomHeapCellType::No>( + return WebCore::subspaceForImpl<JSCryptoHasher, WebCore::UseCustomHeapCellType::No>( vm, - [](auto& spaces) { return spaces.m_clientSubspaceForTLSSocket.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForTLSSocket = WTFMove(space); }, - [](auto& spaces) { return spaces.m_subspaceForTLSSocket.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForTLSSocket = WTFMove(space); }); + [](auto& spaces) { return spaces.m_clientSubspaceForCryptoHasher.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForCryptoHasher = WTFMove(space); }, + [](auto& spaces) { return spaces.m_subspaceForCryptoHasher.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForCryptoHasher = WTFMove(space); }); } static void destroy(JSC::JSCell*); @@ -124,9 +91,9 @@ public: } static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - ; + static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); - ~JSTLSSocket(); + ~JSCryptoHasher(); void* wrapped() const { return m_ctx; } @@ -136,81 +103,54 @@ public: } static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSTLSSocket, m_ctx); } + static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSCryptoHasher, m_ctx); } void* m_ctx { nullptr }; - JSTLSSocket(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) + JSCryptoHasher(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)) - *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; + mutable JSC::WriteBarrier<JSC::Unknown> m_algorithms; + mutable JSC::WriteBarrier<JSC::Unknown> m_algorithm; }; -class JSListener final : public JSC::JSDestructibleObject { +class JSDirent final : public JSC::JSDestructibleObject { public: using Base = JSC::JSDestructibleObject; - static JSListener* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); + 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<JSListener, WebCore::UseCustomHeapCellType::No>( + return WebCore::subspaceForImpl<JSDirent, WebCore::UseCustomHeapCellType::No>( vm, - [](auto& spaces) { return spaces.m_clientSubspaceForListener.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForListener = WTFMove(space); }, - [](auto& spaces) { return spaces.m_subspaceForListener.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForListener = WTFMove(space); }); + [](auto& spaces) { return spaces.m_clientSubspaceForDirent.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForDirent = WTFMove(space); }, + [](auto& spaces) { return spaces.m_subspaceForDirent.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForDirent = WTFMove(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()); + 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); - ~JSListener(); + ~JSDirent(); void* wrapped() const { return m_ctx; } @@ -220,11 +160,11 @@ public: } static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSListener, m_ctx); } + static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSDirent, m_ctx); } void* m_ctx { nullptr }; - JSListener(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) + JSDirent(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) : Base(vm, structure) { m_ctx = sinkPtr; @@ -236,26 +176,25 @@ public: template<typename Visitor> void visitAdditionalChildren(Visitor&); DECLARE_VISIT_OUTPUT_CONSTRAINTS; - mutable JSC::WriteBarrier<JSC::Unknown> m_hostname; - mutable JSC::WriteBarrier<JSC::Unknown> m_unix; + mutable JSC::WriteBarrier<JSC::Unknown> m_name; }; -class JSSubprocess final : public JSC::JSDestructibleObject { +class JSExpect final : public JSC::JSDestructibleObject { public: using Base = JSC::JSDestructibleObject; - static JSSubprocess* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); + 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<JSSubprocess, WebCore::UseCustomHeapCellType::No>( + return WebCore::subspaceForImpl<JSExpect, WebCore::UseCustomHeapCellType::No>( vm, - [](auto& spaces) { return spaces.m_clientSubspaceForSubprocess.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForSubprocess = WTFMove(space); }, - [](auto& spaces) { return spaces.m_subspaceForSubprocess.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForSubprocess = WTFMove(space); }); + [](auto& spaces) { return spaces.m_clientSubspaceForExpect.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForExpect = WTFMove(space); }, + [](auto& spaces) { return spaces.m_subspaceForExpect.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForExpect = WTFMove(space); }); } static void destroy(JSC::JSCell*); @@ -265,9 +204,9 @@ public: } static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - ; + static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); - ~JSSubprocess(); + ~JSExpect(); void* wrapped() const { return m_ctx; } @@ -277,70 +216,42 @@ public: } static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSSubprocess, m_ctx); } + static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSExpect, m_ctx); } void* m_ctx { nullptr }; - JSSubprocess(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) + JSExpect(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<JSSubprocess*>(handle.slot()->asCell()); - if (JSSubprocess::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_stderr; - mutable JSC::WriteBarrier<JSC::Unknown> m_stdin; - mutable JSC::WriteBarrier<JSC::Unknown> m_stdout; + mutable JSC::WriteBarrier<JSC::Unknown> m_capturedValue; + mutable JSC::WriteBarrier<JSC::Unknown> m_resultValue; }; -class JSSHA1 final : public JSC::JSDestructibleObject { +class JSFileSystemRouter final : public JSC::JSDestructibleObject { public: using Base = JSC::JSDestructibleObject; - static JSSHA1* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); + 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<JSSHA1, WebCore::UseCustomHeapCellType::No>( + return WebCore::subspaceForImpl<JSFileSystemRouter, WebCore::UseCustomHeapCellType::No>( vm, - [](auto& spaces) { return spaces.m_clientSubspaceForSHA1.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForSHA1 = WTFMove(space); }, - [](auto& spaces) { return spaces.m_subspaceForSHA1.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForSHA1 = WTFMove(space); }); + [](auto& spaces) { return spaces.m_clientSubspaceForFileSystemRouter.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForFileSystemRouter = WTFMove(space); }, + [](auto& spaces) { return spaces.m_subspaceForFileSystemRouter.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForFileSystemRouter = WTFMove(space); }); } static void destroy(JSC::JSCell*); @@ -352,7 +263,7 @@ public: static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); - ~JSSHA1(); + ~JSFileSystemRouter(); void* wrapped() const { return m_ctx; } @@ -362,35 +273,43 @@ public: } static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSSHA1, m_ctx); } + static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSFileSystemRouter, m_ctx); } void* m_ctx { nullptr }; - JSSHA1(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) + 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 JSMD5 final : public JSC::JSDestructibleObject { +class JSListener final : public JSC::JSDestructibleObject { public: using Base = JSC::JSDestructibleObject; - static JSMD5* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); + 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<JSMD5, WebCore::UseCustomHeapCellType::No>( + return WebCore::subspaceForImpl<JSListener, WebCore::UseCustomHeapCellType::No>( vm, - [](auto& spaces) { return spaces.m_clientSubspaceForMD5.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForMD5 = WTFMove(space); }, - [](auto& spaces) { return spaces.m_subspaceForMD5.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForMD5 = WTFMove(space); }); + [](auto& spaces) { return spaces.m_clientSubspaceForListener.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForListener = WTFMove(space); }, + [](auto& spaces) { return spaces.m_subspaceForListener.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForListener = WTFMove(space); }); } static void destroy(JSC::JSCell*); @@ -400,9 +319,9 @@ public: } static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); + ; - ~JSMD5(); + ~JSListener(); void* wrapped() const { return m_ctx; } @@ -412,17 +331,24 @@ public: } static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSMD5, m_ctx); } + static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSListener, m_ctx); } void* m_ctx { nullptr }; - JSMD5(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) + 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 { @@ -475,22 +401,22 @@ public: void finishCreation(JSC::VM&); }; -class JSSHA224 final : public JSC::JSDestructibleObject { +class JSMD5 final : public JSC::JSDestructibleObject { public: using Base = JSC::JSDestructibleObject; - static JSSHA224* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); + 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<JSSHA224, WebCore::UseCustomHeapCellType::No>( + return WebCore::subspaceForImpl<JSMD5, WebCore::UseCustomHeapCellType::No>( vm, - [](auto& spaces) { return spaces.m_clientSubspaceForSHA224.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForSHA224 = WTFMove(space); }, - [](auto& spaces) { return spaces.m_subspaceForSHA224.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForSHA224 = WTFMove(space); }); + [](auto& spaces) { return spaces.m_clientSubspaceForMD5.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForMD5 = WTFMove(space); }, + [](auto& spaces) { return spaces.m_subspaceForMD5.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForMD5 = WTFMove(space); }); } static void destroy(JSC::JSCell*); @@ -502,7 +428,7 @@ public: static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); - ~JSSHA224(); + ~JSMD5(); void* wrapped() const { return m_ctx; } @@ -512,11 +438,11 @@ public: } static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSSHA224, m_ctx); } + static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSMD5, m_ctx); } void* m_ctx { nullptr }; - JSSHA224(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) + JSMD5(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) : Base(vm, structure) { m_ctx = sinkPtr; @@ -525,22 +451,22 @@ public: void finishCreation(JSC::VM&); }; -class JSSHA512 final : public JSC::JSDestructibleObject { +class JSMatchedRoute final : public JSC::JSDestructibleObject { public: using Base = JSC::JSDestructibleObject; - static JSSHA512* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); + 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<JSSHA512, WebCore::UseCustomHeapCellType::No>( + return WebCore::subspaceForImpl<JSMatchedRoute, WebCore::UseCustomHeapCellType::No>( vm, - [](auto& spaces) { return spaces.m_clientSubspaceForSHA512.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForSHA512 = WTFMove(space); }, - [](auto& spaces) { return spaces.m_subspaceForSHA512.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForSHA512 = WTFMove(space); }); + [](auto& spaces) { return spaces.m_clientSubspaceForMatchedRoute.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForMatchedRoute = WTFMove(space); }, + [](auto& spaces) { return spaces.m_subspaceForMatchedRoute.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForMatchedRoute = WTFMove(space); }); } static void destroy(JSC::JSCell*); @@ -550,9 +476,9 @@ public: } static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); + ; - ~JSSHA512(); + ~JSMatchedRoute(); void* wrapped() const { return m_ctx; } @@ -562,47 +488,59 @@ public: } static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSSHA512, m_ctx); } + static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSMatchedRoute, m_ctx); } void* m_ctx { nullptr }; - JSSHA512(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) + 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 JSSHA384 final : public JSC::JSDestructibleObject { +class JSNodeJSFS final : public JSC::JSDestructibleObject { public: using Base = JSC::JSDestructibleObject; - static JSSHA384* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); + 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<JSSHA384, WebCore::UseCustomHeapCellType::No>( + return WebCore::subspaceForImpl<JSNodeJSFS, WebCore::UseCustomHeapCellType::No>( vm, - [](auto& spaces) { return spaces.m_clientSubspaceForSHA384.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForSHA384 = WTFMove(space); }, - [](auto& spaces) { return spaces.m_subspaceForSHA384.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForSHA384 = WTFMove(space); }); + [](auto& spaces) { return spaces.m_clientSubspaceForNodeJSFS.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForNodeJSFS = WTFMove(space); }, + [](auto& spaces) { return spaces.m_subspaceForNodeJSFS.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForNodeJSFS = WTFMove(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()); + 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); - ~JSSHA384(); + ~JSNodeJSFS(); void* wrapped() const { return m_ctx; } @@ -612,11 +550,11 @@ public: } static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSSHA384, m_ctx); } + static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSNodeJSFS, m_ctx); } void* m_ctx { nullptr }; - JSSHA384(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) + JSNodeJSFS(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) : Base(vm, structure) { m_ctx = sinkPtr; @@ -625,22 +563,22 @@ public: void finishCreation(JSC::VM&); }; -class JSSHA256 final : public JSC::JSDestructibleObject { +class JSRequest final : public JSC::JSDestructibleObject { public: using Base = JSC::JSDestructibleObject; - static JSSHA256* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); + 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<JSSHA256, WebCore::UseCustomHeapCellType::No>( + return WebCore::subspaceForImpl<JSRequest, WebCore::UseCustomHeapCellType::No>( vm, - [](auto& spaces) { return spaces.m_clientSubspaceForSHA256.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForSHA256 = WTFMove(space); }, - [](auto& spaces) { return spaces.m_subspaceForSHA256.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForSHA256 = WTFMove(space); }); + [](auto& spaces) { return spaces.m_clientSubspaceForRequest.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForRequest = WTFMove(space); }, + [](auto& spaces) { return spaces.m_subspaceForRequest.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForRequest = WTFMove(space); }); } static void destroy(JSC::JSCell*); @@ -652,7 +590,7 @@ public: static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); - ~JSSHA256(); + ~JSRequest(); void* wrapped() const { return m_ctx; } @@ -662,35 +600,43 @@ public: } static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSSHA256, m_ctx); } + static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSRequest, m_ctx); } void* m_ctx { nullptr }; - JSSHA256(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) + 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_url; }; -class JSSHA512_256 final : public JSC::JSDestructibleObject { +class JSResponse final : public JSC::JSDestructibleObject { public: using Base = JSC::JSDestructibleObject; - static JSSHA512_256* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); + 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<JSSHA512_256, WebCore::UseCustomHeapCellType::No>( + return WebCore::subspaceForImpl<JSResponse, WebCore::UseCustomHeapCellType::No>( vm, - [](auto& spaces) { return spaces.m_clientSubspaceForSHA512_256.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForSHA512_256 = WTFMove(space); }, - [](auto& spaces) { return spaces.m_subspaceForSHA512_256.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForSHA512_256 = WTFMove(space); }); + [](auto& spaces) { return spaces.m_clientSubspaceForResponse.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForResponse = WTFMove(space); }, + [](auto& spaces) { return spaces.m_subspaceForResponse.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForResponse = WTFMove(space); }); } static void destroy(JSC::JSCell*); @@ -702,7 +648,7 @@ public: static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); - ~JSSHA512_256(); + ~JSResponse(); void* wrapped() const { return m_ctx; } @@ -712,35 +658,44 @@ public: } static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSSHA512_256, m_ctx); } + static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSResponse, m_ctx); } void* m_ctx { nullptr }; - JSSHA512_256(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) + 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 JSCryptoHasher final : public JSC::JSDestructibleObject { +class JSSHA1 final : public JSC::JSDestructibleObject { public: using Base = JSC::JSDestructibleObject; - static JSCryptoHasher* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); + 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<JSCryptoHasher, WebCore::UseCustomHeapCellType::No>( + return WebCore::subspaceForImpl<JSSHA1, WebCore::UseCustomHeapCellType::No>( vm, - [](auto& spaces) { return spaces.m_clientSubspaceForCryptoHasher.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForCryptoHasher = WTFMove(space); }, - [](auto& spaces) { return spaces.m_subspaceForCryptoHasher.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForCryptoHasher = WTFMove(space); }); + [](auto& spaces) { return spaces.m_clientSubspaceForSHA1.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForSHA1 = WTFMove(space); }, + [](auto& spaces) { return spaces.m_subspaceForSHA1.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForSHA1 = WTFMove(space); }); } static void destroy(JSC::JSCell*); @@ -752,7 +707,7 @@ public: static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); - ~JSCryptoHasher(); + ~JSSHA1(); void* wrapped() const { return m_ctx; } @@ -762,42 +717,35 @@ public: } static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSCryptoHasher, m_ctx); } + static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSSHA1, m_ctx); } void* m_ctx { nullptr }; - JSCryptoHasher(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) + JSSHA1(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 JSServerWebSocket final : public JSC::JSDestructibleObject { +class JSSHA224 final : public JSC::JSDestructibleObject { public: using Base = JSC::JSDestructibleObject; - static JSServerWebSocket* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); + 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<JSServerWebSocket, WebCore::UseCustomHeapCellType::No>( + return WebCore::subspaceForImpl<JSSHA224, WebCore::UseCustomHeapCellType::No>( vm, - [](auto& spaces) { return spaces.m_clientSubspaceForServerWebSocket.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForServerWebSocket = WTFMove(space); }, - [](auto& spaces) { return spaces.m_subspaceForServerWebSocket.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForServerWebSocket = WTFMove(space); }); + [](auto& spaces) { return spaces.m_clientSubspaceForSHA224.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForSHA224 = WTFMove(space); }, + [](auto& spaces) { return spaces.m_subspaceForSHA224.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForSHA224 = WTFMove(space); }); } static void destroy(JSC::JSCell*); @@ -809,7 +757,7 @@ public: static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); - ~JSServerWebSocket(); + ~JSSHA224(); void* wrapped() const { return m_ctx; } @@ -819,42 +767,35 @@ public: } static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSServerWebSocket, m_ctx); } + static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSSHA224, m_ctx); } void* m_ctx { nullptr }; - JSServerWebSocket(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) + JSSHA224(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; }; -class JSFileSystemRouter final : public JSC::JSDestructibleObject { +class JSSHA256 final : public JSC::JSDestructibleObject { public: using Base = JSC::JSDestructibleObject; - static JSFileSystemRouter* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); + 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<JSFileSystemRouter, WebCore::UseCustomHeapCellType::No>( + return WebCore::subspaceForImpl<JSSHA256, WebCore::UseCustomHeapCellType::No>( vm, - [](auto& spaces) { return spaces.m_clientSubspaceForFileSystemRouter.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForFileSystemRouter = WTFMove(space); }, - [](auto& spaces) { return spaces.m_subspaceForFileSystemRouter.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForFileSystemRouter = WTFMove(space); }); + [](auto& spaces) { return spaces.m_clientSubspaceForSHA256.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForSHA256 = WTFMove(space); }, + [](auto& spaces) { return spaces.m_subspaceForSHA256.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForSHA256 = WTFMove(space); }); } static void destroy(JSC::JSCell*); @@ -866,7 +807,7 @@ public: static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); - ~JSFileSystemRouter(); + ~JSSHA256(); void* wrapped() const { return m_ctx; } @@ -876,43 +817,35 @@ public: } static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSFileSystemRouter, m_ctx); } + static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSSHA256, m_ctx); } void* m_ctx { nullptr }; - JSFileSystemRouter(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) + JSSHA256(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 JSMatchedRoute final : public JSC::JSDestructibleObject { +class JSSHA384 final : public JSC::JSDestructibleObject { public: using Base = JSC::JSDestructibleObject; - static JSMatchedRoute* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); + 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<JSMatchedRoute, WebCore::UseCustomHeapCellType::No>( + return WebCore::subspaceForImpl<JSSHA384, WebCore::UseCustomHeapCellType::No>( vm, - [](auto& spaces) { return spaces.m_clientSubspaceForMatchedRoute.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForMatchedRoute = WTFMove(space); }, - [](auto& spaces) { return spaces.m_subspaceForMatchedRoute.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForMatchedRoute = WTFMove(space); }); + [](auto& spaces) { return spaces.m_clientSubspaceForSHA384.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForSHA384 = WTFMove(space); }, + [](auto& spaces) { return spaces.m_subspaceForSHA384.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForSHA384 = WTFMove(space); }); } static void destroy(JSC::JSCell*); @@ -922,9 +855,9 @@ public: } static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - ; + static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); - ~JSMatchedRoute(); + ~JSSHA384(); void* wrapped() const { return m_ctx; } @@ -934,47 +867,35 @@ public: } static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSMatchedRoute, m_ctx); } + static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSSHA384, m_ctx); } void* m_ctx { nullptr }; - JSMatchedRoute(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) + JSSHA384(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 JSExpect final : public JSC::JSDestructibleObject { +class JSSHA512 final : public JSC::JSDestructibleObject { public: using Base = JSC::JSDestructibleObject; - static JSExpect* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); + 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<JSExpect, WebCore::UseCustomHeapCellType::No>( + return WebCore::subspaceForImpl<JSSHA512, WebCore::UseCustomHeapCellType::No>( vm, - [](auto& spaces) { return spaces.m_clientSubspaceForExpect.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForExpect = WTFMove(space); }, - [](auto& spaces) { return spaces.m_subspaceForExpect.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForExpect = WTFMove(space); }); + [](auto& spaces) { return spaces.m_clientSubspaceForSHA512.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForSHA512 = WTFMove(space); }, + [](auto& spaces) { return spaces.m_subspaceForSHA512.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForSHA512 = WTFMove(space); }); } static void destroy(JSC::JSCell*); @@ -986,7 +907,7 @@ public: static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); - ~JSExpect(); + ~JSSHA512(); void* wrapped() const { return m_ctx; } @@ -996,42 +917,85 @@ public: } static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSExpect, m_ctx); } + static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSSHA512, m_ctx); } void* m_ctx { nullptr }; - JSExpect(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) + JSSHA512(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; +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); - mutable JSC::WriteBarrier<JSC::Unknown> m_capturedValue; - mutable JSC::WriteBarrier<JSC::Unknown> m_resultValue; + 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 = WTFMove(space); }, + [](auto& spaces) { return spaces.m_subspaceForSHA512_256.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForSHA512_256 = WTFMove(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 JSTextDecoder final : public JSC::JSDestructibleObject { +class JSServerWebSocket final : public JSC::JSDestructibleObject { public: using Base = JSC::JSDestructibleObject; - static JSTextDecoder* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); + 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<JSTextDecoder, WebCore::UseCustomHeapCellType::No>( + return WebCore::subspaceForImpl<JSServerWebSocket, WebCore::UseCustomHeapCellType::No>( vm, - [](auto& spaces) { return spaces.m_clientSubspaceForTextDecoder.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForTextDecoder = WTFMove(space); }, - [](auto& spaces) { return spaces.m_subspaceForTextDecoder.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForTextDecoder = WTFMove(space); }); + [](auto& spaces) { return spaces.m_clientSubspaceForServerWebSocket.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForServerWebSocket = WTFMove(space); }, + [](auto& spaces) { return spaces.m_subspaceForServerWebSocket.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForServerWebSocket = WTFMove(space); }); } static void destroy(JSC::JSCell*); @@ -1043,7 +1007,7 @@ public: static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); - ~JSTextDecoder(); + ~JSServerWebSocket(); void* wrapped() const { return m_ctx; } @@ -1053,11 +1017,11 @@ public: } static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSTextDecoder, m_ctx); } + static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSServerWebSocket, m_ctx); } void* m_ctx { nullptr }; - JSTextDecoder(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) + JSServerWebSocket(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) : Base(vm, structure) { m_ctx = sinkPtr; @@ -1069,25 +1033,26 @@ public: template<typename Visitor> void visitAdditionalChildren(Visitor&); DECLARE_VISIT_OUTPUT_CONSTRAINTS; - mutable JSC::WriteBarrier<JSC::Unknown> m_encoding; + mutable JSC::WriteBarrier<JSC::Unknown> m_data; + mutable JSC::WriteBarrier<JSC::Unknown> m_remoteAddress; }; -class JSRequest final : public JSC::JSDestructibleObject { +class JSSubprocess final : public JSC::JSDestructibleObject { public: using Base = JSC::JSDestructibleObject; - static JSRequest* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); + 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<JSRequest, WebCore::UseCustomHeapCellType::No>( + return WebCore::subspaceForImpl<JSSubprocess, WebCore::UseCustomHeapCellType::No>( vm, - [](auto& spaces) { return spaces.m_clientSubspaceForRequest.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForRequest = WTFMove(space); }, - [](auto& spaces) { return spaces.m_subspaceForRequest.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForRequest = WTFMove(space); }); + [](auto& spaces) { return spaces.m_clientSubspaceForSubprocess.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForSubprocess = WTFMove(space); }, + [](auto& spaces) { return spaces.m_subspaceForSubprocess.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForSubprocess = WTFMove(space); }); } static void destroy(JSC::JSCell*); @@ -1097,9 +1062,9 @@ public: } static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); + ; - ~JSRequest(); + ~JSSubprocess(); void* wrapped() const { return m_ctx; } @@ -1109,43 +1074,70 @@ public: } static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSRequest, m_ctx); } + static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSSubprocess, m_ctx); } void* m_ctx { nullptr }; - JSRequest(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) + 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<JSSubprocess*>(handle.slot()->asCell()); + if (JSSubprocess::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_body; - mutable JSC::WriteBarrier<JSC::Unknown> m_headers; - mutable JSC::WriteBarrier<JSC::Unknown> m_url; + mutable JSC::WriteBarrier<JSC::Unknown> m_stderr; + mutable JSC::WriteBarrier<JSC::Unknown> m_stdin; + mutable JSC::WriteBarrier<JSC::Unknown> m_stdout; }; -class JSResponse final : public JSC::JSDestructibleObject { +class JSTCPSocket final : public JSC::JSDestructibleObject { public: using Base = JSC::JSDestructibleObject; - static JSResponse* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); + 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<JSResponse, WebCore::UseCustomHeapCellType::No>( + return WebCore::subspaceForImpl<JSTCPSocket, WebCore::UseCustomHeapCellType::No>( vm, - [](auto& spaces) { return spaces.m_clientSubspaceForResponse.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForResponse = WTFMove(space); }, - [](auto& spaces) { return spaces.m_subspaceForResponse.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForResponse = WTFMove(space); }); + [](auto& spaces) { return spaces.m_clientSubspaceForTCPSocket.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForTCPSocket = WTFMove(space); }, + [](auto& spaces) { return spaces.m_subspaceForTCPSocket.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForTCPSocket = WTFMove(space); }); } static void destroy(JSC::JSCell*); @@ -1155,9 +1147,9 @@ public: } static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); + ; - ~JSResponse(); + ~JSTCPSocket(); void* wrapped() const { return m_ctx; } @@ -1167,44 +1159,69 @@ public: } static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSResponse, m_ctx); } + static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSTCPSocket, m_ctx); } void* m_ctx { nullptr }; - JSResponse(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) + 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; + + 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_body; - mutable JSC::WriteBarrier<JSC::Unknown> m_headers; - mutable JSC::WriteBarrier<JSC::Unknown> m_statusText; - mutable JSC::WriteBarrier<JSC::Unknown> m_url; + mutable JSC::WriteBarrier<JSC::Unknown> m_data; + mutable JSC::WriteBarrier<JSC::Unknown> m_remoteAddress; }; -class JSBlob final : public JSC::JSDestructibleObject { +class JSTLSSocket final : public JSC::JSDestructibleObject { public: using Base = JSC::JSDestructibleObject; - static JSBlob* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); + 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<JSBlob, WebCore::UseCustomHeapCellType::No>( + return WebCore::subspaceForImpl<JSTLSSocket, WebCore::UseCustomHeapCellType::No>( vm, - [](auto& spaces) { return spaces.m_clientSubspaceForBlob.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForBlob = WTFMove(space); }, - [](auto& spaces) { return spaces.m_subspaceForBlob.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForBlob = WTFMove(space); }); + [](auto& spaces) { return spaces.m_clientSubspaceForTLSSocket.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForTLSSocket = WTFMove(space); }, + [](auto& spaces) { return spaces.m_subspaceForTLSSocket.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForTLSSocket = WTFMove(space); }); } static void destroy(JSC::JSCell*); @@ -1214,9 +1231,9 @@ public: } static JSObject* createPrototype(VM& vm, JSDOMGlobalObject* globalObject); - static JSObject* createConstructor(VM& vm, JSGlobalObject* globalObject, JSValue prototype); + ; - ~JSBlob(); + ~JSTLSSocket(); void* wrapped() const { return m_ctx; } @@ -1226,47 +1243,81 @@ public: } static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSBlob, m_ctx); } + static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSTLSSocket, m_ctx); } void* m_ctx { nullptr }; - JSBlob(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) + 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)) + *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 JSDirent final : public JSC::JSDestructibleObject { +class JSTextDecoder final : public JSC::JSDestructibleObject { public: using Base = JSC::JSDestructibleObject; - static JSDirent* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); + 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<JSDirent, WebCore::UseCustomHeapCellType::No>( + return WebCore::subspaceForImpl<JSTextDecoder, WebCore::UseCustomHeapCellType::No>( vm, - [](auto& spaces) { return spaces.m_clientSubspaceForDirent.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForDirent = WTFMove(space); }, - [](auto& spaces) { return spaces.m_subspaceForDirent.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForDirent = WTFMove(space); }); + [](auto& spaces) { return spaces.m_clientSubspaceForTextDecoder.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForTextDecoder = WTFMove(space); }, + [](auto& spaces) { return spaces.m_subspaceForTextDecoder.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForTextDecoder = WTFMove(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()); + 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); - ~JSDirent(); + ~JSTextDecoder(); void* wrapped() const { return m_ctx; } @@ -1276,11 +1327,11 @@ public: } static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSDirent, m_ctx); } + static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSTextDecoder, m_ctx); } void* m_ctx { nullptr }; - JSDirent(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) + JSTextDecoder(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) : Base(vm, structure) { m_ctx = sinkPtr; @@ -1292,37 +1343,37 @@ public: template<typename Visitor> void visitAdditionalChildren(Visitor&); DECLARE_VISIT_OUTPUT_CONSTRAINTS; - mutable JSC::WriteBarrier<JSC::Unknown> m_name; + mutable JSC::WriteBarrier<JSC::Unknown> m_encoding; }; -class JSNodeJSFS final : public JSC::JSDestructibleObject { +class JSTranspiler final : public JSC::JSDestructibleObject { public: using Base = JSC::JSDestructibleObject; - static JSNodeJSFS* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx); + 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<JSNodeJSFS, WebCore::UseCustomHeapCellType::No>( + return WebCore::subspaceForImpl<JSTranspiler, WebCore::UseCustomHeapCellType::No>( vm, - [](auto& spaces) { return spaces.m_clientSubspaceForNodeJSFS.get(); }, - [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForNodeJSFS = WTFMove(space); }, - [](auto& spaces) { return spaces.m_subspaceForNodeJSFS.get(); }, - [](auto& spaces, auto&& space) { spaces.m_subspaceForNodeJSFS = WTFMove(space); }); + [](auto& spaces) { return spaces.m_clientSubspaceForTranspiler.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForTranspiler = WTFMove(space); }, + [](auto& spaces) { return spaces.m_subspaceForTranspiler.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForTranspiler = WTFMove(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()); + 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); - ~JSNodeJSFS(); + ~JSTranspiler(); void* wrapped() const { return m_ctx; } @@ -1332,17 +1383,20 @@ public: } static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); - static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSNodeJSFS, m_ctx); } + static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSTranspiler, m_ctx); } void* m_ctx { nullptr }; - JSNodeJSFS(JSC::VM& vm, JSC::Structure* structure, void* sinkPtr) + 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.cpp b/src/bun.js/bindings/bindings.cpp index 4b05f542e..6dcd01bd5 100644 --- a/src/bun.js/bindings/bindings.cpp +++ b/src/bun.js/bindings/bindings.cpp @@ -2049,22 +2049,7 @@ void JSC__JSPromise__resolve(JSC__JSPromise* arg0, JSC__JSGlobalObject* arg1, void JSC__JSPromise__resolveOnNextTick(JSC__JSPromise* promise, JSC__JSGlobalObject* lexicalGlobalObject, JSC__JSValue encoedValue) { - JSC::JSValue value = JSC::JSValue::decode(encoedValue); - VM& vm = lexicalGlobalObject->vm(); - auto scope = DECLARE_THROW_SCOPE(vm); - uint32_t flags = promise->internalField(JSC::JSPromise::Field::Flags).get().asUInt32(); - if (!(flags & JSC::JSPromise::isFirstResolvingFunctionCalledFlag)) { - promise->internalField(JSC::JSPromise::Field::Flags).set(vm, promise, jsNumber(flags | JSC::JSPromise::isFirstResolvingFunctionCalledFlag)); - auto* globalObject = jsCast<Zig::GlobalObject*>(promise->globalObject()); - - globalObject->queueMicrotask( - globalObject->performMicrotaskFunction(), - globalObject->resolvePromiseFunction(), - promise, - value, - JSValue {}); - RETURN_IF_EXCEPTION(scope, void()); - } + return JSC__JSPromise__resolve(promise, lexicalGlobalObject, encoedValue); } bool JSC__JSValue__isAnyError(JSC__JSValue JSValue0) diff --git a/src/bun.js/bindings/generated_classes.zig b/src/bun.js/bindings/generated_classes.zig index c64acbef5..9962ec7f5 100644 --- a/src/bun.js/bindings/generated_classes.zig +++ b/src/bun.js/bindings/generated_classes.zig @@ -1,3 +1,18 @@ +/// Generated code! To regenerate, run: +/// +/// make codegen +/// +/// This file is generated by: +/// 1. `bun src/bun.js/scripts/generate-classes.ts` +/// 2. Scan for **/*.classes.ts files in src/bun.js/src +/// 3. Generate a JS wrapper for each class in: +/// Zig: generated_classes.zig +/// C++: ZigGeneratedClasses.h, ZigGeneratedClasses.cpp +/// 4. For the Zig code to successfully compile: +/// - 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"); @@ -7,299 +22,746 @@ pub const StaticGetterType = fn (*JSC.JSGlobalObject, JSC.JSValue, 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 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; +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; /// Return the pointer to the wrapped object. /// If the object does not match the type, return null. - pub fn fromJS(value: JSC.JSValue) ?*TCPSocket { + pub fn fromJS(value: JSC.JSValue) ?*Blob { JSC.markBinding(@src()); - return TCPSocket__fromJS(value); + return Blob__fromJS(value); } - extern fn TCPSocketPrototype__dataSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; + /// 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); + } - extern fn TCPSocketPrototype__dataGetCachedValue(JSC.JSValue) JSC.JSValue; + /// Create a new instance of Blob + pub fn toJS(this: *Blob, globalObject: *JSC.JSGlobalObject) JSC.JSValue { + JSC.markBinding(@src()); + if (comptime Environment.allow_assert) { + const value__ = Blob__create(globalObject, this); + std.debug.assert(value__.as(Blob).? == this); // If this fails, likely a C ABI issue. + return value__; + } else { + return Blob__create(globalObject, this); + } + } - /// `TCPSocket.data` setter + /// 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); + } + + /// Detach the ptr from the thisValue + pub fn detachPtr(_: *Blob, value: JSC.JSValue) void { + JSC.markBinding(@src()); + std.debug.assert(Blob__dangerouslySetPtr(value, null)); + } + + extern fn Blob__fromJS(JSC.JSValue) ?*Blob; + extern fn Blob__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; + + extern fn Blob__create(globalObject: *JSC.JSGlobalObject, ptr: ?*Blob) JSC.JSValue; + + 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.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.getJSON) != CallbackType) + @compileLog("Expected Blob.getJSON to be a callback but received " ++ @typeName(@TypeOf(Blob.getJSON))); + 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.setType) != SetterType) + @compileLog("Expected Blob.setType to be a setter"); + 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.getJSON, .{ .name = "BlobPrototype__getJSON" }); + @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.setType, .{ .name = "BlobPrototype__setType" }); + } + } +}; +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; + + /// Return the pointer to the wrapped object. + /// If the object does not match the type, return null. + pub fn fromJS(value: JSC.JSValue) ?*CryptoHasher { + JSC.markBinding(@src()); + return CryptoHasher__fromJS(value); + } + + 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 dataSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { + pub fn algorithmSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { JSC.markBinding(@src()); - TCPSocketPrototype__dataSetCachedValue(thisValue, globalObject, value); + CryptoHasherPrototype__algorithmSetCachedValue(thisValue, globalObject, value); } - /// `TCPSocket.data` getter + /// `CryptoHasher.algorithm` getter /// This value will be visited by the garbage collector. - pub fn dataGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { + pub fn algorithmGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { JSC.markBinding(@src()); - const result = TCPSocketPrototype__dataGetCachedValue(thisValue); + const result = CryptoHasherPrototype__algorithmGetCachedValue(thisValue); if (result == .zero) return null; return result; } - extern fn TCPSocketPrototype__remoteAddressSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; + /// 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); + } - extern fn TCPSocketPrototype__remoteAddressGetCachedValue(JSC.JSValue) JSC.JSValue; + /// Create a new instance of CryptoHasher + pub fn toJS(this: *CryptoHasher, globalObject: *JSC.JSGlobalObject) JSC.JSValue { + JSC.markBinding(@src()); + if (comptime Environment.allow_assert) { + const value__ = CryptoHasher__create(globalObject, this); + std.debug.assert(value__.as(CryptoHasher).? == this); // If this fails, likely a C ABI issue. + return value__; + } else { + return CryptoHasher__create(globalObject, this); + } + } - /// `TCPSocket.remoteAddress` setter + /// 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); + } + + /// Detach the ptr from the thisValue + pub fn detachPtr(_: *CryptoHasher, value: JSC.JSValue) void { + JSC.markBinding(@src()); + std.debug.assert(CryptoHasher__dangerouslySetPtr(value, null)); + } + + extern fn CryptoHasher__fromJS(JSC.JSValue) ?*CryptoHasher; + extern fn CryptoHasher__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; + + extern fn CryptoHasher__create(globalObject: *JSC.JSGlobalObject, ptr: ?*CryptoHasher) JSC.JSValue; + + 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.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 (!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" }); + } + } +}; +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; + + /// Return the pointer to the wrapped object. + /// If the object does not match the type, return null. + pub fn fromJS(value: JSC.JSValue) ?*Dirent { + JSC.markBinding(@src()); + return Dirent__fromJS(value); + } + + 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 remoteAddressSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { + pub fn nameSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { JSC.markBinding(@src()); - TCPSocketPrototype__remoteAddressSetCachedValue(thisValue, globalObject, value); + DirentPrototype__nameSetCachedValue(thisValue, globalObject, value); } - /// `TCPSocket.remoteAddress` getter + /// `Dirent.name` getter /// This value will be visited by the garbage collector. - pub fn remoteAddressGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { + pub fn nameGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { JSC.markBinding(@src()); - const result = TCPSocketPrototype__remoteAddressGetCachedValue(thisValue); + const result = DirentPrototype__nameGetCachedValue(thisValue); if (result == .zero) return null; return result; } - /// Create a new instance of TCPSocket - pub fn toJS(this: *TCPSocket, globalObject: *JSC.JSGlobalObject) JSC.JSValue { + /// 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()); if (comptime Environment.allow_assert) { - const value__ = TCPSocket__create(globalObject, this); - std.debug.assert(value__.as(TCPSocket).? == this); // If this fails, likely a C ABI issue. + const value__ = Dirent__create(globalObject, this); + std.debug.assert(value__.as(Dirent).? == this); // If this fails, likely a C ABI issue. return value__; } else { - return TCPSocket__create(globalObject, this); + return Dirent__create(globalObject, this); } } - /// Modify the internal ptr to point to a new instance of TCPSocket. - pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*TCPSocket) bool { + /// 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 TCPSocket__dangerouslySetPtr(value, ptr); + return Dirent__dangerouslySetPtr(value, ptr); } /// Detach the ptr from the thisValue - pub fn detachPtr(_: *TCPSocket, value: JSC.JSValue) void { + pub fn detachPtr(_: *Dirent, value: JSC.JSValue) void { JSC.markBinding(@src()); - std.debug.assert(TCPSocket__dangerouslySetPtr(value, null)); + std.debug.assert(Dirent__dangerouslySetPtr(value, null)); } - extern fn TCPSocket__fromJS(JSC.JSValue) ?*TCPSocket; - extern fn TCPSocket__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; + extern fn Dirent__fromJS(JSC.JSValue) ?*Dirent; + extern fn Dirent__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; - extern fn TCPSocket__create(globalObject: *JSC.JSGlobalObject, ptr: ?*TCPSocket) JSC.JSValue; + extern fn Dirent__create(globalObject: *JSC.JSGlobalObject, ptr: ?*Dirent) JSC.JSValue; - extern fn TCPSocket__dangerouslySetPtr(JSC.JSValue, ?*TCPSocket) bool; + extern fn Dirent__dangerouslySetPtr(JSC.JSValue, ?*Dirent) bool; comptime { - if (@TypeOf(TCPSocket.finalize) != (fn (*TCPSocket) callconv(.C) void)) { - @compileLog("TCPSocket.finalize is not a finalizer"); + if (@TypeOf(Dirent.constructor) != (fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*Dirent)) { + @compileLog("Dirent.constructor is not a constructor"); } - if (@TypeOf(TCPSocket.getData) != GetterType) - @compileLog("Expected TCPSocket.getData to be a getter"); + if (@TypeOf(Dirent.finalize) != (fn (*Dirent) callconv(.C) void)) { + @compileLog("Dirent.finalize is not a finalizer"); + } - 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(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(TCPSocket.getLocalPort) != GetterType) - @compileLog("Expected TCPSocket.getLocalPort 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" }); + } + } +}; +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; - if (@TypeOf(TCPSocket.getReadyState) != GetterType) - @compileLog("Expected TCPSocket.getReadyState to be a getter"); + /// Return the pointer to the wrapped object. + /// If the object does not match the type, return null. + pub fn fromJS(value: JSC.JSValue) ?*Expect { + JSC.markBinding(@src()); + return Expect__fromJS(value); + } - 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"); + extern fn ExpectPrototype__capturedValueSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - 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))); + 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) + return null; + + return result; + } + + extern fn ExpectPrototype__resultValueSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; + + 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) + return null; + + 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()); + if (comptime Environment.allow_assert) { + const value__ = Expect__create(globalObject, this); + std.debug.assert(value__.as(Expect).? == this); // If this fails, likely a C ABI issue. + return value__; + } else { + return Expect__create(globalObject, this); + } + } + + /// 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); + } + + /// Detach the ptr from the thisValue + pub fn detachPtr(_: *Expect, value: JSC.JSValue) void { + JSC.markBinding(@src()); + std.debug.assert(Expect__dangerouslySetPtr(value, null)); + } + + extern fn Expect__fromJS(JSC.JSValue) ?*Expect; + extern fn Expect__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; + + extern fn Expect__create(globalObject: *JSC.JSGlobalObject, ptr: ?*Expect) JSC.JSValue; + + 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 (!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(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 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; +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; /// Return the pointer to the wrapped object. /// If the object does not match the type, return null. - pub fn fromJS(value: JSC.JSValue) ?*TLSSocket { + pub fn fromJS(value: JSC.JSValue) ?*FileSystemRouter { JSC.markBinding(@src()); - return TLSSocket__fromJS(value); + return FileSystemRouter__fromJS(value); } - extern fn TLSSocketPrototype__dataSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; + extern fn FileSystemRouterPrototype__originSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - extern fn TLSSocketPrototype__dataGetCachedValue(JSC.JSValue) JSC.JSValue; + extern fn FileSystemRouterPrototype__originGetCachedValue(JSC.JSValue) JSC.JSValue; - /// `TLSSocket.data` setter + /// `FileSystemRouter.origin` setter /// This value will be visited by the garbage collector. - pub fn dataSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { + pub fn originSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { JSC.markBinding(@src()); - TLSSocketPrototype__dataSetCachedValue(thisValue, globalObject, value); + FileSystemRouterPrototype__originSetCachedValue(thisValue, globalObject, value); } - /// `TLSSocket.data` getter + /// `FileSystemRouter.origin` getter /// This value will be visited by the garbage collector. - pub fn dataGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { + pub fn originGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { JSC.markBinding(@src()); - const result = TLSSocketPrototype__dataGetCachedValue(thisValue); + const result = FileSystemRouterPrototype__originGetCachedValue(thisValue); if (result == .zero) return null; return result; } - extern fn TLSSocketPrototype__remoteAddressSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; + extern fn FileSystemRouterPrototype__routesSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - extern fn TLSSocketPrototype__remoteAddressGetCachedValue(JSC.JSValue) JSC.JSValue; + extern fn FileSystemRouterPrototype__routesGetCachedValue(JSC.JSValue) JSC.JSValue; - /// `TLSSocket.remoteAddress` setter + /// `FileSystemRouter.routes` setter /// This value will be visited by the garbage collector. - pub fn remoteAddressSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { + pub fn routesSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { JSC.markBinding(@src()); - TLSSocketPrototype__remoteAddressSetCachedValue(thisValue, globalObject, value); + FileSystemRouterPrototype__routesSetCachedValue(thisValue, globalObject, value); } - /// `TLSSocket.remoteAddress` getter + /// `FileSystemRouter.routes` getter /// This value will be visited by the garbage collector. - pub fn remoteAddressGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { + pub fn routesGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { JSC.markBinding(@src()); - const result = TLSSocketPrototype__remoteAddressGetCachedValue(thisValue); + const result = FileSystemRouterPrototype__routesGetCachedValue(thisValue); if (result == .zero) return null; return result; } - /// Create a new instance of TLSSocket - pub fn toJS(this: *TLSSocket, globalObject: *JSC.JSGlobalObject) JSC.JSValue { + extern fn FileSystemRouterPrototype__styleSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; + + 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) + return null; + + 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()); if (comptime Environment.allow_assert) { - const value__ = TLSSocket__create(globalObject, this); - std.debug.assert(value__.as(TLSSocket).? == this); // If this fails, likely a C ABI issue. + const value__ = FileSystemRouter__create(globalObject, this); + std.debug.assert(value__.as(FileSystemRouter).? == this); // If this fails, likely a C ABI issue. return value__; } else { - return TLSSocket__create(globalObject, this); + return FileSystemRouter__create(globalObject, this); } } - /// Modify the internal ptr to point to a new instance of TLSSocket. - pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*TLSSocket) bool { + /// 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 TLSSocket__dangerouslySetPtr(value, ptr); + return FileSystemRouter__dangerouslySetPtr(value, ptr); } /// Detach the ptr from the thisValue - pub fn detachPtr(_: *TLSSocket, value: JSC.JSValue) void { + pub fn detachPtr(_: *FileSystemRouter, value: JSC.JSValue) void { JSC.markBinding(@src()); - std.debug.assert(TLSSocket__dangerouslySetPtr(value, null)); + std.debug.assert(FileSystemRouter__dangerouslySetPtr(value, null)); } - extern fn TLSSocket__fromJS(JSC.JSValue) ?*TLSSocket; - extern fn TLSSocket__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; + extern fn FileSystemRouter__fromJS(JSC.JSValue) ?*FileSystemRouter; + extern fn FileSystemRouter__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; - extern fn TLSSocket__create(globalObject: *JSC.JSGlobalObject, ptr: ?*TLSSocket) JSC.JSValue; + extern fn FileSystemRouter__create(globalObject: *JSC.JSGlobalObject, ptr: ?*FileSystemRouter) JSC.JSValue; - extern fn TLSSocket__dangerouslySetPtr(JSC.JSValue, ?*TLSSocket) bool; + extern fn FileSystemRouter__dangerouslySetPtr(JSC.JSValue, ?*FileSystemRouter) bool; comptime { - if (@TypeOf(TLSSocket.finalize) != (fn (*TLSSocket) callconv(.C) void)) { - @compileLog("TLSSocket.finalize is not a finalizer"); + if (@TypeOf(FileSystemRouter.constructor) != (fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*FileSystemRouter)) { + @compileLog("FileSystemRouter.constructor is not a constructor"); } - 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(FileSystemRouter.finalize) != (fn (*FileSystemRouter) callconv(.C) void)) { + @compileLog("FileSystemRouter.finalize is not a finalizer"); + } - if (@TypeOf(TLSSocket.getLocalPort) != GetterType) - @compileLog("Expected TLSSocket.getLocalPort 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(TLSSocket.getReadyState) != GetterType) - @compileLog("Expected TLSSocket.getReadyState 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(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(FileSystemRouter.getStyle) != GetterType) + @compileLog("Expected FileSystemRouter.getStyle 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(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" }); } } }; @@ -434,428 +896,1233 @@ pub const JSListener = struct { } } }; -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; +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; /// Return the pointer to the wrapped object. /// If the object does not match the type, return null. - pub fn fromJS(value: JSC.JSValue) ?*Subprocess { + pub fn fromJS(value: JSC.JSValue) ?*MD4 { JSC.markBinding(@src()); - return Subprocess__fromJS(value); + return MD4__fromJS(value); } - extern fn SubprocessPrototype__stderrSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; + /// 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); + } - extern fn SubprocessPrototype__stderrGetCachedValue(JSC.JSValue) JSC.JSValue; + /// Create a new instance of MD4 + pub fn toJS(this: *MD4, globalObject: *JSC.JSGlobalObject) JSC.JSValue { + JSC.markBinding(@src()); + if (comptime Environment.allow_assert) { + const value__ = MD4__create(globalObject, this); + std.debug.assert(value__.as(MD4).? == this); // If this fails, likely a C ABI issue. + return value__; + } else { + return MD4__create(globalObject, this); + } + } - /// `Subprocess.stderr` setter + /// 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); + } + + /// Detach the ptr from the thisValue + pub fn detachPtr(_: *MD4, value: JSC.JSValue) void { + JSC.markBinding(@src()); + std.debug.assert(MD4__dangerouslySetPtr(value, null)); + } + + extern fn MD4__fromJS(JSC.JSValue) ?*MD4; + extern fn MD4__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; + + extern fn MD4__create(globalObject: *JSC.JSGlobalObject, ptr: ?*MD4) JSC.JSValue; + + 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.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 (!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" }); + } + } +}; +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; + + /// Return the pointer to the wrapped object. + /// If the object does not match the type, return null. + pub fn fromJS(value: JSC.JSValue) ?*MD5 { + JSC.markBinding(@src()); + 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()); + if (comptime Environment.allow_assert) { + const value__ = MD5__create(globalObject, this); + std.debug.assert(value__.as(MD5).? == this); // If this fails, likely a C ABI issue. + return value__; + } else { + return MD5__create(globalObject, this); + } + } + + /// 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); + } + + /// Detach the ptr from the thisValue + pub fn detachPtr(_: *MD5, value: JSC.JSValue) void { + JSC.markBinding(@src()); + std.debug.assert(MD5__dangerouslySetPtr(value, null)); + } + + extern fn MD5__fromJS(JSC.JSValue) ?*MD5; + extern fn MD5__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; + + extern fn MD5__create(globalObject: *JSC.JSGlobalObject, ptr: ?*MD5) JSC.JSValue; + + 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.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 (!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" }); + } + } +}; +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; + + /// Return the pointer to the wrapped object. + /// If the object does not match the type, return null. + pub fn fromJS(value: JSC.JSValue) ?*MatchedRoute { + JSC.markBinding(@src()); + return MatchedRoute__fromJS(value); + } + + 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 stderrSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { + pub fn filePathSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { JSC.markBinding(@src()); - SubprocessPrototype__stderrSetCachedValue(thisValue, globalObject, value); + MatchedRoutePrototype__filePathSetCachedValue(thisValue, globalObject, value); } - /// `Subprocess.stderr` getter + /// `MatchedRoute.filePath` getter /// This value will be visited by the garbage collector. - pub fn stderrGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { + pub fn filePathGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { JSC.markBinding(@src()); - const result = SubprocessPrototype__stderrGetCachedValue(thisValue); + const result = MatchedRoutePrototype__filePathGetCachedValue(thisValue); if (result == .zero) return null; return result; } - extern fn SubprocessPrototype__stdinSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; + extern fn MatchedRoutePrototype__kindSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - extern fn SubprocessPrototype__stdinGetCachedValue(JSC.JSValue) JSC.JSValue; + extern fn MatchedRoutePrototype__kindGetCachedValue(JSC.JSValue) JSC.JSValue; - /// `Subprocess.stdin` setter + /// `MatchedRoute.kind` setter /// This value will be visited by the garbage collector. - pub fn stdinSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { + pub fn kindSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { JSC.markBinding(@src()); - SubprocessPrototype__stdinSetCachedValue(thisValue, globalObject, value); + MatchedRoutePrototype__kindSetCachedValue(thisValue, globalObject, value); } - /// `Subprocess.stdin` getter + /// `MatchedRoute.kind` getter /// This value will be visited by the garbage collector. - pub fn stdinGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { + pub fn kindGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { JSC.markBinding(@src()); - const result = SubprocessPrototype__stdinGetCachedValue(thisValue); + const result = MatchedRoutePrototype__kindGetCachedValue(thisValue); if (result == .zero) return null; return result; } - extern fn SubprocessPrototype__stdoutSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; + extern fn MatchedRoutePrototype__nameSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - extern fn SubprocessPrototype__stdoutGetCachedValue(JSC.JSValue) JSC.JSValue; + extern fn MatchedRoutePrototype__nameGetCachedValue(JSC.JSValue) JSC.JSValue; - /// `Subprocess.stdout` setter + /// `MatchedRoute.name` setter /// This value will be visited by the garbage collector. - pub fn stdoutSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { + pub fn nameSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { JSC.markBinding(@src()); - SubprocessPrototype__stdoutSetCachedValue(thisValue, globalObject, value); + MatchedRoutePrototype__nameSetCachedValue(thisValue, globalObject, value); } - /// `Subprocess.stdout` getter + /// `MatchedRoute.name` getter /// This value will be visited by the garbage collector. - pub fn stdoutGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { + pub fn nameGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { JSC.markBinding(@src()); - const result = SubprocessPrototype__stdoutGetCachedValue(thisValue); + const result = MatchedRoutePrototype__nameGetCachedValue(thisValue); if (result == .zero) return null; return result; } - /// Create a new instance of Subprocess - pub fn toJS(this: *Subprocess, globalObject: *JSC.JSGlobalObject) JSC.JSValue { + extern fn MatchedRoutePrototype__paramsSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; + + 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) + return null; + + return result; + } + + extern fn MatchedRoutePrototype__pathnameSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; + + 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) + return null; + + return result; + } + + extern fn MatchedRoutePrototype__querySetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; + + 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) + return null; + + return result; + } + + extern fn MatchedRoutePrototype__scriptSrcSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; + + 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) + return null; + + return result; + } + + /// Create a new instance of MatchedRoute + pub fn toJS(this: *MatchedRoute, globalObject: *JSC.JSGlobalObject) JSC.JSValue { JSC.markBinding(@src()); if (comptime Environment.allow_assert) { - const value__ = Subprocess__create(globalObject, this); - std.debug.assert(value__.as(Subprocess).? == this); // If this fails, likely a C ABI issue. + const value__ = MatchedRoute__create(globalObject, this); + std.debug.assert(value__.as(MatchedRoute).? == this); // If this fails, likely a C ABI issue. return value__; } else { - return Subprocess__create(globalObject, this); + return MatchedRoute__create(globalObject, this); } } - /// Modify the internal ptr to point to a new instance of Subprocess. - pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*Subprocess) bool { + /// 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 Subprocess__dangerouslySetPtr(value, ptr); + return MatchedRoute__dangerouslySetPtr(value, ptr); } /// Detach the ptr from the thisValue - pub fn detachPtr(_: *Subprocess, value: JSC.JSValue) void { + pub fn detachPtr(_: *MatchedRoute, value: JSC.JSValue) void { JSC.markBinding(@src()); - std.debug.assert(Subprocess__dangerouslySetPtr(value, null)); + std.debug.assert(MatchedRoute__dangerouslySetPtr(value, null)); } - extern fn Subprocess__fromJS(JSC.JSValue) ?*Subprocess; - extern fn Subprocess__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; + extern fn MatchedRoute__fromJS(JSC.JSValue) ?*MatchedRoute; + extern fn MatchedRoute__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; - extern fn Subprocess__create(globalObject: *JSC.JSGlobalObject, ptr: ?*Subprocess) JSC.JSValue; + extern fn MatchedRoute__create(globalObject: *JSC.JSGlobalObject, ptr: ?*MatchedRoute) JSC.JSValue; - extern fn Subprocess__dangerouslySetPtr(JSC.JSValue, ?*Subprocess) bool; + extern fn MatchedRoute__dangerouslySetPtr(JSC.JSValue, ?*MatchedRoute) bool; comptime { - if (@TypeOf(Subprocess.finalize) != (fn (*Subprocess) callconv(.C) void)) { - @compileLog("Subprocess.finalize is not a finalizer"); + if (@TypeOf(MatchedRoute.finalize) != (fn (*MatchedRoute) callconv(.C) void)) { + @compileLog("MatchedRoute.finalize is not a finalizer"); } - if (@TypeOf(Subprocess.getExitCode) != GetterType) - @compileLog("Expected Subprocess.getExitCode to be a getter"); + if (@TypeOf(MatchedRoute.getFilePath) != GetterType) + @compileLog("Expected MatchedRoute.getFilePath to be a getter"); - if (@TypeOf(Subprocess.getExited) != GetterType) - @compileLog("Expected Subprocess.getExited to be a getter"); + if (@TypeOf(MatchedRoute.getKind) != GetterType) + @compileLog("Expected MatchedRoute.getKind 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(MatchedRoute.getName) != GetterType) + @compileLog("Expected MatchedRoute.getName to be a getter"); - if (@TypeOf(Subprocess.getPid) != GetterType) - @compileLog("Expected Subprocess.getPid to be a getter"); + if (@TypeOf(MatchedRoute.getParams) != GetterType) + @compileLog("Expected MatchedRoute.getParams to be a getter"); - if (@TypeOf(Subprocess.getStdout) != GetterType) - @compileLog("Expected Subprocess.getStdout to be a getter"); + if (@TypeOf(MatchedRoute.getPathname) != GetterType) + @compileLog("Expected MatchedRoute.getPathname 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(MatchedRoute.getQuery) != GetterType) + @compileLog("Expected MatchedRoute.getQuery to be a getter"); - if (@TypeOf(Subprocess.getStderr) != GetterType) - @compileLog("Expected Subprocess.getStderr to be a getter"); + if (@TypeOf(MatchedRoute.getScriptSrc) != GetterType) + @compileLog("Expected MatchedRoute.getScriptSrc to be a getter"); - if (@TypeOf(Subprocess.getStdin) != GetterType) - @compileLog("Expected Subprocess.getStdin to be a getter"); + if (@TypeOf(MatchedRoute.getScriptSrc) != GetterType) + @compileLog("Expected MatchedRoute.getScriptSrc to be a getter"); - if (@TypeOf(Subprocess.getStdout) != GetterType) - @compileLog("Expected Subprocess.getStdout 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" }); + } + } +}; +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; - 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"); + /// Return the pointer to the wrapped object. + /// If the object does not match the type, return null. + pub fn fromJS(value: JSC.JSValue) ?*NodeJSFS { + JSC.markBinding(@src()); + 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()); + if (comptime Environment.allow_assert) { + const value__ = NodeJSFS__create(globalObject, this); + std.debug.assert(value__.as(NodeJSFS).? == this); // If this fails, likely a C ABI issue. + return value__; + } else { + return NodeJSFS__create(globalObject, this); + } + } + + /// 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); + } + /// Detach the ptr from the thisValue + pub fn detachPtr(_: *NodeJSFS, value: JSC.JSValue) void { + JSC.markBinding(@src()); + std.debug.assert(NodeJSFS__dangerouslySetPtr(value, null)); + } + + extern fn NodeJSFS__fromJS(JSC.JSValue) ?*NodeJSFS; + extern fn NodeJSFS__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; + + extern fn NodeJSFS__create(globalObject: *JSC.JSGlobalObject, ptr: ?*NodeJSFS) JSC.JSValue; + + 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.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(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(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.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 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; +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; /// Return the pointer to the wrapped object. /// If the object does not match the type, return null. - pub fn fromJS(value: JSC.JSValue) ?*SHA1 { + pub fn fromJS(value: JSC.JSValue) ?*Request { JSC.markBinding(@src()); - return SHA1__fromJS(value); + return Request__fromJS(value); } - /// Get the SHA1 constructor value. + 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); + } + + /// `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; + } + + extern fn RequestPrototype__headersSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; + + 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) + return null; + + return result; + } + + extern fn RequestPrototype__urlSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; + + 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) + return null; + + 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 SHA1__getConstructor(globalObject); + return Request__getConstructor(globalObject); } - /// Create a new instance of SHA1 - pub fn toJS(this: *SHA1, globalObject: *JSC.JSGlobalObject) JSC.JSValue { + /// Create a new instance of Request + pub fn toJS(this: *Request, globalObject: *JSC.JSGlobalObject) JSC.JSValue { JSC.markBinding(@src()); if (comptime Environment.allow_assert) { - const value__ = SHA1__create(globalObject, this); - std.debug.assert(value__.as(SHA1).? == this); // If this fails, likely a C ABI issue. + const value__ = Request__create(globalObject, this); + std.debug.assert(value__.as(Request).? == this); // If this fails, likely a C ABI issue. return value__; } else { - return SHA1__create(globalObject, this); + return Request__create(globalObject, this); } } - /// Modify the internal ptr to point to a new instance of SHA1. - pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*SHA1) bool { + /// 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 SHA1__dangerouslySetPtr(value, ptr); + return Request__dangerouslySetPtr(value, ptr); } /// Detach the ptr from the thisValue - pub fn detachPtr(_: *SHA1, value: JSC.JSValue) void { + pub fn detachPtr(_: *Request, value: JSC.JSValue) void { JSC.markBinding(@src()); - std.debug.assert(SHA1__dangerouslySetPtr(value, null)); + std.debug.assert(Request__dangerouslySetPtr(value, null)); } - extern fn SHA1__fromJS(JSC.JSValue) ?*SHA1; - extern fn SHA1__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; + extern fn Request__fromJS(JSC.JSValue) ?*Request; + extern fn Request__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; - extern fn SHA1__create(globalObject: *JSC.JSGlobalObject, ptr: ?*SHA1) JSC.JSValue; + extern fn Request__create(globalObject: *JSC.JSGlobalObject, ptr: ?*Request) JSC.JSValue; - extern fn SHA1__dangerouslySetPtr(JSC.JSValue, ?*SHA1) bool; + extern fn Request__dangerouslySetPtr(JSC.JSValue, ?*Request) bool; comptime { - if (@TypeOf(SHA1.constructor) != (fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*SHA1)) { - @compileLog("SHA1.constructor is not a constructor"); + if (@TypeOf(Request.estimatedSize) != (fn (*Request) callconv(.C) usize)) { + @compileLog("Request.estimatedSize is not a size function"); } - if (@TypeOf(SHA1.finalize) != (fn (*SHA1) callconv(.C) void)) { - @compileLog("SHA1.finalize is not a finalizer"); + if (@TypeOf(Request.constructor) != (fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*Request)) { + @compileLog("Request.constructor is not a constructor"); } - if (@TypeOf(SHA1.getByteLength) != GetterType) - @compileLog("Expected SHA1.getByteLength to be a getter"); + if (@TypeOf(Request.finalize) != (fn (*Request) callconv(.C) void)) { + @compileLog("Request.finalize is not a finalizer"); + } - 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(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.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.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(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(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.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.getText, .{ .name = "RequestPrototype__getText" }); + @export(Request.getUrl, .{ .name = "RequestPrototype__getUrl" }); } } }; -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; +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; /// Return the pointer to the wrapped object. /// If the object does not match the type, return null. - pub fn fromJS(value: JSC.JSValue) ?*MD5 { + pub fn fromJS(value: JSC.JSValue) ?*Response { JSC.markBinding(@src()); - return MD5__fromJS(value); + return Response__fromJS(value); } - /// Get the MD5 constructor value. + 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); + } + + /// `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; + } + + extern fn ResponsePrototype__headersSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; + + 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) + return null; + + return result; + } + + extern fn ResponsePrototype__statusTextSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; + + 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) + return null; + + return result; + } + + extern fn ResponsePrototype__urlSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; + + 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) + return null; + + 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 MD5__getConstructor(globalObject); + return Response__getConstructor(globalObject); } - /// Create a new instance of MD5 - pub fn toJS(this: *MD5, globalObject: *JSC.JSGlobalObject) JSC.JSValue { + /// Create a new instance of Response + pub fn toJS(this: *Response, globalObject: *JSC.JSGlobalObject) JSC.JSValue { JSC.markBinding(@src()); if (comptime Environment.allow_assert) { - const value__ = MD5__create(globalObject, this); - std.debug.assert(value__.as(MD5).? == this); // If this fails, likely a C ABI issue. + const value__ = Response__create(globalObject, this); + std.debug.assert(value__.as(Response).? == this); // If this fails, likely a C ABI issue. return value__; } else { - return MD5__create(globalObject, this); + return Response__create(globalObject, this); } } - /// Modify the internal ptr to point to a new instance of MD5. - pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*MD5) bool { + /// 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 MD5__dangerouslySetPtr(value, ptr); + return Response__dangerouslySetPtr(value, ptr); } /// Detach the ptr from the thisValue - pub fn detachPtr(_: *MD5, value: JSC.JSValue) void { + pub fn detachPtr(_: *Response, value: JSC.JSValue) void { JSC.markBinding(@src()); - std.debug.assert(MD5__dangerouslySetPtr(value, null)); + std.debug.assert(Response__dangerouslySetPtr(value, null)); } - extern fn MD5__fromJS(JSC.JSValue) ?*MD5; - extern fn MD5__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; + extern fn Response__fromJS(JSC.JSValue) ?*Response; + extern fn Response__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; - extern fn MD5__create(globalObject: *JSC.JSGlobalObject, ptr: ?*MD5) JSC.JSValue; + extern fn Response__create(globalObject: *JSC.JSGlobalObject, ptr: ?*Response) JSC.JSValue; - extern fn MD5__dangerouslySetPtr(JSC.JSValue, ?*MD5) bool; + extern fn Response__dangerouslySetPtr(JSC.JSValue, ?*Response) bool; comptime { - if (@TypeOf(MD5.constructor) != (fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*MD5)) { - @compileLog("MD5.constructor is not a constructor"); + if (@TypeOf(Response.estimatedSize) != (fn (*Response) callconv(.C) usize)) { + @compileLog("Response.estimatedSize is not a size function"); } - if (@TypeOf(MD5.finalize) != (fn (*MD5) callconv(.C) void)) { - @compileLog("MD5.finalize is not a finalizer"); + if (@TypeOf(Response.constructor) != (fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*Response)) { + @compileLog("Response.constructor is not a constructor"); } - if (@TypeOf(MD5.getByteLength) != GetterType) - @compileLog("Expected MD5.getByteLength to be a getter"); + if (@TypeOf(Response.finalize) != (fn (*Response) callconv(.C) void)) { + @compileLog("Response.finalize is not a finalizer"); + } - 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(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(MD5.hash) != StaticCallbackType) - @compileLog("Expected MD5.hash to be a static callback"); + 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.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(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(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.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 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; +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; /// Return the pointer to the wrapped object. /// If the object does not match the type, return null. - pub fn fromJS(value: JSC.JSValue) ?*MD4 { + pub fn fromJS(value: JSC.JSValue) ?*SHA1 { JSC.markBinding(@src()); - return MD4__fromJS(value); + return SHA1__fromJS(value); } - /// Get the MD4 constructor 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 MD4__getConstructor(globalObject); + return SHA1__getConstructor(globalObject); } - /// Create a new instance of MD4 - pub fn toJS(this: *MD4, globalObject: *JSC.JSGlobalObject) JSC.JSValue { + /// Create a new instance of SHA1 + pub fn toJS(this: *SHA1, globalObject: *JSC.JSGlobalObject) JSC.JSValue { JSC.markBinding(@src()); if (comptime Environment.allow_assert) { - const value__ = MD4__create(globalObject, this); - std.debug.assert(value__.as(MD4).? == this); // If this fails, likely a C ABI issue. + const value__ = SHA1__create(globalObject, this); + std.debug.assert(value__.as(SHA1).? == this); // If this fails, likely a C ABI issue. return value__; } else { - return MD4__create(globalObject, this); + return SHA1__create(globalObject, this); } } - /// Modify the internal ptr to point to a new instance of MD4. - pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*MD4) bool { + /// 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 MD4__dangerouslySetPtr(value, ptr); + return SHA1__dangerouslySetPtr(value, ptr); } /// Detach the ptr from the thisValue - pub fn detachPtr(_: *MD4, value: JSC.JSValue) void { + pub fn detachPtr(_: *SHA1, value: JSC.JSValue) void { JSC.markBinding(@src()); - std.debug.assert(MD4__dangerouslySetPtr(value, null)); + std.debug.assert(SHA1__dangerouslySetPtr(value, null)); } - extern fn MD4__fromJS(JSC.JSValue) ?*MD4; - extern fn MD4__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; + extern fn SHA1__fromJS(JSC.JSValue) ?*SHA1; + extern fn SHA1__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; - extern fn MD4__create(globalObject: *JSC.JSGlobalObject, ptr: ?*MD4) JSC.JSValue; + extern fn SHA1__create(globalObject: *JSC.JSGlobalObject, ptr: ?*SHA1) JSC.JSValue; - extern fn MD4__dangerouslySetPtr(JSC.JSValue, ?*MD4) bool; + extern fn SHA1__dangerouslySetPtr(JSC.JSValue, ?*SHA1) bool; comptime { - if (@TypeOf(MD4.constructor) != (fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*MD4)) { - @compileLog("MD4.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(MD4.finalize) != (fn (*MD4) callconv(.C) void)) { - @compileLog("MD4.finalize is not a finalizer"); + if (@TypeOf(SHA1.finalize) != (fn (*SHA1) callconv(.C) void)) { + @compileLog("SHA1.finalize is not a finalizer"); } - if (@TypeOf(MD4.getByteLength) != GetterType) - @compileLog("Expected MD4.getByteLength to be a getter"); + if (@TypeOf(SHA1.getByteLength) != GetterType) + @compileLog("Expected SHA1.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(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(MD4.hash) != StaticCallbackType) - @compileLog("Expected MD4.hash to be a static callback"); + if (@TypeOf(SHA1.hash) != StaticCallbackType) + @compileLog("Expected SHA1.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(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" }); } } }; @@ -944,88 +2211,88 @@ pub const JSSHA224 = struct { } } }; -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; +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; /// Return the pointer to the wrapped object. /// If the object does not match the type, return null. - pub fn fromJS(value: JSC.JSValue) ?*SHA512 { + pub fn fromJS(value: JSC.JSValue) ?*SHA256 { JSC.markBinding(@src()); - return SHA512__fromJS(value); + return SHA256__fromJS(value); } - /// Get the SHA512 constructor 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 SHA512__getConstructor(globalObject); + return SHA256__getConstructor(globalObject); } - /// Create a new instance of SHA512 - pub fn toJS(this: *SHA512, globalObject: *JSC.JSGlobalObject) JSC.JSValue { + /// Create a new instance of SHA256 + pub fn toJS(this: *SHA256, globalObject: *JSC.JSGlobalObject) JSC.JSValue { JSC.markBinding(@src()); if (comptime Environment.allow_assert) { - const value__ = SHA512__create(globalObject, this); - std.debug.assert(value__.as(SHA512).? == this); // If this fails, likely a C ABI issue. + const value__ = SHA256__create(globalObject, this); + std.debug.assert(value__.as(SHA256).? == this); // If this fails, likely a C ABI issue. return value__; } else { - return SHA512__create(globalObject, this); + return SHA256__create(globalObject, this); } } - /// Modify the internal ptr to point to a new instance of SHA512. - pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*SHA512) bool { + /// 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 SHA512__dangerouslySetPtr(value, ptr); + return SHA256__dangerouslySetPtr(value, ptr); } /// Detach the ptr from the thisValue - pub fn detachPtr(_: *SHA512, value: JSC.JSValue) void { + pub fn detachPtr(_: *SHA256, value: JSC.JSValue) void { JSC.markBinding(@src()); - std.debug.assert(SHA512__dangerouslySetPtr(value, null)); + std.debug.assert(SHA256__dangerouslySetPtr(value, null)); } - extern fn SHA512__fromJS(JSC.JSValue) ?*SHA512; - extern fn SHA512__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; + extern fn SHA256__fromJS(JSC.JSValue) ?*SHA256; + extern fn SHA256__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; - extern fn SHA512__create(globalObject: *JSC.JSGlobalObject, ptr: ?*SHA512) JSC.JSValue; + extern fn SHA256__create(globalObject: *JSC.JSGlobalObject, ptr: ?*SHA256) JSC.JSValue; - extern fn SHA512__dangerouslySetPtr(JSC.JSValue, ?*SHA512) bool; + extern fn SHA256__dangerouslySetPtr(JSC.JSValue, ?*SHA256) bool; comptime { - if (@TypeOf(SHA512.constructor) != (fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*SHA512)) { - @compileLog("SHA512.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(SHA512.finalize) != (fn (*SHA512) callconv(.C) void)) { - @compileLog("SHA512.finalize is not a finalizer"); + if (@TypeOf(SHA256.finalize) != (fn (*SHA256) callconv(.C) void)) { + @compileLog("SHA256.finalize is not a finalizer"); } - if (@TypeOf(SHA512.getByteLength) != GetterType) - @compileLog("Expected SHA512.getByteLength to be a getter"); + if (@TypeOf(SHA256.getByteLength) != GetterType) + @compileLog("Expected SHA256.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(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(SHA512.hash) != StaticCallbackType) - @compileLog("Expected SHA512.hash to be a static callback"); + if (@TypeOf(SHA256.hash) != StaticCallbackType) + @compileLog("Expected SHA256.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(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" }); } } }; @@ -1114,88 +2381,88 @@ pub const JSSHA384 = struct { } } }; -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; +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; /// Return the pointer to the wrapped object. /// If the object does not match the type, return null. - pub fn fromJS(value: JSC.JSValue) ?*SHA256 { + pub fn fromJS(value: JSC.JSValue) ?*SHA512 { JSC.markBinding(@src()); - return SHA256__fromJS(value); + return SHA512__fromJS(value); } - /// Get the SHA256 constructor 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 SHA256__getConstructor(globalObject); + return SHA512__getConstructor(globalObject); } - /// Create a new instance of SHA256 - pub fn toJS(this: *SHA256, globalObject: *JSC.JSGlobalObject) JSC.JSValue { + /// Create a new instance of SHA512 + pub fn toJS(this: *SHA512, globalObject: *JSC.JSGlobalObject) JSC.JSValue { JSC.markBinding(@src()); if (comptime Environment.allow_assert) { - const value__ = SHA256__create(globalObject, this); - std.debug.assert(value__.as(SHA256).? == this); // If this fails, likely a C ABI issue. + const value__ = SHA512__create(globalObject, this); + std.debug.assert(value__.as(SHA512).? == this); // If this fails, likely a C ABI issue. return value__; } else { - return SHA256__create(globalObject, this); + return SHA512__create(globalObject, this); } } - /// Modify the internal ptr to point to a new instance of SHA256. - pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*SHA256) bool { + /// 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 SHA256__dangerouslySetPtr(value, ptr); + return SHA512__dangerouslySetPtr(value, ptr); } /// Detach the ptr from the thisValue - pub fn detachPtr(_: *SHA256, value: JSC.JSValue) void { + pub fn detachPtr(_: *SHA512, value: JSC.JSValue) void { JSC.markBinding(@src()); - std.debug.assert(SHA256__dangerouslySetPtr(value, null)); + std.debug.assert(SHA512__dangerouslySetPtr(value, null)); } - extern fn SHA256__fromJS(JSC.JSValue) ?*SHA256; - extern fn SHA256__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; + extern fn SHA512__fromJS(JSC.JSValue) ?*SHA512; + extern fn SHA512__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; - extern fn SHA256__create(globalObject: *JSC.JSGlobalObject, ptr: ?*SHA256) JSC.JSValue; + extern fn SHA512__create(globalObject: *JSC.JSGlobalObject, ptr: ?*SHA512) JSC.JSValue; - extern fn SHA256__dangerouslySetPtr(JSC.JSValue, ?*SHA256) bool; + extern fn SHA512__dangerouslySetPtr(JSC.JSValue, ?*SHA512) bool; comptime { - if (@TypeOf(SHA256.constructor) != (fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*SHA256)) { - @compileLog("SHA256.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(SHA256.finalize) != (fn (*SHA256) callconv(.C) void)) { - @compileLog("SHA256.finalize is not a finalizer"); + if (@TypeOf(SHA512.finalize) != (fn (*SHA512) callconv(.C) void)) { + @compileLog("SHA512.finalize is not a finalizer"); } - if (@TypeOf(SHA256.getByteLength) != GetterType) - @compileLog("Expected SHA256.getByteLength to be a getter"); + if (@TypeOf(SHA512.getByteLength) != GetterType) + @compileLog("Expected SHA512.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(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(SHA256.hash) != StaticCallbackType) - @compileLog("Expected SHA256.hash to be a static callback"); + if (@TypeOf(SHA512.hash) != StaticCallbackType) + @compileLog("Expected SHA512.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(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" }); } } }; @@ -1284,117 +2551,6 @@ pub const JSSHA512_256 = struct { } } }; -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; - - /// Return the pointer to the wrapped object. - /// If the object does not match the type, return null. - pub fn fromJS(value: JSC.JSValue) ?*CryptoHasher { - JSC.markBinding(@src()); - return CryptoHasher__fromJS(value); - } - - 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); - } - - /// `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; - } - - /// 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()); - if (comptime Environment.allow_assert) { - const value__ = CryptoHasher__create(globalObject, this); - std.debug.assert(value__.as(CryptoHasher).? == this); // If this fails, likely a C ABI issue. - return value__; - } else { - return CryptoHasher__create(globalObject, this); - } - } - - /// 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); - } - - /// Detach the ptr from the thisValue - pub fn detachPtr(_: *CryptoHasher, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(CryptoHasher__dangerouslySetPtr(value, null)); - } - - extern fn CryptoHasher__fromJS(JSC.JSValue) ?*CryptoHasher; - extern fn CryptoHasher__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; - - extern fn CryptoHasher__create(globalObject: *JSC.JSGlobalObject, ptr: ?*CryptoHasher) JSC.JSValue; - - 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.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 (!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" }); - } - } -}; pub const JSServerWebSocket = struct { const ServerWebSocket = Classes.ServerWebSocket; const GetterType = fn (*ServerWebSocket, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; @@ -1577,664 +2733,469 @@ pub const JSServerWebSocket = struct { } } }; -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; +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; /// Return the pointer to the wrapped object. /// If the object does not match the type, return null. - pub fn fromJS(value: JSC.JSValue) ?*FileSystemRouter { + pub fn fromJS(value: JSC.JSValue) ?*Subprocess { JSC.markBinding(@src()); - return FileSystemRouter__fromJS(value); + return Subprocess__fromJS(value); } - extern fn FileSystemRouterPrototype__originSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; + extern fn SubprocessPrototype__stderrSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - extern fn FileSystemRouterPrototype__originGetCachedValue(JSC.JSValue) JSC.JSValue; + extern fn SubprocessPrototype__stderrGetCachedValue(JSC.JSValue) JSC.JSValue; - /// `FileSystemRouter.origin` setter + /// `Subprocess.stderr` setter /// This value will be visited by the garbage collector. - pub fn originSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { + pub fn stderrSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { JSC.markBinding(@src()); - FileSystemRouterPrototype__originSetCachedValue(thisValue, globalObject, value); + SubprocessPrototype__stderrSetCachedValue(thisValue, globalObject, value); } - /// `FileSystemRouter.origin` getter + /// `Subprocess.stderr` getter /// This value will be visited by the garbage collector. - pub fn originGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { + pub fn stderrGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { JSC.markBinding(@src()); - const result = FileSystemRouterPrototype__originGetCachedValue(thisValue); + const result = SubprocessPrototype__stderrGetCachedValue(thisValue); if (result == .zero) return null; return result; } - extern fn FileSystemRouterPrototype__routesSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; + extern fn SubprocessPrototype__stdinSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - extern fn FileSystemRouterPrototype__routesGetCachedValue(JSC.JSValue) JSC.JSValue; + extern fn SubprocessPrototype__stdinGetCachedValue(JSC.JSValue) JSC.JSValue; - /// `FileSystemRouter.routes` setter + /// `Subprocess.stdin` setter /// This value will be visited by the garbage collector. - pub fn routesSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { + pub fn stdinSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { JSC.markBinding(@src()); - FileSystemRouterPrototype__routesSetCachedValue(thisValue, globalObject, value); + SubprocessPrototype__stdinSetCachedValue(thisValue, globalObject, value); } - /// `FileSystemRouter.routes` getter + /// `Subprocess.stdin` getter /// This value will be visited by the garbage collector. - pub fn routesGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { + pub fn stdinGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { JSC.markBinding(@src()); - const result = FileSystemRouterPrototype__routesGetCachedValue(thisValue); + const result = SubprocessPrototype__stdinGetCachedValue(thisValue); if (result == .zero) return null; return result; } - extern fn FileSystemRouterPrototype__styleSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; + extern fn SubprocessPrototype__stdoutSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - extern fn FileSystemRouterPrototype__styleGetCachedValue(JSC.JSValue) JSC.JSValue; + extern fn SubprocessPrototype__stdoutGetCachedValue(JSC.JSValue) JSC.JSValue; - /// `FileSystemRouter.style` setter + /// `Subprocess.stdout` setter /// This value will be visited by the garbage collector. - pub fn styleSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { + pub fn stdoutSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { JSC.markBinding(@src()); - FileSystemRouterPrototype__styleSetCachedValue(thisValue, globalObject, value); + SubprocessPrototype__stdoutSetCachedValue(thisValue, globalObject, value); } - /// `FileSystemRouter.style` getter + /// `Subprocess.stdout` getter /// This value will be visited by the garbage collector. - pub fn styleGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { + pub fn stdoutGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { JSC.markBinding(@src()); - const result = FileSystemRouterPrototype__styleGetCachedValue(thisValue); + const result = SubprocessPrototype__stdoutGetCachedValue(thisValue); if (result == .zero) return null; 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 { + /// Create a new instance of Subprocess + pub fn toJS(this: *Subprocess, globalObject: *JSC.JSGlobalObject) JSC.JSValue { JSC.markBinding(@src()); if (comptime Environment.allow_assert) { - const value__ = FileSystemRouter__create(globalObject, this); - std.debug.assert(value__.as(FileSystemRouter).? == this); // If this fails, likely a C ABI issue. + const value__ = Subprocess__create(globalObject, this); + std.debug.assert(value__.as(Subprocess).? == this); // If this fails, likely a C ABI issue. return value__; } else { - return FileSystemRouter__create(globalObject, this); + return Subprocess__create(globalObject, this); } } - /// Modify the internal ptr to point to a new instance of FileSystemRouter. - pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*FileSystemRouter) bool { + /// 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 FileSystemRouter__dangerouslySetPtr(value, ptr); + return Subprocess__dangerouslySetPtr(value, ptr); } /// Detach the ptr from the thisValue - pub fn detachPtr(_: *FileSystemRouter, value: JSC.JSValue) void { + pub fn detachPtr(_: *Subprocess, value: JSC.JSValue) void { JSC.markBinding(@src()); - std.debug.assert(FileSystemRouter__dangerouslySetPtr(value, null)); + std.debug.assert(Subprocess__dangerouslySetPtr(value, null)); } - extern fn FileSystemRouter__fromJS(JSC.JSValue) ?*FileSystemRouter; - extern fn FileSystemRouter__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; + extern fn Subprocess__fromJS(JSC.JSValue) ?*Subprocess; + extern fn Subprocess__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; - extern fn FileSystemRouter__create(globalObject: *JSC.JSGlobalObject, ptr: ?*FileSystemRouter) JSC.JSValue; + extern fn Subprocess__create(globalObject: *JSC.JSGlobalObject, ptr: ?*Subprocess) JSC.JSValue; - extern fn FileSystemRouter__dangerouslySetPtr(JSC.JSValue, ?*FileSystemRouter) bool; + extern fn Subprocess__dangerouslySetPtr(JSC.JSValue, ?*Subprocess) bool; comptime { - 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.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" }); + if (@TypeOf(Subprocess.finalize) != (fn (*Subprocess) callconv(.C) void)) { + @compileLog("Subprocess.finalize is not a finalizer"); } - } -}; -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; - - /// Return the pointer to the wrapped object. - /// If the object does not match the type, return null. - pub fn fromJS(value: JSC.JSValue) ?*MatchedRoute { - JSC.markBinding(@src()); - return MatchedRoute__fromJS(value); - } - 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); - } - - /// `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; - } - - extern fn MatchedRoutePrototype__kindSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - 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) - return null; - - return result; - } - - extern fn MatchedRoutePrototype__nameSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - 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); - } + if (@TypeOf(Subprocess.getExitCode) != GetterType) + @compileLog("Expected Subprocess.getExitCode to be a getter"); - /// `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; + if (@TypeOf(Subprocess.getExited) != GetterType) + @compileLog("Expected Subprocess.getExited to be a getter"); - return result; - } + 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"); - extern fn MatchedRoutePrototype__paramsSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; + if (@TypeOf(Subprocess.getPid) != GetterType) + @compileLog("Expected Subprocess.getPid to be a getter"); - extern fn MatchedRoutePrototype__paramsGetCachedValue(JSC.JSValue) JSC.JSValue; + if (@TypeOf(Subprocess.getStdout) != GetterType) + @compileLog("Expected Subprocess.getStdout to be a getter"); - /// `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); - } + 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"); - /// `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; + if (@TypeOf(Subprocess.getStderr) != GetterType) + @compileLog("Expected Subprocess.getStderr to be a getter"); - return result; - } + if (@TypeOf(Subprocess.getStdin) != GetterType) + @compileLog("Expected Subprocess.getStdin to be a getter"); - extern fn MatchedRoutePrototype__pathnameSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; + if (@TypeOf(Subprocess.getStdout) != GetterType) + @compileLog("Expected Subprocess.getStdout to be a getter"); - extern fn MatchedRoutePrototype__pathnameGetCachedValue(JSC.JSValue) JSC.JSValue; + 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"); - /// `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); + 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" }); + } } +}; +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; - /// `MatchedRoute.pathname` getter - /// This value will be visited by the garbage collector. - pub fn pathnameGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { + /// Return the pointer to the wrapped object. + /// If the object does not match the type, return null. + pub fn fromJS(value: JSC.JSValue) ?*TCPSocket { JSC.markBinding(@src()); - const result = MatchedRoutePrototype__pathnameGetCachedValue(thisValue); - if (result == .zero) - return null; - - return result; + return TCPSocket__fromJS(value); } - extern fn MatchedRoutePrototype__querySetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; + extern fn TCPSocketPrototype__dataSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - extern fn MatchedRoutePrototype__queryGetCachedValue(JSC.JSValue) JSC.JSValue; + extern fn TCPSocketPrototype__dataGetCachedValue(JSC.JSValue) JSC.JSValue; - /// `MatchedRoute.query` setter + /// `TCPSocket.data` setter /// This value will be visited by the garbage collector. - pub fn querySetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { + pub fn dataSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { JSC.markBinding(@src()); - MatchedRoutePrototype__querySetCachedValue(thisValue, globalObject, value); + TCPSocketPrototype__dataSetCachedValue(thisValue, globalObject, value); } - /// `MatchedRoute.query` getter + /// `TCPSocket.data` getter /// This value will be visited by the garbage collector. - pub fn queryGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { + pub fn dataGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { JSC.markBinding(@src()); - const result = MatchedRoutePrototype__queryGetCachedValue(thisValue); + const result = TCPSocketPrototype__dataGetCachedValue(thisValue); if (result == .zero) return null; return result; } - extern fn MatchedRoutePrototype__scriptSrcSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; + extern fn TCPSocketPrototype__remoteAddressSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - extern fn MatchedRoutePrototype__scriptSrcGetCachedValue(JSC.JSValue) JSC.JSValue; + extern fn TCPSocketPrototype__remoteAddressGetCachedValue(JSC.JSValue) JSC.JSValue; - /// `MatchedRoute.scriptSrc` setter + /// `TCPSocket.remoteAddress` setter /// This value will be visited by the garbage collector. - pub fn scriptSrcSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { + pub fn remoteAddressSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { JSC.markBinding(@src()); - MatchedRoutePrototype__scriptSrcSetCachedValue(thisValue, globalObject, value); + TCPSocketPrototype__remoteAddressSetCachedValue(thisValue, globalObject, value); } - /// `MatchedRoute.scriptSrc` getter + /// `TCPSocket.remoteAddress` getter /// This value will be visited by the garbage collector. - pub fn scriptSrcGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { + pub fn remoteAddressGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { JSC.markBinding(@src()); - const result = MatchedRoutePrototype__scriptSrcGetCachedValue(thisValue); + const result = TCPSocketPrototype__remoteAddressGetCachedValue(thisValue); if (result == .zero) return null; return result; } - /// Create a new instance of MatchedRoute - pub fn toJS(this: *MatchedRoute, globalObject: *JSC.JSGlobalObject) JSC.JSValue { + /// Create a new instance of TCPSocket + pub fn toJS(this: *TCPSocket, globalObject: *JSC.JSGlobalObject) JSC.JSValue { JSC.markBinding(@src()); if (comptime Environment.allow_assert) { - const value__ = MatchedRoute__create(globalObject, this); - std.debug.assert(value__.as(MatchedRoute).? == this); // If this fails, likely a C ABI issue. + const value__ = TCPSocket__create(globalObject, this); + std.debug.assert(value__.as(TCPSocket).? == this); // If this fails, likely a C ABI issue. return value__; } else { - return MatchedRoute__create(globalObject, this); + return TCPSocket__create(globalObject, this); } } - /// Modify the internal ptr to point to a new instance of MatchedRoute. - pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*MatchedRoute) bool { + /// 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 MatchedRoute__dangerouslySetPtr(value, ptr); + return TCPSocket__dangerouslySetPtr(value, ptr); } /// Detach the ptr from the thisValue - pub fn detachPtr(_: *MatchedRoute, value: JSC.JSValue) void { + pub fn detachPtr(_: *TCPSocket, value: JSC.JSValue) void { JSC.markBinding(@src()); - std.debug.assert(MatchedRoute__dangerouslySetPtr(value, null)); + std.debug.assert(TCPSocket__dangerouslySetPtr(value, null)); } - extern fn MatchedRoute__fromJS(JSC.JSValue) ?*MatchedRoute; - extern fn MatchedRoute__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; + extern fn TCPSocket__fromJS(JSC.JSValue) ?*TCPSocket; + extern fn TCPSocket__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; - extern fn MatchedRoute__create(globalObject: *JSC.JSGlobalObject, ptr: ?*MatchedRoute) JSC.JSValue; + extern fn TCPSocket__create(globalObject: *JSC.JSGlobalObject, ptr: ?*TCPSocket) JSC.JSValue; - extern fn MatchedRoute__dangerouslySetPtr(JSC.JSValue, ?*MatchedRoute) bool; + extern fn TCPSocket__dangerouslySetPtr(JSC.JSValue, ?*TCPSocket) bool; comptime { - if (@TypeOf(MatchedRoute.finalize) != (fn (*MatchedRoute) callconv(.C) void)) { - @compileLog("MatchedRoute.finalize is not a finalizer"); + if (@TypeOf(TCPSocket.finalize) != (fn (*TCPSocket) callconv(.C) void)) { + @compileLog("TCPSocket.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(TCPSocket.getData) != GetterType) + @compileLog("Expected TCPSocket.getData to be a getter"); - if (@TypeOf(MatchedRoute.getPathname) != GetterType) - @compileLog("Expected MatchedRoute.getPathname 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(MatchedRoute.getQuery) != GetterType) - @compileLog("Expected MatchedRoute.getQuery to be a getter"); + if (@TypeOf(TCPSocket.getLocalPort) != GetterType) + @compileLog("Expected TCPSocket.getLocalPort to be a getter"); - if (@TypeOf(MatchedRoute.getScriptSrc) != GetterType) - @compileLog("Expected MatchedRoute.getScriptSrc to be a getter"); + if (@TypeOf(TCPSocket.getReadyState) != GetterType) + @compileLog("Expected TCPSocket.getReadyState to be a getter"); - if (@TypeOf(MatchedRoute.getScriptSrc) != GetterType) - @compileLog("Expected MatchedRoute.getScriptSrc 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(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(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" }); } } }; -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; +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; /// Return the pointer to the wrapped object. /// If the object does not match the type, return null. - pub fn fromJS(value: JSC.JSValue) ?*Expect { + pub fn fromJS(value: JSC.JSValue) ?*TLSSocket { JSC.markBinding(@src()); - return Expect__fromJS(value); + return TLSSocket__fromJS(value); } - extern fn ExpectPrototype__capturedValueSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; + extern fn TLSSocketPrototype__dataSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - extern fn ExpectPrototype__capturedValueGetCachedValue(JSC.JSValue) JSC.JSValue; + extern fn TLSSocketPrototype__dataGetCachedValue(JSC.JSValue) JSC.JSValue; - /// `Expect.capturedValue` setter + /// `TLSSocket.data` setter /// This value will be visited by the garbage collector. - pub fn capturedValueSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { + pub fn dataSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { JSC.markBinding(@src()); - ExpectPrototype__capturedValueSetCachedValue(thisValue, globalObject, value); + TLSSocketPrototype__dataSetCachedValue(thisValue, globalObject, value); } - /// `Expect.capturedValue` getter + /// `TLSSocket.data` getter /// This value will be visited by the garbage collector. - pub fn capturedValueGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { + pub fn dataGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { JSC.markBinding(@src()); - const result = ExpectPrototype__capturedValueGetCachedValue(thisValue); + const result = TLSSocketPrototype__dataGetCachedValue(thisValue); if (result == .zero) return null; return result; } - extern fn ExpectPrototype__resultValueSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; + extern fn TLSSocketPrototype__remoteAddressSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - extern fn ExpectPrototype__resultValueGetCachedValue(JSC.JSValue) JSC.JSValue; + extern fn TLSSocketPrototype__remoteAddressGetCachedValue(JSC.JSValue) JSC.JSValue; - /// `Expect.resultValue` setter + /// `TLSSocket.remoteAddress` setter /// This value will be visited by the garbage collector. - pub fn resultValueSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { + pub fn remoteAddressSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { JSC.markBinding(@src()); - ExpectPrototype__resultValueSetCachedValue(thisValue, globalObject, value); + TLSSocketPrototype__remoteAddressSetCachedValue(thisValue, globalObject, value); } - /// `Expect.resultValue` getter + /// `TLSSocket.remoteAddress` getter /// This value will be visited by the garbage collector. - pub fn resultValueGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { + pub fn remoteAddressGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { JSC.markBinding(@src()); - const result = ExpectPrototype__resultValueGetCachedValue(thisValue); + const result = TLSSocketPrototype__remoteAddressGetCachedValue(thisValue); if (result == .zero) return null; 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 { + /// Create a new instance of TLSSocket + pub fn toJS(this: *TLSSocket, globalObject: *JSC.JSGlobalObject) JSC.JSValue { JSC.markBinding(@src()); if (comptime Environment.allow_assert) { - const value__ = Expect__create(globalObject, this); - std.debug.assert(value__.as(Expect).? == this); // If this fails, likely a C ABI issue. + const value__ = TLSSocket__create(globalObject, this); + std.debug.assert(value__.as(TLSSocket).? == this); // If this fails, likely a C ABI issue. return value__; } else { - return Expect__create(globalObject, this); + return TLSSocket__create(globalObject, this); } } - /// Modify the internal ptr to point to a new instance of Expect. - pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*Expect) bool { + /// 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 Expect__dangerouslySetPtr(value, ptr); + return TLSSocket__dangerouslySetPtr(value, ptr); } /// Detach the ptr from the thisValue - pub fn detachPtr(_: *Expect, value: JSC.JSValue) void { + pub fn detachPtr(_: *TLSSocket, value: JSC.JSValue) void { JSC.markBinding(@src()); - std.debug.assert(Expect__dangerouslySetPtr(value, null)); + std.debug.assert(TLSSocket__dangerouslySetPtr(value, null)); } - extern fn Expect__fromJS(JSC.JSValue) ?*Expect; - extern fn Expect__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; + extern fn TLSSocket__fromJS(JSC.JSValue) ?*TLSSocket; + extern fn TLSSocket__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; - extern fn Expect__create(globalObject: *JSC.JSGlobalObject, ptr: ?*Expect) JSC.JSValue; + extern fn TLSSocket__create(globalObject: *JSC.JSGlobalObject, ptr: ?*TLSSocket) JSC.JSValue; - extern fn Expect__dangerouslySetPtr(JSC.JSValue, ?*Expect) bool; + extern fn TLSSocket__dangerouslySetPtr(JSC.JSValue, ?*TLSSocket) bool; comptime { - if (@TypeOf(Expect.constructor) != (fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*Expect)) { - @compileLog("Expect.constructor is not a constructor"); + if (@TypeOf(TLSSocket.finalize) != (fn (*TLSSocket) callconv(.C) void)) { + @compileLog("TLSSocket.finalize is not a finalizer"); } - if (@TypeOf(Expect.finalize) != (fn (*Expect) callconv(.C) void)) { - @compileLog("Expect.finalize is not a finalizer"); - } + if (@TypeOf(TLSSocket.getData) != GetterType) + @compileLog("Expected TLSSocket.getData to be a getter"); - 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(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(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(TLSSocket.getLocalPort) != GetterType) + @compileLog("Expected TLSSocket.getLocalPort to be a getter"); - if (@TypeOf(Expect.getStaticResolves) != StaticGetterType) - @compileLog("Expected Expect.getStaticResolves to be a static getter"); + if (@TypeOf(TLSSocket.getReadyState) != GetterType) + @compileLog("Expected TLSSocket.getReadyState to be a 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(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(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(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" }); } } }; @@ -2342,975 +3303,110 @@ pub const JSTextDecoder = struct { } } }; -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; +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; /// Return the pointer to the wrapped object. /// If the object does not match the type, return null. - pub fn fromJS(value: JSC.JSValue) ?*Request { - JSC.markBinding(@src()); - return Request__fromJS(value); - } - - 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 { + pub fn fromJS(value: JSC.JSValue) ?*Transpiler { 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) - return null; - - return result; + return Transpiler__fromJS(value); } - extern fn RequestPrototype__headersSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - 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) - return null; - - return result; - } - - extern fn RequestPrototype__urlSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - 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) - return null; - - return result; - } - - /// Get the Request constructor 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 Request__getConstructor(globalObject); + return Transpiler__getConstructor(globalObject); } - /// Create a new instance of Request - pub fn toJS(this: *Request, globalObject: *JSC.JSGlobalObject) JSC.JSValue { + /// Create a new instance of Transpiler + pub fn toJS(this: *Transpiler, globalObject: *JSC.JSGlobalObject) JSC.JSValue { JSC.markBinding(@src()); if (comptime Environment.allow_assert) { - const value__ = Request__create(globalObject, this); - std.debug.assert(value__.as(Request).? == this); // If this fails, likely a C ABI issue. + const value__ = Transpiler__create(globalObject, this); + std.debug.assert(value__.as(Transpiler).? == this); // If this fails, likely a C ABI issue. return value__; } else { - return Request__create(globalObject, this); + return Transpiler__create(globalObject, this); } } - /// Modify the internal ptr to point to a new instance of Request. - pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*Request) bool { + /// 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 Request__dangerouslySetPtr(value, ptr); + return Transpiler__dangerouslySetPtr(value, ptr); } /// Detach the ptr from the thisValue - pub fn detachPtr(_: *Request, value: JSC.JSValue) void { + pub fn detachPtr(_: *Transpiler, value: JSC.JSValue) void { JSC.markBinding(@src()); - std.debug.assert(Request__dangerouslySetPtr(value, null)); + std.debug.assert(Transpiler__dangerouslySetPtr(value, null)); } - extern fn Request__fromJS(JSC.JSValue) ?*Request; - extern fn Request__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; + extern fn Transpiler__fromJS(JSC.JSValue) ?*Transpiler; + extern fn Transpiler__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; - extern fn Request__create(globalObject: *JSC.JSGlobalObject, ptr: ?*Request) JSC.JSValue; + extern fn Transpiler__create(globalObject: *JSC.JSGlobalObject, ptr: ?*Transpiler) JSC.JSValue; - extern fn Request__dangerouslySetPtr(JSC.JSValue, ?*Request) bool; + extern fn Transpiler__dangerouslySetPtr(JSC.JSValue, ?*Transpiler) bool; comptime { - if (@TypeOf(Request.estimatedSize) != (fn (*Request) callconv(.C) usize)) { - @compileLog("Request.estimatedSize is not a size function"); + if (@TypeOf(Transpiler.constructor) != (fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*Transpiler)) { + @compileLog("Transpiler.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(Transpiler.finalize) != (fn (*Transpiler) callconv(.C) void)) { + @compileLog("Transpiler.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.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.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(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(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.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.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; - - /// Return the pointer to the wrapped object. - /// If the object does not match the type, return null. - pub fn fromJS(value: JSC.JSValue) ?*Response { - JSC.markBinding(@src()); - return Response__fromJS(value); - } - - 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); - } - - /// `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; - } - - extern fn ResponsePrototype__headersSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - 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) - return null; - - return result; - } - - extern fn ResponsePrototype__statusTextSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - 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) - return null; - - return result; - } - - extern fn ResponsePrototype__urlSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; - - 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) - return null; - - 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()); - if (comptime Environment.allow_assert) { - const value__ = Response__create(globalObject, this); - std.debug.assert(value__.as(Response).? == this); // If this fails, likely a C ABI issue. - return value__; - } else { - return Response__create(globalObject, this); - } - } - - /// 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); - } - - /// Detach the ptr from the thisValue - pub fn detachPtr(_: *Response, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(Response__dangerouslySetPtr(value, null)); - } - - extern fn Response__fromJS(JSC.JSValue) ?*Response; - extern fn Response__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; - - extern fn Response__create(globalObject: *JSC.JSGlobalObject, ptr: ?*Response) JSC.JSValue; - - 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.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.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.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.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 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; - - /// Return the pointer to the wrapped object. - /// If the object does not match the type, return null. - pub fn fromJS(value: JSC.JSValue) ?*Blob { - JSC.markBinding(@src()); - 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()); - if (comptime Environment.allow_assert) { - const value__ = Blob__create(globalObject, this); - std.debug.assert(value__.as(Blob).? == this); // If this fails, likely a C ABI issue. - return value__; - } else { - return Blob__create(globalObject, this); - } - } - - /// 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); - } - - /// Detach the ptr from the thisValue - pub fn detachPtr(_: *Blob, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(Blob__dangerouslySetPtr(value, null)); - } - - extern fn Blob__fromJS(JSC.JSValue) ?*Blob; - extern fn Blob__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; - - extern fn Blob__create(globalObject: *JSC.JSGlobalObject, ptr: ?*Blob) JSC.JSValue; - - 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.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.getJSON) != CallbackType) - @compileLog("Expected Blob.getJSON to be a callback but received " ++ @typeName(@TypeOf(Blob.getJSON))); - 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.setType) != SetterType) - @compileLog("Expected Blob.setType to be a setter"); - 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.getJSON, .{ .name = "BlobPrototype__getJSON" }); - @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.setType, .{ .name = "BlobPrototype__setType" }); - } - } -}; -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; - - /// Return the pointer to the wrapped object. - /// If the object does not match the type, return null. - pub fn fromJS(value: JSC.JSValue) ?*Dirent { - JSC.markBinding(@src()); - return Dirent__fromJS(value); - } - - 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); - } - - /// `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; - } - - /// 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()); - if (comptime Environment.allow_assert) { - const value__ = Dirent__create(globalObject, this); - std.debug.assert(value__.as(Dirent).? == this); // If this fails, likely a C ABI issue. - return value__; - } else { - return Dirent__create(globalObject, this); - } - } - - /// 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); - } - - /// Detach the ptr from the thisValue - pub fn detachPtr(_: *Dirent, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(Dirent__dangerouslySetPtr(value, null)); - } - - extern fn Dirent__fromJS(JSC.JSValue) ?*Dirent; - extern fn Dirent__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; - - extern fn Dirent__create(globalObject: *JSC.JSGlobalObject, ptr: ?*Dirent) JSC.JSValue; - - 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 (!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" }); - } - } -}; -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; - - /// Return the pointer to the wrapped object. - /// If the object does not match the type, return null. - pub fn fromJS(value: JSC.JSValue) ?*NodeJSFS { - JSC.markBinding(@src()); - 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()); - if (comptime Environment.allow_assert) { - const value__ = NodeJSFS__create(globalObject, this); - std.debug.assert(value__.as(NodeJSFS).? == this); // If this fails, likely a C ABI issue. - return value__; - } else { - return NodeJSFS__create(globalObject, this); - } - } - - /// 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); - } - - /// Detach the ptr from the thisValue - pub fn detachPtr(_: *NodeJSFS, value: JSC.JSValue) void { - JSC.markBinding(@src()); - std.debug.assert(NodeJSFS__dangerouslySetPtr(value, null)); - } - - extern fn NodeJSFS__fromJS(JSC.JSValue) ?*NodeJSFS; - extern fn NodeJSFS__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; - - extern fn NodeJSFS__create(globalObject: *JSC.JSGlobalObject, ptr: ?*NodeJSFS) JSC.JSValue; - - 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.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.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(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 { - _ = JSTCPSocket; - _ = JSTLSSocket; + _ = JSBlob; + _ = JSCryptoHasher; + _ = JSDirent; + _ = JSExpect; + _ = JSFileSystemRouter; _ = JSListener; - _ = JSSubprocess; - _ = JSSHA1; - _ = JSMD5; _ = JSMD4; + _ = JSMD5; + _ = JSMatchedRoute; + _ = JSNodeJSFS; + _ = JSRequest; + _ = JSResponse; + _ = JSSHA1; _ = JSSHA224; - _ = JSSHA512; - _ = JSSHA384; _ = JSSHA256; + _ = JSSHA384; + _ = JSSHA512; _ = JSSHA512_256; - _ = JSCryptoHasher; _ = JSServerWebSocket; - _ = JSFileSystemRouter; - _ = JSMatchedRoute; - _ = JSExpect; + _ = JSSubprocess; + _ = JSTCPSocket; + _ = JSTLSSocket; _ = JSTextDecoder; - _ = JSRequest; - _ = JSResponse; - _ = JSBlob; - _ = JSDirent; - _ = JSNodeJSFS; + _ = JSTranspiler; } diff --git a/src/bun.js/bindings/generated_classes_list.zig b/src/bun.js/bindings/generated_classes_list.zig index 2eaf30e04..f76376704 100644 --- a/src/bun.js/bindings/generated_classes_list.zig +++ b/src/bun.js/bindings/generated_classes_list.zig @@ -24,4 +24,5 @@ pub const Classes = struct { pub const MatchedRoute = JSC.API.MatchedRoute; pub const Dirent = JSC.Node.Dirent; pub const NodeJSFS = JSC.Node.NodeJSFS; + pub const Transpiler = JSC.API.Transpiler; }; diff --git a/src/jsc.zig b/src/jsc.zig index 114326d79..2ac14cde0 100644 --- a/src/jsc.zig +++ b/src/jsc.zig @@ -62,4 +62,19 @@ pub inline fn markBinding(src: std.builtin.SourceLocation) void { } pub const Subprocess = @import("./bun.js/api/bun.zig").Subprocess; +/// Generated code! To regenerate, run: +/// +/// make codegen +/// +/// This file is generated by: +/// 1. `bun src/bun.js/scripts/generate-classes.ts` +/// 2. Scan for **/*.classes.ts files in src/bun.js/src +/// 3. Generate a JS wrapper for each class in: +/// - Zig: generated_classes.zig +/// - C++: ZigGeneratedClasses.h, ZigGeneratedClasses.cpp +/// 4. For the Zig code to successfully compile: +/// - Add it to generated_classes_list.zig +/// - pub usingnamespace JSC.Codegen.JSMyClassName; +/// 5. make clean-bindings && make bindings -j10 +/// pub const Codegen = @import("./bun.js/bindings/generated_classes.zig"); diff --git a/src/options.zig b/src/options.zig index b9268f400..e161e9582 100644 --- a/src/options.zig +++ b/src/options.zig @@ -669,7 +669,7 @@ pub const Loader = enum(u4) { if (zig_str.len == 0) return null; return fromString(zig_str.slice()) orelse { - JSC.throwInvalidArguments("invalid loader – must be js, jsx, tsx, ts, css, file, toml, wasm, or json", .{}, global, exception); + JSC.throwInvalidArguments("invalid loader - must be js, jsx, tsx, ts, css, file, toml, wasm, or json", .{}, global, exception); return null; }; } |