Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions src/codegen/generate-jssink.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,6 @@ function header() {
}
void initializeProperties(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSObject* prototype);


// Must be defined for each specialization class.
static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*);

private:
${constructor}(JSC::VM& vm, JSC::Structure* structure, JSC::NativeFunction nativeFunction)
: Base(vm, structure, nativeFunction, nativeFunction)
Expand Down Expand Up @@ -707,11 +703,6 @@ void ${constructor}::finishCreation(VM& vm, JSC::JSGlobalObject* globalObject, J
initializeProperties(vm, globalObject, prototype);
}

JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES ${constructor}::construct(JSC::JSGlobalObject* globalObject, JSC::CallFrame* callFrame) {
return ${name}__construct(globalObject, callFrame);
}


void ${constructor}::initializeProperties(VM& vm, JSC::JSGlobalObject* globalObject, JSObject* prototype)
{
putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
Expand Down
6 changes: 0 additions & 6 deletions src/jsc/PluginRunner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ pub struct PluginRunner {
pub(crate) global_object: BackRef<JSGlobalObject>,
}

// Re-export the JSC-free static helpers so callers in this crate can keep
// writing `PluginRunner::could_be_plugin(...)` without naming `bun_bundler`.
impl PluginRunner {
/// Borrow the JS global stored by `Bun__onDidAppendPlugin`.
///
Expand All @@ -37,10 +35,6 @@ impl PluginRunner {
pub fn extract_namespace(specifier: &[u8]) -> &[u8] {
bun_bundler::transpiler::PluginRunner::extract_namespace(specifier)
}
#[inline]
pub fn could_be_plugin(specifier: &[u8]) -> bool {
bun_bundler::transpiler::PluginRunner::could_be_plugin(specifier)
}
}

impl PluginResolver for PluginRunner {
Expand Down
2 changes: 0 additions & 2 deletions src/jsc/bindings/BunCommonStrings.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@
macro(httpMSEARCH, "M-SEARCH") \
macro(httpNOTIFY, "NOTIFY") \
macro(httpOPTIONS, "OPTIONS") \
macro(OperationFailed, "The operation failed.") \
macro(OperationTimedOut, "The operation timed out.") \
/* node's AbortError default message, which unlike the DOMException one has no trailing period: https://github.com/nodejs/node/blob/v26.3.0/lib/internal/errors.js#L980 */ \
macro(OperationWasAborted, "The operation was aborted") \
macro(httpPATCH, "PATCH") \
Expand Down
7 changes: 0 additions & 7 deletions src/jsc/bindings/BunMarkdownTagStrings.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,6 @@ using namespace JSC;

class MarkdownTagStrings {
public:
#define MARKDOWN_TAG_STRINGS_ACCESSOR_DEFINITION(name, str, idx) \
JSC::JSString* name##String(JSC::JSGlobalObject* globalObject) { return stringAt(globalObject, idx); }

MARKDOWN_TAG_STRINGS_EACH_NAME(MARKDOWN_TAG_STRINGS_ACCESSOR_DEFINITION)

#undef MARKDOWN_TAG_STRINGS_ACCESSOR_DEFINITION

JSC::JSString* stringAt(JSC::JSGlobalObject* globalObject, size_t index)
{
return m_strings[index].getInitializedOnMainThread(globalObject);
Expand Down
6 changes: 0 additions & 6 deletions src/jsc/bindings/ErrorCode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,12 +266,6 @@ JSObject* createError(JSC::JSGlobalObject* globalObject, ErrorCode code, const S
return createError(globalObject->vm(), globalObject, code, message);
}

JSObject* createError(Zig::JSGlobalObject* globalObject, ErrorCode code, JSC::JSValue message)
{
auto& vm = JSC::getVM(globalObject);
return createError(vm, globalObject, code, message);
}

// `Bun.inspect` with `single_line` + `quote_strings` — the same renderer
// JSBuffer uses to inline a value into an error message; it renders objects
// on one line ("Received { abc: 123 }") the way Node does.
Expand Down
1 change: 0 additions & 1 deletion src/jsc/bindings/ErrorCode.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ class ErrorCodeCache : public JSC::JSInternalFieldObjectImpl<NODE_ERROR_COUNT> {
JSC::EncodedJSValue throwError(JSC::JSGlobalObject* globalObject, JSC::ThrowScope& scope, ErrorCode code, const WTF::String& message);
JSC::JSObject* createError(Zig::GlobalObject* globalObject, ErrorCode code, const WTF::String& message);
JSC::JSObject* createError(JSC::JSGlobalObject* globalObject, ErrorCode code, const WTF::String& message);
JSC::JSObject* createError(Zig::GlobalObject* globalObject, ErrorCode code, JSC::JSValue message);
JSC::JSObject* createError(VM& vm, Zig::GlobalObject* globalObject, ErrorCode code, JSValue message, JSValue options);
JSObject* createInvalidThisError(JSGlobalObject* globalObject, JSValue thisValue, const ASCIILiteral typeName);
// Throws createInvalidThisError(callFrame->thisValue()) and returns the empty value; one call at each generated host-function's invalid-this branch.
Expand Down
5 changes: 0 additions & 5 deletions src/jsc/bindings/JSBakeResponse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,6 @@ JSBakeResponse* JSBakeResponse::create(JSC::VM& vm, Zig::GlobalObject* globalObj
return ptr;
}

JSC::Structure* JSBakeResponse::createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
{
return Bun::createClassStructure(vm, globalObject, prototype, JSC::TypeInfo(static_cast<JSC::JSType>(0b11101110), StructureFlags), info());
}

JSC::GCClient::IsoSubspace* JSBakeResponse::subspaceForImpl(JSC::VM& vm)
{
return WebCore::subspaceForImpl<JSBakeResponse, WebCore::UseCustomHeapCellType::No>(vm, BUN_SUBSPACE_SLOTS(m_clientSubspaceForBakeResponse, m_subspaceForBakeResponse));
Expand Down
1 change: 0 additions & 1 deletion src/jsc/bindings/JSBakeResponse.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ class JSBakeResponse : public JSResponse {
DECLARE_INFO;

static JSBakeResponse* create(JSC::VM& vm, Zig::GlobalObject* globalObject, JSC::Structure* structure, void* ctx);
static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype);

JSBakeResponseKind kind() const { return m_kind; }
void kind(JSBakeResponseKind kind) { m_kind = kind; }
Expand Down
6 changes: 0 additions & 6 deletions src/jsc/bindings/node/JSNodeHTTPServerSocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,6 @@ JSNodeHTTPServerSocket* JSNodeHTTPServerSocket::create(JSC::VM& vm, JSC::Structu
return object;
}

JSNodeHTTPServerSocket* JSNodeHTTPServerSocket::create(JSC::VM& vm, Zig::GlobalObject* globalObject, us_socket_t* socket, bool is_ssl, WebCore::JSNodeHTTPResponse* response)
{
auto* structure = globalObject->m_JSNodeHTTPServerSocketStructure.getInitializedOnMainThread(globalObject);
return create(vm, structure, socket, is_ssl, response);
}

template<bool SSL>
void JSNodeHTTPServerSocket::clearSocketData(bool upgraded, us_socket_t* socket)
{
Expand Down
1 change: 0 additions & 1 deletion src/jsc/bindings/node/JSNodeHTTPServerSocket.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ class JSNodeHTTPServerSocket : public JSC::JSDestructibleObject {
JSC::Strong<JSNodeHTTPServerSocket> strongThis = {};

static JSNodeHTTPServerSocket* create(JSC::VM& vm, JSC::Structure* structure, us_socket_t* socket, bool is_ssl, WebCore::JSNodeHTTPResponse* response);
static JSNodeHTTPServerSocket* create(JSC::VM& vm, Zig::GlobalObject* globalObject, us_socket_t* socket, bool is_ssl, WebCore::JSNodeHTTPResponse* response);

static void destroy(JSC::JSCell* cell)
{
Expand Down
10 changes: 0 additions & 10 deletions src/jsc/bindings/webcore/CustomEvent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@ namespace WebCore {

WTF_MAKE_TZONE_ALLOCATED_IMPL(CustomEvent);

inline CustomEvent::CustomEvent(IsTrusted isTrusted)
: Event(CustomEventInterfaceType, isTrusted)
{
}

inline CustomEvent::CustomEvent(const AtomString& type, const Init& initializer, IsTrusted isTrusted)
: Event(CustomEventInterfaceType, type, initializer, isTrusted)
, m_detail(initializer.detail)
Expand All @@ -47,11 +42,6 @@ inline CustomEvent::CustomEvent(const AtomString& type, const Init& initializer,

CustomEvent::~CustomEvent() = default;

Ref<CustomEvent> CustomEvent::create(IsTrusted isTrusted)
{
return adoptRef(*new CustomEvent(isTrusted));
}

Ref<CustomEvent> CustomEvent::create(const AtomString& type, const Init& initializer, IsTrusted isTrusted)
{
return adoptRef(*new CustomEvent(type, initializer, isTrusted));
Expand Down
3 changes: 0 additions & 3 deletions src/jsc/bindings/webcore/CustomEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ class CustomEvent final : public Event {
public:
virtual ~CustomEvent();

static Ref<CustomEvent> create(IsTrusted = IsTrusted::No);

struct Init : EventInit {
JSC::JSValue detail;
};
Expand All @@ -53,7 +51,6 @@ class CustomEvent final : public Event {
JSValueInWrappedObject& cachedDetail() { return m_cachedDetail; }

private:
CustomEvent(IsTrusted);
CustomEvent(const AtomString& type, const Init& initializer, IsTrusted);

JSValueInWrappedObject m_detail;
Expand Down
17 changes: 0 additions & 17 deletions src/jsc/bindings/webcore/ErrorEvent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@
#include "ErrorEvent.h"

#include "DOMWrapperWorld.h"
#include "EventNames.h"
#include <JavaScriptCore/HeapInlines.h>
#include <JavaScriptCore/StrongInlines.h>
#include <wtf/TZoneMallocInlines.h>

namespace WebCore {
Expand All @@ -53,21 +51,6 @@ ErrorEvent::ErrorEvent(const AtomString& type, const Init& initializer, IsTruste
{
}

ErrorEvent::ErrorEvent(const AtomString& type, const String& message, const String& fileName, unsigned lineNumber, unsigned columnNumber, JSC::Strong<JSC::Unknown> error)
: Event(ErrorEventInterfaceType, type, CanBubble::No, IsCancelable::Yes)
, m_message(message)
, m_fileName(fileName)
, m_lineNumber(lineNumber)
, m_columnNumber(columnNumber)
, m_error(error.get())
{
}

ErrorEvent::ErrorEvent(const String& message, const String& fileName, unsigned lineNumber, unsigned columnNumber, JSC::Strong<JSC::Unknown> error)
: ErrorEvent(eventNames().errorEvent, message, fileName, lineNumber, columnNumber, error)
{
}

ErrorEvent::~ErrorEvent() = default;

JSValue ErrorEvent::error(JSGlobalObject& globalObject)
Expand Down
13 changes: 0 additions & 13 deletions src/jsc/bindings/webcore/ErrorEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
#include "Event.h"
#include "JSValueInWrappedObject.h"
// #include "SerializedScriptValue.h"
#include <JavaScriptCore/Strong.h>
#include <wtf/text/WTFString.h>

namespace WebCore {
Expand All @@ -43,16 +42,6 @@ class ErrorEvent final : public Event {
WTF_MAKE_TZONE_ALLOCATED(ErrorEvent);

public:
static Ref<ErrorEvent> create(const String& message, const String& fileName, unsigned lineNumber, unsigned columnNumber, JSC::Strong<JSC::Unknown> error)
{
return adoptRef(*new ErrorEvent(message, fileName, lineNumber, columnNumber, error));
}

static Ref<ErrorEvent> create(const AtomString& type, const String& message, const String& fileName, unsigned lineNumber, unsigned columnNumber, JSC::Strong<JSC::Unknown> error)
{
return adoptRef(*new ErrorEvent(type, message, fileName, lineNumber, columnNumber, error));
}

struct Init : EventInit {
String message;
String filename;
Expand All @@ -77,8 +66,6 @@ class ErrorEvent final : public Event {
const JSValueInWrappedObject& originalError() const { return m_error; }

private:
ErrorEvent(const AtomString& type, const String& message, const String& fileName, unsigned lineNumber, unsigned columnNumber, JSC::Strong<JSC::Unknown> error);
ErrorEvent(const String& message, const String& fileName, unsigned lineNumber, unsigned columnNumber, JSC::Strong<JSC::Unknown> error);
ErrorEvent(const AtomString&, const Init&, IsTrusted);
Comment thread
robobun marked this conversation as resolved.

String m_message;
Expand Down
11 changes: 0 additions & 11 deletions src/jsc/bindings/webcore/Event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,23 +56,12 @@ ALWAYS_INLINE Event::Event(EventInterface eventInterface, MonotonicTime createTi
{
}

Event::Event(EventInterface eventInterface, IsTrusted isTrusted)
: Event { eventInterface, MonotonicTime::now(), {}, isTrusted, CanBubble::No, IsCancelable::No, IsComposed::No }
{
}

Event::Event(EventInterface eventInterface, const AtomString& eventType, CanBubble canBubble, IsCancelable isCancelable, IsComposed isComposed)
: Event { eventInterface, MonotonicTime::now(), eventType, IsTrusted::Yes, canBubble, isCancelable, isComposed }
{
ASSERT(!eventType.isNull());
}

Event::Event(EventInterface eventInterface, const AtomString& eventType, CanBubble canBubble, IsCancelable isCancelable, IsComposed isComposed, MonotonicTime timestamp, IsTrusted isTrusted)
: Event { eventInterface, timestamp, eventType, isTrusted, canBubble, isCancelable, isComposed }
{
ASSERT(!eventType.isNull());
}

Event::Event(EventInterface eventInterface, const AtomString& eventType, const EventInit& initializer, IsTrusted isTrusted)
: Event { eventInterface, MonotonicTime::now(), eventType, isTrusted,
initializer.bubbles ? CanBubble::Yes : CanBubble::No,
Expand Down
2 changes: 0 additions & 2 deletions src/jsc/bindings/webcore/Event.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,7 @@ class Event : public ScriptWrappable, public RefCounted<Event> {
bool isBeingDispatched() const { return eventPhase(); }

protected:
explicit Event(EventInterface, IsTrusted = IsTrusted::No);
Event(EventInterface, const AtomString& type, CanBubble, IsCancelable, IsComposed = IsComposed::No);
Event(EventInterface, const AtomString& type, CanBubble, IsCancelable, IsComposed, MonotonicTime timestamp, IsTrusted isTrusted = IsTrusted::Yes);
Event(EventInterface, const AtomString& type, const EventInit&, IsTrusted);

private:
Expand Down
23 changes: 0 additions & 23 deletions src/jsc/bindings/webcore/FetchHeaders.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,6 @@ class FetchHeaders : public RefCounted<FetchHeaders> {
void setInternalHeaders(HTTPHeaderMap&& headers) { m_headers = WTF::move(headers); }
const HTTPHeaderMap& internalHeaders() const { return m_headers; }

void setGuard(Guard);
Guard guard() const { return m_guard; }

FetchHeaders(Guard, HTTPHeaderMap&&);
explicit FetchHeaders(const FetchHeaders&);

Expand All @@ -139,24 +136,4 @@ inline FetchHeaders::FetchHeaders(const FetchHeaders& other)
{
}

inline void FetchHeaders::setGuard(Guard guard)
{
ASSERT(!m_headers.size());
m_guard = guard;
}

} // namespace WebCore

namespace WTF {

template<> struct EnumTraits<WebCore::FetchHeaders::Guard> {
using values = EnumValues<
WebCore::FetchHeaders::Guard,
WebCore::FetchHeaders::Guard::None,
WebCore::FetchHeaders::Guard::Immutable,
WebCore::FetchHeaders::Guard::Request,
WebCore::FetchHeaders::Guard::RequestNoCors,
WebCore::FetchHeaders::Guard::Response>;
};

}
10 changes: 0 additions & 10 deletions src/jsc/bindings/webcore/HTTPHeaderIdentifiers.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,6 @@ bool findHTTP2PseudoHeaderName(WTF::StringView, HTTP2PseudoHeaderName&);

#define HTTP_HEADERS_INDEX_ENTRY(literal, name) name,

#define HTTP_HEADERS_ACCESSOR_DEFINITIONS(literal, name) \
JSC::Identifier& name##Identifier(JSC::VM& vm) { return identifierAt(vm, Index::name); } \
JSC::JSString* name##String(JSC::JSGlobalObject* g) { return stringAt(g, Index::name); }

// Per-VM cache: one Identifier and one JSString per header name, for the lifetime of the VM.
class HTTPHeaderIdentifiers {
public:
Expand All @@ -137,9 +133,6 @@ class HTTPHeaderIdentifiers {
};
// clang-format on

HTTP_HEADERS_EACH_NAME(HTTP_HEADERS_ACCESSOR_DEFINITIONS)
HTTP2_PSEUDO_HEADERS_EACH_NAME(HTTP_HEADERS_ACCESSOR_DEFINITIONS)

HTTPHeaderIdentifiers();

JSC::Identifier& identifierFor(JSC::VM& vm, HTTPHeaderName name) { return identifierAt(vm, static_cast<size_t>(name)); }
Expand All @@ -155,9 +148,7 @@ class HTTPHeaderIdentifiers {
static constexpr size_t PseudoOffset = numHTTPHeaderNames;

JSC::Identifier& identifierAt(JSC::VM&, size_t);
JSC::Identifier& identifierAt(JSC::VM& vm, Index i) { return identifierAt(vm, static_cast<size_t>(i)); }
JSC::JSString* stringAt(JSC::JSGlobalObject* g, size_t i) { return m_strings[i].getInitializedOnMainThread(g); }
JSC::JSString* stringAt(JSC::JSGlobalObject* g, Index i) { return stringAt(g, static_cast<size_t>(i)); }

JSC::LazyProperty<JSC::JSGlobalObject, JSC::JSString> m_strings[Count];
JSC::Identifier m_identifiers[Count];
Expand All @@ -166,4 +157,3 @@ class HTTPHeaderIdentifiers {
} // namespace WebCore

#undef HTTP_HEADERS_INDEX_ENTRY
#undef HTTP_HEADERS_ACCESSOR_DEFINITIONS
10 changes: 0 additions & 10 deletions src/jsc/bindings/webcore/HTTPHeaderMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,16 +189,6 @@ bool HTTPHeaderMap::contains(const StringView name) const
}) != notFound;
}

bool HTTPHeaderMap::remove(const StringView name)
{

HTTPHeaderName headerName;
if (findHTTPHeaderName(name, headerName))
return remove(headerName);

return removeUncommonHeader(name);
}

bool HTTPHeaderMap::removeUncommonHeader(const StringView name)
{
#if ASSERT_ENABLED
Expand Down
1 change: 0 additions & 1 deletion src/jsc/bindings/webcore/HTTPHeaderMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ class HTTPHeaderMap {
WEBCORE_EXPORT void add(const String& name, const String& value);
WEBCORE_EXPORT bool contains(const StringView) const;
WEBCORE_EXPORT int64_t indexOf(StringView name) const;
WEBCORE_EXPORT bool remove(const StringView);
WEBCORE_EXPORT bool removeUncommonHeader(const StringView);

WEBCORE_EXPORT String getIndex(HeaderIndex index) const;
Expand Down
12 changes: 0 additions & 12 deletions src/jsc/bindings/webcore/JSAbortController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,16 +322,4 @@ JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject*, JSDOMGlobalObject* globalObj
return createWrapper<AbortController>(globalObject, WTF::move(impl));
}

JSC::JSValue toJS(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, AbortController& impl)
{
return wrap(lexicalGlobalObject, globalObject, impl);
}

AbortController* JSAbortController::toWrapped(JSC::VM&, JSC::JSValue value)
{
if (auto* wrapper = dynamicDowncast<JSAbortController>(value))
return &wrapper->wrapped();
return nullptr;
}

}
3 changes: 0 additions & 3 deletions src/jsc/bindings/webcore/JSAbortController.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ class JSAbortController : public JSDOMWrapper<AbortController> {

static JSC::JSObject* createPrototype(JSC::VM&, JSDOMGlobalObject&);
static JSC::JSObject* prototype(JSC::VM&, JSDOMGlobalObject&);
static AbortController* toWrapped(JSC::VM&, JSC::JSValue);
static void destroy(JSC::JSCell*);

DECLARE_INFO;
Expand Down Expand Up @@ -81,8 +80,6 @@ inline JSC::WeakHandleOwner* wrapperOwner(DOMWrapperWorld&, AbortController*)
return &owner.get();
}

JSC::JSValue toJS(JSC::JSGlobalObject*, JSDOMGlobalObject*, AbortController&);
inline JSC::JSValue toJS(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, AbortController* impl) { return impl ? toJS(lexicalGlobalObject, globalObject, *impl) : JSC::jsNull(); }
JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject*, JSDOMGlobalObject*, Ref<AbortController>&&);
inline JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, RefPtr<AbortController>&& impl) { return impl ? toJSNewlyCreated(lexicalGlobalObject, globalObject, impl.releaseNonNull()) : JSC::jsNull(); }

Expand Down
Loading
Loading