diff options
Diffstat (limited to 'src/bun.js/builtins')
-rw-r--r-- | src/bun.js/builtins/cpp/JSBufferConstructorBuiltins.cpp | 10 | ||||
-rw-r--r-- | src/bun.js/builtins/cpp/JSBufferPrototypeBuiltins.h | 9 | ||||
-rw-r--r-- | src/bun.js/builtins/js/JSBufferConstructor.js | 8 |
3 files changed, 14 insertions, 13 deletions
diff --git a/src/bun.js/builtins/cpp/JSBufferConstructorBuiltins.cpp b/src/bun.js/builtins/cpp/JSBufferConstructorBuiltins.cpp index 7025ea8b8..a38be91a7 100644 --- a/src/bun.js/builtins/cpp/JSBufferConstructorBuiltins.cpp +++ b/src/bun.js/builtins/cpp/JSBufferConstructorBuiltins.cpp @@ -51,7 +51,7 @@ namespace WebCore { const JSC::ConstructAbility s_jsBufferConstructorFromCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; const JSC::ConstructorKind s_jsBufferConstructorFromCodeConstructorKind = JSC::ConstructorKind::None; const JSC::ImplementationVisibility s_jsBufferConstructorFromCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_jsBufferConstructorFromCodeLength = 1984; +const int s_jsBufferConstructorFromCodeLength = 1843; static const JSC::Intrinsic s_jsBufferConstructorFromCodeIntrinsic = JSC::NoIntrinsic; const char* const s_jsBufferConstructorFromCode = "(function (items) {\n" \ @@ -60,16 +60,12 @@ const char* const s_jsBufferConstructorFromCode = " if (!@isConstructor(this))\n" \ " @throwTypeError(\"Buffer.from requires |this| to be a constructor\");\n" \ "\n" \ - " if (@isUndefinedOrNull(items))\n" \ + " if (@isUndefinedOrNull(items)) {\n" \ " @throwTypeError(\n" \ " \"The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object.\",\n" \ " );\n" \ - "\n" \ - " if (@argumentCount() === 1 && @isTypedArrayView(items)) {\n" \ - " var out = this.allocUnsafe(items.byteLength);\n" \ - " out.copy(items);\n" \ - " return out;\n" \ " }\n" \ + " \n" \ "\n" \ " //\n" \ " if (\n" \ diff --git a/src/bun.js/builtins/cpp/JSBufferPrototypeBuiltins.h b/src/bun.js/builtins/cpp/JSBufferPrototypeBuiltins.h index 75de0fce2..a3b17f7cc 100644 --- a/src/bun.js/builtins/cpp/JSBufferPrototypeBuiltins.h +++ b/src/bun.js/builtins/cpp/JSBufferPrototypeBuiltins.h @@ -322,6 +322,11 @@ extern const int s_jsBufferPrototypeSliceCodeLength; extern const JSC::ConstructAbility s_jsBufferPrototypeSliceCodeConstructAbility; extern const JSC::ConstructorKind s_jsBufferPrototypeSliceCodeConstructorKind; extern const JSC::ImplementationVisibility s_jsBufferPrototypeSliceCodeImplementationVisibility; +extern const char* const s_jsBufferPrototypeParentCode; +extern const int s_jsBufferPrototypeParentCodeLength; +extern const JSC::ConstructAbility s_jsBufferPrototypeParentCodeConstructAbility; +extern const JSC::ConstructorKind s_jsBufferPrototypeParentCodeConstructorKind; +extern const JSC::ImplementationVisibility s_jsBufferPrototypeParentCodeImplementationVisibility; extern const char* const s_jsBufferPrototypeInitializeBunBufferCode; extern const int s_jsBufferPrototypeInitializeBunBufferCodeLength; extern const JSC::ConstructAbility s_jsBufferPrototypeInitializeBunBufferCodeConstructAbility; @@ -384,6 +389,7 @@ extern const JSC::ImplementationVisibility s_jsBufferPrototypeInitializeBunBuffe macro(hexSlice, jsBufferPrototypeHexSlice, 2) \ macro(toJSON, jsBufferPrototypeToJSON, 0) \ macro(slice, jsBufferPrototypeSlice, 2) \ + macro(parent, jsBufferPrototypeParent, 0) \ macro(initializeBunBuffer, jsBufferPrototypeInitializeBunBuffer, 1) \ #define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_SETBIGUINT64 1 @@ -441,6 +447,7 @@ extern const JSC::ImplementationVisibility s_jsBufferPrototypeInitializeBunBuffe #define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_HEXSLICE 1 #define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_TOJSON 1 #define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_SLICE 1 +#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_PARENT 1 #define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_INITIALIZEBUNBUFFER 1 #define WEBCORE_FOREACH_JSBUFFERPROTOTYPE_BUILTIN_CODE(macro) \ @@ -499,6 +506,7 @@ extern const JSC::ImplementationVisibility s_jsBufferPrototypeInitializeBunBuffe macro(jsBufferPrototypeHexSliceCode, hexSlice, ASCIILiteral(), s_jsBufferPrototypeHexSliceCodeLength) \ macro(jsBufferPrototypeToJSONCode, toJSON, ASCIILiteral(), s_jsBufferPrototypeToJSONCodeLength) \ macro(jsBufferPrototypeSliceCode, slice, ASCIILiteral(), s_jsBufferPrototypeSliceCodeLength) \ + macro(jsBufferPrototypeParentCode, parent, "get parent"_s, s_jsBufferPrototypeParentCodeLength) \ macro(jsBufferPrototypeInitializeBunBufferCode, initializeBunBuffer, ASCIILiteral(), s_jsBufferPrototypeInitializeBunBufferCodeLength) \ #define WEBCORE_FOREACH_JSBUFFERPROTOTYPE_BUILTIN_FUNCTION_NAME(macro) \ @@ -513,6 +521,7 @@ extern const JSC::ImplementationVisibility s_jsBufferPrototypeInitializeBunBuffe macro(initializeBunBuffer) \ macro(latin1Slice) \ macro(latin1Write) \ + macro(parent) \ macro(readBigInt64BE) \ macro(readBigInt64LE) \ macro(readBigUInt64BE) \ diff --git a/src/bun.js/builtins/js/JSBufferConstructor.js b/src/bun.js/builtins/js/JSBufferConstructor.js index 4c3650360..10994394e 100644 --- a/src/bun.js/builtins/js/JSBufferConstructor.js +++ b/src/bun.js/builtins/js/JSBufferConstructor.js @@ -31,16 +31,12 @@ function from(items) { if (!@isConstructor(this)) @throwTypeError("Buffer.from requires |this| to be a constructor"); - if (@isUndefinedOrNull(items)) + if (@isUndefinedOrNull(items)) { @throwTypeError( "The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object.", ); - - if (@argumentCount() === 1 && @isTypedArrayView(items)) { - var out = this.allocUnsafe(items.byteLength); - out.copy(items); - return out; } + // TODO: figure out why private symbol not found if ( |