diff options
author | 2022-08-23 20:12:58 +0800 | |
---|---|---|
committer | 2022-08-23 05:12:58 -0700 | |
commit | 9943ca916df208ab6948965a89859b394a8b38ef (patch) | |
tree | cbafb9cca53a4e191a105ec37bd4ef37232ed88a /src/bun.js/modules/BufferModule.h | |
parent | 75a76fb8361fef540fd9025eff2251fc0fa8f4b8 (diff) | |
download | bun-9943ca916df208ab6948965a89859b394a8b38ef.tar.gz bun-9943ca916df208ab6948965a89859b394a8b38ef.tar.zst bun-9943ca916df208ab6948965a89859b394a8b38ef.zip |
add SlowBuffer (#1133)
Diffstat (limited to 'src/bun.js/modules/BufferModule.h')
-rw-r--r-- | src/bun.js/modules/BufferModule.h | 6 |
1 files changed, 6 insertions, 0 deletions
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<JSDOMGlobalObject*>(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()); |