Compare commits

...

1 Commits

Author SHA1 Message Date
Jarred Sumner
ed2c7e1098 Update WebKit bindings for latest WebKit version
Updates C++ bindings to be compatible with the latest WebKit API changes:
- Update inspector agent implementations for new API signatures
- Fix JSC binding compatibility issues in various components
- Update test harnesses to handle WebKit API changes
- Adjust CMake configuration for new WebKit setup requirements

This ensures Bun compiles and runs correctly with the upgraded WebKit version.
2025-07-16 20:52:47 -07:00
55 changed files with 143 additions and 158 deletions

View File

@@ -2,7 +2,7 @@ option(WEBKIT_VERSION "The version of WebKit to use")
option(WEBKIT_LOCAL "If a local version of WebKit should be used instead of downloading")
if(NOT WEBKIT_VERSION)
set(WEBKIT_VERSION 1098cc50652ab1eab171f58f7669e19ca6c276ae)
set(WEBKIT_VERSION 38a5e13bb73a066d4aa34128f401a3a068e40fef)
endif()
string(SUBSTRING ${WEBKIT_VERSION} 0 16 WEBKIT_VERSION_PREFIX)

View File

@@ -39,7 +39,7 @@ JSHeapData::JSHeapData(Heap& heap)
, m_domBuiltinConstructorSpace ISO_SUBSPACE_INIT(heap, heap.cellHeapCellType, JSDOMBuiltinConstructorBase)
, m_domConstructorSpace ISO_SUBSPACE_INIT(heap, heap.cellHeapCellType, JSDOMConstructorBase)
, m_domNamespaceObjectSpace ISO_SUBSPACE_INIT(heap, heap.cellHeapCellType, JSDOMObject)
, m_subspaces(makeUnique<ExtendedDOMIsoSubspaces>())
, m_subspaces(makeUniqueWithoutFastMallocCheck<ExtendedDOMIsoSubspaces>())
{
}
@@ -53,7 +53,7 @@ JSVMClientData::JSVMClientData(VM& vm, RefPtr<SourceProvider> sourceProvider)
, CLIENT_ISO_SUBSPACE_INIT(m_domBuiltinConstructorSpace)
, CLIENT_ISO_SUBSPACE_INIT(m_domConstructorSpace)
, CLIENT_ISO_SUBSPACE_INIT(m_domNamespaceObjectSpace)
, m_clientSubspaces(makeUnique<ExtendedDOMClientIsoSubspaces>())
, m_clientSubspaces(makeUniqueWithoutFastMallocCheck<ExtendedDOMClientIsoSubspaces>())
{
}
@@ -97,7 +97,7 @@ void JSVMClientData::create(VM* vm, void* bunVM)
vm->clientData = clientData; // ~VM deletes this pointer.
clientData->m_normalWorld = DOMWrapperWorld::create(*vm, DOMWrapperWorld::Type::Normal);
vm->heap.addMarkingConstraint(makeUnique<WebCore::DOMGCOutputConstraint>(*vm, clientData->heapData()));
vm->heap.addMarkingConstraint(makeUniqueWithoutFastMallocCheck<WebCore::DOMGCOutputConstraint>(*vm, clientData->heapData()));
vm->m_typedArrayController = adoptRef(new WebCoreTypedArrayController(true));
clientData->builtinFunctions().exportNames();
}

View File

@@ -36,7 +36,6 @@ enum class UseCustomHeapCellType { Yes,
class JSHeapData {
WTF_MAKE_NONCOPYABLE(JSHeapData);
WTF_MAKE_FAST_ALLOCATED;
friend class JSVMClientData;
public:
@@ -77,7 +76,6 @@ DECLARE_ALLOCATOR_WITH_HEAP_IDENTIFIER(JSVMClientData);
class JSVMClientData : public JSC::VM::ClientData {
WTF_MAKE_NONCOPYABLE(JSVMClientData);
WTF_MAKE_FAST_ALLOCATED_WITH_HEAP_IDENTIFIER(JSVMClientData);
public:
explicit JSVMClientData(JSC::VM&, RefPtr<JSC::SourceProvider>);

View File

@@ -110,13 +110,13 @@ public:
if (!hasConnected) {
hasConnected = true;
globalObject->inspectorController().registerAlternateAgent(
WTF::makeUnique<Inspector::InspectorLifecycleAgent>(*globalObject));
WTF::makeUniqueWithoutFastMallocCheck<Inspector::InspectorLifecycleAgent>(*globalObject));
globalObject->inspectorController().registerAlternateAgent(
WTF::makeUnique<Inspector::InspectorTestReporterAgent>(*globalObject));
WTF::makeUniqueWithoutFastMallocCheck<Inspector::InspectorTestReporterAgent>(*globalObject));
globalObject->inspectorController().registerAlternateAgent(
WTF::makeUnique<Inspector::InspectorBunFrontendDevServerAgent>(*globalObject));
WTF::makeUniqueWithoutFastMallocCheck<Inspector::InspectorBunFrontendDevServerAgent>(*globalObject));
globalObject->inspectorController().registerAlternateAgent(
WTF::makeUnique<Inspector::InspectorHTTPServerAgent>(*globalObject));
WTF::makeUniqueWithoutFastMallocCheck<Inspector::InspectorHTTPServerAgent>(*globalObject));
}
this->hasEverConnected = true;

View File

@@ -36,7 +36,6 @@ namespace WebCore {
class JSHeapData;
class DOMGCOutputConstraint : public JSC::MarkingConstraint {
WTF_MAKE_FAST_ALLOCATED;
public:
DOMGCOutputConstraint(JSC::VM&, JSHeapData&);

View File

@@ -20,7 +20,6 @@ using InspectorScriptProfilerAgent = Inspector::InspectorScriptProfilerAgent;
using namespace JSC;
class ConsoleObject final : public JSC::ConsoleClient {
WTF_MAKE_FAST_ALLOCATED;
public:
~ConsoleObject() final {}

View File

@@ -43,10 +43,7 @@ class ScriptExecutionContext;
template<typename> class ExceptionOr;
class HTMLElement;
class HTMLFormElement;
DECLARE_ALLOCATOR_WITH_HEAP_IDENTIFIER(DOMFormData);
class DOMFormData : public RefCounted<DOMFormData>, public ContextDestructionObserver {
WTF_MAKE_FAST_ALLOCATED_WITH_HEAP_IDENTIFIER(DOMFormData);
public:
using FormDataEntryValue = std::variant<String, RefPtr<Blob>>;

View File

@@ -132,7 +132,7 @@ public:
}
bool isConstructor() const
{
return m_codeBlock && (JSC::CodeForConstruct == m_codeBlock->specializationKind());
return m_codeBlock && (JSC::CodeSpecializationKind::CodeForConstruct == m_codeBlock->specializationKind());
}
private:

View File

@@ -31,7 +31,7 @@ InspectorBunFrontendDevServerAgent::InspectorBunFrontendDevServerAgent(JSC::JSGl
InspectorBunFrontendDevServerAgent::~InspectorBunFrontendDevServerAgent() = default;
void InspectorBunFrontendDevServerAgent::didCreateFrontendAndBackend(FrontendRouter*, BackendDispatcher*)
void InspectorBunFrontendDevServerAgent::didCreateFrontendAndBackend()
{
}

View File

@@ -25,7 +25,7 @@ public:
virtual ~InspectorBunFrontendDevServerAgent() final;
// InspectorAgentBase
virtual void didCreateFrontendAndBackend(FrontendRouter*, BackendDispatcher*) final;
virtual void didCreateFrontendAndBackend() final;
virtual void willDestroyFrontendAndBackend(DisconnectReason) final;
// BunFrontendDevServerBackendDispatcherHandler

View File

@@ -38,7 +38,7 @@ InspectorHTTPServerAgent::~InspectorHTTPServerAgent()
}
}
void InspectorHTTPServerAgent::didCreateFrontendAndBackend(FrontendRouter*, BackendDispatcher*)
void InspectorHTTPServerAgent::didCreateFrontendAndBackend()
{
}

View File

@@ -28,7 +28,7 @@ public:
virtual ~InspectorHTTPServerAgent();
// InspectorAgentBase
virtual void didCreateFrontendAndBackend(FrontendRouter*, BackendDispatcher*) final;
virtual void didCreateFrontendAndBackend() final;
virtual void willDestroyFrontendAndBackend(DisconnectReason) final;
// HTTPServerBackendDispatcherHandler

View File

@@ -61,7 +61,7 @@ InspectorLifecycleAgent::~InspectorLifecycleAgent()
}
}
void InspectorLifecycleAgent::didCreateFrontendAndBackend(FrontendRouter*, BackendDispatcher*)
void InspectorLifecycleAgent::didCreateFrontendAndBackend()
{
}

View File

@@ -1,13 +1,13 @@
#pragma once
#include "root.h"
#include <JavaScriptCore/AlternateDispatchableAgent.h>
#include <JavaScriptCore/InspectorAgentBase.h>
#include <JavaScriptCore/InspectorBackendDispatchers.h>
#include <JavaScriptCore/InspectorFrontendDispatchers.h>
#include <JavaScriptCore/JSGlobalObject.h>
#include <wtf/Forward.h>
#include <wtf/Noncopyable.h>
#include <JavaScriptCore/AlternateDispatchableAgent.h>
#include "headers-handwritten.h"
namespace Inspector {
@@ -25,7 +25,7 @@ public:
virtual ~InspectorLifecycleAgent();
// InspectorAgentBase
virtual void didCreateFrontendAndBackend(FrontendRouter*, BackendDispatcher*) final;
virtual void didCreateFrontendAndBackend() final;
virtual void willDestroyFrontendAndBackend(DisconnectReason) final;
// LifecycleReporterBackendDispatcherHandler

View File

@@ -35,13 +35,13 @@ void Bun__TestReporterAgentReportTestFound(Inspector::InspectorTestReporterAgent
{
auto str = name->toWTFString(BunString::ZeroCopy);
Protocol::TestReporter::TestType type;
String type;
switch (item_type) {
case BunTestType::Test:
type = Protocol::TestReporter::TestType::Test;
type = "test"_s;
break;
case BunTestType::Describe:
type = Protocol::TestReporter::TestType::Describe;
type = "describe"_s;
break;
default:
ASSERT_NOT_REACHED();
@@ -84,7 +84,7 @@ void Bun__TestReporterAgentReportTestEnd(Inspector::InspectorTestReporterAgent*
status = Protocol::TestReporter::TestStatus::Todo;
break;
case BunTestStatus::SkippedBecauseLabel:
status = Protocol::TestReporter::TestStatus::Skipped_because_label;
status = Protocol::TestReporter::TestStatus::Skip;
break;
default:
ASSERT_NOT_REACHED();
@@ -109,7 +109,7 @@ InspectorTestReporterAgent::~InspectorTestReporterAgent()
}
}
void InspectorTestReporterAgent::didCreateFrontendAndBackend(FrontendRouter*, BackendDispatcher*)
void InspectorTestReporterAgent::didCreateFrontendAndBackend()
{
}
@@ -138,7 +138,7 @@ Protocol::ErrorStringOr<void> InspectorTestReporterAgent::disable()
return {};
}
void InspectorTestReporterAgent::reportTestFound(JSC::CallFrame* callFrame, int testId, const String& name, Protocol::TestReporter::TestType type, int parentId)
void InspectorTestReporterAgent::reportTestFound(JSC::CallFrame* callFrame, int testId, const String& name, const String& type, int parentId)
{
if (!m_enabled)
return;
@@ -205,9 +205,7 @@ void InspectorTestReporterAgent::reportTestFound(JSC::CallFrame* callFrame, int
sourceID > 0 ? String::number(sourceID) : String(),
sourceURL,
lineColumn.line,
name,
type,
parentId > 0 ? parentId : std::optional<int>());
name);
}
void InspectorTestReporterAgent::reportTestStart(int testId)

View File

@@ -25,7 +25,7 @@ public:
virtual ~InspectorTestReporterAgent();
// InspectorAgentBase
virtual void didCreateFrontendAndBackend(FrontendRouter*, BackendDispatcher*) final;
virtual void didCreateFrontendAndBackend() final;
virtual void willDestroyFrontendAndBackend(DisconnectReason) final;
// TestReporterBackendDispatcherHandler
@@ -33,7 +33,7 @@ public:
virtual Protocol::ErrorStringOr<void> disable() final;
// Public API for reporting test events
void reportTestFound(JSC::CallFrame*, int testId, const String& name, Protocol::TestReporter::TestType type = Protocol::TestReporter::TestType::Test, int parentId = -1);
void reportTestFound(JSC::CallFrame*, int testId, const String& name, const String& type = "test"_s, int parentId = -1);
void reportTestStart(int testId);
void reportTestEnd(int testId, Protocol::TestReporter::TestStatus status, double elapsed);

View File

@@ -127,13 +127,15 @@ static bool evaluateCommonJSModuleOnce(JSC::VM& vm, Zig::GlobalObject* globalObj
globalObject,
globalObject->requireResolveFunctionUnbound(),
moduleObject->filename(),
ArgList(), 1, globalObject->commonStrings().resolveString(globalObject));
ArgList(), 1, globalObject->commonStrings().resolveString(globalObject),
JSC::makeSource(WTF::String(), JSC::SourceOrigin(), JSC::SourceTaintedOrigin::Untainted));
RETURN_IF_EXCEPTION(scope, );
requireFunction = JSC::JSBoundFunction::create(vm,
globalObject,
globalObject->requireFunctionUnbound(),
moduleObject,
ArgList(), 1, globalObject->commonStrings().requireString(globalObject));
ArgList(), 1, globalObject->commonStrings().requireString(globalObject),
JSC::makeSource(WTF::String(), JSC::SourceOrigin(), JSC::SourceTaintedOrigin::Untainted));
RETURN_IF_EXCEPTION(scope, );
requireFunction->putDirect(vm, vm.propertyNames->resolve, resolveFunction, 0);
RETURN_IF_EXCEPTION(scope, );
@@ -1553,14 +1555,16 @@ JSObject* JSCommonJSModule::createBoundRequireFunction(VM& vm, JSGlobalObject* l
globalObject,
globalObject->requireFunctionUnbound(),
moduleObject,
ArgList(), 1, globalObject->commonStrings().requireString(globalObject));
ArgList(), 1, globalObject->commonStrings().requireString(globalObject),
JSC::makeSource(WTF::String(), JSC::SourceOrigin(), JSC::SourceTaintedOrigin::Untainted));
RETURN_IF_EXCEPTION(scope, nullptr);
JSFunction* resolveFunction = JSC::JSBoundFunction::create(vm,
globalObject,
globalObject->requireResolveFunctionUnbound(),
moduleObject->filename(),
ArgList(), 1, globalObject->commonStrings().resolveString(globalObject));
ArgList(), 1, globalObject->commonStrings().resolveString(globalObject),
JSC::makeSource(WTF::String(), JSC::SourceOrigin(), JSC::SourceTaintedOrigin::Untainted));
RETURN_IF_EXCEPTION(scope, nullptr);
requireFunction->putDirect(vm, vm.propertyNames->resolve, resolveFunction, 0);

View File

@@ -39,8 +39,6 @@
class FFICallbackFunctionWrapper {
WTF_MAKE_FAST_ALLOCATED;
public:
JSC::Strong<JSC::JSFunction> m_function;
JSC::Strong<Zig::GlobalObject> globalObject;

View File

@@ -32,8 +32,6 @@ public:
{
return new JSPropertyIterator(vm, data);
}
WTF_MAKE_FAST_ALLOCATED;
};
extern "C" JSPropertyIterator* Bun__JSPropertyIterator__create(JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue encodedValue, size_t* count, bool own_properties_only, bool only_non_index_properties)

View File

@@ -40,9 +40,7 @@ using ScriptExecutionContextIdentifier = uint32_t;
DECLARE_ALLOCATOR_WITH_HEAP_IDENTIFIER(ScriptExecutionContext);
#endif
class ScriptExecutionContext : public CanMakeWeakPtr<ScriptExecutionContext>, public RefCounted<ScriptExecutionContext> {
#if ENABLE(MALLOC_BREAKDOWN)
WTF_MAKE_FAST_ALLOCATED_WITH_HEAP_IDENTIFIER(ScriptExecutionContext);
#else
#if !ENABLE(MALLOC_BREAKDOWN)
WTF_MAKE_TZONE_ALLOCATED(ScriptExecutionContext);
#endif

View File

@@ -1284,7 +1284,7 @@ const JSC::GlobalObjectMethodTable& EvalGlobalObject::globalObjectMethodTable()
GlobalObject::GlobalObject(JSC::VM& vm, JSC::Structure* structure, const JSC::GlobalObjectMethodTable* methodTable)
: Base(vm, structure, methodTable)
, m_bunVM(Bun__getVM())
, m_constructors(makeUnique<WebCore::DOMConstructors>())
, m_constructors(makeUniqueWithoutFastMallocCheck<WebCore::DOMConstructors>())
, m_world(static_cast<JSVMClientData*>(vm.clientData)->normalWorld())
, m_worldIsNormal(true)
, m_builtinInternalFunctions(vm)
@@ -1299,7 +1299,7 @@ GlobalObject::GlobalObject(JSC::VM& vm, JSC::Structure* structure, const JSC::Gl
GlobalObject::GlobalObject(JSC::VM& vm, JSC::Structure* structure, WebCore::ScriptExecutionContextIdentifier contextId, const JSC::GlobalObjectMethodTable* methodTable)
: Base(vm, structure, methodTable)
, m_bunVM(Bun__getVM())
, m_constructors(makeUnique<WebCore::DOMConstructors>())
, m_constructors(makeUniqueWithoutFastMallocCheck<WebCore::DOMConstructors>())
, m_world(static_cast<JSVMClientData*>(vm.clientData)->normalWorld())
, m_worldIsNormal(true)
, m_builtinInternalFunctions(vm)

View File

@@ -25,7 +25,6 @@ JSC::SourceID sourceIDForSourceURL(const WTF::String& sourceURL);
void* sourceMappingForSourceURL(const WTF::String& sourceURL);
JSC::SourceOrigin toSourceOrigin(const String& sourceURL, bool isBuiltin);
class SourceProvider final : public JSC::SourceProvider {
WTF_MAKE_FAST_ALLOCATED;
using Base = JSC::SourceProvider;
using BytecodeCacheGenerator = JSC::BytecodeCacheGenerator;
using UnlinkedFunctionExecutable = JSC::UnlinkedFunctionExecutable;

View File

@@ -1723,9 +1723,8 @@ bool WebCore__FetchHeaders__isEmpty(WebCore::FetchHeaders* arg0)
WebCore::FetchHeaders* WebCore__FetchHeaders__createEmpty()
{
auto* headers = new WebCore::FetchHeaders({ WebCore::FetchHeaders::Guard::None, {} });
headers->relaxAdoptionRequirement();
return headers;
auto headers = WebCore::FetchHeaders::create(WebCore::FetchHeaders::Guard::None, {});
return &headers.leakRef();
}
void WebCore__FetchHeaders__append(WebCore::FetchHeaders* headers, const ZigString* arg1, const ZigString* arg2,
JSC::JSGlobalObject* lexicalGlobalObject)
@@ -1775,8 +1774,7 @@ WebCore::FetchHeaders* WebCore__FetchHeaders__createFromJS(JSC::JSGlobalObject*
}
}
auto* headers = new WebCore::FetchHeaders({ WebCore::FetchHeaders::Guard::None, {} });
headers->relaxAdoptionRequirement();
auto headers = WebCore::FetchHeaders::create(WebCore::FetchHeaders::Guard::None, {});
// `fill` doesn't set an exception on the VM if it fails, it returns an
// ExceptionOr<void>. So we need to check for the exception and, if set,
@@ -1784,13 +1782,12 @@ WebCore::FetchHeaders* WebCore__FetchHeaders__createFromJS(JSC::JSGlobalObject*
WebCore::propagateException(*lexicalGlobalObject, throwScope, headers->fill(WTFMove(init.value())));
// If there's an exception, it will be thrown by the above call to fill().
// in that case, let's also free the headers to make memory leaks harder.
// in that case, the headers should not be leaked.
if (throwScope.exception()) {
headers->deref();
return nullptr;
}
return headers;
return &headers.leakRef();
}
JSC::EncodedJSValue WebCore__FetchHeaders__toJS(WebCore::FetchHeaders* headers, JSC::JSGlobalObject* lexicalGlobalObject)
@@ -1798,15 +1795,10 @@ JSC::EncodedJSValue WebCore__FetchHeaders__toJS(WebCore::FetchHeaders* headers,
Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject);
ASSERT_NO_PENDING_EXCEPTION(globalObject);
bool needsMemoryCost = headers->hasOneRef();
// Since we're passing raw pointers, we can't easily check ref count
// The memory cost will be computed when needed
JSValue value = WebCore::toJS(lexicalGlobalObject, globalObject, headers);
if (needsMemoryCost) {
JSFetchHeaders* jsHeaders = jsCast<JSFetchHeaders*>(value);
jsHeaders->computeMemoryCost();
}
return JSC::JSValue::encode(value);
}
@@ -1814,7 +1806,7 @@ JSC::EncodedJSValue WebCore__FetchHeaders__clone(WebCore::FetchHeaders* headers,
{
auto throwScope = DECLARE_THROW_SCOPE(arg1->vm());
Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(arg1);
auto* clone = new WebCore::FetchHeaders({ WebCore::FetchHeaders::Guard::None, {} });
auto clone = WebCore::FetchHeaders::create(WebCore::FetchHeaders::Guard::None, {});
WebCore::propagateException(*arg1, throwScope, clone->fill(*headers));
return JSC::JSValue::encode(WebCore::toJSNewlyCreated(arg1, globalObject, WTFMove(clone)));
}
@@ -1822,10 +1814,9 @@ JSC::EncodedJSValue WebCore__FetchHeaders__clone(WebCore::FetchHeaders* headers,
WebCore::FetchHeaders* WebCore__FetchHeaders__cloneThis(WebCore::FetchHeaders* headers, JSC::JSGlobalObject* lexicalGlobalObject)
{
auto throwScope = DECLARE_THROW_SCOPE(lexicalGlobalObject->vm());
auto* clone = new WebCore::FetchHeaders({ WebCore::FetchHeaders::Guard::None, {} });
clone->relaxAdoptionRequirement();
auto clone = WebCore::FetchHeaders::create(WebCore::FetchHeaders::Guard::None, {});
WebCore::propagateException(*lexicalGlobalObject, throwScope, clone->fill(*headers));
return clone;
return &clone.leakRef();
}
bool WebCore__FetchHeaders__fastHas_(WebCore::FetchHeaders* arg0, unsigned char HTTPHeaderName1)
@@ -1913,8 +1904,7 @@ typedef struct PicoHTTPHeaders {
WebCore::FetchHeaders* WebCore__FetchHeaders__createFromPicoHeaders_(const void* arg1)
{
PicoHTTPHeaders pico_headers = *reinterpret_cast<const PicoHTTPHeaders*>(arg1);
auto* headers = new WebCore::FetchHeaders({ WebCore::FetchHeaders::Guard::None, {} });
headers->relaxAdoptionRequirement(); // This prevents an assertion later, but may not be the proper approach.
auto headers = WebCore::FetchHeaders::create(WebCore::FetchHeaders::Guard::None, {});
if (pico_headers.len > 0) {
HTTPHeaderMap map = HTTPHeaderMap();
@@ -1949,14 +1939,13 @@ WebCore::FetchHeaders* WebCore__FetchHeaders__createFromPicoHeaders_(const void*
headers->setInternalHeaders(WTFMove(map));
}
return headers;
return &headers.leakRef();
}
WebCore::FetchHeaders* WebCore__FetchHeaders__createFromUWS(void* arg1)
{
uWS::HttpRequest req = *reinterpret_cast<uWS::HttpRequest*>(arg1);
auto* headers = new WebCore::FetchHeaders({ WebCore::FetchHeaders::Guard::None, {} });
headers->relaxAdoptionRequirement(); // This prevents an assertion later, but may not be the proper approach.
auto headers = WebCore::FetchHeaders::create(WebCore::FetchHeaders::Guard::None, {});
HTTPHeaderMap map = HTTPHeaderMap();
@@ -1976,7 +1965,7 @@ WebCore::FetchHeaders* WebCore__FetchHeaders__createFromUWS(void* arg1)
}
}
headers->setInternalHeaders(WTFMove(map));
return headers;
return &headers.leakRef();
}
void WebCore__FetchHeaders__deref(WebCore::FetchHeaders* arg0)
{

View File

@@ -202,7 +202,6 @@ static inline JSC::JSValue jsBigIntFromSQLite(JSC::JSGlobalObject* globalObject,
DECLARE_ALLOCATOR_WITH_HEAP_IDENTIFIER(VersionSqlite3);
class VersionSqlite3 {
WTF_MAKE_FAST_ALLOCATED_WITH_HEAP_IDENTIFIER(VersionSqlite3);
public:
explicit VersionSqlite3(sqlite3* db)

View File

@@ -10,7 +10,6 @@ using namespace JSC;
class DOMClientIsoSubspaces {
WTF_MAKE_NONCOPYABLE(DOMClientIsoSubspaces);
WTF_MAKE_FAST_ALLOCATED(DOMClientIsoSubspaces);
public:
DOMClientIsoSubspaces() = default;

View File

@@ -868,7 +868,6 @@ static constexpr unsigned numberOfDOMConstructors = numberOfDOMConstructorsBase
class DOMConstructors {
WTF_MAKE_NONCOPYABLE(DOMConstructors);
WTF_MAKE_FAST_ALLOCATED(DOMConstructors);
public:
using ConstructorArray = std::array<JSC::WriteBarrier<JSC::JSObject>, numberOfDOMConstructors>;

View File

@@ -11,7 +11,6 @@ using namespace JSC;
class DOMIsoSubspaces {
WTF_MAKE_NONCOPYABLE(DOMIsoSubspaces);
WTF_MAKE_FAST_ALLOCATED(DOMIsoSubspaces);
public:
DOMIsoSubspaces() = default;

View File

@@ -35,7 +35,6 @@ namespace WebCore {
template<typename IDLType>
class DOMPromiseProxy {
WTF_MAKE_FAST_ALLOCATED;
public:
using Value = typename IDLType::StorageType;
@@ -62,7 +61,6 @@ private:
template<>
class DOMPromiseProxy<IDLUndefined> {
WTF_MAKE_FAST_ALLOCATED;
public:
DOMPromiseProxy() = default;
@@ -88,7 +86,6 @@ private:
// FontFace and FontFaceSet.
template<typename IDLType>
class DOMPromiseProxyWithResolveCallback {
WTF_MAKE_FAST_ALLOCATED;
public:
using ResolveCallback = Function<typename IDLType::ParameterType()>;

View File

@@ -35,7 +35,6 @@
namespace WebCore {
class EventContext {
WTF_MAKE_FAST_ALLOCATED;
public:
using EventInvokePhase = EventTarget::EventInvokePhase;

View File

@@ -42,7 +42,6 @@ namespace WebCore {
struct EventNames {
WTF_MAKE_NONCOPYABLE(EventNames);
WTF_MAKE_FAST_ALLOCATED;
public:
#define DOM_EVENT_NAMES_DECLARE(name) const AtomString name##Event;

View File

@@ -35,7 +35,6 @@ class Page;
template<typename T> class EventSender {
WTF_MAKE_NONCOPYABLE(EventSender);
WTF_MAKE_FAST_ALLOCATED;
public:
explicit EventSender(const AtomString& eventType);

View File

@@ -38,10 +38,7 @@ namespace WebCore {
class ScriptExecutionContext;
DECLARE_ALLOCATOR_WITH_HEAP_IDENTIFIER(FetchHeaders);
class FetchHeaders : public RefCounted<FetchHeaders> {
WTF_MAKE_FAST_ALLOCATED_WITH_HEAP_IDENTIFIER(FetchHeaders);
public:
enum class Guard {

View File

@@ -42,7 +42,6 @@ namespace WebCore {
// (and synchronization would be slow).
class JSCallbackData {
WTF_MAKE_FAST_ALLOCATED;
public:
enum class CallbackType { Function,

View File

@@ -213,7 +213,6 @@ private:
};
class DOMPromiseDeferredBase {
WTF_MAKE_FAST_ALLOCATED;
public:
DOMPromiseDeferredBase(Ref<DeferredPromise>&& genericPromise)

View File

@@ -7,7 +7,6 @@ namespace WebCore {
// Wrapper type for JSEventEmitter's castedThis because JSDOMWindow and JSWorkerGlobalScope do not inherit JSEventEmitter.
class JSEventEmitterWrapper {
WTF_MAKE_FAST_ALLOCATED;
public:
JSEventEmitterWrapper(EventEmitter& wrapped, JSC::JSObject* wrapper)

View File

@@ -66,7 +66,7 @@ EventTarget* JSEventTarget::toWrapped(VM& vm, JSValue value)
std::unique_ptr<JSEventTargetWrapper> jsEventTargetCast(VM& vm, JSValue thisValue)
{
if (auto* target = jsDynamicCast<JSEventTarget*>(thisValue))
return makeUnique<JSEventTargetWrapper>(target->wrapped(), *target);
return makeUniqueWithoutFastMallocCheck<JSEventTargetWrapper>(target->wrapped(), *target);
if (!thisValue.isObject())
return nullptr;
@@ -77,7 +77,7 @@ std::unique_ptr<JSEventTargetWrapper> jsEventTargetCast(VM& vm, JSValue thisValu
return nullptr;
}
if (auto* global = jsDynamicCast<Zig::GlobalObject*>(object))
return makeUnique<JSEventTargetWrapper>(global->eventTarget(), *global);
return makeUniqueWithoutFastMallocCheck<JSEventTargetWrapper>(global->eventTarget(), *global);
// if (auto* window = toJSDOMGlobalObject<JSDOMGlobalObject>(vm, thisValue))
// return makeUnique<JSEventTargetWrapper>(*window, *window);

View File

@@ -32,7 +32,7 @@ namespace WebCore {
// Wrapper type for JSEventTarget's castedThis because JSDOMWindow and JSWorkerGlobalScope do not inherit JSEventTarget.
class JSEventTargetWrapper {
WTF_MAKE_FAST_ALLOCATED;
WTF_DEPRECATED_MAKE_FAST_ALLOCATED(JSEventTargetWrapper);
public:
JSEventTargetWrapper(EventTarget& wrapped, JSC::JSObject& wrapper)

View File

@@ -61,7 +61,6 @@ constexpr MonotonicTime reusedTLSConnectionSentinel { MonotonicTime::fromRawSeco
struct AdditionalNetworkLoadMetricsForWebInspector;
class NetworkLoadMetrics {
WTF_MAKE_FAST_ALLOCATED(NetworkLoadMetrics);
public:
WEBCORE_EXPORT NetworkLoadMetrics();

View File

@@ -369,7 +369,7 @@ bool Performance::isResourceTimingBufferFull() const
ExceptionOr<Ref<PerformanceMark>> Performance::mark(JSC::JSGlobalObject& globalObject, const String& markName, std::optional<PerformanceMarkOptions>&& markOptions)
{
if (!m_userTiming)
m_userTiming = makeUnique<PerformanceUserTiming>(*this);
m_userTiming = makeUniqueWithoutFastMallocCheck<PerformanceUserTiming>(*this);
auto mark = m_userTiming->mark(globalObject, markName, WTFMove(markOptions));
if (mark.hasException())
@@ -382,14 +382,14 @@ ExceptionOr<Ref<PerformanceMark>> Performance::mark(JSC::JSGlobalObject& globalO
void Performance::clearMarks(const String& markName)
{
if (!m_userTiming)
m_userTiming = makeUnique<PerformanceUserTiming>(*this);
m_userTiming = makeUniqueWithoutFastMallocCheck<PerformanceUserTiming>(*this);
m_userTiming->clearMarks(markName);
}
ExceptionOr<Ref<PerformanceMeasure>> Performance::measure(JSC::JSGlobalObject& globalObject, const String& measureName, std::optional<StartOrMeasureOptions>&& startOrMeasureOptions, const String& endMark)
{
if (!m_userTiming)
m_userTiming = makeUnique<PerformanceUserTiming>(*this);
m_userTiming = makeUniqueWithoutFastMallocCheck<PerformanceUserTiming>(*this);
auto measure = m_userTiming->measure(globalObject, measureName, WTFMove(startOrMeasureOptions), endMark);
if (measure.hasException())
@@ -402,7 +402,7 @@ ExceptionOr<Ref<PerformanceMeasure>> Performance::measure(JSC::JSGlobalObject& g
void Performance::clearMeasures(const String& measureName)
{
if (!m_userTiming)
m_userTiming = makeUnique<PerformanceUserTiming>(*this);
m_userTiming = makeUniqueWithoutFastMallocCheck<PerformanceUserTiming>(*this);
m_userTiming->clearMeasures(measureName);
}

View File

@@ -39,7 +39,6 @@ namespace WebCore {
DECLARE_ALLOCATOR_WITH_HEAP_IDENTIFIER(PerformanceEntry);
class PerformanceEntry : public RefCounted<PerformanceEntry> {
WTF_MAKE_FAST_ALLOCATED_WITH_HEAP_IDENTIFIER(PerformanceEntry);
public:
virtual ~PerformanceEntry();

View File

@@ -34,7 +34,6 @@ namespace WebCore {
class PerformanceEntry;
class PerformanceObserverEntryList : public RefCounted<PerformanceObserverEntryList> {
WTF_MAKE_FAST_ALLOCATED;
public:
static Ref<PerformanceObserverEntryList> create(Vector<RefPtr<PerformanceEntry>>&& entries);

View File

@@ -42,7 +42,6 @@ class Performance;
using PerformanceEntryMap = HashMap<String, Vector<RefPtr<PerformanceEntry>>>;
class PerformanceUserTiming {
WTF_MAKE_FAST_ALLOCATED;
public:
explicit PerformanceUserTiming(Performance&);

View File

@@ -32,7 +32,7 @@ ReadableStreamSource::~ReadableStreamSource() = default;
void ReadableStreamSource::start(ReadableStreamDefaultController&& controller, DOMPromiseDeferred<void>&& promise)
{
ASSERT(!m_promise);
m_promise = makeUnique<DOMPromiseDeferred<void>>(WTFMove(promise));
m_promise = makeUniqueWithoutFastMallocCheck<DOMPromiseDeferred<void>>(WTFMove(promise));
m_controller = WTFMove(controller);
setActive();
@@ -44,7 +44,7 @@ void ReadableStreamSource::pull(DOMPromiseDeferred<void>&& promise)
ASSERT(!m_promise);
ASSERT(m_controller);
m_promise = makeUnique<DOMPromiseDeferred<void>>(WTFMove(promise));
m_promise = makeUniqueWithoutFastMallocCheck<DOMPromiseDeferred<void>>(WTFMove(promise));
setActive();
doPull();

View File

@@ -42,7 +42,6 @@ class SecurityOrigin;
DECLARE_ALLOCATOR_WITH_HEAP_IDENTIFIER(ResourceTiming);
class ResourceTiming {
WTF_MAKE_FAST_ALLOCATED_WITH_HEAP_IDENTIFIER(ResourceTiming);
public:
// static ResourceTiming fromMemoryCache(const URL&, const String& initiator const ResourceResponse&, const NetworkLoadMetrics&, const SecurityOrigin&);

View File

@@ -84,9 +84,7 @@ using WasmModuleArray = Vector<RefPtr<JSC::Wasm::Module>>;
using WasmMemoryHandleArray = Vector<RefPtr<JSC::SharedArrayBufferContents>>;
#endif
DECLARE_ALLOCATOR_WITH_HEAP_IDENTIFIER(SerializedScriptValue);
class SerializedScriptValue : public ThreadSafeRefCounted<SerializedScriptValue> {
WTF_MAKE_FAST_ALLOCATED_WITH_HEAP_IDENTIFIER(SerializedScriptValue);
public:
static SYSV_ABI void writeBytesForBun(CloneSerializer*, const uint8_t*, uint32_t);

View File

@@ -34,7 +34,6 @@
namespace WebCore {
class CryptoAlgorithmParameters {
WTF_MAKE_FAST_ALLOCATED;
public:
enum class Class {

View File

@@ -75,11 +75,12 @@ struct CryptoDigestContext {
template<typename SHAContext, typename SHAFunctions>
struct CryptoDigestContextImpl : public CryptoDigestContext {
WTF_MAKE_STRUCT_FAST_ALLOCATED;
WTF_DEPRECATED_MAKE_FAST_ALLOCATED(CryptoDigestContextImpl);
public:
static std::unique_ptr<CryptoDigestContext> create()
{
return makeUnique<CryptoDigestContextImpl>();
return makeUniqueWithoutFastMallocCheck<CryptoDigestContextImpl>();
}
CryptoDigestContextImpl()

View File

@@ -138,31 +138,31 @@ static ExceptionOr<std::unique_ptr<CryptoAlgorithmParameters>> normalizeCryptoAl
case CryptoAlgorithmIdentifier::RSAES_PKCS1_v1_5:
if (isRSAESPKCSWebCryptoDeprecated(state))
return Exception { NotSupportedError, "RSAES-PKCS1-v1_5 support is deprecated"_s };
result = makeUnique<CryptoAlgorithmParameters>(params);
result = makeUniqueWithoutFastMallocCheck<CryptoAlgorithmParameters>(params);
break;
case CryptoAlgorithmIdentifier::RSA_OAEP: {
auto params = convertDictionary<CryptoAlgorithmRsaOaepParams>(state, value.get());
RETURN_IF_EXCEPTION(scope, Exception { ExistingExceptionError });
result = makeUnique<CryptoAlgorithmRsaOaepParams>(params);
result = makeUniqueWithoutFastMallocCheck<CryptoAlgorithmRsaOaepParams>(params);
break;
}
case CryptoAlgorithmIdentifier::AES_CBC:
case CryptoAlgorithmIdentifier::AES_CFB: {
auto params = convertDictionary<CryptoAlgorithmAesCbcCfbParams>(state, value.get());
RETURN_IF_EXCEPTION(scope, Exception { ExistingExceptionError });
result = makeUnique<CryptoAlgorithmAesCbcCfbParams>(params);
result = makeUniqueWithoutFastMallocCheck<CryptoAlgorithmAesCbcCfbParams>(params);
break;
}
case CryptoAlgorithmIdentifier::AES_CTR: {
auto params = convertDictionary<CryptoAlgorithmAesCtrParams>(state, value.get());
RETURN_IF_EXCEPTION(scope, Exception { ExistingExceptionError });
result = makeUnique<CryptoAlgorithmAesCtrParams>(params);
result = makeUniqueWithoutFastMallocCheck<CryptoAlgorithmAesCtrParams>(params);
break;
}
case CryptoAlgorithmIdentifier::AES_GCM: {
auto params = convertDictionary<CryptoAlgorithmAesGcmParams>(state, value.get());
RETURN_IF_EXCEPTION(scope, Exception { ExistingExceptionError });
result = makeUnique<CryptoAlgorithmAesGcmParams>(params);
result = makeUniqueWithoutFastMallocCheck<CryptoAlgorithmAesGcmParams>(params);
break;
}
default:
@@ -175,7 +175,7 @@ static ExceptionOr<std::unique_ptr<CryptoAlgorithmParameters>> normalizeCryptoAl
case CryptoAlgorithmIdentifier::RSASSA_PKCS1_v1_5:
case CryptoAlgorithmIdentifier::HMAC:
case CryptoAlgorithmIdentifier::Ed25519:
result = makeUnique<CryptoAlgorithmParameters>(params);
result = makeUniqueWithoutFastMallocCheck<CryptoAlgorithmParameters>(params);
break;
case CryptoAlgorithmIdentifier::ECDSA: {
auto params = convertDictionary<CryptoAlgorithmEcdsaParams>(state, value.get());
@@ -184,13 +184,13 @@ static ExceptionOr<std::unique_ptr<CryptoAlgorithmParameters>> normalizeCryptoAl
RETURN_IF_EXCEPTION(scope, Exception { ExistingExceptionError });
if (hashIdentifier.hasException()) return hashIdentifier.releaseException();
params.hashIdentifier = hashIdentifier.releaseReturnValue();
result = makeUnique<CryptoAlgorithmEcdsaParams>(params);
result = makeUniqueWithoutFastMallocCheck<CryptoAlgorithmEcdsaParams>(params);
break;
}
case CryptoAlgorithmIdentifier::RSA_PSS: {
auto params = convertDictionary<CryptoAlgorithmRsaPssParams>(state, value.get());
RETURN_IF_EXCEPTION(scope, Exception { ExistingExceptionError });
result = makeUnique<CryptoAlgorithmRsaPssParams>(params);
result = makeUniqueWithoutFastMallocCheck<CryptoAlgorithmRsaPssParams>(params);
break;
}
default:
@@ -204,7 +204,7 @@ static ExceptionOr<std::unique_ptr<CryptoAlgorithmParameters>> normalizeCryptoAl
case CryptoAlgorithmIdentifier::SHA_256:
case CryptoAlgorithmIdentifier::SHA_384:
case CryptoAlgorithmIdentifier::SHA_512:
result = makeUnique<CryptoAlgorithmParameters>(params);
result = makeUniqueWithoutFastMallocCheck<CryptoAlgorithmParameters>(params);
break;
default:
return Exception { NotSupportedError };
@@ -217,7 +217,7 @@ static ExceptionOr<std::unique_ptr<CryptoAlgorithmParameters>> normalizeCryptoAl
return Exception { NotSupportedError, "RSAES-PKCS1-v1_5 support is deprecated"_s };
auto params = convertDictionary<CryptoAlgorithmRsaKeyGenParams>(state, value.get());
RETURN_IF_EXCEPTION(scope, Exception { ExistingExceptionError });
result = makeUnique<CryptoAlgorithmRsaKeyGenParams>(params);
result = makeUniqueWithoutFastMallocCheck<CryptoAlgorithmRsaKeyGenParams>(params);
break;
}
case CryptoAlgorithmIdentifier::RSASSA_PKCS1_v1_5:
@@ -229,7 +229,7 @@ static ExceptionOr<std::unique_ptr<CryptoAlgorithmParameters>> normalizeCryptoAl
RETURN_IF_EXCEPTION(scope, Exception { ExistingExceptionError });
if (hashIdentifier.hasException()) return hashIdentifier.releaseException();
params.hashIdentifier = hashIdentifier.releaseReturnValue();
result = makeUnique<CryptoAlgorithmRsaHashedKeyGenParams>(params);
result = makeUniqueWithoutFastMallocCheck<CryptoAlgorithmRsaHashedKeyGenParams>(params);
break;
}
case CryptoAlgorithmIdentifier::AES_CTR:
@@ -239,7 +239,7 @@ static ExceptionOr<std::unique_ptr<CryptoAlgorithmParameters>> normalizeCryptoAl
case CryptoAlgorithmIdentifier::AES_KW: {
auto params = convertDictionary<CryptoAlgorithmAesKeyParams>(state, value.get());
RETURN_IF_EXCEPTION(scope, Exception { ExistingExceptionError });
result = makeUnique<CryptoAlgorithmAesKeyParams>(params);
result = makeUniqueWithoutFastMallocCheck<CryptoAlgorithmAesKeyParams>(params);
break;
}
case CryptoAlgorithmIdentifier::HMAC: {
@@ -249,21 +249,21 @@ static ExceptionOr<std::unique_ptr<CryptoAlgorithmParameters>> normalizeCryptoAl
RETURN_IF_EXCEPTION(scope, Exception { ExistingExceptionError });
if (hashIdentifier.hasException()) return hashIdentifier.releaseException();
params.hashIdentifier = hashIdentifier.releaseReturnValue();
result = makeUnique<CryptoAlgorithmHmacKeyParams>(params);
result = makeUniqueWithoutFastMallocCheck<CryptoAlgorithmHmacKeyParams>(params);
break;
}
case CryptoAlgorithmIdentifier::ECDSA:
case CryptoAlgorithmIdentifier::ECDH: {
auto params = convertDictionary<CryptoAlgorithmEcKeyParams>(state, value.get());
RETURN_IF_EXCEPTION(scope, Exception { ExistingExceptionError });
result = makeUnique<CryptoAlgorithmEcKeyParams>(params);
result = makeUniqueWithoutFastMallocCheck<CryptoAlgorithmEcKeyParams>(params);
break;
}
case CryptoAlgorithmIdentifier::Ed25519:
result = makeUnique<CryptoAlgorithmParameters>(params);
result = makeUniqueWithoutFastMallocCheck<CryptoAlgorithmParameters>(params);
break;
case CryptoAlgorithmIdentifier::X25519:
result = makeUnique<CryptoAlgorithmParameters>(params);
result = makeUniqueWithoutFastMallocCheck<CryptoAlgorithmParameters>(params);
break;
default:
return Exception { NotSupportedError };
@@ -281,7 +281,7 @@ static ExceptionOr<std::unique_ptr<CryptoAlgorithmParameters>> normalizeCryptoAl
auto params = convertDictionary<CryptoAlgorithmEcdhKeyDeriveParams>(state, newValue);
RETURN_IF_EXCEPTION(scope, Exception { ExistingExceptionError });
result = makeUnique<CryptoAlgorithmEcdhKeyDeriveParams>(params);
result = makeUniqueWithoutFastMallocCheck<CryptoAlgorithmEcdhKeyDeriveParams>(params);
break;
}
case CryptoAlgorithmIdentifier::X25519: {
@@ -294,7 +294,7 @@ static ExceptionOr<std::unique_ptr<CryptoAlgorithmParameters>> normalizeCryptoAl
auto params = convertDictionary<CryptoAlgorithmX25519Params>(state, newValue);
RETURN_IF_EXCEPTION(scope, Exception { ExistingExceptionError });
result = makeUnique<CryptoAlgorithmX25519Params>(params);
result = makeUniqueWithoutFastMallocCheck<CryptoAlgorithmX25519Params>(params);
break;
}
case CryptoAlgorithmIdentifier::HKDF: {
@@ -304,7 +304,7 @@ static ExceptionOr<std::unique_ptr<CryptoAlgorithmParameters>> normalizeCryptoAl
RETURN_IF_EXCEPTION(scope, Exception { ExistingExceptionError });
if (hashIdentifier.hasException()) return hashIdentifier.releaseException();
params.hashIdentifier = hashIdentifier.releaseReturnValue();
result = makeUnique<CryptoAlgorithmHkdfParams>(params);
result = makeUniqueWithoutFastMallocCheck<CryptoAlgorithmHkdfParams>(params);
break;
}
case CryptoAlgorithmIdentifier::PBKDF2: {
@@ -314,7 +314,7 @@ static ExceptionOr<std::unique_ptr<CryptoAlgorithmParameters>> normalizeCryptoAl
RETURN_IF_EXCEPTION(scope, Exception { ExistingExceptionError });
if (hashIdentifier.hasException()) return hashIdentifier.releaseException();
params.hashIdentifier = hashIdentifier.releaseReturnValue();
result = makeUnique<CryptoAlgorithmPbkdf2Params>(params);
result = makeUniqueWithoutFastMallocCheck<CryptoAlgorithmPbkdf2Params>(params);
break;
}
default:
@@ -326,7 +326,7 @@ static ExceptionOr<std::unique_ptr<CryptoAlgorithmParameters>> normalizeCryptoAl
case CryptoAlgorithmIdentifier::RSAES_PKCS1_v1_5:
if (isRSAESPKCSWebCryptoDeprecated(state))
return Exception { NotSupportedError, "RSAES-PKCS1-v1_5 support is deprecated"_s };
result = makeUnique<CryptoAlgorithmParameters>(params);
result = makeUniqueWithoutFastMallocCheck<CryptoAlgorithmParameters>(params);
break;
case CryptoAlgorithmIdentifier::RSASSA_PKCS1_v1_5:
case CryptoAlgorithmIdentifier::RSA_PSS:
@@ -337,7 +337,7 @@ static ExceptionOr<std::unique_ptr<CryptoAlgorithmParameters>> normalizeCryptoAl
RETURN_IF_EXCEPTION(scope, Exception { ExistingExceptionError });
if (hashIdentifier.hasException()) return hashIdentifier.releaseException();
params.hashIdentifier = hashIdentifier.releaseReturnValue();
result = makeUnique<CryptoAlgorithmRsaHashedImportParams>(params);
result = makeUniqueWithoutFastMallocCheck<CryptoAlgorithmRsaHashedImportParams>(params);
break;
}
case CryptoAlgorithmIdentifier::AES_CTR:
@@ -347,7 +347,7 @@ static ExceptionOr<std::unique_ptr<CryptoAlgorithmParameters>> normalizeCryptoAl
case CryptoAlgorithmIdentifier::AES_KW:
case CryptoAlgorithmIdentifier::Ed25519:
case CryptoAlgorithmIdentifier::X25519:
result = makeUnique<CryptoAlgorithmParameters>(params);
result = makeUniqueWithoutFastMallocCheck<CryptoAlgorithmParameters>(params);
break;
case CryptoAlgorithmIdentifier::HMAC: {
auto params = convertDictionary<CryptoAlgorithmHmacKeyParams>(state, value.get());
@@ -356,19 +356,19 @@ static ExceptionOr<std::unique_ptr<CryptoAlgorithmParameters>> normalizeCryptoAl
RETURN_IF_EXCEPTION(scope, Exception { ExistingExceptionError });
if (hashIdentifier.hasException()) return hashIdentifier.releaseException();
params.hashIdentifier = hashIdentifier.releaseReturnValue();
result = makeUnique<CryptoAlgorithmHmacKeyParams>(params);
result = makeUniqueWithoutFastMallocCheck<CryptoAlgorithmHmacKeyParams>(params);
break;
}
case CryptoAlgorithmIdentifier::ECDSA:
case CryptoAlgorithmIdentifier::ECDH: {
auto params = convertDictionary<CryptoAlgorithmEcKeyParams>(state, value.get());
RETURN_IF_EXCEPTION(scope, Exception { ExistingExceptionError });
result = makeUnique<CryptoAlgorithmEcKeyParams>(params);
result = makeUniqueWithoutFastMallocCheck<CryptoAlgorithmEcKeyParams>(params);
break;
}
case CryptoAlgorithmIdentifier::HKDF:
case CryptoAlgorithmIdentifier::PBKDF2:
result = makeUnique<CryptoAlgorithmParameters>(params);
result = makeUniqueWithoutFastMallocCheck<CryptoAlgorithmParameters>(params);
break;
case CryptoAlgorithmIdentifier::SHA_1:
case CryptoAlgorithmIdentifier::SHA_224:
@@ -385,7 +385,7 @@ static ExceptionOr<std::unique_ptr<CryptoAlgorithmParameters>> normalizeCryptoAl
case Operations::UnwrapKey:
switch (*identifier) {
case CryptoAlgorithmIdentifier::AES_KW:
result = makeUnique<CryptoAlgorithmParameters>(params);
result = makeUniqueWithoutFastMallocCheck<CryptoAlgorithmParameters>(params);
break;
default:
return Exception { NotSupportedError };
@@ -400,7 +400,7 @@ static ExceptionOr<std::unique_ptr<CryptoAlgorithmParameters>> normalizeCryptoAl
case CryptoAlgorithmIdentifier::AES_KW: {
auto params = convertDictionary<CryptoAlgorithmAesKeyParams>(state, value.get());
RETURN_IF_EXCEPTION(scope, Exception { ExistingExceptionError });
result = makeUnique<CryptoAlgorithmAesKeyParams>(params);
result = makeUniqueWithoutFastMallocCheck<CryptoAlgorithmAesKeyParams>(params);
break;
}
case CryptoAlgorithmIdentifier::HMAC: {
@@ -410,12 +410,12 @@ static ExceptionOr<std::unique_ptr<CryptoAlgorithmParameters>> normalizeCryptoAl
RETURN_IF_EXCEPTION(scope, Exception { ExistingExceptionError });
if (hashIdentifier.hasException()) return hashIdentifier.releaseException();
params.hashIdentifier = hashIdentifier.releaseReturnValue();
result = makeUnique<CryptoAlgorithmHmacKeyParams>(params);
result = makeUniqueWithoutFastMallocCheck<CryptoAlgorithmHmacKeyParams>(params);
break;
}
case CryptoAlgorithmIdentifier::HKDF:
case CryptoAlgorithmIdentifier::PBKDF2:
result = makeUnique<CryptoAlgorithmParameters>(params);
result = makeUniqueWithoutFastMallocCheck<CryptoAlgorithmParameters>(params);
break;
default:
return Exception { NotSupportedError };
@@ -577,16 +577,16 @@ static std::unique_ptr<CryptoAlgorithmParameters> crossThreadCopyImportParams(co
{
switch (importParams.parametersClass()) {
case CryptoAlgorithmParameters::Class::None: {
auto result = makeUnique<CryptoAlgorithmParameters>();
auto result = makeUniqueWithoutFastMallocCheck<CryptoAlgorithmParameters>();
result->identifier = importParams.identifier;
return result;
}
case CryptoAlgorithmParameters::Class::EcKeyParams:
return makeUnique<CryptoAlgorithmEcKeyParams>(crossThreadCopy(downcast<CryptoAlgorithmEcKeyParams>(importParams)));
return makeUniqueWithoutFastMallocCheck<CryptoAlgorithmEcKeyParams>(crossThreadCopy(downcast<CryptoAlgorithmEcKeyParams>(importParams)));
case CryptoAlgorithmParameters::Class::HmacKeyParams:
return makeUnique<CryptoAlgorithmHmacKeyParams>(crossThreadCopy(downcast<CryptoAlgorithmHmacKeyParams>(importParams)));
return makeUniqueWithoutFastMallocCheck<CryptoAlgorithmHmacKeyParams>(crossThreadCopy(downcast<CryptoAlgorithmHmacKeyParams>(importParams)));
case CryptoAlgorithmParameters::Class::RsaHashedImportParams:
return makeUnique<CryptoAlgorithmRsaHashedImportParams>(crossThreadCopy(downcast<CryptoAlgorithmRsaHashedImportParams>(importParams)));
return makeUniqueWithoutFastMallocCheck<CryptoAlgorithmRsaHashedImportParams>(crossThreadCopy(downcast<CryptoAlgorithmRsaHashedImportParams>(importParams)));
default:
ASSERT_NOT_REACHED();
return nullptr;

View File

@@ -987,6 +987,10 @@ export class Client extends EventEmitter {
// Create unique message ID for this evaluation
const messageId = Math.random().toString(36).slice(2);
if (this.exited) {
throw new Error("Client exited while waiting for error overlay");
}
// Send the evaluation request and wait for response
this.#proc.send({
type: "get-errors",
@@ -1006,6 +1010,10 @@ export class Client extends EventEmitter {
// Create unique message ID for this evaluation
const messageId = Math.random().toString(36).slice(2);
if (this.exited) {
throw new Error("Client exited while waiting for error overlay with visible modal");
}
// Send the evaluation request and wait for response
this.#proc.send({
type: "get-errors",
@@ -1074,6 +1082,10 @@ export class Client extends EventEmitter {
this.once(`js-result-${messageId}`, handler);
if (this.exited) {
throw new Error("Client exited while waiting for js");
}
// Send the evaluation request
this.#proc.send({
type: "evaluate",

View File

@@ -1730,6 +1730,8 @@ export function normalizeBunSnapshot(snapshot: string, optionalDir?: string) {
// Remove timestamps from test result lines that start with (pass), (fail), (skip), or (todo)
snapshot = snapshot.replace(/^((?:pass|fail|skip|todo)\) .+) \[[\d.]+\s?m?s\]$/gm, "$1");
snapshot = snapshot.replace(/(localhost|127\.0\.0\.1):\d+/g, "$1:<port>");
return (
snapshot
.replaceAll("\r\n", "\n")

View File

@@ -64,20 +64,20 @@ function make(expected: unknown) {
for (let data of inputType) {
test(`$(cat < ${data.constructor.name}).text()`, async () => {
expect(await $`cat < ${data}`.text()).toEqual(expected);
expect(await $`cat < ${data}`.quiet().text()).toEqual(expected);
});
if (ArrayBuffer.isView(data)) {
test(`$(cat hello > ${data.constructor.name}).text() passes`, async () => {
await $`cat ${import.meta.path} > ${data}`.quiet();
const out = await $`cat ${import.meta.path}`.arrayBuffer();
const out = await $`cat ${import.meta.path}`.quiet().arrayBuffer();
expect(data.subarray(0, out.byteLength)).toEqual(new Uint8Array(out));
});
// TODO: if the buffer is not sufficiently large, this will hang forever
} else {
test(`$(cat hello > ${data.constructor.name}).text() fails`, async () => {
expect(async () => await $`cat ${import.meta.path} > ${data}`.text()).toThrow();
expect(async () => await $`cat ${import.meta.path} > ${data}`.quiet().text()).toThrow();
});
}
}

View File

@@ -3,10 +3,10 @@ import { expect, test } from "bun:test";
test("which rlly long", async () => {
const longstr = "a".repeat(100000);
expect(async () => await $`${longstr}`.throws(true)).toThrow();
expect(async () => await $`${longstr}`.quiet().throws(true)).toThrow();
});
test("which PATH rlly long", async () => {
const longstr = "a".repeat(100000);
expect(async () => await $`PATH=${longstr} slkdfjlsdkfj`.throws(true)).toThrow();
expect(async () => await $`PATH=${longstr} slkdfjlsdkfj`.quiet().throws(true)).toThrow();
});

View File

@@ -9,11 +9,12 @@ const BUN = bunExe();
$.nothrow();
describe("bun exec", () => {
TestBuilder.command`${BUN} exec ${"echo hi!"}`.env(bunEnv).stdout("hi!\n").runAsTest("it works");
TestBuilder.command`${BUN} exec ${"echo hi!"}`.env(bunEnv).stdout("hi!\n").quiet().runAsTest("it works");
TestBuilder.command`${BUN} exec sldkfjslkdjflksdjflj`
.env(bunEnv)
.exitCode(1)
.stderr("bun: command not found: sldkfjslkdjflksdjflj\n")
.quiet()
.runAsTest("it works on command fail");
TestBuilder.command`${BUN} exec`
@@ -21,10 +22,12 @@ describe("bun exec", () => {
.stdout(
'Usage: bun exec <script>\n\nExecute a shell script directly from Bun.\n\nNote: If executing this from a shell, make sure to escape the string!\n\nExamples:\n bun exec "echo hi"\n bun exec "echo \\"hey friends\\"!"\n',
)
.quiet()
.runAsTest("no args prints help text");
TestBuilder.command`${BUN} exec ${{ raw: Bun.$.escape(`echo 'hi "there bud"'`) }}`
.stdout('hi "there bud"\n')
.quiet()
.runAsTest("it works2");
TestBuilder.command`${BUN} exec ${"cat filename"}`
@@ -40,6 +43,7 @@ describe("bun exec", () => {
.fill("a")
.join("")}`,
)
.quiet()
.runAsTest("write a lot of data");
describe("--help works", () => {
@@ -67,6 +71,7 @@ describe("bun exec", () => {
.exitCode(exitCode)
.stderr(stderr)
.stdout(stdout)
.quiet()
.runAsTest(item);
}
});
@@ -76,6 +81,7 @@ describe("bun exec", () => {
.exitCode(0)
.stderr("")
.stdout("")
.quiet()
.runAsTest("cd with no arguments works");
test("bun works even when not in PATH", async () => {
@@ -91,7 +97,8 @@ describe("bun exec", () => {
const result = await $`${BUN} exec ls`
.env({ ...(bunEnv as any) })
.cwd(join(tempdir, "Í"))
.quiet();
.quiet()
.run();
expect(result.text()).toBe("hi\n");
});
});

View File

@@ -24,11 +24,13 @@ describe("IOWriter file output redirection", () => {
TestBuilder.command`echo -n ${"x".repeat(1024 * 10)} > large.txt`
.exitCode(0)
.fileEquals("large.txt", "x".repeat(1024 * 10))
.quiet()
.runAsTest("large single write");
TestBuilder.command`mkdir -p subdir && echo "test" > subdir/file.txt`
.exitCode(0)
.fileEquals("subdir/file.txt", "test\n")
.quiet()
.runAsTest("write to subdirectory");
});

View File

@@ -149,13 +149,15 @@ describe("fd leak", () => {
Array(128 * 1024)
.fill("a")
.join(""),
])}`.stdout(str =>
expect(str).toEqual(
Array(128 * 1024)
.fill("a")
.join(""),
])}`
.quiet()
.stdout(str =>
expect(str).toEqual(
Array(128 * 1024)
.fill("a")
.join(""),
),
),
),
100,
);
memLeakTest(
@@ -165,10 +167,16 @@ describe("fd leak", () => {
Array(128 * 1024)
.fill("a")
.join(""),
])}`.stdout("hi\n"),
])}`
.quiet()
.stdout("hi\n"),
100,
);
memLeakTest(
"String",
() => TestBuilder.command`echo ${Array(4096).fill("a").join("")}`.quiet().stdout(() => {}),
100,
);
memLeakTest("String", () => TestBuilder.command`echo ${Array(4096).fill("a").join("")}`.stdout(() => {}), 100);
function memLeakTestProtect(
name: string,