aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/bindings/ZigGlobalObject.cpp
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-02-11 18:11:09 -0800
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-02-11 18:11:09 -0800
commit675529bd0cc7f7753b1d33cf0f14d945bd850654 (patch)
treeb8285ab53fa2b02f1e3a5110b23445bfa998a966 /src/bun.js/bindings/ZigGlobalObject.cpp
parent5528c0fa47399a28e2caadf540f4b385c6bb3f4f (diff)
downloadbun-675529bd0cc7f7753b1d33cf0f14d945bd850654.tar.gz
bun-675529bd0cc7f7753b1d33cf0f14d945bd850654.tar.zst
bun-675529bd0cc7f7753b1d33cf0f14d945bd850654.zip
Fixes https://github.com/oven-sh/bun/issues/2052
Diffstat (limited to 'src/bun.js/bindings/ZigGlobalObject.cpp')
-rw-r--r--src/bun.js/bindings/ZigGlobalObject.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/bun.js/bindings/ZigGlobalObject.cpp b/src/bun.js/bindings/ZigGlobalObject.cpp
index 054e55bcc..ce29e43a6 100644
--- a/src/bun.js/bindings/ZigGlobalObject.cpp
+++ b/src/bun.js/bindings/ZigGlobalObject.cpp
@@ -575,7 +575,7 @@ JSC_DEFINE_CUSTOM_GETTER(JSCloseEvent_getter,
WebCore::JSCloseEvent::getConstructor(JSC::getVM(lexicalGlobalObject), thisObject));
}
-JSC_DEFINE_CUSTOM_GETTER(JSBuffer_getter,
+JSC_DEFINE_CUSTOM_GETTER(JSBuffer_privateGetter,
(JSC::JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue,
JSC::PropertyName))
{
@@ -584,6 +584,9 @@ JSC_DEFINE_CUSTOM_GETTER(JSBuffer_getter,
thisObject->JSBufferConstructor());
}
+GENERATED_CONSTRUCTOR_GETTER(JSBuffer);
+GENERATED_CONSTRUCTOR_SETTER(JSBuffer);
+
GENERATED_CONSTRUCTOR_GETTER(JSTextDecoder);
GENERATED_CONSTRUCTOR_SETTER(JSTextDecoder);
@@ -3221,11 +3224,13 @@ void GlobalObject::addBuiltinGlobals(JSC::VM& vm)
putDirectCustomAccessor(vm, JSC::Identifier::fromString(vm, "CloseEvent"_s), JSC::CustomGetterSetter::create(vm, JSCloseEvent_getter, nullptr),
JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly);
- auto bufferAccessor = JSC::CustomGetterSetter::create(vm, JSBuffer_getter, nullptr);
+ auto bufferAccessor = JSC::CustomGetterSetter::create(vm, JSBuffer_getter, JSBuffer_setter);
+ auto realBufferAccessor = JSC::CustomGetterSetter::create(vm, JSBuffer_privateGetter, nullptr);
+ //
putDirectCustomAccessor(vm, static_cast<JSVMClientData*>(vm.clientData)->builtinNames().BufferPublicName(), bufferAccessor,
- JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly);
- putDirectCustomAccessor(vm, static_cast<JSVMClientData*>(vm.clientData)->builtinNames().BufferPrivateName(), bufferAccessor,
+ JSC::PropertyAttribute::DontDelete | 0);
+ putDirectCustomAccessor(vm, static_cast<JSVMClientData*>(vm.clientData)->builtinNames().BufferPrivateName(), realBufferAccessor,
JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly);
PUT_WEBCORE_GENERATED_CONSTRUCTOR("TextEncoder"_s, JSTextEncoder);