From 9943ca916df208ab6948965a89859b394a8b38ef Mon Sep 17 00:00:00 2001 From: Zilin Zhu Date: Tue, 23 Aug 2022 20:12:58 +0800 Subject: add SlowBuffer (#1133) --- src/bun.js/modules/BufferModule.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/bun.js/modules/BufferModule.h') diff --git a/src/bun.js/modules/BufferModule.h b/src/bun.js/modules/BufferModule.h index 12d4c54c8..9032f0d2e 100644 --- a/src/bun.js/modules/BufferModule.h +++ b/src/bun.js/modules/BufferModule.h @@ -1,4 +1,5 @@ #include "../bindings/ZigGlobalObject.h" +#include "../bindings/JSBuffer.h" #include "JavaScriptCore/JSGlobalObject.h" namespace Zig { @@ -10,6 +11,11 @@ inline void generateBufferSourceCode(JSC::JSGlobalObject* lexicalGlobalObject, J exportNames.append(JSC::Identifier::fromString(vm, "Buffer"_s)); exportValues.append(WebCore::JSBuffer::getConstructor(vm, globalObject)); + auto* slowBuffer = JSC::JSFunction::create(vm, globalObject, 0, "SlowBuffer"_s, WebCore::constructSlowBuffer, ImplementationVisibility::Public, NoIntrinsic, WebCore::constructSlowBuffer); + slowBuffer->putDirect(vm, vm.propertyNames->prototype, WebCore::JSBuffer::prototype(vm, *jsCast(lexicalGlobalObject)), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum | JSC::PropertyAttribute::DontDelete); + exportNames.append(JSC::Identifier::fromString(vm, "SlowBuffer"_s)); + exportValues.append(slowBuffer); + // substitute after JSBlob is implemented. exportNames.append(JSC::Identifier::fromString(vm, "Blob"_s)); exportValues.append(JSC::jsUndefined()); -- cgit v1.2.3