aboutsummaryrefslogtreecommitdiff
path: root/src/javascript/jsc/bindings/ZigGlobalObject.cpp
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2022-04-25 07:09:18 -0700
committerGravatar Jarred Sumner <jarred@jarredsumner.com> 2022-04-25 07:09:18 -0700
commit2c6e5c3fc4a7255eb29f7ae618d2826dd9a7d5e5 (patch)
tree1de65b5cc11b7a479f92f853980d6a8ee640c9e6 /src/javascript/jsc/bindings/ZigGlobalObject.cpp
parent4b4df5095ea756388df4c26683ab0bb222750ed3 (diff)
downloadbun-2c6e5c3fc4a7255eb29f7ae618d2826dd9a7d5e5.tar.gz
bun-2c6e5c3fc4a7255eb29f7ae618d2826dd9a7d5e5.tar.zst
bun-2c6e5c3fc4a7255eb29f7ae618d2826dd9a7d5e5.zip
some of buffer
Diffstat (limited to 'src/javascript/jsc/bindings/ZigGlobalObject.cpp')
-rw-r--r--src/javascript/jsc/bindings/ZigGlobalObject.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/javascript/jsc/bindings/ZigGlobalObject.cpp b/src/javascript/jsc/bindings/ZigGlobalObject.cpp
index a2e4fc42a..8e522ab85 100644
--- a/src/javascript/jsc/bindings/ZigGlobalObject.cpp
+++ b/src/javascript/jsc/bindings/ZigGlobalObject.cpp
@@ -88,6 +88,8 @@
#include "JavaScriptCore/RemoteInspectorServer.h"
+#include "JSBuffer.h"
+
using JSGlobalObject = JSC::JSGlobalObject;
using Exception = JSC::Exception;
using JSValue = JSC::JSValue;
@@ -99,6 +101,7 @@ using SourceOrigin = JSC::SourceOrigin;
using JSObject = JSC::JSObject;
using JSNonFinalObject = JSC::JSNonFinalObject;
namespace JSCastingHelpers = JSC::JSCastingHelpers;
+using JSBuffer = WebCore::JSBuffer;
static bool has_loaded_jsc = false;
@@ -325,6 +328,17 @@ void GlobalObject::setConsole(void* console)
#pragma mark - Globals
+JSC_DECLARE_CUSTOM_GETTER(JSBuffer_getter);
+
+JSC_DEFINE_CUSTOM_GETTER(JSBuffer_getter,
+ (JSC::JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue,
+ JSC::PropertyName))
+{
+ Zig::GlobalObject* thisObject = JSC::jsCast<Zig::GlobalObject*>(lexicalGlobalObject);
+ return JSC::JSValue::encode(
+ WebCore::JSBuffer::getConstructor(JSC::getVM(lexicalGlobalObject), thisObject));
+}
+
JSC_DECLARE_CUSTOM_GETTER(JSDOMURL_getter);
JSC_DEFINE_CUSTOM_GETTER(JSDOMURL_getter,
@@ -874,6 +888,9 @@ void GlobalObject::installAPIGlobals(JSClassRef* globals, int count, JSC::VM& vm
putDirectCustomAccessor(vm, JSC::Identifier::fromString(vm, "ErrorEvent"_s), JSC::CustomGetterSetter::create(vm, JSErrorEvent_getter, nullptr),
JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly);
+ putDirectCustomAccessor(vm, JSC::Identifier::fromString(vm, "Buffer"_s), JSC::CustomGetterSetter::create(vm, JSBuffer_getter, nullptr),
+ JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly);
+
extraStaticGlobals.releaseBuffer();
this->setRemoteDebuggingEnabled(true);