aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2022-11-25 00:10:31 -0800
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2022-11-25 00:10:31 -0800
commit0e900c8ca9864f1b69f7a6d2f4994cd84a294ced (patch)
tree581652012381fdf40b713e00a3c20fb2cbfa82bd /src/bun.js
parent61673fa705478f8bfcd24aa308480a0e30e35317 (diff)
downloadbun-0e900c8ca9864f1b69f7a6d2f4994cd84a294ced.tar.gz
bun-0e900c8ca9864f1b69f7a6d2f4994cd84a294ced.tar.zst
bun-0e900c8ca9864f1b69f7a6d2f4994cd84a294ced.zip
Upgrade WebKit
Diffstat (limited to 'src/bun.js')
m---------src/bun.js/WebKit0
-rw-r--r--src/bun.js/bindings/JSBuffer.cpp21
-rw-r--r--src/bun.js/bindings/JSBufferList.cpp19
-rw-r--r--src/bun.js/bindings/JSStringDecoder.cpp53
-rw-r--r--src/bun.js/bindings/headers-cpp.h2
-rw-r--r--src/bun.js/bindings/sizes.zig18
-rw-r--r--src/bun.js/bindings/webcore/JSDOMConvertBufferSource.h4
-rw-r--r--src/bun.js/bindings/webcore/JSDOMConvertUnion.h21
-rw-r--r--src/bun.js/bindings/webcore/ReadableStreamDefaultController.cpp2
9 files changed, 82 insertions, 58 deletions
diff --git a/src/bun.js/WebKit b/src/bun.js/WebKit
-Subproject 4ffb9be0393081908e18bd6f11eac6e5a5d5b28
+Subproject 6e5bbee4a3f5fe81a095067e5d0f8d8f891f79d
diff --git a/src/bun.js/bindings/JSBuffer.cpp b/src/bun.js/bindings/JSBuffer.cpp
index d28976f48..d2d8c281f 100644
--- a/src/bun.js/bindings/JSBuffer.cpp
+++ b/src/bun.js/bindings/JSBuffer.cpp
@@ -138,9 +138,9 @@ JSC::EncodedJSValue JSBuffer__bufferFromPointerAndLengthAndDeinit(JSC::JSGlobalO
bytesDeallocator(p, ctx);
}));
- uint8Array = JSC::JSUint8Array::create(lexicalGlobalObject, lexicalGlobalObject->typedArrayStructure(JSC::TypeUint8), WTFMove(buffer), 0, length);
+ uint8Array = JSC::JSUint8Array::create(lexicalGlobalObject, lexicalGlobalObject->typedArrayStructure(JSC::TypeUint8, false), WTFMove(buffer), 0, length);
} else {
- uint8Array = JSC::JSUint8Array::create(lexicalGlobalObject, lexicalGlobalObject->typedArrayStructure(JSC::TypeUint8), 0);
+ uint8Array = JSC::JSUint8Array::create(lexicalGlobalObject, lexicalGlobalObject->typedArrayStructure(JSC::TypeUint8, false), 0);
}
toBuffer(lexicalGlobalObject, uint8Array);
@@ -170,9 +170,9 @@ static inline JSC::JSUint8Array* JSBuffer__bufferFromLengthAsArray(JSC::JSGlobal
return nullptr;
}
- uint8Array = JSC::JSUint8Array::create(lexicalGlobalObject, lexicalGlobalObject->typedArrayStructure(JSC::TypeUint8), WTFMove(arrayBuffer), 0, length);
+ uint8Array = JSC::JSUint8Array::create(lexicalGlobalObject, lexicalGlobalObject->typedArrayStructure(JSC::TypeUint8, false), WTFMove(arrayBuffer), 0, length);
} else {
- uint8Array = JSC::JSUint8Array::create(lexicalGlobalObject, lexicalGlobalObject->typedArrayStructure(JSC::TypeUint8), 0);
+ uint8Array = JSC::JSUint8Array::create(lexicalGlobalObject, lexicalGlobalObject->typedArrayStructure(JSC::TypeUint8, false), 0);
}
toBuffer(lexicalGlobalObject, uint8Array);
@@ -207,9 +207,9 @@ EncodedJSValue JSBuffer__bufferFromPointerAndLength(JSC::JSGlobalObject* lexical
if (LIKELY(length > 0)) {
auto buffer = ArrayBuffer::create(ptr, length);
- uint8Array = JSC::JSUint8Array::create(lexicalGlobalObject, lexicalGlobalObject->typedArrayStructure(JSC::TypeUint8), WTFMove(buffer), 0, length);
+ uint8Array = JSC::JSUint8Array::create(lexicalGlobalObject, lexicalGlobalObject->typedArrayStructure(JSC::TypeUint8, false), WTFMove(buffer), 0, length);
} else {
- uint8Array = JSC::JSUint8Array::create(lexicalGlobalObject, lexicalGlobalObject->typedArrayStructure(JSC::TypeUint8), 0);
+ uint8Array = JSC::JSUint8Array::create(lexicalGlobalObject, lexicalGlobalObject->typedArrayStructure(JSC::TypeUint8, false), 0);
}
toBuffer(lexicalGlobalObject, uint8Array);
@@ -287,11 +287,10 @@ static EncodedJSValue constructFromEncoding(JSGlobalObject* lexicalGlobalObject,
return result;
}
-static inline JSC::EncodedJSValue constructBufferFromStringAndEncoding(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSBuffer>::ClassParameter castedThis)
+static inline JSC::EncodedJSValue constructBufferFromStringAndEncoding(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame)
{
auto& vm = JSC::getVM(lexicalGlobalObject);
uint32_t offset = 0;
- uint32_t length = castedThis->length();
WebCore::BufferEncodingType encoding = WebCore::BufferEncodingType::utf8;
auto scope = DECLARE_THROW_SCOPE(vm);
@@ -335,7 +334,7 @@ static inline JSC::EncodedJSValue jsBufferConstructorFunction_allocBody(JSC::JSG
return JSValue::encode(jsUndefined());
}
- auto uint8Array = JSC::JSUint8Array::create(lexicalGlobalObject, lexicalGlobalObject->typedArrayStructure(JSC::TypeUint8), WTFMove(arrayBuffer), 0, length);
+ auto uint8Array = JSC::JSUint8Array::create(lexicalGlobalObject, lexicalGlobalObject->typedArrayStructure(JSC::TypeUint8, false), WTFMove(arrayBuffer), 0, length);
toBuffer(lexicalGlobalObject, uint8Array);
RELEASE_AND_RETURN(throwScope, JSC::JSValue::encode(uint8Array));
@@ -1324,7 +1323,7 @@ template<> EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSBufferConstructor::construc
if (distinguishingArg.isNumber()) {
RELEASE_AND_RETURN(throwScope, (constructBufferFromLength(lexicalGlobalObject, callFrame)));
} else if (distinguishingArg.isString()) {
- RELEASE_AND_RETURN(throwScope, (constructBufferFromStringAndEncoding(lexicalGlobalObject, callFrame, nullptr)));
+ RELEASE_AND_RETURN(throwScope, (constructBufferFromStringAndEncoding(lexicalGlobalObject, callFrame)));
}
JSC::JSObject* constructor = lexicalGlobalObject->m_typedArrayUint8.constructor(lexicalGlobalObject);
@@ -1647,7 +1646,7 @@ void toBuffer(JSC::JSGlobalObject* lexicalGlobalObject, JSC::JSUint8Array* uint8
object->setPrototypeDirect(vm, WebCore::JSBuffer::prototype(vm, *JSC::jsCast<WebCore::JSDOMGlobalObject*>(lexicalGlobalObject)));
- auto* dataView = JSC::JSDataView::create(lexicalGlobalObject, lexicalGlobalObject->typedArrayStructure(JSC::TypeDataView), uint8Array->possiblySharedBuffer(), uint8Array->byteOffset(), uint8Array->length());
+ auto* dataView = JSC::JSDataView::create(lexicalGlobalObject, lexicalGlobalObject->typedArrayStructure(JSC::TypeDataView, false), uint8Array->possiblySharedBuffer(), uint8Array->byteOffset(), uint8Array->length());
// putDirectWithTransition doesn't work here
object->putDirectWithoutTransition(vm, clientData->builtinNames().dataViewPublicName(), dataView, JSC::PropertyAttribute::DontEnum | JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly);
}
diff --git a/src/bun.js/bindings/JSBufferList.cpp b/src/bun.js/bindings/JSBufferList.cpp
index 10dd3c794..8ba02829a 100644
--- a/src/bun.js/bindings/JSBufferList.cpp
+++ b/src/bun.js/bindings/JSBufferList.cpp
@@ -38,7 +38,7 @@ JSC::JSValue JSBufferList::concat(JSC::VM& vm, JSC::JSGlobalObject* lexicalGloba
JSC::JSUint8Array* uint8Array = nullptr;
if (length() == 0) {
// Buffer.alloc(0)
- uint8Array = JSC::JSUint8Array::create(lexicalGlobalObject, lexicalGlobalObject->typedArrayStructure(JSC::TypeUint8), 0);
+ uint8Array = JSC::JSUint8Array::create(lexicalGlobalObject, lexicalGlobalObject->typedArrayStructure(JSC::TypeUint8, false), 0);
toBuffer(lexicalGlobalObject, uint8Array);
RELEASE_AND_RETURN(throwScope, uint8Array);
}
@@ -47,7 +47,7 @@ JSC::JSValue JSBufferList::concat(JSC::VM& vm, JSC::JSGlobalObject* lexicalGloba
if (UNLIKELY(!arrayBuffer)) {
return throwOutOfMemoryError(lexicalGlobalObject, throwScope);
}
- uint8Array = JSC::JSUint8Array::create(lexicalGlobalObject, lexicalGlobalObject->typedArrayStructure(JSC::TypeUint8), WTFMove(arrayBuffer), 0, n);
+ uint8Array = JSC::JSUint8Array::create(lexicalGlobalObject, lexicalGlobalObject->typedArrayStructure(JSC::TypeUint8, false), WTFMove(arrayBuffer), 0, n);
toBuffer(lexicalGlobalObject, uint8Array);
size_t i = 0;
@@ -56,7 +56,7 @@ JSC::JSValue JSBufferList::concat(JSC::VM& vm, JSC::JSGlobalObject* lexicalGloba
if (!array)
continue;
size_t length = array->byteLength();
- uint8Array->set(lexicalGlobalObject, i, array, 0, length);
+ uint8Array->setFromTypedArray(lexicalGlobalObject, i, array, 0, length, JSC::CopyType::Unobservable);
}
RELEASE_AND_RETURN(throwScope, uint8Array);
@@ -126,7 +126,7 @@ JSC::JSValue JSBufferList::_getBuffer(JSC::VM& vm, JSC::JSGlobalObject* lexicalG
JSC::JSUint8Array* uint8Array = nullptr;
if (n == 0) {
// Buffer.alloc(0)
- uint8Array = JSC::JSUint8Array::create(lexicalGlobalObject, lexicalGlobalObject->typedArrayStructure(JSC::TypeUint8), 0);
+ uint8Array = JSC::JSUint8Array::create(lexicalGlobalObject, lexicalGlobalObject->typedArrayStructure(JSC::TypeUint8, false), 0);
toBuffer(lexicalGlobalObject, uint8Array);
RELEASE_AND_RETURN(throwScope, uint8Array);
}
@@ -135,7 +135,7 @@ JSC::JSValue JSBufferList::_getBuffer(JSC::VM& vm, JSC::JSGlobalObject* lexicalG
if (UNLIKELY(!arrayBuffer)) {
return throwTypeError(lexicalGlobalObject, throwScope);
}
- uint8Array = JSC::JSUint8Array::create(lexicalGlobalObject, lexicalGlobalObject->typedArrayStructure(JSC::TypeUint8), WTFMove(arrayBuffer), 0, n);
+ uint8Array = JSC::JSUint8Array::create(lexicalGlobalObject, lexicalGlobalObject->typedArrayStructure(JSC::TypeUint8, false), WTFMove(arrayBuffer), 0, n);
toBuffer(lexicalGlobalObject, uint8Array);
size_t offset = 0;
@@ -146,7 +146,7 @@ JSC::JSValue JSBufferList::_getBuffer(JSC::VM& vm, JSC::JSGlobalObject* lexicalG
}
size_t length = array->byteLength();
if (length > n) {
- uint8Array->set(lexicalGlobalObject, offset, array, 0, n);
+ uint8Array->setFromTypedArray(lexicalGlobalObject, offset, array, 0, n, JSC::CopyType::Unobservable);
// create a new array of size length - n.
// is there a faster way to do this?
auto arrayBuffer = JSC::ArrayBuffer::tryCreateUninitialized(length - n, 1);
@@ -154,13 +154,13 @@ JSC::JSValue JSBufferList::_getBuffer(JSC::VM& vm, JSC::JSGlobalObject* lexicalG
return throwOutOfMemoryError(lexicalGlobalObject, throwScope);
}
JSC::JSUint8Array* newArray = JSC::JSUint8Array::create(
- lexicalGlobalObject, lexicalGlobalObject->typedArrayStructure(JSC::TypeUint8), WTFMove(arrayBuffer), 0, length - n);
+ lexicalGlobalObject, lexicalGlobalObject->typedArrayStructure(JSC::TypeUint8, false), WTFMove(arrayBuffer), 0, length - n);
toBuffer(lexicalGlobalObject, newArray);
memcpy(newArray->typedVector(), array->typedVector() + n, length - n);
iter->set(vm, this, newArray);
} else {
- uint8Array->set(lexicalGlobalObject, offset, array, 0, length);
+ uint8Array->setFromTypedArray(lexicalGlobalObject, offset, array, 0, length, JSC::CopyType::Unobservable);
m_deque.removeFirst();
}
n -= static_cast<int32_t>(length);
@@ -364,7 +364,8 @@ void JSBufferListConstructor::finishCreation(VM& vm, JSC::JSGlobalObject* global
ASSERT(inherits(info()));
}
-JSBufferListConstructor* JSBufferListConstructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSBufferListPrototype* prototype) {
+JSBufferListConstructor* JSBufferListConstructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSBufferListPrototype* prototype)
+{
JSBufferListConstructor* ptr = new (NotNull, JSC::allocateCell<JSBufferListConstructor>(vm)) JSBufferListConstructor(vm, structure, construct);
ptr->finishCreation(vm, globalObject, prototype);
return ptr;
diff --git a/src/bun.js/bindings/JSStringDecoder.cpp b/src/bun.js/bindings/JSStringDecoder.cpp
index c4daad1dd..024d9fb62 100644
--- a/src/bun.js/bindings/JSStringDecoder.cpp
+++ b/src/bun.js/bindings/JSStringDecoder.cpp
@@ -41,7 +41,7 @@ JSC::JSValue JSStringDecoder::fillLast(JSC::VM& vm, JSC::JSGlobalObject* globalO
RELEASE_AND_RETURN(throwScope, JSC::jsString(vm, WTF::String(u"\uFFFD", 1)));
}
if (m_lastNeed > 2 && length > 2) {
- if ((bufPtr[2] & 0xC0) != 0x80) {
+ if ((bufPtr[2] & 0xC0) != 0x80) {
m_lastNeed = 2;
RELEASE_AND_RETURN(throwScope, JSC::jsString(vm, WTF::String(u"\uFFFD", 1)));
}
@@ -60,11 +60,16 @@ JSC::JSValue JSStringDecoder::fillLast(JSC::VM& vm, JSC::JSGlobalObject* globalO
// Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a
// continuation byte. If an invalid byte is detected, -2 is returned.
-int8_t utf8CheckByte(uint8_t byte) {
- if (byte <= 0x7F) return 0;
- else if ((byte >> 5) == 0x06) return 2;
- else if ((byte >> 4) == 0x0E) return 3;
- else if ((byte >> 3) == 0x1E) return 4;
+int8_t utf8CheckByte(uint8_t byte)
+{
+ if (byte <= 0x7F)
+ return 0;
+ else if ((byte >> 5) == 0x06)
+ return 2;
+ else if ((byte >> 4) == 0x0E)
+ return 3;
+ else if ((byte >> 3) == 0x1E)
+ return 4;
return (byte >> 6) == 0x02 ? -1 : -2;
}
@@ -74,23 +79,31 @@ int8_t utf8CheckByte(uint8_t byte) {
uint8_t JSStringDecoder::utf8CheckIncomplete(uint8_t* bufPtr, uint32_t length, uint32_t i)
{
uint32_t j = length - 1;
- if (j < i) return 0;
+ if (j < i)
+ return 0;
int8_t nb = utf8CheckByte(bufPtr[j]);
if (nb >= 0) {
- if (nb > 0) m_lastNeed = nb - 1;
+ if (nb > 0)
+ m_lastNeed = nb - 1;
return nb;
}
- if (--j < i || nb == -2) return 0;
+ if (--j < i || nb == -2)
+ return 0;
nb = utf8CheckByte(bufPtr[j]);
if (nb >= 0) {
- if (nb > 0) m_lastNeed = nb - 2;
+ if (nb > 0)
+ m_lastNeed = nb - 2;
return nb;
}
- if (--j < i || nb == -2) return 0;
+ if (--j < i || nb == -2)
+ return 0;
nb = utf8CheckByte(bufPtr[j]);
if (nb >= 0) {
if (nb > 0) {
- if (nb == 2) nb = 0;else m_lastNeed = nb - 3;
+ if (nb == 2)
+ nb = 0;
+ else
+ m_lastNeed = nb - 3;
}
return nb;
}
@@ -152,7 +165,6 @@ JSC::JSValue JSStringDecoder::text(JSC::VM& vm, JSC::JSGlobalObject* globalObjec
RETURN_IF_EXCEPTION(throwScope, JSC::jsUndefined());
}
}
-
}
JSC::JSValue JSStringDecoder::write(JSC::VM& vm, JSC::JSGlobalObject* globalObject, uint8_t* bufPtr, uint32_t length)
@@ -339,7 +351,7 @@ static JSC_DEFINE_CUSTOM_GETTER(jsStringDecoder_lastChar, (JSGlobalObject * lexi
auto throwScope = DECLARE_THROW_SCOPE(vm);
JSStringDecoder* thisObject = jsCast<JSStringDecoder*>(JSValue::decode(thisValue));
auto buffer = ArrayBuffer::createFromBytes(thisObject->m_lastChar, 4, nullptr);
- JSC::JSUint8Array* uint8Array = JSC::JSUint8Array::create(lexicalGlobalObject, lexicalGlobalObject->typedArrayStructure(JSC::TypeUint8), WTFMove(buffer), 0, 4);
+ JSC::JSUint8Array* uint8Array = JSC::JSUint8Array::create(lexicalGlobalObject, lexicalGlobalObject->typedArrayStructure(JSC::TypeUint8, true), WTFMove(buffer), 0, 4);
toBuffer(lexicalGlobalObject, uint8Array);
RELEASE_AND_RETURN(throwScope, JSC::JSValue::encode(uint8Array));
}
@@ -385,7 +397,8 @@ void JSStringDecoderConstructor::finishCreation(VM& vm, JSC::JSGlobalObject* glo
ASSERT(inherits(info()));
}
-JSStringDecoderConstructor* JSStringDecoderConstructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSStringDecoderPrototype* prototype) {
+JSStringDecoderConstructor* JSStringDecoderConstructor::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, JSStringDecoderPrototype* prototype)
+{
JSStringDecoderConstructor* ptr = new (NotNull, JSC::allocateCell<JSStringDecoderConstructor>(vm)) JSStringDecoderConstructor(vm, structure, construct);
ptr->finishCreation(vm, globalObject, prototype);
return ptr;
@@ -396,11 +409,11 @@ JSC::EncodedJSValue JSStringDecoderConstructor::construct(JSC::JSGlobalObject* l
JSC::VM& vm = lexicalGlobalObject->vm();
auto encoding = BufferEncodingType::utf8;
if (callFrame->argumentCount() > 0) {
- auto encoding_ = callFrame->argument(0).toString(lexicalGlobalObject);
- std::optional<BufferEncodingType> opt = parseEnumeration<BufferEncodingType>(*lexicalGlobalObject, encoding_);
- if (opt.has_value()) {
- encoding = opt.value();
- }
+ auto encoding_ = callFrame->argument(0).toString(lexicalGlobalObject);
+ std::optional<BufferEncodingType> opt = parseEnumeration<BufferEncodingType>(*lexicalGlobalObject, encoding_);
+ if (opt.has_value()) {
+ encoding = opt.value();
+ }
}
JSStringDecoder* stringDecoder = JSStringDecoder::create(
vm, lexicalGlobalObject, reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject)->JSStringDecoderStructure(), encoding);
diff --git a/src/bun.js/bindings/headers-cpp.h b/src/bun.js/bindings/headers-cpp.h
index e5f4cb8f8..684656083 100644
--- a/src/bun.js/bindings/headers-cpp.h
+++ b/src/bun.js/bindings/headers-cpp.h
@@ -1,4 +1,4 @@
-//-- AUTOGENERATED FILE -- 1669191472
+//-- AUTOGENERATED FILE -- 1669352137
// clang-format off
#pragma once
diff --git a/src/bun.js/bindings/sizes.zig b/src/bun.js/bindings/sizes.zig
index d63972fe4..136eb9f61 100644
--- a/src/bun.js/bindings/sizes.zig
+++ b/src/bun.js/bindings/sizes.zig
@@ -1,4 +1,4 @@
-// Auto-generated by src/bun.js/headergen/sizegen.cpp at 2022-08-17 02:46:1660729585.
+// Auto-generated by src/bun.js/headergen/sizegen.cpp at 2022-11-24 20:03:1669349010.
// These are the byte sizes for the different object types with bindings in JavaScriptCore.
// This allows us to safely return stack allocated C++ types to Zig.
// It is only safe to do this when these sizes are correct.
@@ -6,20 +6,20 @@
// 1. We can't dynamically link JavaScriptCore
// 2. It's important that this is run whenever JavaScriptCore is updated or the bindings on the Zig side change.
// Failure to do so will lead to undefined behavior and probably some frustrated people.
-// --- Regenerate this: ---
+// --- Regenerate this: ---
// 1. "make headers"
// 2. "make sizegen"
// 3. "make headers"
// ------------------------
// You can verify the numbers written in this file at runtime via the `extern`d types
-// Run "headers" twice because it uses these values in the output. That's how all the bJSC__.* types are created - from these values.
+// Run "headers" twice because it uses these values in the output. That's how all the bJSC__.* types are created - from these values.
pub const JSC__JSObject = 16;
pub const JSC__JSObject_align = 8;
pub const WebCore__DOMURL = 112;
pub const WebCore__DOMURL_align = 8;
-pub const WebCore__FetchHeaders = 40;
+pub const WebCore__FetchHeaders = 56;
pub const WebCore__FetchHeaders_align = 8;
-pub const SystemError = 72;
+pub const SystemError = 80;
pub const SystemError_align = 8;
pub const JSC__JSCell = 8;
pub const JSC__JSCell_align = 4;
@@ -29,7 +29,7 @@ pub const Inspector__ScriptArguments = 32;
pub const Inspector__ScriptArguments_align = 8;
pub const JSC__JSModuleLoader = 16;
pub const JSC__JSModuleLoader_align = 8;
-pub const JSC__JSModuleRecord = 208;
+pub const JSC__JSModuleRecord = 216;
pub const JSC__JSModuleRecord_align = 8;
pub const JSC__JSPromise = 32;
pub const JSC__JSPromise_align = 8;
@@ -41,7 +41,7 @@ pub const JSC__SourceCode = 24;
pub const JSC__SourceCode_align = 8;
pub const JSC__JSFunction = 32;
pub const JSC__JSFunction_align = 8;
-pub const JSC__JSGlobalObject = 2840;
+pub const JSC__JSGlobalObject = 3128;
pub const JSC__JSGlobalObject_align = 8;
pub const WTF__URL = 40;
pub const WTF__URL_align = 8;
@@ -53,7 +53,7 @@ pub const JSC__PropertyName = 8;
pub const JSC__PropertyName_align = 8;
pub const JSC__Exception = 40;
pub const JSC__Exception_align = 8;
-pub const JSC__VM = 52008;
+pub const JSC__VM = 52176;
pub const JSC__VM_align = 8;
pub const JSC__ThrowScope = 8;
pub const JSC__ThrowScope_align = 8;
@@ -67,7 +67,7 @@ pub const WTF__ExternalStringImpl = 40;
pub const WTF__ExternalStringImpl_align = 8;
pub const WTF__StringView = 16;
pub const WTF__StringView_align = 8;
-pub const Zig__GlobalObject = 4704;
+pub const Zig__GlobalObject = 6496;
pub const Zig__GlobalObject_align = 8;
pub const Bun_FFI_PointerOffsetToArgumentsList = 6;
pub const Bun_FFI_PointerOffsetToTypedArrayVector = 16;
diff --git a/src/bun.js/bindings/webcore/JSDOMConvertBufferSource.h b/src/bun.js/bindings/webcore/JSDOMConvertBufferSource.h
index bab958a4f..211ba8411 100644
--- a/src/bun.js/bindings/webcore/JSDOMConvertBufferSource.h
+++ b/src/bun.js/bindings/webcore/JSDOMConvertBufferSource.h
@@ -29,7 +29,7 @@
#include "IDLTypes.h"
#include "JSDOMConvertBase.h"
#include "JSDOMWrapperCache.h"
-#include "JavaScriptCore/JSTypedArrays.h"
+#include <JavaScriptCore/JSTypedArrays.h>
namespace WebCore {
@@ -108,7 +108,7 @@ inline JSC::JSValue toJS(JSC::JSGlobalObject* lexicalGlobalObject, JSC::JSGlobal
return toJS(lexicalGlobalObject, globalObject, *view);
}
-inline RefPtr<JSC::ArrayBufferView> toPossiblySharedArrayBufferView(JSC::VM& vm, JSC::JSValue value)
+inline RefPtr<JSC::ArrayBufferView> toPossiblySharedArrayBufferView(JSC::VM&, JSC::JSValue value)
{
auto* wrapper = JSC::jsDynamicCast<JSC::JSArrayBufferView*>(value);
if (!wrapper)
diff --git a/src/bun.js/bindings/webcore/JSDOMConvertUnion.h b/src/bun.js/bindings/webcore/JSDOMConvertUnion.h
index 75ce6f86a..2d4c5e5f9 100644
--- a/src/bun.js/bindings/webcore/JSDOMConvertUnion.h
+++ b/src/bun.js/bindings/webcore/JSDOMConvertUnion.h
@@ -29,10 +29,9 @@
#include "JSDOMBinding.h"
#include "JSDOMConvertBase.h"
#include "JSDOMConvertBufferSource.h"
-#include "JSDOMConvertBufferSource+JSBuffer.h"
#include "JSDOMConvertInterface.h"
#include "JSDOMConvertNull.h"
-#include "JavaScriptCore/IteratorOperations.h"
+#include <JavaScriptCore/IteratorOperations.h>
#include <variant>
namespace WebCore {
@@ -197,7 +196,7 @@ template<typename... T> struct Converter<IDLUnion<T...>> : DefaultConverter<IDLU
if (returnValue)
return;
- using Type = typename WTF::RemoveCVAndReference<decltype(type)>::type::type;
+ using Type = typename std::remove_cvref_t<decltype(type)>::type;
using ImplementationType = typename Type::ImplementationType;
using RawType = typename Type::RawType;
@@ -269,7 +268,7 @@ template<typename... T> struct Converter<IDLUnion<T...>> : DefaultConverter<IDLU
if (returnValue)
return;
- using Type = typename WTF::RemoveCVAndReference<decltype(type)>::type::type;
+ using Type = typename std::remove_cvref_t<decltype(type)>::type;
using ImplementationType = typename Type::ImplementationType;
using WrapperType = typename Converter<Type>::WrapperType;
@@ -393,7 +392,7 @@ template<typename... T> struct JSConverter<IDLUnion<T...>> {
std::optional<JSC::JSValue> returnValue;
brigand::for_each<Sequence>([&](auto&& type) {
- using I = typename WTF::RemoveCVAndReference<decltype(type)>::type::type;
+ using I = typename std::remove_cvref_t<decltype(type)>::type;
if (I::value == index) {
ASSERT(!returnValue);
returnValue = toJS<brigand::at<TypeList, I>>(lexicalGlobalObject, globalObject, std::get<I::value>(variant));
@@ -414,4 +413,16 @@ template<> struct Converter<IDLAllowSharedAdaptor<IDLUnion<IDLArrayBufferView, I
}
};
+template<>
+struct JSConverter<IDLAllowSharedAdaptor<IDLUnion<IDLArrayBufferView, IDLArrayBuffer>>> {
+ static constexpr bool needsState = true;
+ static constexpr bool needsGlobalObject = true;
+
+ template<typename U>
+ static JSC::JSValue convert(JSC::JSGlobalObject& lexicalGlobalObject, JSDOMGlobalObject& globalObject, const U& value)
+ {
+ return JSConverter<IDLUnion<IDLArrayBufferView, IDLArrayBuffer>>::convert(lexicalGlobalObject, globalObject, value);
+ }
+};
+
} // namespace WebCore
diff --git a/src/bun.js/bindings/webcore/ReadableStreamDefaultController.cpp b/src/bun.js/bindings/webcore/ReadableStreamDefaultController.cpp
index 229a02d38..c601884ea 100644
--- a/src/bun.js/bindings/webcore/ReadableStreamDefaultController.cpp
+++ b/src/bun.js/bindings/webcore/ReadableStreamDefaultController.cpp
@@ -143,7 +143,7 @@ bool ReadableStreamDefaultController::enqueue(RefPtr<JSC::ArrayBuffer>&& buffer)
JSC::JSLockHolder lock(vm);
auto scope = DECLARE_CATCH_SCOPE(vm);
auto length = buffer->byteLength();
- auto value = JSC::JSUint8Array::create(&lexicalGlobalObject, lexicalGlobalObject.typedArrayStructure(JSC::TypeUint8), WTFMove(buffer), 0, length);
+ auto value = JSC::JSUint8Array::create(&lexicalGlobalObject, lexicalGlobalObject.typedArrayStructure(JSC::TypeUint8, true), WTFMove(buffer), 0, length);
EXCEPTION_ASSERT(!scope.exception() || vm.hasPendingTerminationException());
RETURN_IF_EXCEPTION(scope, false);