From 05f14c8d6a50c6fd4652b2670b77ab23902dacb9 Mon Sep 17 00:00:00 2001 From: Jarred Sumner Date: Fri, 29 Dec 2023 18:26:33 -0800 Subject: [PATCH] Add `setMayBePrototype` where it should be added (#7922) Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> --- src/bun.js/bindings/CommonJSModuleRecord.cpp | 12 +++++++++--- src/bun.js/bindings/webcore/JSAbortController.cpp | 4 +++- .../bindings/webcore/JSByteLengthQueuingStrategy.cpp | 4 +++- .../bindings/webcore/JSCountQueuingStrategy.cpp | 4 +++- src/bun.js/bindings/webcore/JSDOMFormData.cpp | 4 +++- src/bun.js/bindings/webcore/JSDOMURL.cpp | 4 +++- src/bun.js/bindings/webcore/JSEvent.cpp | 4 +++- src/bun.js/bindings/webcore/JSEventEmitter.cpp | 4 +++- src/bun.js/bindings/webcore/JSEventTarget.cpp | 4 +++- src/bun.js/bindings/webcore/JSFetchHeaders.cpp | 4 +++- .../webcore/JSReadableByteStreamController.cpp | 4 +++- src/bun.js/bindings/webcore/JSReadableStream.cpp | 4 +++- .../bindings/webcore/JSReadableStreamBYOBReader.cpp | 4 +++- .../bindings/webcore/JSReadableStreamBYOBRequest.cpp | 4 +++- .../webcore/JSReadableStreamDefaultController.cpp | 4 +++- .../webcore/JSReadableStreamDefaultReader.cpp | 4 +++- src/bun.js/bindings/webcore/JSReadableStreamSink.cpp | 4 +++- .../bindings/webcore/JSReadableStreamSource.cpp | 4 +++- src/bun.js/bindings/webcore/JSTextEncoder.cpp | 4 +++- src/bun.js/bindings/webcore/JSTransformStream.cpp | 4 +++- .../webcore/JSTransformStreamDefaultController.cpp | 4 +++- src/bun.js/bindings/webcore/JSURLSearchParams.cpp | 4 +++- src/bun.js/bindings/webcore/JSWritableStream.cpp | 4 +++- .../webcore/JSWritableStreamDefaultController.cpp | 4 +++- .../webcore/JSWritableStreamDefaultWriter.cpp | 4 +++- src/bun.js/bindings/webcore/JSWritableStreamSink.cpp | 4 +++- src/bun.js/bindings/webcrypto/JSCryptoKey.cpp | 6 +++--- src/bun.js/bindings/webcrypto/JSSubtleCrypto.cpp | 4 +++- src/codegen/generate-classes.ts | 6 +++--- 29 files changed, 93 insertions(+), 35 deletions(-) diff --git a/src/bun.js/bindings/CommonJSModuleRecord.cpp b/src/bun.js/bindings/CommonJSModuleRecord.cpp index 6507d24c6b..2cf17a15ea 100644 --- a/src/bun.js/bindings/CommonJSModuleRecord.cpp +++ b/src/bun.js/bindings/CommonJSModuleRecord.cpp @@ -218,14 +218,18 @@ Structure* RequireFunctionPrototype::createStructure( JSC::VM& vm, JSC::JSGlobalObject* globalObject) { - return Structure::create(vm, globalObject, globalObject->functionPrototype(), TypeInfo(ObjectType, StructureFlags), info()); + auto* structure = Structure::create(vm, globalObject, globalObject->functionPrototype(), TypeInfo(ObjectType, StructureFlags), info()); + structure->setMayBePrototype(true); + return structure; } Structure* RequireResolveFunctionPrototype::createStructure( JSC::VM& vm, JSC::JSGlobalObject* globalObject) { - return Structure::create(vm, globalObject, globalObject->functionPrototype(), TypeInfo(ObjectType, StructureFlags), info()); + auto* structure = Structure::create(vm, globalObject, globalObject->functionPrototype(), TypeInfo(ObjectType, StructureFlags), info()); + structure->setMayBePrototype(true); + return structure; } RequireResolveFunctionPrototype* RequireResolveFunctionPrototype::create(JSC::JSGlobalObject* globalObject) @@ -518,7 +522,9 @@ public: JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) { - return JSC::Structure::create(vm, globalObject, prototype, TypeInfo(JSC::ObjectType, StructureFlags), info()); + auto* structure = JSC::Structure::create(vm, globalObject, prototype, TypeInfo(JSC::ObjectType, StructureFlags), info()); + structure->setMayBePrototype(true); + return structure; } DECLARE_INFO; diff --git a/src/bun.js/bindings/webcore/JSAbortController.cpp b/src/bun.js/bindings/webcore/JSAbortController.cpp index eac7e745de..926c898971 100644 --- a/src/bun.js/bindings/webcore/JSAbortController.cpp +++ b/src/bun.js/bindings/webcore/JSAbortController.cpp @@ -170,7 +170,9 @@ void JSAbortController::finishCreation(VM& vm) JSObject* JSAbortController::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) { - return JSAbortControllerPrototype::create(vm, &globalObject, JSAbortControllerPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype())); + auto* structure = JSAbortControllerPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype()); + structure->setMayBePrototype(true); + return JSAbortControllerPrototype::create(vm, &globalObject, structure); } JSObject* JSAbortController::prototype(VM& vm, JSDOMGlobalObject& globalObject) diff --git a/src/bun.js/bindings/webcore/JSByteLengthQueuingStrategy.cpp b/src/bun.js/bindings/webcore/JSByteLengthQueuingStrategy.cpp index 4dc2e94d34..523734aab4 100644 --- a/src/bun.js/bindings/webcore/JSByteLengthQueuingStrategy.cpp +++ b/src/bun.js/bindings/webcore/JSByteLengthQueuingStrategy.cpp @@ -136,7 +136,9 @@ void JSByteLengthQueuingStrategy::finishCreation(VM& vm) JSObject* JSByteLengthQueuingStrategy::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) { - return JSByteLengthQueuingStrategyPrototype::create(vm, &globalObject, JSByteLengthQueuingStrategyPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype())); + auto* structure = JSByteLengthQueuingStrategyPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype()); + structure->setMayBePrototype(true); + return JSByteLengthQueuingStrategyPrototype::create(vm, &globalObject, structure); } JSObject* JSByteLengthQueuingStrategy::prototype(VM& vm, JSDOMGlobalObject& globalObject) diff --git a/src/bun.js/bindings/webcore/JSCountQueuingStrategy.cpp b/src/bun.js/bindings/webcore/JSCountQueuingStrategy.cpp index 0a05fe8083..5d83696115 100644 --- a/src/bun.js/bindings/webcore/JSCountQueuingStrategy.cpp +++ b/src/bun.js/bindings/webcore/JSCountQueuingStrategy.cpp @@ -136,7 +136,9 @@ void JSCountQueuingStrategy::finishCreation(VM& vm) JSObject* JSCountQueuingStrategy::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) { - return JSCountQueuingStrategyPrototype::create(vm, &globalObject, JSCountQueuingStrategyPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype())); + auto* structure = JSCountQueuingStrategyPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype()); + structure->setMayBePrototype(true); + return JSCountQueuingStrategyPrototype::create(vm, &globalObject, structure); } JSObject* JSCountQueuingStrategy::prototype(VM& vm, JSDOMGlobalObject& globalObject) diff --git a/src/bun.js/bindings/webcore/JSDOMFormData.cpp b/src/bun.js/bindings/webcore/JSDOMFormData.cpp index bbad4c6fde..23b9818974 100644 --- a/src/bun.js/bindings/webcore/JSDOMFormData.cpp +++ b/src/bun.js/bindings/webcore/JSDOMFormData.cpp @@ -241,7 +241,9 @@ void JSDOMFormData::finishCreation(VM& vm) JSObject* JSDOMFormData::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) { - return JSDOMFormDataPrototype::create(vm, &globalObject, JSDOMFormDataPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype())); + auto* structure = JSDOMFormDataPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype()); + structure->setMayBePrototype(true); + return JSDOMFormDataPrototype::create(vm, &globalObject, structure); } JSObject* JSDOMFormData::prototype(VM& vm, JSDOMGlobalObject& globalObject) diff --git a/src/bun.js/bindings/webcore/JSDOMURL.cpp b/src/bun.js/bindings/webcore/JSDOMURL.cpp index 88d051dc6f..b296575100 100644 --- a/src/bun.js/bindings/webcore/JSDOMURL.cpp +++ b/src/bun.js/bindings/webcore/JSDOMURL.cpp @@ -268,7 +268,9 @@ void JSDOMURL::finishCreation(VM& vm) JSObject* JSDOMURL::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) { - return JSDOMURLPrototype::create(vm, &globalObject, JSDOMURLPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype())); + auto* structure = JSDOMURLPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype()); + structure->setMayBePrototype(true); + return JSDOMURLPrototype::create(vm, &globalObject, structure); } JSObject* JSDOMURL::prototype(VM& vm, JSDOMGlobalObject& globalObject) diff --git a/src/bun.js/bindings/webcore/JSEvent.cpp b/src/bun.js/bindings/webcore/JSEvent.cpp index 6352617000..7cb48182f6 100644 --- a/src/bun.js/bindings/webcore/JSEvent.cpp +++ b/src/bun.js/bindings/webcore/JSEvent.cpp @@ -255,7 +255,9 @@ void JSEvent::finishCreation(VM& vm) JSObject* JSEvent::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) { - return JSEventPrototype::create(vm, &globalObject, JSEventPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype())); + auto* structure = JSEventPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype()); + structure->setMayBePrototype(true); + return JSEventPrototype::create(vm, &globalObject, structure); } JSObject* JSEvent::prototype(VM& vm, JSDOMGlobalObject& globalObject) diff --git a/src/bun.js/bindings/webcore/JSEventEmitter.cpp b/src/bun.js/bindings/webcore/JSEventEmitter.cpp index e10c1fd65f..1cc7d945b4 100644 --- a/src/bun.js/bindings/webcore/JSEventEmitter.cpp +++ b/src/bun.js/bindings/webcore/JSEventEmitter.cpp @@ -191,7 +191,9 @@ void JSEventEmitter::finishCreation(VM& vm) JSObject* JSEventEmitter::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) { - return JSEventEmitterPrototype::create(vm, &globalObject, JSEventEmitterPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype())); + auto* structure = JSEventEmitterPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype()); + structure->setMayBePrototype(true); + return JSEventEmitterPrototype::create(vm, &globalObject, structure); } JSObject* JSEventEmitter::prototype(VM& vm, JSDOMGlobalObject& globalObject) diff --git a/src/bun.js/bindings/webcore/JSEventTarget.cpp b/src/bun.js/bindings/webcore/JSEventTarget.cpp index f3a233615f..5ddd7385aa 100644 --- a/src/bun.js/bindings/webcore/JSEventTarget.cpp +++ b/src/bun.js/bindings/webcore/JSEventTarget.cpp @@ -174,7 +174,9 @@ void JSEventTarget::finishCreation(VM& vm) JSObject* JSEventTarget::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) { - return JSEventTargetPrototype::create(vm, &globalObject, JSEventTargetPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype())); + auto* structure = JSEventTargetPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype()); + structure->setMayBePrototype(true); + return JSEventTargetPrototype::create(vm, &globalObject, structure); } JSObject* JSEventTarget::prototype(VM& vm, JSDOMGlobalObject& globalObject) diff --git a/src/bun.js/bindings/webcore/JSFetchHeaders.cpp b/src/bun.js/bindings/webcore/JSFetchHeaders.cpp index d4608127a8..5c45ae3cdf 100644 --- a/src/bun.js/bindings/webcore/JSFetchHeaders.cpp +++ b/src/bun.js/bindings/webcore/JSFetchHeaders.cpp @@ -341,7 +341,9 @@ void JSFetchHeaders::computeMemoryCost() JSObject* JSFetchHeaders::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) { - return JSFetchHeadersPrototype::create(vm, &globalObject, JSFetchHeadersPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype())); + auto* structure = JSFetchHeadersPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype()); + structure->setMayBePrototype(true); + return JSFetchHeadersPrototype::create(vm, &globalObject, structure); } JSObject* JSFetchHeaders::prototype(VM& vm, JSDOMGlobalObject& globalObject) diff --git a/src/bun.js/bindings/webcore/JSReadableByteStreamController.cpp b/src/bun.js/bindings/webcore/JSReadableByteStreamController.cpp index cf3d514423..5c21c42792 100644 --- a/src/bun.js/bindings/webcore/JSReadableByteStreamController.cpp +++ b/src/bun.js/bindings/webcore/JSReadableByteStreamController.cpp @@ -139,7 +139,9 @@ void JSReadableByteStreamController::finishCreation(VM& vm) JSObject* JSReadableByteStreamController::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) { - return JSReadableByteStreamControllerPrototype::create(vm, &globalObject, JSReadableByteStreamControllerPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype())); + auto* structure = JSReadableByteStreamControllerPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype()); + structure->setMayBePrototype(true); + return JSReadableByteStreamControllerPrototype::create(vm, &globalObject, structure); } JSObject* JSReadableByteStreamController::prototype(VM& vm, JSDOMGlobalObject& globalObject) diff --git a/src/bun.js/bindings/webcore/JSReadableStream.cpp b/src/bun.js/bindings/webcore/JSReadableStream.cpp index 775aa4193c..158e4421d7 100644 --- a/src/bun.js/bindings/webcore/JSReadableStream.cpp +++ b/src/bun.js/bindings/webcore/JSReadableStream.cpp @@ -145,7 +145,9 @@ void JSReadableStream::finishCreation(VM& vm) JSObject* JSReadableStream::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) { - return JSReadableStreamPrototype::create(vm, &globalObject, JSReadableStreamPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype())); + auto* structure = JSReadableStreamPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype()); + structure->setMayBePrototype(true); + return JSReadableStreamPrototype::create(vm, &globalObject, structure); } JSObject* JSReadableStream::prototype(VM& vm, JSDOMGlobalObject& globalObject) diff --git a/src/bun.js/bindings/webcore/JSReadableStreamBYOBReader.cpp b/src/bun.js/bindings/webcore/JSReadableStreamBYOBReader.cpp index fa8b37d163..9568df1bcf 100644 --- a/src/bun.js/bindings/webcore/JSReadableStreamBYOBReader.cpp +++ b/src/bun.js/bindings/webcore/JSReadableStreamBYOBReader.cpp @@ -138,7 +138,9 @@ void JSReadableStreamBYOBReader::finishCreation(VM& vm) JSObject* JSReadableStreamBYOBReader::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) { - return JSReadableStreamBYOBReaderPrototype::create(vm, &globalObject, JSReadableStreamBYOBReaderPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype())); + auto* structure = JSReadableStreamBYOBReaderPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype()); + structure->setMayBePrototype(true); + return JSReadableStreamBYOBReaderPrototype::create(vm, &globalObject, structure); } JSObject* JSReadableStreamBYOBReader::prototype(VM& vm, JSDOMGlobalObject& globalObject) diff --git a/src/bun.js/bindings/webcore/JSReadableStreamBYOBRequest.cpp b/src/bun.js/bindings/webcore/JSReadableStreamBYOBRequest.cpp index 0e50d440cf..18f7c8834d 100644 --- a/src/bun.js/bindings/webcore/JSReadableStreamBYOBRequest.cpp +++ b/src/bun.js/bindings/webcore/JSReadableStreamBYOBRequest.cpp @@ -137,7 +137,9 @@ void JSReadableStreamBYOBRequest::finishCreation(VM& vm) JSObject* JSReadableStreamBYOBRequest::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) { - return JSReadableStreamBYOBRequestPrototype::create(vm, &globalObject, JSReadableStreamBYOBRequestPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype())); + auto* structure = JSReadableStreamBYOBRequestPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype()); + structure->setMayBePrototype(true); + return JSReadableStreamBYOBRequestPrototype::create(vm, &globalObject, structure); } JSObject* JSReadableStreamBYOBRequest::prototype(VM& vm, JSDOMGlobalObject& globalObject) diff --git a/src/bun.js/bindings/webcore/JSReadableStreamDefaultController.cpp b/src/bun.js/bindings/webcore/JSReadableStreamDefaultController.cpp index 1faff7a64f..b69dde2844 100644 --- a/src/bun.js/bindings/webcore/JSReadableStreamDefaultController.cpp +++ b/src/bun.js/bindings/webcore/JSReadableStreamDefaultController.cpp @@ -141,7 +141,9 @@ void JSReadableStreamDefaultController::finishCreation(VM& vm) JSObject* JSReadableStreamDefaultController::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) { - return JSReadableStreamDefaultControllerPrototype::create(vm, &globalObject, JSReadableStreamDefaultControllerPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype())); + auto* structure = JSReadableStreamDefaultControllerPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype()); + structure->setMayBePrototype(true); + return JSReadableStreamDefaultControllerPrototype::create(vm, &globalObject, structure); } JSObject* JSReadableStreamDefaultController::prototype(VM& vm, JSDOMGlobalObject& globalObject) diff --git a/src/bun.js/bindings/webcore/JSReadableStreamDefaultReader.cpp b/src/bun.js/bindings/webcore/JSReadableStreamDefaultReader.cpp index 3b72d7b004..021901cebf 100644 --- a/src/bun.js/bindings/webcore/JSReadableStreamDefaultReader.cpp +++ b/src/bun.js/bindings/webcore/JSReadableStreamDefaultReader.cpp @@ -139,7 +139,9 @@ void JSReadableStreamDefaultReader::finishCreation(VM& vm) JSObject* JSReadableStreamDefaultReader::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) { - return JSReadableStreamDefaultReaderPrototype::create(vm, &globalObject, JSReadableStreamDefaultReaderPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype())); + auto* structure = JSReadableStreamDefaultReaderPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype()); + structure->setMayBePrototype(true); + return JSReadableStreamDefaultReaderPrototype::create(vm, &globalObject, structure); } JSObject* JSReadableStreamDefaultReader::prototype(VM& vm, JSDOMGlobalObject& globalObject) diff --git a/src/bun.js/bindings/webcore/JSReadableStreamSink.cpp b/src/bun.js/bindings/webcore/JSReadableStreamSink.cpp index e9710fe829..633be1f087 100644 --- a/src/bun.js/bindings/webcore/JSReadableStreamSink.cpp +++ b/src/bun.js/bindings/webcore/JSReadableStreamSink.cpp @@ -120,7 +120,9 @@ void JSReadableStreamSink::finishCreation(VM& vm) JSObject* JSReadableStreamSink::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) { - return JSReadableStreamSinkPrototype::create(vm, &globalObject, JSReadableStreamSinkPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype())); + auto* structure = JSReadableStreamSinkPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype()); + structure->setMayBePrototype(true); + return JSReadableStreamSinkPrototype::create(vm, &globalObject, structure); } JSObject* JSReadableStreamSink::prototype(VM& vm, JSDOMGlobalObject& globalObject) diff --git a/src/bun.js/bindings/webcore/JSReadableStreamSource.cpp b/src/bun.js/bindings/webcore/JSReadableStreamSource.cpp index fe9ca3ae1e..d74757b4d5 100644 --- a/src/bun.js/bindings/webcore/JSReadableStreamSource.cpp +++ b/src/bun.js/bindings/webcore/JSReadableStreamSource.cpp @@ -130,7 +130,9 @@ void JSReadableStreamSource::finishCreation(VM& vm) JSObject* JSReadableStreamSource::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) { - return JSReadableStreamSourcePrototype::create(vm, &globalObject, JSReadableStreamSourcePrototype::createStructure(vm, &globalObject, globalObject.objectPrototype())); + auto* structure = JSReadableStreamSourcePrototype::createStructure(vm, &globalObject, globalObject.objectPrototype()); + structure->setMayBePrototype(true); + return JSReadableStreamSourcePrototype::create(vm, &globalObject, structure); } JSObject* JSReadableStreamSource::prototype(VM& vm, JSDOMGlobalObject& globalObject) diff --git a/src/bun.js/bindings/webcore/JSTextEncoder.cpp b/src/bun.js/bindings/webcore/JSTextEncoder.cpp index 533ffe84af..bfeda8eb28 100644 --- a/src/bun.js/bindings/webcore/JSTextEncoder.cpp +++ b/src/bun.js/bindings/webcore/JSTextEncoder.cpp @@ -329,7 +329,9 @@ void JSTextEncoder::finishCreation(VM& vm) JSObject* JSTextEncoder::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) { - return JSTextEncoderPrototype::create(vm, &globalObject, JSTextEncoderPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype())); + auto* structure = JSTextEncoderPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype()); + structure->setMayBePrototype(true); + return JSTextEncoderPrototype::create(vm, &globalObject, structure); } JSObject* JSTextEncoder::prototype(VM& vm, JSDOMGlobalObject& globalObject) diff --git a/src/bun.js/bindings/webcore/JSTransformStream.cpp b/src/bun.js/bindings/webcore/JSTransformStream.cpp index 25cdd8a103..76488775aa 100644 --- a/src/bun.js/bindings/webcore/JSTransformStream.cpp +++ b/src/bun.js/bindings/webcore/JSTransformStream.cpp @@ -133,7 +133,9 @@ void JSTransformStream::finishCreation(VM& vm) JSObject* JSTransformStream::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) { - return JSTransformStreamPrototype::create(vm, &globalObject, JSTransformStreamPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype())); + auto* structure = JSTransformStreamPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype()); + structure->setMayBePrototype(true); + return JSTransformStreamPrototype::create(vm, &globalObject, structure); } JSObject* JSTransformStream::prototype(VM& vm, JSDOMGlobalObject& globalObject) diff --git a/src/bun.js/bindings/webcore/JSTransformStreamDefaultController.cpp b/src/bun.js/bindings/webcore/JSTransformStreamDefaultController.cpp index 495d9202dc..67309e62f1 100644 --- a/src/bun.js/bindings/webcore/JSTransformStreamDefaultController.cpp +++ b/src/bun.js/bindings/webcore/JSTransformStreamDefaultController.cpp @@ -138,7 +138,9 @@ void JSTransformStreamDefaultController::finishCreation(VM& vm) JSObject* JSTransformStreamDefaultController::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) { - return JSTransformStreamDefaultControllerPrototype::create(vm, &globalObject, JSTransformStreamDefaultControllerPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype())); + auto* structure = JSTransformStreamDefaultControllerPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype()); + structure->setMayBePrototype(true); + return JSTransformStreamDefaultControllerPrototype::create(vm, &globalObject, structure); } JSObject* JSTransformStreamDefaultController::prototype(VM& vm, JSDOMGlobalObject& globalObject) diff --git a/src/bun.js/bindings/webcore/JSURLSearchParams.cpp b/src/bun.js/bindings/webcore/JSURLSearchParams.cpp index 1e09b2adb1..ac168cd4e1 100644 --- a/src/bun.js/bindings/webcore/JSURLSearchParams.cpp +++ b/src/bun.js/bindings/webcore/JSURLSearchParams.cpp @@ -212,7 +212,9 @@ void JSURLSearchParams::finishCreation(VM& vm) JSObject* JSURLSearchParams::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) { - return JSURLSearchParamsPrototype::create(vm, &globalObject, JSURLSearchParamsPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype())); + auto* structure = JSURLSearchParamsPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype()); + structure->setMayBePrototype(true); + return JSURLSearchParamsPrototype::create(vm, &globalObject, structure); } JSObject* JSURLSearchParams::prototype(VM& vm, JSDOMGlobalObject& globalObject) diff --git a/src/bun.js/bindings/webcore/JSWritableStream.cpp b/src/bun.js/bindings/webcore/JSWritableStream.cpp index 5292e7c1a9..9f2d586c40 100644 --- a/src/bun.js/bindings/webcore/JSWritableStream.cpp +++ b/src/bun.js/bindings/webcore/JSWritableStream.cpp @@ -173,7 +173,9 @@ void JSWritableStream::finishCreation(VM& vm) JSObject* JSWritableStream::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) { - return JSWritableStreamPrototype::create(vm, &globalObject, JSWritableStreamPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype())); + auto* structure = JSWritableStreamPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype()); + structure->setMayBePrototype(true); + return JSWritableStreamPrototype::create(vm, &globalObject, structure); } JSObject* JSWritableStream::prototype(VM& vm, JSDOMGlobalObject& globalObject) diff --git a/src/bun.js/bindings/webcore/JSWritableStreamDefaultController.cpp b/src/bun.js/bindings/webcore/JSWritableStreamDefaultController.cpp index af641d0b66..15b0097a6a 100644 --- a/src/bun.js/bindings/webcore/JSWritableStreamDefaultController.cpp +++ b/src/bun.js/bindings/webcore/JSWritableStreamDefaultController.cpp @@ -134,7 +134,9 @@ void JSWritableStreamDefaultController::finishCreation(VM& vm) JSObject* JSWritableStreamDefaultController::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) { - return JSWritableStreamDefaultControllerPrototype::create(vm, &globalObject, JSWritableStreamDefaultControllerPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype())); + auto* structure = JSWritableStreamDefaultControllerPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype()); + structure->setMayBePrototype(true); + return JSWritableStreamDefaultControllerPrototype::create(vm, &globalObject, structure); } JSObject* JSWritableStreamDefaultController::prototype(VM& vm, JSDOMGlobalObject& globalObject) diff --git a/src/bun.js/bindings/webcore/JSWritableStreamDefaultWriter.cpp b/src/bun.js/bindings/webcore/JSWritableStreamDefaultWriter.cpp index cc79c03d5e..a9e758f6f1 100644 --- a/src/bun.js/bindings/webcore/JSWritableStreamDefaultWriter.cpp +++ b/src/bun.js/bindings/webcore/JSWritableStreamDefaultWriter.cpp @@ -141,7 +141,9 @@ void JSWritableStreamDefaultWriter::finishCreation(VM& vm) JSObject* JSWritableStreamDefaultWriter::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) { - return JSWritableStreamDefaultWriterPrototype::create(vm, &globalObject, JSWritableStreamDefaultWriterPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype())); + auto* structure = JSWritableStreamDefaultWriterPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype()); + structure->setMayBePrototype(true); + return JSWritableStreamDefaultWriterPrototype::create(vm, &globalObject, structure); } JSObject* JSWritableStreamDefaultWriter::prototype(VM& vm, JSDOMGlobalObject& globalObject) diff --git a/src/bun.js/bindings/webcore/JSWritableStreamSink.cpp b/src/bun.js/bindings/webcore/JSWritableStreamSink.cpp index 80bff52e81..25e83a92aa 100644 --- a/src/bun.js/bindings/webcore/JSWritableStreamSink.cpp +++ b/src/bun.js/bindings/webcore/JSWritableStreamSink.cpp @@ -122,7 +122,9 @@ void JSWritableStreamSink::finishCreation(VM& vm) JSObject* JSWritableStreamSink::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) { - return JSWritableStreamSinkPrototype::create(vm, &globalObject, JSWritableStreamSinkPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype())); + auto* structure = JSWritableStreamSinkPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype()); + structure->setMayBePrototype(true); + return JSWritableStreamSinkPrototype::create(vm, &globalObject, structure); } JSObject* JSWritableStreamSink::prototype(VM& vm, JSDOMGlobalObject& globalObject) diff --git a/src/bun.js/bindings/webcrypto/JSCryptoKey.cpp b/src/bun.js/bindings/webcrypto/JSCryptoKey.cpp index 1218efaa4c..860e208211 100644 --- a/src/bun.js/bindings/webcrypto/JSCryptoKey.cpp +++ b/src/bun.js/bindings/webcrypto/JSCryptoKey.cpp @@ -196,11 +196,11 @@ void JSCryptoKey::finishCreation(VM& vm) // static_assert(!std::is_base_of::value, "Interface is not marked as [ActiveDOMObject] even though implementation class subclasses ActiveDOMObject."); } - - JSObject* JSCryptoKey::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) { - return JSCryptoKeyPrototype::create(vm, &globalObject, JSCryptoKeyPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype())); + auto* structure = JSCryptoKeyPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype()); + structure->setMayBePrototype(true); + return JSCryptoKeyPrototype::create(vm, &globalObject, structure); } JSObject* JSCryptoKey::prototype(VM& vm, JSDOMGlobalObject& globalObject) diff --git a/src/bun.js/bindings/webcrypto/JSSubtleCrypto.cpp b/src/bun.js/bindings/webcrypto/JSSubtleCrypto.cpp index 790c3577f4..ae63d04d11 100644 --- a/src/bun.js/bindings/webcrypto/JSSubtleCrypto.cpp +++ b/src/bun.js/bindings/webcrypto/JSSubtleCrypto.cpp @@ -225,7 +225,9 @@ void JSSubtleCrypto::finishCreation(VM& vm) JSObject* JSSubtleCrypto::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) { - return JSSubtleCryptoPrototype::create(vm, &globalObject, JSSubtleCryptoPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype())); + auto* structure = JSSubtleCryptoPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype()); + structure->setMayBePrototype(true); + return JSSubtleCryptoPrototype::create(vm, &globalObject, structure); } JSObject* JSSubtleCrypto::prototype(VM& vm, JSDOMGlobalObject& globalObject) diff --git a/src/codegen/generate-classes.ts b/src/codegen/generate-classes.ts index 8d29f0ca0e..1b85eaeca4 100644 --- a/src/codegen/generate-classes.ts +++ b/src/codegen/generate-classes.ts @@ -1431,9 +1431,9 @@ ${ JSObject* ${name}::createPrototype(VM& vm, JSDOMGlobalObject* globalObject) { - return ${prototypeName(typeName)}::create(vm, globalObject, ${prototypeName( - typeName, - )}::createStructure(vm, globalObject, globalObject->objectPrototype())); + auto *structure = ${prototypeName(typeName)}::createStructure(vm, globalObject, globalObject->objectPrototype()); + structure->setMayBePrototype(true); + return ${prototypeName(typeName)}::create(vm, globalObject, structure); } extern "C" EncodedJSValue ${typeName}__create(Zig::GlobalObject* globalObject, void* ptr) {