Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 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
1 change: 0 additions & 1 deletion src/jsc/bindings/Cookie.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ class Cookie : public RefCounted<Cookie> {
size_t memoryCost() const;

static bool isValidCookieName(const String& name);
static bool isValidCookieValue(const String& value); // values are uri component encoded, so this isn't needed
static bool isValidCookiePath(const String& path);
static bool isValidCookieDomain(const String& domain);

Expand Down
18 changes: 0 additions & 18 deletions src/jsc/bindings/CookieMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,6 @@ CookieMap::CookieMap()
{
}

CookieMap::CookieMap(Vector<Ref<Cookie>>&& cookies)
: m_modifiedCookies(WTF::move(cookies))
{
}

CookieMap::CookieMap(Vector<KeyValuePair<String, String>>&& cookies)
: m_originalCookies(WTF::move(cookies))
{
Expand Down Expand Up @@ -151,19 +146,6 @@ std::optional<String> CookieMap::get(const String& name) const
return std::nullopt;
}

Vector<KeyValuePair<String, String>> CookieMap::getAll() const
{
Vector<KeyValuePair<String, String>> all;
for (const auto& cookie : m_modifiedCookies) {
if (cookie->value().isEmpty()) continue;
all.append(KeyValuePair<String, String>(cookie->name(), cookie->value()));
}
for (const auto& cookie : m_originalCookies) {
all.append(KeyValuePair<String, String>(cookie.key, cookie.value));
}
return all;
}

bool CookieMap::has(const String& name) const
{
return get(name).has_value();
Expand Down
7 changes: 0 additions & 7 deletions src/jsc/bindings/CookieMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@

namespace WebCore {

struct CookieStoreGetOptions {
String name {};
String url {};
};

struct CookieStoreDeleteOptions {
String name {};
String domain {};
Expand All @@ -31,7 +26,6 @@ class CookieMap : public RefCounted<CookieMap> {
static ExceptionOr<Ref<CookieMap>> create(std::variant<Vector<Vector<String>>, HashMap<String, String>, String>&& init, bool throwOnInvalidCookieString = true);

std::optional<String> get(const String& name) const;
Vector<KeyValuePair<String, String>> getAll() const;
Vector<Ref<Cookie>> getAllChanges() const { return m_modifiedCookies; }

bool has(const String& name) const;
Expand Down Expand Up @@ -62,7 +56,6 @@ class CookieMap : public RefCounted<CookieMap> {

private:
CookieMap();
CookieMap(Vector<Ref<Cookie>>&& cookies);
CookieMap(Vector<KeyValuePair<String, String>>&& cookies);

void removeInternal(const String& name);
Expand Down
8 changes: 0 additions & 8 deletions src/jsc/bindings/DOMException.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@
#include "root.h"
#include "DOMException.h"

#include "Exception.h"

namespace WebCore {

// This array needs to be kept in sync with the ExceptionCode enumeration.
Expand Down Expand Up @@ -101,12 +99,6 @@ Ref<DOMException> DOMException::create(const String& message, const String& name
return adoptRef(*new DOMException(legacyCodeFromName(name), name, message));
}

Ref<DOMException> DOMException::create(const Exception& exception)
{
auto& description = DOMException::description(exception.code());
return adoptRef(*new DOMException(description.legacyCode, description.name, exception.message().isEmpty() ? description.message : exception.message()));
}

DOMException::DOMException(LegacyCode legacyCode, const String& name, const String& message)
: m_legacyCode(legacyCode)
, m_name(name)
Expand Down
6 changes: 0 additions & 6 deletions src/jsc/bindings/DOMException.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,9 @@

namespace WebCore {

class Exception;

class DOMException : public RefCounted<DOMException> {
public:
static Ref<DOMException> create(ExceptionCode, const String& message = emptyString());
static Ref<DOMException> create(const Exception&);

// For DOM bindings.
static Ref<DOMException> create(const String& message, const String& name);
Expand All @@ -58,9 +55,6 @@ class DOMException : public RefCounted<DOMException> {

WEBCORE_EXPORT static const Description& description(ExceptionCode);

static ASCIILiteral name(ExceptionCode ec) { return description(ec).name; }
static ASCIILiteral message(ExceptionCode ec) { return description(ec).message; }

protected:
DOMException(LegacyCode, const String& name, const String& message);

Expand Down
8 changes: 0 additions & 8 deletions src/jsc/bindings/DOMFormData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,6 @@ extern "C" void DOMFormData__forEach(DOMFormData* form, void* context, void (*ca
}
}

Ref<DOMFormData> DOMFormData::clone() const
{
auto newFormData = adoptRef(*new DOMFormData(scriptExecutionContext()));
newFormData->m_items = m_items;

return newFormData;
}

// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#create-an-entry
static auto createStringEntry(const String& name, const String& value) -> DOMFormData::Item
{
Expand Down
1 change: 0 additions & 1 deletion src/jsc/bindings/DOMFormData.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ class DOMFormData : public RefCounted<DOMFormData>, public ContextDestructionObs
bool has(const StringView name);
void set(const String& name, const String& value);
void set(const String& name, RefPtr<Blob>, const String& filename = {});
Ref<DOMFormData> clone() const;

size_t count() const { return m_items.size(); }
size_t memoryCost() const;
Expand Down
29 changes: 0 additions & 29 deletions src/jsc/bindings/ErrorCode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -726,17 +726,6 @@ WTF::String ERR_INVALID_ARG_TYPE(JSC::ThrowScope& scope, JSC::JSGlobalObject* gl
return result.toString();
}

WTF::String ERR_INVALID_ARG_TYPE(JSC::ThrowScope& scope, JSC::JSGlobalObject* globalObject, const ZigString* arg_name_string, const ZigString* expected_type_string, JSValue actual_value)
{
auto arg_name = std::span<const Latin1Character>(arg_name_string->ptr, arg_name_string->len);
ASSERT(WTF::charactersAreAllASCII(arg_name));

auto expected_type = std::span<const Latin1Character>(expected_type_string->ptr, expected_type_string->len);
ASSERT(WTF::charactersAreAllASCII(expected_type));

return ERR_INVALID_ARG_TYPE(scope, globalObject, arg_name, expected_type, actual_value);
}

WTF::String ERR_INVALID_ARG_TYPE(JSC::ThrowScope& scope, JSC::JSGlobalObject* globalObject, JSValue val_arg_name, JSValue val_expected_type, JSValue val_actual_value)
{
auto* arg_name_str = val_arg_name.toString(globalObject);
Expand Down Expand Up @@ -1165,13 +1154,6 @@ JSC::EncodedJSValue INVALID_FILE_URL_HOST(JSC::ThrowScope& throwScope, JSC::JSGl
throwScope.release();
return {};
}
JSC::EncodedJSValue INVALID_FILE_URL_HOST(JSC::ThrowScope& throwScope, JSC::JSGlobalObject* globalObject, const ASCIILiteral platform)
{
auto message = makeString("File URL host must be \"localhost\" or empty on "_s, platform);
throwScope.throwException(globalObject, createError(globalObject, ErrorCode::ERR_INVALID_FILE_URL_HOST, message));
throwScope.release();
return {};
}
/// `File URL path {suffix}`
JSC::EncodedJSValue INVALID_FILE_URL_PATH(JSC::ThrowScope& throwScope, JSC::JSGlobalObject* globalObject, const ASCIILiteral suffix)
{
Expand Down Expand Up @@ -1397,17 +1379,6 @@ JSC::EncodedJSValue CRYPTO_ECDH_INVALID_FORMAT(ThrowScope& scope, JSGlobalObject
return {};
}

JSC::EncodedJSValue CRYPTO_JWK_UNSUPPORTED_CURVE(JSC::ThrowScope& throwScope, JSC::JSGlobalObject* globalObject, const WTF::String& curve)
{
WTF::StringBuilder builder;
builder.append("Unsupported JWK EC curve: "_s);
builder.append(curve);
builder.append('.');
throwScope.throwException(globalObject, createError(globalObject, ErrorCode::ERR_CRYPTO_JWK_UNSUPPORTED_CURVE, builder.toString()));
throwScope.release();
return {};
}

JSC::EncodedJSValue CRYPTO_JWK_UNSUPPORTED_CURVE(JSC::ThrowScope& throwScope, JSC::JSGlobalObject* globalObject, ASCIILiteral message, const char* curveName)
{
WTF::StringBuilder builder;
Expand Down
2 changes: 0 additions & 2 deletions src/jsc/bindings/ErrorCode.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ JSC::JSObject* createError(Zig::GlobalObject* globalObject, ErrorCode code, cons
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);
JSC::JSValue toJS(JSC::JSGlobalObject*, ErrorCode);
JSObject* createInvalidThisError(JSGlobalObject* globalObject, JSValue thisValue, const ASCIILiteral typeName);
JSObject* createInvalidThisError(JSGlobalObject* globalObject, const String& message);

Expand Down Expand Up @@ -121,7 +120,6 @@ JSC::EncodedJSValue CRYPTO_OPERATION_FAILED(JSC::ThrowScope& throwScope, JSC::JS
JSC::EncodedJSValue CRYPTO_INVALID_KEYPAIR(JSC::ThrowScope& throwScope, JSC::JSGlobalObject* globalObject);
JSC::EncodedJSValue CRYPTO_ECDH_INVALID_PUBLIC_KEY(JSC::ThrowScope& throwScope, JSC::JSGlobalObject* globalObject);
JSC::EncodedJSValue CRYPTO_ECDH_INVALID_FORMAT(JSC::ThrowScope&, JSC::JSGlobalObject*, const WTF::String& formatString);
JSC::EncodedJSValue CRYPTO_JWK_UNSUPPORTED_CURVE(JSC::ThrowScope&, JSC::JSGlobalObject*, const WTF::String&);
JSC::EncodedJSValue CRYPTO_JWK_UNSUPPORTED_CURVE(JSC::ThrowScope&, JSC::JSGlobalObject*, ASCIILiteral message, const char* curveName);
JSC::EncodedJSValue CRYPTO_JWK_UNSUPPORTED_KEY_TYPE(JSC::ThrowScope&, JSC::JSGlobalObject*);
JSC::EncodedJSValue CRYPTO_INVALID_JWK(JSC::ThrowScope& throwScope, JSC::JSGlobalObject* globalObject);
Expand Down
2 changes: 0 additions & 2 deletions src/jsc/bindings/ImportMetaObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ class ImportMetaObject final : public JSC::JSNonFinalObject {
/// stated in https://github.com/oven-sh/bun/pull/9399
static ImportMetaObject* createFromSpecifier(JSC::JSGlobalObject* globalObject, const String& specifier);

static ImportMetaObject* createRequireFunction(VM& vm, JSGlobalObject* lexicalGlobalObject, const WTF::String& pathString);

DECLARE_INFO;
DECLARE_VISIT_CHILDREN;

Expand Down
5 changes: 0 additions & 5 deletions src/jsc/bindings/JSCommonJSModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,9 @@ class JSCommonJSModule final : public JSC::JSDestructibleObject {

static size_t estimatedSize(JSC::JSCell* cell, JSC::VM& vm);

void setSourceCode(JSC::SourceCode&& sourceCode);

static void destroy(JSC::JSCell*);
~JSCommonJSModule();

void clearSourceCode() { sourceCode = JSC::SourceCode(); }

void finishCreation(JSC::VM& vm, const JSC::SourceCode& sourceCode);

static JSC::Structure* createStructure(JSC::JSGlobalObject* globalObject);
Expand Down Expand Up @@ -127,7 +123,6 @@ class JSCommonJSModule final : public JSC::JSDestructibleObject {
return this->get(globalObject(), JSC::PropertyName(WebCore::clientData(vm())->builtinNames().exportsPublicName()));
}
void setExportsObject(JSC::JSValue exportsObject);
JSValue idOrDot() { return m_id.get(); }
JSValue filename() { return m_filename.get(); }

bool load(JSC::VM& vm, Zig::GlobalObject* globalObject);
Expand Down
2 changes: 0 additions & 2 deletions src/jsc/bindings/ProcessBindingTTYWrap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,6 @@ const ClassInfo TTYWrapObject::s_info = {
&Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(TTYWrapObject)
};

JSC::EncodedJSValue Process_functionInternalGetWindowSize(JSC::JSGlobalObject* globalObject, JSC::CallFrame* callFrame);

JSC_DEFINE_HOST_FUNCTION(jsTTYSetMode, (JSC::JSGlobalObject * globalObject, CallFrame* callFrame))
{
#if OS(WINDOWS)
Expand Down
2 changes: 0 additions & 2 deletions src/jsc/bindings/Sink.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,5 @@ enum SinkID : uint8_t {
FetchRequestBodySink = 8,

};
static constexpr unsigned numberOfSinkIDs
= 9;

}
98 changes: 1 addition & 97 deletions src/jsc/bindings/webcore/DOMJITCheckDOM.h
Original file line number Diff line number Diff line change
@@ -1,98 +1,2 @@
/*
* Copyright (C) 2016 Apple Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/

// Empty: DOMJITCheckDOM was dead. Stub kept for the verification harness.
#pragma once

#include "DOMJITHelpers.h"

#if ENABLE(JIT)

// #include "Document.h"
// #include "Element.h"
#include "Event.h"
#include "Node.h"

namespace WebCore {
namespace DOMJIT {

template<typename DOMInterface>
struct TypeChecker {
};

template<>
struct TypeChecker<Node> {
static CCallHelpers::Jump branchIfFail(CCallHelpers& jit, GPRReg dom)
{
return DOMJIT::branchIfNotNode(jit, dom);
}
};

// template<>
// struct TypeChecker<Document> {
// static CCallHelpers::Jump branchIfFail(CCallHelpers& jit, GPRReg dom)
// {
// return DOMJIT::branchIfNotDocumentWrapper(jit, dom);
// }
// };

// template<>
// struct TypeChecker<DocumentFragment> {
// static CCallHelpers::Jump branchIfFail(CCallHelpers& jit, GPRReg dom)
// {
// return DOMJIT::branchIfNotDocumentFragment(jit, dom);
// }
// };

template<>
struct TypeChecker<Event> {
static CCallHelpers::Jump branchIfFail(CCallHelpers& jit, GPRReg dom)
{
return DOMJIT::branchIfNotEvent(jit, dom);
}
};

// template<>
// struct TypeChecker<Element> {
// static CCallHelpers::Jump branchIfFail(CCallHelpers& jit, GPRReg dom)
// {
// return DOMJIT::branchIfNotElement(jit, dom);
// }
// };

template<typename DOMInterface>
Ref<JSC::Snippet> checkDOM()
{
Ref<JSC::Snippet> snippet = JSC::Snippet::create();
snippet->setGenerator([=](CCallHelpers& jit, JSC::SnippetParams& params) {
return TypeChecker<DOMInterface>::branchIfFail(jit, params[0].gpr());
});
return snippet;
}

}
}

#endif
Loading
Loading