diff options
author | 2022-08-18 00:56:36 -0700 | |
---|---|---|
committer | 2022-08-18 00:56:36 -0700 | |
commit | 9eaed7cec7a62309c854ad968bcaea4326bea151 (patch) | |
tree | 1356cdfea94e5eacb93dda669562e76b18ac128a /src | |
parent | eb5b298bc17a7ea2ede438b227c27c3fc0b5462e (diff) | |
download | bun-9eaed7cec7a62309c854ad968bcaea4326bea151.tar.gz bun-9eaed7cec7a62309c854ad968bcaea4326bea151.tar.zst bun-9eaed7cec7a62309c854ad968bcaea4326bea151.zip |
Fix missing `prototype` property on generated classes
Diffstat (limited to 'src')
-rw-r--r-- | src/bun.js/bindings/ZigGeneratedClasses.cpp | 1660 | ||||
-rw-r--r-- | src/bun.js/bindings/ZigGlobalObject.cpp | 2 | ||||
-rw-r--r-- | src/bun.js/bindings/generated_classes.zig | 996 | ||||
-rw-r--r-- | src/bun.js/scripts/generate-classes.ts | 1 | ||||
-rw-r--r-- | src/bun.js/webcore/response.classes.ts | 8 |
5 files changed, 1345 insertions, 1322 deletions
diff --git a/src/bun.js/bindings/ZigGeneratedClasses.cpp b/src/bun.js/bindings/ZigGeneratedClasses.cpp index 25f2f42e7..58e300890 100644 --- a/src/bun.js/bindings/ZigGeneratedClasses.cpp +++ b/src/bun.js/bindings/ZigGeneratedClasses.cpp @@ -2,7 +2,7 @@ // GENERATED CODE - DO NOT MODIFY BY HAND // Generated by make codegen #include "root.h" - + #include "ZigGlobalObject.h" #include <JavaScriptCore/DOMJITAbstractHeap.h> @@ -15,6 +15,9 @@ #include "JSDOMConvertBufferSource.h" #include "ZigGeneratedClasses.h" + + + namespace WebCore { using namespace JSC; @@ -27,22 +30,29 @@ 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, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(SHA1Prototype__byteLengthGetterWrap), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, - { "digest"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(SHA1Prototype__digestCallback), (intptr_t)(0) } }, - { "update"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(SHA1Prototype__updateCallback), (intptr_t)(0) } } -}; + + static const HashTableValue JSSHA1PrototypeTableValues[] = { +{ "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(SHA1Prototype__byteLengthGetterWrap), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } } , +{ "digest"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(SHA1Prototype__digestCallback), (intptr_t)(0) } } , +{ "update"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(SHA1Prototype__updateCallback), (intptr_t)(0) } } + }; + const ClassInfo JSSHA1Prototype::s_info = { "SHA1"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA1Prototype) }; + + JSC_DEFINE_CUSTOM_GETTER(jsSHA1Constructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); @@ -53,12 +63,14 @@ JSC_DEFINE_CUSTOM_GETTER(jsSHA1Constructor, (JSGlobalObject * lexicalGlobalObjec if (UNLIKELY(!prototype)) return throwVMTypeError(lexicalGlobalObject, throwScope); return JSValue::encode(globalObject->JSSHA1Constructor()); -} +} + + JSC_DEFINE_CUSTOM_GETTER(SHA1Prototype__byteLengthGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSSHA1* thisObject = jsCast<JSSHA1*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -66,11 +78,12 @@ JSC_DEFINE_CUSTOM_GETTER(SHA1Prototype__byteLengthGetterWrap, (JSGlobalObject * RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + JSC_DEFINE_HOST_FUNCTION(SHA1Prototype__digestCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - + JSSHA1* thisObject = jsDynamicCast<JSSHA1*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { @@ -79,14 +92,15 @@ JSC_DEFINE_HOST_FUNCTION(SHA1Prototype__digestCallback, (JSGlobalObject * lexica } JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - + return SHA1Prototype__digest(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + JSC_DEFINE_HOST_FUNCTION(SHA1Prototype__updateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - + JSSHA1* thisObject = jsDynamicCast<JSSHA1*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { @@ -95,10 +109,11 @@ JSC_DEFINE_HOST_FUNCTION(SHA1Prototype__updateCallback, (JSGlobalObject * lexica } JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - + return SHA1Prototype__update(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + void JSSHA1Prototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) { Base::finishCreation(vm); @@ -109,20 +124,21 @@ void JSSHA1Prototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObj extern "C" JSC_DECLARE_CUSTOM_GETTER(SHA1Class__getByteLengthStatic); extern "C" JSC_DECLARE_HOST_FUNCTION(SHA1Class__hash); -static const HashTableValue JSSHA1ConstructorTableValues[] = { - { "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(SHA1Class__getByteLengthStatic), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, - { "hash"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(SHA1Class__hash), (intptr_t)(2) } } -}; + static const HashTableValue JSSHA1ConstructorTableValues[] = { +{ "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(SHA1Class__getByteLengthStatic), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } } , +{ "hash"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(SHA1Class__hash), (intptr_t)(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::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSSHA1Prototype* prototype) -{ +JSSHA1Constructor* JSSHA1Constructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSSHA1Prototype* prototype) { JSSHA1Constructor* ptr = new (NotNull, JSC::allocateCell<JSSHA1Constructor>(vm)) JSSHA1Constructor(vm, structure, construct); ptr->finishCreation(vm, globalObject, prototype); return ptr; @@ -130,28 +146,30 @@ JSSHA1Constructor* JSSHA1Constructor::create(JSC::VM& vm, JSC::JSGlobalObject* g JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSSHA1Constructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) { - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); - JSC::VM& vm = globalObject->vm(); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + JSC::VM &vm = globalObject->vm(); JSObject* newTarget = asObject(callFrame->newTarget()); auto* constructor = globalObject->JSSHA1Constructor(); Structure* structure = globalObject->JSSHA1Structure(); if (constructor != newTarget) { - auto scope = DECLARE_THROW_SCOPE(vm); + auto scope = DECLARE_THROW_SCOPE(vm); - auto* functionGlobalObject = reinterpret_cast<Zig::GlobalObject*>( - // ShadowRealm functions belong to a different global object. - getFunctionRealm(globalObject, newTarget)); - RETURN_IF_EXCEPTION(scope, {}); - structure = InternalFunction::createSubclassStructure( - globalObject, - newTarget, - functionGlobalObject->JSSHA1Structure()); + auto* functionGlobalObject = reinterpret_cast<Zig::GlobalObject*>( + // ShadowRealm functions belong to a different global object. + getFunctionRealm(globalObject, newTarget) + ); + RETURN_IF_EXCEPTION(scope, {}); + structure = InternalFunction::createSubclassStructure( + globalObject, + newTarget, + functionGlobalObject->JSSHA1Structure() + ); } void* ptr = SHA1Class__construct(globalObject, callFrame); if (UNLIKELY(!ptr)) { - return JSValue::encode(JSC::jsUndefined()); + return JSValue::encode(JSC::jsUndefined()); } JSSHA1* instance = JSSHA1::create(vm, globalObject, structure, ptr); @@ -159,23 +177,23 @@ JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSSHA1Constructor::construct(JSC::J return JSValue::encode(instance); } -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); +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); } 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()); + +extern "C" EncodedJSValue SHA1__getConstructor(Zig::GlobalObject* globalObject) { + return JSValue::encode(globalObject->JSSHA1Constructor()); } JSSHA1::~JSSHA1() @@ -188,7 +206,7 @@ void JSSHA1::destroy(JSCell* cell) { static_cast<JSSHA1*>(cell)->JSSHA1::~JSSHA1(); } - + const ClassInfo JSSHA1::s_info = { "SHA1"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA1) }; void JSSHA1::finishCreation(VM& vm) @@ -197,32 +215,31 @@ void JSSHA1::finishCreation(VM& vm) ASSERT(inherits(info())); } -JSSHA1* JSSHA1::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSSHA1* ptr = new (NotNull, JSC::allocateCell<JSSHA1>(vm)) JSSHA1(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; +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) -{ - JSSHA1* object = JSC::jsDynamicCast<JSSHA1*>(JSValue::decode(value)); - if (!object) - return nullptr; - return object->wrapped(); +extern "C" void* SHA1__fromJS(JSC::EncodedJSValue value) { + JSSHA1* object = JSC::jsDynamicCast<JSSHA1*>(JSValue::decode(value)); + if (!object) + return nullptr; + + return object->wrapped(); } -extern "C" bool SHA1__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSSHA1* object = JSC::jsDynamicCast<JSSHA1*>(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; +extern "C" bool SHA1__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) { + JSSHA1* object = JSC::jsDynamicCast<JSSHA1*>(JSValue::decode(value)); + if (!object) + return false; + + object->m_ctx = ptr; + return true; } + extern "C" const size_t SHA1__ptrOffset = JSSHA1::offsetOfWrapped(); void JSSHA1::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) @@ -238,30 +255,36 @@ void JSSHA1::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) JSObject* JSSHA1::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) { return JSSHA1Prototype::create(vm, globalObject, JSSHA1Prototype::createStructure(vm, globalObject, globalObject->objectPrototype())); -} -extern "C" void* MD5Class__construct(JSC::JSGlobalObject*, JSC::CallFrame*); +}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, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(MD5Prototype__byteLengthGetterWrap), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, - { "digest"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(MD5Prototype__digestCallback), (intptr_t)(0) } }, - { "update"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(MD5Prototype__updateCallback), (intptr_t)(0) } } -}; + + static const HashTableValue JSMD5PrototypeTableValues[] = { +{ "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(MD5Prototype__byteLengthGetterWrap), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } } , +{ "digest"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(MD5Prototype__digestCallback), (intptr_t)(0) } } , +{ "update"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(MD5Prototype__updateCallback), (intptr_t)(0) } } + }; + const ClassInfo JSMD5Prototype::s_info = { "MD5"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSMD5Prototype) }; + + JSC_DEFINE_CUSTOM_GETTER(jsMD5Constructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); @@ -272,12 +295,14 @@ JSC_DEFINE_CUSTOM_GETTER(jsMD5Constructor, (JSGlobalObject * lexicalGlobalObject if (UNLIKELY(!prototype)) return throwVMTypeError(lexicalGlobalObject, throwScope); return JSValue::encode(globalObject->JSMD5Constructor()); -} +} + + JSC_DEFINE_CUSTOM_GETTER(MD5Prototype__byteLengthGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSMD5* thisObject = jsCast<JSMD5*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -285,11 +310,12 @@ JSC_DEFINE_CUSTOM_GETTER(MD5Prototype__byteLengthGetterWrap, (JSGlobalObject * l RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + JSC_DEFINE_HOST_FUNCTION(MD5Prototype__digestCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - + JSMD5* thisObject = jsDynamicCast<JSMD5*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { @@ -298,14 +324,15 @@ JSC_DEFINE_HOST_FUNCTION(MD5Prototype__digestCallback, (JSGlobalObject * lexical } JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - + return MD5Prototype__digest(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + JSC_DEFINE_HOST_FUNCTION(MD5Prototype__updateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - + JSMD5* thisObject = jsDynamicCast<JSMD5*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { @@ -314,10 +341,11 @@ JSC_DEFINE_HOST_FUNCTION(MD5Prototype__updateCallback, (JSGlobalObject * lexical } JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - + return MD5Prototype__update(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + void JSMD5Prototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) { Base::finishCreation(vm); @@ -328,20 +356,21 @@ void JSMD5Prototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObje extern "C" JSC_DECLARE_CUSTOM_GETTER(MD5Class__getByteLengthStatic); extern "C" JSC_DECLARE_HOST_FUNCTION(MD5Class__hash); -static const HashTableValue JSMD5ConstructorTableValues[] = { - { "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(MD5Class__getByteLengthStatic), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, - { "hash"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(MD5Class__hash), (intptr_t)(2) } } -}; + static const HashTableValue JSMD5ConstructorTableValues[] = { +{ "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(MD5Class__getByteLengthStatic), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } } , +{ "hash"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(MD5Class__hash), (intptr_t)(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())); } -JSMD5Constructor* JSMD5Constructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSMD5Prototype* prototype) -{ +JSMD5Constructor* JSMD5Constructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSMD5Prototype* prototype) { JSMD5Constructor* ptr = new (NotNull, JSC::allocateCell<JSMD5Constructor>(vm)) JSMD5Constructor(vm, structure, construct); ptr->finishCreation(vm, globalObject, prototype); return ptr; @@ -349,28 +378,30 @@ JSMD5Constructor* JSMD5Constructor::create(JSC::VM& vm, JSC::JSGlobalObject* glo JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSMD5Constructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) { - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); - JSC::VM& vm = globalObject->vm(); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + JSC::VM &vm = globalObject->vm(); JSObject* newTarget = asObject(callFrame->newTarget()); auto* constructor = globalObject->JSMD5Constructor(); Structure* structure = globalObject->JSMD5Structure(); if (constructor != newTarget) { - auto scope = DECLARE_THROW_SCOPE(vm); + auto scope = DECLARE_THROW_SCOPE(vm); - auto* functionGlobalObject = reinterpret_cast<Zig::GlobalObject*>( - // ShadowRealm functions belong to a different global object. - getFunctionRealm(globalObject, newTarget)); - RETURN_IF_EXCEPTION(scope, {}); - structure = InternalFunction::createSubclassStructure( - globalObject, - newTarget, - functionGlobalObject->JSMD5Structure()); + auto* functionGlobalObject = reinterpret_cast<Zig::GlobalObject*>( + // ShadowRealm functions belong to a different global object. + getFunctionRealm(globalObject, newTarget) + ); + RETURN_IF_EXCEPTION(scope, {}); + structure = InternalFunction::createSubclassStructure( + globalObject, + newTarget, + functionGlobalObject->JSMD5Structure() + ); } void* ptr = MD5Class__construct(globalObject, callFrame); if (UNLIKELY(!ptr)) { - return JSValue::encode(JSC::jsUndefined()); + return JSValue::encode(JSC::jsUndefined()); } JSMD5* instance = JSMD5::create(vm, globalObject, structure, ptr); @@ -378,23 +409,23 @@ JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSMD5Constructor::construct(JSC::JS return JSValue::encode(instance); } -extern "C" EncodedJSValue MD5__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSMD5Structure(); - JSMD5* instance = JSMD5::create(vm, globalObject, structure, ptr); - return JSValue::encode(instance); +extern "C" EncodedJSValue MD5__create(Zig::GlobalObject* globalObject, void* ptr) { + auto &vm = globalObject->vm(); + JSC::Structure* structure = globalObject->JSMD5Structure(); + JSMD5* instance = JSMD5::create(vm, globalObject, structure, ptr); + return JSValue::encode(instance); } void JSMD5Constructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSMD5Prototype* prototype) { + } const ClassInfo JSMD5Constructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSMD5Constructor) }; -extern "C" EncodedJSValue MD5__getConstructor(Zig::GlobalObject* globalObject) -{ - return JSValue::encode(globalObject->JSMD5Constructor()); + +extern "C" EncodedJSValue MD5__getConstructor(Zig::GlobalObject* globalObject) { + return JSValue::encode(globalObject->JSMD5Constructor()); } JSMD5::~JSMD5() @@ -407,7 +438,7 @@ void JSMD5::destroy(JSCell* cell) { static_cast<JSMD5*>(cell)->JSMD5::~JSMD5(); } - + const ClassInfo JSMD5::s_info = { "MD5"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSMD5) }; void JSMD5::finishCreation(VM& vm) @@ -416,32 +447,31 @@ void JSMD5::finishCreation(VM& vm) ASSERT(inherits(info())); } -JSMD5* JSMD5::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSMD5* ptr = new (NotNull, JSC::allocateCell<JSMD5>(vm)) JSMD5(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; +JSMD5* JSMD5::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) { + JSMD5* ptr = new (NotNull, JSC::allocateCell<JSMD5>(vm)) JSMD5(vm, structure, ctx); + ptr->finishCreation(vm); + return ptr; } -extern "C" void* MD5__fromJS(JSC::EncodedJSValue value) -{ - JSMD5* object = JSC::jsDynamicCast<JSMD5*>(JSValue::decode(value)); - if (!object) - return nullptr; - return object->wrapped(); +extern "C" void* MD5__fromJS(JSC::EncodedJSValue value) { + JSMD5* object = JSC::jsDynamicCast<JSMD5*>(JSValue::decode(value)); + if (!object) + return nullptr; + + return object->wrapped(); } -extern "C" bool MD5__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSMD5* object = JSC::jsDynamicCast<JSMD5*>(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; +extern "C" bool MD5__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) { + JSMD5* object = JSC::jsDynamicCast<JSMD5*>(JSValue::decode(value)); + if (!object) + return false; + + object->m_ctx = ptr; + return true; } + extern "C" const size_t MD5__ptrOffset = JSMD5::offsetOfWrapped(); void JSMD5::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) @@ -457,30 +487,36 @@ void JSMD5::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) JSObject* JSMD5::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) { return JSMD5Prototype::create(vm, globalObject, JSMD5Prototype::createStructure(vm, globalObject, globalObject->objectPrototype())); -} -extern "C" void* MD4Class__construct(JSC::JSGlobalObject*, JSC::CallFrame*); +}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, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(MD4Prototype__byteLengthGetterWrap), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, - { "digest"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(MD4Prototype__digestCallback), (intptr_t)(0) } }, - { "update"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(MD4Prototype__updateCallback), (intptr_t)(0) } } -}; + + static const HashTableValue JSMD4PrototypeTableValues[] = { +{ "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(MD4Prototype__byteLengthGetterWrap), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } } , +{ "digest"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(MD4Prototype__digestCallback), (intptr_t)(0) } } , +{ "update"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(MD4Prototype__updateCallback), (intptr_t)(0) } } + }; + const ClassInfo JSMD4Prototype::s_info = { "MD4"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSMD4Prototype) }; + + JSC_DEFINE_CUSTOM_GETTER(jsMD4Constructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); @@ -491,12 +527,14 @@ JSC_DEFINE_CUSTOM_GETTER(jsMD4Constructor, (JSGlobalObject * lexicalGlobalObject if (UNLIKELY(!prototype)) return throwVMTypeError(lexicalGlobalObject, throwScope); return JSValue::encode(globalObject->JSMD4Constructor()); -} +} + + JSC_DEFINE_CUSTOM_GETTER(MD4Prototype__byteLengthGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSMD4* thisObject = jsCast<JSMD4*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -504,11 +542,12 @@ JSC_DEFINE_CUSTOM_GETTER(MD4Prototype__byteLengthGetterWrap, (JSGlobalObject * l RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + JSC_DEFINE_HOST_FUNCTION(MD4Prototype__digestCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - + JSMD4* thisObject = jsDynamicCast<JSMD4*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { @@ -517,14 +556,15 @@ JSC_DEFINE_HOST_FUNCTION(MD4Prototype__digestCallback, (JSGlobalObject * lexical } JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - + return MD4Prototype__digest(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + JSC_DEFINE_HOST_FUNCTION(MD4Prototype__updateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - + JSMD4* thisObject = jsDynamicCast<JSMD4*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { @@ -533,10 +573,11 @@ JSC_DEFINE_HOST_FUNCTION(MD4Prototype__updateCallback, (JSGlobalObject * lexical } JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - + return MD4Prototype__update(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + void JSMD4Prototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) { Base::finishCreation(vm); @@ -547,20 +588,21 @@ void JSMD4Prototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObje extern "C" JSC_DECLARE_CUSTOM_GETTER(MD4Class__getByteLengthStatic); extern "C" JSC_DECLARE_HOST_FUNCTION(MD4Class__hash); -static const HashTableValue JSMD4ConstructorTableValues[] = { - { "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(MD4Class__getByteLengthStatic), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, - { "hash"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(MD4Class__hash), (intptr_t)(2) } } -}; + static const HashTableValue JSMD4ConstructorTableValues[] = { +{ "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(MD4Class__getByteLengthStatic), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } } , +{ "hash"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(MD4Class__hash), (intptr_t)(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())); } -JSMD4Constructor* JSMD4Constructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSMD4Prototype* prototype) -{ +JSMD4Constructor* JSMD4Constructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSMD4Prototype* prototype) { JSMD4Constructor* ptr = new (NotNull, JSC::allocateCell<JSMD4Constructor>(vm)) JSMD4Constructor(vm, structure, construct); ptr->finishCreation(vm, globalObject, prototype); return ptr; @@ -568,28 +610,30 @@ JSMD4Constructor* JSMD4Constructor::create(JSC::VM& vm, JSC::JSGlobalObject* glo JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSMD4Constructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) { - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); - JSC::VM& vm = globalObject->vm(); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + JSC::VM &vm = globalObject->vm(); JSObject* newTarget = asObject(callFrame->newTarget()); auto* constructor = globalObject->JSMD4Constructor(); Structure* structure = globalObject->JSMD4Structure(); if (constructor != newTarget) { - auto scope = DECLARE_THROW_SCOPE(vm); + auto scope = DECLARE_THROW_SCOPE(vm); - auto* functionGlobalObject = reinterpret_cast<Zig::GlobalObject*>( - // ShadowRealm functions belong to a different global object. - getFunctionRealm(globalObject, newTarget)); - RETURN_IF_EXCEPTION(scope, {}); - structure = InternalFunction::createSubclassStructure( - globalObject, - newTarget, - functionGlobalObject->JSMD4Structure()); + auto* functionGlobalObject = reinterpret_cast<Zig::GlobalObject*>( + // ShadowRealm functions belong to a different global object. + getFunctionRealm(globalObject, newTarget) + ); + RETURN_IF_EXCEPTION(scope, {}); + structure = InternalFunction::createSubclassStructure( + globalObject, + newTarget, + functionGlobalObject->JSMD4Structure() + ); } void* ptr = MD4Class__construct(globalObject, callFrame); if (UNLIKELY(!ptr)) { - return JSValue::encode(JSC::jsUndefined()); + return JSValue::encode(JSC::jsUndefined()); } JSMD4* instance = JSMD4::create(vm, globalObject, structure, ptr); @@ -597,23 +641,23 @@ JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSMD4Constructor::construct(JSC::JS return JSValue::encode(instance); } -extern "C" EncodedJSValue MD4__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSMD4Structure(); - JSMD4* instance = JSMD4::create(vm, globalObject, structure, ptr); - return JSValue::encode(instance); +extern "C" EncodedJSValue MD4__create(Zig::GlobalObject* globalObject, void* ptr) { + auto &vm = globalObject->vm(); + JSC::Structure* structure = globalObject->JSMD4Structure(); + JSMD4* instance = JSMD4::create(vm, globalObject, structure, ptr); + return JSValue::encode(instance); } void JSMD4Constructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSMD4Prototype* prototype) { + } const ClassInfo JSMD4Constructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSMD4Constructor) }; -extern "C" EncodedJSValue MD4__getConstructor(Zig::GlobalObject* globalObject) -{ - return JSValue::encode(globalObject->JSMD4Constructor()); + +extern "C" EncodedJSValue MD4__getConstructor(Zig::GlobalObject* globalObject) { + return JSValue::encode(globalObject->JSMD4Constructor()); } JSMD4::~JSMD4() @@ -626,7 +670,7 @@ void JSMD4::destroy(JSCell* cell) { static_cast<JSMD4*>(cell)->JSMD4::~JSMD4(); } - + const ClassInfo JSMD4::s_info = { "MD4"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSMD4) }; void JSMD4::finishCreation(VM& vm) @@ -635,32 +679,31 @@ void JSMD4::finishCreation(VM& vm) ASSERT(inherits(info())); } -JSMD4* JSMD4::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSMD4* ptr = new (NotNull, JSC::allocateCell<JSMD4>(vm)) JSMD4(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; +JSMD4* JSMD4::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) { + JSMD4* ptr = new (NotNull, JSC::allocateCell<JSMD4>(vm)) JSMD4(vm, structure, ctx); + ptr->finishCreation(vm); + return ptr; } -extern "C" void* MD4__fromJS(JSC::EncodedJSValue value) -{ - JSMD4* object = JSC::jsDynamicCast<JSMD4*>(JSValue::decode(value)); - if (!object) - return nullptr; - return object->wrapped(); +extern "C" void* MD4__fromJS(JSC::EncodedJSValue value) { + JSMD4* object = JSC::jsDynamicCast<JSMD4*>(JSValue::decode(value)); + if (!object) + return nullptr; + + return object->wrapped(); } -extern "C" bool MD4__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSMD4* object = JSC::jsDynamicCast<JSMD4*>(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; +extern "C" bool MD4__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) { + JSMD4* object = JSC::jsDynamicCast<JSMD4*>(JSValue::decode(value)); + if (!object) + return false; + + object->m_ctx = ptr; + return true; } + extern "C" const size_t MD4__ptrOffset = JSMD4::offsetOfWrapped(); void JSMD4::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) @@ -676,30 +719,36 @@ void JSMD4::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) JSObject* JSMD4::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) { return JSMD4Prototype::create(vm, globalObject, JSMD4Prototype::createStructure(vm, globalObject, globalObject->objectPrototype())); -} -extern "C" void* SHA224Class__construct(JSC::JSGlobalObject*, JSC::CallFrame*); +}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, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(SHA224Prototype__byteLengthGetterWrap), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, - { "digest"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(SHA224Prototype__digestCallback), (intptr_t)(0) } }, - { "update"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(SHA224Prototype__updateCallback), (intptr_t)(0) } } -}; + + static const HashTableValue JSSHA224PrototypeTableValues[] = { +{ "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(SHA224Prototype__byteLengthGetterWrap), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } } , +{ "digest"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(SHA224Prototype__digestCallback), (intptr_t)(0) } } , +{ "update"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(SHA224Prototype__updateCallback), (intptr_t)(0) } } + }; + 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); @@ -710,12 +759,14 @@ JSC_DEFINE_CUSTOM_GETTER(jsSHA224Constructor, (JSGlobalObject * lexicalGlobalObj if (UNLIKELY(!prototype)) return throwVMTypeError(lexicalGlobalObject, throwScope); return JSValue::encode(globalObject->JSSHA224Constructor()); -} +} + + JSC_DEFINE_CUSTOM_GETTER(SHA224Prototype__byteLengthGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSSHA224* thisObject = jsCast<JSSHA224*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -723,11 +774,12 @@ JSC_DEFINE_CUSTOM_GETTER(SHA224Prototype__byteLengthGetterWrap, (JSGlobalObject RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + JSC_DEFINE_HOST_FUNCTION(SHA224Prototype__digestCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - + JSSHA224* thisObject = jsDynamicCast<JSSHA224*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { @@ -736,14 +788,15 @@ JSC_DEFINE_HOST_FUNCTION(SHA224Prototype__digestCallback, (JSGlobalObject * lexi } JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - + return SHA224Prototype__digest(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + JSC_DEFINE_HOST_FUNCTION(SHA224Prototype__updateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - + JSSHA224* thisObject = jsDynamicCast<JSSHA224*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { @@ -752,10 +805,11 @@ JSC_DEFINE_HOST_FUNCTION(SHA224Prototype__updateCallback, (JSGlobalObject * lexi } JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - + return SHA224Prototype__update(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + void JSSHA224Prototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) { Base::finishCreation(vm); @@ -766,20 +820,21 @@ void JSSHA224Prototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalO extern "C" JSC_DECLARE_CUSTOM_GETTER(SHA224Class__getByteLengthStatic); extern "C" JSC_DECLARE_HOST_FUNCTION(SHA224Class__hash); -static const HashTableValue JSSHA224ConstructorTableValues[] = { - { "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(SHA224Class__getByteLengthStatic), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, - { "hash"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(SHA224Class__hash), (intptr_t)(2) } } -}; + static const HashTableValue JSSHA224ConstructorTableValues[] = { +{ "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(SHA224Class__getByteLengthStatic), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } } , +{ "hash"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(SHA224Class__hash), (intptr_t)(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::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSSHA224Prototype* prototype) -{ +JSSHA224Constructor* JSSHA224Constructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSSHA224Prototype* prototype) { JSSHA224Constructor* ptr = new (NotNull, JSC::allocateCell<JSSHA224Constructor>(vm)) JSSHA224Constructor(vm, structure, construct); ptr->finishCreation(vm, globalObject, prototype); return ptr; @@ -787,28 +842,30 @@ JSSHA224Constructor* JSSHA224Constructor::create(JSC::VM& vm, JSC::JSGlobalObjec JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSSHA224Constructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) { - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); - JSC::VM& vm = globalObject->vm(); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + JSC::VM &vm = globalObject->vm(); JSObject* newTarget = asObject(callFrame->newTarget()); auto* constructor = globalObject->JSSHA224Constructor(); Structure* structure = globalObject->JSSHA224Structure(); if (constructor != newTarget) { - auto scope = DECLARE_THROW_SCOPE(vm); + auto scope = DECLARE_THROW_SCOPE(vm); - auto* functionGlobalObject = reinterpret_cast<Zig::GlobalObject*>( - // ShadowRealm functions belong to a different global object. - getFunctionRealm(globalObject, newTarget)); - RETURN_IF_EXCEPTION(scope, {}); - structure = InternalFunction::createSubclassStructure( - globalObject, - newTarget, - functionGlobalObject->JSSHA224Structure()); + auto* functionGlobalObject = reinterpret_cast<Zig::GlobalObject*>( + // ShadowRealm functions belong to a different global object. + getFunctionRealm(globalObject, newTarget) + ); + RETURN_IF_EXCEPTION(scope, {}); + structure = InternalFunction::createSubclassStructure( + globalObject, + newTarget, + functionGlobalObject->JSSHA224Structure() + ); } void* ptr = SHA224Class__construct(globalObject, callFrame); if (UNLIKELY(!ptr)) { - return JSValue::encode(JSC::jsUndefined()); + return JSValue::encode(JSC::jsUndefined()); } JSSHA224* instance = JSSHA224::create(vm, globalObject, structure, ptr); @@ -816,23 +873,23 @@ JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSSHA224Constructor::construct(JSC: return JSValue::encode(instance); } -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); +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); } 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()); + +extern "C" EncodedJSValue SHA224__getConstructor(Zig::GlobalObject* globalObject) { + return JSValue::encode(globalObject->JSSHA224Constructor()); } JSSHA224::~JSSHA224() @@ -845,7 +902,7 @@ void JSSHA224::destroy(JSCell* cell) { static_cast<JSSHA224*>(cell)->JSSHA224::~JSSHA224(); } - + const ClassInfo JSSHA224::s_info = { "SHA224"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA224) }; void JSSHA224::finishCreation(VM& vm) @@ -854,32 +911,31 @@ void JSSHA224::finishCreation(VM& vm) ASSERT(inherits(info())); } -JSSHA224* JSSHA224::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSSHA224* ptr = new (NotNull, JSC::allocateCell<JSSHA224>(vm)) JSSHA224(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; +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) -{ - JSSHA224* object = JSC::jsDynamicCast<JSSHA224*>(JSValue::decode(value)); - if (!object) - return nullptr; - return object->wrapped(); +extern "C" void* SHA224__fromJS(JSC::EncodedJSValue value) { + JSSHA224* object = JSC::jsDynamicCast<JSSHA224*>(JSValue::decode(value)); + if (!object) + return nullptr; + + return object->wrapped(); } -extern "C" bool SHA224__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSSHA224* object = JSC::jsDynamicCast<JSSHA224*>(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; +extern "C" bool SHA224__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) { + JSSHA224* object = JSC::jsDynamicCast<JSSHA224*>(JSValue::decode(value)); + if (!object) + return false; + + object->m_ctx = ptr; + return true; } + extern "C" const size_t SHA224__ptrOffset = JSSHA224::offsetOfWrapped(); void JSSHA224::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) @@ -895,30 +951,36 @@ void JSSHA224::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) JSObject* JSSHA224::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) { return JSSHA224Prototype::create(vm, globalObject, JSSHA224Prototype::createStructure(vm, globalObject, globalObject->objectPrototype())); -} -extern "C" void* SHA512Class__construct(JSC::JSGlobalObject*, JSC::CallFrame*); +}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, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(SHA512Prototype__byteLengthGetterWrap), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, - { "digest"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(SHA512Prototype__digestCallback), (intptr_t)(0) } }, - { "update"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(SHA512Prototype__updateCallback), (intptr_t)(0) } } -}; + + static const HashTableValue JSSHA512PrototypeTableValues[] = { +{ "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(SHA512Prototype__byteLengthGetterWrap), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } } , +{ "digest"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(SHA512Prototype__digestCallback), (intptr_t)(0) } } , +{ "update"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(SHA512Prototype__updateCallback), (intptr_t)(0) } } + }; + 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); @@ -929,12 +991,14 @@ JSC_DEFINE_CUSTOM_GETTER(jsSHA512Constructor, (JSGlobalObject * lexicalGlobalObj if (UNLIKELY(!prototype)) return throwVMTypeError(lexicalGlobalObject, throwScope); return JSValue::encode(globalObject->JSSHA512Constructor()); -} +} + + JSC_DEFINE_CUSTOM_GETTER(SHA512Prototype__byteLengthGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSSHA512* thisObject = jsCast<JSSHA512*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -942,11 +1006,12 @@ JSC_DEFINE_CUSTOM_GETTER(SHA512Prototype__byteLengthGetterWrap, (JSGlobalObject RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + JSC_DEFINE_HOST_FUNCTION(SHA512Prototype__digestCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - + JSSHA512* thisObject = jsDynamicCast<JSSHA512*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { @@ -955,14 +1020,15 @@ JSC_DEFINE_HOST_FUNCTION(SHA512Prototype__digestCallback, (JSGlobalObject * lexi } JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - + return SHA512Prototype__digest(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + JSC_DEFINE_HOST_FUNCTION(SHA512Prototype__updateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - + JSSHA512* thisObject = jsDynamicCast<JSSHA512*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { @@ -971,10 +1037,11 @@ JSC_DEFINE_HOST_FUNCTION(SHA512Prototype__updateCallback, (JSGlobalObject * lexi } JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - + return SHA512Prototype__update(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + void JSSHA512Prototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) { Base::finishCreation(vm); @@ -985,20 +1052,21 @@ void JSSHA512Prototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalO extern "C" JSC_DECLARE_CUSTOM_GETTER(SHA512Class__getByteLengthStatic); extern "C" JSC_DECLARE_HOST_FUNCTION(SHA512Class__hash); -static const HashTableValue JSSHA512ConstructorTableValues[] = { - { "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(SHA512Class__getByteLengthStatic), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, - { "hash"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(SHA512Class__hash), (intptr_t)(2) } } -}; + static const HashTableValue JSSHA512ConstructorTableValues[] = { +{ "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(SHA512Class__getByteLengthStatic), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } } , +{ "hash"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(SHA512Class__hash), (intptr_t)(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())); } -JSSHA512Constructor* JSSHA512Constructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSSHA512Prototype* prototype) -{ +JSSHA512Constructor* JSSHA512Constructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSSHA512Prototype* prototype) { JSSHA512Constructor* ptr = new (NotNull, JSC::allocateCell<JSSHA512Constructor>(vm)) JSSHA512Constructor(vm, structure, construct); ptr->finishCreation(vm, globalObject, prototype); return ptr; @@ -1006,28 +1074,30 @@ JSSHA512Constructor* JSSHA512Constructor::create(JSC::VM& vm, JSC::JSGlobalObjec JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSSHA512Constructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) { - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); - JSC::VM& vm = globalObject->vm(); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + JSC::VM &vm = globalObject->vm(); JSObject* newTarget = asObject(callFrame->newTarget()); auto* constructor = globalObject->JSSHA512Constructor(); Structure* structure = globalObject->JSSHA512Structure(); if (constructor != newTarget) { - auto scope = DECLARE_THROW_SCOPE(vm); + auto scope = DECLARE_THROW_SCOPE(vm); - auto* functionGlobalObject = reinterpret_cast<Zig::GlobalObject*>( - // ShadowRealm functions belong to a different global object. - getFunctionRealm(globalObject, newTarget)); - RETURN_IF_EXCEPTION(scope, {}); - structure = InternalFunction::createSubclassStructure( - globalObject, - newTarget, - functionGlobalObject->JSSHA512Structure()); + auto* functionGlobalObject = reinterpret_cast<Zig::GlobalObject*>( + // ShadowRealm functions belong to a different global object. + getFunctionRealm(globalObject, newTarget) + ); + RETURN_IF_EXCEPTION(scope, {}); + structure = InternalFunction::createSubclassStructure( + globalObject, + newTarget, + functionGlobalObject->JSSHA512Structure() + ); } void* ptr = SHA512Class__construct(globalObject, callFrame); if (UNLIKELY(!ptr)) { - return JSValue::encode(JSC::jsUndefined()); + return JSValue::encode(JSC::jsUndefined()); } JSSHA512* instance = JSSHA512::create(vm, globalObject, structure, ptr); @@ -1035,23 +1105,23 @@ JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSSHA512Constructor::construct(JSC: return JSValue::encode(instance); } -extern "C" EncodedJSValue SHA512__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSSHA512Structure(); - JSSHA512* instance = JSSHA512::create(vm, globalObject, structure, ptr); - return JSValue::encode(instance); +extern "C" EncodedJSValue SHA512__create(Zig::GlobalObject* globalObject, void* ptr) { + auto &vm = globalObject->vm(); + JSC::Structure* structure = globalObject->JSSHA512Structure(); + JSSHA512* instance = JSSHA512::create(vm, globalObject, structure, ptr); + return JSValue::encode(instance); } void JSSHA512Constructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSSHA512Prototype* prototype) { + } const ClassInfo JSSHA512Constructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA512Constructor) }; -extern "C" EncodedJSValue SHA512__getConstructor(Zig::GlobalObject* globalObject) -{ - return JSValue::encode(globalObject->JSSHA512Constructor()); + +extern "C" EncodedJSValue SHA512__getConstructor(Zig::GlobalObject* globalObject) { + return JSValue::encode(globalObject->JSSHA512Constructor()); } JSSHA512::~JSSHA512() @@ -1064,7 +1134,7 @@ void JSSHA512::destroy(JSCell* cell) { static_cast<JSSHA512*>(cell)->JSSHA512::~JSSHA512(); } - + const ClassInfo JSSHA512::s_info = { "SHA512"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA512) }; void JSSHA512::finishCreation(VM& vm) @@ -1073,32 +1143,31 @@ void JSSHA512::finishCreation(VM& vm) ASSERT(inherits(info())); } -JSSHA512* JSSHA512::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSSHA512* ptr = new (NotNull, JSC::allocateCell<JSSHA512>(vm)) JSSHA512(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; +JSSHA512* JSSHA512::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) { + JSSHA512* ptr = new (NotNull, JSC::allocateCell<JSSHA512>(vm)) JSSHA512(vm, structure, ctx); + ptr->finishCreation(vm); + return ptr; } -extern "C" void* SHA512__fromJS(JSC::EncodedJSValue value) -{ - JSSHA512* object = JSC::jsDynamicCast<JSSHA512*>(JSValue::decode(value)); - if (!object) - return nullptr; - return object->wrapped(); +extern "C" void* SHA512__fromJS(JSC::EncodedJSValue value) { + JSSHA512* object = JSC::jsDynamicCast<JSSHA512*>(JSValue::decode(value)); + if (!object) + return nullptr; + + return object->wrapped(); } -extern "C" bool SHA512__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSSHA512* object = JSC::jsDynamicCast<JSSHA512*>(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; +extern "C" bool SHA512__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) { + JSSHA512* object = JSC::jsDynamicCast<JSSHA512*>(JSValue::decode(value)); + if (!object) + return false; + + object->m_ctx = ptr; + return true; } + extern "C" const size_t SHA512__ptrOffset = JSSHA512::offsetOfWrapped(); void JSSHA512::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) @@ -1114,30 +1183,36 @@ void JSSHA512::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) JSObject* JSSHA512::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) { return JSSHA512Prototype::create(vm, globalObject, JSSHA512Prototype::createStructure(vm, globalObject, globalObject->objectPrototype())); -} -extern "C" void* SHA384Class__construct(JSC::JSGlobalObject*, JSC::CallFrame*); +}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, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(SHA384Prototype__byteLengthGetterWrap), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, - { "digest"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(SHA384Prototype__digestCallback), (intptr_t)(0) } }, - { "update"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(SHA384Prototype__updateCallback), (intptr_t)(0) } } -}; + + static const HashTableValue JSSHA384PrototypeTableValues[] = { +{ "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(SHA384Prototype__byteLengthGetterWrap), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } } , +{ "digest"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(SHA384Prototype__digestCallback), (intptr_t)(0) } } , +{ "update"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(SHA384Prototype__updateCallback), (intptr_t)(0) } } + }; + const ClassInfo JSSHA384Prototype::s_info = { "SHA384"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA384Prototype) }; + + JSC_DEFINE_CUSTOM_GETTER(jsSHA384Constructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); @@ -1148,12 +1223,14 @@ JSC_DEFINE_CUSTOM_GETTER(jsSHA384Constructor, (JSGlobalObject * lexicalGlobalObj if (UNLIKELY(!prototype)) return throwVMTypeError(lexicalGlobalObject, throwScope); return JSValue::encode(globalObject->JSSHA384Constructor()); -} +} + + JSC_DEFINE_CUSTOM_GETTER(SHA384Prototype__byteLengthGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSSHA384* thisObject = jsCast<JSSHA384*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -1161,11 +1238,12 @@ JSC_DEFINE_CUSTOM_GETTER(SHA384Prototype__byteLengthGetterWrap, (JSGlobalObject RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + JSC_DEFINE_HOST_FUNCTION(SHA384Prototype__digestCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - + JSSHA384* thisObject = jsDynamicCast<JSSHA384*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { @@ -1174,14 +1252,15 @@ JSC_DEFINE_HOST_FUNCTION(SHA384Prototype__digestCallback, (JSGlobalObject * lexi } JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - + return SHA384Prototype__digest(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + JSC_DEFINE_HOST_FUNCTION(SHA384Prototype__updateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - + JSSHA384* thisObject = jsDynamicCast<JSSHA384*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { @@ -1190,10 +1269,11 @@ JSC_DEFINE_HOST_FUNCTION(SHA384Prototype__updateCallback, (JSGlobalObject * lexi } JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - + return SHA384Prototype__update(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + void JSSHA384Prototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) { Base::finishCreation(vm); @@ -1204,20 +1284,21 @@ void JSSHA384Prototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalO extern "C" JSC_DECLARE_CUSTOM_GETTER(SHA384Class__getByteLengthStatic); extern "C" JSC_DECLARE_HOST_FUNCTION(SHA384Class__hash); -static const HashTableValue JSSHA384ConstructorTableValues[] = { - { "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(SHA384Class__getByteLengthStatic), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, - { "hash"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(SHA384Class__hash), (intptr_t)(2) } } -}; + static const HashTableValue JSSHA384ConstructorTableValues[] = { +{ "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(SHA384Class__getByteLengthStatic), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } } , +{ "hash"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(SHA384Class__hash), (intptr_t)(2) } } + }; + 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())); } -JSSHA384Constructor* JSSHA384Constructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSSHA384Prototype* prototype) -{ +JSSHA384Constructor* JSSHA384Constructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSSHA384Prototype* prototype) { JSSHA384Constructor* ptr = new (NotNull, JSC::allocateCell<JSSHA384Constructor>(vm)) JSSHA384Constructor(vm, structure, construct); ptr->finishCreation(vm, globalObject, prototype); return ptr; @@ -1225,28 +1306,30 @@ JSSHA384Constructor* JSSHA384Constructor::create(JSC::VM& vm, JSC::JSGlobalObjec JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSSHA384Constructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) { - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); - JSC::VM& vm = globalObject->vm(); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + JSC::VM &vm = globalObject->vm(); JSObject* newTarget = asObject(callFrame->newTarget()); auto* constructor = globalObject->JSSHA384Constructor(); Structure* structure = globalObject->JSSHA384Structure(); if (constructor != newTarget) { - auto scope = DECLARE_THROW_SCOPE(vm); + auto scope = DECLARE_THROW_SCOPE(vm); - auto* functionGlobalObject = reinterpret_cast<Zig::GlobalObject*>( - // ShadowRealm functions belong to a different global object. - getFunctionRealm(globalObject, newTarget)); - RETURN_IF_EXCEPTION(scope, {}); - structure = InternalFunction::createSubclassStructure( - globalObject, - newTarget, - functionGlobalObject->JSSHA384Structure()); + auto* functionGlobalObject = reinterpret_cast<Zig::GlobalObject*>( + // ShadowRealm functions belong to a different global object. + getFunctionRealm(globalObject, newTarget) + ); + RETURN_IF_EXCEPTION(scope, {}); + structure = InternalFunction::createSubclassStructure( + globalObject, + newTarget, + functionGlobalObject->JSSHA384Structure() + ); } void* ptr = SHA384Class__construct(globalObject, callFrame); if (UNLIKELY(!ptr)) { - return JSValue::encode(JSC::jsUndefined()); + return JSValue::encode(JSC::jsUndefined()); } JSSHA384* instance = JSSHA384::create(vm, globalObject, structure, ptr); @@ -1254,23 +1337,23 @@ JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSSHA384Constructor::construct(JSC: return JSValue::encode(instance); } -extern "C" EncodedJSValue SHA384__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSSHA384Structure(); - JSSHA384* instance = JSSHA384::create(vm, globalObject, structure, ptr); - return JSValue::encode(instance); +extern "C" EncodedJSValue SHA384__create(Zig::GlobalObject* globalObject, void* ptr) { + auto &vm = globalObject->vm(); + JSC::Structure* structure = globalObject->JSSHA384Structure(); + JSSHA384* instance = JSSHA384::create(vm, globalObject, structure, ptr); + return JSValue::encode(instance); } void JSSHA384Constructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSSHA384Prototype* prototype) { + } const ClassInfo JSSHA384Constructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA384Constructor) }; -extern "C" EncodedJSValue SHA384__getConstructor(Zig::GlobalObject* globalObject) -{ - return JSValue::encode(globalObject->JSSHA384Constructor()); + +extern "C" EncodedJSValue SHA384__getConstructor(Zig::GlobalObject* globalObject) { + return JSValue::encode(globalObject->JSSHA384Constructor()); } JSSHA384::~JSSHA384() @@ -1283,7 +1366,7 @@ void JSSHA384::destroy(JSCell* cell) { static_cast<JSSHA384*>(cell)->JSSHA384::~JSSHA384(); } - + const ClassInfo JSSHA384::s_info = { "SHA384"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA384) }; void JSSHA384::finishCreation(VM& vm) @@ -1292,32 +1375,31 @@ void JSSHA384::finishCreation(VM& vm) ASSERT(inherits(info())); } -JSSHA384* JSSHA384::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSSHA384* ptr = new (NotNull, JSC::allocateCell<JSSHA384>(vm)) JSSHA384(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; +JSSHA384* JSSHA384::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) { + JSSHA384* ptr = new (NotNull, JSC::allocateCell<JSSHA384>(vm)) JSSHA384(vm, structure, ctx); + ptr->finishCreation(vm); + return ptr; } -extern "C" void* SHA384__fromJS(JSC::EncodedJSValue value) -{ - JSSHA384* object = JSC::jsDynamicCast<JSSHA384*>(JSValue::decode(value)); - if (!object) - return nullptr; - return object->wrapped(); +extern "C" void* SHA384__fromJS(JSC::EncodedJSValue value) { + JSSHA384* object = JSC::jsDynamicCast<JSSHA384*>(JSValue::decode(value)); + if (!object) + return nullptr; + + return object->wrapped(); } -extern "C" bool SHA384__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSSHA384* object = JSC::jsDynamicCast<JSSHA384*>(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; +extern "C" bool SHA384__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) { + JSSHA384* object = JSC::jsDynamicCast<JSSHA384*>(JSValue::decode(value)); + if (!object) + return false; + + object->m_ctx = ptr; + return true; } + extern "C" const size_t SHA384__ptrOffset = JSSHA384::offsetOfWrapped(); void JSSHA384::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) @@ -1333,30 +1415,36 @@ void JSSHA384::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) JSObject* JSSHA384::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) { return JSSHA384Prototype::create(vm, globalObject, JSSHA384Prototype::createStructure(vm, globalObject, globalObject->objectPrototype())); -} -extern "C" void* SHA256Class__construct(JSC::JSGlobalObject*, JSC::CallFrame*); +}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, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(SHA256Prototype__byteLengthGetterWrap), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, - { "digest"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(SHA256Prototype__digestCallback), (intptr_t)(0) } }, - { "update"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(SHA256Prototype__updateCallback), (intptr_t)(0) } } -}; + + static const HashTableValue JSSHA256PrototypeTableValues[] = { +{ "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(SHA256Prototype__byteLengthGetterWrap), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } } , +{ "digest"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(SHA256Prototype__digestCallback), (intptr_t)(0) } } , +{ "update"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(SHA256Prototype__updateCallback), (intptr_t)(0) } } + }; + 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); @@ -1367,12 +1455,14 @@ JSC_DEFINE_CUSTOM_GETTER(jsSHA256Constructor, (JSGlobalObject * lexicalGlobalObj if (UNLIKELY(!prototype)) return throwVMTypeError(lexicalGlobalObject, throwScope); return JSValue::encode(globalObject->JSSHA256Constructor()); -} +} + + JSC_DEFINE_CUSTOM_GETTER(SHA256Prototype__byteLengthGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSSHA256* thisObject = jsCast<JSSHA256*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -1380,11 +1470,12 @@ JSC_DEFINE_CUSTOM_GETTER(SHA256Prototype__byteLengthGetterWrap, (JSGlobalObject RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + JSC_DEFINE_HOST_FUNCTION(SHA256Prototype__digestCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - + JSSHA256* thisObject = jsDynamicCast<JSSHA256*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { @@ -1393,14 +1484,15 @@ JSC_DEFINE_HOST_FUNCTION(SHA256Prototype__digestCallback, (JSGlobalObject * lexi } JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - + return SHA256Prototype__digest(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + JSC_DEFINE_HOST_FUNCTION(SHA256Prototype__updateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - + JSSHA256* thisObject = jsDynamicCast<JSSHA256*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { @@ -1409,10 +1501,11 @@ JSC_DEFINE_HOST_FUNCTION(SHA256Prototype__updateCallback, (JSGlobalObject * lexi } 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); @@ -1423,20 +1516,21 @@ void JSSHA256Prototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalO extern "C" JSC_DECLARE_CUSTOM_GETTER(SHA256Class__getByteLengthStatic); extern "C" JSC_DECLARE_HOST_FUNCTION(SHA256Class__hash); -static const HashTableValue JSSHA256ConstructorTableValues[] = { - { "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(SHA256Class__getByteLengthStatic), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, - { "hash"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(SHA256Class__hash), (intptr_t)(2) } } -}; + static const HashTableValue JSSHA256ConstructorTableValues[] = { +{ "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(SHA256Class__getByteLengthStatic), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } } , +{ "hash"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(SHA256Class__hash), (intptr_t)(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())); } -JSSHA256Constructor* JSSHA256Constructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSSHA256Prototype* prototype) -{ +JSSHA256Constructor* JSSHA256Constructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSSHA256Prototype* prototype) { JSSHA256Constructor* ptr = new (NotNull, JSC::allocateCell<JSSHA256Constructor>(vm)) JSSHA256Constructor(vm, structure, construct); ptr->finishCreation(vm, globalObject, prototype); return ptr; @@ -1444,28 +1538,30 @@ JSSHA256Constructor* JSSHA256Constructor::create(JSC::VM& vm, JSC::JSGlobalObjec JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSSHA256Constructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) { - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); - JSC::VM& vm = globalObject->vm(); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + JSC::VM &vm = globalObject->vm(); JSObject* newTarget = asObject(callFrame->newTarget()); auto* constructor = globalObject->JSSHA256Constructor(); Structure* structure = globalObject->JSSHA256Structure(); if (constructor != newTarget) { - auto scope = DECLARE_THROW_SCOPE(vm); + auto scope = DECLARE_THROW_SCOPE(vm); - auto* functionGlobalObject = reinterpret_cast<Zig::GlobalObject*>( - // ShadowRealm functions belong to a different global object. - getFunctionRealm(globalObject, newTarget)); - RETURN_IF_EXCEPTION(scope, {}); - structure = InternalFunction::createSubclassStructure( - globalObject, - newTarget, - functionGlobalObject->JSSHA256Structure()); + auto* functionGlobalObject = reinterpret_cast<Zig::GlobalObject*>( + // ShadowRealm functions belong to a different global object. + getFunctionRealm(globalObject, newTarget) + ); + RETURN_IF_EXCEPTION(scope, {}); + structure = InternalFunction::createSubclassStructure( + globalObject, + newTarget, + functionGlobalObject->JSSHA256Structure() + ); } void* ptr = SHA256Class__construct(globalObject, callFrame); if (UNLIKELY(!ptr)) { - return JSValue::encode(JSC::jsUndefined()); + return JSValue::encode(JSC::jsUndefined()); } JSSHA256* instance = JSSHA256::create(vm, globalObject, structure, ptr); @@ -1473,23 +1569,23 @@ JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSSHA256Constructor::construct(JSC: return JSValue::encode(instance); } -extern "C" EncodedJSValue SHA256__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSSHA256Structure(); - JSSHA256* instance = JSSHA256::create(vm, globalObject, structure, ptr); - return JSValue::encode(instance); +extern "C" EncodedJSValue SHA256__create(Zig::GlobalObject* globalObject, void* ptr) { + auto &vm = globalObject->vm(); + JSC::Structure* structure = globalObject->JSSHA256Structure(); + JSSHA256* instance = JSSHA256::create(vm, globalObject, structure, ptr); + return JSValue::encode(instance); } void JSSHA256Constructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSSHA256Prototype* prototype) { + } const ClassInfo JSSHA256Constructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA256Constructor) }; -extern "C" EncodedJSValue SHA256__getConstructor(Zig::GlobalObject* globalObject) -{ - return JSValue::encode(globalObject->JSSHA256Constructor()); + +extern "C" EncodedJSValue SHA256__getConstructor(Zig::GlobalObject* globalObject) { + return JSValue::encode(globalObject->JSSHA256Constructor()); } JSSHA256::~JSSHA256() @@ -1502,7 +1598,7 @@ void JSSHA256::destroy(JSCell* cell) { static_cast<JSSHA256*>(cell)->JSSHA256::~JSSHA256(); } - + const ClassInfo JSSHA256::s_info = { "SHA256"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA256) }; void JSSHA256::finishCreation(VM& vm) @@ -1511,32 +1607,31 @@ void JSSHA256::finishCreation(VM& vm) ASSERT(inherits(info())); } -JSSHA256* JSSHA256::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSSHA256* ptr = new (NotNull, JSC::allocateCell<JSSHA256>(vm)) JSSHA256(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; +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) -{ - JSSHA256* object = JSC::jsDynamicCast<JSSHA256*>(JSValue::decode(value)); - if (!object) - return nullptr; - return object->wrapped(); +extern "C" void* SHA256__fromJS(JSC::EncodedJSValue value) { + JSSHA256* object = JSC::jsDynamicCast<JSSHA256*>(JSValue::decode(value)); + if (!object) + return nullptr; + + return object->wrapped(); } -extern "C" bool SHA256__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSSHA256* object = JSC::jsDynamicCast<JSSHA256*>(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; +extern "C" bool SHA256__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) { + JSSHA256* object = JSC::jsDynamicCast<JSSHA256*>(JSValue::decode(value)); + if (!object) + return false; + + object->m_ctx = ptr; + return true; } + extern "C" const size_t SHA256__ptrOffset = JSSHA256::offsetOfWrapped(); void JSSHA256::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) @@ -1552,30 +1647,36 @@ void JSSHA256::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) JSObject* JSSHA256::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) { return JSSHA256Prototype::create(vm, globalObject, JSSHA256Prototype::createStructure(vm, globalObject, globalObject->objectPrototype())); -} -extern "C" void* SHA512_256Class__construct(JSC::JSGlobalObject*, JSC::CallFrame*); +}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, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(SHA512_256Prototype__byteLengthGetterWrap), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, - { "digest"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(SHA512_256Prototype__digestCallback), (intptr_t)(0) } }, - { "update"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(SHA512_256Prototype__updateCallback), (intptr_t)(0) } } -}; + + static const HashTableValue JSSHA512_256PrototypeTableValues[] = { +{ "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(SHA512_256Prototype__byteLengthGetterWrap), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } } , +{ "digest"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(SHA512_256Prototype__digestCallback), (intptr_t)(0) } } , +{ "update"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(SHA512_256Prototype__updateCallback), (intptr_t)(0) } } + }; + const ClassInfo JSSHA512_256Prototype::s_info = { "SHA512_256"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA512_256Prototype) }; + + JSC_DEFINE_CUSTOM_GETTER(jsSHA512_256Constructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); @@ -1586,12 +1687,14 @@ JSC_DEFINE_CUSTOM_GETTER(jsSHA512_256Constructor, (JSGlobalObject * lexicalGloba if (UNLIKELY(!prototype)) return throwVMTypeError(lexicalGlobalObject, throwScope); return JSValue::encode(globalObject->JSSHA512_256Constructor()); -} +} + + JSC_DEFINE_CUSTOM_GETTER(SHA512_256Prototype__byteLengthGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSSHA512_256* thisObject = jsCast<JSSHA512_256*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -1599,11 +1702,12 @@ JSC_DEFINE_CUSTOM_GETTER(SHA512_256Prototype__byteLengthGetterWrap, (JSGlobalObj RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + JSC_DEFINE_HOST_FUNCTION(SHA512_256Prototype__digestCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - + JSSHA512_256* thisObject = jsDynamicCast<JSSHA512_256*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { @@ -1612,14 +1716,15 @@ JSC_DEFINE_HOST_FUNCTION(SHA512_256Prototype__digestCallback, (JSGlobalObject * } JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - + return SHA512_256Prototype__digest(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + JSC_DEFINE_HOST_FUNCTION(SHA512_256Prototype__updateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - + JSSHA512_256* thisObject = jsDynamicCast<JSSHA512_256*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { @@ -1628,10 +1733,11 @@ JSC_DEFINE_HOST_FUNCTION(SHA512_256Prototype__updateCallback, (JSGlobalObject * } JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - + return SHA512_256Prototype__update(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + void JSSHA512_256Prototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) { Base::finishCreation(vm); @@ -1642,20 +1748,21 @@ void JSSHA512_256Prototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* glo extern "C" JSC_DECLARE_CUSTOM_GETTER(SHA512_256Class__getByteLengthStatic); extern "C" JSC_DECLARE_HOST_FUNCTION(SHA512_256Class__hash); -static const HashTableValue JSSHA512_256ConstructorTableValues[] = { - { "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(SHA512_256Class__getByteLengthStatic), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, - { "hash"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(SHA512_256Class__hash), (intptr_t)(2) } } -}; + static const HashTableValue JSSHA512_256ConstructorTableValues[] = { +{ "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(SHA512_256Class__getByteLengthStatic), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } } , +{ "hash"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(SHA512_256Class__hash), (intptr_t)(2) } } + }; + 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())); } -JSSHA512_256Constructor* JSSHA512_256Constructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSSHA512_256Prototype* prototype) -{ +JSSHA512_256Constructor* JSSHA512_256Constructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSSHA512_256Prototype* prototype) { JSSHA512_256Constructor* ptr = new (NotNull, JSC::allocateCell<JSSHA512_256Constructor>(vm)) JSSHA512_256Constructor(vm, structure, construct); ptr->finishCreation(vm, globalObject, prototype); return ptr; @@ -1663,28 +1770,30 @@ JSSHA512_256Constructor* JSSHA512_256Constructor::create(JSC::VM& vm, JSC::JSGlo JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSSHA512_256Constructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) { - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); - JSC::VM& vm = globalObject->vm(); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + JSC::VM &vm = globalObject->vm(); JSObject* newTarget = asObject(callFrame->newTarget()); auto* constructor = globalObject->JSSHA512_256Constructor(); Structure* structure = globalObject->JSSHA512_256Structure(); if (constructor != newTarget) { - auto scope = DECLARE_THROW_SCOPE(vm); + auto scope = DECLARE_THROW_SCOPE(vm); - auto* functionGlobalObject = reinterpret_cast<Zig::GlobalObject*>( - // ShadowRealm functions belong to a different global object. - getFunctionRealm(globalObject, newTarget)); - RETURN_IF_EXCEPTION(scope, {}); - structure = InternalFunction::createSubclassStructure( - globalObject, - newTarget, - functionGlobalObject->JSSHA512_256Structure()); + auto* functionGlobalObject = reinterpret_cast<Zig::GlobalObject*>( + // ShadowRealm functions belong to a different global object. + getFunctionRealm(globalObject, newTarget) + ); + RETURN_IF_EXCEPTION(scope, {}); + structure = InternalFunction::createSubclassStructure( + globalObject, + newTarget, + functionGlobalObject->JSSHA512_256Structure() + ); } void* ptr = SHA512_256Class__construct(globalObject, callFrame); if (UNLIKELY(!ptr)) { - return JSValue::encode(JSC::jsUndefined()); + return JSValue::encode(JSC::jsUndefined()); } JSSHA512_256* instance = JSSHA512_256::create(vm, globalObject, structure, ptr); @@ -1692,23 +1801,23 @@ JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSSHA512_256Constructor::construct( return JSValue::encode(instance); } -extern "C" EncodedJSValue SHA512_256__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSSHA512_256Structure(); - JSSHA512_256* instance = JSSHA512_256::create(vm, globalObject, structure, ptr); - return JSValue::encode(instance); +extern "C" EncodedJSValue SHA512_256__create(Zig::GlobalObject* globalObject, void* ptr) { + auto &vm = globalObject->vm(); + JSC::Structure* structure = globalObject->JSSHA512_256Structure(); + JSSHA512_256* instance = JSSHA512_256::create(vm, globalObject, structure, ptr); + return JSValue::encode(instance); } void JSSHA512_256Constructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSSHA512_256Prototype* prototype) { + } const ClassInfo JSSHA512_256Constructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA512_256Constructor) }; -extern "C" EncodedJSValue SHA512_256__getConstructor(Zig::GlobalObject* globalObject) -{ - return JSValue::encode(globalObject->JSSHA512_256Constructor()); + +extern "C" EncodedJSValue SHA512_256__getConstructor(Zig::GlobalObject* globalObject) { + return JSValue::encode(globalObject->JSSHA512_256Constructor()); } JSSHA512_256::~JSSHA512_256() @@ -1721,7 +1830,7 @@ void JSSHA512_256::destroy(JSCell* cell) { static_cast<JSSHA512_256*>(cell)->JSSHA512_256::~JSSHA512_256(); } - + const ClassInfo JSSHA512_256::s_info = { "SHA512_256"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSHA512_256) }; void JSSHA512_256::finishCreation(VM& vm) @@ -1730,32 +1839,31 @@ void JSSHA512_256::finishCreation(VM& vm) ASSERT(inherits(info())); } -JSSHA512_256* JSSHA512_256::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSSHA512_256* ptr = new (NotNull, JSC::allocateCell<JSSHA512_256>(vm)) JSSHA512_256(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; +JSSHA512_256* JSSHA512_256::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) { + JSSHA512_256* ptr = new (NotNull, JSC::allocateCell<JSSHA512_256>(vm)) JSSHA512_256(vm, structure, ctx); + ptr->finishCreation(vm); + return ptr; } -extern "C" void* SHA512_256__fromJS(JSC::EncodedJSValue value) -{ - JSSHA512_256* object = JSC::jsDynamicCast<JSSHA512_256*>(JSValue::decode(value)); - if (!object) - return nullptr; - return object->wrapped(); +extern "C" void* SHA512_256__fromJS(JSC::EncodedJSValue value) { + JSSHA512_256* object = JSC::jsDynamicCast<JSSHA512_256*>(JSValue::decode(value)); + if (!object) + return nullptr; + + return object->wrapped(); } -extern "C" bool SHA512_256__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSSHA512_256* object = JSC::jsDynamicCast<JSSHA512_256*>(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; +extern "C" bool SHA512_256__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) { + JSSHA512_256* object = JSC::jsDynamicCast<JSSHA512_256*>(JSValue::decode(value)); + if (!object) + return false; + + object->m_ctx = ptr; + return true; } + extern "C" const size_t SHA512_256__ptrOffset = JSSHA512_256::offsetOfWrapped(); void JSSHA512_256::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) @@ -1771,30 +1879,36 @@ void JSSHA512_256::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) JSObject* JSSHA512_256::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) { return JSSHA512_256Prototype::create(vm, globalObject, JSSHA512_256Prototype::createStructure(vm, globalObject, globalObject->objectPrototype())); -} -extern "C" void* MD5_SHA1Class__construct(JSC::JSGlobalObject*, JSC::CallFrame*); +}extern "C" void* MD5_SHA1Class__construct(JSC::JSGlobalObject*, JSC::CallFrame*); JSC_DECLARE_CUSTOM_GETTER(jsMD5_SHA1Constructor); extern "C" void MD5_SHA1Class__finalize(void*); extern "C" JSC::EncodedJSValue MD5_SHA1Prototype__getByteLength(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(MD5_SHA1Prototype__byteLengthGetterWrap); + extern "C" EncodedJSValue MD5_SHA1Prototype__digest(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(MD5_SHA1Prototype__digestCallback); + extern "C" EncodedJSValue MD5_SHA1Prototype__update(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(MD5_SHA1Prototype__updateCallback); + STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSMD5_SHA1Prototype, JSMD5_SHA1Prototype::Base); -static const HashTableValue JSMD5_SHA1PrototypeTableValues[] = { - { "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(MD5_SHA1Prototype__byteLengthGetterWrap), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, - { "digest"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(MD5_SHA1Prototype__digestCallback), (intptr_t)(0) } }, - { "update"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(MD5_SHA1Prototype__updateCallback), (intptr_t)(0) } } -}; + + static const HashTableValue JSMD5_SHA1PrototypeTableValues[] = { +{ "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(MD5_SHA1Prototype__byteLengthGetterWrap), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } } , +{ "digest"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(MD5_SHA1Prototype__digestCallback), (intptr_t)(0) } } , +{ "update"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(MD5_SHA1Prototype__updateCallback), (intptr_t)(0) } } + }; + const ClassInfo JSMD5_SHA1Prototype::s_info = { "MD5_SHA1"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSMD5_SHA1Prototype) }; + + JSC_DEFINE_CUSTOM_GETTER(jsMD5_SHA1Constructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); @@ -1805,12 +1919,14 @@ JSC_DEFINE_CUSTOM_GETTER(jsMD5_SHA1Constructor, (JSGlobalObject * lexicalGlobalO if (UNLIKELY(!prototype)) return throwVMTypeError(lexicalGlobalObject, throwScope); return JSValue::encode(globalObject->JSMD5_SHA1Constructor()); -} +} + + JSC_DEFINE_CUSTOM_GETTER(MD5_SHA1Prototype__byteLengthGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSMD5_SHA1* thisObject = jsCast<JSMD5_SHA1*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -1818,11 +1934,12 @@ JSC_DEFINE_CUSTOM_GETTER(MD5_SHA1Prototype__byteLengthGetterWrap, (JSGlobalObjec RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + JSC_DEFINE_HOST_FUNCTION(MD5_SHA1Prototype__digestCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - + JSMD5_SHA1* thisObject = jsDynamicCast<JSMD5_SHA1*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { @@ -1831,14 +1948,15 @@ JSC_DEFINE_HOST_FUNCTION(MD5_SHA1Prototype__digestCallback, (JSGlobalObject * le } JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - + return MD5_SHA1Prototype__digest(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + JSC_DEFINE_HOST_FUNCTION(MD5_SHA1Prototype__updateCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - + JSMD5_SHA1* thisObject = jsDynamicCast<JSMD5_SHA1*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { @@ -1847,10 +1965,11 @@ JSC_DEFINE_HOST_FUNCTION(MD5_SHA1Prototype__updateCallback, (JSGlobalObject * le } JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - + return MD5_SHA1Prototype__update(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + void JSMD5_SHA1Prototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) { Base::finishCreation(vm); @@ -1861,20 +1980,21 @@ void JSMD5_SHA1Prototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globa extern "C" JSC_DECLARE_CUSTOM_GETTER(MD5_SHA1Class__getByteLengthStatic); extern "C" JSC_DECLARE_HOST_FUNCTION(MD5_SHA1Class__hash); -static const HashTableValue JSMD5_SHA1ConstructorTableValues[] = { - { "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(MD5_SHA1Class__getByteLengthStatic), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, - { "hash"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(MD5_SHA1Class__hash), (intptr_t)(2) } } -}; + static const HashTableValue JSMD5_SHA1ConstructorTableValues[] = { +{ "byteLength"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(MD5_SHA1Class__getByteLengthStatic), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } } , +{ "hash"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(MD5_SHA1Class__hash), (intptr_t)(2) } } + }; + void JSMD5_SHA1Constructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSMD5_SHA1Prototype* prototype) { Base::finishCreation(vm, 0, "MD5_SHA1"_s, PropertyAdditionMode::WithoutStructureTransition); reifyStaticProperties(vm, &JSMD5_SHA1Constructor::s_info, JSMD5_SHA1ConstructorTableValues, *this); + putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly); ASSERT(inherits(info())); } -JSMD5_SHA1Constructor* JSMD5_SHA1Constructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSMD5_SHA1Prototype* prototype) -{ +JSMD5_SHA1Constructor* JSMD5_SHA1Constructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSMD5_SHA1Prototype* prototype) { JSMD5_SHA1Constructor* ptr = new (NotNull, JSC::allocateCell<JSMD5_SHA1Constructor>(vm)) JSMD5_SHA1Constructor(vm, structure, construct); ptr->finishCreation(vm, globalObject, prototype); return ptr; @@ -1882,28 +2002,30 @@ JSMD5_SHA1Constructor* JSMD5_SHA1Constructor::create(JSC::VM& vm, JSC::JSGlobalO JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSMD5_SHA1Constructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) { - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); - JSC::VM& vm = globalObject->vm(); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + JSC::VM &vm = globalObject->vm(); JSObject* newTarget = asObject(callFrame->newTarget()); auto* constructor = globalObject->JSMD5_SHA1Constructor(); Structure* structure = globalObject->JSMD5_SHA1Structure(); if (constructor != newTarget) { - auto scope = DECLARE_THROW_SCOPE(vm); + auto scope = DECLARE_THROW_SCOPE(vm); - auto* functionGlobalObject = reinterpret_cast<Zig::GlobalObject*>( - // ShadowRealm functions belong to a different global object. - getFunctionRealm(globalObject, newTarget)); - RETURN_IF_EXCEPTION(scope, {}); - structure = InternalFunction::createSubclassStructure( - globalObject, - newTarget, - functionGlobalObject->JSMD5_SHA1Structure()); + 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->JSMD5_SHA1Structure() + ); } void* ptr = MD5_SHA1Class__construct(globalObject, callFrame); if (UNLIKELY(!ptr)) { - return JSValue::encode(JSC::jsUndefined()); + return JSValue::encode(JSC::jsUndefined()); } JSMD5_SHA1* instance = JSMD5_SHA1::create(vm, globalObject, structure, ptr); @@ -1911,23 +2033,23 @@ JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSMD5_SHA1Constructor::construct(JS return JSValue::encode(instance); } -extern "C" EncodedJSValue MD5_SHA1__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSMD5_SHA1Structure(); - JSMD5_SHA1* instance = JSMD5_SHA1::create(vm, globalObject, structure, ptr); - return JSValue::encode(instance); +extern "C" EncodedJSValue MD5_SHA1__create(Zig::GlobalObject* globalObject, void* ptr) { + auto &vm = globalObject->vm(); + JSC::Structure* structure = globalObject->JSMD5_SHA1Structure(); + JSMD5_SHA1* instance = JSMD5_SHA1::create(vm, globalObject, structure, ptr); + return JSValue::encode(instance); } void JSMD5_SHA1Constructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSMD5_SHA1Prototype* prototype) { + } const ClassInfo JSMD5_SHA1Constructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSMD5_SHA1Constructor) }; -extern "C" EncodedJSValue MD5_SHA1__getConstructor(Zig::GlobalObject* globalObject) -{ - return JSValue::encode(globalObject->JSMD5_SHA1Constructor()); + +extern "C" EncodedJSValue MD5_SHA1__getConstructor(Zig::GlobalObject* globalObject) { + return JSValue::encode(globalObject->JSMD5_SHA1Constructor()); } JSMD5_SHA1::~JSMD5_SHA1() @@ -1940,7 +2062,7 @@ void JSMD5_SHA1::destroy(JSCell* cell) { static_cast<JSMD5_SHA1*>(cell)->JSMD5_SHA1::~JSMD5_SHA1(); } - + const ClassInfo JSMD5_SHA1::s_info = { "MD5_SHA1"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSMD5_SHA1) }; void JSMD5_SHA1::finishCreation(VM& vm) @@ -1949,32 +2071,31 @@ void JSMD5_SHA1::finishCreation(VM& vm) ASSERT(inherits(info())); } -JSMD5_SHA1* JSMD5_SHA1::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSMD5_SHA1* ptr = new (NotNull, JSC::allocateCell<JSMD5_SHA1>(vm)) JSMD5_SHA1(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; +JSMD5_SHA1* JSMD5_SHA1::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) { + JSMD5_SHA1* ptr = new (NotNull, JSC::allocateCell<JSMD5_SHA1>(vm)) JSMD5_SHA1(vm, structure, ctx); + ptr->finishCreation(vm); + return ptr; } -extern "C" void* MD5_SHA1__fromJS(JSC::EncodedJSValue value) -{ - JSMD5_SHA1* object = JSC::jsDynamicCast<JSMD5_SHA1*>(JSValue::decode(value)); - if (!object) - return nullptr; - return object->wrapped(); +extern "C" void* MD5_SHA1__fromJS(JSC::EncodedJSValue value) { + JSMD5_SHA1* object = JSC::jsDynamicCast<JSMD5_SHA1*>(JSValue::decode(value)); + if (!object) + return nullptr; + + return object->wrapped(); } -extern "C" bool MD5_SHA1__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSMD5_SHA1* object = JSC::jsDynamicCast<JSMD5_SHA1*>(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; +extern "C" bool MD5_SHA1__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) { + JSMD5_SHA1* object = JSC::jsDynamicCast<JSMD5_SHA1*>(JSValue::decode(value)); + if (!object) + return false; + + object->m_ctx = ptr; + return true; } + extern "C" const size_t MD5_SHA1__ptrOffset = JSMD5_SHA1::offsetOfWrapped(); void JSMD5_SHA1::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) @@ -1990,86 +2111,106 @@ void JSMD5_SHA1::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) JSObject* JSMD5_SHA1::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) { return JSMD5_SHA1Prototype::create(vm, globalObject, JSMD5_SHA1Prototype::createStructure(vm, globalObject, globalObject->objectPrototype())); -} -extern "C" void* RequestClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); +}extern "C" void* RequestClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); JSC_DECLARE_CUSTOM_GETTER(jsRequestConstructor); extern "C" void RequestClass__finalize(void*); extern "C" EncodedJSValue RequestPrototype__getArrayBuffer(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(RequestPrototype__arrayBufferCallback); + extern "C" EncodedJSValue RequestPrototype__getBlob(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(RequestPrototype__blobCallback); + extern "C" JSC::EncodedJSValue RequestPrototype__getBodyUsed(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(RequestPrototype__bodyUsedGetterWrap); + extern "C" JSC::EncodedJSValue RequestPrototype__getCache(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(RequestPrototype__cacheGetterWrap); + extern "C" EncodedJSValue RequestPrototype__doClone(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(RequestPrototype__cloneCallback); + extern "C" JSC::EncodedJSValue RequestPrototype__getCredentials(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(RequestPrototype__credentialsGetterWrap); + extern "C" JSC::EncodedJSValue RequestPrototype__getDestination(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(RequestPrototype__destinationGetterWrap); + extern "C" JSC::EncodedJSValue RequestPrototype__getHeaders(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(RequestPrototype__headersGetterWrap); + extern "C" JSC::EncodedJSValue RequestPrototype__getIntegrity(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(RequestPrototype__integrityGetterWrap); + extern "C" EncodedJSValue RequestPrototype__getJSON(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(RequestPrototype__jsonCallback); + extern "C" JSC::EncodedJSValue RequestPrototype__getMethod(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(RequestPrototype__methodGetterWrap); + extern "C" JSC::EncodedJSValue RequestPrototype__getMode(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(RequestPrototype__modeGetterWrap); + extern "C" JSC::EncodedJSValue RequestPrototype__getRedirect(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(RequestPrototype__redirectGetterWrap); + extern "C" JSC::EncodedJSValue RequestPrototype__getReferrer(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(RequestPrototype__referrerGetterWrap); + extern "C" JSC::EncodedJSValue RequestPrototype__getReferrerPolicy(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(RequestPrototype__referrerPolicyGetterWrap); + extern "C" EncodedJSValue RequestPrototype__getText(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(RequestPrototype__textCallback); + extern "C" JSC::EncodedJSValue RequestPrototype__getUrl(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(RequestPrototype__urlGetterWrap); + STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSRequestPrototype, JSRequestPrototype::Base); -static const HashTableValue JSRequestPrototypeTableValues[] = { - { "arrayBuffer"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(RequestPrototype__arrayBufferCallback), (intptr_t)(0) } }, - { "blob"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(RequestPrototype__blobCallback), (intptr_t)(0) } }, - { "bodyUsed"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(RequestPrototype__bodyUsedGetterWrap), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, - { "cache"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(RequestPrototype__cacheGetterWrap), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, - { "clone"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(RequestPrototype__cloneCallback), (intptr_t)(1) } }, - { "credentials"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(RequestPrototype__credentialsGetterWrap), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, - { "destination"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(RequestPrototype__destinationGetterWrap), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, - { "headers"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(RequestPrototype__headersGetterWrap), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, - { "integrity"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(RequestPrototype__integrityGetterWrap), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, - { "json"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(RequestPrototype__jsonCallback), (intptr_t)(0) } }, - { "method"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(RequestPrototype__methodGetterWrap), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, - { "mode"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(RequestPrototype__modeGetterWrap), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, - { "redirect"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(RequestPrototype__redirectGetterWrap), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, - { "referrer"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(RequestPrototype__referrerGetterWrap), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, - { "referrerPolicy"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(RequestPrototype__referrerPolicyGetterWrap), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, - { "text"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(RequestPrototype__textCallback), (intptr_t)(0) } }, - { "url"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(RequestPrototype__urlGetterWrap), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } } -}; + + static const HashTableValue JSRequestPrototypeTableValues[] = { +{ "arrayBuffer"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(RequestPrototype__arrayBufferCallback), (intptr_t)(0) } } , +{ "blob"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(RequestPrototype__blobCallback), (intptr_t)(0) } } , +{ "bodyUsed"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(RequestPrototype__bodyUsedGetterWrap), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } } , +{ "cache"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(RequestPrototype__cacheGetterWrap), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } } , +{ "clone"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(RequestPrototype__cloneCallback), (intptr_t)(1) } } , +{ "credentials"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(RequestPrototype__credentialsGetterWrap), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } } , +{ "destination"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(RequestPrototype__destinationGetterWrap), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } } , +{ "headers"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(RequestPrototype__headersGetterWrap), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } } , +{ "integrity"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(RequestPrototype__integrityGetterWrap), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } } , +{ "json"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(RequestPrototype__jsonCallback), (intptr_t)(0) } } , +{ "method"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(RequestPrototype__methodGetterWrap), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } } , +{ "mode"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(RequestPrototype__modeGetterWrap), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } } , +{ "redirect"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(RequestPrototype__redirectGetterWrap), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } } , +{ "referrer"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(RequestPrototype__referrerGetterWrap), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } } , +{ "referrerPolicy"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(RequestPrototype__referrerPolicyGetterWrap), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } } , +{ "text"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(RequestPrototype__textCallback), (intptr_t)(0) } } , +{ "url"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(RequestPrototype__urlGetterWrap), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } } + }; + const ClassInfo JSRequestPrototype::s_info = { "Request"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSRequestPrototype) }; + + JSC_DEFINE_CUSTOM_GETTER(jsRequestConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); @@ -2080,12 +2221,14 @@ JSC_DEFINE_CUSTOM_GETTER(jsRequestConstructor, (JSGlobalObject * lexicalGlobalOb if (UNLIKELY(!prototype)) return throwVMTypeError(lexicalGlobalObject, throwScope); return JSValue::encode(globalObject->JSRequestConstructor()); -} +} + + JSC_DEFINE_HOST_FUNCTION(RequestPrototype__arrayBufferCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - + JSRequest* thisObject = jsDynamicCast<JSRequest*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { @@ -2094,14 +2237,15 @@ JSC_DEFINE_HOST_FUNCTION(RequestPrototype__arrayBufferCallback, (JSGlobalObject } JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - + return RequestPrototype__getArrayBuffer(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + JSC_DEFINE_HOST_FUNCTION(RequestPrototype__blobCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - + JSRequest* thisObject = jsDynamicCast<JSRequest*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { @@ -2110,14 +2254,15 @@ JSC_DEFINE_HOST_FUNCTION(RequestPrototype__blobCallback, (JSGlobalObject * lexic } JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - + return RequestPrototype__getBlob(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + JSC_DEFINE_CUSTOM_GETTER(RequestPrototype__bodyUsedGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSRequest* thisObject = jsCast<JSRequest*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -2125,11 +2270,12 @@ JSC_DEFINE_CUSTOM_GETTER(RequestPrototype__bodyUsedGetterWrap, (JSGlobalObject * RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + JSC_DEFINE_CUSTOM_GETTER(RequestPrototype__cacheGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSRequest* thisObject = jsCast<JSRequest*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -2137,11 +2283,12 @@ JSC_DEFINE_CUSTOM_GETTER(RequestPrototype__cacheGetterWrap, (JSGlobalObject * le RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + JSC_DEFINE_HOST_FUNCTION(RequestPrototype__cloneCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - + JSRequest* thisObject = jsDynamicCast<JSRequest*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { @@ -2150,14 +2297,15 @@ JSC_DEFINE_HOST_FUNCTION(RequestPrototype__cloneCallback, (JSGlobalObject * lexi } JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - + return RequestPrototype__doClone(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + JSC_DEFINE_CUSTOM_GETTER(RequestPrototype__credentialsGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSRequest* thisObject = jsCast<JSRequest*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -2165,11 +2313,12 @@ JSC_DEFINE_CUSTOM_GETTER(RequestPrototype__credentialsGetterWrap, (JSGlobalObjec RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + JSC_DEFINE_CUSTOM_GETTER(RequestPrototype__destinationGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSRequest* thisObject = jsCast<JSRequest*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -2177,29 +2326,32 @@ JSC_DEFINE_CUSTOM_GETTER(RequestPrototype__destinationGetterWrap, (JSGlobalObjec RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + JSC_DEFINE_CUSTOM_GETTER(RequestPrototype__headersGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSRequest* thisObject = jsCast<JSRequest*>(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + if (JSValue cachedValue = thisObject->m_headers.get()) return JSValue::encode(cachedValue); - + JSC::JSValue result = JSC::JSValue::decode( - RequestPrototype__getHeaders(thisObject->wrapped(), globalObject)); + RequestPrototype__getHeaders(thisObject->wrapped(), globalObject) + ); RETURN_IF_EXCEPTION(throwScope, {}); thisObject->m_headers.set(vm, thisObject, result); RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); } + JSC_DEFINE_CUSTOM_GETTER(RequestPrototype__integrityGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSRequest* thisObject = jsCast<JSRequest*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -2207,11 +2359,12 @@ JSC_DEFINE_CUSTOM_GETTER(RequestPrototype__integrityGetterWrap, (JSGlobalObject RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + JSC_DEFINE_HOST_FUNCTION(RequestPrototype__jsonCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - + JSRequest* thisObject = jsDynamicCast<JSRequest*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { @@ -2220,14 +2373,15 @@ JSC_DEFINE_HOST_FUNCTION(RequestPrototype__jsonCallback, (JSGlobalObject * lexic } JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - + return RequestPrototype__getJSON(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + JSC_DEFINE_CUSTOM_GETTER(RequestPrototype__methodGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSRequest* thisObject = jsCast<JSRequest*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -2235,11 +2389,12 @@ JSC_DEFINE_CUSTOM_GETTER(RequestPrototype__methodGetterWrap, (JSGlobalObject * l RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + JSC_DEFINE_CUSTOM_GETTER(RequestPrototype__modeGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSRequest* thisObject = jsCast<JSRequest*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -2247,11 +2402,12 @@ JSC_DEFINE_CUSTOM_GETTER(RequestPrototype__modeGetterWrap, (JSGlobalObject * lex RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + JSC_DEFINE_CUSTOM_GETTER(RequestPrototype__redirectGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSRequest* thisObject = jsCast<JSRequest*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -2259,11 +2415,12 @@ JSC_DEFINE_CUSTOM_GETTER(RequestPrototype__redirectGetterWrap, (JSGlobalObject * RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + JSC_DEFINE_CUSTOM_GETTER(RequestPrototype__referrerGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSRequest* thisObject = jsCast<JSRequest*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -2271,11 +2428,12 @@ JSC_DEFINE_CUSTOM_GETTER(RequestPrototype__referrerGetterWrap, (JSGlobalObject * RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + JSC_DEFINE_CUSTOM_GETTER(RequestPrototype__referrerPolicyGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSRequest* thisObject = jsCast<JSRequest*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -2283,11 +2441,12 @@ JSC_DEFINE_CUSTOM_GETTER(RequestPrototype__referrerPolicyGetterWrap, (JSGlobalOb RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + JSC_DEFINE_HOST_FUNCTION(RequestPrototype__textCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - + JSRequest* thisObject = jsDynamicCast<JSRequest*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { @@ -2296,28 +2455,31 @@ JSC_DEFINE_HOST_FUNCTION(RequestPrototype__textCallback, (JSGlobalObject * lexic } JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - + return RequestPrototype__getText(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + JSC_DEFINE_CUSTOM_GETTER(RequestPrototype__urlGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSRequest* thisObject = jsCast<JSRequest*>(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + if (JSValue cachedValue = thisObject->m_url.get()) return JSValue::encode(cachedValue); - + JSC::JSValue result = JSC::JSValue::decode( - RequestPrototype__getUrl(thisObject->wrapped(), globalObject)); + RequestPrototype__getUrl(thisObject->wrapped(), globalObject) + ); RETURN_IF_EXCEPTION(throwScope, {}); thisObject->m_url.set(vm, thisObject, result); RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); } + void JSRequestPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) { Base::finishCreation(vm); @@ -2328,12 +2490,12 @@ void JSRequestPrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* global void JSRequestConstructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSRequestPrototype* prototype) { Base::finishCreation(vm, 0, "Request"_s, PropertyAdditionMode::WithoutStructureTransition); - + + putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly); ASSERT(inherits(info())); } -JSRequestConstructor* JSRequestConstructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSRequestPrototype* prototype) -{ +JSRequestConstructor* JSRequestConstructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSRequestPrototype* prototype) { JSRequestConstructor* ptr = new (NotNull, JSC::allocateCell<JSRequestConstructor>(vm)) JSRequestConstructor(vm, structure, construct); ptr->finishCreation(vm, globalObject, prototype); return ptr; @@ -2341,28 +2503,30 @@ JSRequestConstructor* JSRequestConstructor::create(JSC::VM& vm, JSC::JSGlobalObj JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSRequestConstructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) { - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); - JSC::VM& vm = globalObject->vm(); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + JSC::VM &vm = globalObject->vm(); JSObject* newTarget = asObject(callFrame->newTarget()); auto* constructor = globalObject->JSRequestConstructor(); Structure* structure = globalObject->JSRequestStructure(); if (constructor != newTarget) { - auto scope = DECLARE_THROW_SCOPE(vm); + auto scope = DECLARE_THROW_SCOPE(vm); - auto* functionGlobalObject = reinterpret_cast<Zig::GlobalObject*>( - // ShadowRealm functions belong to a different global object. - getFunctionRealm(globalObject, newTarget)); - RETURN_IF_EXCEPTION(scope, {}); - structure = InternalFunction::createSubclassStructure( - globalObject, - newTarget, - functionGlobalObject->JSRequestStructure()); + auto* functionGlobalObject = reinterpret_cast<Zig::GlobalObject*>( + // ShadowRealm functions belong to a different global object. + getFunctionRealm(globalObject, newTarget) + ); + RETURN_IF_EXCEPTION(scope, {}); + structure = InternalFunction::createSubclassStructure( + globalObject, + newTarget, + functionGlobalObject->JSRequestStructure() + ); } void* ptr = RequestClass__construct(globalObject, callFrame); if (UNLIKELY(!ptr)) { - return JSValue::encode(JSC::jsUndefined()); + return JSValue::encode(JSC::jsUndefined()); } JSRequest* instance = JSRequest::create(vm, globalObject, structure, ptr); @@ -2370,23 +2534,23 @@ JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSRequestConstructor::construct(JSC return JSValue::encode(instance); } -extern "C" EncodedJSValue Request__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSRequestStructure(); - JSRequest* instance = JSRequest::create(vm, globalObject, structure, ptr); - return JSValue::encode(instance); +extern "C" EncodedJSValue Request__create(Zig::GlobalObject* globalObject, void* ptr) { + auto &vm = globalObject->vm(); + JSC::Structure* structure = globalObject->JSRequestStructure(); + JSRequest* instance = JSRequest::create(vm, globalObject, structure, ptr); + return JSValue::encode(instance); } void JSRequestConstructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSRequestPrototype* prototype) { + } const ClassInfo JSRequestConstructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSRequestConstructor) }; -extern "C" EncodedJSValue Request__getConstructor(Zig::GlobalObject* globalObject) -{ - return JSValue::encode(globalObject->JSRequestConstructor()); + +extern "C" EncodedJSValue Request__getConstructor(Zig::GlobalObject* globalObject) { + return JSValue::encode(globalObject->JSRequestConstructor()); } JSRequest::~JSRequest() @@ -2399,7 +2563,7 @@ void JSRequest::destroy(JSCell* cell) { static_cast<JSRequest*>(cell)->JSRequest::~JSRequest(); } - + const ClassInfo JSRequest::s_info = { "Request"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSRequest) }; void JSRequest::finishCreation(VM& vm) @@ -2408,32 +2572,31 @@ void JSRequest::finishCreation(VM& vm) ASSERT(inherits(info())); } -JSRequest* JSRequest::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSRequest* ptr = new (NotNull, JSC::allocateCell<JSRequest>(vm)) JSRequest(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; +JSRequest* JSRequest::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) { + JSRequest* ptr = new (NotNull, JSC::allocateCell<JSRequest>(vm)) JSRequest(vm, structure, ctx); + ptr->finishCreation(vm); + return ptr; } -extern "C" void* Request__fromJS(JSC::EncodedJSValue value) -{ - JSRequest* object = JSC::jsDynamicCast<JSRequest*>(JSValue::decode(value)); - if (!object) - return nullptr; - return object->wrapped(); +extern "C" void* Request__fromJS(JSC::EncodedJSValue value) { + JSRequest* object = JSC::jsDynamicCast<JSRequest*>(JSValue::decode(value)); + if (!object) + return nullptr; + + return object->wrapped(); } -extern "C" bool Request__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSRequest* object = JSC::jsDynamicCast<JSRequest*>(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; +extern "C" bool Request__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) { + JSRequest* object = JSC::jsDynamicCast<JSRequest*>(JSValue::decode(value)); + if (!object) + return false; + + object->m_ctx = ptr; + return true; } + extern "C" const size_t Request__ptrOffset = JSRequest::offsetOfWrapped(); void JSRequest::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) @@ -2450,7 +2613,7 @@ JSObject* JSRequest::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) { return JSRequestPrototype::create(vm, globalObject, JSRequestPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); } - + template<typename Visitor> void JSRequest::visitChildrenImpl(JSCell* cell, Visitor& visitor) { @@ -2461,66 +2624,81 @@ void JSRequest::visitChildrenImpl(JSCell* cell, Visitor& visitor) visitor.append(thisObject->m_url); } -DEFINE_VISIT_CHILDREN(JSRequest); -extern "C" void* ResponseClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); +DEFINE_VISIT_CHILDREN(JSRequest);extern "C" void* ResponseClass__construct(JSC::JSGlobalObject*, JSC::CallFrame*); JSC_DECLARE_CUSTOM_GETTER(jsResponseConstructor); extern "C" void ResponseClass__finalize(void*); extern "C" EncodedJSValue ResponsePrototype__getArrayBuffer(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(ResponsePrototype__arrayBufferCallback); + extern "C" EncodedJSValue ResponsePrototype__getBlob(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(ResponsePrototype__blobCallback); + extern "C" JSC::EncodedJSValue ResponsePrototype__getBodyUsed(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(ResponsePrototype__bodyUsedGetterWrap); + extern "C" EncodedJSValue ResponsePrototype__doClone(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(ResponsePrototype__cloneCallback); + extern "C" JSC::EncodedJSValue ResponsePrototype__getHeaders(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(ResponsePrototype__headersGetterWrap); + extern "C" EncodedJSValue ResponsePrototype__getJSON(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(ResponsePrototype__jsonCallback); + extern "C" JSC::EncodedJSValue ResponsePrototype__getOK(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(ResponsePrototype__okGetterWrap); + extern "C" JSC::EncodedJSValue ResponsePrototype__getStatus(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(ResponsePrototype__statusGetterWrap); + extern "C" JSC::EncodedJSValue ResponsePrototype__getStatusText(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(ResponsePrototype__statusTextGetterWrap); + extern "C" EncodedJSValue ResponsePrototype__getText(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame); JSC_DECLARE_HOST_FUNCTION(ResponsePrototype__textCallback); + extern "C" JSC::EncodedJSValue ResponsePrototype__getResponseType(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(ResponsePrototype__typeGetterWrap); + extern "C" JSC::EncodedJSValue ResponsePrototype__getURL(void* ptr, JSC::JSGlobalObject* lexicalGlobalObject); JSC_DECLARE_CUSTOM_GETTER(ResponsePrototype__urlGetterWrap); + STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSResponsePrototype, JSResponsePrototype::Base); -static const HashTableValue JSResponsePrototypeTableValues[] = { - { "arrayBuffer"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(ResponsePrototype__arrayBufferCallback), (intptr_t)(0) } }, - { "blob"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(ResponsePrototype__blobCallback), (intptr_t)(0) } }, - { "bodyUsed"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(ResponsePrototype__bodyUsedGetterWrap), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, - { "clone"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(ResponsePrototype__cloneCallback), (intptr_t)(1) } }, - { "headers"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(ResponsePrototype__headersGetterWrap), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, - { "json"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(ResponsePrototype__jsonCallback), (intptr_t)(0) } }, - { "ok"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(ResponsePrototype__okGetterWrap), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, - { "status"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(ResponsePrototype__statusGetterWrap), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, - { "statusText"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(ResponsePrototype__statusTextGetterWrap), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, - { "text"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(ResponsePrototype__textCallback), (intptr_t)(0) } }, - { "type"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(ResponsePrototype__typeGetterWrap), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, - { "url"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(ResponsePrototype__urlGetterWrap), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } } -}; + + static const HashTableValue JSResponsePrototypeTableValues[] = { +{ "arrayBuffer"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(ResponsePrototype__arrayBufferCallback), (intptr_t)(0) } } , +{ "blob"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(ResponsePrototype__blobCallback), (intptr_t)(0) } } , +{ "bodyUsed"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(ResponsePrototype__bodyUsedGetterWrap), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } } , +{ "clone"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(ResponsePrototype__cloneCallback), (intptr_t)(1) } } , +{ "headers"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(ResponsePrototype__headersGetterWrap), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } } , +{ "json"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(ResponsePrototype__jsonCallback), (intptr_t)(0) } } , +{ "ok"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(ResponsePrototype__okGetterWrap), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } } , +{ "status"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(ResponsePrototype__statusGetterWrap), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } } , +{ "statusText"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(ResponsePrototype__statusTextGetterWrap), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } } , +{ "text"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(ResponsePrototype__textCallback), (intptr_t)(0) } } , +{ "type"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(ResponsePrototype__typeGetterWrap), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } } , +{ "url"_s, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(ResponsePrototype__urlGetterWrap), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } } + }; + const ClassInfo JSResponsePrototype::s_info = { "Response"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSResponsePrototype) }; + + JSC_DEFINE_CUSTOM_GETTER(jsResponseConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) { VM& vm = JSC::getVM(lexicalGlobalObject); @@ -2531,12 +2709,14 @@ JSC_DEFINE_CUSTOM_GETTER(jsResponseConstructor, (JSGlobalObject * lexicalGlobalO if (UNLIKELY(!prototype)) return throwVMTypeError(lexicalGlobalObject, throwScope); return JSValue::encode(globalObject->JSResponseConstructor()); -} +} + + JSC_DEFINE_HOST_FUNCTION(ResponsePrototype__arrayBufferCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - + JSResponse* thisObject = jsDynamicCast<JSResponse*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { @@ -2545,14 +2725,15 @@ JSC_DEFINE_HOST_FUNCTION(ResponsePrototype__arrayBufferCallback, (JSGlobalObject } JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - + return ResponsePrototype__getArrayBuffer(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + JSC_DEFINE_HOST_FUNCTION(ResponsePrototype__blobCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - + JSResponse* thisObject = jsDynamicCast<JSResponse*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { @@ -2561,14 +2742,15 @@ JSC_DEFINE_HOST_FUNCTION(ResponsePrototype__blobCallback, (JSGlobalObject * lexi } JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - + return ResponsePrototype__getBlob(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + JSC_DEFINE_CUSTOM_GETTER(ResponsePrototype__bodyUsedGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSResponse* thisObject = jsCast<JSResponse*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -2576,11 +2758,12 @@ JSC_DEFINE_CUSTOM_GETTER(ResponsePrototype__bodyUsedGetterWrap, (JSGlobalObject RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + JSC_DEFINE_HOST_FUNCTION(ResponsePrototype__cloneCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - + JSResponse* thisObject = jsDynamicCast<JSResponse*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { @@ -2589,32 +2772,35 @@ JSC_DEFINE_HOST_FUNCTION(ResponsePrototype__cloneCallback, (JSGlobalObject * lex } JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - + return ResponsePrototype__doClone(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + JSC_DEFINE_CUSTOM_GETTER(ResponsePrototype__headersGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSResponse* thisObject = jsCast<JSResponse*>(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + if (JSValue cachedValue = thisObject->m_headers.get()) return JSValue::encode(cachedValue); - + JSC::JSValue result = JSC::JSValue::decode( - ResponsePrototype__getHeaders(thisObject->wrapped(), globalObject)); + ResponsePrototype__getHeaders(thisObject->wrapped(), globalObject) + ); RETURN_IF_EXCEPTION(throwScope, {}); thisObject->m_headers.set(vm, thisObject, result); RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); } + JSC_DEFINE_HOST_FUNCTION(ResponsePrototype__jsonCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - + JSResponse* thisObject = jsDynamicCast<JSResponse*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { @@ -2623,14 +2809,15 @@ JSC_DEFINE_HOST_FUNCTION(ResponsePrototype__jsonCallback, (JSGlobalObject * lexi } JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - + return ResponsePrototype__getJSON(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + JSC_DEFINE_CUSTOM_GETTER(ResponsePrototype__okGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSResponse* thisObject = jsCast<JSResponse*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -2638,11 +2825,12 @@ JSC_DEFINE_CUSTOM_GETTER(ResponsePrototype__okGetterWrap, (JSGlobalObject * lexi RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + JSC_DEFINE_CUSTOM_GETTER(ResponsePrototype__statusGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSResponse* thisObject = jsCast<JSResponse*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -2650,29 +2838,32 @@ JSC_DEFINE_CUSTOM_GETTER(ResponsePrototype__statusGetterWrap, (JSGlobalObject * RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + JSC_DEFINE_CUSTOM_GETTER(ResponsePrototype__statusTextGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSResponse* thisObject = jsCast<JSResponse*>(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + if (JSValue cachedValue = thisObject->m_statusText.get()) return JSValue::encode(cachedValue); - + JSC::JSValue result = JSC::JSValue::decode( - ResponsePrototype__getStatusText(thisObject->wrapped(), globalObject)); + ResponsePrototype__getStatusText(thisObject->wrapped(), globalObject) + ); RETURN_IF_EXCEPTION(throwScope, {}); thisObject->m_statusText.set(vm, thisObject, result); RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); } + JSC_DEFINE_HOST_FUNCTION(ResponsePrototype__textCallback, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) { auto& vm = lexicalGlobalObject->vm(); - + JSResponse* thisObject = jsDynamicCast<JSResponse*>(callFrame->thisValue()); if (UNLIKELY(!thisObject)) { @@ -2681,14 +2872,15 @@ JSC_DEFINE_HOST_FUNCTION(ResponsePrototype__textCallback, (JSGlobalObject * lexi } JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - + return ResponsePrototype__getText(thisObject->wrapped(), lexicalGlobalObject, callFrame); } + JSC_DEFINE_CUSTOM_GETTER(ResponsePrototype__typeGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSResponse* thisObject = jsCast<JSResponse*>(JSValue::decode(thisValue)); JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); @@ -2696,25 +2888,28 @@ JSC_DEFINE_CUSTOM_GETTER(ResponsePrototype__typeGetterWrap, (JSGlobalObject * le RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, result); } + JSC_DEFINE_CUSTOM_GETTER(ResponsePrototype__urlGetterWrap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) { auto& vm = lexicalGlobalObject->vm(); - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); JSResponse* thisObject = jsCast<JSResponse*>(JSValue::decode(thisValue)); - JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); - + JSC::EnsureStillAliveScope thisArg = JSC::EnsureStillAliveScope(thisObject); + if (JSValue cachedValue = thisObject->m_url.get()) return JSValue::encode(cachedValue); - + JSC::JSValue result = JSC::JSValue::decode( - ResponsePrototype__getURL(thisObject->wrapped(), globalObject)); + ResponsePrototype__getURL(thisObject->wrapped(), globalObject) + ); RETURN_IF_EXCEPTION(throwScope, {}); thisObject->m_url.set(vm, thisObject, result); RELEASE_AND_RETURN(throwScope, JSValue::encode(result)); } + void JSResponsePrototype::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject) { Base::finishCreation(vm); @@ -2726,21 +2921,22 @@ extern "C" JSC_DECLARE_HOST_FUNCTION(ResponseClass__constructError); extern "C" JSC_DECLARE_HOST_FUNCTION(ResponseClass__constructJSON); extern "C" JSC_DECLARE_HOST_FUNCTION(ResponseClass__constructRedirect); -static const HashTableValue JSResponseConstructorTableValues[] = { - { "error"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(ResponseClass__constructError), (intptr_t)(0) } }, - { "json"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(ResponseClass__constructJSON), (intptr_t)(0) } }, - { "redirect"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(ResponseClass__constructRedirect), (intptr_t)(0) } } -}; + static const HashTableValue JSResponseConstructorTableValues[] = { +{ "error"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(ResponseClass__constructError), (intptr_t)(0) } } , +{ "json"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(ResponseClass__constructJSON), (intptr_t)(0) } } , +{ "redirect"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(ResponseClass__constructRedirect), (intptr_t)(0) } } + }; + void JSResponseConstructor::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, JSResponsePrototype* prototype) { Base::finishCreation(vm, 0, "Response"_s, PropertyAdditionMode::WithoutStructureTransition); reifyStaticProperties(vm, &JSResponseConstructor::s_info, JSResponseConstructorTableValues, *this); + putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly); ASSERT(inherits(info())); } -JSResponseConstructor* JSResponseConstructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSResponsePrototype* prototype) -{ +JSResponseConstructor* JSResponseConstructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSResponsePrototype* prototype) { JSResponseConstructor* ptr = new (NotNull, JSC::allocateCell<JSResponseConstructor>(vm)) JSResponseConstructor(vm, structure, construct); ptr->finishCreation(vm, globalObject, prototype); return ptr; @@ -2748,28 +2944,30 @@ JSResponseConstructor* JSResponseConstructor::create(JSC::VM& vm, JSC::JSGlobalO JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSResponseConstructor::construct(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) { - Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); - JSC::VM& vm = globalObject->vm(); + Zig::GlobalObject *globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject); + JSC::VM &vm = globalObject->vm(); JSObject* newTarget = asObject(callFrame->newTarget()); auto* constructor = globalObject->JSResponseConstructor(); Structure* structure = globalObject->JSResponseStructure(); if (constructor != newTarget) { - auto scope = DECLARE_THROW_SCOPE(vm); + auto scope = DECLARE_THROW_SCOPE(vm); - auto* functionGlobalObject = reinterpret_cast<Zig::GlobalObject*>( - // ShadowRealm functions belong to a different global object. - getFunctionRealm(globalObject, newTarget)); - RETURN_IF_EXCEPTION(scope, {}); - structure = InternalFunction::createSubclassStructure( - globalObject, - newTarget, - functionGlobalObject->JSResponseStructure()); + auto* functionGlobalObject = reinterpret_cast<Zig::GlobalObject*>( + // ShadowRealm functions belong to a different global object. + getFunctionRealm(globalObject, newTarget) + ); + RETURN_IF_EXCEPTION(scope, {}); + structure = InternalFunction::createSubclassStructure( + globalObject, + newTarget, + functionGlobalObject->JSResponseStructure() + ); } void* ptr = ResponseClass__construct(globalObject, callFrame); if (UNLIKELY(!ptr)) { - return JSValue::encode(JSC::jsUndefined()); + return JSValue::encode(JSC::jsUndefined()); } JSResponse* instance = JSResponse::create(vm, globalObject, structure, ptr); @@ -2777,23 +2975,23 @@ JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSResponseConstructor::construct(JS return JSValue::encode(instance); } -extern "C" EncodedJSValue Response__create(Zig::GlobalObject* globalObject, void* ptr) -{ - auto& vm = globalObject->vm(); - JSC::Structure* structure = globalObject->JSResponseStructure(); - JSResponse* instance = JSResponse::create(vm, globalObject, structure, ptr); - return JSValue::encode(instance); +extern "C" EncodedJSValue Response__create(Zig::GlobalObject* globalObject, void* ptr) { + auto &vm = globalObject->vm(); + JSC::Structure* structure = globalObject->JSResponseStructure(); + JSResponse* instance = JSResponse::create(vm, globalObject, structure, ptr); + return JSValue::encode(instance); } void JSResponseConstructor::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSResponsePrototype* prototype) { + } const ClassInfo JSResponseConstructor::s_info = { "Function"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSResponseConstructor) }; -extern "C" EncodedJSValue Response__getConstructor(Zig::GlobalObject* globalObject) -{ - return JSValue::encode(globalObject->JSResponseConstructor()); + +extern "C" EncodedJSValue Response__getConstructor(Zig::GlobalObject* globalObject) { + return JSValue::encode(globalObject->JSResponseConstructor()); } JSResponse::~JSResponse() @@ -2806,7 +3004,7 @@ void JSResponse::destroy(JSCell* cell) { static_cast<JSResponse*>(cell)->JSResponse::~JSResponse(); } - + const ClassInfo JSResponse::s_info = { "Response"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSResponse) }; void JSResponse::finishCreation(VM& vm) @@ -2815,32 +3013,31 @@ void JSResponse::finishCreation(VM& vm) ASSERT(inherits(info())); } -JSResponse* JSResponse::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) -{ - JSResponse* ptr = new (NotNull, JSC::allocateCell<JSResponse>(vm)) JSResponse(vm, structure, ctx); - ptr->finishCreation(vm); - return ptr; +JSResponse* JSResponse::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* ctx) { + JSResponse* ptr = new (NotNull, JSC::allocateCell<JSResponse>(vm)) JSResponse(vm, structure, ctx); + ptr->finishCreation(vm); + return ptr; } -extern "C" void* Response__fromJS(JSC::EncodedJSValue value) -{ - JSResponse* object = JSC::jsDynamicCast<JSResponse*>(JSValue::decode(value)); - if (!object) - return nullptr; - return object->wrapped(); +extern "C" void* Response__fromJS(JSC::EncodedJSValue value) { + JSResponse* object = JSC::jsDynamicCast<JSResponse*>(JSValue::decode(value)); + if (!object) + return nullptr; + + return object->wrapped(); } -extern "C" bool Response__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) -{ - JSResponse* object = JSC::jsDynamicCast<JSResponse*>(JSValue::decode(value)); - if (!object) - return false; - - object->m_ctx = ptr; - return true; +extern "C" bool Response__dangerouslySetPtr(JSC::EncodedJSValue value, void* ptr) { + JSResponse* object = JSC::jsDynamicCast<JSResponse*>(JSValue::decode(value)); + if (!object) + return false; + + object->m_ctx = ptr; + return true; } + extern "C" const size_t Response__ptrOffset = JSResponse::offsetOfWrapped(); void JSResponse::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) @@ -2857,7 +3054,7 @@ JSObject* JSResponse::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) { return JSResponsePrototype::create(vm, globalObject, JSResponsePrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); } - + template<typename Visitor> void JSResponse::visitChildrenImpl(JSCell* cell, Visitor& visitor) { @@ -2872,3 +3069,4 @@ void JSResponse::visitChildrenImpl(JSCell* cell, Visitor& visitor) DEFINE_VISIT_CHILDREN(JSResponse); } // namespace WebCore + diff --git a/src/bun.js/bindings/ZigGlobalObject.cpp b/src/bun.js/bindings/ZigGlobalObject.cpp index 453e8851d..762814d65 100644 --- a/src/bun.js/bindings/ZigGlobalObject.cpp +++ b/src/bun.js/bindings/ZigGlobalObject.cpp @@ -956,7 +956,7 @@ JSC_DEFINE_HOST_FUNCTION(functionFileURLToPath, (JSC::JSGlobalObject * globalObj if (arg0.isString()) { auto url = WTF::URL(arg0.toWTFString(globalObject)); RETURN_IF_EXCEPTION(scope, JSC::JSValue::encode(JSC::jsUndefined())); - RETURN_AND_RELEASE_SCOPE(scope, jsString(vm, url.fileSystemPath())); + RELEASE_AND_RETURN(scope, JSValue::encode(jsString(vm, url.fileSystemPath()))); } throwTypeError(globalObject, scope, "Argument must be a URL"_s); return JSC::JSValue::encode(JSC::JSValue {}); diff --git a/src/bun.js/bindings/generated_classes.zig b/src/bun.js/bindings/generated_classes.zig index 4fff6c065..92f3812f0 100644 --- a/src/bun.js/bindings/generated_classes.zig +++ b/src/bun.js/bindings/generated_classes.zig @@ -1,20 +1,17 @@ - const JSC = @import("javascript_core"); const Classes = @import("./generated_classes_list.zig").Classes; const Environment = @import("../../env.zig"); const std = @import("std"); -pub const StaticGetterType = fn(*JSC.JSGlobalObject, JSC.JSValue, JSC.JSValue) callconv(.C) JSC.JSValue; -pub const StaticSetterType = fn(*JSC.JSGlobalObject, JSC.JSValue, JSC.JSValue, JSC.JSValue) callconv(.C) bool; -pub const StaticCallbackType = fn(*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; - - +pub const StaticGetterType = fn (*JSC.JSGlobalObject, JSC.JSValue, JSC.JSValue) callconv(.C) JSC.JSValue; +pub const StaticSetterType = fn (*JSC.JSGlobalObject, JSC.JSValue, JSC.JSValue, JSC.JSValue) callconv(.C) bool; +pub const StaticCallbackType = fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; pub const JSSHA1 = struct { const SHA1 = Classes.SHA1; - const GetterType = fn(*SHA1, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn(*SHA1, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn(*SHA1, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; + const GetterType = fn (*SHA1, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const SetterType = fn (*SHA1, *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. @@ -44,8 +41,8 @@ pub const JSSHA1 = struct { /// Modify the internal ptr to point to a new instance of SHA1. pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*SHA1) bool { - JSC.markBinding(); - return SHA1__dangerouslySetPtr(value, ptr); + JSC.markBinding(); + return SHA1__dangerouslySetPtr(value, ptr); } extern fn SHA1__fromJS(JSC.JSValue) ?*SHA1; @@ -56,53 +53,42 @@ pub const JSSHA1 = struct { extern fn SHA1__dangerouslySetPtr(JSC.JSValue, ?*SHA1) bool; comptime { - - if (@TypeOf(SHA1.constructor) != (fn(*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*SHA1)) { - @compileLog("SHA1.constructor is not a constructor"); + if (@TypeOf(SHA1.constructor) != (fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*SHA1)) { + @compileLog("SHA1.constructor is not a constructor"); } - - if (@TypeOf(SHA1.finalize) != (fn(*SHA1) callconv(.C) void)) { - @compileLog("SHA1.finalize is not a finalizer"); + + if (@TypeOf(SHA1.finalize) != (fn (*SHA1) callconv(.C) void)) { + @compileLog("SHA1.finalize is not a finalizer"); } - - if (@TypeOf(SHA1.getByteLength) != GetterType) - @compileLog( - "Expected SHA1.getByteLength to be a getter" - ); - - if (@TypeOf(SHA1.digest) != CallbackType) - @compileLog( - "Expected SHA1.digest to be a callback" - ); - if (@TypeOf(SHA1.update) != CallbackType) - @compileLog( - "Expected SHA1.update to be a callback" - ); - if (@TypeOf(SHA1.getByteLengthStatic) != StaticGetterType) - @compileLog( - "Expected SHA1.getByteLengthStatic to be a static getter" - ); - - if (@TypeOf(SHA1.hash) != StaticCallbackType) - @compileLog( - "Expected SHA1.hash to be a static callback" - ); + + if (@TypeOf(SHA1.getByteLength) != GetterType) + @compileLog("Expected SHA1.getByteLength to be a getter"); + + if (@TypeOf(SHA1.digest) != CallbackType) + @compileLog("Expected SHA1.digest to be a callback"); + if (@TypeOf(SHA1.update) != CallbackType) + @compileLog("Expected SHA1.update to be a callback"); + if (@TypeOf(SHA1.getByteLengthStatic) != StaticGetterType) + @compileLog("Expected SHA1.getByteLengthStatic to be a static getter"); + + if (@TypeOf(SHA1.hash) != StaticCallbackType) + @compileLog("Expected SHA1.hash to be a static callback"); if (!JSC.is_bindgen) { -@export(SHA1.constructor, .{.name = "SHA1Class__construct"}); - @export(SHA1.digest, .{.name = "SHA1Prototype__digest"}); - @export(SHA1.finalize, .{.name = "SHA1Class__finalize"}); - @export(SHA1.getByteLength, .{.name = "SHA1Prototype__getByteLength"}); - @export(SHA1.getByteLengthStatic, .{.name = "SHA1Class__getByteLengthStatic"}); - @export(SHA1.hash, .{.name = "SHA1Class__hash"}); - @export(SHA1.update, .{.name = "SHA1Prototype__update"}); + @export(SHA1.constructor, .{ .name = "SHA1Class__construct" }); + @export(SHA1.digest, .{ .name = "SHA1Prototype__digest" }); + @export(SHA1.finalize, .{ .name = "SHA1Class__finalize" }); + @export(SHA1.getByteLength, .{ .name = "SHA1Prototype__getByteLength" }); + @export(SHA1.getByteLengthStatic, .{ .name = "SHA1Class__getByteLengthStatic" }); + @export(SHA1.hash, .{ .name = "SHA1Class__hash" }); + @export(SHA1.update, .{ .name = "SHA1Prototype__update" }); } } }; pub const JSMD5 = struct { const MD5 = Classes.MD5; - const GetterType = fn(*MD5, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn(*MD5, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn(*MD5, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; + const GetterType = fn (*MD5, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const SetterType = fn (*MD5, *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. @@ -132,8 +118,8 @@ pub const JSMD5 = struct { /// Modify the internal ptr to point to a new instance of MD5. pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*MD5) bool { - JSC.markBinding(); - return MD5__dangerouslySetPtr(value, ptr); + JSC.markBinding(); + return MD5__dangerouslySetPtr(value, ptr); } extern fn MD5__fromJS(JSC.JSValue) ?*MD5; @@ -144,53 +130,42 @@ pub const JSMD5 = struct { extern fn MD5__dangerouslySetPtr(JSC.JSValue, ?*MD5) bool; comptime { - - if (@TypeOf(MD5.constructor) != (fn(*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*MD5)) { - @compileLog("MD5.constructor is not a constructor"); + if (@TypeOf(MD5.constructor) != (fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*MD5)) { + @compileLog("MD5.constructor is not a constructor"); } - - if (@TypeOf(MD5.finalize) != (fn(*MD5) callconv(.C) void)) { - @compileLog("MD5.finalize is not a finalizer"); + + if (@TypeOf(MD5.finalize) != (fn (*MD5) callconv(.C) void)) { + @compileLog("MD5.finalize is not a finalizer"); } - - if (@TypeOf(MD5.getByteLength) != GetterType) - @compileLog( - "Expected MD5.getByteLength to be a getter" - ); - - if (@TypeOf(MD5.digest) != CallbackType) - @compileLog( - "Expected MD5.digest to be a callback" - ); - if (@TypeOf(MD5.update) != CallbackType) - @compileLog( - "Expected MD5.update to be a callback" - ); - if (@TypeOf(MD5.getByteLengthStatic) != StaticGetterType) - @compileLog( - "Expected MD5.getByteLengthStatic to be a static getter" - ); - - if (@TypeOf(MD5.hash) != StaticCallbackType) - @compileLog( - "Expected MD5.hash to be a static callback" - ); + + if (@TypeOf(MD5.getByteLength) != GetterType) + @compileLog("Expected MD5.getByteLength to be a getter"); + + if (@TypeOf(MD5.digest) != CallbackType) + @compileLog("Expected MD5.digest to be a callback"); + if (@TypeOf(MD5.update) != CallbackType) + @compileLog("Expected MD5.update to be a callback"); + if (@TypeOf(MD5.getByteLengthStatic) != StaticGetterType) + @compileLog("Expected MD5.getByteLengthStatic to be a static getter"); + + if (@TypeOf(MD5.hash) != StaticCallbackType) + @compileLog("Expected MD5.hash to be a static callback"); if (!JSC.is_bindgen) { -@export(MD5.constructor, .{.name = "MD5Class__construct"}); - @export(MD5.digest, .{.name = "MD5Prototype__digest"}); - @export(MD5.finalize, .{.name = "MD5Class__finalize"}); - @export(MD5.getByteLength, .{.name = "MD5Prototype__getByteLength"}); - @export(MD5.getByteLengthStatic, .{.name = "MD5Class__getByteLengthStatic"}); - @export(MD5.hash, .{.name = "MD5Class__hash"}); - @export(MD5.update, .{.name = "MD5Prototype__update"}); + @export(MD5.constructor, .{ .name = "MD5Class__construct" }); + @export(MD5.digest, .{ .name = "MD5Prototype__digest" }); + @export(MD5.finalize, .{ .name = "MD5Class__finalize" }); + @export(MD5.getByteLength, .{ .name = "MD5Prototype__getByteLength" }); + @export(MD5.getByteLengthStatic, .{ .name = "MD5Class__getByteLengthStatic" }); + @export(MD5.hash, .{ .name = "MD5Class__hash" }); + @export(MD5.update, .{ .name = "MD5Prototype__update" }); } } }; pub const JSMD4 = struct { const MD4 = Classes.MD4; - const GetterType = fn(*MD4, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn(*MD4, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn(*MD4, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; + const GetterType = fn (*MD4, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const SetterType = fn (*MD4, *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. @@ -220,8 +195,8 @@ pub const JSMD4 = struct { /// Modify the internal ptr to point to a new instance of MD4. pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*MD4) bool { - JSC.markBinding(); - return MD4__dangerouslySetPtr(value, ptr); + JSC.markBinding(); + return MD4__dangerouslySetPtr(value, ptr); } extern fn MD4__fromJS(JSC.JSValue) ?*MD4; @@ -232,53 +207,42 @@ pub const JSMD4 = struct { extern fn MD4__dangerouslySetPtr(JSC.JSValue, ?*MD4) bool; comptime { - - if (@TypeOf(MD4.constructor) != (fn(*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*MD4)) { - @compileLog("MD4.constructor is not a constructor"); + if (@TypeOf(MD4.constructor) != (fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*MD4)) { + @compileLog("MD4.constructor is not a constructor"); } - - if (@TypeOf(MD4.finalize) != (fn(*MD4) callconv(.C) void)) { - @compileLog("MD4.finalize is not a finalizer"); + + if (@TypeOf(MD4.finalize) != (fn (*MD4) callconv(.C) void)) { + @compileLog("MD4.finalize is not a finalizer"); } - - if (@TypeOf(MD4.getByteLength) != GetterType) - @compileLog( - "Expected MD4.getByteLength to be a getter" - ); - - if (@TypeOf(MD4.digest) != CallbackType) - @compileLog( - "Expected MD4.digest to be a callback" - ); - if (@TypeOf(MD4.update) != CallbackType) - @compileLog( - "Expected MD4.update to be a callback" - ); - if (@TypeOf(MD4.getByteLengthStatic) != StaticGetterType) - @compileLog( - "Expected MD4.getByteLengthStatic to be a static getter" - ); - - if (@TypeOf(MD4.hash) != StaticCallbackType) - @compileLog( - "Expected MD4.hash to be a static callback" - ); + + if (@TypeOf(MD4.getByteLength) != GetterType) + @compileLog("Expected MD4.getByteLength to be a getter"); + + if (@TypeOf(MD4.digest) != CallbackType) + @compileLog("Expected MD4.digest to be a callback"); + if (@TypeOf(MD4.update) != CallbackType) + @compileLog("Expected MD4.update to be a callback"); + if (@TypeOf(MD4.getByteLengthStatic) != StaticGetterType) + @compileLog("Expected MD4.getByteLengthStatic to be a static getter"); + + if (@TypeOf(MD4.hash) != StaticCallbackType) + @compileLog("Expected MD4.hash to be a static callback"); if (!JSC.is_bindgen) { -@export(MD4.constructor, .{.name = "MD4Class__construct"}); - @export(MD4.digest, .{.name = "MD4Prototype__digest"}); - @export(MD4.finalize, .{.name = "MD4Class__finalize"}); - @export(MD4.getByteLength, .{.name = "MD4Prototype__getByteLength"}); - @export(MD4.getByteLengthStatic, .{.name = "MD4Class__getByteLengthStatic"}); - @export(MD4.hash, .{.name = "MD4Class__hash"}); - @export(MD4.update, .{.name = "MD4Prototype__update"}); + @export(MD4.constructor, .{ .name = "MD4Class__construct" }); + @export(MD4.digest, .{ .name = "MD4Prototype__digest" }); + @export(MD4.finalize, .{ .name = "MD4Class__finalize" }); + @export(MD4.getByteLength, .{ .name = "MD4Prototype__getByteLength" }); + @export(MD4.getByteLengthStatic, .{ .name = "MD4Class__getByteLengthStatic" }); + @export(MD4.hash, .{ .name = "MD4Class__hash" }); + @export(MD4.update, .{ .name = "MD4Prototype__update" }); } } }; pub const JSSHA224 = struct { const SHA224 = Classes.SHA224; - const GetterType = fn(*SHA224, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn(*SHA224, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn(*SHA224, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; + const GetterType = fn (*SHA224, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const SetterType = fn (*SHA224, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const CallbackType = fn (*SHA224, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; /// Return the pointer to the wrapped object. /// If the object does not match the type, return null. @@ -308,8 +272,8 @@ pub const JSSHA224 = struct { /// Modify the internal ptr to point to a new instance of SHA224. pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*SHA224) bool { - JSC.markBinding(); - return SHA224__dangerouslySetPtr(value, ptr); + JSC.markBinding(); + return SHA224__dangerouslySetPtr(value, ptr); } extern fn SHA224__fromJS(JSC.JSValue) ?*SHA224; @@ -320,53 +284,42 @@ pub const JSSHA224 = struct { extern fn SHA224__dangerouslySetPtr(JSC.JSValue, ?*SHA224) bool; comptime { - - if (@TypeOf(SHA224.constructor) != (fn(*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*SHA224)) { - @compileLog("SHA224.constructor is not a constructor"); + if (@TypeOf(SHA224.constructor) != (fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*SHA224)) { + @compileLog("SHA224.constructor is not a constructor"); } - - if (@TypeOf(SHA224.finalize) != (fn(*SHA224) callconv(.C) void)) { - @compileLog("SHA224.finalize is not a finalizer"); + + if (@TypeOf(SHA224.finalize) != (fn (*SHA224) callconv(.C) void)) { + @compileLog("SHA224.finalize is not a finalizer"); } - - if (@TypeOf(SHA224.getByteLength) != GetterType) - @compileLog( - "Expected SHA224.getByteLength to be a getter" - ); - - if (@TypeOf(SHA224.digest) != CallbackType) - @compileLog( - "Expected SHA224.digest to be a callback" - ); - if (@TypeOf(SHA224.update) != CallbackType) - @compileLog( - "Expected SHA224.update to be a callback" - ); - if (@TypeOf(SHA224.getByteLengthStatic) != StaticGetterType) - @compileLog( - "Expected SHA224.getByteLengthStatic to be a static getter" - ); - - if (@TypeOf(SHA224.hash) != StaticCallbackType) - @compileLog( - "Expected SHA224.hash to be a static callback" - ); + + if (@TypeOf(SHA224.getByteLength) != GetterType) + @compileLog("Expected SHA224.getByteLength to be a getter"); + + if (@TypeOf(SHA224.digest) != CallbackType) + @compileLog("Expected SHA224.digest to be a callback"); + if (@TypeOf(SHA224.update) != CallbackType) + @compileLog("Expected SHA224.update to be a callback"); + if (@TypeOf(SHA224.getByteLengthStatic) != StaticGetterType) + @compileLog("Expected SHA224.getByteLengthStatic to be a static getter"); + + if (@TypeOf(SHA224.hash) != StaticCallbackType) + @compileLog("Expected SHA224.hash to be a static callback"); if (!JSC.is_bindgen) { -@export(SHA224.constructor, .{.name = "SHA224Class__construct"}); - @export(SHA224.digest, .{.name = "SHA224Prototype__digest"}); - @export(SHA224.finalize, .{.name = "SHA224Class__finalize"}); - @export(SHA224.getByteLength, .{.name = "SHA224Prototype__getByteLength"}); - @export(SHA224.getByteLengthStatic, .{.name = "SHA224Class__getByteLengthStatic"}); - @export(SHA224.hash, .{.name = "SHA224Class__hash"}); - @export(SHA224.update, .{.name = "SHA224Prototype__update"}); + @export(SHA224.constructor, .{ .name = "SHA224Class__construct" }); + @export(SHA224.digest, .{ .name = "SHA224Prototype__digest" }); + @export(SHA224.finalize, .{ .name = "SHA224Class__finalize" }); + @export(SHA224.getByteLength, .{ .name = "SHA224Prototype__getByteLength" }); + @export(SHA224.getByteLengthStatic, .{ .name = "SHA224Class__getByteLengthStatic" }); + @export(SHA224.hash, .{ .name = "SHA224Class__hash" }); + @export(SHA224.update, .{ .name = "SHA224Prototype__update" }); } } }; pub const JSSHA512 = struct { const SHA512 = Classes.SHA512; - const GetterType = fn(*SHA512, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn(*SHA512, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn(*SHA512, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; + const GetterType = fn (*SHA512, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const SetterType = fn (*SHA512, *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. @@ -396,8 +349,8 @@ pub const JSSHA512 = struct { /// Modify the internal ptr to point to a new instance of SHA512. pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*SHA512) bool { - JSC.markBinding(); - return SHA512__dangerouslySetPtr(value, ptr); + JSC.markBinding(); + return SHA512__dangerouslySetPtr(value, ptr); } extern fn SHA512__fromJS(JSC.JSValue) ?*SHA512; @@ -408,53 +361,42 @@ pub const JSSHA512 = struct { extern fn SHA512__dangerouslySetPtr(JSC.JSValue, ?*SHA512) bool; comptime { - - if (@TypeOf(SHA512.constructor) != (fn(*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*SHA512)) { - @compileLog("SHA512.constructor is not a constructor"); + if (@TypeOf(SHA512.constructor) != (fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*SHA512)) { + @compileLog("SHA512.constructor is not a constructor"); } - - if (@TypeOf(SHA512.finalize) != (fn(*SHA512) callconv(.C) void)) { - @compileLog("SHA512.finalize is not a finalizer"); + + if (@TypeOf(SHA512.finalize) != (fn (*SHA512) callconv(.C) void)) { + @compileLog("SHA512.finalize is not a finalizer"); } - - if (@TypeOf(SHA512.getByteLength) != GetterType) - @compileLog( - "Expected SHA512.getByteLength to be a getter" - ); - - if (@TypeOf(SHA512.digest) != CallbackType) - @compileLog( - "Expected SHA512.digest to be a callback" - ); - if (@TypeOf(SHA512.update) != CallbackType) - @compileLog( - "Expected SHA512.update to be a callback" - ); - if (@TypeOf(SHA512.getByteLengthStatic) != StaticGetterType) - @compileLog( - "Expected SHA512.getByteLengthStatic to be a static getter" - ); - - if (@TypeOf(SHA512.hash) != StaticCallbackType) - @compileLog( - "Expected SHA512.hash to be a static callback" - ); + + if (@TypeOf(SHA512.getByteLength) != GetterType) + @compileLog("Expected SHA512.getByteLength to be a getter"); + + if (@TypeOf(SHA512.digest) != CallbackType) + @compileLog("Expected SHA512.digest to be a callback"); + if (@TypeOf(SHA512.update) != CallbackType) + @compileLog("Expected SHA512.update to be a callback"); + if (@TypeOf(SHA512.getByteLengthStatic) != StaticGetterType) + @compileLog("Expected SHA512.getByteLengthStatic to be a static getter"); + + if (@TypeOf(SHA512.hash) != StaticCallbackType) + @compileLog("Expected SHA512.hash to be a static callback"); if (!JSC.is_bindgen) { -@export(SHA512.constructor, .{.name = "SHA512Class__construct"}); - @export(SHA512.digest, .{.name = "SHA512Prototype__digest"}); - @export(SHA512.finalize, .{.name = "SHA512Class__finalize"}); - @export(SHA512.getByteLength, .{.name = "SHA512Prototype__getByteLength"}); - @export(SHA512.getByteLengthStatic, .{.name = "SHA512Class__getByteLengthStatic"}); - @export(SHA512.hash, .{.name = "SHA512Class__hash"}); - @export(SHA512.update, .{.name = "SHA512Prototype__update"}); + @export(SHA512.constructor, .{ .name = "SHA512Class__construct" }); + @export(SHA512.digest, .{ .name = "SHA512Prototype__digest" }); + @export(SHA512.finalize, .{ .name = "SHA512Class__finalize" }); + @export(SHA512.getByteLength, .{ .name = "SHA512Prototype__getByteLength" }); + @export(SHA512.getByteLengthStatic, .{ .name = "SHA512Class__getByteLengthStatic" }); + @export(SHA512.hash, .{ .name = "SHA512Class__hash" }); + @export(SHA512.update, .{ .name = "SHA512Prototype__update" }); } } }; pub const JSSHA384 = struct { const SHA384 = Classes.SHA384; - const GetterType = fn(*SHA384, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn(*SHA384, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn(*SHA384, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; + const GetterType = fn (*SHA384, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const SetterType = fn (*SHA384, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const CallbackType = fn (*SHA384, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; /// Return the pointer to the wrapped object. /// If the object does not match the type, return null. @@ -484,8 +426,8 @@ pub const JSSHA384 = struct { /// Modify the internal ptr to point to a new instance of SHA384. pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*SHA384) bool { - JSC.markBinding(); - return SHA384__dangerouslySetPtr(value, ptr); + JSC.markBinding(); + return SHA384__dangerouslySetPtr(value, ptr); } extern fn SHA384__fromJS(JSC.JSValue) ?*SHA384; @@ -496,53 +438,42 @@ pub const JSSHA384 = struct { extern fn SHA384__dangerouslySetPtr(JSC.JSValue, ?*SHA384) bool; comptime { - - if (@TypeOf(SHA384.constructor) != (fn(*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*SHA384)) { - @compileLog("SHA384.constructor is not a constructor"); + if (@TypeOf(SHA384.constructor) != (fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*SHA384)) { + @compileLog("SHA384.constructor is not a constructor"); } - - if (@TypeOf(SHA384.finalize) != (fn(*SHA384) callconv(.C) void)) { - @compileLog("SHA384.finalize is not a finalizer"); + + if (@TypeOf(SHA384.finalize) != (fn (*SHA384) callconv(.C) void)) { + @compileLog("SHA384.finalize is not a finalizer"); } - - if (@TypeOf(SHA384.getByteLength) != GetterType) - @compileLog( - "Expected SHA384.getByteLength to be a getter" - ); - - if (@TypeOf(SHA384.digest) != CallbackType) - @compileLog( - "Expected SHA384.digest to be a callback" - ); - if (@TypeOf(SHA384.update) != CallbackType) - @compileLog( - "Expected SHA384.update to be a callback" - ); - if (@TypeOf(SHA384.getByteLengthStatic) != StaticGetterType) - @compileLog( - "Expected SHA384.getByteLengthStatic to be a static getter" - ); - - if (@TypeOf(SHA384.hash) != StaticCallbackType) - @compileLog( - "Expected SHA384.hash to be a static callback" - ); + + if (@TypeOf(SHA384.getByteLength) != GetterType) + @compileLog("Expected SHA384.getByteLength to be a getter"); + + if (@TypeOf(SHA384.digest) != CallbackType) + @compileLog("Expected SHA384.digest to be a callback"); + if (@TypeOf(SHA384.update) != CallbackType) + @compileLog("Expected SHA384.update to be a callback"); + if (@TypeOf(SHA384.getByteLengthStatic) != StaticGetterType) + @compileLog("Expected SHA384.getByteLengthStatic to be a static getter"); + + if (@TypeOf(SHA384.hash) != StaticCallbackType) + @compileLog("Expected SHA384.hash to be a static callback"); if (!JSC.is_bindgen) { -@export(SHA384.constructor, .{.name = "SHA384Class__construct"}); - @export(SHA384.digest, .{.name = "SHA384Prototype__digest"}); - @export(SHA384.finalize, .{.name = "SHA384Class__finalize"}); - @export(SHA384.getByteLength, .{.name = "SHA384Prototype__getByteLength"}); - @export(SHA384.getByteLengthStatic, .{.name = "SHA384Class__getByteLengthStatic"}); - @export(SHA384.hash, .{.name = "SHA384Class__hash"}); - @export(SHA384.update, .{.name = "SHA384Prototype__update"}); + @export(SHA384.constructor, .{ .name = "SHA384Class__construct" }); + @export(SHA384.digest, .{ .name = "SHA384Prototype__digest" }); + @export(SHA384.finalize, .{ .name = "SHA384Class__finalize" }); + @export(SHA384.getByteLength, .{ .name = "SHA384Prototype__getByteLength" }); + @export(SHA384.getByteLengthStatic, .{ .name = "SHA384Class__getByteLengthStatic" }); + @export(SHA384.hash, .{ .name = "SHA384Class__hash" }); + @export(SHA384.update, .{ .name = "SHA384Prototype__update" }); } } }; pub const JSSHA256 = struct { const SHA256 = Classes.SHA256; - const GetterType = fn(*SHA256, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn(*SHA256, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn(*SHA256, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; + const GetterType = fn (*SHA256, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const SetterType = fn (*SHA256, *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. @@ -572,8 +503,8 @@ pub const JSSHA256 = struct { /// Modify the internal ptr to point to a new instance of SHA256. pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*SHA256) bool { - JSC.markBinding(); - return SHA256__dangerouslySetPtr(value, ptr); + JSC.markBinding(); + return SHA256__dangerouslySetPtr(value, ptr); } extern fn SHA256__fromJS(JSC.JSValue) ?*SHA256; @@ -584,53 +515,42 @@ pub const JSSHA256 = struct { extern fn SHA256__dangerouslySetPtr(JSC.JSValue, ?*SHA256) bool; comptime { - - if (@TypeOf(SHA256.constructor) != (fn(*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*SHA256)) { - @compileLog("SHA256.constructor is not a constructor"); + if (@TypeOf(SHA256.constructor) != (fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*SHA256)) { + @compileLog("SHA256.constructor is not a constructor"); } - - if (@TypeOf(SHA256.finalize) != (fn(*SHA256) callconv(.C) void)) { - @compileLog("SHA256.finalize is not a finalizer"); + + if (@TypeOf(SHA256.finalize) != (fn (*SHA256) callconv(.C) void)) { + @compileLog("SHA256.finalize is not a finalizer"); } - - if (@TypeOf(SHA256.getByteLength) != GetterType) - @compileLog( - "Expected SHA256.getByteLength to be a getter" - ); - - if (@TypeOf(SHA256.digest) != CallbackType) - @compileLog( - "Expected SHA256.digest to be a callback" - ); - if (@TypeOf(SHA256.update) != CallbackType) - @compileLog( - "Expected SHA256.update to be a callback" - ); - if (@TypeOf(SHA256.getByteLengthStatic) != StaticGetterType) - @compileLog( - "Expected SHA256.getByteLengthStatic to be a static getter" - ); - - if (@TypeOf(SHA256.hash) != StaticCallbackType) - @compileLog( - "Expected SHA256.hash to be a static callback" - ); + + if (@TypeOf(SHA256.getByteLength) != GetterType) + @compileLog("Expected SHA256.getByteLength to be a getter"); + + if (@TypeOf(SHA256.digest) != CallbackType) + @compileLog("Expected SHA256.digest to be a callback"); + if (@TypeOf(SHA256.update) != CallbackType) + @compileLog("Expected SHA256.update to be a callback"); + if (@TypeOf(SHA256.getByteLengthStatic) != StaticGetterType) + @compileLog("Expected SHA256.getByteLengthStatic to be a static getter"); + + if (@TypeOf(SHA256.hash) != StaticCallbackType) + @compileLog("Expected SHA256.hash to be a static callback"); if (!JSC.is_bindgen) { -@export(SHA256.constructor, .{.name = "SHA256Class__construct"}); - @export(SHA256.digest, .{.name = "SHA256Prototype__digest"}); - @export(SHA256.finalize, .{.name = "SHA256Class__finalize"}); - @export(SHA256.getByteLength, .{.name = "SHA256Prototype__getByteLength"}); - @export(SHA256.getByteLengthStatic, .{.name = "SHA256Class__getByteLengthStatic"}); - @export(SHA256.hash, .{.name = "SHA256Class__hash"}); - @export(SHA256.update, .{.name = "SHA256Prototype__update"}); + @export(SHA256.constructor, .{ .name = "SHA256Class__construct" }); + @export(SHA256.digest, .{ .name = "SHA256Prototype__digest" }); + @export(SHA256.finalize, .{ .name = "SHA256Class__finalize" }); + @export(SHA256.getByteLength, .{ .name = "SHA256Prototype__getByteLength" }); + @export(SHA256.getByteLengthStatic, .{ .name = "SHA256Class__getByteLengthStatic" }); + @export(SHA256.hash, .{ .name = "SHA256Class__hash" }); + @export(SHA256.update, .{ .name = "SHA256Prototype__update" }); } } }; pub const JSSHA512_256 = struct { const SHA512_256 = Classes.SHA512_256; - const GetterType = fn(*SHA512_256, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn(*SHA512_256, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn(*SHA512_256, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; + const GetterType = fn (*SHA512_256, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const SetterType = fn (*SHA512_256, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const CallbackType = fn (*SHA512_256, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; /// Return the pointer to the wrapped object. /// If the object does not match the type, return null. @@ -660,8 +580,8 @@ pub const JSSHA512_256 = struct { /// Modify the internal ptr to point to a new instance of SHA512_256. pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*SHA512_256) bool { - JSC.markBinding(); - return SHA512_256__dangerouslySetPtr(value, ptr); + JSC.markBinding(); + return SHA512_256__dangerouslySetPtr(value, ptr); } extern fn SHA512_256__fromJS(JSC.JSValue) ?*SHA512_256; @@ -672,53 +592,42 @@ pub const JSSHA512_256 = struct { extern fn SHA512_256__dangerouslySetPtr(JSC.JSValue, ?*SHA512_256) bool; comptime { - - if (@TypeOf(SHA512_256.constructor) != (fn(*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*SHA512_256)) { - @compileLog("SHA512_256.constructor is not a constructor"); + if (@TypeOf(SHA512_256.constructor) != (fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*SHA512_256)) { + @compileLog("SHA512_256.constructor is not a constructor"); } - - if (@TypeOf(SHA512_256.finalize) != (fn(*SHA512_256) callconv(.C) void)) { - @compileLog("SHA512_256.finalize is not a finalizer"); + + if (@TypeOf(SHA512_256.finalize) != (fn (*SHA512_256) callconv(.C) void)) { + @compileLog("SHA512_256.finalize is not a finalizer"); } - - if (@TypeOf(SHA512_256.getByteLength) != GetterType) - @compileLog( - "Expected SHA512_256.getByteLength to be a getter" - ); - - if (@TypeOf(SHA512_256.digest) != CallbackType) - @compileLog( - "Expected SHA512_256.digest to be a callback" - ); - if (@TypeOf(SHA512_256.update) != CallbackType) - @compileLog( - "Expected SHA512_256.update to be a callback" - ); - if (@TypeOf(SHA512_256.getByteLengthStatic) != StaticGetterType) - @compileLog( - "Expected SHA512_256.getByteLengthStatic to be a static getter" - ); - - if (@TypeOf(SHA512_256.hash) != StaticCallbackType) - @compileLog( - "Expected SHA512_256.hash to be a static callback" - ); + + if (@TypeOf(SHA512_256.getByteLength) != GetterType) + @compileLog("Expected SHA512_256.getByteLength to be a getter"); + + if (@TypeOf(SHA512_256.digest) != CallbackType) + @compileLog("Expected SHA512_256.digest to be a callback"); + if (@TypeOf(SHA512_256.update) != CallbackType) + @compileLog("Expected SHA512_256.update to be a callback"); + if (@TypeOf(SHA512_256.getByteLengthStatic) != StaticGetterType) + @compileLog("Expected SHA512_256.getByteLengthStatic to be a static getter"); + + if (@TypeOf(SHA512_256.hash) != StaticCallbackType) + @compileLog("Expected SHA512_256.hash to be a static callback"); if (!JSC.is_bindgen) { -@export(SHA512_256.constructor, .{.name = "SHA512_256Class__construct"}); - @export(SHA512_256.digest, .{.name = "SHA512_256Prototype__digest"}); - @export(SHA512_256.finalize, .{.name = "SHA512_256Class__finalize"}); - @export(SHA512_256.getByteLength, .{.name = "SHA512_256Prototype__getByteLength"}); - @export(SHA512_256.getByteLengthStatic, .{.name = "SHA512_256Class__getByteLengthStatic"}); - @export(SHA512_256.hash, .{.name = "SHA512_256Class__hash"}); - @export(SHA512_256.update, .{.name = "SHA512_256Prototype__update"}); + @export(SHA512_256.constructor, .{ .name = "SHA512_256Class__construct" }); + @export(SHA512_256.digest, .{ .name = "SHA512_256Prototype__digest" }); + @export(SHA512_256.finalize, .{ .name = "SHA512_256Class__finalize" }); + @export(SHA512_256.getByteLength, .{ .name = "SHA512_256Prototype__getByteLength" }); + @export(SHA512_256.getByteLengthStatic, .{ .name = "SHA512_256Class__getByteLengthStatic" }); + @export(SHA512_256.hash, .{ .name = "SHA512_256Class__hash" }); + @export(SHA512_256.update, .{ .name = "SHA512_256Prototype__update" }); } } }; pub const JSMD5_SHA1 = struct { const MD5_SHA1 = Classes.MD5_SHA1; - const GetterType = fn(*MD5_SHA1, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn(*MD5_SHA1, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn(*MD5_SHA1, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; + const GetterType = fn (*MD5_SHA1, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const SetterType = fn (*MD5_SHA1, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const CallbackType = fn (*MD5_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. @@ -748,8 +657,8 @@ pub const JSMD5_SHA1 = struct { /// Modify the internal ptr to point to a new instance of MD5_SHA1. pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*MD5_SHA1) bool { - JSC.markBinding(); - return MD5_SHA1__dangerouslySetPtr(value, ptr); + JSC.markBinding(); + return MD5_SHA1__dangerouslySetPtr(value, ptr); } extern fn MD5_SHA1__fromJS(JSC.JSValue) ?*MD5_SHA1; @@ -760,53 +669,42 @@ pub const JSMD5_SHA1 = struct { extern fn MD5_SHA1__dangerouslySetPtr(JSC.JSValue, ?*MD5_SHA1) bool; comptime { - - if (@TypeOf(MD5_SHA1.constructor) != (fn(*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*MD5_SHA1)) { - @compileLog("MD5_SHA1.constructor is not a constructor"); + if (@TypeOf(MD5_SHA1.constructor) != (fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*MD5_SHA1)) { + @compileLog("MD5_SHA1.constructor is not a constructor"); } - - if (@TypeOf(MD5_SHA1.finalize) != (fn(*MD5_SHA1) callconv(.C) void)) { - @compileLog("MD5_SHA1.finalize is not a finalizer"); + + if (@TypeOf(MD5_SHA1.finalize) != (fn (*MD5_SHA1) callconv(.C) void)) { + @compileLog("MD5_SHA1.finalize is not a finalizer"); } - - if (@TypeOf(MD5_SHA1.getByteLength) != GetterType) - @compileLog( - "Expected MD5_SHA1.getByteLength to be a getter" - ); - - if (@TypeOf(MD5_SHA1.digest) != CallbackType) - @compileLog( - "Expected MD5_SHA1.digest to be a callback" - ); - if (@TypeOf(MD5_SHA1.update) != CallbackType) - @compileLog( - "Expected MD5_SHA1.update to be a callback" - ); - if (@TypeOf(MD5_SHA1.getByteLengthStatic) != StaticGetterType) - @compileLog( - "Expected MD5_SHA1.getByteLengthStatic to be a static getter" - ); - - if (@TypeOf(MD5_SHA1.hash) != StaticCallbackType) - @compileLog( - "Expected MD5_SHA1.hash to be a static callback" - ); + + if (@TypeOf(MD5_SHA1.getByteLength) != GetterType) + @compileLog("Expected MD5_SHA1.getByteLength to be a getter"); + + if (@TypeOf(MD5_SHA1.digest) != CallbackType) + @compileLog("Expected MD5_SHA1.digest to be a callback"); + if (@TypeOf(MD5_SHA1.update) != CallbackType) + @compileLog("Expected MD5_SHA1.update to be a callback"); + if (@TypeOf(MD5_SHA1.getByteLengthStatic) != StaticGetterType) + @compileLog("Expected MD5_SHA1.getByteLengthStatic to be a static getter"); + + if (@TypeOf(MD5_SHA1.hash) != StaticCallbackType) + @compileLog("Expected MD5_SHA1.hash to be a static callback"); if (!JSC.is_bindgen) { -@export(MD5_SHA1.constructor, .{.name = "MD5_SHA1Class__construct"}); - @export(MD5_SHA1.digest, .{.name = "MD5_SHA1Prototype__digest"}); - @export(MD5_SHA1.finalize, .{.name = "MD5_SHA1Class__finalize"}); - @export(MD5_SHA1.getByteLength, .{.name = "MD5_SHA1Prototype__getByteLength"}); - @export(MD5_SHA1.getByteLengthStatic, .{.name = "MD5_SHA1Class__getByteLengthStatic"}); - @export(MD5_SHA1.hash, .{.name = "MD5_SHA1Class__hash"}); - @export(MD5_SHA1.update, .{.name = "MD5_SHA1Prototype__update"}); + @export(MD5_SHA1.constructor, .{ .name = "MD5_SHA1Class__construct" }); + @export(MD5_SHA1.digest, .{ .name = "MD5_SHA1Prototype__digest" }); + @export(MD5_SHA1.finalize, .{ .name = "MD5_SHA1Class__finalize" }); + @export(MD5_SHA1.getByteLength, .{ .name = "MD5_SHA1Prototype__getByteLength" }); + @export(MD5_SHA1.getByteLengthStatic, .{ .name = "MD5_SHA1Class__getByteLengthStatic" }); + @export(MD5_SHA1.hash, .{ .name = "MD5_SHA1Class__hash" }); + @export(MD5_SHA1.update, .{ .name = "MD5_SHA1Prototype__update" }); } } }; pub const JSRequest = struct { const Request = Classes.Request; - const GetterType = fn(*Request, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn(*Request, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn(*Request, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; + const GetterType = fn (*Request, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const SetterType = fn (*Request, *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. @@ -836,8 +734,8 @@ pub const JSRequest = struct { /// Modify the internal ptr to point to a new instance of Request. pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*Request) bool { - JSC.markBinding(); - return Request__dangerouslySetPtr(value, ptr); + JSC.markBinding(); + return Request__dangerouslySetPtr(value, ptr); } extern fn Request__fromJS(JSC.JSValue) ?*Request; @@ -848,123 +746,88 @@ pub const JSRequest = struct { extern fn Request__dangerouslySetPtr(JSC.JSValue, ?*Request) bool; comptime { - - if (@TypeOf(Request.constructor) != (fn(*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*Request)) { - @compileLog("Request.constructor is not a constructor"); + if (@TypeOf(Request.constructor) != (fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*Request)) { + @compileLog("Request.constructor is not a constructor"); } - - if (@TypeOf(Request.finalize) != (fn(*Request) callconv(.C) void)) { - @compileLog("Request.finalize is not a finalizer"); + + if (@TypeOf(Request.finalize) != (fn (*Request) callconv(.C) void)) { + @compileLog("Request.finalize is not a finalizer"); } - - if (@TypeOf(Request.getArrayBuffer) != CallbackType) - @compileLog( - "Expected Request.getArrayBuffer to be a callback" - ); - if (@TypeOf(Request.getBlob) != CallbackType) - @compileLog( - "Expected Request.getBlob to be a callback" - ); - 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" - ); - 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" - ); - 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" - ); - if (@TypeOf(Request.getUrl) != GetterType) - @compileLog( - "Expected Request.getUrl to be a getter" - ); + + if (@TypeOf(Request.getArrayBuffer) != CallbackType) + @compileLog("Expected Request.getArrayBuffer to be a callback"); + if (@TypeOf(Request.getBlob) != CallbackType) + @compileLog("Expected Request.getBlob to be a callback"); + 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"); + 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"); + 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"); + if (@TypeOf(Request.getUrl) != GetterType) + @compileLog("Expected Request.getUrl to be a getter"); if (!JSC.is_bindgen) { -@export(Request.constructor, .{.name = "RequestClass__construct"}); - @export(Request.doClone, .{.name = "RequestPrototype__doClone"}); - @export(Request.finalize, .{.name = "RequestClass__finalize"}); - @export(Request.getArrayBuffer, .{.name = "RequestPrototype__getArrayBuffer"}); - @export(Request.getBlob, .{.name = "RequestPrototype__getBlob"}); - @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"}); + @export(Request.constructor, .{ .name = "RequestClass__construct" }); + @export(Request.doClone, .{ .name = "RequestPrototype__doClone" }); + @export(Request.finalize, .{ .name = "RequestClass__finalize" }); + @export(Request.getArrayBuffer, .{ .name = "RequestPrototype__getArrayBuffer" }); + @export(Request.getBlob, .{ .name = "RequestPrototype__getBlob" }); + @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 SetterType = fn(*Response, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn(*Response, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; + const GetterType = fn (*Response, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const SetterType = fn (*Response, *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. @@ -994,8 +857,8 @@ pub const JSResponse = struct { /// Modify the internal ptr to point to a new instance of Response. pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*Response) bool { - JSC.markBinding(); - return Response__dangerouslySetPtr(value, ptr); + JSC.markBinding(); + return Response__dangerouslySetPtr(value, ptr); } extern fn Response__fromJS(JSC.JSValue) ?*Response; @@ -1006,100 +869,69 @@ pub const JSResponse = struct { extern fn Response__dangerouslySetPtr(JSC.JSValue, ?*Response) bool; comptime { - - if (@TypeOf(Response.constructor) != (fn(*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*Response)) { - @compileLog("Response.constructor is not a constructor"); + if (@TypeOf(Response.constructor) != (fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*Response)) { + @compileLog("Response.constructor is not a constructor"); } - - if (@TypeOf(Response.finalize) != (fn(*Response) callconv(.C) void)) { - @compileLog("Response.finalize is not a finalizer"); + + if (@TypeOf(Response.finalize) != (fn (*Response) callconv(.C) void)) { + @compileLog("Response.finalize is not a finalizer"); } - - if (@TypeOf(Response.getArrayBuffer) != CallbackType) - @compileLog( - "Expected Response.getArrayBuffer to be a callback" - ); - if (@TypeOf(Response.getBlob) != CallbackType) - @compileLog( - "Expected Response.getBlob to be a 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" - ); - 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" - ); - if (@TypeOf(Response.getOK) != GetterType) - @compileLog( - "Expected Response.getOK 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" - ); - if (@TypeOf(Response.getResponseType) != GetterType) - @compileLog( - "Expected Response.getResponseType to be a getter" - ); - - if (@TypeOf(Response.getURL) != GetterType) - @compileLog( - "Expected Response.getURL to be a getter" - ); - - if (@TypeOf(Response.constructError) != StaticCallbackType) - @compileLog( - "Expected Response.constructError to be a static callback" - ); - if (@TypeOf(Response.constructJSON) != StaticCallbackType) - @compileLog( - "Expected Response.constructJSON to be a static callback" - ); - if (@TypeOf(Response.constructRedirect) != StaticCallbackType) - @compileLog( - "Expected Response.constructRedirect to be a static callback" - ); + + if (@TypeOf(Response.getArrayBuffer) != CallbackType) + @compileLog("Expected Response.getArrayBuffer to be a callback"); + if (@TypeOf(Response.getBlob) != CallbackType) + @compileLog("Expected Response.getBlob to be a 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"); + 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"); + if (@TypeOf(Response.getOK) != GetterType) + @compileLog("Expected Response.getOK 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"); + 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.finalize, .{.name = "ResponseClass__finalize"}); - @export(Response.getArrayBuffer, .{.name = "ResponsePrototype__getArrayBuffer"}); - @export(Response.getBlob, .{.name = "ResponsePrototype__getBlob"}); - @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.getResponseType, .{.name = "ResponsePrototype__getResponseType"}); - @export(Response.getStatus, .{.name = "ResponsePrototype__getStatus"}); - @export(Response.getStatusText, .{.name = "ResponsePrototype__getStatusText"}); - @export(Response.getText, .{.name = "ResponsePrototype__getText"}); - @export(Response.getURL, .{.name = "ResponsePrototype__getURL"}); + @export(Response.constructError, .{ .name = "ResponseClass__constructError" }); + @export(Response.constructJSON, .{ .name = "ResponseClass__constructJSON" }); + @export(Response.constructor, .{ .name = "ResponseClass__construct" }); + @export(Response.constructRedirect, .{ .name = "ResponseClass__constructRedirect" }); + @export(Response.doClone, .{ .name = "ResponsePrototype__doClone" }); + @export(Response.finalize, .{ .name = "ResponseClass__finalize" }); + @export(Response.getArrayBuffer, .{ .name = "ResponsePrototype__getArrayBuffer" }); + @export(Response.getBlob, .{ .name = "ResponsePrototype__getBlob" }); + @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.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" }); } } -};
\ No newline at end of file +}; diff --git a/src/bun.js/scripts/generate-classes.ts b/src/bun.js/scripts/generate-classes.ts index 84b81899d..3f8d4876b 100644 --- a/src/bun.js/scripts/generate-classes.ts +++ b/src/bun.js/scripts/generate-classes.ts @@ -332,6 +332,7 @@ void ${name}::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, ${protot ? `reifyStaticProperties(vm, &${name}::s_info, ${hashTableIdentifier}, *this);` : "" } + putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly); ASSERT(inherits(info())); } diff --git a/src/bun.js/webcore/response.classes.ts b/src/bun.js/webcore/response.classes.ts index 783aa8616..45df255e1 100644 --- a/src/bun.js/webcore/response.classes.ts +++ b/src/bun.js/webcore/response.classes.ts @@ -8,10 +8,6 @@ export default [ klass: {}, JSType: "0b11101110", proto: { - // body: { - // getter: "getBody", - // }, - text: { fn: "getText" }, json: { fn: "getJSON" }, arrayBuffer: { fn: "getArrayBuffer" }, @@ -79,10 +75,6 @@ export default [ cache: true, }, - // body: { - // getter: "getBody", - // }, - text: { fn: "getText" }, json: { fn: "getJSON" }, arrayBuffer: { fn: "getArrayBuffer" }, |