Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 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/codegen/generate-jssink.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,6 @@ async function implementation() {
#include "JSSink.h"
#include "AsyncContextFrame.h"

#include "ActiveDOMObject.h"
#include "ExtendedDOMClientIsoSubspaces.h"
#include "ExtendedDOMIsoSubspaces.h"
#include "IDLTypes.h"
Expand Down
41 changes: 0 additions & 41 deletions src/js/node/dgram.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1498,48 +1498,7 @@ Socket.prototype._stopReceiving = deprecate(
"DEP0112",
);

/*
function _createSocketHandle(address, port, addressType, fd, flags) {
const handle = newHandle(addressType);
let err;

if (isInt32(fd) && fd > 0) {
const type = guessHandleType(fd);
if (type !== 'UDP') {
err = UV_EINVAL;
} else {
err = handle.open(fd);
}
} else if (port || address) {
err = handle.bind(address, port || 0, flags);
}

if (err) {
handle.close();
return err;
}

return handle;
}


// Legacy alias on the C++ wrapper object. This is not public API, so we may
// want to runtime-deprecate it at some point. There's no hurry, though.
ObjectDefineProperty(UDP.prototype, 'owner', {
__proto__: null,
get() { return this[kOwnerSymbol]; },
set(v) { return this[kOwnerSymbol] = v; },
});
*/

export default {
/*
_createSocketHandle: deprecate(
_createSocketHandle,
'dgram._createSocketHandle() is deprecated',
'DEP0112',
),
*/
createSocket,
Socket,
};
1 change: 0 additions & 1 deletion src/jsc/bindings/DOMURL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include "config.h"
#include "DOMURL.h"

#include "ActiveDOMObject.h"
// #include "Blob.h"
// #include "BlobURL.h"
// #include "MemoryCache.h"
Expand Down
1 change: 0 additions & 1 deletion src/jsc/bindings/ImportMetaObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

#include "ImportMetaObject.h"
#include "ZigGlobalObject.h"
#include "ActiveDOMObject.h"
#include "ExtendedDOMClientIsoSubspaces.h"
#include "ExtendedDOMIsoSubspaces.h"
#include "IDLTypes.h"
Expand Down
1 change: 0 additions & 1 deletion src/jsc/bindings/JSBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#include "JavaScriptCore/ArgList.h"
#include "JavaScriptCore/ExceptionScope.h"

#include "ActiveDOMObject.h"
#include "ExtendedDOMClientIsoSubspaces.h"
#include "ExtendedDOMIsoSubspaces.h"
#include "IDLTypes.h"
Expand Down
26 changes: 0 additions & 26 deletions src/jsc/bindings/JSBufferEncodingType.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#include <JavaScriptCore/JSCInlines.h>
#include <JavaScriptCore/JSString.h>
#include <wtf/NeverDestroyed.h>
#include "ErrorCode.h"
namespace WebCore {
using namespace JSC;

Expand Down Expand Up @@ -82,19 +81,6 @@ template<> std::optional<BufferEncodingType> parseEnumeration<BufferEncodingType
return parseEnumerationAllowBufferInternal<false>(lexicalGlobalObject, arg);
}

template<bool allowBuffer>
std::optional<BufferEncodingType> validateBufferEncoding(JSGlobalObject& lexicalGlobalObject, JSValue arg)
{
auto value = parseEnumerationAllowBufferInternal<allowBuffer>(lexicalGlobalObject, arg);
if (!value) {
auto scope = DECLARE_THROW_SCOPE(lexicalGlobalObject.vm());
Bun::throwError(&lexicalGlobalObject, scope, Bun::ErrorCode::ERR_UNKNOWN_ENCODING, "Invalid encoding"_s);
return std::nullopt;
}

return value;
}

template<> std::optional<BufferEncodingType> parseEnumerationFromString<BufferEncodingType>(const String& encoding)
{
return parseEnumerationFromView<BufferEncodingType>(encoding);
Expand Down Expand Up @@ -176,16 +162,4 @@ template<> ASCIILiteral expectedEnumerationValues<BufferEncodingType>()
return "\"utf8\", \"ucs2\", \"utf16le\", \"latin1\", \"ascii\", \"base64\", \"base64url\", \"hex\""_s;
}

template<>
std::optional<BufferEncodingType> validateBufferEncoding<true>(JSGlobalObject& lexicalGlobalObject, JSValue arg)
{
return parseEnumerationAllowBufferInternal<true>(lexicalGlobalObject, arg);
}

template<>
std::optional<BufferEncodingType> validateBufferEncoding<false>(JSGlobalObject& lexicalGlobalObject, JSValue arg)
{
return parseEnumerationAllowBufferInternal<false>(lexicalGlobalObject, arg);
}

} // namespace WebCore
3 changes: 0 additions & 3 deletions src/jsc/bindings/JSBufferEncodingType.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,4 @@ template<> std::optional<BufferEncodingType> parseEnumerationFromString(const WT
template<> std::optional<BufferEncodingType> parseEnumerationFromView(const WTF::StringView&);
template<> WTF::ASCIILiteral expectedEnumerationValues<BufferEncodingType>();

template<bool allowBuffer>
std::optional<BufferEncodingType> validateBufferEncoding(JSC::JSGlobalObject&, JSValue);

} // namespace WebCore
1 change: 0 additions & 1 deletion src/jsc/bindings/ScriptExecutionContext.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#pragma once

#include "root.h"
#include "ActiveDOMObject.h"
#include "SharedEnvStore.h"
#include <wtf/CrossThreadTask.h>
#include <wtf/Function.h>
Expand Down
108 changes: 2 additions & 106 deletions src/jsc/bindings/ncrpyto_engine.cpp
Original file line number Diff line number Diff line change
@@ -1,106 +1,2 @@
#include "ncrypto.h"

namespace ncrypto {

// ============================================================================
// Engine

#ifndef OPENSSL_NO_ENGINE
EnginePointer::EnginePointer(ENGINE* engine_, bool finish_on_exit_)
: engine(engine_)
, finish_on_exit(finish_on_exit_)
{
}

EnginePointer::EnginePointer(EnginePointer&& other) noexcept
: engine(other.engine)
, finish_on_exit(other.finish_on_exit)
{
other.release();
}

EnginePointer::~EnginePointer()
{
reset();
}

EnginePointer& EnginePointer::operator=(EnginePointer&& other) noexcept
{
if (this == &other) return *this;
this->~EnginePointer();
return *new (this) EnginePointer(std::move(other));
}

void EnginePointer::reset(ENGINE* engine_, bool finish_on_exit_)
{
if (engine != nullptr) {
if (finish_on_exit) {
// This also does the equivalent of ENGINE_free.
ENGINE_finish(engine);
} else {
ENGINE_free(engine);
}
}
engine = engine_;
finish_on_exit = finish_on_exit_;
}

ENGINE* EnginePointer::release()
{
ENGINE* ret = engine;
engine = nullptr;
finish_on_exit = false;
return ret;
}

EnginePointer EnginePointer::getEngineByName(const std::string_view name,
CryptoErrorList* errors)
{
MarkPopErrorOnReturn mark_pop_error_on_return(errors);
EnginePointer engine(ENGINE_by_id(name.data()));
if (!engine) {
// Engine not found, try loading dynamically.
engine = EnginePointer(ENGINE_by_id("dynamic"));
if (engine) {
if (!ENGINE_ctrl_cmd_string(engine.get(), "SO_PATH", name.data(), 0) || !ENGINE_ctrl_cmd_string(engine.get(), "LOAD", nullptr, 0)) {
engine.reset();
}
}
}
return engine;
}

bool EnginePointer::setAsDefault(uint32_t flags, CryptoErrorList* errors)
{
if (engine == nullptr) return false;
ClearErrorOnReturn clear_error_on_return(errors);
return ENGINE_set_default(engine, flags) != 0;
}

bool EnginePointer::init(bool finish_on_exit)
{
if (engine == nullptr) return false;
if (finish_on_exit) setFinishOnExit();
return ENGINE_init(engine) == 1;
}

EVPKeyPointer EnginePointer::loadPrivateKey(const std::string_view key_name)
{
if (engine == nullptr) return EVPKeyPointer();
return EVPKeyPointer(
ENGINE_load_private_key(engine, key_name.data(), nullptr, nullptr));
}

void EnginePointer::initEnginesOnce()
{
static bool initialized = false;
if (!initialized) {
ENGINE_load_builtin_engines();
ENGINE_register_all_complete();
initialized = true;
}
}

#endif // OPENSSL_NO_ENGINE

} // namespace ncrypto
#include "config.h"
// Empty: EnginePointer was dead. Kept so unified-source bundles don't shift.
Loading
Loading