Begin adding WebCore classes to bun

This commit is contained in:
Jarred Sumner
2022-03-27 22:37:55 -07:00
parent 4bf5dc1df9
commit ed4f4ae4e2
123 changed files with 12708 additions and 1005 deletions

View File

@@ -2,12 +2,15 @@
#pragma once
#include "helpers.h"
#include "root.h"
#include <JavaScriptCore/BuiltinUtils.h>
namespace Bun {
#include "helpers.h"
#include "JavaScriptCore/BuiltinUtils.h"
namespace WebCore {
using namespace JSC;
@@ -116,5 +119,5 @@ private:
BUN_COMMON_PRIVATE_IDENTIFIERS_EACH_PROPERTY_NAME(DECLARE_BUILTIN_NAMES)
};
} // namespace Bun
} // namespace WebCore

View File

@@ -1,39 +1,47 @@
#include "BunClientData.h"
#include "root.h"
#include "JSDOMURL.h"
#include <JavaScriptCore/FastMallocAlignedMemoryAllocator.h>
#include <JavaScriptCore/HeapInlines.h>
#include <JavaScriptCore/IsoHeapCellType.h>
#include <JavaScriptCore/JSDestructibleObjectHeapCellType.h>
#include <JavaScriptCore/MarkingConstraint.h>
#include <JavaScriptCore/SubspaceInlines.h>
#include <JavaScriptCore/VM.h>
#include <wtf/MainThread.h>
#include "BunClientData.h"
// #include "BunGCOutputConstraint.h"
#include "ExtendedDOMClientIsoSubspaces.h"
#include "ExtendedDOMIsoSubspaces.h"
#include "JavaScriptCore/FastMallocAlignedMemoryAllocator.h"
#include "JavaScriptCore/HeapInlines.h"
#include "JavaScriptCore/IsoHeapCellType.h"
#include "JavaScriptCore/JSDestructibleObjectHeapCellType.h"
// #include "JavaScriptCore/MarkingConstraint.h"
#include "JavaScriptCore/SubspaceInlines.h"
#include "JavaScriptCore/VM.h"
#include "wtf/MainThread.h"
namespace Bun {
#include "JSDOMConstructorBase.h"
#include "BunGCOutputConstraint.h"
#include "WebCoreTypedArrayController.h"
namespace WebCore {
using namespace JSC;
using namespace WebCore;
class ExtendedDOMClientIsoSubspaces;
class ExtendedDOMIsoSubspaces;
#define CLIENT_ISO_SUBSPACE_INIT(subspace) subspace(m_heapData->subspace)
JSHeapData::JSHeapData(Heap& heap)
: m_domNamespaceObjectSpace ISO_SUBSPACE_INIT(heap, heap.cellHeapCellType, JSDOMObject)
// : m_domNamespaceObjectSpace ISO_SUBSPACE_INIT(heap, heap.cellHeapCellType, JSDOMObject)
// ,
: m_subspaces(makeUnique<ExtendedDOMIsoSubspaces>())
, m_domConstructorSpace ISO_SUBSPACE_INIT(heap, heap.cellHeapCellType, JSDOMConstructorBase)
{
}
#define CLIENT_ISO_SUBSPACE_INIT(subspace) subspace(m_heapData->subspace)
JSVMClientData::JSVMClientData(VM& vm)
: m_builtinNames(vm)
, m_heapData(JSHeapData::ensureHeapData(vm.heap))
, CLIENT_ISO_SUBSPACE_INIT(m_domConstructorSpace)
, m_clientSubspaces(makeUnique<ExtendedDOMClientIsoSubspaces>())
{
}
#undef CLIENT_ISO_SUBSPACE_INIT
JSHeapData* JSHeapData::ensureHeapData(Heap& heap)
{
if (!Options::useGlobalGC())
@@ -53,11 +61,11 @@ void JSVMClientData::create(VM* vm)
{
JSVMClientData* clientData = new JSVMClientData(*vm);
vm->clientData = clientData; // ~VM deletes this pointer.
clientData->m_normalWorld = DOMWrapperWorld::create(*vm, DOMWrapperWorld::Type::Normal);
// vm->heap.addMarkingConstraint(makeUnique<BunGCOutputConstraint>(*vm, *clientData));
// vm->m_typedArrayController = adoptRef(new WebCoreTypedArrayController(
// type == WorkerThreadType::DedicatedWorker || type == WorkerThreadType::Worklet));
// vm->m_typedArrayController = adoptRef(new WebCoreTypedArrayController(true));
}
} // namespace Bun
} // namespace WebCore

View File

@@ -1,15 +1,31 @@
#pragma once
#include "BunBuiltinNames.h"
#include "root.h"
#include <JavaScriptCore/BuiltinUtils.h>
#include <JavaScriptCore/IsoSubspacePerVM.h>
#include <JavaScriptCore/JSDestructibleObjectHeapCellType.h>
#include <wtf/HashSet.h>
#include <wtf/RefPtr.h>
namespace WebCore {
namespace Bun {
class ExtendedDOMClientIsoSubspaces;
class ExtendedDOMIsoSubspaces;
class DOMWrapperWorld;
}
#include "root.h"
#include "ExtendedDOMClientIsoSubspaces.h"
#include "ExtendedDOMIsoSubspaces.h"
#include "DOMIsoSubspaces.h"
// #include "DOMWrapperWorld.h"
#include "BunBuiltinNames.h"
// #include "WebCoreJSBuiltins.h"
// #include "WorkerThreadType.h"
#include "wtf/Function.h"
#include "wtf/HashSet.h"
#include "wtf/RefPtr.h"
#include "JavaScriptCore/IsoSubspacePerVM.h"
namespace WebCore {
using namespace JSC;
using namespace Zig;
enum class UseCustomHeapCellType { Yes,
No };
@@ -25,7 +41,7 @@ public:
static JSHeapData* ensureHeapData(JSC::Heap&);
Lock& lock() { return m_lock; }
// ExtendedDOMIsoSubspaces& subspaces() { return *m_subspaces.get(); }
ExtendedDOMIsoSubspaces& subspaces() { return *m_subspaces.get(); }
Vector<JSC::IsoSubspace*>& outputConstraintSpaces() { return m_outputConstraintSpaces; }
@@ -36,13 +52,15 @@ public:
func(*space);
}
JSC::IsoSubspace m_domNamespaceObjectSpace;
// JSC::IsoSubspace m_domNamespaceObjectSpace;
private:
Lock m_lock;
private:
// std::unique_ptr<ExtendedDOMIsoSubspaces> m_subspaces;
std::unique_ptr<ExtendedDOMIsoSubspaces> m_subspaces;
JSC::IsoSubspace m_domConstructorSpace;
Vector<JSC::IsoSubspace*> m_outputConstraintSpaces;
};
@@ -59,36 +77,96 @@ public:
JSHeapData& heapData() { return *m_heapData; }
BunBuiltinNames& builtinNames() { return m_builtinNames; }
// ExtendedDOMClientIsoSubspaces& clientSubspaces() { return *m_clientSubspaces.get(); }
// Vector<JSC::IsoSubspace *> &outputConstraintSpaces() { return m_outputConstraintSpaces; }
WebCore::DOMWrapperWorld& normalWorld() { return *m_normalWorld; }
// template<typename Func> void forEachOutputConstraintSpace(const Func& func)
// {
// for (auto* space : m_outputConstraintSpaces)
// func(*space);
// }
JSC::GCClient::IsoSubspace& domConstructorSpace() { return m_domConstructorSpace; }
ExtendedDOMClientIsoSubspaces& clientSubspaces() { return *m_clientSubspaces.get(); }
Vector<JSC::IsoSubspace*>& outputConstraintSpaces() { return m_outputConstraintSpaces; }
template<typename Func> void forEachOutputConstraintSpace(const Func& func)
{
for (auto* space : m_outputConstraintSpaces)
func(*space);
}
private:
BunBuiltinNames m_builtinNames;
JSHeapData* m_heapData;
// Vector<JSC::IsoSubspace *> m_outputConstraintSpaces;
RefPtr<WebCore::DOMWrapperWorld> m_normalWorld;
JSC::GCClient::IsoSubspace m_domConstructorSpace;
// JSC::IsoSubspace m_domNamespaceObjectSpace;
std::unique_ptr<ExtendedDOMClientIsoSubspaces> m_clientSubspaces;
Vector<JSC::IsoSubspace*> m_outputConstraintSpaces;
};
template<typename T, UseCustomHeapCellType useCustomHeapCellType, typename GetClient, typename SetClient, typename GetServer, typename SetServer>
ALWAYS_INLINE JSC::GCClient::IsoSubspace* subspaceForImpl(JSC::VM& vm, GetClient getClient, SetClient setClient, GetServer getServer, SetServer setServer, JSC::HeapCellType& (*getCustomHeapCellType)(JSHeapData&) = nullptr)
{
static NeverDestroyed<JSC::IsoSubspacePerVM> perVM([](JSC::Heap& heap) {
return ISO_SUBSPACE_PARAMETERS(heap.destructibleObjectHeapCellType, T);
});
return &perVM.get().clientIsoSubspaceforVM(vm);
auto& clientData = *static_cast<JSVMClientData*>(vm.clientData);
auto& clientSubspaces = clientData.clientSubspaces();
if (auto* clientSpace = getClient(clientSubspaces))
return clientSpace;
auto& heapData = clientData.heapData();
Locker locker { heapData.lock() };
auto& subspaces = heapData.subspaces();
JSC::IsoSubspace* space = getServer(subspaces);
if (!space) {
JSC::Heap& heap = vm.heap;
std::unique_ptr<JSC::IsoSubspace> uniqueSubspace;
static_assert(useCustomHeapCellType == UseCustomHeapCellType::Yes || std::is_base_of_v<JSC::JSDestructibleObject, T> || !T::needsDestruction);
if constexpr (useCustomHeapCellType == UseCustomHeapCellType::Yes)
uniqueSubspace = makeUnique<JSC::IsoSubspace> ISO_SUBSPACE_INIT(heap, getCustomHeapCellType(heapData), T);
else {
if constexpr (std::is_base_of_v<JSC::JSDestructibleObject, T>)
uniqueSubspace = makeUnique<JSC::IsoSubspace> ISO_SUBSPACE_INIT(heap, heap.destructibleObjectHeapCellType, T);
else
uniqueSubspace = makeUnique<JSC::IsoSubspace> ISO_SUBSPACE_INIT(heap, heap.cellHeapCellType, T);
}
space = uniqueSubspace.get();
setServer(subspaces, uniqueSubspace);
IGNORE_WARNINGS_BEGIN("unreachable-code")
IGNORE_WARNINGS_BEGIN("tautological-compare")
void (*myVisitOutputConstraint)(JSC::JSCell*, JSC::SlotVisitor&) = T::visitOutputConstraints;
void (*jsCellVisitOutputConstraint)(JSC::JSCell*, JSC::SlotVisitor&) = JSC::JSCell::visitOutputConstraints;
if (myVisitOutputConstraint != jsCellVisitOutputConstraint)
heapData.outputConstraintSpaces().append(space);
IGNORE_WARNINGS_END
IGNORE_WARNINGS_END
}
auto uniqueClientSubspace = makeUnique<JSC::GCClient::IsoSubspace>(*space);
auto* clientSpace = uniqueClientSubspace.get();
setClient(clientSubspaces, uniqueClientSubspace);
return clientSpace;
}
// template<typename T, UseCustomHeapCellType useCustomHeapCellType, typename GetClient, typename SetClient, typename GetServer, typename SetServer>
// ALWAYS_INLINE JSC::GCClient::IsoSubspace* subspaceForImpl(JSC::VM& vm, GetClient getClient, SetClient setClient, GetServer getServer, SetServer setServer, JSC::HeapCellType& (*getCustomHeapCellType)(JSHeapData&) = nullptr)
// {
// static NeverDestroyed<JSC::IsoSubspacePerVM> perVM([](JSC::Heap& heap) {
// return ISO_SUBSPACE_PARAMETERS(heap.destructibleObjectHeapCellType, T);
// });
// return &perVM.get().clientIsoSubspaceforVM(vm);
// }
static JSVMClientData* clientData(JSC::VM& vm)
{
return static_cast<Bun::JSVMClientData*>(vm.clientData);
return static_cast<WebCore::JSVMClientData*>(vm.clientData);
}
} // namespace Bun
} // namespace WebCore
namespace WebCore {
using JSVMClientData = WebCore::JSVMClientData;
using JSHeapData = WebCore::JSHeapData;
}

View File

@@ -1,53 +1,52 @@
// #include "BunGCOutputConstraint.h"
#include "BunGCOutputConstraint.h"
// #include "BunClientData.h"
// #include <JavaScriptCore/BlockDirectoryInlines.h>
// #include <JavaScriptCore/HeapInlines.h>
// #include <JavaScriptCore/MarkedBlockInlines.h>
// #include <JavaScriptCore/MarkingConstraint.h>
// #include <JavaScriptCore/SubspaceInlines.h>
// #include <JavaScriptCore/VM.h>
#include "BunClientData.h"
#include "JavaScriptCore/BlockDirectoryInlines.h"
#include "JavaScriptCore/HeapInlines.h"
#include "JavaScriptCore/MarkedBlockInlines.h"
#include "JavaScriptCore/MarkingConstraint.h"
#include "JavaScriptCore/SubspaceInlines.h"
#include "JavaScriptCore/VM.h"
// namespace Bun {
namespace WebCore {
// using namespace JSC;
using namespace JSC;
// BunGCOutputConstraint::BunGCOutputConstraint(VM& vm, Bun::JSVMClientData& clientData)
// : MarkingConstraint("Domo", "DOM Output", ConstraintVolatility::SeldomGreyed,
// ConstraintConcurrency::Concurrent, ConstraintParallelism::Parallel)
// , m_vm(vm)
// , m_clientData(clientData)
// , m_lastExecutionVersion(vm.heap.mutatorExecutionVersion())
// {
// }
BunGCOutputConstraint::BunGCOutputConstraint(VM& vm, WebCore::JSVMClientData& clientData)
: MarkingConstraint("Domo", "DOM Output", ConstraintVolatility::SeldomGreyed, ConstraintConcurrency::Concurrent, ConstraintParallelism::Parallel)
, m_vm(vm)
, m_clientData(clientData)
, m_lastExecutionVersion(vm.heap.mutatorExecutionVersion())
{
}
// template<typename Visitor> void BunGCOutputConstraint::executeImplImpl(Visitor& visitor)
// {
// Heap& heap = m_vm.heap;
template<typename Visitor> void BunGCOutputConstraint::executeImplImpl(Visitor& visitor)
{
Heap& heap = m_vm.heap;
// if (heap.mutatorExecutionVersion() == m_lastExecutionVersion)
// return;
if (heap.mutatorExecutionVersion() == m_lastExecutionVersion)
return;
// m_lastExecutionVersion = heap.mutatorExecutionVersion();
m_lastExecutionVersion = heap.mutatorExecutionVersion();
// m_clientData.forEachOutputConstraintSpace([&](Subspace& subspace) {
// auto func = [](Visitor& visitor, HeapCell* heapCell, HeapCell::Kind) {
// SetRootMarkReasonScope rootScope(visitor, RootMarkReason::DOMGCOutput);
// JSCell* cell = static_cast<JSCell*>(heapCell);
// cell->methodTable(visitor.vm())->visitOutputConstraints(cell, visitor);
// };
m_clientData.forEachOutputConstraintSpace([&](Subspace& subspace) {
auto func = [](Visitor& visitor, HeapCell* heapCell, HeapCell::Kind) {
SetRootMarkReasonScope rootScope(visitor, RootMarkReason::DOMGCOutput);
JSCell* cell = static_cast<JSCell*>(heapCell);
cell->methodTable(visitor.vm())->visitOutputConstraints(cell, visitor);
};
// RefPtr<SharedTask<void(Visitor&)>> task = subspace.template forEachMarkedCellInParallel<Visitor>(func);
// visitor.addParallelConstraintTask(task);
// });
// }
RefPtr<SharedTask<void(Visitor&)>> task = subspace.template forEachMarkedCellInParallel<Visitor>(func);
visitor.addParallelConstraintTask(task);
});
}
// void BunGCOutputConstraint::executeImpl(AbstractSlotVisitor& visitor)
// {
// executeImplImpl(visitor);
// }
// void BunGCOutputConstraint::executeImpl(SlotVisitor& visitor) { executeImplImpl(visitor); }
void BunGCOutputConstraint::executeImpl(AbstractSlotVisitor& visitor)
{
executeImplImpl(visitor);
}
void BunGCOutputConstraint::executeImpl(SlotVisitor& visitor) { executeImplImpl(visitor); }
// } // namespace Bun
} // namespace WebCore

View File

@@ -1,34 +1,35 @@
// #pragma once
#pragma once
// #include "root.h"
// #include <JavaScriptCore/MarkingConstraint.h>
#include "root.h"
// namespace JSC {
// class VM;
// }
#include "JavaScriptCore/MarkingConstraint.h"
// namespace Bun {
namespace JSC {
class VM;
}
// class JSVMClientData;
namespace WebCore {
// class BunGCOutputConstraint : public JSC::MarkingConstraint {
// WTF_MAKE_FAST_ALLOCATED;
class JSVMClientData;
// public:
// BunGCOutputConstraint(JSC::VM&, Bun::JSVMClientData&);
// ~BunGCOutputConstraint() {};
class BunGCOutputConstraint : public JSC::MarkingConstraint {
WTF_MAKE_FAST_ALLOCATED;
// protected:
// void executeImpl(JSC::AbstractSlotVisitor&) override;
// void executeImpl(JSC::SlotVisitor&) override;
public:
BunGCOutputConstraint(JSC::VM&, WebCore::JSVMClientData&);
~BunGCOutputConstraint() {};
// private:
// template<typename Visitor> void executeImplImpl(Visitor&);
protected:
void executeImpl(JSC::AbstractSlotVisitor&) override;
void executeImpl(JSC::SlotVisitor&) override;
// JSC::VM& m_vm;
// JSVMClientData& m_clientData;
// uint64_t m_lastExecutionVersion;
// };
private:
template<typename Visitor> void executeImplImpl(Visitor&);
// } // namespace Bun
JSC::VM& m_vm;
JSVMClientData& m_clientData;
uint64_t m_lastExecutionVersion;
};
} // namespace WebCore

View File

@@ -1,8 +1,10 @@
#include "BunStream.h"
#include <JavaScriptCore/JSMicrotask.h>
#include <JavaScriptCore/ObjectConstructor.h>
#include "JavaScriptCore/JSMicrotask.h"
#include "JavaScriptCore/ObjectConstructor.h"
namespace Bun {
#include "JavaScriptCore/JSCInlines.h"
namespace WebCore {
using JSGlobalObject = JSC::JSGlobalObject;
using Exception = JSC::Exception;
using JSValue = JSC::JSValue;
@@ -127,7 +129,7 @@ static JSC_DEFINE_HOST_FUNCTION(Readable__on,
JSC::VM& vm = globalObject->vm();
auto scope = DECLARE_THROW_SCOPE(vm);
auto thisObject = JSC::jsDynamicCast<Bun::Readable*>(vm, callFrame->thisValue());
auto thisObject = JSC::jsDynamicCast<WebCore::Readable*>(vm, callFrame->thisValue());
if (UNLIKELY(!thisObject)) {
scope.release();
JSC::throwVMTypeError(globalObject, scope);
@@ -163,7 +165,7 @@ static JSC_DEFINE_HOST_FUNCTION(Readable__on,
extern "C" Bun__Readable* JSC__JSValue__getReadableStreamState(JSC__JSValue value, JSC__VM* vm)
{
auto* thisObject = JSC::jsDynamicCast<Bun::Readable*>(*vm, JSC::JSValue::decode(value));
auto* thisObject = JSC::jsDynamicCast<WebCore::Readable*>(*vm, JSC::JSValue::decode(value));
if (UNLIKELY(!thisObject)) {
return nullptr;
}
@@ -171,17 +173,17 @@ extern "C" Bun__Readable* JSC__JSValue__getReadableStreamState(JSC__JSValue valu
}
extern "C" Bun__Writable* JSC__JSValue__getWritableStreamState(JSC__JSValue value, JSC__VM* vm)
{
auto* thisObject = JSC::jsDynamicCast<Bun::Writable*>(*vm, JSC::JSValue::decode(value));
auto* thisObject = JSC::jsDynamicCast<WebCore::Writable*>(*vm, JSC::JSValue::decode(value));
if (UNLIKELY(!thisObject)) {
return nullptr;
}
return thisObject->state;
}
const JSC::ClassInfo Readable::s_info = { "Readable", &Base::s_info, nullptr, nullptr,
const JSC::ClassInfo Readable::s_info = { "Readable"_s, &Base::s_info, nullptr, nullptr,
CREATE_METHOD_TABLE(Readable) };
const JSC::ClassInfo Writable::s_info = { "Writable", &Base::s_info, nullptr, nullptr,
const JSC::ClassInfo Writable::s_info = { "Writable"_s, &Base::s_info, nullptr, nullptr,
CREATE_METHOD_TABLE(Writable) };
static JSC_DEFINE_HOST_FUNCTION(Readable__once,
@@ -194,7 +196,7 @@ static JSC_DEFINE_HOST_FUNCTION(Readable__once,
JSC::VM& vm = globalObject->vm();
auto scope = DECLARE_THROW_SCOPE(vm);
auto thisObject = JSC::jsDynamicCast<Bun::Readable*>(vm, callFrame->thisValue());
auto thisObject = JSC::jsDynamicCast<WebCore::Readable*>(vm, callFrame->thisValue());
if (UNLIKELY(!thisObject)) {
scope.release();
JSC::throwVMTypeError(globalObject, scope);
@@ -238,7 +240,7 @@ static JSC_DEFINE_HOST_FUNCTION(Writable__on,
JSC::VM& vm = globalObject->vm();
auto scope = DECLARE_THROW_SCOPE(vm);
auto thisObject = JSC::jsDynamicCast<Bun::Writable*>(vm, callFrame->thisValue());
auto thisObject = JSC::jsDynamicCast<WebCore::Writable*>(vm, callFrame->thisValue());
if (UNLIKELY(!thisObject)) {
scope.release();
JSC::throwVMTypeError(globalObject, scope);
@@ -282,7 +284,7 @@ static JSC_DEFINE_HOST_FUNCTION(Writable__once,
JSC::VM& vm = globalObject->vm();
auto scope = DECLARE_THROW_SCOPE(vm);
auto thisObject = JSC::jsDynamicCast<Bun::Writable*>(vm, callFrame->thisValue());
auto thisObject = JSC::jsDynamicCast<WebCore::Writable*>(vm, callFrame->thisValue());
if (UNLIKELY(!thisObject)) {
scope.release();
JSC::throwVMTypeError(globalObject, scope);
@@ -319,71 +321,71 @@ static JSC_DEFINE_HOST_FUNCTION(Writable__once,
static JSC_DEFINE_HOST_FUNCTION(Readable__read,
(JSC::JSGlobalObject * globalObject, JSC::CallFrame* callFrame))
{
DEFINE_CALLBACK_FUNCTION_BODY(Bun::Readable, Bun__Readable__read);
DEFINE_CALLBACK_FUNCTION_BODY(WebCore::Readable, Bun__Readable__read);
}
static JSC_DEFINE_HOST_FUNCTION(Readable__pipe,
(JSC::JSGlobalObject * globalObject, JSC::CallFrame* callFrame))
{
DEFINE_CALLBACK_FUNCTION_BODY(Bun::Readable, Bun__Readable__pipe);
DEFINE_CALLBACK_FUNCTION_BODY(WebCore::Readable, Bun__Readable__pipe);
}
static JSC_DEFINE_HOST_FUNCTION(Readable__resume,
(JSC::JSGlobalObject * globalObject, JSC::CallFrame* callFrame))
{
DEFINE_CALLBACK_FUNCTION_BODY(Bun::Readable, Bun__Readable__resume);
DEFINE_CALLBACK_FUNCTION_BODY(WebCore::Readable, Bun__Readable__resume);
}
static JSC_DEFINE_HOST_FUNCTION(Readable__unpipe,
(JSC::JSGlobalObject * globalObject, JSC::CallFrame* callFrame))
{
DEFINE_CALLBACK_FUNCTION_BODY(Bun::Readable, Bun__Readable__unpipe);
DEFINE_CALLBACK_FUNCTION_BODY(WebCore::Readable, Bun__Readable__unpipe);
}
static JSC_DEFINE_HOST_FUNCTION(Readable__pause,
(JSC::JSGlobalObject * globalObject, JSC::CallFrame* callFrame))
{
DEFINE_CALLBACK_FUNCTION_BODY(Bun::Readable, Bun__Readable__pause);
DEFINE_CALLBACK_FUNCTION_BODY(WebCore::Readable, Bun__Readable__pause);
}
static JSC_DEFINE_HOST_FUNCTION(Readable__unshift,
(JSC::JSGlobalObject * globalObject, JSC::CallFrame* callFrame))
{
DEFINE_CALLBACK_FUNCTION_BODY(Bun::Readable, Bun__Readable__unshift);
DEFINE_CALLBACK_FUNCTION_BODY(WebCore::Readable, Bun__Readable__unshift);
}
// static JSC_DECLARE_HOST_FUNCTION(Readable__isPaused);
// static JSC_DECLARE_HOST_FUNCTION(Writable__setDefaultEncoding);
// static DEFINE_CALLBACK_FUNCTION(Writable__setDefaultEncoding, Bun::Writable,
// static DEFINE_CALLBACK_FUNCTION(Writable__setDefaultEncoding, WebCore::Writable,
// Bun__Writable__setDefaultEncoding);
static JSC_DEFINE_HOST_FUNCTION(Writable__write,
(JSC::JSGlobalObject * globalObject, JSC::CallFrame* callFrame))
{
DEFINE_CALLBACK_FUNCTION_BODY(Bun::Writable, Bun__Writable__write);
DEFINE_CALLBACK_FUNCTION_BODY(WebCore::Writable, Bun__Writable__write);
}
static JSC_DEFINE_HOST_FUNCTION(Writable__end,
(JSC::JSGlobalObject * globalObject, JSC::CallFrame* callFrame))
{
DEFINE_CALLBACK_FUNCTION_BODY(Bun::Writable, Bun__Writable__end);
DEFINE_CALLBACK_FUNCTION_BODY(WebCore::Writable, Bun__Writable__end);
}
static JSC_DEFINE_HOST_FUNCTION(Writable__close,
(JSC::JSGlobalObject * globalObject, JSC::CallFrame* callFrame))
{
DEFINE_CALLBACK_FUNCTION_BODY(Bun::Writable, Bun__Writable__close);
DEFINE_CALLBACK_FUNCTION_BODY(WebCore::Writable, Bun__Writable__close);
}
static JSC_DEFINE_HOST_FUNCTION(Writable__destroy,
(JSC::JSGlobalObject * globalObject, JSC::CallFrame* callFrame))
{
DEFINE_CALLBACK_FUNCTION_BODY(Bun::Writable, Bun__Writable__destroy);
DEFINE_CALLBACK_FUNCTION_BODY(WebCore::Writable, Bun__Writable__destroy);
}
static JSC_DEFINE_HOST_FUNCTION(Writable__cork,
(JSC::JSGlobalObject * globalObject, JSC::CallFrame* callFrame))
{
DEFINE_CALLBACK_FUNCTION_BODY(Bun::Writable, Bun__Writable__cork);
DEFINE_CALLBACK_FUNCTION_BODY(WebCore::Writable, Bun__Writable__cork);
}
static JSC_DEFINE_HOST_FUNCTION(Writable__uncork,
(JSC::JSGlobalObject * globalObject, JSC::CallFrame* callFrame))
{
DEFINE_CALLBACK_FUNCTION_BODY(Bun::Writable, Bun__Writable__uncork);
DEFINE_CALLBACK_FUNCTION_BODY(WebCore::Writable, Bun__Writable__uncork);
}
extern "C" JSC__JSValue Bun__Readable__create(Bun__Readable* state,
@@ -422,7 +424,7 @@ Writable::~Writable()
void Readable::finishCreation(JSC::VM& vm)
{
Base::finishCreation(vm);
auto clientData = Bun::clientData(vm);
auto clientData = WebCore::clientData(vm);
auto* globalObject = this->globalObject();
putDirect(vm, clientData->builtinNames().onPublicName(),
@@ -469,7 +471,7 @@ void Readable::finishCreation(JSC::VM& vm)
void Writable::finishCreation(JSC::VM& vm)
{
Base::finishCreation(vm);
auto clientData = Bun::clientData(vm);
auto clientData = WebCore::clientData(vm);
auto* globalObject = this->globalObject();
@@ -524,4 +526,4 @@ void Writable::finishCreation(JSC::VM& vm)
0);
}
} // namespace Bun
} // namespace WebCore

View File

@@ -4,7 +4,7 @@
#include "BunClientData.h"
#include "root.h"
namespace Bun {
namespace WebCore {
using namespace JSC;
@@ -39,7 +39,7 @@ public:
static Readable* create(JSC::VM& vm, Bun__Readable* state, JSC::Structure* structure)
{
Readable* accessor = new (NotNull, JSC::allocateCell<Bun::Readable>(vm)) Readable(vm, state, structure);
Readable* accessor = new (NotNull, JSC::allocateCell<WebCore::Readable>(vm)) Readable(vm, state, structure);
accessor->finishCreation(vm);
return accessor;
}
@@ -86,4 +86,4 @@ public:
void finishCreation(JSC::VM& vm);
};
} // namespace Bun
} // namespace WebCore

View File

@@ -30,7 +30,7 @@
#include "root.h"
#include "ExceptionCode.h"
#include <wtf/text/WTFString.h>
#include "wtf/text/WTFString.h"
namespace WebCore {

View File

@@ -33,8 +33,8 @@
// #include "File.h"
// #include <pal/text/TextEncoding.h>
// #include <variant>
// #include <wtf/RefCounted.h>
// #include <wtf/text/WTFString.h>
// #include "wtf/RefCounted.h"
// #include "wtf/text/WTFString.h"
// namespace WebCore {

View File

@@ -32,7 +32,7 @@
// #include "PublicURLManager.h"
// #include "ResourceRequest.h"
#include "URLSearchParams.h"
// #include <wtf/MainThread.h>
// #include "wtf/MainThread.h"
namespace WebCore {

View File

@@ -30,8 +30,8 @@
#include "ExceptionOr.h"
#include "URLDecomposition.h"
#include <wtf/URL.h>
#include <wtf/WeakPtr.h>
#include "wtf/URL.h"
#include "wtf/WeakPtr.h"
namespace WebCore {

View File

@@ -0,0 +1,65 @@
#pragma once
#include "root.h"
#include "JavaScriptCore/JSCInlines.h"
#include "wtf/Forward.h"
namespace WebCore {
class WindowProxy;
typedef HashMap<void*, JSC::Weak<JSC::JSObject>> DOMObjectWrapperMap;
class DOMWrapperWorld : public RefCounted<DOMWrapperWorld> {
public:
enum class Type {
Normal, // Main (e.g. Page)
User, // User Scripts (e.g. Extensions)
Internal, // WebKit Internal (e.g. Media Controls)
};
static Ref<DOMWrapperWorld> create(JSC::VM& vm, Type type = Type::Internal, const String& name = {})
{
return adoptRef(*new DOMWrapperWorld(vm, type, name));
}
WEBCORE_EXPORT ~DOMWrapperWorld();
// Free as much memory held onto by this world as possible.
WEBCORE_EXPORT void clearWrappers();
void didCreateWindowProxy(WindowProxy* controller) { m_jsWindowProxies.add(controller); }
void didDestroyWindowProxy(WindowProxy* controller) { m_jsWindowProxies.remove(controller); }
void setShadowRootIsAlwaysOpen() { m_shadowRootIsAlwaysOpen = true; }
bool shadowRootIsAlwaysOpen() const { return m_shadowRootIsAlwaysOpen; }
void disableLegacyOverrideBuiltInsBehavior() { m_shouldDisableLegacyOverrideBuiltInsBehavior = true; }
bool shouldDisableLegacyOverrideBuiltInsBehavior() const { return m_shouldDisableLegacyOverrideBuiltInsBehavior; }
DOMObjectWrapperMap& wrappers() { return m_wrappers; }
Type type() const { return m_type; }
bool isNormal() const { return m_type == Type::Normal; }
const String& name() const { return m_name; }
JSC::VM& vm() const { return m_vm; }
protected:
DOMWrapperWorld(JSC::VM&, Type, const String& name);
private:
JSC::VM& m_vm;
HashSet<WindowProxy*> m_jsWindowProxies;
DOMObjectWrapperMap m_wrappers;
String m_name;
Type m_type { Type::Internal };
bool m_shadowRootIsAlwaysOpen { false };
bool m_shouldDisableLegacyOverrideBuiltInsBehavior { false };
};
} // namespace WebCore

View File

@@ -0,0 +1,71 @@
/*
* Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
* Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
* Copyright (C) 2007 Samuel Weinig <sam@webkit.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "root.h"
#include "DOMWrapperWorld.h"
// #include "JSDOMWindow.h"
#include "WebCoreJSClientData.h"
// #include "WindowProxy.h"
#include "ZigGlobalObject.h"
#include "wtf/MainThread.h"
namespace WebCore {
using namespace JSC;
DOMWrapperWorld::DOMWrapperWorld(JSC::VM& vm, Type type, const String& name)
: m_vm(vm)
, m_name(name)
, m_type(type)
{
VM::ClientData* clientData = m_vm.clientData;
ASSERT(clientData);
// static_cast<JSVMClientData*>(clientData)->rememberWorld(*this);
}
DOMWrapperWorld::~DOMWrapperWorld()
{
VM::ClientData* clientData = m_vm.clientData;
ASSERT(clientData);
// static_cast<JSVMClientData*>(clientData)->forgetWorld(*this);
}
void DOMWrapperWorld::clearWrappers()
{
m_wrappers.clear();
}
DOMWrapperWorld& normalWorld(JSC::VM& vm)
{
VM::ClientData* clientData = vm.clientData;
ASSERT(clientData);
return static_cast<JSVMClientData*>(clientData)->normalWorld();
}
// DOMWrapperWorld& mainThreadNormalWorld()
// {
// ASSERT(isMainThread());
// // static DOMWrapperWorld& cachedNormalWorld = normalWorld(commonVM());
// return cachedNormalWorld;
// }
} // namespace WebCore

View File

@@ -0,0 +1,59 @@
/*
* Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
* Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Apple Inc. All rights reserved.
* Copyright (C) 2007 Samuel Weinig <sam@webkit.org>
* Copyright (C) 2009 Google, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#pragma once
#include "root.h"
#include "DOMWrapperWorld-class.h"
#include "ZigGlobalObject.h"
namespace WebCore {
DOMWrapperWorld& normalWorld(JSC::VM&);
// WEBCORE_EXPORT DOMWrapperWorld& mainThreadNormalWorld();
// inline DOMWrapperWorld& debuggerWorld() { return mainThreadNormalWorld(); }
// inline DOMWrapperWorld& pluginWorld() { return mainThreadNormalWorld(); }
DOMWrapperWorld& currentWorld(JSC::JSGlobalObject&);
DOMWrapperWorld& worldForDOMObject(JSC::JSObject&);
// Helper function for code paths that must not share objects across isolated DOM worlds.
bool isWorldCompatible(JSC::JSGlobalObject&, JSC::JSValue);
inline DOMWrapperWorld& currentWorld(JSC::JSGlobalObject& lexicalGlobalObject);
inline DOMWrapperWorld& worldForDOMObject(JSC::JSObject& object);
inline bool isWorldCompatible(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value)
{
return true;
// return !value.isObject() || &worldForDOMObject(*value.getObject()) == &currentWorld(lexicalGlobalObject);
}
inline DOMWrapperWorld& currentWorld(JSC::JSGlobalObject& lexicalGlobalObject)
{
return JSC::jsCast<Zig::GlobalObject*>(&lexicalGlobalObject)->world();
}
inline DOMWrapperWorld& worldForDOMObject(JSC::JSObject& object)
{
return JSC::jsCast<Zig::GlobalObject*>(object.globalObject())->world();
};
}

View File

@@ -29,7 +29,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "root.h"
#include "ExceptionCode.h"
#include <wtf/text/WTFString.h>
#include "wtf/text/WTFString.h"
namespace WebCore {

View File

@@ -20,7 +20,7 @@
#include "root.h"
#include <wtf/EnumTraits.h>
#include "wtf/EnumTraits.h"
namespace WebCore {

View File

@@ -29,9 +29,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "root.h"
#include "Exception.h"
#include <wtf/CrossThreadCopier.h>
#include <wtf/Expected.h>
#include <wtf/StdLibExtras.h>
#include "wtf/CrossThreadCopier.h"
#include "wtf/Expected.h"
#include "wtf/StdLibExtras.h"
namespace WebCore {

View File

@@ -2,6 +2,8 @@
#include "helpers.h"
#include "JavaScriptCore/JSCInlines.h"
namespace JSC {
ALWAYS_INLINE GCDeferralContext::GCDeferralContext(VM& vm)

View File

@@ -25,14 +25,14 @@
#pragma once
#include "JavaScriptCore/HandleTypes.h"
#include "JavaScriptCore/Strong.h"
#include "StringAdaptors.h"
#include <JavaScriptCore/HandleTypes.h>
#include <JavaScriptCore/Strong.h>
#include "wtf/Brigand.h"
#include "wtf/StdLibExtras.h"
#include "wtf/URL.h"
#include "wtf/WallTime.h"
#include <variant>
#include <wtf/Brigand.h>
#include <wtf/StdLibExtras.h>
#include <wtf/URL.h>
#include <wtf/WallTime.h>
#if ENABLE(WEBGL)
#include "WebGLAny.h"

View File

@@ -36,22 +36,22 @@
// In fact, it can make a lot of sense: outside of JSC, this file becomes a kind of umbrella
// header that pulls in most (all?) of the interesting things in JSC.
#include <JavaScriptCore/ExceptionHelpers.h>
#include <JavaScriptCore/GCIncomingRefCountedInlines.h>
#include <JavaScriptCore/HeapInlines.h>
#include <JavaScriptCore/IdentifierInlines.h>
#include <JavaScriptCore/JSArrayBufferViewInlines.h>
#include <JavaScriptCore/JSCJSValueInlines.h>
#include <JavaScriptCore/JSCellInlines.h>
#include <JavaScriptCore/JSFunctionInlines.h>
#include <JavaScriptCore/JSGlobalObjectInlines.h>
#include <JavaScriptCore/JSObjectInlines.h>
#include <JavaScriptCore/JSProxy.h>
#include <JavaScriptCore/JSString.h>
#include <JavaScriptCore/Operations.h>
#include <JavaScriptCore/SlotVisitorInlines.h>
#include <JavaScriptCore/StrongInlines.h>
#include <JavaScriptCore/StructureInlines.h>
#include <JavaScriptCore/ThrowScope.h>
#include <JavaScriptCore/WeakGCMapInlines.h>
#include <JavaScriptCore/WeakGCSetInlines.h>
#include "JavaScriptCore/ExceptionHelpers.h"
#include "JavaScriptCore/GCIncomingRefCountedInlines.h"
#include "JavaScriptCore/HeapInlines.h"
#include "JavaScriptCore/IdentifierInlines.h"
#include "JavaScriptCore/JSArrayBufferViewInlines.h"
#include "JavaScriptCore/JSCJSValueInlines.h"
#include "JavaScriptCore/JSCellInlines.h"
#include "JavaScriptCore/JSFunctionInlines.h"
#include "JavaScriptCore/JSGlobalObjectInlines.h"
#include "JavaScriptCore/JSObjectInlines.h"
#include "JavaScriptCore/JSProxy.h"
#include "JavaScriptCore/JSString.h"
#include "JavaScriptCore/Operations.h"
#include "JavaScriptCore/SlotVisitorInlines.h"
#include "JavaScriptCore/StrongInlines.h"
#include "JavaScriptCore/StructureInlines.h"
#include "JavaScriptCore/ThrowScope.h"
#include "JavaScriptCore/WeakGCMapInlines.h"
#include "JavaScriptCore/WeakGCSetInlines.h"

View File

@@ -0,0 +1,21 @@
#pragma once
#include "root.h"
#include "ExceptionOr.h"
#include "JavaScriptCore/AuxiliaryBarrierInlines.h"
#include "JavaScriptCore/HeapInlines.h"
#include "JavaScriptCore/JSArray.h"
#include "JavaScriptCore/JSCJSValueInlines.h"
#include "JavaScriptCore/JSCellInlines.h"
#include "JavaScriptCore/JSObjectInlines.h"
#include "JavaScriptCore/Lookup.h"
#include "JavaScriptCore/ObjectConstructor.h"
#include "JavaScriptCore/SlotVisitorInlines.h"
#include "JavaScriptCore/StructureInlines.h"
#include "JavaScriptCore/WriteBarrier.h"
#include "wtf/Forward.h"
#include "wtf/GetPtr.h"
#include "wtf/Vector.h"
#include <cstddef>
#include "JavaScriptCore/WeakHandleOwner.h"

View File

@@ -25,11 +25,11 @@
#include "JSDOMException.h"
#include "JSDOMExceptionHandling.h"
#include <JavaScriptCore/ErrorHandlingScope.h>
#include <JavaScriptCore/Exception.h>
#include <JavaScriptCore/ExceptionHelpers.h>
#include <JavaScriptCore/ScriptCallStack.h>
#include <JavaScriptCore/ScriptCallStackFactory.h>
#include "JavaScriptCore/ErrorHandlingScope.h"
#include "JavaScriptCore/Exception.h"
#include "JavaScriptCore/ExceptionHelpers.h"
#include "JavaScriptCore/ScriptCallStack.h"
#include "JavaScriptCore/ScriptCallStackFactory.h"
namespace WebCore {
using namespace JSC;
@@ -76,7 +76,7 @@ void reportCurrentException(JSGlobalObject* lexicalGlobalObject)
auto scope = DECLARE_CATCH_SCOPE(vm);
auto* exception = scope.exception();
scope.clearException();
reportException(lexicalGlobalObject, exception);
// reportException(lexicalGlobalObject, exception);
}
JSValue createDOMException(JSGlobalObject* lexicalGlobalObject, ExceptionCode ec, const String& message)
@@ -116,7 +116,7 @@ JSValue createDOMException(JSGlobalObject* lexicalGlobalObject, ExceptionCode ec
// For now, we're going to assume the lexicalGlobalObject. Which is wrong in cases like this:
// frames[0].document.createElement(null, null); // throws an exception which should have the subframe's prototypes.
// https://bugs.webkit.org/show_bug.cgi?id=222229
JSDOMGlobalObject* globalObject = deprecatedGlobalObjectForPrototype(lexicalGlobalObject);
JSDOMGlobalObject* globalObject = JSC::jsCast<JSDOMGlobalObject*>(lexicalGlobalObject);
JSValue errorObject = toJS(lexicalGlobalObject, globalObject, DOMException::create(ec, message));
ASSERT(errorObject);
@@ -214,10 +214,10 @@ void throwNonFiniteTypeError(JSGlobalObject& lexicalGlobalObject, JSC::ThrowScop
throwTypeError(&lexicalGlobalObject, scope, "The provided value is non-finite"_s);
}
JSC::EncodedJSValue rejectPromiseWithGetterTypeError(JSC::JSGlobalObject& lexicalGlobalObject, const JSC::ClassInfo* classInfo, JSC::PropertyName attributeName)
{
return createRejectedPromiseWithTypeError(lexicalGlobalObject, JSC::makeDOMAttributeGetterTypeErrorMessage(classInfo->className, String(attributeName.uid())), RejectedPromiseWithTypeErrorCause::NativeGetter);
}
// JSC::EncodedJSValue rejectPromiseWithGetterTypeError(JSC::JSGlobalObject& lexicalGlobalObject, const JSC::ClassInfo* classInfo, JSC::PropertyName attributeName)
// {
// return createRejectedPromiseWithTypeError(lexicalGlobalObject, JSC::makeDOMAttributeGetterTypeErrorMessage(classInfo->className, String(attributeName.uid())), RejectedPromiseWithTypeErrorCause::NativeGetter);
// }
String makeThisTypeErrorMessage(const char* interfaceName, const char* functionName)
{
@@ -234,16 +234,16 @@ EncodedJSValue throwThisTypeError(JSC::JSGlobalObject& lexicalGlobalObject, JSC:
return throwTypeError(lexicalGlobalObject, scope, makeThisTypeErrorMessage(interfaceName, functionName));
}
JSC::EncodedJSValue rejectPromiseWithThisTypeError(DeferredPromise& promise, const char* interfaceName, const char* methodName)
{
promise.reject(TypeError, makeThisTypeErrorMessage(interfaceName, methodName));
return JSValue::encode(jsUndefined());
}
// JSC::EncodedJSValue rejectPromiseWithThisTypeError(DeferredPromise& promise, const char* interfaceName, const char* methodName)
// {
// promise.reject(TypeError, makeThisTypeErrorMessage(interfaceName, methodName));
// return JSValue::encode(jsUndefined());
// }
JSC::EncodedJSValue rejectPromiseWithThisTypeError(JSC::JSGlobalObject& lexicalGlobalObject, const char* interfaceName, const char* methodName)
{
return createRejectedPromiseWithTypeError(lexicalGlobalObject, makeThisTypeErrorMessage(interfaceName, methodName), RejectedPromiseWithTypeErrorCause::InvalidThis);
}
// JSC::EncodedJSValue rejectPromiseWithThisTypeError(JSC::JSGlobalObject& lexicalGlobalObject, const char* interfaceName, const char* methodName)
// {
// return createRejectedPromiseWithTypeError(lexicalGlobalObject, makeThisTypeErrorMessage(interfaceName, methodName), RejectedPromiseWithTypeErrorCause::InvalidThis);
// }
void throwDOMSyntaxError(JSC::JSGlobalObject& lexicalGlobalObject, JSC::ThrowScope& scope, ASCIILiteral message)
{

View File

@@ -23,9 +23,13 @@
#pragma once
#include "root.h"
#include "JavaScriptCore/WeakHandleOwner.h"
#include "ExceptionDetails.h"
#include "ExceptionOr.h"
#include <JavaScriptCore/ThrowScope.h>
#include "JavaScriptCore/ThrowScope.h"
namespace JSC {
class CatchScope;
@@ -35,7 +39,6 @@ namespace WebCore {
class CachedScript;
class DeferredPromise;
class JSDOMGlobalObject;
void throwAttributeTypeError(JSC::JSGlobalObject&, JSC::ThrowScope&, const char* interfaceName, const char* attributeName, const char* expectedType);
@@ -59,9 +62,9 @@ String makeUnsupportedIndexedSetterErrorMessage(const char* interfaceName);
WEBCORE_EXPORT JSC::EncodedJSValue throwThisTypeError(JSC::JSGlobalObject&, JSC::ThrowScope&, const char* interfaceName, const char* functionName);
WEBCORE_EXPORT JSC::EncodedJSValue rejectPromiseWithGetterTypeError(JSC::JSGlobalObject&, const JSC::ClassInfo*, JSC::PropertyName attributeName);
WEBCORE_EXPORT JSC::EncodedJSValue rejectPromiseWithThisTypeError(DeferredPromise&, const char* interfaceName, const char* operationName);
WEBCORE_EXPORT JSC::EncodedJSValue rejectPromiseWithThisTypeError(JSC::JSGlobalObject&, const char* interfaceName, const char* operationName);
// WEBCORE_EXPORT JSC::EncodedJSValue rejectPromiseWithGetterTypeError(JSC::JSGlobalObject&, const JSC::ClassInfo*, JSC::PropertyName attributeName);
// WEBCORE_EXPORT JSC::EncodedJSValue rejectPromiseWithThisTypeError(DeferredPromise&, const char* interfaceName, const char* operationName);
// WEBCORE_EXPORT JSC::EncodedJSValue rejectPromiseWithThisTypeError(JSC::JSGlobalObject&, const char* interfaceName, const char* operationName);
String retrieveErrorMessageWithoutName(JSC::JSGlobalObject&, JSC::VM&, JSC::JSValue exception, JSC::CatchScope&);
String retrieveErrorMessage(JSC::JSGlobalObject&, JSC::VM&, JSC::JSValue exception, JSC::CatchScope&);
@@ -88,6 +91,12 @@ inline void propagateException(JSC::JSGlobalObject& lexicalGlobalObject, JSC::Th
propagateException(lexicalGlobalObject, throwScope, value.releaseException());
}
inline void propagateException(JSC::JSGlobalObject* lexicalGlobalObject, JSC::ThrowScope& throwScope, ExceptionOr<void>&& value)
{
if (UNLIKELY(value.hasException()))
propagateException(lexicalGlobalObject, throwScope, value.releaseException());
}
template<typename Functor> void invokeFunctorPropagatingExceptionIfNecessary(JSC::JSGlobalObject& lexicalGlobalObject, JSC::ThrowScope& throwScope, Functor&& functor)
{
using ReturnType = std::invoke_result_t<Functor>;
@@ -100,4 +109,16 @@ template<typename Functor> void invokeFunctorPropagatingExceptionIfNecessary(JSC
functor();
}
template<typename Functor> void invokeFunctorPropagatingExceptionIfNecessary(JSC::JSGlobalObject* lexicalGlobalObject, JSC::ThrowScope& throwScope, Functor&& functor)
{
using ReturnType = std::invoke_result_t<Functor>;
if constexpr (IsExceptionOr<ReturnType>) {
auto result = functor();
if (UNLIKELY(result.hasException()))
propagateException(lexicalGlobalObject, throwScope, result.releaseException());
} else
functor();
}
} // namespace WebCore

View File

@@ -0,0 +1,82 @@
#include "JSDOMGlobalObject.h"
#include "JavaScriptCore/JSCast.h"
#include "ZigGlobalObject.h"
namespace WebCore {
// static JSDOMGlobalObject& callerGlobalObject(JSC::JSGlobalObject& lexicalGlobalObject, JSC::CallFrame* callFrame, bool skipFirstFrame, bool lookUpFromVMEntryScope)
// {
// VM& vm = lexicalGlobalObject.vm();
// if (callFrame) {
// class GetCallerGlobalObjectFunctor {
// public:
// GetCallerGlobalObjectFunctor(bool skipFirstFrame)
// : m_skipFirstFrame(skipFirstFrame)
// {
// }
// StackVisitor::Status operator()(StackVisitor& visitor) const
// {
// if (m_skipFirstFrame) {
// if (!m_hasSkippedFirstFrame) {
// m_hasSkippedFirstFrame = true;
// return StackVisitor::Continue;
// }
// }
// if (auto* codeBlock = visitor->codeBlock())
// m_globalObject = codeBlock->globalObject();
// else {
// ASSERT(visitor->callee().rawPtr());
// // FIXME: Callee is not an object if the caller is Web Assembly.
// // Figure out what to do here. We can probably get the global object
// // from the top-most Wasm Instance. https://bugs.webkit.org/show_bug.cgi?id=165721
// if (visitor->callee().isCell() && visitor->callee().asCell()->isObject())
// m_globalObject = jsCast<JSObject*>(visitor->callee().asCell())->globalObject();
// }
// return StackVisitor::Done;
// }
// JSC::JSGlobalObject* globalObject() const { return m_globalObject; }
// private:
// bool m_skipFirstFrame { false };
// mutable bool m_hasSkippedFirstFrame { false };
// mutable JSC::JSGlobalObject* m_globalObject { nullptr };
// };
// GetCallerGlobalObjectFunctor iter(skipFirstFrame);
// callFrame->iterate(vm, iter);
// if (iter.globalObject())
// return *jsCast<JSDOMGlobalObject*>(iter.globalObject());
// }
// // In the case of legacyActiveGlobalObjectForAccessor, it is possible that vm.topCallFrame is nullptr when the script is evaluated as JSONP.
// // Since we put JSGlobalObject to VMEntryScope, we can retrieve the right globalObject from that.
// // For callerGlobalObject, we do not check vm.entryScope to keep it the old behavior.
// if (lookUpFromVMEntryScope) {
// if (vm.entryScope) {
// if (auto* result = vm.entryScope->globalObject())
// return *jsCast<JSDOMGlobalObject*>(result);
// }
// }
// // If we cannot find JSGlobalObject in caller frames, we just return the current lexicalGlobalObject.
// return *jsCast<JSDOMGlobalObject*>(&lexicalGlobalObject);
// }
// JSDOMGlobalObject& callerGlobalObject(JSC::JSGlobalObject& lexicalGlobalObject, JSC::CallFrame* callFrame)
// {
// constexpr bool skipFirstFrame = true;
// constexpr bool lookUpFromVMEntryScope = false;
// return callerGlobalObject(lexicalGlobalObject, callFrame, skipFirstFrame, lookUpFromVMEntryScope);
// }
// JSDOMGlobalObject& legacyActiveGlobalObjectForAccessor(JSC::JSGlobalObject& lexicalGlobalObject, JSC::CallFrame* callFrame)
// {
// constexpr bool skipFirstFrame = false;
// constexpr bool lookUpFromVMEntryScope = true;
// return callerGlobalObject(lexicalGlobalObject, callFrame, skipFirstFrame, lookUpFromVMEntryScope);
// }
}

View File

@@ -0,0 +1,33 @@
#pragma once
#include "root.h"
#include "DOMWrapperWorld.h"
#include "JavaScriptCore/HeapInlines.h"
#include "JavaScriptCore/JSGlobalObject.h"
#include "JavaScriptCore/JSObjectInlines.h"
#include "JavaScriptCore/WeakGCMap.h"
namespace WebCore {
// Zig::GlobalObject* toJSDOMGlobalObject(ScriptExecutionContext&, DOMWrapperWorld&);
WEBCORE_EXPORT Zig::GlobalObject& callerGlobalObject(JSC::JSGlobalObject&, JSC::CallFrame*);
Zig::GlobalObject& legacyActiveGlobalObjectForAccessor(JSC::JSGlobalObject&, JSC::CallFrame*);
template<class JSClass>
JSClass* toJSDOMGlobalObject(JSC::VM& vm, JSC::JSValue value)
{
// static_assert(std::is_base_of_v<JSDOMGlobalObject, JSClass>);
if (auto* object = value.getObject()) {
if (object->type() == JSC::PureForwardingProxyType)
return JSC::jsDynamicCast<JSClass*>(vm, JSC::jsCast<JSC::JSProxy*>(object)->target());
if (object->inherits<JSClass>(vm))
return JSC::jsCast<JSClass*>(object);
}
return nullptr;
}
}

View File

@@ -1,321 +0,0 @@
#include "root.h"
#include "JSDOMURL.h"
#include <JavaScriptCore/JSMicrotask.h>
#include <JavaScriptCore/ObjectConstructor.h>
namespace WebCore {
using namespace JSC;
using namespace Bun;
using JSGlobalObject = JSC::JSGlobalObject;
using JSValue = JSC::JSValue;
using JSString = JSC::JSString;
using JSModuleLoader = JSC::JSModuleLoader;
using JSModuleRecord = JSC::JSModuleRecord;
using Identifier = JSC::Identifier;
using SourceOrigin = JSC::SourceOrigin;
using JSObject = JSC::JSObject;
using JSNonFinalObject = JSC::JSNonFinalObject;
namespace JSCastingHelpers = JSC::JSCastingHelpers;
JSC_DEFINE_CUSTOM_GETTER(DOMURL__href_get, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, JSC::PropertyName))
{
auto* thisObject = JSC::jsDynamicCast<JSDOMURL*>(lexicalGlobalObject->vm(), JSC::JSValue::decode(thisValue));
auto& vm = JSC::getVM(lexicalGlobalObject);
auto throwScope = DECLARE_THROW_SCOPE(vm);
auto& impl = thisObject->wrapped();
RETURN_IF_EXCEPTION(throwScope, {});
return JSValue::encode(JSC::jsStringWithCache(vm, impl.href().string()));
}
JSC_DEFINE_CUSTOM_GETTER(DOMURL__protocol_get, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, JSC::PropertyName))
{
auto* thisObject = JSC::jsDynamicCast<JSDOMURL*>(lexicalGlobalObject->vm(), JSC::JSValue::decode(thisValue));
auto& vm = JSC::getVM(lexicalGlobalObject);
auto throwScope = DECLARE_THROW_SCOPE(vm);
auto& impl = thisObject->wrapped();
RETURN_IF_EXCEPTION(throwScope, {});
return JSValue::encode(JSC::jsStringWithCache(vm, impl.protocol()));
}
JSC_DEFINE_CUSTOM_GETTER(DOMURL__username_get, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, JSC::PropertyName))
{
auto* thisObject = JSC::jsDynamicCast<JSDOMURL*>(lexicalGlobalObject->vm(), JSC::JSValue::decode(thisValue));
auto& vm = JSC::getVM(lexicalGlobalObject);
auto throwScope = DECLARE_THROW_SCOPE(vm);
auto& impl = thisObject->wrapped();
RETURN_IF_EXCEPTION(throwScope, {});
return JSValue::encode(JSC::jsStringWithCache(vm, impl.username()));
}
JSC_DEFINE_CUSTOM_GETTER(DOMURL__password_get, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, JSC::PropertyName))
{
auto* thisObject = JSC::jsDynamicCast<JSDOMURL*>(lexicalGlobalObject->vm(), JSC::JSValue::decode(thisValue));
auto& vm = JSC::getVM(lexicalGlobalObject);
auto throwScope = DECLARE_THROW_SCOPE(vm);
auto& impl = thisObject->wrapped();
RETURN_IF_EXCEPTION(throwScope, {});
return JSValue::encode(JSC::jsStringWithCache(vm, impl.password()));
}
JSC_DEFINE_CUSTOM_GETTER(DOMURL__host_get, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, JSC::PropertyName))
{
auto* thisObject = JSC::jsDynamicCast<JSDOMURL*>(lexicalGlobalObject->vm(), JSC::JSValue::decode(thisValue));
auto& vm = JSC::getVM(lexicalGlobalObject);
auto throwScope = DECLARE_THROW_SCOPE(vm);
auto& impl = thisObject->wrapped();
RETURN_IF_EXCEPTION(throwScope, {});
return JSValue::encode(JSC::jsStringWithCache(vm, impl.host()));
}
JSC_DEFINE_CUSTOM_GETTER(DOMURL__hostname_get, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, JSC::PropertyName))
{
auto* thisObject = JSC::jsDynamicCast<JSDOMURL*>(lexicalGlobalObject->vm(), JSC::JSValue::decode(thisValue));
auto& vm = JSC::getVM(lexicalGlobalObject);
auto throwScope = DECLARE_THROW_SCOPE(vm);
auto& impl = thisObject->wrapped();
RETURN_IF_EXCEPTION(throwScope, {});
return JSValue::encode(JSC::jsStringWithCache(vm, impl.hostname()));
}
JSC_DEFINE_CUSTOM_GETTER(DOMURL__port_get, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, JSC::PropertyName))
{
auto* thisObject = JSC::jsDynamicCast<JSDOMURL*>(lexicalGlobalObject->vm(), JSC::JSValue::decode(thisValue));
auto& vm = JSC::getVM(lexicalGlobalObject);
auto throwScope = DECLARE_THROW_SCOPE(vm);
auto& impl = thisObject->wrapped();
RETURN_IF_EXCEPTION(throwScope, {});
return JSValue::encode(JSC::jsStringWithCache(vm, impl.port()));
}
JSC_DEFINE_CUSTOM_GETTER(DOMURL__pathname_get, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, JSC::PropertyName))
{
auto* thisObject = JSC::jsDynamicCast<JSDOMURL*>(lexicalGlobalObject->vm(), JSC::JSValue::decode(thisValue));
auto& vm = JSC::getVM(lexicalGlobalObject);
auto throwScope = DECLARE_THROW_SCOPE(vm);
auto& impl = thisObject->wrapped();
RETURN_IF_EXCEPTION(throwScope, {});
return JSValue::encode(JSC::jsStringWithCache(vm, impl.pathname()));
}
JSC_DEFINE_CUSTOM_GETTER(DOMURL__hash_get, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, JSC::PropertyName))
{
auto* thisObject = JSC::jsDynamicCast<JSDOMURL*>(lexicalGlobalObject->vm(), JSC::JSValue::decode(thisValue));
auto& vm = JSC::getVM(lexicalGlobalObject);
auto throwScope = DECLARE_THROW_SCOPE(vm);
auto& impl = thisObject->wrapped();
RETURN_IF_EXCEPTION(throwScope, {});
return JSValue::encode(JSC::jsStringWithCache(vm, impl.hash()));
}
JSC_DEFINE_CUSTOM_GETTER(DOMURL__search_get, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, JSC::PropertyName))
{
auto* thisObject = JSC::jsDynamicCast<JSDOMURL*>(lexicalGlobalObject->vm(), JSC::JSValue::decode(thisValue));
auto& vm = JSC::getVM(lexicalGlobalObject);
auto throwScope = DECLARE_THROW_SCOPE(vm);
auto& impl = thisObject->wrapped();
RETURN_IF_EXCEPTION(throwScope, {});
return JSValue::encode(JSC::jsStringWithCache(vm, impl.search()));
}
JSC_DEFINE_CUSTOM_SETTER(DOMURL__protocol_set,
(JSC::JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue,
JSC::EncodedJSValue value, JSC::PropertyName))
{
auto* thisObject = JSC::jsDynamicCast<JSDOMURL*>(lexicalGlobalObject->vm(), JSC::JSValue::decode(thisValue));
auto& vm = JSC::getVM(lexicalGlobalObject);
auto throwScope = DECLARE_THROW_SCOPE(vm);
auto& impl = thisObject->wrapped();
invokeFunctorPropagatingExceptionIfNecessary(lexicalGlobalObject, throwScope, [&] {
return impl.setProtocol(JSC::JSValue::decode(value).toWTFString(lexicalGlobalObject));
});
return true;
}
JSC_DEFINE_CUSTOM_SETTER(DOMURL__username_set,
(JSC::JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue,
JSC::EncodedJSValue value, JSC::PropertyName))
{
auto* thisObject = JSC::jsDynamicCast<JSDOMURL*>(lexicalGlobalObject->vm(), JSC::JSValue::decode(thisValue));
auto& vm = JSC::getVM(lexicalGlobalObject);
auto throwScope = DECLARE_THROW_SCOPE(vm);
auto& impl = thisObject->wrapped();
invokeFunctorPropagatingExceptionIfNecessary(lexicalGlobalObject, throwScope, [&] {
return impl.setUsername(JSC::JSValue::decode(value).toWTFString(lexicalGlobalObject));
});
return true;
}
JSC_DEFINE_CUSTOM_SETTER(DOMURL__href_set,
(JSC::JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue,
JSC::EncodedJSValue value, JSC::PropertyName))
{
auto* thisObject = JSC::jsDynamicCast<JSDOMURL*>(lexicalGlobalObject->vm(), JSC::JSValue::decode(thisValue));
auto& vm = JSC::getVM(lexicalGlobalObject);
auto throwScope = DECLARE_THROW_SCOPE(vm);
auto& impl = thisObject->wrapped();
invokeFunctorPropagatingExceptionIfNecessary(lexicalGlobalObject, throwScope, [&] {
return impl.setHref(JSC::JSValue::decode(value).toWTFString(lexicalGlobalObject));
});
return true;
}
JSC_DEFINE_CUSTOM_SETTER(DOMURL__password_set,
(JSC::JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue,
JSC::EncodedJSValue value, JSC::PropertyName))
{
auto* thisObject = JSC::jsDynamicCast<JSDOMURL*>(lexicalGlobalObject->vm(), JSC::JSValue::decode(thisValue));
auto& vm = JSC::getVM(lexicalGlobalObject);
auto throwScope = DECLARE_THROW_SCOPE(vm);
auto& impl = thisObject->wrapped();
invokeFunctorPropagatingExceptionIfNecessary(lexicalGlobalObject, throwScope, [&] {
return impl.setPassword(JSC::JSValue::decode(value).toWTFString(lexicalGlobalObject));
});
return true;
}
JSC_DEFINE_CUSTOM_SETTER(DOMURL__host_set,
(JSC::JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue,
JSC::EncodedJSValue value, JSC::PropertyName))
{
auto* thisObject = JSC::jsDynamicCast<JSDOMURL*>(lexicalGlobalObject->vm(), JSC::JSValue::decode(thisValue));
auto& vm = JSC::getVM(lexicalGlobalObject);
auto throwScope = DECLARE_THROW_SCOPE(vm);
auto& impl = thisObject->wrapped();
invokeFunctorPropagatingExceptionIfNecessary(lexicalGlobalObject, throwScope, [&] {
return impl.setHost(JSC::JSValue::decode(value).toWTFString(lexicalGlobalObject));
});
return true;
}
JSC_DEFINE_CUSTOM_SETTER(DOMURL__hostname_set,
(JSC::JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue,
JSC::EncodedJSValue value, JSC::PropertyName))
{
auto* thisObject = JSC::jsDynamicCast<JSDOMURL*>(lexicalGlobalObject->vm(), JSC::JSValue::decode(thisValue));
auto& vm = JSC::getVM(lexicalGlobalObject);
auto throwScope = DECLARE_THROW_SCOPE(vm);
auto& impl = thisObject->wrapped();
invokeFunctorPropagatingExceptionIfNecessary(lexicalGlobalObject, throwScope, [&] {
return impl.setHostname(JSC::JSValue::decode(value).toWTFString(lexicalGlobalObject));
});
return true;
}
JSC_DEFINE_CUSTOM_SETTER(DOMURL__port_set,
(JSC::JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue,
JSC::EncodedJSValue value, JSC::PropertyName))
{
auto* thisObject = JSC::jsDynamicCast<JSDOMURL*>(lexicalGlobalObject->vm(), JSC::JSValue::decode(thisValue));
auto& vm = JSC::getVM(lexicalGlobalObject);
auto throwScope = DECLARE_THROW_SCOPE(vm);
auto& impl = thisObject->wrapped();
invokeFunctorPropagatingExceptionIfNecessary(lexicalGlobalObject, throwScope, [&] {
return impl.setPort(JSC::JSValue::decode(value).toWTFString(lexicalGlobalObject));
});
return true;
}
JSC_DEFINE_CUSTOM_SETTER(DOMURL__pathname_set,
(JSC::JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue,
JSC::EncodedJSValue value, JSC::PropertyName))
{
auto* thisObject = JSC::jsDynamicCast<JSDOMURL*>(lexicalGlobalObject->vm(), JSC::JSValue::decode(thisValue));
auto& vm = JSC::getVM(lexicalGlobalObject);
auto throwScope = DECLARE_THROW_SCOPE(vm);
auto& impl = thisObject->wrapped();
invokeFunctorPropagatingExceptionIfNecessary(lexicalGlobalObject, throwScope, [&] {
return impl.setPathname(JSC::JSValue::decode(value).toWTFString(lexicalGlobalObject));
});
return true;
}
JSC_DEFINE_CUSTOM_SETTER(DOMURL__hash_set,
(JSC::JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue,
JSC::EncodedJSValue value, JSC::PropertyName))
{
auto* thisObject = JSC::jsDynamicCast<JSDOMURL*>(lexicalGlobalObject->vm(), JSC::JSValue::decode(thisValue));
auto& vm = JSC::getVM(lexicalGlobalObject);
auto throwScope = DECLARE_THROW_SCOPE(vm);
auto& impl = thisObject->wrapped();
invokeFunctorPropagatingExceptionIfNecessary(lexicalGlobalObject, throwScope, [&] {
return impl.setHash(JSC::JSValue::decode(value).toWTFString(lexicalGlobalObject));
});
return true;
}
JSC_DEFINE_CUSTOM_SETTER(DOMURL__search_set,
(JSC::JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue,
JSC::EncodedJSValue value, JSC::PropertyName))
{
auto* thisObject = JSC::jsDynamicCast<JSDOMURL*>(lexicalGlobalObject->vm(), JSC::JSValue::decode(thisValue));
auto& vm = JSC::getVM(lexicalGlobalObject);
auto throwScope = DECLARE_THROW_SCOPE(vm);
auto& impl = thisObject->wrapped();
invokeFunctorPropagatingExceptionIfNecessary(lexicalGlobalObject, throwScope, [&] {
return impl.setSearch(JSC::JSValue::decode(value).toWTFString(lexicalGlobalObject));
});
return true;
}
void JSDOMURL::finishCreation(JSC::VM& vm)
{
Base::finishCreation(vm);
auto clientData = Bun::clientData(vm);
putDirectCustomAccessor(vm, clientData->builtinNames().protocolPublicName(),
JSC::CustomGetterSetter::create(vm, DOMURL__protocol_get, DOMURL__protocol_set),
static_cast<unsigned>(JSC::PropertyAttribute::CustomValue));
putDirectCustomAccessor(vm, clientData->builtinNames().usernamePublicName(),
JSC::CustomGetterSetter::create(vm, DOMURL__username_get, DOMURL__username_set),
static_cast<unsigned>(JSC::PropertyAttribute::CustomValue));
putDirectCustomAccessor(vm, clientData->builtinNames().hrefPublicName(),
JSC::CustomGetterSetter::create(vm, DOMURL__href_get, DOMURL__href_set),
static_cast<unsigned>(JSC::PropertyAttribute::CustomValue));
putDirectCustomAccessor(vm, clientData->builtinNames().passwordPublicName(),
JSC::CustomGetterSetter::create(vm, DOMURL__password_get, DOMURL__password_set),
static_cast<unsigned>(JSC::PropertyAttribute::CustomValue));
putDirectCustomAccessor(vm, clientData->builtinNames().hostPublicName(),
JSC::CustomGetterSetter::create(vm, DOMURL__host_get, DOMURL__host_set),
static_cast<unsigned>(JSC::PropertyAttribute::CustomValue));
putDirectCustomAccessor(vm, clientData->builtinNames().hostnamePublicName(),
JSC::CustomGetterSetter::create(vm, DOMURL__hostname_get, DOMURL__hostname_set),
static_cast<unsigned>(JSC::PropertyAttribute::CustomValue));
putDirectCustomAccessor(vm, clientData->builtinNames().portPublicName(),
JSC::CustomGetterSetter::create(vm, DOMURL__port_get, DOMURL__port_set),
static_cast<unsigned>(JSC::PropertyAttribute::CustomValue));
putDirectCustomAccessor(vm, clientData->builtinNames().pathnamePublicName(),
JSC::CustomGetterSetter::create(vm, DOMURL__pathname_get, DOMURL__pathname_set),
static_cast<unsigned>(JSC::PropertyAttribute::CustomValue));
putDirectCustomAccessor(vm, clientData->builtinNames().hashPublicName(),
JSC::CustomGetterSetter::create(vm, DOMURL__hash_get, DOMURL__hash_set),
static_cast<unsigned>(JSC::PropertyAttribute::CustomValue));
putDirectCustomAccessor(vm, clientData->builtinNames().searchPublicName(),
JSC::CustomGetterSetter::create(vm, DOMURL__search_get, DOMURL__search_set),
static_cast<unsigned>(JSC::PropertyAttribute::CustomValue));
}
JSC::GCClient::IsoSubspace* JSDOMURL::subspaceForImpl(JSC::VM& vm)
{
return Bun::subspaceForImpl<JSDOMURL, UseCustomHeapCellType::No>(
vm,
// this is a placeholder
[](auto& spaces) { return spaces.m_clientSubspaceForExposedToWorkerAndWindow.get(); },
[](auto& spaces, auto&& space) { spaces.m_clientSubspaceForExposedToWorkerAndWindow = WTFMove(space); },
[](auto& spaces) { return spaces.m_subspaceForExposedToWorkerAndWindow.get(); },
[](auto& spaces, auto&& space) { spaces.m_subspaceForExposedToWorkerAndWindow = WTFMove(space); });
}
const ClassInfo JSDOMURL::s_info = { "JSDOMURL", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSDOMURL) };
}

View File

@@ -1,52 +0,0 @@
#pragma once
#include "BunBuiltinNames.h"
#include "BunClientData.h"
#include "DOMURL.h"
#include "JSDOMWrapper.h"
#include "root.h"
namespace WebCore {
using namespace WebCore;
using namespace JSC;
class JSDOMURL : public JSDOMWrapper<DOMURL> {
using Base = JSDOMWrapper<DOMURL>;
public:
JSDOMURL(JSC::Structure* structure, JSC::JSGlobalObject& global, DOMURL& domURL)
: Base(structure, global, domURL)
{
}
DECLARE_INFO;
static constexpr unsigned StructureFlags = Base::StructureFlags;
template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm)
{
if constexpr (mode == JSC::SubspaceAccess::Concurrently)
return nullptr;
return subspaceForImpl(vm);
}
static JSC::GCClient::IsoSubspace* subspaceForImpl(JSC::VM& vm);
static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject,
JSC::JSValue prototype)
{
return JSC::Structure::create(vm, globalObject, prototype,
JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
}
static JSDOMURL* create(JSC::Structure* structure, JSC::JSGlobalObject* global, Ref<DOMURL> domURL)
{
JSDOMURL* accessor = new (NotNull, JSC::allocateCell<JSDOMURL>(global->vm())) JSDOMURL(structure, *global, WTFMove(domURL));
accessor->finishCreation(global->vm());
return accessor;
}
void finishCreation(JSC::VM& vm);
};
} // namespace Zig

View File

@@ -33,7 +33,7 @@
// #include "JSDOMWindow.h"
// #include "JSRemoteDOMWindow.h"
// #include "SerializedScriptValue.h"
// #include <JavaScriptCore/Error.h>
// #include "JavaScriptCore/Error.h"
namespace WebCore {

View File

@@ -22,10 +22,11 @@
#pragma once
#include "root.h"
#include "NodeConstants.h"
#include "JSDOMGlobalObject.h"
#include "ZigGlobalObject.h"
#include <JavaScriptCore/JSDestructibleObject.h>
#include <wtf/SignedPtr.h>
#include "NodeConstants.h"
#include "JavaScriptCore/JSDestructibleObject.h"
#include "wtf/SignedPtr.h"
namespace WebCore {
using namespace Zig;

View File

@@ -0,0 +1,49 @@
/*
* Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
* Copyright (C) 2004-2011, 2013, 2016 Apple Inc. All rights reserved.
* Copyright (C) 2007 Samuel Weinig <sam@webkit.org>
* Copyright (C) 2013 Michael Pruett <michael@68k.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "root.h"
#include "JSDOMWrapperCache.h"
#include "JavaScriptCore/JSCInlines.h"
namespace WebCore {
using namespace JSC;
Structure* getCachedDOMStructure(const JSDOMGlobalObject& globalObject, const ClassInfo* classInfo)
{
return globalObject.structures().get(classInfo).get();
}
Structure* cacheDOMStructure(JSDOMGlobalObject& globalObject, Structure* structure, const ClassInfo* classInfo)
{
auto addToStructures = [](JSDOMStructureMap& structures, JSDOMGlobalObject& globalObject, Structure* structure, const ClassInfo* classInfo) {
ASSERT(!structures.contains(classInfo));
return structures.set(classInfo, WriteBarrier<Structure>(globalObject.vm(), &globalObject, structure)).iterator->value.get();
};
if (globalObject.vm().heap.mutatorShouldBeFenced()) {
Locker locker { globalObject.gcLock() };
return addToStructures(globalObject.structures(), globalObject, structure, classInfo);
}
return addToStructures(globalObject.structures(NoLockingNecessary), globalObject, structure, classInfo);
}
} // namespace WebCore

View File

@@ -0,0 +1,227 @@
/*
* Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
* Copyright (C) 2003-2006, 2008-2009, 2013, 2016 Apple Inc. All rights reserved.
* Copyright (C) 2007 Samuel Weinig <sam@webkit.org>
* Copyright (C) 2009 Google, Inc. All rights reserved.
* Copyright (C) 2012 Ericsson AB. All rights reserved.
* Copyright (C) 2013 Michael Pruett <michael@68k.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#pragma once
#include "DOMWrapperWorld.h"
#include "JSDOMGlobalObject.h"
#include "JSDOMWrapper.h"
#include "ScriptWrappable.h"
#include "ScriptWrappableInlines.h"
#include "WebCoreTypedArrayController.h"
#include "JavaScriptCore/JSArrayBuffer.h"
#include "JavaScriptCore/TypedArrayInlines.h"
#include "JavaScriptCore/Weak.h"
#include "JavaScriptCore/WeakInlines.h"
namespace WebCore {
WEBCORE_EXPORT JSC::Structure* getCachedDOMStructure(const JSDOMGlobalObject&, const JSC::ClassInfo*);
WEBCORE_EXPORT JSC::Structure* cacheDOMStructure(JSDOMGlobalObject&, JSC::Structure*, const JSC::ClassInfo*);
template<typename WrapperClass> JSC::Structure* getDOMStructure(JSC::VM&, JSDOMGlobalObject&);
template<typename WrapperClass> JSC::Structure* deprecatedGetDOMStructure(JSC::JSGlobalObject*);
template<typename WrapperClass> JSC::JSObject* getDOMPrototype(JSC::VM&, JSC::JSGlobalObject*);
JSC::WeakHandleOwner* wrapperOwner(DOMWrapperWorld&, JSC::ArrayBuffer*);
void* wrapperKey(JSC::ArrayBuffer*);
JSDOMObject* getInlineCachedWrapper(DOMWrapperWorld&, void*);
JSDOMObject* getInlineCachedWrapper(DOMWrapperWorld&, ScriptWrappable*);
JSC::JSArrayBuffer* getInlineCachedWrapper(DOMWrapperWorld&, JSC::ArrayBuffer*);
bool setInlineCachedWrapper(DOMWrapperWorld&, void*, JSDOMObject*, JSC::WeakHandleOwner*);
bool setInlineCachedWrapper(DOMWrapperWorld&, ScriptWrappable*, JSDOMObject* wrapper, JSC::WeakHandleOwner* wrapperOwner);
bool setInlineCachedWrapper(DOMWrapperWorld&, JSC::ArrayBuffer*, JSC::JSArrayBuffer* wrapper, JSC::WeakHandleOwner* wrapperOwner);
bool clearInlineCachedWrapper(DOMWrapperWorld&, void*, JSDOMObject*);
bool clearInlineCachedWrapper(DOMWrapperWorld&, ScriptWrappable*, JSDOMObject* wrapper);
bool clearInlineCachedWrapper(DOMWrapperWorld&, JSC::ArrayBuffer*, JSC::JSArrayBuffer* wrapper);
template<typename DOMClass> JSC::JSObject* getOrCreateWrapper(DOMWrapperWorld&, DOMClass&);
template<typename DOMClass> JSC::JSObject* getCachedWrapper(DOMWrapperWorld&, DOMClass&);
template<typename DOMClass> inline JSC::JSObject* getCachedWrapper(DOMWrapperWorld& world, Ref<DOMClass>& object) { return getCachedWrapper(world, object.get()); }
template<typename DOMClass, typename WrapperClass> void cacheWrapper(DOMWrapperWorld&, DOMClass*, WrapperClass*);
template<typename DOMClass, typename WrapperClass> void uncacheWrapper(DOMWrapperWorld&, DOMClass*, WrapperClass*);
template<typename DOMClass, typename T> auto createWrapper(JSDOMGlobalObject*, Ref<T>&&) -> typename std::enable_if<std::is_same<DOMClass, T>::value, typename JSDOMWrapperConverterTraits<DOMClass>::WrapperClass*>::type;
template<typename DOMClass, typename T> auto createWrapper(JSDOMGlobalObject*, Ref<T>&&) -> typename std::enable_if<!std::is_same<DOMClass, T>::value, typename JSDOMWrapperConverterTraits<DOMClass>::WrapperClass*>::type;
template<typename DOMClass> JSC::JSValue wrap(JSC::JSGlobalObject*, DOMWrapperWorld&, DOMClass&);
template<typename DOMClass> JSC::JSValue wrap(JSC::JSGlobalObject*, JSDOMGlobalObject*, DOMClass&);
// Inline functions and template definitions.
inline JSDOMGlobalObject* deprecatedGlobalObjectForPrototype(JSC::JSGlobalObject* lexicalGlobalObject)
{
// FIXME: Callers to this function should be using the global object
// from which the object is being created, instead of assuming the lexical one.
// e.g. subframe.document.body should use the subframe's global object, not the lexical one.
return JSC::jsCast<JSDOMGlobalObject*>(lexicalGlobalObject);
}
template<typename WrapperClass> inline JSC::Structure* getDOMStructure(JSC::VM& vm, JSDOMGlobalObject& globalObject)
{
if (JSC::Structure* structure = getCachedDOMStructure(globalObject, WrapperClass::info()))
return structure;
return cacheDOMStructure(globalObject, WrapperClass::createStructure(vm, &globalObject, WrapperClass::createPrototype(vm, globalObject)), WrapperClass::info());
}
template<typename WrapperClass> inline JSC::Structure* deprecatedGetDOMStructure(JSC::JSGlobalObject* lexicalGlobalObject)
{
// FIXME: This function is wrong. It uses the wrong global object for creating the prototype structure.
return getDOMStructure<WrapperClass>(JSC::getVM(lexicalGlobalObject), *deprecatedGlobalObjectForPrototype(lexicalGlobalObject));
}
template<typename WrapperClass> inline JSC::JSObject* getDOMPrototype(JSC::VM& vm, JSDOMGlobalObject& globalObject)
{
return JSC::jsCast<JSC::JSObject*>(asObject(getDOMStructure<WrapperClass>(vm, globalObject)->storedPrototype()));
}
inline JSC::WeakHandleOwner* wrapperOwner(DOMWrapperWorld& world, JSC::ArrayBuffer*)
{
return static_cast<WebCoreTypedArrayController*>(world.vm().m_typedArrayController.get())->wrapperOwner();
}
inline void* wrapperKey(JSC::ArrayBuffer* domObject)
{
return domObject;
}
inline JSDOMObject* getInlineCachedWrapper(DOMWrapperWorld&, void*) { return nullptr; }
inline bool setInlineCachedWrapper(DOMWrapperWorld&, void*, JSDOMObject*, JSC::WeakHandleOwner*) { return false; }
inline bool clearInlineCachedWrapper(DOMWrapperWorld&, void*, JSDOMObject*) { return false; }
inline JSDOMObject* getInlineCachedWrapper(DOMWrapperWorld& world, ScriptWrappable* domObject)
{
if (!world.isNormal())
return nullptr;
return domObject->wrapper();
}
inline JSC::JSArrayBuffer* getInlineCachedWrapper(DOMWrapperWorld& world, JSC::ArrayBuffer* buffer)
{
if (!world.isNormal())
return nullptr;
return buffer->m_wrapper.get();
}
inline bool setInlineCachedWrapper(DOMWrapperWorld& world, ScriptWrappable* domObject, JSDOMObject* wrapper, JSC::WeakHandleOwner* wrapperOwner)
{
if (!world.isNormal())
return false;
domObject->setWrapper(wrapper, wrapperOwner, &world);
return true;
}
inline bool setInlineCachedWrapper(DOMWrapperWorld& world, JSC::ArrayBuffer* domObject, JSC::JSArrayBuffer* wrapper, JSC::WeakHandleOwner* wrapperOwner)
{
if (!world.isNormal())
return false;
domObject->m_wrapper = JSC::Weak<JSC::JSArrayBuffer>(wrapper, wrapperOwner, &world);
return true;
}
inline bool clearInlineCachedWrapper(DOMWrapperWorld& world, ScriptWrappable* domObject, JSDOMObject* wrapper)
{
if (!world.isNormal())
return false;
domObject->clearWrapper(wrapper);
return true;
}
inline bool clearInlineCachedWrapper(DOMWrapperWorld& world, JSC::ArrayBuffer* domObject, JSC::JSArrayBuffer* wrapper)
{
if (!world.isNormal())
return false;
weakClear(domObject->m_wrapper, wrapper);
return true;
}
template<typename DOMClass> inline JSC::JSObject* getCachedWrapper(DOMWrapperWorld& world, DOMClass& domObject)
{
if (auto* wrapper = getInlineCachedWrapper(world, &domObject))
return wrapper;
return world.wrappers().get(wrapperKey(&domObject));
}
template<typename DOMClass, typename WrapperClass> inline void cacheWrapper(DOMWrapperWorld& world, DOMClass* domObject, WrapperClass* wrapper)
{
JSC::WeakHandleOwner* owner = wrapperOwner(world, domObject);
if (setInlineCachedWrapper(world, domObject, wrapper, owner))
return;
weakAdd(world.wrappers(), wrapperKey(domObject), JSC::Weak<JSC::JSObject>(wrapper, owner, &world));
}
template<typename DOMClass, typename WrapperClass> inline void uncacheWrapper(DOMWrapperWorld& world, DOMClass* domObject, WrapperClass* wrapper)
{
if (clearInlineCachedWrapper(world, domObject, wrapper))
return;
weakRemove(world.wrappers(), wrapperKey(domObject), wrapper);
}
template<typename DOMClass, typename T> inline auto createWrapper(JSDOMGlobalObject* globalObject, Ref<T>&& domObject) -> typename std::enable_if<std::is_same<DOMClass, T>::value, typename JSDOMWrapperConverterTraits<DOMClass>::WrapperClass*>::type
{
using WrapperClass = typename JSDOMWrapperConverterTraits<DOMClass>::WrapperClass;
ASSERT(!getCachedWrapper(globalObject->world(), domObject));
auto* domObjectPtr = domObject.ptr();
auto* wrapper = WrapperClass::create(getDOMStructure<WrapperClass>(globalObject->vm(), *globalObject), globalObject, WTFMove(domObject));
cacheWrapper(globalObject->world(), domObjectPtr, wrapper);
return wrapper;
}
template<typename DOMClass, typename T> inline auto createWrapper(JSDOMGlobalObject* globalObject, Ref<T>&& domObject) -> typename std::enable_if<!std::is_same<DOMClass, T>::value, typename JSDOMWrapperConverterTraits<DOMClass>::WrapperClass*>::type
{
return createWrapper<DOMClass>(globalObject, static_reference_cast<DOMClass>(WTFMove(domObject)));
}
template<typename DOMClass> inline JSC::JSValue wrap(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, DOMClass& domObject)
{
if (auto* wrapper = getCachedWrapper(globalObject->world(), domObject))
return wrapper;
return toJSNewlyCreated(lexicalGlobalObject, globalObject, Ref<DOMClass>(domObject));
}
template<typename DOMClass> inline void setSubclassStructureIfNeeded(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, JSC::JSObject* jsObject)
{
JSC::JSObject* newTarget = callFrame->newTarget().getObject();
JSC::JSObject* constructor = callFrame->jsCallee();
if (!newTarget || newTarget == constructor)
return;
using WrapperClass = typename JSDOMWrapperConverterTraits<DOMClass>::WrapperClass;
JSC::VM& vm = lexicalGlobalObject->vm();
auto scope = DECLARE_THROW_SCOPE(vm);
auto* functionGlobalObject = JSC::getFunctionRealm(lexicalGlobalObject, newTarget);
RETURN_IF_EXCEPTION(scope, void());
auto* newTargetGlobalObject = JSC::jsCast<JSDOMGlobalObject*>(functionGlobalObject);
auto* baseStructure = getDOMStructure<WrapperClass>(vm, *newTargetGlobalObject);
auto* subclassStructure = JSC::InternalFunction::createSubclassStructure(lexicalGlobalObject, newTarget, baseStructure);
RETURN_IF_EXCEPTION(scope, void());
jsObject->setStructure(vm, subclassStructure);
}
} // namespace WebCore

View File

@@ -1,8 +1,13 @@
#include "BunClientData.h"
#include "root.h"
#include <JavaScriptCore/JSFunction.h>
#include <JavaScriptCore/JSMicrotask.h>
#include <JavaScriptCore/ObjectConstructor.h>
#include "BunClientData.h"
#include "JavaScriptCore/JSCInlines.h"
#include "JavaScriptCore/JSFunction.h"
#include "JavaScriptCore/JSMicrotask.h"
#include "JavaScriptCore/ObjectConstructor.h"
#pragma mark - Node.js Path
@@ -36,7 +41,7 @@ namespace JSCastingHelpers = JSC::JSCastingHelpers;
arguments.uncheckedAppend(JSC::JSValue::encode(callFrame->uncheckedArgument(i))); \
} \
} \
auto clientData = Bun::clientData(vm); \
auto clientData = WebCore::clientData(vm); \
auto isWindows = thisObject->get(globalObject, clientData->builtinNames().isWindowsPrivateName()); \
JSC::JSValue result = JSC::JSValue::decode( \
ZigFunction(globalObject, isWindows.asBoolean(), reinterpret_cast<JSC__JSValue*>(arguments.data()), argCount) \
@@ -127,7 +132,7 @@ static JSC::JSObject* createPath(JSGlobalObject* globalThis, bool isWindows)
JSC::VM& vm = globalThis->vm();
JSC::Structure* plainObjectStructure = JSC::JSFinalObject::createStructure(vm, globalThis, globalThis->objectPrototype(), 0);
JSC::JSObject* path = JSC::JSFinalObject::create(vm, plainObjectStructure);
auto clientData = Bun::clientData(vm);
auto clientData = WebCore::clientData(vm);
path->putDirect(vm, clientData->builtinNames().isWindowsPrivateName(),
JSC::jsBoolean(isWindows), 0);

View File

@@ -1,6 +1,8 @@
#include "Process.h"
#include <JavaScriptCore/JSMicrotask.h>
#include <JavaScriptCore/ObjectConstructor.h>
#include "JavaScriptCore/JSMicrotask.h"
#include "JavaScriptCore/ObjectConstructor.h"
#include "JavaScriptCore/JSCInlines.h"
#pragma mark - Node.js Process
@@ -145,7 +147,7 @@ static JSC_DEFINE_HOST_FUNCTION(Process_functionChdir,
void Process::finishCreation(JSC::VM& vm)
{
Base::finishCreation(vm);
auto clientData = Bun::clientData(vm);
auto clientData = WebCore::clientData(vm);
putDirectCustomAccessor(vm, clientData->builtinNames().pidPublicName(),
JSC::CustomGetterSetter::create(vm, Process_getPID, nullptr),
@@ -223,7 +225,7 @@ void Process::finishCreation(JSC::VM& vm)
#endif
}
const JSC::ClassInfo Process::s_info = { "Process", &Base::s_info, nullptr, nullptr,
const JSC::ClassInfo Process::s_info = { "Process"_s, &Base::s_info, nullptr, nullptr,
CREATE_METHOD_TABLE(Process) };
JSC_DEFINE_CUSTOM_GETTER(Process_getTitle, (JSC::JSGlobalObject * globalObject, JSC::EncodedJSValue thisValue, JSC::PropertyName))
@@ -259,7 +261,7 @@ JSC_DEFINE_CUSTOM_GETTER(Process_getArgv, (JSC::JSGlobalObject * globalObject, J
if (!thisObject) {
return JSValue::encode(JSC::jsUndefined());
}
auto clientData = Bun::clientData(vm);
auto clientData = WebCore::clientData(vm);
if (JSC::JSValue argv = thisObject->getIfPropertyExists(
globalObject, clientData->builtinNames().argvPrivateName())) {
@@ -284,7 +286,7 @@ JSC_DEFINE_CUSTOM_SETTER(Process_setArgv,
return false;
}
auto clientData = Bun::clientData(vm);
auto clientData = WebCore::clientData(vm);
return thisObject->putDirect(vm, clientData->builtinNames().argvPrivateName(),
JSC::JSValue::decode(value));
@@ -305,7 +307,7 @@ JSC_DEFINE_CUSTOM_GETTER(Process_getVersionsLazy,
JSC::PropertyName))
{
JSC::VM& vm = globalObject->vm();
auto clientData = Bun::clientData(vm);
auto clientData = WebCore::clientData(vm);
Zig::Process* thisObject = JSC::jsDynamicCast<Zig::Process*>(vm, JSValue::decode(thisValue));
if (!thisObject) {
@@ -351,7 +353,7 @@ JSC_DEFINE_CUSTOM_SETTER(Process_setVersionsLazy,
{
JSC::VM& vm = globalObject->vm();
auto clientData = Bun::clientData(vm);
auto clientData = WebCore::clientData(vm);
Zig::Process* thisObject = JSC::jsDynamicCast<Zig::Process*>(vm, JSValue::decode(thisValue));
if (!thisObject) {

View File

@@ -1,8 +1,9 @@
#pragma once
#include "root.h"
#include "BunBuiltinNames.h"
#include "BunClientData.h"
#include "root.h"
namespace Zig {

View File

@@ -25,7 +25,7 @@
#pragma once
#include <wtf/text/WTFString.h>
#include "wtf/text/WTFString.h"
namespace WebCore {

View File

@@ -25,7 +25,7 @@
#include "URLDecomposition.h"
#include <wtf/text/StringToIntegerConversion.h>
#include "wtf/text/StringToIntegerConversion.h"
namespace WebCore {

View File

@@ -27,9 +27,9 @@
#include "root.h"
#include <wtf/URL.h>
#include "wtf/URL.h"
#include <wtf/Forward.h>
#include "wtf/Forward.h"
namespace WebCore {

View File

@@ -25,7 +25,7 @@
#include "URLSearchParams.h"
#include "DOMURL.h"
#include <wtf/URLParser.h>
#include "wtf/URLParser.h"
namespace WebCore {

View File

@@ -26,10 +26,10 @@
#include "root.h"
#include "ExceptionOr.h"
#include "wtf/Vector.h"
#include "wtf/WeakPtr.h"
#include "wtf/text/WTFString.h"
#include <variant>
#include <wtf/Vector.h>
#include <wtf/WeakPtr.h>
#include <wtf/text/WTFString.h>
namespace WebCore {

View File

@@ -1,13 +1,14 @@
#include "helpers.h"
#include "JavaScriptCore/ConsoleClient.h"
#include "JavaScriptCore/ConsoleMessage.h"
#include "JavaScriptCore/JSString.h"
#include "JavaScriptCore/ScriptArguments.h"
#include "ZigConsoleClient.h"
#include <JavaScriptCore/ConsoleClient.h>
#include <JavaScriptCore/ConsoleMessage.h>
#include <JavaScriptCore/JSString.h>
#include <JavaScriptCore/ScriptArguments.h>
#include <wtf/text/WTFString.h>
#include "wtf/text/WTFString.h"
#include "GCDefferalContext.h"
#include "JavaScriptCore/JSCInlines.h"
using ScriptArguments = Inspector::ScriptArguments;
using MessageType = JSC::MessageType;

View File

@@ -1,8 +1,8 @@
#pragma once
#include <JavaScriptCore/ConsoleClient.h>
#include <wtf/Vector.h>
#include <wtf/text/WTFString.h>
#include "JavaScriptCore/ConsoleClient.h"
#include "wtf/Vector.h"
#include "wtf/text/WTFString.h"
namespace Inspector {
class InspectorConsoleAgent;

View File

@@ -1,81 +1,86 @@
#include "ZigGlobalObject.h"
#include "helpers.h"
#include "JavaScriptCore/AggregateError.h"
#include "JavaScriptCore/BytecodeIndex.h"
#include "JavaScriptCore/CallFrameInlines.h"
#include "JavaScriptCore/ClassInfo.h"
#include "JavaScriptCore/CodeBlock.h"
#include "JavaScriptCore/CodeCache.h"
#include "JavaScriptCore/Completion.h"
#include "JavaScriptCore/Error.h"
#include "JavaScriptCore/ErrorInstance.h"
#include "JavaScriptCore/Exception.h"
#include "JavaScriptCore/ExceptionScope.h"
#include "JavaScriptCore/FunctionConstructor.h"
#include "JavaScriptCore/HashMapImpl.h"
#include "JavaScriptCore/HashMapImplInlines.h"
#include "JavaScriptCore/Heap.h"
#include "JavaScriptCore/Identifier.h"
#include "JavaScriptCore/InitializeThreading.h"
#include "JavaScriptCore/IteratorOperations.h"
#include "JavaScriptCore/JSArray.h"
#include "JavaScriptCore/JSCInlines.h"
#include "JavaScriptCore/JSCallbackConstructor.h"
#include "JavaScriptCore/JSCallbackObject.h"
#include "JavaScriptCore/JSCast.h"
#include "JavaScriptCore/JSClassRef.h"
#include "JavaScriptCore/JSMicrotask.h"
#include "ZigConsoleClient.h"
#include <JavaScriptCore/AggregateError.h>
#include <JavaScriptCore/BytecodeIndex.h>
#include <JavaScriptCore/CallFrameInlines.h>
#include <JavaScriptCore/ClassInfo.h>
#include <JavaScriptCore/CodeBlock.h>
#include <JavaScriptCore/CodeCache.h>
#include <JavaScriptCore/Completion.h>
#include <JavaScriptCore/Error.h>
#include <JavaScriptCore/ErrorInstance.h>
#include <JavaScriptCore/Exception.h>
#include <JavaScriptCore/ExceptionScope.h>
#include <JavaScriptCore/FunctionConstructor.h>
#include <JavaScriptCore/HashMapImpl.h>
#include <JavaScriptCore/HashMapImplInlines.h>
#include <JavaScriptCore/Heap.h>
#include <JavaScriptCore/Identifier.h>
#include <JavaScriptCore/InitializeThreading.h>
#include <JavaScriptCore/IteratorOperations.h>
#include <JavaScriptCore/JSArray.h>
#include <JavaScriptCore/JSCInlines.h>
#include <JavaScriptCore/JSCallbackConstructor.h>
#include <JavaScriptCore/JSCallbackObject.h>
#include <JavaScriptCore/JSCast.h>
#include <JavaScriptCore/JSClassRef.h>
#include <JavaScriptCore/JSMicrotask.h>
// #include <JavaScriptCore/JSContextInternal.h>
#include <JavaScriptCore/CatchScope.h>
#include <JavaScriptCore/DeferredWorkTimer.h>
#include <JavaScriptCore/JSInternalPromise.h>
#include <JavaScriptCore/JSLock.h>
#include <JavaScriptCore/JSMap.h>
#include <JavaScriptCore/JSModuleLoader.h>
#include <JavaScriptCore/JSModuleRecord.h>
#include <JavaScriptCore/JSNativeStdFunction.h>
#include <JavaScriptCore/JSObject.h>
#include <JavaScriptCore/JSPromise.h>
#include <JavaScriptCore/JSSet.h>
#include <JavaScriptCore/JSSourceCode.h>
#include <JavaScriptCore/JSString.h>
#include <JavaScriptCore/JSValueInternal.h>
#include <JavaScriptCore/JSVirtualMachineInternal.h>
#include <JavaScriptCore/ObjectConstructor.h>
#include <JavaScriptCore/OptionsList.h>
#include <JavaScriptCore/ParserError.h>
#include <JavaScriptCore/ScriptExecutable.h>
#include <JavaScriptCore/SourceOrigin.h>
#include <JavaScriptCore/StackFrame.h>
#include <JavaScriptCore/StackVisitor.h>
#include <JavaScriptCore/VM.h>
#include <JavaScriptCore/VMEntryScope.h>
#include <JavaScriptCore/WasmFaultSignalHandler.h>
// #include "JavaScriptCore/JSContextInternal.h"
#include "JavaScriptCore/CatchScope.h"
#include "JavaScriptCore/DeferredWorkTimer.h"
#include "JavaScriptCore/JSInternalPromise.h"
#include "JavaScriptCore/JSLock.h"
#include "JavaScriptCore/JSMap.h"
#include "JavaScriptCore/JSModuleLoader.h"
#include "JavaScriptCore/JSModuleRecord.h"
#include "JavaScriptCore/JSNativeStdFunction.h"
#include "JavaScriptCore/JSObject.h"
#include "JavaScriptCore/JSPromise.h"
#include "JavaScriptCore/JSSet.h"
#include "JavaScriptCore/JSSourceCode.h"
#include "JavaScriptCore/JSString.h"
#include "JavaScriptCore/JSValueInternal.h"
#include "JavaScriptCore/JSVirtualMachineInternal.h"
#include "JavaScriptCore/ObjectConstructor.h"
#include "JavaScriptCore/OptionsList.h"
#include "JavaScriptCore/ParserError.h"
#include "JavaScriptCore/ScriptExecutable.h"
#include "JavaScriptCore/SourceOrigin.h"
#include "JavaScriptCore/StackFrame.h"
#include "JavaScriptCore/StackVisitor.h"
#include "JavaScriptCore/VM.h"
#include "JavaScriptCore/VMEntryScope.h"
#include "JavaScriptCore/WasmFaultSignalHandler.h"
#include "wtf/Gigacage.h"
#include "wtf/StdLibExtras.h"
#include "wtf/URL.h"
#include "wtf/text/ExternalStringImpl.h"
#include "wtf/text/StringCommon.h"
#include "wtf/text/StringImpl.h"
#include "wtf/text/StringView.h"
#include "wtf/text/WTFString.h"
#include <unistd.h>
#include <wtf/Gigacage.h>
#include <wtf/StdLibExtras.h>
#include <wtf/URL.h>
#include <wtf/text/ExternalStringImpl.h>
#include <wtf/text/StringCommon.h>
#include <wtf/text/StringImpl.h>
#include <wtf/text/StringView.h>
#include <wtf/text/WTFString.h>
#include "wtf/text/Base64.h"
#include <cstdlib>
#include <exception>
#include <iostream>
#include <wtf/text/Base64.h>
// #include <JavaScriptCore/CachedType.h>
#include <JavaScriptCore/JSCallbackObject.h>
#include <JavaScriptCore/JSClassRef.h>
// #include "JavaScriptCore/CachedType.h"
#include "JavaScriptCore/JSCallbackObject.h"
#include "JavaScriptCore/JSClassRef.h"
#include "BunClientData.h"
#include "ZigSourceProvider.h"
#include "JSDOMURL.h"
#include "JSURLSearchParams.h"
#include "Process.h"
using JSGlobalObject = JSC::JSGlobalObject;
using Exception = JSC::Exception;
@@ -125,18 +130,19 @@ extern "C" JSC__JSGlobalObject* Zig__GlobalObject__create(JSClassRef* globalObje
auto heapSize = JSC::HeapType::Large;
JSC::VM& vm = JSC::VM::create(heapSize).leakRef();
Bun::JSVMClientData::create(&vm);
WebCore::JSVMClientData::create(&vm);
vm.heap.acquireAccess();
JSC::Wasm::enableFastMemory();
JSC::JSLockHolder locker(vm);
Zig::GlobalObject* globalObject = Zig::GlobalObject::create(vm, Zig::GlobalObject::createStructure(vm, JSC::jsNull()));
Zig::GlobalObject* globalObject = Zig::GlobalObject::create(vm, Zig::GlobalObject::createStructure(vm, JSC::JSGlobalObject::create(vm, JSC::JSGlobalObject::createStructure(vm, JSC::jsNull())), JSC::jsNull()));
globalObject->setConsole(globalObject);
if (count > 0) {
globalObject->installAPIGlobals(globalObjectClass, count);
globalObject->installAPIGlobals(globalObjectClass, count, vm);
}
JSC::gcProtect(globalObject);
@@ -206,7 +212,9 @@ extern "C" bool Zig__GlobalObject__resetModuleRegistryMap(JSC__JSGlobalObject* g
namespace Zig {
const JSC::ClassInfo GlobalObject::s_info = { "GlobalObject", &Base::s_info, nullptr, nullptr,
using namespace WebCore;
const JSC::ClassInfo GlobalObject::s_info = { "GlobalObject"_s, &Base::s_info, nullptr, nullptr,
CREATE_METHOD_TABLE(GlobalObject) };
extern "C" JSClassRef* Zig__getAPIGlobals(size_t* count);
@@ -215,14 +223,14 @@ extern "C" const JSC__JSValue* Zig__getAPIConstructors(size_t* count, JSC__JSGlo
static JSGlobalObject* deriveShadowRealmGlobalObject(JSGlobalObject* globalObject)
{
auto& vm = globalObject->vm();
Zig::GlobalObject* shadow = Zig::GlobalObject::create(vm, Zig::GlobalObject::createStructure(vm, JSC::jsNull()));
Zig::GlobalObject* shadow = Zig::GlobalObject::create(vm, Zig::GlobalObject::createStructure(vm, JSC::JSGlobalObject::create(vm, JSC::JSGlobalObject::createStructure(vm, JSC::jsNull())), JSC::jsNull()));
shadow->setConsole(shadow);
size_t count = 0;
JSClassRef* globalObjectClass = Zig__getAPIGlobals(&count);
shadow->setConsole(shadow);
if (count > 0) {
shadow->installAPIGlobals(globalObjectClass, count);
shadow->installAPIGlobals(globalObjectClass, count, vm);
}
return shadow;
@@ -269,7 +277,7 @@ const JSC::GlobalObjectMethodTable GlobalObject::s_globalObjectMethodTable = {
};
void GlobalObject::reportUncaughtExceptionAtEventLoop(JSGlobalObject* globalObject,
Exception* exception)
JSC::Exception* exception)
{
Zig__GlobalObject__reportUncaughtException(globalObject, exception);
}
@@ -291,6 +299,28 @@ void GlobalObject::setConsole(void* console)
#pragma mark - Globals
JSC_DECLARE_CUSTOM_GETTER(JSDOMURL_getter);
JSC_DEFINE_CUSTOM_GETTER(JSDOMURL_getter,
(JSC::JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue,
JSC::PropertyName))
{
Zig::GlobalObject* thisObject = JSC::jsCast<Zig::GlobalObject*>(lexicalGlobalObject);
return JSC::JSValue::encode(
WebCore::JSDOMURL::getConstructor(JSC::getVM(lexicalGlobalObject), thisObject));
}
JSC_DECLARE_CUSTOM_GETTER(JSURLSearchParams_getter);
JSC_DEFINE_CUSTOM_GETTER(JSURLSearchParams_getter,
(JSC::JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue,
JSC::PropertyName))
{
Zig::GlobalObject* thisObject = JSC::jsCast<Zig::GlobalObject*>(lexicalGlobalObject);
return JSC::JSValue::encode(
WebCore::JSURLSearchParams::getConstructor(JSC::getVM(lexicalGlobalObject), thisObject));
}
static JSC_DECLARE_CUSTOM_SETTER(property_lazyProcessSetter);
static JSC_DECLARE_CUSTOM_GETTER(property_lazyProcessGetter);
@@ -309,7 +339,7 @@ JSC_DEFINE_CUSTOM_GETTER(property_lazyProcessGetter,
Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(_globalObject);
JSC::VM& vm = globalObject->vm();
auto clientData = Bun::clientData(vm);
auto clientData = WebCore::clientData(vm);
JSC::JSValue processPrivate = globalObject->getIfPropertyExists(globalObject, clientData->builtinNames().processPrivateName());
if (LIKELY(processPrivate)) {
return JSC::JSValue::encode(processPrivate);
@@ -561,7 +591,7 @@ static JSC_DEFINE_HOST_FUNCTION(functionImportMeta__resolve,
return JSC::JSValue::encode(JSC::JSValue {});
}
auto clientData = Bun::clientData(vm);
auto clientData = WebCore::clientData(vm);
from = JSC::JSValue::encode(thisObject->get(globalObject, clientData->builtinNames().urlPublicName()));
}
@@ -592,19 +622,19 @@ static JSC_DEFINE_HOST_FUNCTION(functionReportError,
// This is not a publicly exposed API currently.
// This is used by the bundler to make Response, Request, FetchEvent,
// and any other objects available globally.
void GlobalObject::installAPIGlobals(JSClassRef* globals, int count)
void GlobalObject::installAPIGlobals(JSClassRef* globals, int count, JSC::VM& vm)
{
auto clientData = Bun::clientData(vm());
auto clientData = WebCore::clientData(vm);
size_t constructor_count = 0;
JSC__JSValue const* constructors = Zig__getAPIConstructors(&constructor_count, this);
WTF::Vector<GlobalPropertyInfo> extraStaticGlobals;
extraStaticGlobals.reserveCapacity((size_t)count + constructor_count + 3 + 10);
int i = 0;
for (; i < constructor_count; i++) {
auto* object = JSC::jsDynamicCast<JSC::JSCallbackConstructor*>(vm(), JSC::JSValue::decode(constructors[i]).asCell()->getObject());
auto* object = JSC::jsDynamicCast<JSC::JSCallbackConstructor*>(vm, JSC::JSValue::decode(constructors[i]).asCell()->getObject());
extraStaticGlobals.uncheckedAppend(
GlobalPropertyInfo { JSC::Identifier::fromString(vm(), object->get(this, vm().propertyNames->name).toWTFString(this)),
GlobalPropertyInfo { JSC::Identifier::fromString(vm, object->get(this, vm.propertyNames->name).toWTFString(this)),
JSC::JSValue(object), JSC::PropertyAttribute::DontDelete | 0 });
}
int j = 0;
@@ -614,10 +644,10 @@ void GlobalObject::installAPIGlobals(JSClassRef* globals, int count)
JSC::JSCallbackObject<JSNonFinalObject>* object = JSC::JSCallbackObject<JSNonFinalObject>::create(this, this->callbackObjectStructure(),
jsClass, nullptr);
if (JSObject* prototype = object->classRef()->prototype(this))
object->setPrototypeDirect(vm(), prototype);
object->setPrototypeDirect(vm, prototype);
extraStaticGlobals.uncheckedAppend(
GlobalPropertyInfo { JSC::Identifier::fromString(vm(), jsClass->className()),
GlobalPropertyInfo { JSC::Identifier::fromString(vm, jsClass->className()),
JSC::JSValue(object), JSC::PropertyAttribute::DontDelete | 0 });
}
@@ -633,85 +663,143 @@ void GlobalObject::installAPIGlobals(JSClassRef* globals, int count)
// JSC::JSCallbackObject<JSNonFinalObject> *object =
// JSC::JSCallbackObject<JSNonFinalObject>::create(this, this->callbackObjectStructure(),
// jsClass, nullptr);
// if (JSObject *prototype = jsClass->prototype(this)) object->setPrototypeDirect(vm(),
// if (JSObject *prototype = jsClass->prototype(this)) object->setPrototypeDirect(vm,
// prototype);
// process->putDirect(this->vm(), JSC::Identifier::fromString(this->vm(), "env"),
// process->putDirect(this->vm, JSC::Identifier::fromString(this->vm, "env"),
// JSC::JSValue(object), JSC::PropertyAttribute::DontDelete | 0);
// }
JSC::Identifier queueMicrotaskIdentifier = JSC::Identifier::fromString(vm(), "queueMicrotask"_s);
JSC::Identifier queueMicrotaskIdentifier = JSC::Identifier::fromString(vm, "queueMicrotask"_s);
extraStaticGlobals.uncheckedAppend(
GlobalPropertyInfo { queueMicrotaskIdentifier,
JSC::JSFunction::create(vm(), JSC::jsCast<JSC::JSGlobalObject*>(this), 0,
JSC::JSFunction::create(vm, JSC::jsCast<JSC::JSGlobalObject*>(globalObject()), 0,
"queueMicrotask", functionQueueMicrotask),
JSC::PropertyAttribute::DontDelete | 0 });
JSC::Identifier setTimeoutIdentifier = JSC::Identifier::fromString(vm(), "setTimeout"_s);
JSC::Identifier setTimeoutIdentifier = JSC::Identifier::fromString(vm, "setTimeout"_s);
extraStaticGlobals.uncheckedAppend(
GlobalPropertyInfo { setTimeoutIdentifier,
JSC::JSFunction::create(vm(), JSC::jsCast<JSC::JSGlobalObject*>(this), 0,
JSC::JSFunction::create(vm, JSC::jsCast<JSC::JSGlobalObject*>(globalObject()), 0,
"setTimeout", functionSetTimeout),
JSC::PropertyAttribute::DontDelete | 0 });
JSC::Identifier clearTimeoutIdentifier = JSC::Identifier::fromString(vm(), "clearTimeout"_s);
JSC::Identifier clearTimeoutIdentifier = JSC::Identifier::fromString(vm, "clearTimeout"_s);
extraStaticGlobals.uncheckedAppend(
GlobalPropertyInfo { clearTimeoutIdentifier,
JSC::JSFunction::create(vm(), JSC::jsCast<JSC::JSGlobalObject*>(this), 0,
JSC::JSFunction::create(vm, JSC::jsCast<JSC::JSGlobalObject*>(globalObject()), 0,
"clearTimeout", functionClearTimeout),
JSC::PropertyAttribute::DontDelete | 0 });
JSC::Identifier setIntervalIdentifier = JSC::Identifier::fromString(vm(), "setInterval"_s);
JSC::Identifier setIntervalIdentifier = JSC::Identifier::fromString(vm, "setInterval"_s);
extraStaticGlobals.uncheckedAppend(
GlobalPropertyInfo { setIntervalIdentifier,
JSC::JSFunction::create(vm(), JSC::jsCast<JSC::JSGlobalObject*>(this), 0,
JSC::JSFunction::create(vm, JSC::jsCast<JSC::JSGlobalObject*>(globalObject()), 0,
"setInterval", functionSetInterval),
JSC::PropertyAttribute::DontDelete | 0 });
JSC::Identifier clearIntervalIdentifier = JSC::Identifier::fromString(vm(), "clearInterval"_s);
JSC::Identifier clearIntervalIdentifier = JSC::Identifier::fromString(vm, "clearInterval"_s);
extraStaticGlobals.uncheckedAppend(
GlobalPropertyInfo { clearIntervalIdentifier,
JSC::JSFunction::create(vm(), JSC::jsCast<JSC::JSGlobalObject*>(this), 0,
JSC::JSFunction::create(vm, JSC::jsCast<JSC::JSGlobalObject*>(globalObject()), 0,
"clearInterval", functionClearInterval),
JSC::PropertyAttribute::DontDelete | 0 });
JSC::Identifier atobIdentifier = JSC::Identifier::fromString(vm(), "atob"_s);
JSC::Identifier atobIdentifier = JSC::Identifier::fromString(vm, "atob"_s);
extraStaticGlobals.uncheckedAppend(
GlobalPropertyInfo { atobIdentifier,
JSC::JSFunction::create(vm(), JSC::jsCast<JSC::JSGlobalObject*>(this), 0,
JSC::JSFunction::create(vm, JSC::jsCast<JSC::JSGlobalObject*>(globalObject()), 0,
"atob", functionATOB),
JSC::PropertyAttribute::DontDelete | 0 });
JSC::Identifier btoaIdentifier = JSC::Identifier::fromString(vm(), "btoa"_s);
JSC::Identifier btoaIdentifier = JSC::Identifier::fromString(vm, "btoa"_s);
extraStaticGlobals.uncheckedAppend(
GlobalPropertyInfo { btoaIdentifier,
JSC::JSFunction::create(vm(), JSC::jsCast<JSC::JSGlobalObject*>(this), 0,
JSC::JSFunction::create(vm, JSC::jsCast<JSC::JSGlobalObject*>(globalObject()), 0,
"btoa", functionBTOA),
JSC::PropertyAttribute::DontDelete | 0 });
JSC::Identifier reportErrorIdentifier = JSC::Identifier::fromString(vm(), "reportError"_s);
JSC::Identifier reportErrorIdentifier = JSC::Identifier::fromString(vm, "reportError"_s);
extraStaticGlobals.uncheckedAppend(
GlobalPropertyInfo { reportErrorIdentifier,
JSC::JSFunction::create(vm(), JSC::jsCast<JSC::JSGlobalObject*>(this), 0,
JSC::JSFunction::create(vm, JSC::jsCast<JSC::JSGlobalObject*>(globalObject()), 0,
"reportError", functionReportError),
JSC::PropertyAttribute::DontDelete | 0 });
JSC::Identifier URLConstructor = JSC::Identifier::fromString(vm, "URL"_s);
extraStaticGlobals.uncheckedAppend(
GlobalPropertyInfo { reportErrorIdentifier,
JSC::JSFunction::create(vm, JSC::jsCast<JSC::JSGlobalObject*>(globalObject()), 0,
"reportError", functionReportError),
JSC::PropertyAttribute::DontDelete | 0 });
this->addStaticGlobals(extraStaticGlobals.data(), extraStaticGlobals.size());
putDirectCustomAccessor(
vm(), clientData->builtinNames().processPublicName(),
JSC::CustomGetterSetter::create(vm(), property_lazyProcessGetter, property_lazyProcessSetter),
PropertyAttribute::DontDelete | JSC::PropertyAttribute::CustomAccessor | 0);
auto domURL = WebCore::DOMURL::create("https://example.com/"_s, WTF::String());
auto url = WebCore::JSDOMURL::create(
WebCore::JSDOMURL::createStructure(vm(), this, objectPrototype()),
this,
domURL.returnValue().get());
putDirectCustomAccessor(vm, JSC::Identifier::fromString(vm, "URL"), JSC::CustomGetterSetter::create(vm, JSDOMURL_getter, nullptr),
JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly);
this->putDirect(vm(), clientData->builtinNames().urlPublicName(), JSC::JSValue(url), JSC::PropertyAttribute::DontDelete | 0);
putDirectCustomAccessor(vm, JSC::Identifier::fromString(vm, "URLSearchParams"), JSC::CustomGetterSetter::create(vm, JSURLSearchParams_getter, nullptr),
JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly);
extraStaticGlobals.releaseBuffer();
}
template<typename Visitor>
void GlobalObject::visitChildrenImpl(JSCell* cell, Visitor& visitor)
{
GlobalObject* thisObject = jsCast<GlobalObject*>(cell);
ASSERT_GC_OBJECT_INHERITS(thisObject, info());
Base::visitChildren(thisObject, visitor);
{
// The GC thread has to grab the GC lock even though it is not mutating the containers.
Locker locker { thisObject->m_gcLock };
for (auto& structure : thisObject->m_structures.values())
visitor.append(structure);
// for (auto& guarded : thisObject->m_guardedObjects)
// guarded->visitAggregate(visitor);
}
for (auto& constructor : thisObject->constructors().array())
visitor.append(constructor);
// thisObject->m_builtinInternalFunctions.visit(visitor);
}
DEFINE_VISIT_CHILDREN(GlobalObject);
// void GlobalObject::destroy(JSCell* cell)
// {
// static_cast<Zig::GlobalObject*>(cell)->Zig::GlobalObject::~Zig::GlobalObject();
// }
// template<typename Visitor>
// void GlobalObject::visitChildrenImpl(JSCell* cell, Visitor& visitor)
// {
// Zig::GlobalObject* thisObject = jsCast<Zig::GlobalObject*>(cell);
// ASSERT_GC_OBJECT_INHERITS(thisObject, info());
// Base::visitChildren(thisObject, visitor);
// {
// // The GC thread has to grab the GC lock even though it is not mutating the containers.
// Locker locker { thisObject->m_gcLock };
// for (auto& structure : thisObject->m_structures.values())
// visitor.append(structure);
// for (auto& guarded : thisObject->m_guardedObjects)
// guarded->visitAggregate(visitor);
// }
// for (auto& constructor : thisObject->constructors().array())
// visitor.append(constructor);
// thisObject->m_builtinInternalFunctions.visit(visitor);
// }
// DEFINE_VISIT_CHILDREN(Zig::GlobalObject);
JSC::Identifier GlobalObject::moduleLoaderResolve(JSGlobalObject* globalObject,
JSModuleLoader* loader, JSValue key,
JSValue referrer, JSValue origin)
@@ -835,7 +923,7 @@ JSC::JSObject* GlobalObject::moduleLoaderCreateImportMetaProperties(JSGlobalObje
JSC::JSObject* metaProperties = JSC::constructEmptyObject(vm, globalObject->nullPrototypeObjectStructure());
RETURN_IF_EXCEPTION(scope, nullptr);
auto clientData = Bun::clientData(vm);
auto clientData = WebCore::clientData(vm);
JSString* keyString = key.toStringOrNull(globalObject);
if (UNLIKELY(!keyString)) {
return metaProperties;

View File

@@ -1,51 +1,98 @@
#include "root.h"
#pragma once
#include "headers-handwritten.h"
namespace JSC {
class Structure;
class Identifier;
} // namespace JSC
#include "Process.h"
#include "root.h"
#include "headers-handwritten.h"
#include "BunClientData.h"
#include "JavaScriptCore/CatchScope.h"
#include "JavaScriptCore/JSGlobalObject.h"
#include "JavaScriptCore/JSTypeInfo.h"
#include "JavaScriptCore/Structure.h"
#include "ZigConsoleClient.h"
#include <JavaScriptCore/CatchScope.h>
#include <JavaScriptCore/JSGlobalObject.h>
#include <JavaScriptCore/JSTypeInfo.h>
#include <JavaScriptCore/Structure.h>
#include "DOMConstructors.h"
#include "DOMWrapperWorld-class.h"
#include "DOMIsoSubspaces.h"
namespace Zig {
using JSDOMStructureMap = HashMap<const JSC::ClassInfo*, JSC::WriteBarrier<JSC::Structure>>;
class GlobalObject : public JSC::JSGlobalObject {
using Base = JSC::JSGlobalObject;
public:
DECLARE_EXPORT_INFO;
static const JSC::ClassInfo s_info;
static const JSC::GlobalObjectMethodTable s_globalObjectMethodTable;
Zig::Process* m_process;
static constexpr bool needsDestruction = true;
template<typename CellType, JSC::SubspaceAccess mode>
static GCClient::IsoSubspace* subspaceFor(VM& vm)
static constexpr bool needsDestruction = false;
template<typename, SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm)
{
return vm.globalObjectSpace<mode>();
if constexpr (mode == JSC::SubspaceAccess::Concurrently)
return nullptr;
return WebCore::subspaceForImpl<GlobalObject, WebCore::UseCustomHeapCellType::No>(
vm,
[](auto& spaces) { return spaces.m_clientSubspaceForGlobalObject.get(); },
[](auto& spaces, auto&& space) { spaces.m_clientSubspaceForGlobalObject = WTFMove(space); },
[](auto& spaces) { return spaces.m_subspaceForGlobalObject.get(); },
[](auto& spaces, auto&& space) { spaces.m_subspaceForGlobalObject = WTFMove(space); });
}
~GlobalObject();
static constexpr const JSC::ClassInfo* info() { return &s_info; }
static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* global, JSC::JSValue prototype)
{
return JSC::Structure::create(vm, global, prototype, JSC::TypeInfo(JSC::GlobalObjectType, StructureFlags), info());
}
// Make binding code generation easier.
GlobalObject* globalObject() { return this; }
static GlobalObject* create(JSC::VM& vm, JSC::Structure* structure)
{
auto* object = new (NotNull, JSC::allocateCell<GlobalObject>(vm)) GlobalObject(vm, structure);
object->finishCreation(vm);
return object;
GlobalObject* ptr = new (NotNull, JSC::allocateCell<GlobalObject>(vm)) GlobalObject(vm, structure);
ptr->finishCreation(vm);
return ptr;
}
static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSValue prototype)
const JSDOMStructureMap& structures() const WTF_IGNORES_THREAD_SAFETY_ANALYSIS
{
auto* result = JSC::Structure::create(
vm, nullptr, prototype, JSC::TypeInfo(JSC::GlobalObjectType, Base::StructureFlags), info());
result->setTransitionWatchpointIsLikelyToBeFired(true);
return result;
ASSERT(!Thread::mayBeGCThread());
return m_structures;
}
const WebCore::DOMConstructors& constructors() const
{
ASSERT(!Thread::mayBeGCThread());
return *m_constructors;
}
WebCore::DOMWrapperWorld& world() { return m_world.get(); }
DECLARE_VISIT_CHILDREN;
bool worldIsNormal() const { return m_worldIsNormal; }
static ptrdiff_t offsetOfWorldIsNormal() { return OBJECT_OFFSETOF(GlobalObject, m_worldIsNormal); }
JSDOMStructureMap& structures() WTF_REQUIRES_LOCK(m_gcLock) { return m_structures; }
JSDOMStructureMap& structures(NoLockingNecessaryTag) WTF_IGNORES_THREAD_SAFETY_ANALYSIS
{
ASSERT(!vm().heap.mutatorShouldBeFenced());
return m_structures;
}
WebCore::DOMConstructors& constructors() { return *m_constructors; }
Lock& gcLock() WTF_RETURNS_LOCK(m_gcLock) { return m_gcLock; }
static void reportUncaughtExceptionAtEventLoop(JSGlobalObject*, JSC::Exception*);
static JSGlobalObject* deriveShadowRealmGlobalObject(JSGlobalObject* globalObject);
@@ -67,13 +114,24 @@ public:
static void promiseRejectionTracker(JSGlobalObject*, JSC::JSPromise*,
JSC::JSPromiseRejectionOperation);
void setConsole(void* console);
void installAPIGlobals(JSClassRef* globals, int count);
void installAPIGlobals(JSClassRef* globals, int count, JSC::VM& vm);
private:
GlobalObject(JSC::VM& vm, JSC::Structure* structure)
: JSC::JSGlobalObject(vm, structure, &s_globalObjectMethodTable)
, m_constructors(makeUnique<WebCore::DOMConstructors>())
, m_world(WebCore::DOMWrapperWorld::create(vm, WebCore::DOMWrapperWorld::Type::Normal))
, m_worldIsNormal(true)
{
}
private:
std::unique_ptr<WebCore::DOMConstructors> m_constructors;
uint8_t m_worldIsNormal;
JSDOMStructureMap m_structures WTF_GUARDED_BY_LOCK(m_gcLock);
Lock m_gcLock;
Ref<WebCore::DOMWrapperWorld> m_world;
};
class JSMicrotaskCallback : public RefCounted<JSMicrotaskCallback> {
@@ -105,3 +163,11 @@ private:
};
} // namespace Zig
namespace WebCore {
using JSDOMGlobalObject = Zig::GlobalObject;
}
namespace WebCore {
using JSDOMGlobalObject = Zig::GlobalObject;
}

View File

@@ -1,13 +1,16 @@
#include "ZigSourceProvider.h"
#include "helpers.h"
#include "root.h"
#include <JavaScriptCore/BytecodeCacheError.h>
#include <JavaScriptCore/CodeCache.h>
#include <JavaScriptCore/Completion.h>
#include "helpers.h"
#include "ZigSourceProvider.h"
#include "JavaScriptCore/BytecodeCacheError.h"
#include "JavaScriptCore/CodeCache.h"
#include "JavaScriptCore/Completion.h"
#include "wtf/Scope.h"
#include "wtf/text/StringHash.h"
#include <sys/stat.h>
#include <wtf/Scope.h>
#include <wtf/text/StringHash.h>
extern "C" void RefString__free(void*, void*, unsigned);

View File

@@ -10,13 +10,13 @@ class SourceCodeKey;
class SourceProvider;
} // namespace JSC
#include "JavaScriptCore/CachedBytecode.h"
#include "JavaScriptCore/JSGlobalObject.h"
#include "JavaScriptCore/JSTypeInfo.h"
#include "ZigConsoleClient.h"
#include <JavaScriptCore/CachedBytecode.h>
#include <JavaScriptCore/JSGlobalObject.h>
#include <JavaScriptCore/JSTypeInfo.h>
// #include <JavaScriptCore/SourceCodeKey.h>
#include <JavaScriptCore/SourceProvider.h>
#include <JavaScriptCore/Structure.h>
// #include "JavaScriptCore/SourceCodeKey.h"
#include "JavaScriptCore/SourceProvider.h"
#include "JavaScriptCore/Structure.h"
namespace Zig {

View File

@@ -1,49 +1,53 @@
#include "root.h"
#include "BunClientData.h"
#include "GCDefferalContext.h"
#include "JavaScriptCore/AggregateError.h"
#include "JavaScriptCore/BytecodeIndex.h"
#include "JavaScriptCore/CodeBlock.h"
#include "JavaScriptCore/Completion.h"
#include "JavaScriptCore/DeferredWorkTimer.h"
#include "JavaScriptCore/ErrorInstance.h"
#include "JavaScriptCore/ExceptionHelpers.h"
#include "JavaScriptCore/ExceptionScope.h"
#include "JavaScriptCore/FunctionConstructor.h"
#include "JavaScriptCore/HeapSnapshotBuilder.h"
#include "JavaScriptCore/Identifier.h"
#include "JavaScriptCore/IteratorOperations.h"
#include "JavaScriptCore/JSArray.h"
#include "JavaScriptCore/JSArrayBuffer.h"
#include "JavaScriptCore/JSArrayInlines.h"
#include "JavaScriptCore/JSCInlines.h"
#include "JavaScriptCore/JSCallbackObject.h"
#include "JavaScriptCore/JSClassRef.h"
#include "JavaScriptCore/JSInternalPromise.h"
#include "JavaScriptCore/JSMap.h"
#include "JavaScriptCore/JSModuleLoader.h"
#include "JavaScriptCore/JSModuleRecord.h"
#include "JavaScriptCore/JSNativeStdFunction.h"
#include "JavaScriptCore/JSONObject.h"
#include "JavaScriptCore/JSObject.h"
#include "JavaScriptCore/JSSet.h"
#include "JavaScriptCore/JSString.h"
#include "JavaScriptCore/Microtask.h"
#include "JavaScriptCore/ObjectConstructor.h"
#include "JavaScriptCore/ParserError.h"
#include "JavaScriptCore/ScriptExecutable.h"
#include "JavaScriptCore/StackFrame.h"
#include "JavaScriptCore/StackVisitor.h"
#include "JavaScriptCore/VM.h"
#include "JavaScriptCore/WasmFaultSignalHandler.h"
#include "JavaScriptCore/Watchdog.h"
#include "ZigGlobalObject.h"
#include "helpers.h"
#include "root.h"
#include <JavaScriptCore/AggregateError.h>
#include <JavaScriptCore/BytecodeIndex.h>
#include <JavaScriptCore/CodeBlock.h>
#include <JavaScriptCore/Completion.h>
#include <JavaScriptCore/DeferredWorkTimer.h>
#include <JavaScriptCore/ErrorInstance.h>
#include <JavaScriptCore/ExceptionHelpers.h>
#include <JavaScriptCore/ExceptionScope.h>
#include <JavaScriptCore/FunctionConstructor.h>
#include <JavaScriptCore/HeapSnapshotBuilder.h>
#include <JavaScriptCore/Identifier.h>
#include <JavaScriptCore/IteratorOperations.h>
#include <JavaScriptCore/JSArray.h>
#include <JavaScriptCore/JSArrayBuffer.h>
#include <JavaScriptCore/JSArrayInlines.h>
#include <JavaScriptCore/JSCInlines.h>
#include <JavaScriptCore/JSCallbackObject.h>
#include <JavaScriptCore/JSClassRef.h>
#include <JavaScriptCore/JSInternalPromise.h>
#include <JavaScriptCore/JSMap.h>
#include <JavaScriptCore/JSModuleLoader.h>
#include <JavaScriptCore/JSModuleRecord.h>
#include <JavaScriptCore/JSNativeStdFunction.h>
#include <JavaScriptCore/JSONObject.h>
#include <JavaScriptCore/JSObject.h>
#include <JavaScriptCore/JSSet.h>
#include <JavaScriptCore/JSString.h>
#include <JavaScriptCore/Microtask.h>
#include <JavaScriptCore/ObjectConstructor.h>
#include <JavaScriptCore/ParserError.h>
#include <JavaScriptCore/ScriptExecutable.h>
#include <JavaScriptCore/StackFrame.h>
#include <JavaScriptCore/StackVisitor.h>
#include <JavaScriptCore/VM.h>
#include <JavaScriptCore/WasmFaultSignalHandler.h>
#include <JavaScriptCore/Watchdog.h>
#include <wtf/text/ExternalStringImpl.h>
#include <wtf/text/StringCommon.h>
#include <wtf/text/StringImpl.h>
#include <wtf/text/StringView.h>
#include <wtf/text/WTFString.h>
#include "wtf/text/ExternalStringImpl.h"
#include "wtf/text/StringCommon.h"
#include "wtf/text/StringImpl.h"
#include "wtf/text/StringView.h"
#include "wtf/text/WTFString.h"
extern "C" {
JSC__JSValue SystemError__toErrorInstance(const SystemError* arg0,
@@ -66,7 +70,7 @@ JSC__JSValue SystemError__toErrorInstance(const SystemError* arg0,
JSC::Structure* errorStructure = globalObject->errorStructure();
JSC::JSObject* result = JSC::ErrorInstance::create(globalObject, errorStructure, message, options);
auto clientData = Bun::clientData(vm);
auto clientData = WebCore::clientData(vm);
if (err.code.len > 0) {
JSC::JSValue code = Zig::toJSString(err.code, globalObject);
@@ -642,7 +646,7 @@ JSC__JSValue JSC__JSValue__createRangeError(const ZigString* message, const ZigS
0);
if (code.len > 0) {
auto clientData = Bun::clientData(vm);
auto clientData = WebCore::clientData(vm);
JSC::JSValue codeValue = Zig::toJSStringValue(code, globalObject);
rangeError->putDirect(vm, clientData->builtinNames().codePublicName(), codeValue,
JSC::PropertyAttribute::ReadOnly | 0);
@@ -665,7 +669,7 @@ JSC__JSValue JSC__JSValue__createTypeError(const ZigString* message, const ZigSt
0);
if (code.len > 0) {
auto clientData = Bun::clientData(vm);
auto clientData = WebCore::clientData(vm);
JSC::JSValue codeValue = Zig::toJSStringValue(code, globalObject);
typeError->putDirect(vm, clientData->builtinNames().codePublicName(), codeValue, 0);
}
@@ -1184,77 +1188,77 @@ void JSC__SourceCode__fromString(JSC__SourceCode* arg0, const WTF__String* arg1,
#pragma mark - JSC::JSFunction
JSC__JSValue JSC__JSFunction__callWithArguments(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1,
JSC__JSValue* arg2, size_t arg3,
JSC__Exception** arg4, const unsigned char* arg5)
{
auto args = makeArgs(arg2, arg3);
return JSC::JSValue::encode(JSC::call(arg1, JSC::JSValue::decode(JSValue0),
JSC::JSValue::decode(JSValue0), args, (const char*)arg5));
}
JSC__JSValue JSC__JSFunction__callWithArgumentsAndThis(JSC__JSValue JSValue0, JSC__JSValue JSValue1,
JSC__JSGlobalObject* arg2,
JSC__JSValue* arg3, size_t arg4,
JSC__Exception** arg5,
const unsigned char* arg6)
{
auto args = makeArgs(arg3, arg4);
return JSC::JSValue::encode(JSC::call(arg2, JSC::JSValue::decode(JSValue0),
JSC::JSValue::decode(JSValue1), args, (const char*)arg6));
}
JSC__JSValue JSC__JSFunction__callWithoutAnyArgumentsOrThis(JSC__JSValue JSValue0,
JSC__JSGlobalObject* arg1,
JSC__Exception** arg2,
const unsigned char* arg3)
{
return JSC::JSValue::encode(JSC::call(arg1, JSC::JSValue::decode(JSValue0),
JSC::JSValue::decode(JSValue0), JSC::ArgList(),
(const char*)arg3));
}
JSC__JSValue JSC__JSFunction__callWithThis(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1,
JSC__JSValue JSValue2, JSC__Exception** arg3,
const unsigned char* arg4)
{
return JSC::JSValue::encode(JSC::call(arg1, JSC::JSValue::decode(JSValue0),
JSC::JSValue::decode(JSValue2), JSC::ArgList(),
(const char*)arg4));
}
JSC__JSValue JSC__JSFunction__constructWithArguments(JSC__JSValue JSValue0,
JSC__JSGlobalObject* arg1, JSC__JSValue* arg2,
size_t arg3, JSC__Exception** arg4,
const unsigned char* arg5)
{
auto args = makeArgs(arg2, arg3);
return JSC::JSValue::encode(
JSC::construct(arg1, JSC::JSValue::decode(JSValue0), args, (const char*)arg5));
}
// JSC__JSValue JSC__JSFunction__callWithArguments(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1,
// JSC__JSValue* arg2, size_t arg3,
// JSC__Exception** arg4, const unsigned char* arg5)
// {
// auto args = makeArgs(arg2, arg3);
// return JSC::JSValue::encode(JSC::call(arg1, JSC::JSValue::decode(JSValue0),
// JSC::JSValue::decode(JSValue0), args, (const char*)arg5));
// }
// JSC__JSValue JSC__JSFunction__callWithArgumentsAndThis(JSC__JSValue JSValue0, JSC__JSValue JSValue1,
// JSC__JSGlobalObject* arg2,
// JSC__JSValue* arg3, size_t arg4,
// JSC__Exception** arg5,
// const unsigned char* arg6)
// {
// auto args = makeArgs(arg3, arg4);
// return JSC::JSValue::encode(JSC::call(arg2, JSC::JSValue::decode(JSValue0),
// JSC::JSValue::decode(JSValue1), args, (const char*)arg6));
// }
// JSC__JSValue JSC__JSFunction__callWithoutAnyArgumentsOrThis(JSC__JSValue JSValue0,
// JSC__JSGlobalObject* arg1,
// JSC__Exception** arg2,
// const unsigned char* arg3)
// {
// return JSC::JSValue::encode(JSC::call(arg1, JSC::JSValue::decode(JSValue0),
// JSC::JSValue::decode(JSValue0), JSC::ArgList(),
// (const char*)arg3));
// }
// JSC__JSValue JSC__JSFunction__callWithThis(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1,
// JSC__JSValue JSValue2, JSC__Exception** arg3,
// const unsigned char* arg4)
// {
// return JSC::JSValue::encode(JSC::call(arg1, JSC::JSValue::decode(JSValue0),
// JSC::JSValue::decode(JSValue2), JSC::ArgList(),
// (const char*)arg4));
// }
// JSC__JSValue JSC__JSFunction__constructWithArguments(JSC__JSValue JSValue0,
// JSC__JSGlobalObject* arg1, JSC__JSValue* arg2,
// size_t arg3, JSC__Exception** arg4,
// const unsigned char* arg5)
// {
// auto args = makeArgs(arg2, arg3);
// return JSC::JSValue::encode(
// JSC::construct(arg1, JSC::JSValue::decode(JSValue0), args, (const char*)arg5));
// }
JSC__JSValue JSC__JSFunction__constructWithArgumentsAndNewTarget(
JSC__JSValue JSValue0, JSC__JSValue JSValue1, JSC__JSGlobalObject* arg2, JSC__JSValue* arg3,
size_t arg4, JSC__Exception** arg5, const unsigned char* arg6)
{
auto args = makeArgs(arg3, arg4);
return JSC::JSValue::encode(JSC::construct(arg2, JSC::JSValue::decode(JSValue0),
JSC::JSValue::decode(JSValue0), args,
(const char*)arg6));
}
JSC__JSValue JSC__JSFunction__constructWithNewTarget(JSC__JSValue JSValue0,
JSC__JSGlobalObject* arg1,
JSC__JSValue JSValue2, JSC__Exception** arg3,
const unsigned char* arg4)
{
return JSC::JSValue::encode(JSC::construct(arg1, JSC::JSValue::decode(JSValue0),
JSC::JSValue::decode(JSValue2), JSC::ArgList(),
(const char*)arg4));
}
JSC__JSValue JSC__JSFunction__constructWithoutAnyArgumentsOrNewTarget(JSC__JSValue JSValue0,
JSC__JSGlobalObject* arg1,
JSC__Exception** arg2,
const unsigned char* arg3)
{
return JSC::JSValue::encode(
JSC::construct(arg1, JSC::JSValue::decode(JSValue0), JSC::ArgList(), (const char*)arg3));
}
// JSC__JSValue JSC__JSFunction__constructWithArgumentsAndNewTarget(
// JSC__JSValue JSValue0, JSC__JSValue JSValue1, JSC__JSGlobalObject* arg2, JSC__JSValue* arg3,
// size_t arg4, JSC__Exception** arg5, const unsigned char* arg6)
// {
// auto args = makeArgs(arg3, arg4);
// return JSC::JSValue::encode(JSC::construct(arg2, JSC::JSValue::decode(JSValue0),
// JSC::JSValue::decode(JSValue0), args,
// (const char*)arg6));
// }
// JSC__JSValue JSC__JSFunction__constructWithNewTarget(JSC__JSValue JSValue0,
// JSC__JSGlobalObject* arg1,
// JSC__JSValue JSValue2, JSC__Exception** arg3,
// const unsigned char* arg4)
// {
// return JSC::JSValue::encode(JSC::construct(arg1, JSC::JSValue::decode(JSValue0),
// JSC::JSValue::decode(JSValue2), JSC::ArgList(),
// (const char*)arg4));
// }
// JSC__JSValue JSC__JSFunction__constructWithoutAnyArgumentsOrNewTarget(JSC__JSValue JSValue0,
// JSC__JSGlobalObject* arg1,
// JSC__Exception** arg2,
// const unsigned char* arg3)
// {
// return JSC::JSValue::encode(
// JSC::construct(arg1, JSC::JSValue::decode(JSValue0), JSC::ArgList(), (const char*)arg3));
// }
JSC__JSFunction* JSC__JSFunction__createFromNative(JSC__JSGlobalObject* arg0, uint16_t arg1,
const WTF__String* arg2, void* ctx,
@@ -2035,7 +2039,7 @@ static void fromErrorInstance(ZigException* except, JSC::JSGlobalObject* global,
except->name = Zig::toZigString(err->sanitizedNameString(global));
except->runtime_type = err->runtimeTypeForCause();
auto clientData = Bun::clientData(global->vm());
auto clientData = WebCore::clientData(global->vm());
if (except->code != SYNTAX_ERROR_CODE) {
if (JSC::JSValue syscall = obj->getIfPropertyExists(global, clientData->builtinNames().syscallPublicName())) {
@@ -2643,7 +2647,7 @@ bWTF__String WTF__URL__stringWithoutFragmentIdentifier(WTF__URL* arg0)
};
bWTF__StringView WTF__URL__stringWithoutQueryOrFragmentIdentifier(WTF__URL* arg0)
{
auto result = arg0->stringWithoutQueryOrFragmentIdentifier();
auto result = arg0->viewWithoutQueryOrFragmentIdentifier();
return cast<bWTF__StringView>(&result);
};
bWTF__URL WTF__URL__truncatedForUseAsBase(WTF__URL* arg0)

View File

@@ -19,7 +19,7 @@ pub const JSObject = extern struct {
pub const shim = Shimmer("JSC", "JSObject", @This());
bytes: shim.Bytes,
const cppFn = shim.cppFn;
pub const include = "<JavaScriptCore/JSObject.h>";
pub const include = "JavaScriptCore/JSObject.h";
pub const name = "JSC::JSObject";
pub const namespace = "JSC";
@@ -384,7 +384,7 @@ pub const JSCell = extern struct {
pub const shim = Shimmer("JSC", "JSCell", @This());
bytes: shim.Bytes,
const cppFn = shim.cppFn;
pub const include = "<JavaScriptCore/JSCell.h>";
pub const include = "JavaScriptCore/JSCell.h";
pub const name = "JSC::JSCell";
pub const namespace = "JSC";
@@ -411,7 +411,7 @@ pub const JSString = extern struct {
pub const shim = Shimmer("JSC", "JSString", @This());
bytes: shim.Bytes,
const cppFn = shim.cppFn;
pub const include = "<JavaScriptCore/JSString.h>";
pub const include = "JavaScriptCore/JSString.h";
pub const name = "JSC::JSString";
pub const namespace = "JSC";
@@ -463,7 +463,7 @@ pub const ScriptArguments = extern struct {
pub const shim = Shimmer("Inspector", "ScriptArguments", @This());
bytes: shim.Bytes,
const cppFn = shim.cppFn;
pub const include = "<JavaScriptCore/ScriptArguments.h>";
pub const include = "JavaScriptCore/ScriptArguments.h";
pub const name = "Inspector::ScriptArguments";
pub const namespace = "Inspector";
@@ -569,7 +569,7 @@ pub const JSModuleLoader = extern struct {
pub const shim = Shimmer("JSC", "JSModuleLoader", @This());
bytes: shim.Bytes,
const cppFn = shim.cppFn;
pub const include = "<JavaScriptCore/JSModuleLoader.h>";
pub const include = "JavaScriptCore/JSModuleLoader.h";
pub const name = "JSC::JSModuleLoader";
pub const namespace = "JSC";
@@ -663,7 +663,7 @@ pub const JSModuleRecord = extern struct {
pub const shim = Shimmer("JSC", "JSModuleRecord", @This());
bytes: shim.Bytes,
const cppFn = shim.cppFn;
pub const include = "<JavaScriptCore/JSModuleRecord.h>";
pub const include = "JavaScriptCore/JSModuleRecord.h";
pub const name = "JSC::JSModuleRecord";
pub const namespace = "JSC";
@@ -682,7 +682,7 @@ pub const JSPromise = extern struct {
pub const shim = Shimmer("JSC", "JSPromise", @This());
bytes: shim.Bytes,
const cppFn = shim.cppFn;
pub const include = "<JavaScriptCore/JSPromise.h>";
pub const include = "JavaScriptCore/JSPromise.h";
pub const name = "JSC::JSPromise";
pub const namespace = "JSC";
@@ -769,7 +769,7 @@ pub const JSInternalPromise = extern struct {
pub const shim = Shimmer("JSC", "JSInternalPromise", @This());
bytes: shim.Bytes,
const cppFn = shim.cppFn;
pub const include = "<JavaScriptCore/JSInternalPromise.h>";
pub const include = "JavaScriptCore/JSInternalPromise.h";
pub const name = "JSC::JSInternalPromise";
pub const namespace = "JSC";
@@ -988,7 +988,7 @@ pub const SourceOrigin = extern struct {
pub const shim = Shimmer("JSC", "SourceOrigin", @This());
bytes: shim.Bytes,
const cppFn = shim.cppFn;
pub const include = "<JavaScriptCore/SourceOrigin.h>";
pub const include = "JavaScriptCore/SourceOrigin.h";
pub const name = "JSC::SourceOrigin";
pub const namespace = "JSC";
@@ -1005,7 +1005,7 @@ pub const SourceCode = extern struct {
pub const shim = Shimmer("JSC", "SourceCode", @This());
bytes: shim.Bytes,
const cppFn = shim.cppFn;
pub const include = "<JavaScriptCore/SourceProvider.h>";
pub const include = "JavaScriptCore/SourceProvider.h";
pub const name = "JSC::SourceCode";
pub const namespace = "JSC";
@@ -1022,7 +1022,7 @@ pub const JSFunction = extern struct {
pub const shim = Shimmer("JSC", "JSFunction", @This());
bytes: shim.Bytes,
const cppFn = shim.cppFn;
pub const include = "<JavaScriptCore/JSFunction.h>";
pub const include = "JavaScriptCore/JSFunction.h";
pub const name = "JSC::JSFunction";
pub const namespace = "JSC";
@@ -1224,7 +1224,7 @@ pub const JSGlobalObject = extern struct {
pub const shim = Shimmer("JSC", "JSGlobalObject", @This());
bytes: shim.Bytes,
pub const include = "<JavaScriptCore/JSGlobalObject.h>";
pub const include = "JavaScriptCore/JSGlobalObject.h";
pub const name = "JSC::JSGlobalObject";
pub const namespace = "JSC";
@@ -1395,7 +1395,7 @@ fn _JSCellStub(comptime str: []const u8) type {
fn _Bun(comptime str: []const u8) type {
if (is_bindgen) {
return opaque {
pub const name = "Bun::" ++ str ++ "";
pub const name = "WebCore::" ++ str ++ "";
};
} else {
return opaque {};
@@ -1416,7 +1416,7 @@ pub const URL = extern struct {
pub const shim = Shimmer("WTF", "URL", @This());
bytes: shim.Bytes,
const cppFn = shim.cppFn;
pub const include = "<wtf/URL.h>";
pub const include = "wtf/URL.h";
pub const name = "WTF::URL";
pub const namespace = "WTF";
@@ -1547,7 +1547,7 @@ pub const String = extern struct {
pub const shim = Shimmer("WTF", "String", @This());
bytes: shim.Bytes,
const cppFn = shim.cppFn;
pub const include = "<wtf/text/WTFString.h>";
pub const include = "wtf/text/WTFString.h";
pub const name = "WTF::String";
pub const namespace = "WTF";
@@ -1638,7 +1638,7 @@ pub const JSValue = enum(u64) {
pub const Type = u64;
const cppFn = shim.cppFn;
pub const include = "<JavaScriptCore/JSValue.h>";
pub const include = "JavaScriptCore/JSValue.h";
pub const name = "JSC::JSValue";
pub const namespace = "JSC";
pub const zero = @intToEnum(JSValue, @as(u64, 0));
@@ -2430,7 +2430,7 @@ pub const PropertyName = extern struct {
const cppFn = shim.cppFn;
pub const include = "<JavaScriptCore/PropertyName.h>";
pub const include = "JavaScriptCore/PropertyName.h";
pub const name = "JSC::PropertyName";
pub const namespace = "JSC";
@@ -2463,7 +2463,7 @@ pub const Exception = extern struct {
pub const Type = JSObject;
const cppFn = shim.cppFn;
pub const include = "<JavaScriptCore/Exception.h>";
pub const include = "JavaScriptCore/Exception.h";
pub const name = "JSC::Exception";
pub const namespace = "JSC";
@@ -2502,7 +2502,7 @@ pub const JSLock = extern struct {
const cppFn = shim.cppFn;
pub const include = "<JavaScriptCore/JSLock.h>";
pub const include = "JavaScriptCore/JSLock.h";
pub const name = "JSC::JSLock";
pub const namespace = "JSC";
@@ -2522,7 +2522,7 @@ pub const VM = extern struct {
const cppFn = shim.cppFn;
pub const include = "<JavaScriptCore/VM.h>";
pub const include = "JavaScriptCore/VM.h";
pub const name = "JSC::VM";
pub const namespace = "JSC";
@@ -2639,7 +2639,7 @@ pub const ThrowScope = extern struct {
const cppFn = shim.cppFn;
pub const include = "<JavaScriptCore/ThrowScope.h>";
pub const include = "JavaScriptCore/ThrowScope.h";
pub const name = "JSC::ThrowScope";
pub const namespace = "JSC";
@@ -2678,7 +2678,7 @@ pub const CatchScope = extern struct {
const cppFn = shim.cppFn;
pub const include = "<JavaScriptCore/CatchScope.h>";
pub const include = "JavaScriptCore/CatchScope.h";
pub const name = "JSC::CatchScope";
pub const namespace = "JSC";
@@ -2711,7 +2711,7 @@ pub const CallFrame = extern struct {
bytes: shim.Bytes,
const cppFn = shim.cppFn;
pub const include = "<JavaScriptCore/CallFrame.h>";
pub const include = "JavaScriptCore/CallFrame.h";
pub const name = "JSC::CallFrame";
pub const namespace = "JSC";
@@ -2767,7 +2767,7 @@ pub const CallFrame = extern struct {
//
//
// pub const include = "<JavaScriptCore/CommonIdentifiers.h>";
// pub const include = "JavaScriptCore/CommonIdentifiers.h";
// pub const name = "JSC::CommonIdentifiers";
// pub const namespace = "JSC";
@@ -2795,7 +2795,7 @@ pub const EncodedJSValue = enum(i64) {
pub const Type = u64;
const cppFn = shim.cppFn;
pub const include = "<JavaScriptCore/EncodedJSValue.h>";
pub const include = "JavaScriptCore/EncodedJSValue.h";
pub const name = "JSC::EncodedJSValue";
pub const namespace = "JSC";
};
@@ -2805,7 +2805,7 @@ pub const Identifier = extern struct {
bytes: shim.Bytes,
const cppFn = shim.cppFn;
pub const include = "<JavaScriptCore/Identifier.h>";
pub const include = "JavaScriptCore/Identifier.h";
pub const name = "JSC::Identifier";
pub const namespace = "JSC";
@@ -2892,7 +2892,7 @@ pub const StringImpl = extern struct {
bytes: shim.Bytes,
const cppFn = shim.cppFn;
pub const include = "<wtf/text/StringImpl.h>";
pub const include = "wtf/text/StringImpl.h";
pub const name = "WTF::StringImpl";
pub const namespace = "WTF";
@@ -2940,7 +2940,7 @@ pub const ExternalStringImpl = extern struct {
bytes: shim.Bytes,
const cppFn = shim.cppFn;
pub const include = "<wtf/text/ExternalStringImpl.h>";
pub const include = "wtf/text/ExternalStringImpl.h";
pub const name = "WTF::ExternalStringImpl";
pub const namespace = "WTF";
@@ -3015,7 +3015,7 @@ pub const StringView = extern struct {
bytesA: u64,
const cppFn = shim.cppFn;
pub const include = "<wtf/text/StringView.h>";
pub const include = "wtf/text/StringView.h";
pub const name = "WTF::StringView";
pub const namespace = "WTF";

View File

@@ -0,0 +1,53 @@
/*
* Copyright (c) 2021 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.
*/
#ifndef BMALLOC_HEAP_REF_H
#define BMALLOC_HEAP_REF_H
#include <bmalloc/bmalloc_type.h>
#include <bmalloc/pas_heap_ref.h>
PAS_BEGIN_EXTERN_C;
#define BMALLOC_HEAP_REF_INITIALIZER(passed_type) \
((pas_heap_ref) { \
.type = (const pas_heap_type*)(passed_type), \
.heap = NULL, \
.allocator_index = 0 })
#define BMALLOC_PRIMITIVE_HEAP_REF_INITIALIZER_IMPL(passed_type) \
((pas_primitive_heap_ref) { \
.base = BMALLOC_HEAP_REF_INITIALIZER(passed_type), \
.cached_index = UINT_MAX })
#define BMALLOC_FLEX_HEAP_REF_INITIALIZER(passed_type) \
BMALLOC_PRIMITIVE_HEAP_REF_INITIALIZER_IMPL(passed_type)
#define BMALLOC_AUXILIARY_HEAP_REF_INITIALIZER(passed_type) \
BMALLOC_PRIMITIVE_HEAP_REF_INITIALIZER_IMPL(passed_type)
PAS_END_EXTERN_C;
#endif /* BMALLOC_HEAP_REF_H */

View File

@@ -275,7 +275,7 @@ pub const JSErrorCode = enum(u8) {
URIError = 6,
AggregateError = 7,
// StackOverflow & OutOfMemoryError is not an ErrorType in <JavaScriptCore/ErrorType.h> within JSC, so the number here is just totally made up
// StackOverflow & OutOfMemoryError is not an ErrorType in "JavaScriptCore/ErrorType.h" within JSC, so the number here is just totally made up
OutOfMemoryError = 8,
BundlerError = 252,
StackOverflow = 253,

View File

@@ -621,7 +621,7 @@ pub fn HeaderGen(comptime first_import: type, comptime second_import: type, comp
\\
\\#ifdef __cplusplus
\\#include "root.h"
\\#include <JavaScriptCore/JSClassRef.h>
\\#include "JavaScriptCore/JSClassRef.h"
\\#endif
\\#include "headers-handwritten.h"
\\

View File

@@ -1,4 +1,4 @@
//-- AUTOGENERATED FILE -- 1648167213
//-- AUTOGENERATED FILE -- 1648440945
// clang-format off
#pragma once
@@ -8,201 +8,201 @@
#include "root.h"
#ifndef INCLUDED__JavaScriptCore_JSObject_h_
#define INCLUDED__JavaScriptCore_JSObject_h_
#include <JavaScriptCore/JSObject.h>
#ifndef INCLUDED_JavaScriptCore_JSObject_h
#define INCLUDED_JavaScriptCore_JSObject_h
#include JavaScriptCore/JSObject.h
#endif
extern "C" const size_t JSC__JSObject_object_size_ = sizeof(JSC::JSObject);
extern "C" const size_t JSC__JSObject_object_align_ = alignof(JSC::JSObject);
#ifndef INCLUDED__JavaScriptCore_JSCell_h_
#define INCLUDED__JavaScriptCore_JSCell_h_
#include <JavaScriptCore/JSCell.h>
#ifndef INCLUDED_JavaScriptCore_JSCell_h
#define INCLUDED_JavaScriptCore_JSCell_h
#include JavaScriptCore/JSCell.h
#endif
extern "C" const size_t JSC__JSCell_object_size_ = sizeof(JSC::JSCell);
extern "C" const size_t JSC__JSCell_object_align_ = alignof(JSC::JSCell);
#ifndef INCLUDED__JavaScriptCore_JSString_h_
#define INCLUDED__JavaScriptCore_JSString_h_
#include <JavaScriptCore/JSString.h>
#ifndef INCLUDED_JavaScriptCore_JSString_h
#define INCLUDED_JavaScriptCore_JSString_h
#include JavaScriptCore/JSString.h
#endif
extern "C" const size_t JSC__JSString_object_size_ = sizeof(JSC::JSString);
extern "C" const size_t JSC__JSString_object_align_ = alignof(JSC::JSString);
#ifndef INCLUDED__JavaScriptCore_ScriptArguments_h_
#define INCLUDED__JavaScriptCore_ScriptArguments_h_
#include <JavaScriptCore/ScriptArguments.h>
#ifndef INCLUDED_JavaScriptCore_ScriptArguments_h
#define INCLUDED_JavaScriptCore_ScriptArguments_h
#include JavaScriptCore/ScriptArguments.h
#endif
extern "C" const size_t Inspector__ScriptArguments_object_size_ = sizeof(Inspector::ScriptArguments);
extern "C" const size_t Inspector__ScriptArguments_object_align_ = alignof(Inspector::ScriptArguments);
#ifndef INCLUDED__JavaScriptCore_JSModuleLoader_h_
#define INCLUDED__JavaScriptCore_JSModuleLoader_h_
#include <JavaScriptCore/JSModuleLoader.h>
#ifndef INCLUDED_JavaScriptCore_JSModuleLoader_h
#define INCLUDED_JavaScriptCore_JSModuleLoader_h
#include JavaScriptCore/JSModuleLoader.h
#endif
extern "C" const size_t JSC__JSModuleLoader_object_size_ = sizeof(JSC::JSModuleLoader);
extern "C" const size_t JSC__JSModuleLoader_object_align_ = alignof(JSC::JSModuleLoader);
#ifndef INCLUDED__JavaScriptCore_JSModuleRecord_h_
#define INCLUDED__JavaScriptCore_JSModuleRecord_h_
#include <JavaScriptCore/JSModuleRecord.h>
#ifndef INCLUDED_JavaScriptCore_JSModuleRecord_h
#define INCLUDED_JavaScriptCore_JSModuleRecord_h
#include JavaScriptCore/JSModuleRecord.h
#endif
extern "C" const size_t JSC__JSModuleRecord_object_size_ = sizeof(JSC::JSModuleRecord);
extern "C" const size_t JSC__JSModuleRecord_object_align_ = alignof(JSC::JSModuleRecord);
#ifndef INCLUDED__JavaScriptCore_JSPromise_h_
#define INCLUDED__JavaScriptCore_JSPromise_h_
#include <JavaScriptCore/JSPromise.h>
#ifndef INCLUDED_JavaScriptCore_JSPromise_h
#define INCLUDED_JavaScriptCore_JSPromise_h
#include JavaScriptCore/JSPromise.h
#endif
extern "C" const size_t JSC__JSPromise_object_size_ = sizeof(JSC::JSPromise);
extern "C" const size_t JSC__JSPromise_object_align_ = alignof(JSC::JSPromise);
#ifndef INCLUDED__JavaScriptCore_JSInternalPromise_h_
#define INCLUDED__JavaScriptCore_JSInternalPromise_h_
#include <JavaScriptCore/JSInternalPromise.h>
#ifndef INCLUDED_JavaScriptCore_JSInternalPromise_h
#define INCLUDED_JavaScriptCore_JSInternalPromise_h
#include JavaScriptCore/JSInternalPromise.h
#endif
extern "C" const size_t JSC__JSInternalPromise_object_size_ = sizeof(JSC::JSInternalPromise);
extern "C" const size_t JSC__JSInternalPromise_object_align_ = alignof(JSC::JSInternalPromise);
#ifndef INCLUDED__JavaScriptCore_SourceOrigin_h_
#define INCLUDED__JavaScriptCore_SourceOrigin_h_
#include <JavaScriptCore/SourceOrigin.h>
#ifndef INCLUDED_JavaScriptCore_SourceOrigin_h
#define INCLUDED_JavaScriptCore_SourceOrigin_h
#include JavaScriptCore/SourceOrigin.h
#endif
extern "C" const size_t JSC__SourceOrigin_object_size_ = sizeof(JSC::SourceOrigin);
extern "C" const size_t JSC__SourceOrigin_object_align_ = alignof(JSC::SourceOrigin);
#ifndef INCLUDED__JavaScriptCore_SourceProvider_h_
#define INCLUDED__JavaScriptCore_SourceProvider_h_
#include <JavaScriptCore/SourceProvider.h>
#ifndef INCLUDED_JavaScriptCore_SourceProvider_h
#define INCLUDED_JavaScriptCore_SourceProvider_h
#include JavaScriptCore/SourceProvider.h
#endif
extern "C" const size_t JSC__SourceCode_object_size_ = sizeof(JSC::SourceCode);
extern "C" const size_t JSC__SourceCode_object_align_ = alignof(JSC::SourceCode);
#ifndef INCLUDED__JavaScriptCore_JSFunction_h_
#define INCLUDED__JavaScriptCore_JSFunction_h_
#include <JavaScriptCore/JSFunction.h>
#ifndef INCLUDED_JavaScriptCore_JSFunction_h
#define INCLUDED_JavaScriptCore_JSFunction_h
#include JavaScriptCore/JSFunction.h
#endif
extern "C" const size_t JSC__JSFunction_object_size_ = sizeof(JSC::JSFunction);
extern "C" const size_t JSC__JSFunction_object_align_ = alignof(JSC::JSFunction);
#ifndef INCLUDED__JavaScriptCore_JSGlobalObject_h_
#define INCLUDED__JavaScriptCore_JSGlobalObject_h_
#include <JavaScriptCore/JSGlobalObject.h>
#ifndef INCLUDED_JavaScriptCore_JSGlobalObject_h
#define INCLUDED_JavaScriptCore_JSGlobalObject_h
#include JavaScriptCore/JSGlobalObject.h
#endif
extern "C" const size_t JSC__JSGlobalObject_object_size_ = sizeof(JSC::JSGlobalObject);
extern "C" const size_t JSC__JSGlobalObject_object_align_ = alignof(JSC::JSGlobalObject);
#ifndef INCLUDED__wtf_URL_h_
#define INCLUDED__wtf_URL_h_
#include <wtf/URL.h>
#ifndef INCLUDED_wtf_URL_h
#define INCLUDED_wtf_URL_h
#include wtf/URL.h
#endif
extern "C" const size_t WTF__URL_object_size_ = sizeof(WTF::URL);
extern "C" const size_t WTF__URL_object_align_ = alignof(WTF::URL);
#ifndef INCLUDED__wtf_text_WTFString_h_
#define INCLUDED__wtf_text_WTFString_h_
#include <wtf/text/WTFString.h>
#ifndef INCLUDED_wtf_text_WTFString_h
#define INCLUDED_wtf_text_WTFString_h
#include wtf/text/WTFString.h
#endif
extern "C" const size_t WTF__String_object_size_ = sizeof(WTF::String);
extern "C" const size_t WTF__String_object_align_ = alignof(WTF::String);
#ifndef INCLUDED__JavaScriptCore_JSValue_h_
#define INCLUDED__JavaScriptCore_JSValue_h_
#include <JavaScriptCore/JSValue.h>
#ifndef INCLUDED_JavaScriptCore_JSValue_h
#define INCLUDED_JavaScriptCore_JSValue_h
#include JavaScriptCore/JSValue.h
#endif
extern "C" const size_t JSC__JSValue_object_size_ = sizeof(JSC::JSValue);
extern "C" const size_t JSC__JSValue_object_align_ = alignof(JSC::JSValue);
#ifndef INCLUDED__JavaScriptCore_PropertyName_h_
#define INCLUDED__JavaScriptCore_PropertyName_h_
#include <JavaScriptCore/PropertyName.h>
#ifndef INCLUDED_JavaScriptCore_PropertyName_h
#define INCLUDED_JavaScriptCore_PropertyName_h
#include JavaScriptCore/PropertyName.h
#endif
extern "C" const size_t JSC__PropertyName_object_size_ = sizeof(JSC::PropertyName);
extern "C" const size_t JSC__PropertyName_object_align_ = alignof(JSC::PropertyName);
#ifndef INCLUDED__JavaScriptCore_Exception_h_
#define INCLUDED__JavaScriptCore_Exception_h_
#include <JavaScriptCore/Exception.h>
#ifndef INCLUDED_JavaScriptCore_Exception_h
#define INCLUDED_JavaScriptCore_Exception_h
#include JavaScriptCore/Exception.h
#endif
extern "C" const size_t JSC__Exception_object_size_ = sizeof(JSC::Exception);
extern "C" const size_t JSC__Exception_object_align_ = alignof(JSC::Exception);
#ifndef INCLUDED__JavaScriptCore_VM_h_
#define INCLUDED__JavaScriptCore_VM_h_
#include <JavaScriptCore/VM.h>
#ifndef INCLUDED_JavaScriptCore_VM_h
#define INCLUDED_JavaScriptCore_VM_h
#include JavaScriptCore/VM.h
#endif
extern "C" const size_t JSC__VM_object_size_ = sizeof(JSC::VM);
extern "C" const size_t JSC__VM_object_align_ = alignof(JSC::VM);
#ifndef INCLUDED__JavaScriptCore_ThrowScope_h_
#define INCLUDED__JavaScriptCore_ThrowScope_h_
#include <JavaScriptCore/ThrowScope.h>
#ifndef INCLUDED_JavaScriptCore_ThrowScope_h
#define INCLUDED_JavaScriptCore_ThrowScope_h
#include JavaScriptCore/ThrowScope.h
#endif
extern "C" const size_t JSC__ThrowScope_object_size_ = sizeof(JSC::ThrowScope);
extern "C" const size_t JSC__ThrowScope_object_align_ = alignof(JSC::ThrowScope);
#ifndef INCLUDED__JavaScriptCore_CatchScope_h_
#define INCLUDED__JavaScriptCore_CatchScope_h_
#include <JavaScriptCore/CatchScope.h>
#ifndef INCLUDED_JavaScriptCore_CatchScope_h
#define INCLUDED_JavaScriptCore_CatchScope_h
#include JavaScriptCore/CatchScope.h
#endif
extern "C" const size_t JSC__CatchScope_object_size_ = sizeof(JSC::CatchScope);
extern "C" const size_t JSC__CatchScope_object_align_ = alignof(JSC::CatchScope);
#ifndef INCLUDED__JavaScriptCore_CallFrame_h_
#define INCLUDED__JavaScriptCore_CallFrame_h_
#include <JavaScriptCore/CallFrame.h>
#ifndef INCLUDED_JavaScriptCore_CallFrame_h
#define INCLUDED_JavaScriptCore_CallFrame_h
#include JavaScriptCore/CallFrame.h
#endif
extern "C" const size_t JSC__CallFrame_object_size_ = sizeof(JSC::CallFrame);
extern "C" const size_t JSC__CallFrame_object_align_ = alignof(JSC::CallFrame);
#ifndef INCLUDED__JavaScriptCore_Identifier_h_
#define INCLUDED__JavaScriptCore_Identifier_h_
#include <JavaScriptCore/Identifier.h>
#ifndef INCLUDED_JavaScriptCore_Identifier_h
#define INCLUDED_JavaScriptCore_Identifier_h
#include JavaScriptCore/Identifier.h
#endif
extern "C" const size_t JSC__Identifier_object_size_ = sizeof(JSC::Identifier);
extern "C" const size_t JSC__Identifier_object_align_ = alignof(JSC::Identifier);
#ifndef INCLUDED__wtf_text_StringImpl_h_
#define INCLUDED__wtf_text_StringImpl_h_
#include <wtf/text/StringImpl.h>
#ifndef INCLUDED_wtf_text_StringImpl_h
#define INCLUDED_wtf_text_StringImpl_h
#include wtf/text/StringImpl.h
#endif
extern "C" const size_t WTF__StringImpl_object_size_ = sizeof(WTF::StringImpl);
extern "C" const size_t WTF__StringImpl_object_align_ = alignof(WTF::StringImpl);
#ifndef INCLUDED__wtf_text_ExternalStringImpl_h_
#define INCLUDED__wtf_text_ExternalStringImpl_h_
#include <wtf/text/ExternalStringImpl.h>
#ifndef INCLUDED_wtf_text_ExternalStringImpl_h
#define INCLUDED_wtf_text_ExternalStringImpl_h
#include wtf/text/ExternalStringImpl.h
#endif
extern "C" const size_t WTF__ExternalStringImpl_object_size_ = sizeof(WTF::ExternalStringImpl);
extern "C" const size_t WTF__ExternalStringImpl_object_align_ = alignof(WTF::ExternalStringImpl);
#ifndef INCLUDED__wtf_text_StringView_h_
#define INCLUDED__wtf_text_StringView_h_
#include <wtf/text/StringView.h>
#ifndef INCLUDED_wtf_text_StringView_h
#define INCLUDED_wtf_text_StringView_h
#include wtf/text/StringView.h
#endif
extern "C" const size_t WTF__StringView_object_size_ = sizeof(WTF::StringView);

View File

@@ -1,10 +1,10 @@
// clang-format: off
//-- AUTOGENERATED FILE -- 1648167213
//-- AUTOGENERATED FILE -- 1648440945
#pragma once
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>
#ifdef __cplusplus
#define AUTO_EXTERN_C extern "C"
@@ -23,7 +23,7 @@ typedef void* JSClassRef;
#ifdef __cplusplus
#include "root.h"
#include <JavaScriptCore/JSClassRef.h>
#include "JavaScriptCore/JSClassRef.h"
#endif
#include "headers-handwritten.h"
typedef struct bJSC__SourceCode {

View File

@@ -1,16 +1,17 @@
#pragma once
#include "headers.h"
#include "root.h"
#include <JavaScriptCore/Error.h>
#include <JavaScriptCore/Exception.h>
#include <JavaScriptCore/Identifier.h>
#include <JavaScriptCore/JSCInlines.h>
#include <JavaScriptCore/JSString.h>
#include <JavaScriptCore/JSValueInternal.h>
#include <JavaScriptCore/ThrowScope.h>
#include <JavaScriptCore/VM.h>
#include "headers.h"
#include "JavaScriptCore/Error.h"
#include "JavaScriptCore/Exception.h"
#include "JavaScriptCore/Identifier.h"
#include "JavaScriptCore/JSGlobalObject.h"
#include "JavaScriptCore/JSString.h"
#include "JavaScriptCore/JSValueInternal.h"
#include "JavaScriptCore/ThrowScope.h"
#include "JavaScriptCore/VM.h"
template<class CppType, typename ZigType> class Wrap {
public:

View File

@@ -3,9 +3,9 @@
// #include "root.h"
// #include "headers.h"
// #include <JavaScriptCore/JSObject.h>
// #include <JavaScriptCore/JSCInlines.h>
// #include <JavaScriptCore/InternalFunction.h>
// #include "JavaScriptCore/JSObject.h"
// #include "JavaScriptCore/JSCInlines.h"
// #include "JavaScriptCore/InternalFunction.h"
// namespace Zig {

View File

@@ -2,7 +2,7 @@
/*
* Copyright (C) 2006-2021 Apple Inc. All rights reserved.
* Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
* Copyright (C) 2006 Samuel Weinig "sam.weinig@gmail.com"
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -34,16 +34,14 @@
#define JSC_MAC_VERSION_TBA 0
#define JSC_IOS_VERSION_TBA 0
#include <wtf/ExportMacros.h>
#include "wtf/ExportMacros.h"
#if !defined(JS_EXPORT_PRIVATE)
#if defined(BUILDING_JavaScriptCore) || defined(STATICALLY_LINKED_WITH_JavaScriptCore)
#define JS_EXPORT_PRIVATE WTF_EXPORT_DECLARATION
#define WEBCORE_EXPORT WTF_EXPORT_DECLARATION
#else
#define JS_EXPORT_PRIVATE WTF_IMPORT_DECLARATION
#define WEBCORE_EXPORT WTF_IMPORT_DECLARATION
#endif
#endif
@@ -51,10 +49,10 @@
#ifdef __cplusplus
#undef new
#undef delete
#include <wtf/FastMalloc.h>
#include "wtf/FastMalloc.h"
#endif
#include <wtf/DisallowCType.h>
#include "wtf/DisallowCType.h"
/* Disabling warning C4206: nonstandard extension used: translation unit is empty.
By design, we rely on #define flags to make some translation units empty.
@@ -64,9 +62,11 @@
#pragma warning(disable : 4206)
#endif
#ifdef USE_FOUNDATION
#include <CoreFoundation/CoreFoundation.h>
#ifndef WEBCORE_EXPORT
#define WEBCORE_EXPORT JS_EXPORT_PRIVATE
#endif
#include <JavaScriptCore/Heap.h>
#include <wtf/PlatformCallingConventions.h>
#include "wtf/PlatformCallingConventions.h"
#include "JavaScriptCore/Strong.h"
#include "JavaScriptCore/Weak.h"
#include "JavaScriptCore/WeakInlines.h"

View File

@@ -0,0 +1,114 @@
/*
* Copyright (C) 2016 Igalia S.L.
* Copyright (C) 2021 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. AND ITS CONTRIBUTORS ``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 ITS 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.
*/
#pragma once
#include "JavaScriptCore/ArrayBuffer.h"
#include "JavaScriptCore/ArrayBufferView.h"
#include "wtf/RefPtr.h"
#include <variant>
namespace WebCore {
class BufferSource {
public:
using VariantType = std::variant<RefPtr<JSC::ArrayBufferView>, RefPtr<JSC::ArrayBuffer>>;
BufferSource() {}
BufferSource(VariantType&& variant)
: m_variant(WTFMove(variant))
{
}
const VariantType& variant() const { return m_variant; }
const uint8_t* data() const
{
return std::visit([](auto& buffer) -> const uint8_t* {
return buffer ? static_cast<const uint8_t*>(buffer->data()) : nullptr;
},
m_variant);
}
void* mutableData() const
{
return std::visit([](auto& buffer) -> void* {
return buffer->data();
},
m_variant);
}
size_t length() const
{
return std::visit([](auto& buffer) -> size_t {
return buffer ? buffer->byteLength() : 0;
},
m_variant);
}
template<class Encoder> void encode(Encoder&) const;
template<class Decoder> static std::optional<BufferSource> decode(Decoder&);
private:
VariantType m_variant;
};
template<class Encoder>
void BufferSource::encode(Encoder& encoder) const
{
encoder << static_cast<uint64_t>(length());
if (!length())
return;
encoder.encodeFixedLengthData(data(), length() * sizeof(uint8_t), alignof(uint8_t));
}
template<class Decoder>
std::optional<BufferSource> BufferSource::decode(Decoder& decoder)
{
std::optional<uint64_t> size;
decoder >> size;
if (!size)
return std::nullopt;
if (!*size)
return BufferSource();
auto dataSize = CheckedSize { *size };
if (UNLIKELY(dataSize.hasOverflowed()))
return std::nullopt;
const uint8_t* data = decoder.decodeFixedLengthReference(dataSize, alignof(uint8_t));
if (!data)
return std::nullopt;
return BufferSource(JSC::ArrayBuffer::tryCreate(static_cast<const void*>(data), dataSize.value()));
}
inline BufferSource toBufferSource(const uint8_t* data, size_t length)
{
return BufferSource(JSC::ArrayBuffer::tryCreate(data, length));
}
} // namespace WebCore

View File

@@ -0,0 +1,874 @@
#pragma once
#include "root.h"
#include "wtf/FastMalloc.h"
#include "wtf/Noncopyable.h"
namespace WebCore {
using namespace JSC;
class DOMClientIsoSubspaces {
WTF_MAKE_NONCOPYABLE(DOMClientIsoSubspaces);
WTF_MAKE_FAST_ALLOCATED(DOMClientIsoSubspaces);
public:
DOMClientIsoSubspaces() = default;
std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForGlobalObject;
std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForDOMException;
std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForDOMFormData;
std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForDOMFormDataIterator;
std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForDOMURL;
std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForURLSearchParams;
std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForURLSearchParamsIterator;
std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForExposedToWorkerAndWindow;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForTouch;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForTouchEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForTouchList;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForInternalSettingsGenerated;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForGPU;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForGPUAdapter;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForGPUBindGroup;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForGPUBindGroupLayout;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForGPUBuffer;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForGPUBufferUsage;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForGPUCanvasContext;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForGPUColorWrite;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForGPUCommandBuffer;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForGPUCommandEncoder;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForGPUCompilationInfo;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForGPUCompilationMessage;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForGPUComputePassEncoder;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForGPUComputePipeline;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForGPUDevice;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForGPUDeviceLostInfo;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForGPUExternalTexture;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForGPUMapMode;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForGPUOutOfMemoryError;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForGPUPipelineLayout;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForGPUQuerySet;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForGPUQueue;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForGPURenderBundle;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForGPURenderBundleEncoder;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForGPURenderPassEncoder;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForGPURenderPipeline;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForGPUSampler;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForGPUShaderModule;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForGPUShaderStage;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForGPUSupportedFeatures;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForGPUSupportedLimits;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForGPUTexture;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForGPUTextureUsage;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForGPUTextureView;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForGPUUncapturedErrorEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForGPUValidationError;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWebKitPlaybackTargetAvailabilityEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForApplePayCancelEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForApplePayCouponCodeChangedEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForApplePayError;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForApplePayPaymentAuthorizedEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForApplePayPaymentMethodSelectedEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForApplePaySession;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForApplePaySetup;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForApplePaySetupFeature;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForApplePayShippingContactSelectedEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForApplePayShippingMethodSelectedEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForApplePayValidateMerchantEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForClipboard;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForClipboardItem;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForDOMCache;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForDOMCacheStorage;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForContactsManager;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForBasicCredential;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCredentialsContainer;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForMediaKeyMessageEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForMediaKeySession;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForMediaKeyStatusMap;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForMediaKeyStatusMapIterator;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForMediaKeySystemAccess;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForMediaKeys;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWebKitMediaKeyMessageEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWebKitMediaKeyNeededEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWebKitMediaKeySession;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWebKitMediaKeys;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForDOMFileSystem;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForFileSystemDirectoryEntry;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForFileSystemDirectoryReader;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForFileSystemEntry;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForFileSystemFileEntry;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForFetchHeaders;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForFetchHeadersIterator;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForFetchRequest;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForFetchResponse;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForFileSystemDirectoryHandle;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForFileSystemFileHandle;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForFileSystemHandle;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForFileSystemSyncAccessHandle;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForGamepad;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForGamepadButton;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForGamepadEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForGeolocation;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForGeolocationCoordinates;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForGeolocationPosition;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForGeolocationPositionError;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHighlight;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHighlightRegister;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForIDBCursor;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForIDBCursorWithValue;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForIDBDatabase;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForIDBFactory;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForIDBIndex;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForIDBKeyRange;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForIDBObjectStore;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForIDBOpenDBRequest;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForIDBRequest;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForIDBTransaction;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForIDBVersionChangeEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForMediaCapabilities;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForMediaControlsHost;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForBlobEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForMediaRecorder;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForMediaRecorderErrorEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForMediaMetadata;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForMediaSession;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForMediaSessionCoordinator;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForMediaSource;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSourceBuffer;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSourceBufferList;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForVideoPlaybackQuality;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCanvasCaptureMediaStreamTrack;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForMediaDeviceInfo;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForMediaDevices;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForMediaStream;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForMediaStreamTrack;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForMediaStreamTrackEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForOverconstrainedError;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForOverconstrainedErrorEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForRTCCertificate;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForRTCDTMFSender;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForRTCDTMFToneChangeEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForRTCDataChannel;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForRTCDataChannelEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForRTCDtlsTransport;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForRTCEncodedAudioFrame;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForRTCEncodedVideoFrame;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForRTCError;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForRTCErrorEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForRTCIceCandidate;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForRTCIceTransport;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForRTCPeerConnection;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForRTCPeerConnectionIceErrorEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForRTCPeerConnectionIceEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForRTCRtpReceiver;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForRTCRtpSFrameTransform;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForRTCRtpSFrameTransformErrorEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForRTCRtpScriptTransform;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForRTCRtpScriptTransformer;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForRTCRtpSender;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForRTCRtpTransceiver;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForRTCSctpTransport;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForRTCSessionDescription;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForRTCStatsReport;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForRTCTrackEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForRTCTransformEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLModelElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForNotification;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForNotificationEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForMerchantValidationEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForPaymentAddress;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForPaymentMethodChangeEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForPaymentRequest;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForPaymentRequestUpdateEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForPaymentResponse;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForPermissionStatus;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForPermissions;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForPictureInPictureEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForPictureInPictureWindow;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForPushEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForPushManager;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForPushMessageData;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForPushSubscription;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForPushSubscriptionChangeEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForPushSubscriptionOptions;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForRemotePlayback;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSpeechRecognition;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSpeechRecognitionAlternative;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSpeechRecognitionErrorEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSpeechRecognitionEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSpeechRecognitionResult;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSpeechRecognitionResultList;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSpeechSynthesis;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSpeechSynthesisErrorEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSpeechSynthesisEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSpeechSynthesisUtterance;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSpeechSynthesisVoice;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForStorageManager;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForByteLengthQueuingStrategy;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCountQueuingStrategy;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForReadableByteStreamController;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForReadableStream;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForReadableStreamBYOBReader;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForReadableStreamBYOBRequest;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForReadableStreamDefaultController;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForReadableStreamDefaultReader;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForReadableStreamSink;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForReadableStreamSource;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForTransformStream;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForTransformStreamDefaultController;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWritableStream;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWritableStreamDefaultController;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWritableStreamDefaultWriter;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWritableStreamSink;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWebLock;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWebLockManager;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForAnalyserNode;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForAudioBuffer;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForAudioBufferSourceNode;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForAudioContext;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForAudioDestinationNode;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForAudioListener;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForAudioNode;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForAudioParam;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForAudioParamMap;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForAudioProcessingEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForAudioScheduledSourceNode;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForAudioWorklet;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForAudioWorkletGlobalScope;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForAudioWorkletNode;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForAudioWorkletProcessor;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForBaseAudioContext;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForBiquadFilterNode;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForChannelMergerNode;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForChannelSplitterNode;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForConstantSourceNode;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForConvolverNode;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForDelayNode;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForDynamicsCompressorNode;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForGainNode;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForIIRFilterNode;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForMediaElementAudioSourceNode;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForMediaStreamAudioDestinationNode;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForMediaStreamAudioSourceNode;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForOfflineAudioCompletionEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForOfflineAudioContext;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForOscillatorNode;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForPannerNode;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForPeriodicWave;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForScriptProcessorNode;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForStereoPannerNode;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWaveShaperNode;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForAuthenticatorAssertionResponse;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForAuthenticatorAttestationResponse;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForAuthenticatorResponse;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForPublicKeyCredential;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForVideoColorSpace;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForDatabase;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSQLError;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSQLResultSet;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSQLResultSetRowList;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSQLTransaction;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCloseEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWebSocket;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWebXRBoundedReferenceSpace;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWebXRFrame;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWebXRHand;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWebXRHandIterator;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWebXRInputSource;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWebXRInputSourceArray;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWebXRInputSourceArrayIterator;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWebXRJointPose;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWebXRJointSpace;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWebXRLayer;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWebXRPose;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWebXRReferenceSpace;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWebXRRenderState;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWebXRRigidTransform;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWebXRSession;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWebXRSpace;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWebXRSystem;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWebXRView;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWebXRViewerPose;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWebXRViewport;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWebXRWebGLLayer;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForXRInputSourceEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForXRInputSourcesChangeEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForXRReferenceSpaceEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForXRSessionEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForAnimationEffect;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForAnimationPlaybackEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForAnimationTimeline;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCSSAnimation;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCSSTransition;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCustomEffect;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForDocumentTimeline;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForKeyframeEffect;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWebAnimation;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCryptoKey;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSubtleCrypto;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCSSConditionRule;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCSSCounterStyleRule;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCSSFontFaceRule;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCSSFontPaletteValuesRule;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCSSGroupingRule;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCSSImportRule;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCSSKeyframeRule;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCSSKeyframesRule;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCSSLayerBlockRule;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCSSLayerStatementRule;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCSSMediaRule;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCSSNamespaceRule;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCSSPageRule;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCSSPaintSize;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCSSRule;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCSSRuleList;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCSSStyleDeclaration;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCSSStyleRule;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCSSStyleSheet;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCSSSupportsRule;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCSSUnknownRule;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForDOMCSSNamespace;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForDOMMatrix;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForDOMMatrixReadOnly;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForDeprecatedCSSOMCounter;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForDeprecatedCSSOMPrimitiveValue;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForDeprecatedCSSOMRGBColor;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForDeprecatedCSSOMRect;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForDeprecatedCSSOMValue;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForDeprecatedCSSOMValueList;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForFontFace;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForFontFaceSet;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForFontFaceSetIterator;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForMediaList;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForMediaQueryList;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForMediaQueryListEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForStyleMedia;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForStyleSheet;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForStyleSheetList;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCSSKeywordValue;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCSSNumericValue;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCSSOMVariableReferenceValue;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCSSStyleImageValue;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCSSStyleValue;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCSSUnitValue;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCSSUnparsedValue;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCSSUnparsedValueIterator;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForStylePropertyMap;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForStylePropertyMapReadOnly;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCSSMathInvert;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCSSMathMax;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCSSMathMin;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCSSMathNegate;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCSSMathProduct;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCSSMathSum;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCSSMathValue;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCSSNumericArray;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCSSNumericArrayIterator;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCSSMatrixComponent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCSSPerspective;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCSSRotate;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCSSScale;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCSSSkew;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCSSSkewX;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCSSSkewY;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCSSTransformComponent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCSSTransformValue;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCSSTransformValueIterator;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCSSTranslate;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForAbortController;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForAbortSignal;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForAbstractRange;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForAnimationEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForAttr;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForBeforeUnloadEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForBroadcastChannel;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCDATASection;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCharacterData;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForClipboardEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForComment;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCompositionEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCustomElementRegistry;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCustomEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForDOMException;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForDOMImplementation;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForDOMPoint;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForDOMPointReadOnly;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForDOMQuad;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForDOMRect;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForDOMRectList;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForDOMRectReadOnly;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForDOMStringList;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForDOMStringMap;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForDataTransfer;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForDataTransferItem;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForDataTransferItemList;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForDeviceMotionEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForDeviceOrientationEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForDocument;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForDocumentFragment;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForDocumentType;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForDragEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForErrorEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForEventListener;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForEventTarget;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForFocusEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForFormDataEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHashChangeEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForIdleDeadline;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForInputEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForKeyboardEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForMessageChannel;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForMessageEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForMessagePort;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForMouseEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForMutationEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForMutationObserver;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForMutationRecord;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForNamedNodeMap;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForNode;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForNodeIterator;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForNodeList;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForNodeListIterator;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForOverflowEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForPageTransitionEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForPointerEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForPopStateEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForProcessingInstruction;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForProgressEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForPromiseRejectionEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForRange;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSecurityPolicyViolationEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForShadowRoot;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForStaticRange;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForText;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForTextDecoder;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForTextDecoderStream;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForTextDecoderStreamDecoder;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForTextEncoder;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForTextEncoderStream;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForTextEncoderStreamEncoder;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForTextEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForTransitionEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForTreeWalker;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForUIEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWheelEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForXMLDocument;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForBlob;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForFile;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForFileList;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForFileReader;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForFileReaderSync;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForDOMFormData;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForDOMFormDataIterator;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForDOMTokenList;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForDOMTokenListIterator;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForDOMURL;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLAllCollection;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLAnchorElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLAreaElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLAttachmentElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLAudioElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLBRElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLBaseElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLBodyElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLButtonElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLCanvasElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLCollection;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLDListElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLDataElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLDataListElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLDetailsElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLDialogElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLDirectoryElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLDivElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLDocument;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLEmbedElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLFieldSetElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLFontElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLFormControlsCollection;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLFormElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLFrameElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLFrameSetElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLHRElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLHeadElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLHeadingElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLHtmlElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLIFrameElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLImageElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLInputElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLLIElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLLabelElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLLegendElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLLinkElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLMapElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLMarqueeElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLMediaElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLMenuElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLMenuItemElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLMetaElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLMeterElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLModElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLOListElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLObjectElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLOptGroupElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLOptionElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLOptionsCollection;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLOutputElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLParagraphElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLParamElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLPictureElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLPreElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLProgressElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLQuoteElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLScriptElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLSelectElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLSlotElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLSourceElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLSpanElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLStyleElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLTableCaptionElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLTableCellElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLTableColElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLTableElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLTableRowElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLTableSectionElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLTemplateElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLTextAreaElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLTimeElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLTitleElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLTrackElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLUListElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLUnknownElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHTMLVideoElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForImageBitmap;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForImageData;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForMediaController;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForMediaEncryptedEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForMediaError;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForOffscreenCanvas;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForRadioNodeList;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSubmitEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForTextMetrics;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForTimeRanges;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForURLSearchParams;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForURLSearchParamsIterator;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForValidityState;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWebKitMediaKeyError;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForANGLEInstancedArrays;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCanvasGradient;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCanvasPattern;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCanvasRenderingContext2D;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForEXTBlendMinMax;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForEXTColorBufferFloat;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForEXTColorBufferHalfFloat;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForEXTFloatBlend;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForEXTFragDepth;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForEXTShaderTextureLOD;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForEXTTextureCompressionRGTC;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForEXTTextureFilterAnisotropic;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForEXTsRGB;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForImageBitmapRenderingContext;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForKHRParallelShaderCompile;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForOESElementIndexUint;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForOESFBORenderMipmap;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForOESStandardDerivatives;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForOESTextureFloat;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForOESTextureFloatLinear;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForOESTextureHalfFloat;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForOESTextureHalfFloatLinear;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForOESVertexArrayObject;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForOffscreenCanvasRenderingContext2D;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForPaintRenderingContext2D;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForPath2D;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWebGL2RenderingContext;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWebGLActiveInfo;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWebGLBuffer;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWebGLColorBufferFloat;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWebGLCompressedTextureASTC;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWebGLCompressedTextureATC;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWebGLCompressedTextureETC;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWebGLCompressedTextureETC1;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWebGLCompressedTexturePVRTC;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWebGLCompressedTextureS3TC;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWebGLCompressedTextureS3TCsRGB;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWebGLContextEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWebGLDebugRendererInfo;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWebGLDebugShaders;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWebGLDepthTexture;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWebGLDrawBuffers;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWebGLFramebuffer;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWebGLLoseContext;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWebGLMultiDraw;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWebGLProgram;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWebGLQuery;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWebGLRenderbuffer;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWebGLRenderingContext;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWebGLSampler;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWebGLShader;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWebGLShaderPrecisionFormat;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWebGLSync;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWebGLTexture;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWebGLTransformFeedback;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWebGLUniformLocation;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWebGLVertexArrayObject;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWebGLVertexArrayObjectOES;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForAudioTrack;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForAudioTrackConfiguration;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForAudioTrackList;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForDataCue;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForTextTrack;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForTextTrackCue;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForTextTrackCueGeneric;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForTextTrackCueList;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForTextTrackList;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForTrackEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForVTTCue;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForVTTRegion;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForVTTRegionList;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForVideoTrack;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForVideoTrackConfiguration;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForVideoTrackList;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCommandLineAPIHost;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForInspectorAuditAccessibilityObject;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForInspectorAuditDOMObject;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForInspectorAuditResourcesObject;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForInspectorFrontendHost;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForDOMApplicationCache;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForMathMLElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForMathMLMathElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForBarProp;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCrypto;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForDOMSelection;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForDOMWindow;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForEventSource;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForHistory;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForIntersectionObserver;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForIntersectionObserverEntry;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForLocation;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForNavigator;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForPerformance;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForPerformanceEntry;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForPerformanceMark;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForPerformanceMeasure;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForPerformanceNavigation;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForPerformanceNavigationTiming;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForPerformanceObserver;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForPerformanceObserverEntryList;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForPerformancePaintTiming;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForPerformanceResourceTiming;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForPerformanceServerTiming;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForPerformanceTiming;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForRemoteDOMWindow;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForResizeObserver;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForResizeObserverEntry;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForResizeObserverSize;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForScreen;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForShadowRealmGlobalScope;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForUndoItem;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForUndoManager;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForUserMessageHandler;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForUserMessageHandlersNamespace;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForVisualViewport;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWebKitNamespace;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWebKitPoint;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWorkerNavigator;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForDOMMimeType;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForDOMMimeTypeArray;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForDOMPlugin;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForDOMPluginArray;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForStorage;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForStorageEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGAElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGAltGlyphDefElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGAltGlyphElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGAltGlyphItemElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGAngle;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGAnimateColorElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGAnimateElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGAnimateMotionElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGAnimateTransformElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGAnimatedAngle;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGAnimatedBoolean;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGAnimatedEnumeration;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGAnimatedInteger;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGAnimatedLength;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGAnimatedLengthList;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGAnimatedNumber;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGAnimatedNumberList;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGAnimatedPreserveAspectRatio;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGAnimatedRect;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGAnimatedString;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGAnimatedTransformList;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGAnimationElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGCircleElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGClipPathElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGComponentTransferFunctionElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGCursorElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGDefsElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGDescElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGEllipseElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGFEBlendElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGFEColorMatrixElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGFEComponentTransferElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGFECompositeElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGFEConvolveMatrixElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGFEDiffuseLightingElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGFEDisplacementMapElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGFEDistantLightElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGFEDropShadowElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGFEFloodElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGFEFuncAElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGFEFuncBElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGFEFuncGElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGFEFuncRElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGFEGaussianBlurElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGFEImageElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGFEMergeElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGFEMergeNodeElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGFEMorphologyElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGFEOffsetElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGFEPointLightElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGFESpecularLightingElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGFESpotLightElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGFETileElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGFETurbulenceElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGFilterElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGFontElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGFontFaceElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGFontFaceFormatElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGFontFaceNameElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGFontFaceSrcElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGFontFaceUriElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGForeignObjectElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGGElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGGeometryElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGGlyphElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGGlyphRefElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGGradientElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGGraphicsElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGHKernElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGImageElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGLength;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGLengthList;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGLineElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGLinearGradientElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGMPathElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGMarkerElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGMaskElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGMatrix;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGMetadataElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGMissingGlyphElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGNumber;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGNumberList;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGPathElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGPathSeg;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGPathSegArcAbs;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGPathSegArcRel;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGPathSegClosePath;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGPathSegCurvetoCubicAbs;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGPathSegCurvetoCubicRel;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGPathSegCurvetoCubicSmoothAbs;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGPathSegCurvetoCubicSmoothRel;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGPathSegCurvetoQuadraticAbs;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGPathSegCurvetoQuadraticRel;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGPathSegCurvetoQuadraticSmoothAbs;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGPathSegCurvetoQuadraticSmoothRel;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGPathSegLinetoAbs;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGPathSegLinetoHorizontalAbs;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGPathSegLinetoHorizontalRel;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGPathSegLinetoRel;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGPathSegLinetoVerticalAbs;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGPathSegLinetoVerticalRel;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGPathSegList;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGPathSegMovetoAbs;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGPathSegMovetoRel;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGPatternElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGPoint;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGPointList;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGPolygonElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGPolylineElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGPreserveAspectRatio;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGRadialGradientElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGRect;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGRectElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGRenderingIntent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGSVGElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGScriptElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGSetElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGStopElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGStringList;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGStyleElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGSwitchElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGSymbolElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGTRefElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGTSpanElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGTextContentElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGTextElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGTextPathElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGTextPositioningElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGTitleElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGTransform;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGTransformList;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGUnitTypes;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGUseElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGVKernElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGViewElement;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGViewSpec;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSVGZoomEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForGCObservation;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForInternalSettings;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForInternals;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForInternalsMapLike;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForInternalsSetLike;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForMallocStatistics;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForMemoryInfo;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForMockCDMFactory;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForMockContentFilterSettings;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForMockPageOverlay;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForMockPaymentCoordinator;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForServiceWorkerInternals;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForTypeConversions;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWebFakeXRDevice;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWebFakeXRInputController;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWebXRTest;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForDedicatedWorkerGlobalScope;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWorker;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWorkerGlobalScope;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWorkerLocation;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForExtendableEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForExtendableMessageEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForFetchEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForNavigationPreloadManager;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForServiceWorker;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForServiceWorkerClient;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForServiceWorkerClients;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForServiceWorkerContainer;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForServiceWorkerGlobalScope;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForServiceWorkerRegistration;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForServiceWorkerWindowClient;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSharedWorker;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSharedWorkerGlobalScope;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForPaintWorkletGlobalScope;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWorklet;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWorkletGlobalScope;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForDOMParser;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForXMLHttpRequest;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForXMLHttpRequestEventTarget;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForXMLHttpRequestProgressEvent;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForXMLHttpRequestUpload;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForXMLSerializer;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForXPathEvaluator;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForXPathExpression;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForXPathNSResolver;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForXPathResult;
// std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForXSLTProcessor;
};
} // namespace WebCore

View File

@@ -0,0 +1,864 @@
#include "JavaScriptCore/JSCInlines.h"
#include "wtf/FastMalloc.h"
#include "wtf/Noncopyable.h"
#pragma once
namespace WebCore {
enum class DOMConstructorID : uint16_t {
Touch,
TouchEvent,
TouchList,
InternalSettingsGenerated,
GPU,
GPUAdapter,
GPUBindGroup,
GPUBindGroupLayout,
GPUBuffer,
GPUBufferUsage,
GPUCanvasContext,
GPUColorWrite,
GPUCommandBuffer,
GPUCommandEncoder,
GPUCompilationInfo,
GPUCompilationMessage,
GPUComputePassEncoder,
GPUComputePipeline,
GPUDevice,
GPUDeviceLostInfo,
GPUExternalTexture,
GPUMapMode,
GPUOutOfMemoryError,
GPUPipelineLayout,
GPUQuerySet,
GPUQueue,
GPURenderBundle,
GPURenderBundleEncoder,
GPURenderPassEncoder,
GPURenderPipeline,
GPUSampler,
GPUShaderModule,
GPUShaderStage,
GPUSupportedFeatures,
GPUSupportedLimits,
GPUTexture,
GPUTextureUsage,
GPUTextureView,
GPUUncapturedErrorEvent,
GPUValidationError,
WebKitPlaybackTargetAvailabilityEvent,
ApplePayCancelEvent,
ApplePayCouponCodeChangedEvent,
ApplePayError,
ApplePayPaymentAuthorizedEvent,
ApplePayPaymentMethodSelectedEvent,
ApplePaySession,
ApplePaySetup,
ApplePaySetupFeature,
ApplePayShippingContactSelectedEvent,
ApplePayShippingMethodSelectedEvent,
ApplePayValidateMerchantEvent,
Clipboard,
ClipboardItem,
DOMCache,
DOMCacheStorage,
ContactsManager,
BasicCredential,
CredentialsContainer,
MediaKeyMessageEvent,
MediaKeySession,
MediaKeyStatusMap,
MediaKeySystemAccess,
MediaKeys,
WebKitMediaKeyMessageEvent,
WebKitMediaKeyNeededEvent,
WebKitMediaKeySession,
WebKitMediaKeys,
DOMFileSystem,
FileSystemDirectoryEntry,
FileSystemDirectoryReader,
FileSystemEntry,
FileSystemFileEntry,
FetchHeaders,
FetchRequest,
FetchResponse,
FileSystemDirectoryHandle,
FileSystemFileHandle,
FileSystemHandle,
FileSystemSyncAccessHandle,
Gamepad,
GamepadButton,
GamepadEvent,
Geolocation,
GeolocationCoordinates,
GeolocationPosition,
GeolocationPositionError,
Highlight,
HighlightRegister,
IDBCursor,
IDBCursorWithValue,
IDBDatabase,
IDBFactory,
IDBIndex,
IDBKeyRange,
IDBObjectStore,
IDBOpenDBRequest,
IDBRequest,
IDBTransaction,
IDBVersionChangeEvent,
MediaCapabilities,
MediaControlsHost,
BlobEvent,
MediaRecorder,
MediaRecorderErrorEvent,
MediaMetadata,
MediaSession,
MediaSessionCoordinator,
MediaSource,
SourceBuffer,
SourceBufferList,
VideoPlaybackQuality,
CanvasCaptureMediaStreamTrack,
MediaDeviceInfo,
MediaDevices,
MediaStream,
MediaStreamTrack,
MediaStreamTrackEvent,
OverconstrainedError,
OverconstrainedErrorEvent,
RTCCertificate,
RTCDTMFSender,
RTCDTMFToneChangeEvent,
RTCDataChannel,
RTCDataChannelEvent,
RTCDtlsTransport,
RTCEncodedAudioFrame,
RTCEncodedVideoFrame,
RTCError,
RTCErrorEvent,
RTCIceCandidate,
RTCIceTransport,
RTCPeerConnection,
RTCPeerConnectionIceErrorEvent,
RTCPeerConnectionIceEvent,
RTCRtpReceiver,
RTCRtpSFrameTransform,
RTCRtpSFrameTransformErrorEvent,
RTCRtpScriptTransform,
RTCRtpScriptTransformer,
RTCRtpSender,
RTCRtpTransceiver,
RTCSctpTransport,
RTCSessionDescription,
RTCStatsReport,
RTCTrackEvent,
RTCTransformEvent,
HTMLModelElement,
Notification,
NotificationEvent,
MerchantValidationEvent,
PaymentAddress,
PaymentMethodChangeEvent,
PaymentRequest,
PaymentRequestUpdateEvent,
PaymentResponse,
PermissionStatus,
Permissions,
PictureInPictureEvent,
PictureInPictureWindow,
PushEvent,
PushManager,
PushMessageData,
PushSubscription,
PushSubscriptionChangeEvent,
PushSubscriptionOptions,
RemotePlayback,
SpeechRecognition,
SpeechRecognitionAlternative,
SpeechRecognitionErrorEvent,
SpeechRecognitionEvent,
SpeechRecognitionResult,
SpeechRecognitionResultList,
SpeechSynthesis,
SpeechSynthesisErrorEvent,
SpeechSynthesisEvent,
SpeechSynthesisUtterance,
SpeechSynthesisVoice,
StorageManager,
ByteLengthQueuingStrategy,
CountQueuingStrategy,
ReadableByteStreamController,
ReadableStream,
ReadableStreamBYOBReader,
ReadableStreamBYOBRequest,
ReadableStreamDefaultController,
ReadableStreamDefaultReader,
ReadableStreamSink,
ReadableStreamSource,
TransformStream,
TransformStreamDefaultController,
WritableStream,
WritableStreamDefaultController,
WritableStreamDefaultWriter,
WritableStreamSink,
WebLock,
WebLockManager,
AnalyserNode,
AudioBuffer,
AudioBufferSourceNode,
AudioContext,
AudioDestinationNode,
AudioListener,
AudioNode,
AudioParam,
AudioParamMap,
AudioProcessingEvent,
AudioScheduledSourceNode,
AudioWorklet,
AudioWorkletGlobalScope,
AudioWorkletNode,
AudioWorkletProcessor,
BaseAudioContext,
BiquadFilterNode,
ChannelMergerNode,
ChannelSplitterNode,
ConstantSourceNode,
ConvolverNode,
DelayNode,
DynamicsCompressorNode,
GainNode,
IIRFilterNode,
MediaElementAudioSourceNode,
MediaStreamAudioDestinationNode,
MediaStreamAudioSourceNode,
OfflineAudioCompletionEvent,
OfflineAudioContext,
OscillatorNode,
PannerNode,
PeriodicWave,
ScriptProcessorNode,
StereoPannerNode,
WaveShaperNode,
AuthenticatorAssertionResponse,
AuthenticatorAttestationResponse,
AuthenticatorResponse,
PublicKeyCredential,
VideoColorSpace,
Database,
SQLError,
SQLResultSet,
SQLResultSetRowList,
SQLTransaction,
CloseEvent,
WebSocket,
WebXRBoundedReferenceSpace,
WebXRFrame,
WebXRHand,
WebXRInputSource,
WebXRInputSourceArray,
WebXRJointPose,
WebXRJointSpace,
WebXRLayer,
WebXRPose,
WebXRReferenceSpace,
WebXRRenderState,
WebXRRigidTransform,
WebXRSession,
WebXRSpace,
WebXRSystem,
WebXRView,
WebXRViewerPose,
WebXRViewport,
WebXRWebGLLayer,
XRInputSourceEvent,
XRInputSourcesChangeEvent,
XRReferenceSpaceEvent,
XRSessionEvent,
AnimationEffect,
AnimationPlaybackEvent,
AnimationTimeline,
CSSAnimation,
CSSTransition,
CustomEffect,
DocumentTimeline,
KeyframeEffect,
WebAnimation,
CryptoKey,
SubtleCrypto,
CSSConditionRule,
CSSCounterStyleRule,
CSSFontFaceRule,
CSSFontPaletteValuesRule,
CSSGroupingRule,
CSSImportRule,
CSSKeyframeRule,
CSSKeyframesRule,
CSSLayerBlockRule,
CSSLayerStatementRule,
CSSMediaRule,
CSSNamespaceRule,
CSSPageRule,
CSSPaintSize,
CSSRule,
CSSRuleList,
CSSStyleDeclaration,
CSSStyleRule,
CSSStyleSheet,
CSSSupportsRule,
CSSUnknownRule,
DOMCSSNamespace,
DOMMatrix,
DOMMatrixReadOnly,
DeprecatedCSSOMCounter,
DeprecatedCSSOMPrimitiveValue,
DeprecatedCSSOMRGBColor,
DeprecatedCSSOMRect,
DeprecatedCSSOMValue,
DeprecatedCSSOMValueList,
FontFace,
FontFaceSet,
MediaList,
MediaQueryList,
MediaQueryListEvent,
StyleMedia,
StyleSheet,
StyleSheetList,
CSSKeywordValue,
CSSNumericValue,
CSSOMVariableReferenceValue,
CSSStyleImageValue,
CSSStyleValue,
CSSUnitValue,
CSSUnparsedValue,
StylePropertyMap,
StylePropertyMapReadOnly,
CSSMathInvert,
CSSMathMax,
CSSMathMin,
CSSMathNegate,
CSSMathProduct,
CSSMathSum,
CSSMathValue,
CSSNumericArray,
CSSMatrixComponent,
CSSPerspective,
CSSRotate,
CSSScale,
CSSSkew,
CSSSkewX,
CSSSkewY,
CSSTransformComponent,
CSSTransformValue,
CSSTranslate,
AbortController,
AbortSignal,
AbstractRange,
AnimationEvent,
Attr,
BeforeUnloadEvent,
BroadcastChannel,
CDATASection,
CharacterData,
ClipboardEvent,
Comment,
CompositionEvent,
CustomElementRegistry,
CustomEvent,
DOMException,
DOMImplementation,
DOMPoint,
DOMPointReadOnly,
DOMQuad,
DOMRect,
DOMRectList,
DOMRectReadOnly,
DOMStringList,
DOMStringMap,
DataTransfer,
DataTransferItem,
DataTransferItemList,
DeviceMotionEvent,
DeviceOrientationEvent,
Document,
DocumentFragment,
DocumentType,
DragEvent,
Element,
ErrorEvent,
Event,
EventListener,
EventTarget,
FocusEvent,
FormDataEvent,
HashChangeEvent,
IdleDeadline,
InputEvent,
KeyboardEvent,
MessageChannel,
MessageEvent,
MessagePort,
MouseEvent,
MutationEvent,
MutationObserver,
MutationRecord,
NamedNodeMap,
Node,
NodeFilter,
NodeIterator,
NodeList,
OverflowEvent,
PageTransitionEvent,
PointerEvent,
PopStateEvent,
ProcessingInstruction,
ProgressEvent,
PromiseRejectionEvent,
Range,
SecurityPolicyViolationEvent,
ShadowRoot,
StaticRange,
Text,
TextDecoder,
TextDecoderStream,
TextDecoderStreamDecoder,
TextEncoder,
TextEncoderStream,
TextEncoderStreamEncoder,
TextEvent,
TransitionEvent,
TreeWalker,
UIEvent,
WheelEvent,
XMLDocument,
Blob,
File,
FileList,
FileReader,
FileReaderSync,
DOMFormData,
DOMTokenList,
DOMURL,
HTMLAllCollection,
HTMLAnchorElement,
HTMLAreaElement,
HTMLAttachmentElement,
HTMLAudioElement,
HTMLAudioElementLegacyFactory,
HTMLBRElement,
HTMLBaseElement,
HTMLBodyElement,
HTMLButtonElement,
HTMLCanvasElement,
HTMLCollection,
HTMLDListElement,
HTMLDataElement,
HTMLDataListElement,
HTMLDetailsElement,
HTMLDialogElement,
HTMLDirectoryElement,
HTMLDivElement,
HTMLDocument,
HTMLElement,
HTMLEmbedElement,
HTMLFieldSetElement,
HTMLFontElement,
HTMLFormControlsCollection,
HTMLFormElement,
HTMLFrameElement,
HTMLFrameSetElement,
HTMLHRElement,
HTMLHeadElement,
HTMLHeadingElement,
HTMLHtmlElement,
HTMLIFrameElement,
HTMLImageElement,
HTMLImageElementLegacyFactory,
HTMLInputElement,
HTMLLIElement,
HTMLLabelElement,
HTMLLegendElement,
HTMLLinkElement,
HTMLMapElement,
HTMLMarqueeElement,
HTMLMediaElement,
HTMLMenuElement,
HTMLMenuItemElement,
HTMLMetaElement,
HTMLMeterElement,
HTMLModElement,
HTMLOListElement,
HTMLObjectElement,
HTMLOptGroupElement,
HTMLOptionElement,
HTMLOptionElementLegacyFactory,
HTMLOptionsCollection,
HTMLOutputElement,
HTMLParagraphElement,
HTMLParamElement,
HTMLPictureElement,
HTMLPreElement,
HTMLProgressElement,
HTMLQuoteElement,
HTMLScriptElement,
HTMLSelectElement,
HTMLSlotElement,
HTMLSourceElement,
HTMLSpanElement,
HTMLStyleElement,
HTMLTableCaptionElement,
HTMLTableCellElement,
HTMLTableColElement,
HTMLTableElement,
HTMLTableRowElement,
HTMLTableSectionElement,
HTMLTemplateElement,
HTMLTextAreaElement,
HTMLTimeElement,
HTMLTitleElement,
HTMLTrackElement,
HTMLUListElement,
HTMLUnknownElement,
HTMLVideoElement,
ImageBitmap,
ImageData,
MediaController,
MediaEncryptedEvent,
MediaError,
OffscreenCanvas,
RadioNodeList,
SubmitEvent,
TextMetrics,
TimeRanges,
URLSearchParams,
ValidityState,
WebKitMediaKeyError,
ANGLEInstancedArrays,
CanvasGradient,
CanvasPattern,
CanvasRenderingContext2D,
EXTBlendMinMax,
EXTColorBufferFloat,
EXTColorBufferHalfFloat,
EXTFloatBlend,
EXTFragDepth,
EXTShaderTextureLOD,
EXTTextureCompressionRGTC,
EXTTextureFilterAnisotropic,
EXTsRGB,
ImageBitmapRenderingContext,
KHRParallelShaderCompile,
OESElementIndexUint,
OESFBORenderMipmap,
OESStandardDerivatives,
OESTextureFloat,
OESTextureFloatLinear,
OESTextureHalfFloat,
OESTextureHalfFloatLinear,
OESVertexArrayObject,
OffscreenCanvasRenderingContext2D,
PaintRenderingContext2D,
Path2D,
WebGL2RenderingContext,
WebGLActiveInfo,
WebGLBuffer,
WebGLColorBufferFloat,
WebGLCompressedTextureASTC,
WebGLCompressedTextureATC,
WebGLCompressedTextureETC,
WebGLCompressedTextureETC1,
WebGLCompressedTexturePVRTC,
WebGLCompressedTextureS3TC,
WebGLCompressedTextureS3TCsRGB,
WebGLContextEvent,
WebGLDebugRendererInfo,
WebGLDebugShaders,
WebGLDepthTexture,
WebGLDrawBuffers,
WebGLFramebuffer,
WebGLLoseContext,
WebGLMultiDraw,
WebGLProgram,
WebGLQuery,
WebGLRenderbuffer,
WebGLRenderingContext,
WebGLSampler,
WebGLShader,
WebGLShaderPrecisionFormat,
WebGLSync,
WebGLTexture,
WebGLTransformFeedback,
WebGLUniformLocation,
WebGLVertexArrayObject,
WebGLVertexArrayObjectOES,
AudioTrack,
AudioTrackConfiguration,
AudioTrackList,
DataCue,
TextTrack,
TextTrackCue,
TextTrackCueGeneric,
TextTrackCueList,
TextTrackList,
TrackEvent,
VTTCue,
VTTRegion,
VTTRegionList,
VideoTrack,
VideoTrackConfiguration,
VideoTrackList,
CommandLineAPIHost,
InspectorAuditAccessibilityObject,
InspectorAuditDOMObject,
InspectorAuditResourcesObject,
InspectorFrontendHost,
DOMApplicationCache,
MathMLElement,
MathMLMathElement,
BarProp,
Crypto,
DOMSelection,
DOMWindow,
EventSource,
History,
IntersectionObserver,
IntersectionObserverEntry,
Location,
Navigator,
Performance,
PerformanceEntry,
PerformanceMark,
PerformanceMeasure,
PerformanceNavigation,
PerformanceNavigationTiming,
PerformanceObserver,
PerformanceObserverEntryList,
PerformancePaintTiming,
PerformanceResourceTiming,
PerformanceServerTiming,
PerformanceTiming,
RemoteDOMWindow,
ResizeObserver,
ResizeObserverEntry,
ResizeObserverSize,
Screen,
ShadowRealmGlobalScope,
UndoItem,
UndoManager,
UserMessageHandler,
UserMessageHandlersNamespace,
VisualViewport,
WebKitNamespace,
WebKitPoint,
WorkerNavigator,
DOMMimeType,
DOMMimeTypeArray,
DOMPlugin,
DOMPluginArray,
Storage,
StorageEvent,
SVGAElement,
SVGAltGlyphDefElement,
SVGAltGlyphElement,
SVGAltGlyphItemElement,
SVGAngle,
SVGAnimateColorElement,
SVGAnimateElement,
SVGAnimateMotionElement,
SVGAnimateTransformElement,
SVGAnimatedAngle,
SVGAnimatedBoolean,
SVGAnimatedEnumeration,
SVGAnimatedInteger,
SVGAnimatedLength,
SVGAnimatedLengthList,
SVGAnimatedNumber,
SVGAnimatedNumberList,
SVGAnimatedPreserveAspectRatio,
SVGAnimatedRect,
SVGAnimatedString,
SVGAnimatedTransformList,
SVGAnimationElement,
SVGCircleElement,
SVGClipPathElement,
SVGComponentTransferFunctionElement,
SVGCursorElement,
SVGDefsElement,
SVGDescElement,
SVGElement,
SVGEllipseElement,
SVGFEBlendElement,
SVGFEColorMatrixElement,
SVGFEComponentTransferElement,
SVGFECompositeElement,
SVGFEConvolveMatrixElement,
SVGFEDiffuseLightingElement,
SVGFEDisplacementMapElement,
SVGFEDistantLightElement,
SVGFEDropShadowElement,
SVGFEFloodElement,
SVGFEFuncAElement,
SVGFEFuncBElement,
SVGFEFuncGElement,
SVGFEFuncRElement,
SVGFEGaussianBlurElement,
SVGFEImageElement,
SVGFEMergeElement,
SVGFEMergeNodeElement,
SVGFEMorphologyElement,
SVGFEOffsetElement,
SVGFEPointLightElement,
SVGFESpecularLightingElement,
SVGFESpotLightElement,
SVGFETileElement,
SVGFETurbulenceElement,
SVGFilterElement,
SVGFontElement,
SVGFontFaceElement,
SVGFontFaceFormatElement,
SVGFontFaceNameElement,
SVGFontFaceSrcElement,
SVGFontFaceUriElement,
SVGForeignObjectElement,
SVGGElement,
SVGGeometryElement,
SVGGlyphElement,
SVGGlyphRefElement,
SVGGradientElement,
SVGGraphicsElement,
SVGHKernElement,
SVGImageElement,
SVGLength,
SVGLengthList,
SVGLineElement,
SVGLinearGradientElement,
SVGMPathElement,
SVGMarkerElement,
SVGMaskElement,
SVGMatrix,
SVGMetadataElement,
SVGMissingGlyphElement,
SVGNumber,
SVGNumberList,
SVGPathElement,
SVGPathSeg,
SVGPathSegArcAbs,
SVGPathSegArcRel,
SVGPathSegClosePath,
SVGPathSegCurvetoCubicAbs,
SVGPathSegCurvetoCubicRel,
SVGPathSegCurvetoCubicSmoothAbs,
SVGPathSegCurvetoCubicSmoothRel,
SVGPathSegCurvetoQuadraticAbs,
SVGPathSegCurvetoQuadraticRel,
SVGPathSegCurvetoQuadraticSmoothAbs,
SVGPathSegCurvetoQuadraticSmoothRel,
SVGPathSegLinetoAbs,
SVGPathSegLinetoHorizontalAbs,
SVGPathSegLinetoHorizontalRel,
SVGPathSegLinetoRel,
SVGPathSegLinetoVerticalAbs,
SVGPathSegLinetoVerticalRel,
SVGPathSegList,
SVGPathSegMovetoAbs,
SVGPathSegMovetoRel,
SVGPatternElement,
SVGPoint,
SVGPointList,
SVGPolygonElement,
SVGPolylineElement,
SVGPreserveAspectRatio,
SVGRadialGradientElement,
SVGRect,
SVGRectElement,
SVGRenderingIntent,
SVGSVGElement,
SVGScriptElement,
SVGSetElement,
SVGStopElement,
SVGStringList,
SVGStyleElement,
SVGSwitchElement,
SVGSymbolElement,
SVGTRefElement,
SVGTSpanElement,
SVGTextContentElement,
SVGTextElement,
SVGTextPathElement,
SVGTextPositioningElement,
SVGTitleElement,
SVGTransform,
SVGTransformList,
SVGUnitTypes,
SVGUseElement,
SVGVKernElement,
SVGViewElement,
SVGViewSpec,
SVGZoomEvent,
GCObservation,
InternalSettings,
Internals,
InternalsMapLike,
InternalsSetLike,
MallocStatistics,
MemoryInfo,
MockCDMFactory,
MockContentFilterSettings,
MockPageOverlay,
MockPaymentCoordinator,
ServiceWorkerInternals,
TypeConversions,
WebFakeXRDevice,
WebFakeXRInputController,
WebXRTest,
DedicatedWorkerGlobalScope,
Worker,
WorkerGlobalScope,
WorkerLocation,
ExtendableEvent,
ExtendableMessageEvent,
FetchEvent,
NavigationPreloadManager,
ServiceWorker,
ServiceWorkerClient,
ServiceWorkerClients,
ServiceWorkerContainer,
ServiceWorkerGlobalScope,
ServiceWorkerRegistration,
ServiceWorkerWindowClient,
SharedWorker,
SharedWorkerGlobalScope,
PaintWorkletGlobalScope,
Worklet,
WorkletGlobalScope,
CustomXPathNSResolver,
DOMParser,
XMLHttpRequest,
XMLHttpRequestEventTarget,
XMLHttpRequestProgressEvent,
XMLHttpRequestUpload,
XMLSerializer,
XPathEvaluator,
XPathExpression,
XPathNSResolver,
XPathResult,
XSLTProcessor,
};
static constexpr unsigned numberOfDOMConstructors = 836;
class DOMConstructors {
WTF_MAKE_NONCOPYABLE(DOMConstructors);
WTF_MAKE_FAST_ALLOCATED(DOMConstructors);
public:
using ConstructorArray = std::array<JSC::WriteBarrier<JSC::JSObject>, numberOfDOMConstructors>;
DOMConstructors() = default;
ConstructorArray& array() { return m_array; }
const ConstructorArray& array() const { return m_array; }
private:
ConstructorArray m_array {};
};
} // namespace WebCore

View File

@@ -0,0 +1,877 @@
#pragma once
#include "root.h"
#include "wtf/FastMalloc.h"
#include "wtf/Noncopyable.h"
namespace WebCore {
using namespace JSC;
class DOMIsoSubspaces {
WTF_MAKE_NONCOPYABLE(DOMIsoSubspaces);
WTF_MAKE_FAST_ALLOCATED(DOMIsoSubspaces);
public:
DOMIsoSubspaces() = default;
// std::unique_ptr<IsoSubspace> m_subspaceForTouch;
// std::unique_ptr<IsoSubspace> m_subspaceForTouchEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForTouchList;
// std::unique_ptr<IsoSubspace> m_subspaceForInternalSettingsGenerated;
// std::unique_ptr<IsoSubspace> m_subspaceForGPU;
// std::unique_ptr<IsoSubspace> m_subspaceForGPUAdapter;
// std::unique_ptr<IsoSubspace> m_subspaceForGPUBindGroup;
// std::unique_ptr<IsoSubspace> m_subspaceForGPUBindGroupLayout;
// std::unique_ptr<IsoSubspace> m_subspaceForGPUBuffer;
// std::unique_ptr<IsoSubspace> m_subspaceForGPUBufferUsage;
// std::unique_ptr<IsoSubspace> m_subspaceForGPUCanvasContext;
// std::unique_ptr<IsoSubspace> m_subspaceForGPUColorWrite;
// std::unique_ptr<IsoSubspace> m_subspaceForGPUCommandBuffer;
// std::unique_ptr<IsoSubspace> m_subspaceForGPUCommandEncoder;
// std::unique_ptr<IsoSubspace> m_subspaceForGPUCompilationInfo;
// std::unique_ptr<IsoSubspace> m_subspaceForGPUCompilationMessage;
// std::unique_ptr<IsoSubspace> m_subspaceForGPUComputePassEncoder;
// std::unique_ptr<IsoSubspace> m_subspaceForGPUComputePipeline;
// std::unique_ptr<IsoSubspace> m_subspaceForGPUDevice;
// std::unique_ptr<IsoSubspace> m_subspaceForGPUDeviceLostInfo;
// std::unique_ptr<IsoSubspace> m_subspaceForGPUExternalTexture;
// std::unique_ptr<IsoSubspace> m_subspaceForGPUMapMode;
// std::unique_ptr<IsoSubspace> m_subspaceForGPUOutOfMemoryError;
// std::unique_ptr<IsoSubspace> m_subspaceForGPUPipelineLayout;
// std::unique_ptr<IsoSubspace> m_subspaceForGPUQuerySet;
// std::unique_ptr<IsoSubspace> m_subspaceForGPUQueue;
// std::unique_ptr<IsoSubspace> m_subspaceForGPURenderBundle;
// std::unique_ptr<IsoSubspace> m_subspaceForGPURenderBundleEncoder;
// std::unique_ptr<IsoSubspace> m_subspaceForGPURenderPassEncoder;
// std::unique_ptr<IsoSubspace> m_subspaceForGPURenderPipeline;
// std::unique_ptr<IsoSubspace> m_subspaceForGPUSampler;
// std::unique_ptr<IsoSubspace> m_subspaceForGPUShaderModule;
// std::unique_ptr<IsoSubspace> m_subspaceForGPUShaderStage;
// std::unique_ptr<IsoSubspace> m_subspaceForGPUSupportedFeatures;
// std::unique_ptr<IsoSubspace> m_subspaceForGPUSupportedLimits;
// std::unique_ptr<IsoSubspace> m_subspaceForGPUTexture;
// std::unique_ptr<IsoSubspace> m_subspaceForGPUTextureUsage;
// std::unique_ptr<IsoSubspace> m_subspaceForGPUTextureView;
// std::unique_ptr<IsoSubspace> m_subspaceForGPUUncapturedErrorEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForGPUValidationError;
// std::unique_ptr<IsoSubspace> m_subspaceForWebKitPlaybackTargetAvailabilityEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForApplePayCancelEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForApplePayCouponCodeChangedEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForApplePayError;
// std::unique_ptr<IsoSubspace> m_subspaceForApplePayPaymentAuthorizedEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForApplePayPaymentMethodSelectedEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForApplePaySession;
// std::unique_ptr<IsoSubspace> m_subspaceForApplePaySetup;
// std::unique_ptr<IsoSubspace> m_subspaceForApplePaySetupFeature;
// std::unique_ptr<IsoSubspace> m_subspaceForApplePayShippingContactSelectedEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForApplePayShippingMethodSelectedEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForApplePayValidateMerchantEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForClipboard;
// std::unique_ptr<IsoSubspace> m_subspaceForClipboardItem;
// std::unique_ptr<IsoSubspace> m_subspaceForDOMCache;
// std::unique_ptr<IsoSubspace> m_subspaceForDOMCacheStorage;
// std::unique_ptr<IsoSubspace> m_subspaceForContactsManager;
// std::unique_ptr<IsoSubspace> m_subspaceForBasicCredential;
// std::unique_ptr<IsoSubspace> m_subspaceForCredentialsContainer;
// std::unique_ptr<IsoSubspace> m_subspaceForMediaKeyMessageEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForMediaKeySession;
// std::unique_ptr<IsoSubspace> m_subspaceForMediaKeyStatusMap;
// std::unique_ptr<IsoSubspace> m_subspaceForMediaKeyStatusMapIterator;
// std::unique_ptr<IsoSubspace> m_subspaceForMediaKeySystemAccess;
// std::unique_ptr<IsoSubspace> m_subspaceForMediaKeys;
// std::unique_ptr<IsoSubspace> m_subspaceForWebKitMediaKeyMessageEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForWebKitMediaKeyNeededEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForWebKitMediaKeySession;
// std::unique_ptr<IsoSubspace> m_subspaceForWebKitMediaKeys;
// std::unique_ptr<IsoSubspace> m_subspaceForDOMFileSystem;
// std::unique_ptr<IsoSubspace> m_subspaceForFileSystemDirectoryEntry;
// std::unique_ptr<IsoSubspace> m_subspaceForFileSystemDirectoryReader;
// std::unique_ptr<IsoSubspace> m_subspaceForFileSystemEntry;
// std::unique_ptr<IsoSubspace> m_subspaceForFileSystemFileEntry;
// std::unique_ptr<IsoSubspace> m_subspaceForFetchHeaders;
// std::unique_ptr<IsoSubspace> m_subspaceForFetchHeadersIterator;
// std::unique_ptr<IsoSubspace> m_subspaceForFetchRequest;
// std::unique_ptr<IsoSubspace> m_subspaceForFetchResponse;
// std::unique_ptr<IsoSubspace> m_subspaceForFileSystemDirectoryHandle;
// std::unique_ptr<IsoSubspace> m_subspaceForFileSystemFileHandle;
// std::unique_ptr<IsoSubspace> m_subspaceForFileSystemHandle;
// std::unique_ptr<IsoSubspace> m_subspaceForFileSystemSyncAccessHandle;
// std::unique_ptr<IsoSubspace> m_subspaceForGamepad;
// std::unique_ptr<IsoSubspace> m_subspaceForGamepadButton;
// std::unique_ptr<IsoSubspace> m_subspaceForGamepadEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForGeolocation;
// std::unique_ptr<IsoSubspace> m_subspaceForGeolocationCoordinates;
// std::unique_ptr<IsoSubspace> m_subspaceForGeolocationPosition;
// std::unique_ptr<IsoSubspace> m_subspaceForGeolocationPositionError;
// std::unique_ptr<IsoSubspace> m_subspaceForHighlight;
// std::unique_ptr<IsoSubspace> m_subspaceForHighlightRegister;
// std::unique_ptr<IsoSubspace> m_subspaceForIDBCursor;
// std::unique_ptr<IsoSubspace> m_subspaceForIDBCursorWithValue;
// std::unique_ptr<IsoSubspace> m_subspaceForIDBDatabase;
// std::unique_ptr<IsoSubspace> m_subspaceForIDBFactory;
// std::unique_ptr<IsoSubspace> m_subspaceForIDBIndex;
// std::unique_ptr<IsoSubspace> m_subspaceForIDBKeyRange;
// std::unique_ptr<IsoSubspace> m_subspaceForIDBObjectStore;
// std::unique_ptr<IsoSubspace> m_subspaceForIDBOpenDBRequest;
// std::unique_ptr<IsoSubspace> m_subspaceForIDBRequest;
// std::unique_ptr<IsoSubspace> m_subspaceForIDBTransaction;
// std::unique_ptr<IsoSubspace> m_subspaceForIDBVersionChangeEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForMediaCapabilities;
// std::unique_ptr<IsoSubspace> m_subspaceForMediaControlsHost;
// std::unique_ptr<IsoSubspace> m_subspaceForBlobEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForMediaRecorder;
// std::unique_ptr<IsoSubspace> m_subspaceForMediaRecorderErrorEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForMediaMetadata;
// std::unique_ptr<IsoSubspace> m_subspaceForMediaSession;
// std::unique_ptr<IsoSubspace> m_subspaceForMediaSessionCoordinator;
// std::unique_ptr<IsoSubspace> m_subspaceForMediaSource;
// std::unique_ptr<IsoSubspace> m_subspaceForSourceBuffer;
// std::unique_ptr<IsoSubspace> m_subspaceForSourceBufferList;
// std::unique_ptr<IsoSubspace> m_subspaceForVideoPlaybackQuality;
// std::unique_ptr<IsoSubspace> m_subspaceForCanvasCaptureMediaStreamTrack;
// std::unique_ptr<IsoSubspace> m_subspaceForMediaDeviceInfo;
// std::unique_ptr<IsoSubspace> m_subspaceForMediaDevices;
// std::unique_ptr<IsoSubspace> m_subspaceForMediaStream;
// std::unique_ptr<IsoSubspace> m_subspaceForMediaStreamTrack;
// std::unique_ptr<IsoSubspace> m_subspaceForMediaStreamTrackEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForOverconstrainedError;
// std::unique_ptr<IsoSubspace> m_subspaceForOverconstrainedErrorEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForRTCCertificate;
// std::unique_ptr<IsoSubspace> m_subspaceForRTCDTMFSender;
// std::unique_ptr<IsoSubspace> m_subspaceForRTCDTMFToneChangeEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForRTCDataChannel;
// std::unique_ptr<IsoSubspace> m_subspaceForRTCDataChannelEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForRTCDtlsTransport;
// std::unique_ptr<IsoSubspace> m_subspaceForRTCEncodedAudioFrame;
// std::unique_ptr<IsoSubspace> m_subspaceForRTCEncodedVideoFrame;
// std::unique_ptr<IsoSubspace> m_subspaceForRTCError;
// std::unique_ptr<IsoSubspace> m_subspaceForRTCErrorEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForRTCIceCandidate;
// std::unique_ptr<IsoSubspace> m_subspaceForRTCIceTransport;
// std::unique_ptr<IsoSubspace> m_subspaceForRTCPeerConnection;
// std::unique_ptr<IsoSubspace> m_subspaceForRTCPeerConnectionIceErrorEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForRTCPeerConnectionIceEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForRTCRtpReceiver;
// std::unique_ptr<IsoSubspace> m_subspaceForRTCRtpSFrameTransform;
// std::unique_ptr<IsoSubspace> m_subspaceForRTCRtpSFrameTransformErrorEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForRTCRtpScriptTransform;
// std::unique_ptr<IsoSubspace> m_subspaceForRTCRtpScriptTransformer;
// std::unique_ptr<IsoSubspace> m_subspaceForRTCRtpSender;
// std::unique_ptr<IsoSubspace> m_subspaceForRTCRtpTransceiver;
// std::unique_ptr<IsoSubspace> m_subspaceForRTCSctpTransport;
// std::unique_ptr<IsoSubspace> m_subspaceForRTCSessionDescription;
// std::unique_ptr<IsoSubspace> m_subspaceForRTCStatsReport;
// std::unique_ptr<IsoSubspace> m_subspaceForRTCTrackEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForRTCTransformEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLModelElement;
// std::unique_ptr<IsoSubspace> m_subspaceForNotification;
// std::unique_ptr<IsoSubspace> m_subspaceForNotificationEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForMerchantValidationEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForPaymentAddress;
// std::unique_ptr<IsoSubspace> m_subspaceForPaymentMethodChangeEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForPaymentRequest;
// std::unique_ptr<IsoSubspace> m_subspaceForPaymentRequestUpdateEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForPaymentResponse;
// std::unique_ptr<IsoSubspace> m_subspaceForPermissionStatus;
// std::unique_ptr<IsoSubspace> m_subspaceForPermissions;
// std::unique_ptr<IsoSubspace> m_subspaceForPictureInPictureEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForPictureInPictureWindow;
// std::unique_ptr<IsoSubspace> m_subspaceForPushEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForPushManager;
// std::unique_ptr<IsoSubspace> m_subspaceForPushMessageData;
// std::unique_ptr<IsoSubspace> m_subspaceForPushSubscription;
// std::unique_ptr<IsoSubspace> m_subspaceForPushSubscriptionChangeEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForPushSubscriptionOptions;
// std::unique_ptr<IsoSubspace> m_subspaceForRemotePlayback;
// std::unique_ptr<IsoSubspace> m_subspaceForSpeechRecognition;
// std::unique_ptr<IsoSubspace> m_subspaceForSpeechRecognitionAlternative;
// std::unique_ptr<IsoSubspace> m_subspaceForSpeechRecognitionErrorEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForSpeechRecognitionEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForSpeechRecognitionResult;
// std::unique_ptr<IsoSubspace> m_subspaceForSpeechRecognitionResultList;
// std::unique_ptr<IsoSubspace> m_subspaceForSpeechSynthesis;
// std::unique_ptr<IsoSubspace> m_subspaceForSpeechSynthesisErrorEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForSpeechSynthesisEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForSpeechSynthesisUtterance;
// std::unique_ptr<IsoSubspace> m_subspaceForSpeechSynthesisVoice;
// std::unique_ptr<IsoSubspace> m_subspaceForStorageManager;
// std::unique_ptr<IsoSubspace> m_subspaceForByteLengthQueuingStrategy;
// std::unique_ptr<IsoSubspace> m_subspaceForCountQueuingStrategy;
// std::unique_ptr<IsoSubspace> m_subspaceForReadableByteStreamController;
// std::unique_ptr<IsoSubspace> m_subspaceForReadableStream;
// std::unique_ptr<IsoSubspace> m_subspaceForReadableStreamBYOBReader;
// std::unique_ptr<IsoSubspace> m_subspaceForReadableStreamBYOBRequest;
// std::unique_ptr<IsoSubspace> m_subspaceForReadableStreamDefaultController;
// std::unique_ptr<IsoSubspace> m_subspaceForReadableStreamDefaultReader;
// std::unique_ptr<IsoSubspace> m_subspaceForReadableStreamSink;
// std::unique_ptr<IsoSubspace> m_subspaceForReadableStreamSource;
// std::unique_ptr<IsoSubspace> m_subspaceForTransformStream;
// std::unique_ptr<IsoSubspace> m_subspaceForTransformStreamDefaultController;
// std::unique_ptr<IsoSubspace> m_subspaceForWritableStream;
// std::unique_ptr<IsoSubspace> m_subspaceForWritableStreamDefaultController;
// std::unique_ptr<IsoSubspace> m_subspaceForWritableStreamDefaultWriter;
// std::unique_ptr<IsoSubspace> m_subspaceForWritableStreamSink;
// std::unique_ptr<IsoSubspace> m_subspaceForWebLock;
// std::unique_ptr<IsoSubspace> m_subspaceForWebLockManager;
// std::unique_ptr<IsoSubspace> m_subspaceForAnalyserNode;
// std::unique_ptr<IsoSubspace> m_subspaceForAudioBuffer;
// std::unique_ptr<IsoSubspace> m_subspaceForAudioBufferSourceNode;
// std::unique_ptr<IsoSubspace> m_subspaceForAudioContext;
// std::unique_ptr<IsoSubspace> m_subspaceForAudioDestinationNode;
// std::unique_ptr<IsoSubspace> m_subspaceForAudioListener;
// std::unique_ptr<IsoSubspace> m_subspaceForAudioNode;
// std::unique_ptr<IsoSubspace> m_subspaceForAudioParam;
// std::unique_ptr<IsoSubspace> m_subspaceForAudioParamMap;
// std::unique_ptr<IsoSubspace> m_subspaceForAudioProcessingEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForAudioScheduledSourceNode;
// std::unique_ptr<IsoSubspace> m_subspaceForAudioWorklet;
// std::unique_ptr<IsoSubspace> m_subspaceForAudioWorkletGlobalScope;
// std::unique_ptr<IsoSubspace> m_subspaceForAudioWorkletNode;
// std::unique_ptr<IsoSubspace> m_subspaceForAudioWorkletProcessor;
// std::unique_ptr<IsoSubspace> m_subspaceForBaseAudioContext;
// std::unique_ptr<IsoSubspace> m_subspaceForBiquadFilterNode;
// std::unique_ptr<IsoSubspace> m_subspaceForChannelMergerNode;
// std::unique_ptr<IsoSubspace> m_subspaceForChannelSplitterNode;
// std::unique_ptr<IsoSubspace> m_subspaceForConstantSourceNode;
// std::unique_ptr<IsoSubspace> m_subspaceForConvolverNode;
// std::unique_ptr<IsoSubspace> m_subspaceForDelayNode;
// std::unique_ptr<IsoSubspace> m_subspaceForDynamicsCompressorNode;
// std::unique_ptr<IsoSubspace> m_subspaceForGainNode;
// std::unique_ptr<IsoSubspace> m_subspaceForIIRFilterNode;
// std::unique_ptr<IsoSubspace> m_subspaceForMediaElementAudioSourceNode;
// std::unique_ptr<IsoSubspace> m_subspaceForMediaStreamAudioDestinationNode;
// std::unique_ptr<IsoSubspace> m_subspaceForMediaStreamAudioSourceNode;
// std::unique_ptr<IsoSubspace> m_subspaceForOfflineAudioCompletionEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForOfflineAudioContext;
// std::unique_ptr<IsoSubspace> m_subspaceForOscillatorNode;
// std::unique_ptr<IsoSubspace> m_subspaceForPannerNode;
// std::unique_ptr<IsoSubspace> m_subspaceForPeriodicWave;
// std::unique_ptr<IsoSubspace> m_subspaceForScriptProcessorNode;
// std::unique_ptr<IsoSubspace> m_subspaceForStereoPannerNode;
// std::unique_ptr<IsoSubspace> m_subspaceForWaveShaperNode;
// std::unique_ptr<IsoSubspace> m_subspaceForAuthenticatorAssertionResponse;
// std::unique_ptr<IsoSubspace> m_subspaceForAuthenticatorAttestationResponse;
// std::unique_ptr<IsoSubspace> m_subspaceForAuthenticatorResponse;
// std::unique_ptr<IsoSubspace> m_subspaceForPublicKeyCredential;
// std::unique_ptr<IsoSubspace> m_subspaceForVideoColorSpace;
// std::unique_ptr<IsoSubspace> m_subspaceForDatabase;
// std::unique_ptr<IsoSubspace> m_subspaceForSQLError;
// std::unique_ptr<IsoSubspace> m_subspaceForSQLResultSet;
// std::unique_ptr<IsoSubspace> m_subspaceForSQLResultSetRowList;
// std::unique_ptr<IsoSubspace> m_subspaceForSQLTransaction;
// std::unique_ptr<IsoSubspace> m_subspaceForCloseEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForWebSocket;
// std::unique_ptr<IsoSubspace> m_subspaceForWebXRBoundedReferenceSpace;
// std::unique_ptr<IsoSubspace> m_subspaceForWebXRFrame;
// std::unique_ptr<IsoSubspace> m_subspaceForWebXRHand;
// std::unique_ptr<IsoSubspace> m_subspaceForWebXRHandIterator;
// std::unique_ptr<IsoSubspace> m_subspaceForWebXRInputSource;
// std::unique_ptr<IsoSubspace> m_subspaceForWebXRInputSourceArray;
// std::unique_ptr<IsoSubspace> m_subspaceForWebXRInputSourceArrayIterator;
// std::unique_ptr<IsoSubspace> m_subspaceForWebXRJointPose;
// std::unique_ptr<IsoSubspace> m_subspaceForWebXRJointSpace;
// std::unique_ptr<IsoSubspace> m_subspaceForWebXRLayer;
// std::unique_ptr<IsoSubspace> m_subspaceForWebXRPose;
// std::unique_ptr<IsoSubspace> m_subspaceForWebXRReferenceSpace;
// std::unique_ptr<IsoSubspace> m_subspaceForWebXRRenderState;
// std::unique_ptr<IsoSubspace> m_subspaceForWebXRRigidTransform;
// std::unique_ptr<IsoSubspace> m_subspaceForWebXRSession;
// std::unique_ptr<IsoSubspace> m_subspaceForWebXRSpace;
// std::unique_ptr<IsoSubspace> m_subspaceForWebXRSystem;
// std::unique_ptr<IsoSubspace> m_subspaceForWebXRView;
// std::unique_ptr<IsoSubspace> m_subspaceForWebXRViewerPose;
// std::unique_ptr<IsoSubspace> m_subspaceForWebXRViewport;
// std::unique_ptr<IsoSubspace> m_subspaceForWebXRWebGLLayer;
// std::unique_ptr<IsoSubspace> m_subspaceForXRInputSourceEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForXRInputSourcesChangeEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForXRReferenceSpaceEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForXRSessionEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForAnimationEffect;
// std::unique_ptr<IsoSubspace> m_subspaceForAnimationPlaybackEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForAnimationTimeline;
// std::unique_ptr<IsoSubspace> m_subspaceForCSSAnimation;
// std::unique_ptr<IsoSubspace> m_subspaceForCSSTransition;
// std::unique_ptr<IsoSubspace> m_subspaceForCustomEffect;
// std::unique_ptr<IsoSubspace> m_subspaceForDocumentTimeline;
// std::unique_ptr<IsoSubspace> m_subspaceForKeyframeEffect;
// std::unique_ptr<IsoSubspace> m_subspaceForWebAnimation;
// std::unique_ptr<IsoSubspace> m_subspaceForCryptoKey;
// std::unique_ptr<IsoSubspace> m_subspaceForSubtleCrypto;
// std::unique_ptr<IsoSubspace> m_subspaceForCSSConditionRule;
// std::unique_ptr<IsoSubspace> m_subspaceForCSSCounterStyleRule;
// std::unique_ptr<IsoSubspace> m_subspaceForCSSFontFaceRule;
// std::unique_ptr<IsoSubspace> m_subspaceForCSSFontPaletteValuesRule;
// std::unique_ptr<IsoSubspace> m_subspaceForCSSGroupingRule;
// std::unique_ptr<IsoSubspace> m_subspaceForCSSImportRule;
// std::unique_ptr<IsoSubspace> m_subspaceForCSSKeyframeRule;
// std::unique_ptr<IsoSubspace> m_subspaceForCSSKeyframesRule;
// std::unique_ptr<IsoSubspace> m_subspaceForCSSLayerBlockRule;
// std::unique_ptr<IsoSubspace> m_subspaceForCSSLayerStatementRule;
// std::unique_ptr<IsoSubspace> m_subspaceForCSSMediaRule;
// std::unique_ptr<IsoSubspace> m_subspaceForCSSNamespaceRule;
// std::unique_ptr<IsoSubspace> m_subspaceForCSSPageRule;
// std::unique_ptr<IsoSubspace> m_subspaceForCSSPaintSize;
// std::unique_ptr<IsoSubspace> m_subspaceForCSSRule;
// std::unique_ptr<IsoSubspace> m_subspaceForCSSRuleList;
// std::unique_ptr<IsoSubspace> m_subspaceForCSSStyleDeclaration;
// std::unique_ptr<IsoSubspace> m_subspaceForCSSStyleRule;
// std::unique_ptr<IsoSubspace> m_subspaceForCSSStyleSheet;
// std::unique_ptr<IsoSubspace> m_subspaceForCSSSupportsRule;
// std::unique_ptr<IsoSubspace> m_subspaceForCSSUnknownRule;
// std::unique_ptr<IsoSubspace> m_subspaceForDOMCSSNamespace;
// std::unique_ptr<IsoSubspace> m_subspaceForDOMMatrix;
// std::unique_ptr<IsoSubspace> m_subspaceForDOMMatrixReadOnly;
// std::unique_ptr<IsoSubspace> m_subspaceForDeprecatedCSSOMCounter;
// std::unique_ptr<IsoSubspace> m_subspaceForDeprecatedCSSOMPrimitiveValue;
// std::unique_ptr<IsoSubspace> m_subspaceForDeprecatedCSSOMRGBColor;
// std::unique_ptr<IsoSubspace> m_subspaceForDeprecatedCSSOMRect;
// std::unique_ptr<IsoSubspace> m_subspaceForDeprecatedCSSOMValue;
// std::unique_ptr<IsoSubspace> m_subspaceForDeprecatedCSSOMValueList;
// std::unique_ptr<IsoSubspace> m_subspaceForFontFace;
// std::unique_ptr<IsoSubspace> m_subspaceForFontFaceSet;
// std::unique_ptr<IsoSubspace> m_subspaceForFontFaceSetIterator;
// std::unique_ptr<IsoSubspace> m_subspaceForMediaList;
// std::unique_ptr<IsoSubspace> m_subspaceForMediaQueryList;
// std::unique_ptr<IsoSubspace> m_subspaceForMediaQueryListEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForStyleMedia;
// std::unique_ptr<IsoSubspace> m_subspaceForStyleSheet;
// std::unique_ptr<IsoSubspace> m_subspaceForStyleSheetList;
// std::unique_ptr<IsoSubspace> m_subspaceForCSSKeywordValue;
// std::unique_ptr<IsoSubspace> m_subspaceForCSSNumericValue;
// std::unique_ptr<IsoSubspace> m_subspaceForCSSOMVariableReferenceValue;
// std::unique_ptr<IsoSubspace> m_subspaceForCSSStyleImageValue;
// std::unique_ptr<IsoSubspace> m_subspaceForCSSStyleValue;
// std::unique_ptr<IsoSubspace> m_subspaceForCSSUnitValue;
// std::unique_ptr<IsoSubspace> m_subspaceForCSSUnparsedValue;
// std::unique_ptr<IsoSubspace> m_subspaceForCSSUnparsedValueIterator;
// std::unique_ptr<IsoSubspace> m_subspaceForStylePropertyMap;
// std::unique_ptr<IsoSubspace> m_subspaceForStylePropertyMapReadOnly;
// std::unique_ptr<IsoSubspace> m_subspaceForCSSMathInvert;
// std::unique_ptr<IsoSubspace> m_subspaceForCSSMathMax;
// std::unique_ptr<IsoSubspace> m_subspaceForCSSMathMin;
// std::unique_ptr<IsoSubspace> m_subspaceForCSSMathNegate;
// std::unique_ptr<IsoSubspace> m_subspaceForCSSMathProduct;
// std::unique_ptr<IsoSubspace> m_subspaceForCSSMathSum;
// std::unique_ptr<IsoSubspace> m_subspaceForCSSMathValue;
// std::unique_ptr<IsoSubspace> m_subspaceForCSSNumericArray;
// std::unique_ptr<IsoSubspace> m_subspaceForCSSNumericArrayIterator;
// std::unique_ptr<IsoSubspace> m_subspaceForCSSMatrixComponent;
// std::unique_ptr<IsoSubspace> m_subspaceForCSSPerspective;
// std::unique_ptr<IsoSubspace> m_subspaceForCSSRotate;
// std::unique_ptr<IsoSubspace> m_subspaceForCSSScale;
// std::unique_ptr<IsoSubspace> m_subspaceForCSSSkew;
// std::unique_ptr<IsoSubspace> m_subspaceForCSSSkewX;
// std::unique_ptr<IsoSubspace> m_subspaceForCSSSkewY;
// std::unique_ptr<IsoSubspace> m_subspaceForCSSTransformComponent;
// std::unique_ptr<IsoSubspace> m_subspaceForCSSTransformValue;
// std::unique_ptr<IsoSubspace> m_subspaceForCSSTransformValueIterator;
// std::unique_ptr<IsoSubspace> m_subspaceForCSSTranslate;
// std::unique_ptr<IsoSubspace> m_subspaceForAbortController;
// std::unique_ptr<IsoSubspace> m_subspaceForAbortSignal;
// std::unique_ptr<IsoSubspace> m_subspaceForAbstractRange;
// std::unique_ptr<IsoSubspace> m_subspaceForAnimationEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForAttr;
// std::unique_ptr<IsoSubspace> m_subspaceForBeforeUnloadEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForBroadcastChannel;
// std::unique_ptr<IsoSubspace> m_subspaceForCDATASection;
// std::unique_ptr<IsoSubspace> m_subspaceForCharacterData;
// std::unique_ptr<IsoSubspace> m_subspaceForClipboardEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForComment;
// std::unique_ptr<IsoSubspace> m_subspaceForCompositionEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForCustomElementRegistry;
// std::unique_ptr<IsoSubspace> m_subspaceForCustomEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForDOMException;
// std::unique_ptr<IsoSubspace> m_subspaceForDOMImplementation;
// std::unique_ptr<IsoSubspace> m_subspaceForDOMPoint;
// std::unique_ptr<IsoSubspace> m_subspaceForDOMPointReadOnly;
// std::unique_ptr<IsoSubspace> m_subspaceForDOMQuad;
// std::unique_ptr<IsoSubspace> m_subspaceForDOMRect;
// std::unique_ptr<IsoSubspace> m_subspaceForDOMRectList;
// std::unique_ptr<IsoSubspace> m_subspaceForDOMRectReadOnly;
// std::unique_ptr<IsoSubspace> m_subspaceForDOMStringList;
// std::unique_ptr<IsoSubspace> m_subspaceForDOMStringMap;
// std::unique_ptr<IsoSubspace> m_subspaceForDataTransfer;
// std::unique_ptr<IsoSubspace> m_subspaceForDataTransferItem;
// std::unique_ptr<IsoSubspace> m_subspaceForDataTransferItemList;
// std::unique_ptr<IsoSubspace> m_subspaceForDeviceMotionEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForDeviceOrientationEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForDocument;
// std::unique_ptr<IsoSubspace> m_subspaceForDocumentFragment;
// std::unique_ptr<IsoSubspace> m_subspaceForDocumentType;
// std::unique_ptr<IsoSubspace> m_subspaceForDragEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForElement;
// std::unique_ptr<IsoSubspace> m_subspaceForErrorEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForEventListener;
// std::unique_ptr<IsoSubspace> m_subspaceForEventTarget;
// std::unique_ptr<IsoSubspace> m_subspaceForFocusEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForFormDataEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForHashChangeEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForIdleDeadline;
// std::unique_ptr<IsoSubspace> m_subspaceForInputEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForKeyboardEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForMessageChannel;
// std::unique_ptr<IsoSubspace> m_subspaceForMessageEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForMessagePort;
// std::unique_ptr<IsoSubspace> m_subspaceForMouseEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForMutationEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForMutationObserver;
// std::unique_ptr<IsoSubspace> m_subspaceForMutationRecord;
// std::unique_ptr<IsoSubspace> m_subspaceForNamedNodeMap;
// std::unique_ptr<IsoSubspace> m_subspaceForNode;
// std::unique_ptr<IsoSubspace> m_subspaceForNodeIterator;
// std::unique_ptr<IsoSubspace> m_subspaceForNodeList;
// std::unique_ptr<IsoSubspace> m_subspaceForNodeListIterator;
// std::unique_ptr<IsoSubspace> m_subspaceForOverflowEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForPageTransitionEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForPointerEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForPopStateEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForProcessingInstruction;
// std::unique_ptr<IsoSubspace> m_subspaceForProgressEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForPromiseRejectionEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForRange;
// std::unique_ptr<IsoSubspace> m_subspaceForSecurityPolicyViolationEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForShadowRoot;
// std::unique_ptr<IsoSubspace> m_subspaceForStaticRange;
// std::unique_ptr<IsoSubspace> m_subspaceForText;
// std::unique_ptr<IsoSubspace> m_subspaceForTextDecoder;
// std::unique_ptr<IsoSubspace> m_subspaceForTextDecoderStream;
// std::unique_ptr<IsoSubspace> m_subspaceForTextDecoderStreamDecoder;
// std::unique_ptr<IsoSubspace> m_subspaceForTextEncoder;
// std::unique_ptr<IsoSubspace> m_subspaceForTextEncoderStream;
// std::unique_ptr<IsoSubspace> m_subspaceForTextEncoderStreamEncoder;
// std::unique_ptr<IsoSubspace> m_subspaceForTextEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForTransitionEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForTreeWalker;
// std::unique_ptr<IsoSubspace> m_subspaceForUIEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForWheelEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForXMLDocument;
// std::unique_ptr<IsoSubspace> m_subspaceForBlob;
// std::unique_ptr<IsoSubspace> m_subspaceForFile;
// std::unique_ptr<IsoSubspace> m_subspaceForFileList;
// std::unique_ptr<IsoSubspace> m_subspaceForFileReader;
// std::unique_ptr<IsoSubspace> m_subspaceForFileReaderSync;
// std::unique_ptr<IsoSubspace> m_subspaceForDOMFormData;
// std::unique_ptr<IsoSubspace> m_subspaceForDOMFormDataIterator;
// std::unique_ptr<IsoSubspace> m_subspaceForDOMTokenList;
// std::unique_ptr<IsoSubspace> m_subspaceForDOMTokenListIterator;
// std::unique_ptr<IsoSubspace> m_subspaceForDOMURL;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLAllCollection;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLAnchorElement;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLAreaElement;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLAttachmentElement;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLAudioElement;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLBRElement;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLBaseElement;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLBodyElement;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLButtonElement;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLCanvasElement;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLCollection;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLDListElement;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLDataElement;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLDataListElement;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLDetailsElement;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLDialogElement;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLDirectoryElement;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLDivElement;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLDocument;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLElement;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLEmbedElement;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLFieldSetElement;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLFontElement;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLFormControlsCollection;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLFormElement;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLFrameElement;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLFrameSetElement;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLHRElement;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLHeadElement;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLHeadingElement;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLHtmlElement;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLIFrameElement;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLImageElement;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLInputElement;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLLIElement;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLLabelElement;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLLegendElement;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLLinkElement;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLMapElement;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLMarqueeElement;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLMediaElement;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLMenuElement;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLMenuItemElement;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLMetaElement;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLMeterElement;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLModElement;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLOListElement;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLObjectElement;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLOptGroupElement;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLOptionElement;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLOptionsCollection;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLOutputElement;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLParagraphElement;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLParamElement;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLPictureElement;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLPreElement;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLProgressElement;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLQuoteElement;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLScriptElement;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLSelectElement;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLSlotElement;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLSourceElement;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLSpanElement;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLStyleElement;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLTableCaptionElement;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLTableCellElement;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLTableColElement;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLTableElement;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLTableRowElement;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLTableSectionElement;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLTemplateElement;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLTextAreaElement;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLTimeElement;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLTitleElement;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLTrackElement;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLUListElement;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLUnknownElement;
// std::unique_ptr<IsoSubspace> m_subspaceForHTMLVideoElement;
// std::unique_ptr<IsoSubspace> m_subspaceForImageBitmap;
// std::unique_ptr<IsoSubspace> m_subspaceForImageData;
// std::unique_ptr<IsoSubspace> m_subspaceForMediaController;
// std::unique_ptr<IsoSubspace> m_subspaceForMediaEncryptedEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForMediaError;
// std::unique_ptr<IsoSubspace> m_subspaceForOffscreenCanvas;
// std::unique_ptr<IsoSubspace> m_subspaceForRadioNodeList;
// std::unique_ptr<IsoSubspace> m_subspaceForSubmitEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForTextMetrics;
// std::unique_ptr<IsoSubspace> m_subspaceForTimeRanges;
// std::unique_ptr<IsoSubspace> m_subspaceForURLSearchParams;
// std::unique_ptr<IsoSubspace> m_subspaceForURLSearchParamsIterator;
// std::unique_ptr<IsoSubspace> m_subspaceForValidityState;
// std::unique_ptr<IsoSubspace> m_subspaceForWebKitMediaKeyError;
// std::unique_ptr<IsoSubspace> m_subspaceForANGLEInstancedArrays;
// std::unique_ptr<IsoSubspace> m_subspaceForCanvasGradient;
// std::unique_ptr<IsoSubspace> m_subspaceForCanvasPattern;
// std::unique_ptr<IsoSubspace> m_subspaceForCanvasRenderingContext2D;
// std::unique_ptr<IsoSubspace> m_subspaceForEXTBlendMinMax;
// std::unique_ptr<IsoSubspace> m_subspaceForEXTColorBufferFloat;
// std::unique_ptr<IsoSubspace> m_subspaceForEXTColorBufferHalfFloat;
// std::unique_ptr<IsoSubspace> m_subspaceForEXTFloatBlend;
// std::unique_ptr<IsoSubspace> m_subspaceForEXTFragDepth;
// std::unique_ptr<IsoSubspace> m_subspaceForEXTShaderTextureLOD;
// std::unique_ptr<IsoSubspace> m_subspaceForEXTTextureCompressionRGTC;
// std::unique_ptr<IsoSubspace> m_subspaceForEXTTextureFilterAnisotropic;
// std::unique_ptr<IsoSubspace> m_subspaceForEXTsRGB;
// std::unique_ptr<IsoSubspace> m_subspaceForImageBitmapRenderingContext;
// std::unique_ptr<IsoSubspace> m_subspaceForKHRParallelShaderCompile;
// std::unique_ptr<IsoSubspace> m_subspaceForOESElementIndexUint;
// std::unique_ptr<IsoSubspace> m_subspaceForOESFBORenderMipmap;
// std::unique_ptr<IsoSubspace> m_subspaceForOESStandardDerivatives;
// std::unique_ptr<IsoSubspace> m_subspaceForOESTextureFloat;
// std::unique_ptr<IsoSubspace> m_subspaceForOESTextureFloatLinear;
// std::unique_ptr<IsoSubspace> m_subspaceForOESTextureHalfFloat;
// std::unique_ptr<IsoSubspace> m_subspaceForOESTextureHalfFloatLinear;
// std::unique_ptr<IsoSubspace> m_subspaceForOESVertexArrayObject;
// std::unique_ptr<IsoSubspace> m_subspaceForOffscreenCanvasRenderingContext2D;
// std::unique_ptr<IsoSubspace> m_subspaceForPaintRenderingContext2D;
// std::unique_ptr<IsoSubspace> m_subspaceForPath2D;
// std::unique_ptr<IsoSubspace> m_subspaceForWebGL2RenderingContext;
// std::unique_ptr<IsoSubspace> m_subspaceForWebGLActiveInfo;
// std::unique_ptr<IsoSubspace> m_subspaceForWebGLBuffer;
// std::unique_ptr<IsoSubspace> m_subspaceForWebGLColorBufferFloat;
// std::unique_ptr<IsoSubspace> m_subspaceForWebGLCompressedTextureASTC;
// std::unique_ptr<IsoSubspace> m_subspaceForWebGLCompressedTextureATC;
// std::unique_ptr<IsoSubspace> m_subspaceForWebGLCompressedTextureETC;
// std::unique_ptr<IsoSubspace> m_subspaceForWebGLCompressedTextureETC1;
// std::unique_ptr<IsoSubspace> m_subspaceForWebGLCompressedTexturePVRTC;
// std::unique_ptr<IsoSubspace> m_subspaceForWebGLCompressedTextureS3TC;
// std::unique_ptr<IsoSubspace> m_subspaceForWebGLCompressedTextureS3TCsRGB;
// std::unique_ptr<IsoSubspace> m_subspaceForWebGLContextEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForWebGLDebugRendererInfo;
// std::unique_ptr<IsoSubspace> m_subspaceForWebGLDebugShaders;
// std::unique_ptr<IsoSubspace> m_subspaceForWebGLDepthTexture;
// std::unique_ptr<IsoSubspace> m_subspaceForWebGLDrawBuffers;
// std::unique_ptr<IsoSubspace> m_subspaceForWebGLFramebuffer;
// std::unique_ptr<IsoSubspace> m_subspaceForWebGLLoseContext;
// std::unique_ptr<IsoSubspace> m_subspaceForWebGLMultiDraw;
// std::unique_ptr<IsoSubspace> m_subspaceForWebGLProgram;
// std::unique_ptr<IsoSubspace> m_subspaceForWebGLQuery;
// std::unique_ptr<IsoSubspace> m_subspaceForWebGLRenderbuffer;
// std::unique_ptr<IsoSubspace> m_subspaceForWebGLRenderingContext;
// std::unique_ptr<IsoSubspace> m_subspaceForWebGLSampler;
// std::unique_ptr<IsoSubspace> m_subspaceForWebGLShader;
// std::unique_ptr<IsoSubspace> m_subspaceForWebGLShaderPrecisionFormat;
// std::unique_ptr<IsoSubspace> m_subspaceForWebGLSync;
// std::unique_ptr<IsoSubspace> m_subspaceForWebGLTexture;
// std::unique_ptr<IsoSubspace> m_subspaceForWebGLTransformFeedback;
// std::unique_ptr<IsoSubspace> m_subspaceForWebGLUniformLocation;
// std::unique_ptr<IsoSubspace> m_subspaceForWebGLVertexArrayObject;
// std::unique_ptr<IsoSubspace> m_subspaceForWebGLVertexArrayObjectOES;
// std::unique_ptr<IsoSubspace> m_subspaceForAudioTrack;
// std::unique_ptr<IsoSubspace> m_subspaceForAudioTrackConfiguration;
// std::unique_ptr<IsoSubspace> m_subspaceForAudioTrackList;
// std::unique_ptr<IsoSubspace> m_subspaceForDataCue;
// std::unique_ptr<IsoSubspace> m_subspaceForTextTrack;
// std::unique_ptr<IsoSubspace> m_subspaceForTextTrackCue;
// std::unique_ptr<IsoSubspace> m_subspaceForTextTrackCueGeneric;
// std::unique_ptr<IsoSubspace> m_subspaceForTextTrackCueList;
// std::unique_ptr<IsoSubspace> m_subspaceForTextTrackList;
// std::unique_ptr<IsoSubspace> m_subspaceForTrackEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForVTTCue;
// std::unique_ptr<IsoSubspace> m_subspaceForVTTRegion;
// std::unique_ptr<IsoSubspace> m_subspaceForVTTRegionList;
// std::unique_ptr<IsoSubspace> m_subspaceForVideoTrack;
// std::unique_ptr<IsoSubspace> m_subspaceForVideoTrackConfiguration;
// std::unique_ptr<IsoSubspace> m_subspaceForVideoTrackList;
// std::unique_ptr<IsoSubspace> m_subspaceForCommandLineAPIHost;
// std::unique_ptr<IsoSubspace> m_subspaceForInspectorAuditAccessibilityObject;
// std::unique_ptr<IsoSubspace> m_subspaceForInspectorAuditDOMObject;
// std::unique_ptr<IsoSubspace> m_subspaceForInspectorAuditResourcesObject;
// std::unique_ptr<IsoSubspace> m_subspaceForInspectorFrontendHost;
// std::unique_ptr<IsoSubspace> m_subspaceForDOMApplicationCache;
// std::unique_ptr<IsoSubspace> m_subspaceForMathMLElement;
// std::unique_ptr<IsoSubspace> m_subspaceForMathMLMathElement;
// std::unique_ptr<IsoSubspace> m_subspaceForBarProp;
// std::unique_ptr<IsoSubspace> m_subspaceForCrypto;
// std::unique_ptr<IsoSubspace> m_subspaceForDOMSelection;
// std::unique_ptr<IsoSubspace> m_subspaceForDOMWindow;
// std::unique_ptr<IsoSubspace> m_subspaceForEventSource;
// std::unique_ptr<IsoSubspace> m_subspaceForHistory;
// std::unique_ptr<IsoSubspace> m_subspaceForIntersectionObserver;
// std::unique_ptr<IsoSubspace> m_subspaceForIntersectionObserverEntry;
// std::unique_ptr<IsoSubspace> m_subspaceForLocation;
// std::unique_ptr<IsoSubspace> m_subspaceForNavigator;
// std::unique_ptr<IsoSubspace> m_subspaceForPerformance;
// std::unique_ptr<IsoSubspace> m_subspaceForPerformanceEntry;
// std::unique_ptr<IsoSubspace> m_subspaceForPerformanceMark;
// std::unique_ptr<IsoSubspace> m_subspaceForPerformanceMeasure;
// std::unique_ptr<IsoSubspace> m_subspaceForPerformanceNavigation;
// std::unique_ptr<IsoSubspace> m_subspaceForPerformanceNavigationTiming;
// std::unique_ptr<IsoSubspace> m_subspaceForPerformanceObserver;
// std::unique_ptr<IsoSubspace> m_subspaceForPerformanceObserverEntryList;
// std::unique_ptr<IsoSubspace> m_subspaceForPerformancePaintTiming;
// std::unique_ptr<IsoSubspace> m_subspaceForPerformanceResourceTiming;
// std::unique_ptr<IsoSubspace> m_subspaceForPerformanceServerTiming;
// std::unique_ptr<IsoSubspace> m_subspaceForPerformanceTiming;
// std::unique_ptr<IsoSubspace> m_subspaceForRemoteDOMWindow;
// std::unique_ptr<IsoSubspace> m_subspaceForResizeObserver;
// std::unique_ptr<IsoSubspace> m_subspaceForResizeObserverEntry;
// std::unique_ptr<IsoSubspace> m_subspaceForResizeObserverSize;
// std::unique_ptr<IsoSubspace> m_subspaceForScreen;
// std::unique_ptr<IsoSubspace> m_subspaceForShadowRealmGlobalScope;
// std::unique_ptr<IsoSubspace> m_subspaceForUndoItem;
// std::unique_ptr<IsoSubspace> m_subspaceForUndoManager;
// std::unique_ptr<IsoSubspace> m_subspaceForUserMessageHandler;
// std::unique_ptr<IsoSubspace> m_subspaceForUserMessageHandlersNamespace;
// std::unique_ptr<IsoSubspace> m_subspaceForVisualViewport;
// std::unique_ptr<IsoSubspace> m_subspaceForWebKitNamespace;
// std::unique_ptr<IsoSubspace> m_subspaceForWebKitPoint;
// std::unique_ptr<IsoSubspace> m_subspaceForWorkerNavigator;
// std::unique_ptr<IsoSubspace> m_subspaceForDOMMimeType;
// std::unique_ptr<IsoSubspace> m_subspaceForDOMMimeTypeArray;
// std::unique_ptr<IsoSubspace> m_subspaceForDOMPlugin;
// std::unique_ptr<IsoSubspace> m_subspaceForDOMPluginArray;
// std::unique_ptr<IsoSubspace> m_subspaceForStorage;
// std::unique_ptr<IsoSubspace> m_subspaceForStorageEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGAElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGAltGlyphDefElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGAltGlyphElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGAltGlyphItemElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGAngle;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGAnimateColorElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGAnimateElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGAnimateMotionElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGAnimateTransformElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGAnimatedAngle;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGAnimatedBoolean;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGAnimatedEnumeration;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGAnimatedInteger;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGAnimatedLength;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGAnimatedLengthList;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGAnimatedNumber;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGAnimatedNumberList;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGAnimatedPreserveAspectRatio;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGAnimatedRect;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGAnimatedString;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGAnimatedTransformList;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGAnimationElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGCircleElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGClipPathElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGComponentTransferFunctionElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGCursorElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGDefsElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGDescElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGEllipseElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGFEBlendElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGFEColorMatrixElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGFEComponentTransferElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGFECompositeElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGFEConvolveMatrixElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGFEDiffuseLightingElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGFEDisplacementMapElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGFEDistantLightElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGFEDropShadowElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGFEFloodElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGFEFuncAElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGFEFuncBElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGFEFuncGElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGFEFuncRElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGFEGaussianBlurElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGFEImageElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGFEMergeElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGFEMergeNodeElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGFEMorphologyElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGFEOffsetElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGFEPointLightElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGFESpecularLightingElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGFESpotLightElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGFETileElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGFETurbulenceElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGFilterElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGFontElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGFontFaceElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGFontFaceFormatElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGFontFaceNameElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGFontFaceSrcElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGFontFaceUriElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGForeignObjectElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGGElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGGeometryElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGGlyphElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGGlyphRefElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGGradientElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGGraphicsElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGHKernElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGImageElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGLength;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGLengthList;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGLineElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGLinearGradientElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGMPathElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGMarkerElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGMaskElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGMatrix;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGMetadataElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGMissingGlyphElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGNumber;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGNumberList;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGPathElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGPathSeg;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGPathSegArcAbs;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGPathSegArcRel;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGPathSegClosePath;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGPathSegCurvetoCubicAbs;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGPathSegCurvetoCubicRel;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGPathSegCurvetoCubicSmoothAbs;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGPathSegCurvetoCubicSmoothRel;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGPathSegCurvetoQuadraticAbs;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGPathSegCurvetoQuadraticRel;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGPathSegCurvetoQuadraticSmoothAbs;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGPathSegCurvetoQuadraticSmoothRel;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGPathSegLinetoAbs;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGPathSegLinetoHorizontalAbs;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGPathSegLinetoHorizontalRel;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGPathSegLinetoRel;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGPathSegLinetoVerticalAbs;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGPathSegLinetoVerticalRel;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGPathSegList;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGPathSegMovetoAbs;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGPathSegMovetoRel;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGPatternElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGPoint;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGPointList;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGPolygonElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGPolylineElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGPreserveAspectRatio;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGRadialGradientElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGRect;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGRectElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGRenderingIntent;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGSVGElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGScriptElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGSetElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGStopElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGStringList;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGStyleElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGSwitchElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGSymbolElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGTRefElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGTSpanElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGTextContentElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGTextElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGTextPathElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGTextPositioningElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGTitleElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGTransform;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGTransformList;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGUnitTypes;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGUseElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGVKernElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGViewElement;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGViewSpec;
// std::unique_ptr<IsoSubspace> m_subspaceForSVGZoomEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForGCObservation;
// std::unique_ptr<IsoSubspace> m_subspaceForInternalSettings;
// std::unique_ptr<IsoSubspace> m_subspaceForInternals;
// std::unique_ptr<IsoSubspace> m_subspaceForInternalsMapLike;
// std::unique_ptr<IsoSubspace> m_subspaceForInternalsSetLike;
// std::unique_ptr<IsoSubspace> m_subspaceForMallocStatistics;
// std::unique_ptr<IsoSubspace> m_subspaceForMemoryInfo;
// std::unique_ptr<IsoSubspace> m_subspaceForMockCDMFactory;
// std::unique_ptr<IsoSubspace> m_subspaceForMockContentFilterSettings;
// std::unique_ptr<IsoSubspace> m_subspaceForMockPageOverlay;
// std::unique_ptr<IsoSubspace> m_subspaceForMockPaymentCoordinator;
// std::unique_ptr<IsoSubspace> m_subspaceForServiceWorkerInternals;
// std::unique_ptr<IsoSubspace> m_subspaceForTypeConversions;
// std::unique_ptr<IsoSubspace> m_subspaceForWebFakeXRDevice;
// std::unique_ptr<IsoSubspace> m_subspaceForWebFakeXRInputController;
// std::unique_ptr<IsoSubspace> m_subspaceForWebXRTest;
// std::unique_ptr<IsoSubspace> m_subspaceForDedicatedWorkerGlobalScope;
// std::unique_ptr<IsoSubspace> m_subspaceForWorker;
std::unique_ptr<IsoSubspace> m_subspaceForWorkerGlobalScope;
// std::unique_ptr<IsoSubspace> m_subspaceForWorkerLocation;
// std::unique_ptr<IsoSubspace> m_subspaceForExtendableEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForExtendableMessageEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForFetchEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForNavigationPreloadManager;
// std::unique_ptr<IsoSubspace> m_subspaceForServiceWorker;
// std::unique_ptr<IsoSubspace> m_subspaceForServiceWorkerClient;
// std::unique_ptr<IsoSubspace> m_subspaceForServiceWorkerClients;
// std::unique_ptr<IsoSubspace> m_subspaceForServiceWorkerContainer;
// std::unique_ptr<IsoSubspace> m_subspaceForServiceWorkerGlobalScope;
// std::unique_ptr<IsoSubspace> m_subspaceForServiceWorkerRegistration;
// std::unique_ptr<IsoSubspace> m_subspaceForServiceWorkerWindowClient;
// std::unique_ptr<IsoSubspace> m_subspaceForSharedWorker;
// std::unique_ptr<IsoSubspace> m_subspaceForSharedWorkerGlobalScope;
// std::unique_ptr<IsoSubspace> m_subspaceForPaintWorkletGlobalScope;
// std::unique_ptr<IsoSubspace> m_subspaceForWorklet;
// std::unique_ptr<IsoSubspace> m_subspaceForWorkletGlobalScope;
// std::unique_ptr<IsoSubspace> m_subspaceForDOMParser;
// std::unique_ptr<IsoSubspace> m_subspaceForXMLHttpRequest;
// std::unique_ptr<IsoSubspace> m_subspaceForXMLHttpRequestEventTarget;
// std::unique_ptr<IsoSubspace> m_subspaceForXMLHttpRequestProgressEvent;
// std::unique_ptr<IsoSubspace> m_subspaceForXMLHttpRequestUpload;
// std::unique_ptr<IsoSubspace> m_subspaceForXMLSerializer;
// std::unique_ptr<IsoSubspace> m_subspaceForXPathEvaluator;
// std::unique_ptr<IsoSubspace> m_subspaceForXPathExpression;
// std::unique_ptr<IsoSubspace> m_subspaceForXPathNSResolver;
// std::unique_ptr<IsoSubspace> m_subspaceForXPathResult;
// std::unique_ptr<IsoSubspace> m_subspaceForXSLTProcessor;
std::unique_ptr<IsoSubspace> m_subspaceForGlobalObject;
std::unique_ptr<IsoSubspace> m_subspaceForExposedToWorkerAndWindow;
std::unique_ptr<IsoSubspace> m_subspaceForURLSearchParams;
std::unique_ptr<IsoSubspace> m_subspaceForURLSearchParamsIterator;
std::unique_ptr<IsoSubspace> m_subspaceForDOMException;
std::unique_ptr<IsoSubspace> m_subspaceForDOMFormData;
std::unique_ptr<IsoSubspace> m_subspaceForDOMFormDataIterator;
std::unique_ptr<IsoSubspace> m_subspaceForDOMURL;
};
} // namespace WebCore
namespace WebCore {
using DOMIsoSubspaces = WebCore::DOMIsoSubspaces;
}

View File

@@ -0,0 +1,60 @@
/*
* Copyright (C) 2019 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.
*/
#pragma once
#include "wtf/text/WTFString.h"
namespace WebCore {
struct ExceptionDetails {
enum class Type : uint8_t {
Script,
InvalidTargetFrame,
AppBoundDomain,
};
String message;
int lineNumber { 0 };
int columnNumber { 0 };
Type type { Type::Script };
// This bizarre explicit initialization of String is because older compilers (like on High Sierra)
// don't properly handle partial initialization lists unless every struct member has an explicit default value.
// Once we stop building on those platforms we can remove this.
String sourceURL {};
};
} // namespace WebCore
namespace WTF {
template<> struct EnumTraits<WebCore::ExceptionDetails::Type> {
using values = EnumValues<
WebCore::ExceptionDetails::Type,
WebCore::ExceptionDetails::Type::Script,
WebCore::ExceptionDetails::Type::InvalidTargetFrame,
WebCore::ExceptionDetails::Type::AppBoundDomain>;
};
}

View File

@@ -0,0 +1,41 @@
/*
* Copyright (C) 2022 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.
*/
#pragma once
#include "DOMClientIsoSubspaces.h"
namespace WebCore {
class ExtendedDOMClientIsoSubspaces : public DOMClientIsoSubspaces {
public:
ExtendedDOMClientIsoSubspaces() = default;
};
} // namespace WebCore
namespace WebCore {
using ExtendedDOMClientIsoSubspaces = WebCore::ExtendedDOMClientIsoSubspaces;
}

View File

@@ -0,0 +1,37 @@
/*
* Copyright (C) 2022 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.
*/
#pragma once
#include "DOMIsoSubspaces.h"
namespace WebCore {
class ExtendedDOMIsoSubspaces : public DOMIsoSubspaces {
public:
ExtendedDOMIsoSubspaces() = default;
};
} // namespace WebCore

View File

@@ -0,0 +1,136 @@
/*
* Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
* Copyright (C) 2003-2020 Apple Inc. All rights reserved.
* Copyright (C) 2007 Samuel Weinig <sam@webkit.org>
* Copyright (C) 2009 Google, Inc. All rights reserved.
* Copyright (C) 2012 Ericsson AB. All rights reserved.
* Copyright (C) 2013 Michael Pruett <michael@68k.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#pragma once
#include "JSDOMCastThisValue.h"
#include "JSDOMExceptionHandling.h"
namespace WebCore {
template<typename JSClass>
class IDLAttribute {
public:
using Setter = bool(JSC::JSGlobalObject&, JSClass&, JSC::JSValue);
using SetterPassingPropertyName = bool(JSC::JSGlobalObject&, JSClass&, JSC::JSValue, JSC::PropertyName);
using StaticSetter = bool(JSC::JSGlobalObject&, JSC::JSValue);
using Getter = JSC::JSValue(JSC::JSGlobalObject&, JSClass&);
using GetterPassingPropertyName = JSC::JSValue(JSC::JSGlobalObject&, JSClass&, JSC::PropertyName);
using StaticGetter = JSC::JSValue(JSC::JSGlobalObject&);
template<Setter setter, CastedThisErrorBehavior shouldThrow = CastedThisErrorBehavior::Throw>
static bool set(JSC::JSGlobalObject& lexicalGlobalObject, JSC::EncodedJSValue thisValue, JSC::EncodedJSValue encodedValue, JSC::PropertyName attributeName)
{
auto throwScope = DECLARE_THROW_SCOPE(JSC::getVM(&lexicalGlobalObject));
auto* thisObject = castThisValue<JSClass>(lexicalGlobalObject, JSC::JSValue::decode(thisValue));
if (UNLIKELY(!thisObject)) {
if constexpr (shouldThrow == CastedThisErrorBehavior::Throw)
return JSC::throwVMDOMAttributeSetterTypeError(&lexicalGlobalObject, throwScope, JSClass::info(), attributeName);
else
return false;
}
RELEASE_AND_RETURN(throwScope, (setter(lexicalGlobalObject, *thisObject, JSC::JSValue::decode(encodedValue))));
}
// FIXME: FIXME: This can be merged with `set` if we replace the explicit setter function template parameter with a generic lambda.
template<SetterPassingPropertyName setter, CastedThisErrorBehavior shouldThrow = CastedThisErrorBehavior::Throw>
static bool setPassingPropertyName(JSC::JSGlobalObject& lexicalGlobalObject, JSC::EncodedJSValue thisValue, JSC::EncodedJSValue encodedValue, JSC::PropertyName attributeName)
{
auto throwScope = DECLARE_THROW_SCOPE(JSC::getVM(&lexicalGlobalObject));
auto* thisObject = castThisValue<JSClass>(lexicalGlobalObject, JSC::JSValue::decode(thisValue));
if (UNLIKELY(!thisObject)) {
if constexpr (shouldThrow == CastedThisErrorBehavior::Throw)
return JSC::throwVMDOMAttributeSetterTypeError(&lexicalGlobalObject, throwScope, JSClass::info(), attributeName);
else
return false;
}
RELEASE_AND_RETURN(throwScope, (setter(lexicalGlobalObject, *thisObject, JSC::JSValue::decode(encodedValue), attributeName)));
}
template<StaticSetter setter, CastedThisErrorBehavior shouldThrow = CastedThisErrorBehavior::Throw>
static bool setStatic(JSC::JSGlobalObject& lexicalGlobalObject, JSC::EncodedJSValue, JSC::EncodedJSValue encodedValue, JSC::PropertyName)
{
return setter(lexicalGlobalObject, JSC::JSValue::decode(encodedValue));
}
template<Getter getter, CastedThisErrorBehavior shouldThrow = CastedThisErrorBehavior::Throw>
static JSC::EncodedJSValue get(JSC::JSGlobalObject& lexicalGlobalObject, JSC::EncodedJSValue thisValue, JSC::PropertyName attributeName)
{
auto throwScope = DECLARE_THROW_SCOPE(JSC::getVM(&lexicalGlobalObject));
if constexpr (shouldThrow == CastedThisErrorBehavior::Assert) {
ASSERT(castThisValue<JSClass>(lexicalGlobalObject, JSC::JSValue::decode(thisValue)));
auto* thisObject = JSC::jsCast<JSClass*>(JSC::JSValue::decode(thisValue));
RELEASE_AND_RETURN(throwScope, (JSC::JSValue::encode(getter(lexicalGlobalObject, *thisObject))));
} else {
auto* thisObject = castThisValue<JSClass>(lexicalGlobalObject, JSC::JSValue::decode(thisValue));
if (UNLIKELY(!thisObject)) {
if constexpr (shouldThrow == CastedThisErrorBehavior::Throw)
return JSC::throwVMDOMAttributeGetterTypeError(&lexicalGlobalObject, throwScope, JSClass::info(), attributeName);
else if constexpr (shouldThrow == CastedThisErrorBehavior::RejectPromise)
RELEASE_AND_RETURN(throwScope, rejectPromiseWithGetterTypeError(lexicalGlobalObject, JSClass::info(), attributeName));
else
return JSC::JSValue::encode(JSC::jsUndefined());
}
RELEASE_AND_RETURN(throwScope, (JSC::JSValue::encode(getter(lexicalGlobalObject, *thisObject))));
}
}
// FIXME: This can be merged with `get` if we replace the explicit setter function template parameter with a generic lambda.
template<GetterPassingPropertyName getter, CastedThisErrorBehavior shouldThrow = CastedThisErrorBehavior::Throw>
static JSC::EncodedJSValue getPassingPropertyName(JSC::JSGlobalObject& lexicalGlobalObject, JSC::EncodedJSValue thisValue, JSC::PropertyName attributeName)
{
auto throwScope = DECLARE_THROW_SCOPE(JSC::getVM(&lexicalGlobalObject));
if constexpr (shouldThrow == CastedThisErrorBehavior::Assert) {
ASSERT(castThisValue<JSClass>(lexicalGlobalObject, JSC::JSValue::decode(thisValue)));
auto* thisObject = JSC::jsCast<JSClass*>(JSC::JSValue::decode(thisValue));
RELEASE_AND_RETURN(throwScope, (JSC::JSValue::encode(getter(lexicalGlobalObject, *thisObject, attributeName))));
} else {
auto* thisObject = castThisValue<JSClass>(lexicalGlobalObject, JSC::JSValue::decode(thisValue));
if (UNLIKELY(!thisObject)) {
if constexpr (shouldThrow == CastedThisErrorBehavior::Throw)
return JSC::throwVMDOMAttributeGetterTypeError(&lexicalGlobalObject, throwScope, JSClass::info(), attributeName);
else if constexpr (shouldThrow == CastedThisErrorBehavior::RejectPromise)
RELEASE_AND_RETURN(throwScope, rejectPromiseWithGetterTypeError(lexicalGlobalObject, JSClass::info(), attributeName));
else
return JSC::JSValue::encode(JSC::jsUndefined());
}
RELEASE_AND_RETURN(throwScope, (JSC::JSValue::encode(getter(lexicalGlobalObject, *thisObject, attributeName))));
}
}
template<StaticGetter getter, CastedThisErrorBehavior shouldThrow = CastedThisErrorBehavior::Throw>
static JSC::EncodedJSValue getStatic(JSC::JSGlobalObject& lexicalGlobalObject, JSC::EncodedJSValue, JSC::PropertyName)
{
return JSC::JSValue::encode(getter(lexicalGlobalObject));
}
};
} // namespace WebCore

View File

@@ -0,0 +1,79 @@
// /*
// * Copyright (c) 2016 Apple Inc. All rights reserved.
// * Copyright (c) 2017 Apple Inc.
// *
// * 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. AND ITS CONTRIBUTORS ``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 ITS 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.
// *
// */
// // DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for
// // builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py
// #include "config.h"
// #include "JSDOMBindingInternalsBuiltins.h"
// #include "WebCoreJSClientData.h"
// #include "JavaScriptCore/HeapInlines.h"
// #include "JavaScriptCore/IdentifierInlines.h"
// #include "JavaScriptCore/Intrinsic.h"
// #include "JavaScriptCore/JSCJSValueInlines.h"
// #include "JavaScriptCore/JSCellInlines.h"
// #include "JavaScriptCore/StructureInlines.h"
// #include "JavaScriptCore/VM.h"
// namespace WebCore {
// const JSC::ConstructAbility s_jsDOMBindingInternalsForEachWrapperCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
// const JSC::ConstructorKind s_jsDOMBindingInternalsForEachWrapperCodeConstructorKind = JSC::ConstructorKind::None;
// const int s_jsDOMBindingInternalsForEachWrapperCodeLength = 170;
// static const JSC::Intrinsic s_jsDOMBindingInternalsForEachWrapperCodeIntrinsic = JSC::NoIntrinsic;
// const char* const s_jsDOMBindingInternalsForEachWrapperCode =
// "(function (mapLikeOrSetLike, callback)\n" \
// "{\n" \
// " \"use strict\";\n" \
// " mapLikeOrSetLike.forEach((value, key, backingMapOrSet) => {\n" \
// " callback(value, key, this);\n" \
// " });\n" \
// "})\n" \
// ;
// const JSC::ConstructAbility s_jsDOMBindingInternalsGetUserMediaShimCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
// const JSC::ConstructorKind s_jsDOMBindingInternalsGetUserMediaShimCodeConstructorKind = JSC::ConstructorKind::None;
// const int s_jsDOMBindingInternalsGetUserMediaShimCodeLength = 147;
// static const JSC::Intrinsic s_jsDOMBindingInternalsGetUserMediaShimCodeIntrinsic = JSC::NoIntrinsic;
// const char* const s_jsDOMBindingInternalsGetUserMediaShimCode =
// "(function (constraints, successCallback, errorCallback)\n" \
// "{\n" \
// " this.mediaDevices.getUserMedia(constraints).then(successCallback, errorCallback);\n" \
// "})\n" \
// ;
// #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \
// JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \
// {\
// JSVMClientData* clientData = static_cast<JSVMClientData*>(vm.clientData); \
// return clientData->builtinFunctions().jsDOMBindingInternalsBuiltins().codeName##Executable()->link(vm, nullptr, clientData->builtinFunctions().jsDOMBindingInternalsBuiltins().codeName##Source(), std::nullopt, s_##codeName##Intrinsic); \
// }
// WEBCORE_FOREACH_JSDOMBINDINGINTERNALS_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR)
// #undef DEFINE_BUILTIN_GENERATOR
// } // namespace WebCore

View File

@@ -0,0 +1,159 @@
// /*
// * Copyright (c) 2016 Apple Inc. All rights reserved.
// * Copyright (c) 2017 Apple Inc.
// *
// * 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. AND ITS CONTRIBUTORS ``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 ITS 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.
// *
// */
// // DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for
// // builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py
// #pragma once
// #include "JavaScriptCore/BuiltinUtils.h"
// #include "JavaScriptCore/Identifier.h"
// #include "JavaScriptCore/JSFunction.h"
// #include "JavaScriptCore/UnlinkedFunctionExecutable.h"
// namespace JSC {
// class FunctionExecutable;
// }
// namespace WebCore {
// /* JSDOMBindingInternals */
// extern const char* const s_jsDOMBindingInternalsForEachWrapperCode;
// extern const int s_jsDOMBindingInternalsForEachWrapperCodeLength;
// extern const JSC::ConstructAbility s_jsDOMBindingInternalsForEachWrapperCodeConstructAbility;
// extern const JSC::ConstructorKind s_jsDOMBindingInternalsForEachWrapperCodeConstructorKind;
// extern const char* const s_jsDOMBindingInternalsGetUserMediaShimCode;
// extern const int s_jsDOMBindingInternalsGetUserMediaShimCodeLength;
// extern const JSC::ConstructAbility s_jsDOMBindingInternalsGetUserMediaShimCodeConstructAbility;
// extern const JSC::ConstructorKind s_jsDOMBindingInternalsGetUserMediaShimCodeConstructorKind;
// #define WEBCORE_BUILTIN_JSDOMBINDINGINTERNALS_FOREACHWRAPPER 0
// #define WEBCORE_BUILTIN_JSDOMBINDINGINTERNALS_GETUSERMEDIASHIM 0
// #define WEBCORE_FOREACH_JSDOMBINDINGINTERNALS_BUILTIN_CODE(macro) \
// macro(jsDOMBindingInternalsForEachWrapperCode, forEachWrapper, static_cast<const char*>(nullptr), s_jsDOMBindingInternalsForEachWrapperCodeLength) \
// macro(jsDOMBindingInternalsGetUserMediaShimCode, getUserMediaShim, static_cast<const char*>(nullptr), s_jsDOMBindingInternalsGetUserMediaShimCodeLength)
// #define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \
// JSC::FunctionExecutable* codeName##Generator(JSC::VM&);
// WEBCORE_FOREACH_JSDOMBINDINGINTERNALS_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR)
// #undef DECLARE_BUILTIN_GENERATOR
// class JSDOMBindingInternalsBuiltinsWrapper : private JSC::WeakHandleOwner {
// public:
// explicit JSDOMBindingInternalsBuiltinsWrapper(JSC::VM& vm)
// : m_vm(vm)
// WEBCORE_FOREACH_JSDOMBINDINGINTERNALS_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES)
// #define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) , m_##name##Source(JSC::makeSource(StringImpl::createFromLiteral(s_##name, length), {}))
// WEBCORE_FOREACH_JSDOMBINDINGINTERNALS_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS)
// #undef INITIALIZE_BUILTIN_SOURCE_MEMBERS
// {
// }
// #define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \
// JSC::UnlinkedFunctionExecutable* name##Executable(); \
// const JSC::SourceCode& name##Source() const { return m_##name##Source; }
// WEBCORE_FOREACH_JSDOMBINDINGINTERNALS_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES)
// #undef EXPOSE_BUILTIN_EXECUTABLES
// WEBCORE_FOREACH_JSDOMBINDINGINTERNALS_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR)
// void exportNames();
// private:
// JSC::VM& m_vm;
// WEBCORE_FOREACH_JSDOMBINDINGINTERNALS_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES)
// #define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) \
// JSC::SourceCode m_##name##Source; \
// JSC::Weak<JSC::UnlinkedFunctionExecutable> m_##name##Executable;
// WEBCORE_FOREACH_JSDOMBINDINGINTERNALS_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS)
// #undef DECLARE_BUILTIN_SOURCE_MEMBERS
// };
// #define DEFINE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \
// inline JSC::UnlinkedFunctionExecutable* JSDOMBindingInternalsBuiltinsWrapper::name##Executable() \
// { \
// if (!m_##name##Executable) { \
// JSC::Identifier executableName = functionName##PublicName(); \
// if (overriddenName) \
// executableName = JSC::Identifier::fromString(m_vm, overriddenName); \
// m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, executableName, s_##name##ConstructorKind, s_##name##ConstructAbility), this, &m_##name##Executable); \
// } \
// return m_##name##Executable.get(); \
// }
// WEBCORE_FOREACH_JSDOMBINDINGINTERNALS_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES)
// #undef DEFINE_BUILTIN_EXECUTABLES
// inline void JSDOMBindingInternalsBuiltinsWrapper::exportNames()
// {
// #define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName());
// WEBCORE_FOREACH_JSDOMBINDINGINTERNALS_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME)
// #undef EXPORT_FUNCTION_NAME
// }
// class JSDOMBindingInternalsBuiltinFunctions {
// public:
// explicit JSDOMBindingInternalsBuiltinFunctions(JSC::VM& vm)
// : m_vm(vm)
// {
// }
// void init(JSC::JSGlobalObject&);
// template<typename Visitor> void visit(Visitor&);
// public:
// JSC::VM& m_vm;
// #define DECLARE_BUILTIN_SOURCE_MEMBERS(functionName) \
// JSC::WriteBarrier<JSC::JSFunction> m_##functionName##Function;
// WEBCORE_FOREACH_JSDOMBINDINGINTERNALS_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_SOURCE_MEMBERS)
// #undef DECLARE_BUILTIN_SOURCE_MEMBERS
// };
// inline void JSDOMBindingInternalsBuiltinFunctions::init(JSC::JSGlobalObject& globalObject)
// {
// #define EXPORT_FUNCTION(codeName, functionName, overriddenName, length) \
// m_##functionName##Function.set(m_vm, &globalObject, JSC::JSFunction::create(m_vm, codeName##Generator(m_vm), &globalObject));
// WEBCORE_FOREACH_JSDOMBINDINGINTERNALS_BUILTIN_CODE(EXPORT_FUNCTION)
// #undef EXPORT_FUNCTION
// }
// template<typename Visitor>
// inline void JSDOMBindingInternalsBuiltinFunctions::visit(Visitor& visitor)
// {
// #define VISIT_FUNCTION(name) visitor.append(m_##name##Function);
// WEBCORE_FOREACH_JSDOMBINDINGINTERNALS_BUILTIN_FUNCTION_NAME(VISIT_FUNCTION)
// #undef VISIT_FUNCTION
// }
// template void JSDOMBindingInternalsBuiltinFunctions::visit(JSC::AbstractSlotVisitor&);
// template void JSDOMBindingInternalsBuiltinFunctions::visit(JSC::SlotVisitor&);
// } // namespace WebCore

View File

@@ -0,0 +1,54 @@
/*
* Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
* Copyright (C) 2003-2006, 2008-2009, 2013, 2016 Apple Inc. All rights reserved.
* Copyright (C) 2007 Samuel Weinig <sam@webkit.org>
* Copyright (C) 2009 Google, Inc. All rights reserved.
* Copyright (C) 2012 Ericsson AB. All rights reserved.
* Copyright (C) 2013 Michael Pruett <michael@68k.org>
*
* 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. AND ITS CONTRIBUTORS ``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 ITS 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.
*/
#pragma once
#include "JSDOMGlobalObject.h"
namespace WebCore {
enum class CastedThisErrorBehavior : uint8_t {
Throw,
ReturnEarly,
RejectPromise,
Assert,
};
template<class JSClass>
JSClass* castThisValue(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue thisValue)
{
auto& vm = JSC::getVM(&lexicalGlobalObject);
if constexpr (std::is_base_of_v<JSDOMGlobalObject, JSClass>)
return toJSDOMGlobalObject<JSClass>(vm, thisValue.isUndefinedOrNull() ? JSC::JSValue(&lexicalGlobalObject) : thisValue);
else
return JSC::jsDynamicCast<JSClass*>(vm, thisValue);
}
}

View File

@@ -0,0 +1,72 @@
/*
* Copyright (C) 2015, 2016 Canon Inc. All rights reserved.
* Copyright (C) 2016-2021 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#pragma once
#include "JSDOMConstructorBase.h"
namespace WebCore {
template<typename JSClass> class JSDOMConstructor final : public JSDOMConstructorBase {
public:
using Base = JSDOMConstructorBase;
static JSDOMConstructor* create(JSC::VM&, JSC::Structure*, JSDOMGlobalObject&);
static JSC::Structure* createStructure(JSC::VM&, JSC::JSGlobalObject&, JSC::JSValue prototype);
DECLARE_INFO;
// Must be defined for each specialization class.
static JSC::JSValue prototypeForStructure(JSC::VM&, const JSDOMGlobalObject&);
// Must be defined for each specialization class.
static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES construct(JSC::JSGlobalObject*, JSC::CallFrame*);
private:
JSDOMConstructor(JSC::VM& vm, JSC::Structure* structure)
: Base(vm, structure, construct)
{
}
void finishCreation(JSC::VM&, JSDOMGlobalObject&);
// Usually defined for each specialization class.
void initializeProperties(JSC::VM&, JSDOMGlobalObject&) { }
};
template<typename JSClass> inline JSDOMConstructor<JSClass>* JSDOMConstructor<JSClass>::create(JSC::VM& vm, JSC::Structure* structure, JSDOMGlobalObject& globalObject)
{
JSDOMConstructor* constructor = new (NotNull, JSC::allocateCell<JSDOMConstructor>(vm)) JSDOMConstructor(vm, structure);
constructor->finishCreation(vm, globalObject);
return constructor;
}
template<typename JSClass> inline JSC::Structure* JSDOMConstructor<JSClass>::createStructure(JSC::VM& vm, JSC::JSGlobalObject& globalObject, JSC::JSValue prototype)
{
return JSC::Structure::create(vm, &globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info());
}
template<typename JSClass> inline void JSDOMConstructor<JSClass>::finishCreation(JSC::VM& vm, JSDOMGlobalObject& globalObject)
{
Base::finishCreation(vm);
ASSERT(inherits(vm, info()));
initializeProperties(vm, globalObject);
}
} // namespace WebCore

View File

@@ -0,0 +1,54 @@
/*
* Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
* Copyright (C) 2004-2022 Apple Inc. All rights reserved.
* Copyright (C) 2007 Samuel Weinig <sam@webkit.org>
* Copyright (C) 2013 Michael Pruett <michael@68k.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "config.h"
#include "JSDOMConstructor.h"
#include "JavaScriptCore/JSCInlines.h"
#include "WebCoreJSClientData.h"
namespace WebCore {
using namespace JSC;
STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(JSDOMConstructorBase);
JSC_DEFINE_HOST_FUNCTION(callThrowTypeErrorForJSDOMConstructor, (JSGlobalObject * globalObject, CallFrame*))
{
VM& vm = globalObject->vm();
auto scope = DECLARE_THROW_SCOPE(vm);
throwTypeError(globalObject, scope, "Constructor requires 'new' operator"_s);
return JSValue::encode(jsNull());
}
JSC_DEFINE_HOST_FUNCTION(callThrowTypeErrorForJSDOMConstructorNotConstructable, (JSC::JSGlobalObject * globalObject, JSC::CallFrame*))
{
JSC::VM& vm = globalObject->vm();
auto scope = DECLARE_THROW_SCOPE(vm);
JSC::throwTypeError(globalObject, scope, "Illegal constructor"_s);
return JSC::JSValue::encode(JSC::jsNull());
}
JSC::GCClient::IsoSubspace* JSDOMConstructorBase::subspaceForImpl(JSC::VM& vm)
{
return &static_cast<JSVMClientData*>(vm.clientData)->domConstructorSpace();
}
} // namespace WebCore

View File

@@ -0,0 +1,63 @@
/*
* Copyright (C) 2015, 2016 Canon Inc. All rights reserved.
* Copyright (C) 2016-2022 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#pragma once
#include "JSDOMGlobalObject.h"
#include "JavaScriptCore/InternalFunction.h"
#include "ZigGlobalObject.h"
namespace WebCore {
JSC_DECLARE_HOST_FUNCTION(callThrowTypeErrorForJSDOMConstructor);
JSC_DECLARE_HOST_FUNCTION(callThrowTypeErrorForJSDOMConstructorNotConstructable);
// Base class for all callable constructor objects in the JSC bindings.
class JSDOMConstructorBase : public JSC::InternalFunction {
public:
using Base = InternalFunction;
static constexpr unsigned StructureFlags = Base::StructureFlags;
static constexpr bool needsDestruction = false;
template<typename CellType, JSC::SubspaceAccess>
static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm)
{
static_assert(sizeof(CellType) == sizeof(JSDOMConstructorBase));
STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(CellType, JSDOMConstructorBase);
static_assert(CellType::destroy == JSC::JSCell::destroy, "JSDOMConstructor<JSClass> is not destructible actually");
return subspaceForImpl(vm);
}
static JSC::GCClient::IsoSubspace* subspaceForImpl(JSC::VM&);
JSDOMGlobalObject* globalObject() const { return JSC::jsCast<JSDOMGlobalObject*>(Base::globalObject()); }
// ScriptExecutionContext* scriptExecutionContext() const { return globalObject()->scriptExecutionContext(); }
protected:
JSDOMConstructorBase(JSC::VM& vm, JSC::Structure* structure, JSC::NativeFunction functionForConstruct)
: Base(vm, structure,
functionForConstruct ? callThrowTypeErrorForJSDOMConstructor : callThrowTypeErrorForJSDOMConstructorNotConstructable,
functionForConstruct ? functionForConstruct : callThrowTypeErrorForJSDOMConstructorNotConstructable)
{
}
};
} // namespace WebCore

View File

@@ -0,0 +1,85 @@
/*
* Copyright (C) 2021 Alexey Shvayka <shvaikalesh@gmail.com>
* Copyright (C) 2021-2022 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. AND ITS CONTRIBUTORS ``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 ITS 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.
*/
#pragma once
#include "JSDOMWrapper.h"
#include "WebCoreJSClientData.h"
namespace WebCore {
template<typename JSClass> class JSDOMConstructorNotCallable : public JSDOMObject {
public:
using Base = JSDOMObject;
static constexpr unsigned StructureFlags = Base::StructureFlags;
static constexpr bool needsDestruction = false;
static JSDOMConstructorNotCallable* create(JSC::VM&, JSC::Structure*, JSDOMGlobalObject&);
static JSC::Structure* createStructure(JSC::VM&, JSC::JSGlobalObject&, JSC::JSValue prototype);
DECLARE_INFO;
static JSC::JSValue prototypeForStructure(JSC::VM&, const JSDOMGlobalObject&);
template<typename CellType, JSC::SubspaceAccess>
static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm)
{
static_assert(sizeof(CellType) == sizeof(JSDOMConstructorNotCallable));
STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(CellType, JSDOMConstructorNotCallable);
static_assert(CellType::destroy == JSC::JSCell::destroy, "JSDOMConstructorNotCallable<JSClass> is not destructible actually");
return &static_cast<JSVMClientData*>(vm.clientData)->domNamespaceObjectSpace();
}
private:
JSDOMConstructorNotCallable(JSC::Structure* structure, JSDOMGlobalObject& globalObject)
: Base(structure, globalObject)
{
}
void finishCreation(JSC::VM&, JSDOMGlobalObject&);
void initializeProperties(JSC::VM&, JSDOMGlobalObject&) {}
};
template<typename JSClass> inline JSDOMConstructorNotCallable<JSClass>* JSDOMConstructorNotCallable<JSClass>::create(JSC::VM& vm, JSC::Structure* structure, JSDOMGlobalObject& globalObject)
{
JSDOMConstructorNotCallable* constructor = new (NotNull, JSC::allocateCell<JSDOMConstructorNotCallable>(vm)) JSDOMConstructorNotCallable(structure, globalObject);
constructor->finishCreation(vm, globalObject);
return constructor;
}
template<typename JSClass> inline JSC::Structure* JSDOMConstructorNotCallable<JSClass>::createStructure(JSC::VM& vm, JSC::JSGlobalObject& globalObject, JSC::JSValue prototype)
{
return JSC::Structure::create(vm, &globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
}
template<typename JSClass> inline void JSDOMConstructorNotCallable<JSClass>::finishCreation(JSC::VM& vm, JSDOMGlobalObject& globalObject)
{
Base::finishCreation(vm);
ASSERT(inherits(vm, info()));
initializeProperties(vm, globalObject);
}
} // namespace WebCore

View File

@@ -0,0 +1,69 @@
/*
* Copyright (C) 2015, 2016 Canon Inc. All rights reserved.
* Copyright (C) 2016-2021 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#pragma once
#include "JSDOMConstructorBase.h"
namespace WebCore {
template<typename JSClass> class JSDOMConstructorNotConstructable final : public JSDOMConstructorBase {
public:
using Base = JSDOMConstructorBase;
static JSDOMConstructorNotConstructable* create(JSC::VM&, JSC::Structure*, JSDOMGlobalObject&);
static JSC::Structure* createStructure(JSC::VM&, JSC::JSGlobalObject&, JSC::JSValue prototype);
DECLARE_INFO;
// Must be defined for each specialization class.
static JSC::JSValue prototypeForStructure(JSC::VM&, const JSDOMGlobalObject&);
private:
JSDOMConstructorNotConstructable(JSC::VM& vm, JSC::Structure* structure)
: Base(vm, structure, nullptr)
{
}
void finishCreation(JSC::VM&, JSDOMGlobalObject&);
// Usually defined for each specialization class.
void initializeProperties(JSC::VM&, JSDOMGlobalObject&) {}
};
template<typename JSClass> inline JSDOMConstructorNotConstructable<JSClass>* JSDOMConstructorNotConstructable<JSClass>::create(JSC::VM& vm, JSC::Structure* structure, JSDOMGlobalObject& globalObject)
{
JSDOMConstructorNotConstructable* constructor = new (NotNull, JSC::allocateCell<JSDOMConstructorNotConstructable>(vm)) JSDOMConstructorNotConstructable(vm, structure);
constructor->finishCreation(vm, globalObject);
return constructor;
}
template<typename JSClass> inline JSC::Structure* JSDOMConstructorNotConstructable<JSClass>::createStructure(JSC::VM& vm, JSC::JSGlobalObject& globalObject, JSC::JSValue prototype)
{
return JSC::Structure::create(vm, &globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info());
}
template<typename JSClass> inline void JSDOMConstructorNotConstructable<JSClass>::finishCreation(JSC::VM& vm, JSDOMGlobalObject& globalObject)
{
Base::finishCreation(vm);
ASSERT(inherits(vm, info()));
initializeProperties(vm, globalObject);
}
} // namespace WebCore

View File

@@ -0,0 +1,47 @@
/*
* 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. AND ITS CONTRIBUTORS ``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 ITS 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.
*/
#pragma once
#include "JSDOMConvertAny.h"
#include "JSDOMConvertBoolean.h"
#include "JSDOMConvertBufferSource.h"
#include "JSDOMConvertCallbacks.h"
#include "JSDOMConvertDate.h"
#include "JSDOMConvertDictionary.h"
#include "JSDOMConvertEnumeration.h"
#include "JSDOMConvertEventListener.h"
#include "JSDOMConvertInterface.h"
#include "JSDOMConvertJSON.h"
#include "JSDOMConvertNull.h"
#include "JSDOMConvertNullable.h"
#include "JSDOMConvertNumbers.h"
#include "JSDOMConvertObject.h"
#include "JSDOMConvertRecord.h"
#include "JSDOMConvertSequences.h"
#include "JSDOMConvertSerializedScriptValue.h"
#include "JSDOMConvertStrings.h"
#include "JSDOMConvertUnion.h"
#include "JSDOMConvertWebGL.h"

View File

@@ -0,0 +1,85 @@
/*
* 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. AND ITS CONTRIBUTORS ``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 ITS 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.
*/
#pragma once
#include "IDLTypes.h"
#include "JSDOMConvertBase.h"
#include "JSValueInWrappedObject.h"
namespace WebCore {
template<> struct Converter<IDLAny> : DefaultConverter<IDLAny> {
using ReturnType = JSC::JSValue;
static constexpr bool conversionHasSideEffects = false;
static JSC::JSValue convert(JSC::JSGlobalObject&, JSC::JSValue value)
{
return value;
}
static JSC::JSValue convert(const JSC::Strong<JSC::Unknown>& value)
{
return value.get();
}
};
template<> struct JSConverter<IDLAny> {
static constexpr bool needsState = false;
static constexpr bool needsGlobalObject = false;
static JSC::JSValue convert(const JSC::JSValue& value)
{
return value;
}
static JSC::JSValue convert(const JSC::Strong<JSC::Unknown>& value)
{
return value.get();
}
static JSC::JSValue convert(const JSValueInWrappedObject& value)
{
return value.getValue();
}
};
template<> struct VariadicConverter<IDLAny> {
using Item = typename IDLAny::ImplementationType;
static std::optional<Item> convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value)
{
auto& vm = JSC::getVM(&lexicalGlobalObject);
auto scope = DECLARE_THROW_SCOPE(vm);
auto result = Converter<IDLAny>::convert(lexicalGlobalObject, value);
RETURN_IF_EXCEPTION(scope, std::nullopt);
return Item { vm, result };
}
};
} // namespace WebCore

View File

@@ -0,0 +1,268 @@
/*
* 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. AND ITS CONTRIBUTORS ``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 ITS 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.
*/
#pragma once
#include "root.h"
#include "ZigGlobalObject.h"
#include "JSDOMExceptionHandling.h"
#include "JavaScriptCore/Error.h"
namespace WebCore {
// Conversion from JSValue -> Implementation
template<typename T> struct Converter;
namespace Detail {
template<typename T> inline T* getPtrOrRef(const T* p) { return const_cast<T*>(p); }
template<typename T> inline T& getPtrOrRef(const T& p) { return const_cast<T&>(p); }
template<typename T> inline T* getPtrOrRef(const RefPtr<T>& p) { return p.get(); }
template<typename T> inline T& getPtrOrRef(const Ref<T>& p) { return p.get(); }
}
struct DefaultExceptionThrower {
void operator()(JSC::JSGlobalObject& lexicalGlobalObject, JSC::ThrowScope& scope)
{
throwTypeError(&lexicalGlobalObject, scope);
}
};
template<typename T> typename Converter<T>::ReturnType convert(JSC::JSGlobalObject&, JSC::JSValue);
template<typename T> typename Converter<T>::ReturnType convert(JSC::JSGlobalObject&, JSC::JSValue, JSC::JSObject&);
template<typename T> typename Converter<T>::ReturnType convert(JSC::JSGlobalObject&, JSC::JSValue, JSDOMGlobalObject&);
template<typename T, typename ExceptionThrower> typename Converter<T>::ReturnType convert(JSC::JSGlobalObject&, JSC::JSValue, ExceptionThrower&&);
template<typename T, typename ExceptionThrower> typename Converter<T>::ReturnType convert(JSC::JSGlobalObject&, JSC::JSValue, JSC::JSObject&, ExceptionThrower&&);
template<typename T, typename ExceptionThrower> typename Converter<T>::ReturnType convert(JSC::JSGlobalObject&, JSC::JSValue, JSDOMGlobalObject&, ExceptionThrower&&);
template<typename T> inline typename Converter<T>::ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value)
{
return Converter<T>::convert(lexicalGlobalObject, value);
}
template<typename T> inline typename Converter<T>::ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value, JSC::JSObject& thisObject)
{
return Converter<T>::convert(lexicalGlobalObject, value, thisObject);
}
template<typename T> inline typename Converter<T>::ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value, JSDOMGlobalObject& globalObject)
{
return Converter<T>::convert(lexicalGlobalObject, value, globalObject);
}
template<typename T, typename ExceptionThrower> inline typename Converter<T>::ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value, ExceptionThrower&& exceptionThrower)
{
return Converter<T>::convert(lexicalGlobalObject, value, std::forward<ExceptionThrower>(exceptionThrower));
}
template<typename T, typename ExceptionThrower> inline typename Converter<T>::ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value, JSC::JSObject& thisObject, ExceptionThrower&& exceptionThrower)
{
return Converter<T>::convert(lexicalGlobalObject, value, thisObject, std::forward<ExceptionThrower>(exceptionThrower));
}
template<typename T, typename ExceptionThrower> inline typename Converter<T>::ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value, JSDOMGlobalObject& globalObject, ExceptionThrower&& exceptionThrower)
{
return Converter<T>::convert(lexicalGlobalObject, value, globalObject, std::forward<ExceptionThrower>(exceptionThrower));
}
// Conversion from Implementation -> JSValue
template<typename T> struct JSConverter;
template<typename T, typename U> inline JSC::JSValue toJS(U&&);
template<typename T, typename U> inline JSC::JSValue toJS(JSC::JSGlobalObject&, U&&);
template<typename T, typename U> inline JSC::JSValue toJS(JSC::JSGlobalObject&, JSDOMGlobalObject&, U&&);
template<typename T, typename U> inline JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject&, JSDOMGlobalObject&, U&&);
template<typename T, typename U> inline JSC::JSValue toJS(JSC::JSGlobalObject&, JSC::ThrowScope&, U&& valueOrFunctor);
template<typename T, typename U> inline JSC::JSValue toJS(JSC::JSGlobalObject&, JSDOMGlobalObject&, JSC::ThrowScope&, U&& valueOrFunctor);
template<typename T, typename U> inline JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject&, JSDOMGlobalObject&, JSC::ThrowScope&, U&& valueOrFunctor);
template<typename T, bool needsState = JSConverter<T>::needsState, bool needsGlobalObject = JSConverter<T>::needsGlobalObject>
struct JSConverterOverloader;
template<typename T>
struct JSConverterOverloader<T, true, true> {
template<typename U> static JSC::JSValue convert(JSC::JSGlobalObject& lexicalGlobalObject, JSDOMGlobalObject& globalObject, U&& value)
{
return JSConverter<T>::convert(lexicalGlobalObject, globalObject, std::forward<U>(value));
}
};
template<typename T>
struct JSConverterOverloader<T, true, false> {
template<typename U> static JSC::JSValue convert(JSC::JSGlobalObject& lexicalGlobalObject, U&& value)
{
return JSConverter<T>::convert(lexicalGlobalObject, std::forward<U>(value));
}
template<typename U> static JSC::JSValue convert(JSC::JSGlobalObject& lexicalGlobalObject, JSDOMGlobalObject&, U&& value)
{
return JSConverter<T>::convert(lexicalGlobalObject, std::forward<U>(value));
}
};
template<typename T>
struct JSConverterOverloader<T, false, false> {
template<typename U> static JSC::JSValue convert(JSC::JSGlobalObject&, U&& value)
{
return JSConverter<T>::convert(std::forward<U>(value));
}
template<typename U> static JSC::JSValue convert(JSC::JSGlobalObject&, JSDOMGlobalObject&, U&& value)
{
return JSConverter<T>::convert(std::forward<U>(value));
}
};
template<typename T, typename U> inline JSC::JSValue toJS(U&& value)
{
return JSConverter<T>::convert(std::forward<U>(value));
}
template<typename T, typename U> inline JSC::JSValue toJS(JSC::JSGlobalObject& lexicalGlobalObject, U&& value)
{
return JSConverterOverloader<T>::convert(lexicalGlobalObject, std::forward<U>(value));
}
template<typename T, typename U> inline JSC::JSValue toJS(JSC::JSGlobalObject& lexicalGlobalObject, JSDOMGlobalObject& globalObject, U&& value)
{
return JSConverterOverloader<T>::convert(lexicalGlobalObject, globalObject, std::forward<U>(value));
}
template<typename T, typename U> inline JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject& lexicalGlobalObject, JSDOMGlobalObject& globalObject, U&& value)
{
return JSConverter<T>::convertNewlyCreated(lexicalGlobalObject, globalObject, std::forward<U>(value));
}
template<typename T, typename U> inline JSC::JSValue toJS(JSC::JSGlobalObject& lexicalGlobalObject, JSC::ThrowScope& throwScope, U&& valueOrFunctor)
{
if constexpr (std::is_invocable_v<U>) {
using FunctorReturnType = std::invoke_result_t<U>;
if constexpr (std::is_same_v<void, FunctorReturnType>) {
valueOrFunctor();
return JSC::jsUndefined();
} else if constexpr (std::is_same_v<ExceptionOr<void>, FunctorReturnType>) {
auto result = valueOrFunctor();
if (UNLIKELY(result.hasException())) {
propagateException(lexicalGlobalObject, throwScope, result.releaseException());
return {};
}
return JSC::jsUndefined();
} else
return toJS<T>(lexicalGlobalObject, throwScope, valueOrFunctor());
} else {
if constexpr (IsExceptionOr<U>) {
if (UNLIKELY(valueOrFunctor.hasException())) {
propagateException(lexicalGlobalObject, throwScope, valueOrFunctor.releaseException());
return {};
}
return toJS<T>(lexicalGlobalObject, valueOrFunctor.releaseReturnValue());
} else
return toJS<T>(lexicalGlobalObject, std::forward<U>(valueOrFunctor));
}
}
template<typename T, typename U> inline JSC::JSValue toJS(JSC::JSGlobalObject& lexicalGlobalObject, JSDOMGlobalObject& globalObject, JSC::ThrowScope& throwScope, U&& valueOrFunctor)
{
if constexpr (std::is_invocable_v<U>) {
using FunctorReturnType = std::invoke_result_t<U>;
if constexpr (std::is_same_v<void, FunctorReturnType>) {
valueOrFunctor();
return JSC::jsUndefined();
} else if constexpr (std::is_same_v<ExceptionOr<void>, FunctorReturnType>) {
auto result = valueOrFunctor();
if (UNLIKELY(result.hasException())) {
propagateException(lexicalGlobalObject, throwScope, result.releaseException());
return {};
}
return JSC::jsUndefined();
} else
return toJS<T>(lexicalGlobalObject, globalObject, throwScope, valueOrFunctor());
} else {
if constexpr (IsExceptionOr<U>) {
if (UNLIKELY(valueOrFunctor.hasException())) {
propagateException(lexicalGlobalObject, throwScope, valueOrFunctor.releaseException());
return {};
}
return toJS<T>(lexicalGlobalObject, globalObject, valueOrFunctor.releaseReturnValue());
} else
return toJS<T>(lexicalGlobalObject, globalObject, std::forward<U>(valueOrFunctor));
}
}
template<typename T, typename U> inline JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject& lexicalGlobalObject, JSDOMGlobalObject& globalObject, JSC::ThrowScope& throwScope, U&& valueOrFunctor)
{
if constexpr (std::is_invocable_v<U>) {
using FunctorReturnType = std::invoke_result_t<U>;
if constexpr (std::is_same_v<void, FunctorReturnType>) {
valueOrFunctor();
return JSC::jsUndefined();
} else if constexpr (std::is_same_v<ExceptionOr<void>, FunctorReturnType>) {
auto result = valueOrFunctor();
if (UNLIKELY(result.hasException())) {
propagateException(lexicalGlobalObject, throwScope, result.releaseException());
return {};
}
return JSC::jsUndefined();
} else
return toJSNewlyCreated<T>(lexicalGlobalObject, globalObject, throwScope, valueOrFunctor());
} else {
if constexpr (IsExceptionOr<U>) {
if (UNLIKELY(valueOrFunctor.hasException())) {
propagateException(lexicalGlobalObject, throwScope, valueOrFunctor.releaseException());
return {};
}
return toJSNewlyCreated<T>(lexicalGlobalObject, globalObject, valueOrFunctor.releaseReturnValue());
} else
return toJSNewlyCreated<T>(lexicalGlobalObject, globalObject, std::forward<U>(valueOrFunctor));
}
}
template<typename T> struct DefaultConverter {
using ReturnType = typename T::ImplementationType;
// We assume the worst, subtypes can override to be less pessimistic.
// An example of something that can have side effects
// is having a converter that does JSC::JSValue::toNumber.
// toNumber() in JavaScript can call arbitrary JS functions.
//
// An example of something that does not have side effects
// is something having a converter that does JSC::JSValue::toBoolean.
// toBoolean() in JS can't call arbitrary functions.
static constexpr bool conversionHasSideEffects = true;
};
// Conversion from JSValue -> Implementation for variadic arguments
template<typename IDLType> struct VariadicConverter;
} // namespace WebCore

View File

@@ -0,0 +1,53 @@
/*
* 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. AND ITS CONTRIBUTORS ``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 ITS 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.
*/
#pragma once
#include "IDLTypes.h"
#include "JSDOMConvertBase.h"
namespace WebCore {
template<> struct Converter<IDLBoolean> : DefaultConverter<IDLBoolean> {
static constexpr bool conversionHasSideEffects = false;
static bool convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value)
{
return value.toBoolean(&lexicalGlobalObject);
}
};
template<> struct JSConverter<IDLBoolean> {
static constexpr bool needsState = false;
static constexpr bool needsGlobalObject = false;
static JSC::JSValue convert(bool value)
{
return JSC::jsBoolean(value);
}
};
} // namespace WebCore

View File

@@ -0,0 +1,481 @@
/*
* 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. AND ITS CONTRIBUTORS ``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 ITS 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.
*/
#pragma once
#include "BufferSource.h"
#include "IDLTypes.h"
#include "JSDOMConvertBase.h"
#include "JSDOMWrapperCache.h"
#include "JavaScriptCore/JSTypedArrays.h"
namespace WebCore {
struct IDLInt8Array : IDLTypedArray<JSC::Int8Array> {
};
struct IDLInt16Array : IDLTypedArray<JSC::Int16Array> {
};
struct IDLInt32Array : IDLTypedArray<JSC::Int32Array> {
};
struct IDLUint8Array : IDLTypedArray<JSC::Uint8Array> {
};
struct IDLUint16Array : IDLTypedArray<JSC::Uint16Array> {
};
struct IDLUint32Array : IDLTypedArray<JSC::Uint32Array> {
};
struct IDLUint8ClampedArray : IDLTypedArray<JSC::Uint8ClampedArray> {
};
struct IDLFloat32Array : IDLTypedArray<JSC::Float32Array> {
};
struct IDLFloat64Array : IDLTypedArray<JSC::Float64Array> {
};
struct IDLBigInt64Array : IDLTypedArray<JSC::BigInt64Array> {
};
struct IDLBigUint64Array : IDLTypedArray<JSC::BigUint64Array> {
};
inline RefPtr<JSC::Int8Array> toPossiblySharedInt8Array(JSC::VM& vm, JSC::JSValue value) { return JSC::toPossiblySharedNativeTypedView<JSC::Int8Adaptor>(vm, value); }
inline RefPtr<JSC::Int16Array> toPossiblySharedInt16Array(JSC::VM& vm, JSC::JSValue value) { return JSC::toPossiblySharedNativeTypedView<JSC::Int16Adaptor>(vm, value); }
inline RefPtr<JSC::Int32Array> toPossiblySharedInt32Array(JSC::VM& vm, JSC::JSValue value) { return JSC::toPossiblySharedNativeTypedView<JSC::Int32Adaptor>(vm, value); }
inline RefPtr<JSC::Uint8Array> toPossiblySharedUint8Array(JSC::VM& vm, JSC::JSValue value) { return JSC::toPossiblySharedNativeTypedView<JSC::Uint8Adaptor>(vm, value); }
inline RefPtr<JSC::Uint8ClampedArray> toPossiblySharedUint8ClampedArray(JSC::VM& vm, JSC::JSValue value) { return JSC::toPossiblySharedNativeTypedView<JSC::Uint8ClampedAdaptor>(vm, value); }
inline RefPtr<JSC::Uint16Array> toPossiblySharedUint16Array(JSC::VM& vm, JSC::JSValue value) { return JSC::toPossiblySharedNativeTypedView<JSC::Uint16Adaptor>(vm, value); }
inline RefPtr<JSC::Uint32Array> toPossiblySharedUint32Array(JSC::VM& vm, JSC::JSValue value) { return JSC::toPossiblySharedNativeTypedView<JSC::Uint32Adaptor>(vm, value); }
inline RefPtr<JSC::Float32Array> toPossiblySharedFloat32Array(JSC::VM& vm, JSC::JSValue value) { return JSC::toPossiblySharedNativeTypedView<JSC::Float32Adaptor>(vm, value); }
inline RefPtr<JSC::Float64Array> toPossiblySharedFloat64Array(JSC::VM& vm, JSC::JSValue value) { return JSC::toPossiblySharedNativeTypedView<JSC::Float64Adaptor>(vm, value); }
inline RefPtr<JSC::BigInt64Array> toPossiblySharedBigInt64Array(JSC::VM& vm, JSC::JSValue value) { return JSC::toPossiblySharedNativeTypedView<JSC::BigInt64Adaptor>(vm, value); }
inline RefPtr<JSC::BigUint64Array> toPossiblySharedBigUint64Array(JSC::VM& vm, JSC::JSValue value) { return JSC::toPossiblySharedNativeTypedView<JSC::BigUint64Adaptor>(vm, value); }
inline RefPtr<JSC::Int8Array> toUnsharedInt8Array(JSC::VM& vm, JSC::JSValue value) { return JSC::toUnsharedNativeTypedView<JSC::Int8Adaptor>(vm, value); }
inline RefPtr<JSC::Int16Array> toUnsharedInt16Array(JSC::VM& vm, JSC::JSValue value) { return JSC::toUnsharedNativeTypedView<JSC::Int16Adaptor>(vm, value); }
inline RefPtr<JSC::Int32Array> toUnsharedInt32Array(JSC::VM& vm, JSC::JSValue value) { return JSC::toUnsharedNativeTypedView<JSC::Int32Adaptor>(vm, value); }
inline RefPtr<JSC::Uint8Array> toUnsharedUint8Array(JSC::VM& vm, JSC::JSValue value) { return JSC::toUnsharedNativeTypedView<JSC::Uint8Adaptor>(vm, value); }
inline RefPtr<JSC::Uint8ClampedArray> toUnsharedUint8ClampedArray(JSC::VM& vm, JSC::JSValue value) { return JSC::toUnsharedNativeTypedView<JSC::Uint8ClampedAdaptor>(vm, value); }
inline RefPtr<JSC::Uint16Array> toUnsharedUint16Array(JSC::VM& vm, JSC::JSValue value) { return JSC::toUnsharedNativeTypedView<JSC::Uint16Adaptor>(vm, value); }
inline RefPtr<JSC::Uint32Array> toUnsharedUint32Array(JSC::VM& vm, JSC::JSValue value) { return JSC::toUnsharedNativeTypedView<JSC::Uint32Adaptor>(vm, value); }
inline RefPtr<JSC::Float32Array> toUnsharedFloat32Array(JSC::VM& vm, JSC::JSValue value) { return JSC::toUnsharedNativeTypedView<JSC::Float32Adaptor>(vm, value); }
inline RefPtr<JSC::Float64Array> toUnsharedFloat64Array(JSC::VM& vm, JSC::JSValue value) { return JSC::toUnsharedNativeTypedView<JSC::Float64Adaptor>(vm, value); }
inline RefPtr<JSC::BigInt64Array> toUnsharedBigInt64Array(JSC::VM& vm, JSC::JSValue value) { return JSC::toUnsharedNativeTypedView<JSC::BigInt64Adaptor>(vm, value); }
inline RefPtr<JSC::BigUint64Array> toUnsharedBigUint64Array(JSC::VM& vm, JSC::JSValue value) { return JSC::toUnsharedNativeTypedView<JSC::BigUint64Adaptor>(vm, value); }
inline JSC::JSValue toJS(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, JSC::ArrayBuffer& buffer)
{
if (auto result = getCachedWrapper(globalObject->world(), buffer))
return result;
// The JSArrayBuffer::create function will register the wrapper in finishCreation.
return JSC::JSArrayBuffer::create(JSC::getVM(lexicalGlobalObject), globalObject->arrayBufferStructure(buffer.sharingMode()), &buffer);
}
inline JSC::JSValue toJS(JSC::JSGlobalObject* lexicalGlobalObject, JSC::JSGlobalObject* globalObject, JSC::ArrayBufferView& view)
{
return view.wrap(lexicalGlobalObject, globalObject);
}
inline JSC::JSValue toJS(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, JSC::ArrayBuffer* buffer)
{
if (!buffer)
return JSC::jsNull();
return toJS(lexicalGlobalObject, globalObject, *buffer);
}
inline JSC::JSValue toJS(JSC::JSGlobalObject* lexicalGlobalObject, JSC::JSGlobalObject* globalObject, JSC::ArrayBufferView* view)
{
if (!view)
return JSC::jsNull();
return toJS(lexicalGlobalObject, globalObject, *view);
}
inline RefPtr<JSC::ArrayBufferView> toPossiblySharedArrayBufferView(JSC::VM& vm, JSC::JSValue value)
{
auto* wrapper = JSC::jsDynamicCast<JSC::JSArrayBufferView*>(vm, value);
if (!wrapper)
return nullptr;
return wrapper->possiblySharedImpl();
}
inline RefPtr<JSC::ArrayBufferView> toUnsharedArrayBufferView(JSC::VM& vm, JSC::JSValue value)
{
auto result = toPossiblySharedArrayBufferView(vm, value);
if (!result || result->isShared())
return nullptr;
return result;
}
namespace Detail {
enum class BufferSourceConverterAllowSharedMode { Allow,
Disallow };
template<typename BufferSourceType, BufferSourceConverterAllowSharedMode mode>
struct BufferSourceConverter {
using WrapperType = typename Converter<BufferSourceType>::WrapperType;
using ReturnType = typename Converter<BufferSourceType>::ReturnType;
template<typename ExceptionThrower = DefaultExceptionThrower>
static ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value, ExceptionThrower&& exceptionThrower = ExceptionThrower())
{
auto& vm = JSC::getVM(&lexicalGlobalObject);
auto scope = DECLARE_THROW_SCOPE(vm);
ReturnType object {};
if constexpr (mode == BufferSourceConverterAllowSharedMode::Allow)
object = WrapperType::toWrappedAllowShared(vm, value);
else
object = WrapperType::toWrapped(vm, value);
if (UNLIKELY(!object))
exceptionThrower(lexicalGlobalObject, scope);
return object;
}
};
}
template<> struct Converter<IDLArrayBuffer> : DefaultConverter<IDLArrayBuffer> {
using WrapperType = JSC::JSArrayBuffer;
using ReturnType = JSC::ArrayBuffer*;
template<typename ExceptionThrower = DefaultExceptionThrower>
static ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value, ExceptionThrower&& exceptionThrower = ExceptionThrower())
{
return Detail::BufferSourceConverter<IDLArrayBuffer, Detail::BufferSourceConverterAllowSharedMode::Disallow>::convert(lexicalGlobalObject, value, std::forward<ExceptionThrower>(exceptionThrower));
}
};
template<> struct JSConverter<IDLArrayBuffer> {
static constexpr bool needsState = true;
static constexpr bool needsGlobalObject = true;
template<typename U>
static JSC::JSValue convert(JSC::JSGlobalObject& lexicalGlobalObject, JSDOMGlobalObject& globalObject, const U& value)
{
return toJS(&lexicalGlobalObject, &globalObject, Detail::getPtrOrRef(value));
}
};
template<> struct Converter<IDLDataView> : DefaultConverter<IDLDataView> {
using WrapperType = JSC::JSDataView;
using ReturnType = RefPtr<JSC::DataView>;
template<typename ExceptionThrower = DefaultExceptionThrower>
static ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value, ExceptionThrower&& exceptionThrower = ExceptionThrower())
{
return Detail::BufferSourceConverter<IDLDataView, Detail::BufferSourceConverterAllowSharedMode::Disallow>::convert(lexicalGlobalObject, value, std::forward<ExceptionThrower>(exceptionThrower));
}
};
template<> struct JSConverter<IDLDataView> {
static constexpr bool needsState = true;
static constexpr bool needsGlobalObject = true;
template<typename U>
static JSC::JSValue convert(JSC::JSGlobalObject& lexicalGlobalObject, JSDOMGlobalObject& globalObject, const U& value)
{
return toJS(&lexicalGlobalObject, &globalObject, Detail::getPtrOrRef(value));
}
};
template<> struct Converter<IDLInt8Array> : DefaultConverter<IDLInt8Array> {
using WrapperType = JSC::JSInt8Array;
using ReturnType = RefPtr<JSC::Int8Array>;
template<typename ExceptionThrower = DefaultExceptionThrower>
static ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value, ExceptionThrower&& exceptionThrower = ExceptionThrower())
{
return Detail::BufferSourceConverter<IDLInt8Array, Detail::BufferSourceConverterAllowSharedMode::Disallow>::convert(lexicalGlobalObject, value, std::forward<ExceptionThrower>(exceptionThrower));
}
};
template<> struct JSConverter<IDLInt8Array> {
static constexpr bool needsState = true;
static constexpr bool needsGlobalObject = true;
template<typename U>
static JSC::JSValue convert(JSC::JSGlobalObject& lexicalGlobalObject, JSDOMGlobalObject& globalObject, const U& value)
{
return toJS(&lexicalGlobalObject, &globalObject, Detail::getPtrOrRef(value));
}
};
template<> struct Converter<IDLInt16Array> : DefaultConverter<IDLInt16Array> {
using WrapperType = JSC::JSInt16Array;
using ReturnType = RefPtr<JSC::Int16Array>;
template<typename ExceptionThrower = DefaultExceptionThrower>
static ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value, ExceptionThrower&& exceptionThrower = ExceptionThrower())
{
return Detail::BufferSourceConverter<IDLInt16Array, Detail::BufferSourceConverterAllowSharedMode::Disallow>::convert(lexicalGlobalObject, value, std::forward<ExceptionThrower>(exceptionThrower));
}
};
template<> struct JSConverter<IDLInt16Array> {
static constexpr bool needsState = true;
static constexpr bool needsGlobalObject = true;
template<typename U>
static JSC::JSValue convert(JSC::JSGlobalObject& lexicalGlobalObject, JSDOMGlobalObject& globalObject, const U& value)
{
return toJS(&lexicalGlobalObject, &globalObject, Detail::getPtrOrRef(value));
}
};
template<> struct Converter<IDLInt32Array> : DefaultConverter<IDLInt32Array> {
using WrapperType = JSC::JSInt32Array;
using ReturnType = RefPtr<JSC::Int32Array>;
template<typename ExceptionThrower = DefaultExceptionThrower>
static ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value, ExceptionThrower&& exceptionThrower = ExceptionThrower())
{
return Detail::BufferSourceConverter<IDLInt32Array, Detail::BufferSourceConverterAllowSharedMode::Disallow>::convert(lexicalGlobalObject, value, std::forward<ExceptionThrower>(exceptionThrower));
}
};
template<> struct JSConverter<IDLInt32Array> {
static constexpr bool needsState = true;
static constexpr bool needsGlobalObject = true;
template<typename U>
static JSC::JSValue convert(JSC::JSGlobalObject& lexicalGlobalObject, JSDOMGlobalObject& globalObject, const U& value)
{
return toJS(&lexicalGlobalObject, &globalObject, Detail::getPtrOrRef(value));
}
};
template<> struct Converter<IDLUint8Array> : DefaultConverter<IDLUint8Array> {
using WrapperType = JSC::JSUint8Array;
using ReturnType = RefPtr<JSC::Uint8Array>;
template<typename ExceptionThrower = DefaultExceptionThrower>
static ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value, ExceptionThrower&& exceptionThrower = ExceptionThrower())
{
return Detail::BufferSourceConverter<IDLUint8Array, Detail::BufferSourceConverterAllowSharedMode::Disallow>::convert(lexicalGlobalObject, value, std::forward<ExceptionThrower>(exceptionThrower));
}
};
template<> struct JSConverter<IDLUint8Array> {
static constexpr bool needsState = true;
static constexpr bool needsGlobalObject = true;
template<typename U>
static JSC::JSValue convert(JSC::JSGlobalObject& lexicalGlobalObject, JSDOMGlobalObject& globalObject, const U& value)
{
return toJS(&lexicalGlobalObject, &globalObject, Detail::getPtrOrRef(value));
}
template<typename U>
static JSC::JSValue convertNewlyCreated(JSC::JSGlobalObject& lexicalGlobalObject, JSDOMGlobalObject& globalObject, U&& value)
{
return convert(lexicalGlobalObject, globalObject, std::forward<U>(value));
}
};
template<> struct Converter<IDLUint16Array> : DefaultConverter<IDLUint16Array> {
using WrapperType = JSC::JSUint16Array;
using ReturnType = RefPtr<JSC::Uint16Array>;
template<typename ExceptionThrower = DefaultExceptionThrower>
static ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value, ExceptionThrower&& exceptionThrower = ExceptionThrower())
{
return Detail::BufferSourceConverter<IDLUint16Array, Detail::BufferSourceConverterAllowSharedMode::Disallow>::convert(lexicalGlobalObject, value, std::forward<ExceptionThrower>(exceptionThrower));
}
};
template<> struct JSConverter<IDLUint16Array> {
static constexpr bool needsState = true;
static constexpr bool needsGlobalObject = true;
template<typename U>
static JSC::JSValue convert(JSC::JSGlobalObject& lexicalGlobalObject, JSDOMGlobalObject& globalObject, const U& value)
{
return toJS(&lexicalGlobalObject, &globalObject, Detail::getPtrOrRef(value));
}
};
template<> struct Converter<IDLUint32Array> : DefaultConverter<IDLUint32Array> {
using WrapperType = JSC::JSUint32Array;
using ReturnType = RefPtr<JSC::Uint32Array>;
template<typename ExceptionThrower = DefaultExceptionThrower>
static ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value, ExceptionThrower&& exceptionThrower = ExceptionThrower())
{
return Detail::BufferSourceConverter<IDLUint32Array, Detail::BufferSourceConverterAllowSharedMode::Disallow>::convert(lexicalGlobalObject, value, std::forward<ExceptionThrower>(exceptionThrower));
}
};
template<> struct JSConverter<IDLUint32Array> {
static constexpr bool needsState = true;
static constexpr bool needsGlobalObject = true;
template<typename U>
static JSC::JSValue convert(JSC::JSGlobalObject& lexicalGlobalObject, JSDOMGlobalObject& globalObject, const U& value)
{
return toJS(&lexicalGlobalObject, &globalObject, Detail::getPtrOrRef(value));
}
};
template<> struct Converter<IDLUint8ClampedArray> : DefaultConverter<IDLUint8ClampedArray> {
using WrapperType = JSC::JSUint8ClampedArray;
using ReturnType = RefPtr<JSC::Uint8ClampedArray>;
template<typename ExceptionThrower = DefaultExceptionThrower>
static ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value, ExceptionThrower&& exceptionThrower = ExceptionThrower())
{
return Detail::BufferSourceConverter<IDLUint8ClampedArray, Detail::BufferSourceConverterAllowSharedMode::Disallow>::convert(lexicalGlobalObject, value, std::forward<ExceptionThrower>(exceptionThrower));
}
};
template<> struct JSConverter<IDLUint8ClampedArray> {
static constexpr bool needsState = true;
static constexpr bool needsGlobalObject = true;
template<typename U>
static JSC::JSValue convert(JSC::JSGlobalObject& lexicalGlobalObject, JSDOMGlobalObject& globalObject, const U& value)
{
return toJS(&lexicalGlobalObject, &globalObject, Detail::getPtrOrRef(value));
}
};
template<> struct Converter<IDLFloat32Array> : DefaultConverter<IDLFloat32Array> {
using WrapperType = JSC::JSFloat32Array;
using ReturnType = RefPtr<JSC::Float32Array>;
template<typename ExceptionThrower = DefaultExceptionThrower>
static ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value, ExceptionThrower&& exceptionThrower = ExceptionThrower())
{
return Detail::BufferSourceConverter<IDLFloat32Array, Detail::BufferSourceConverterAllowSharedMode::Disallow>::convert(lexicalGlobalObject, value, std::forward<ExceptionThrower>(exceptionThrower));
}
};
template<> struct JSConverter<IDLFloat32Array> {
static constexpr bool needsState = true;
static constexpr bool needsGlobalObject = true;
template<typename U>
static JSC::JSValue convert(JSC::JSGlobalObject& lexicalGlobalObject, JSDOMGlobalObject& globalObject, const U& value)
{
return toJS(&lexicalGlobalObject, &globalObject, Detail::getPtrOrRef(value));
}
};
template<> struct Converter<IDLFloat64Array> : DefaultConverter<IDLFloat64Array> {
using WrapperType = JSC::JSFloat64Array;
using ReturnType = RefPtr<JSC::Float64Array>;
template<typename ExceptionThrower = DefaultExceptionThrower>
static ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value, ExceptionThrower&& exceptionThrower = ExceptionThrower())
{
return Detail::BufferSourceConverter<IDLFloat64Array, Detail::BufferSourceConverterAllowSharedMode::Disallow>::convert(lexicalGlobalObject, value, std::forward<ExceptionThrower>(exceptionThrower));
}
};
template<> struct JSConverter<IDLFloat64Array> {
static constexpr bool needsState = true;
static constexpr bool needsGlobalObject = true;
template<typename U>
static JSC::JSValue convert(JSC::JSGlobalObject& lexicalGlobalObject, JSDOMGlobalObject& globalObject, const U& value)
{
return toJS(&lexicalGlobalObject, &globalObject, Detail::getPtrOrRef(value));
}
};
template<> struct Converter<IDLBigInt64Array> : DefaultConverter<IDLBigInt64Array> {
using WrapperType = JSC::JSBigInt64Array;
using ReturnType = RefPtr<JSC::BigInt64Array>;
template<typename ExceptionThrower = DefaultExceptionThrower>
static ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value, ExceptionThrower&& exceptionThrower = ExceptionThrower())
{
return Detail::BufferSourceConverter<IDLBigInt64Array, Detail::BufferSourceConverterAllowSharedMode::Disallow>::convert(lexicalGlobalObject, value, std::forward<ExceptionThrower>(exceptionThrower));
}
};
template<> struct JSConverter<IDLBigInt64Array> {
static constexpr bool needsState = true;
static constexpr bool needsGlobalObject = true;
template<typename U>
static JSC::JSValue convert(JSC::JSGlobalObject& lexicalGlobalObject, JSDOMGlobalObject& globalObject, const U& value)
{
return toJS(&lexicalGlobalObject, &globalObject, Detail::getPtrOrRef(value));
}
};
template<> struct Converter<IDLBigUint64Array> : DefaultConverter<IDLBigUint64Array> {
using WrapperType = JSC::JSBigUint64Array;
using ReturnType = RefPtr<JSC::BigUint64Array>;
template<typename ExceptionThrower = DefaultExceptionThrower>
static ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value, ExceptionThrower&& exceptionThrower = ExceptionThrower())
{
return Detail::BufferSourceConverter<IDLBigUint64Array, Detail::BufferSourceConverterAllowSharedMode::Disallow>::convert(lexicalGlobalObject, value, std::forward<ExceptionThrower>(exceptionThrower));
}
};
template<> struct JSConverter<IDLBigUint64Array> {
static constexpr bool needsState = true;
static constexpr bool needsGlobalObject = true;
template<typename U>
static JSC::JSValue convert(JSC::JSGlobalObject& lexicalGlobalObject, JSDOMGlobalObject& globalObject, const U& value)
{
return toJS(&lexicalGlobalObject, &globalObject, Detail::getPtrOrRef(value));
}
};
template<> struct Converter<IDLArrayBufferView> : DefaultConverter<IDLArrayBufferView> {
using WrapperType = JSC::JSArrayBufferView;
using ReturnType = RefPtr<JSC::ArrayBufferView>;
template<typename ExceptionThrower = DefaultExceptionThrower>
static ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value, ExceptionThrower&& exceptionThrower = ExceptionThrower())
{
return Detail::BufferSourceConverter<IDLArrayBufferView, Detail::BufferSourceConverterAllowSharedMode::Disallow>::convert(lexicalGlobalObject, value, std::forward<ExceptionThrower>(exceptionThrower));
}
};
template<> struct JSConverter<IDLArrayBufferView> {
static constexpr bool needsState = true;
static constexpr bool needsGlobalObject = true;
template<typename U>
static JSC::JSValue convert(JSC::JSGlobalObject& lexicalGlobalObject, JSDOMGlobalObject& globalObject, const U& value)
{
return toJS(&lexicalGlobalObject, &globalObject, Detail::getPtrOrRef(value));
}
};
template<typename T>
struct Converter<IDLAllowSharedAdaptor<T>> : DefaultConverter<T> {
using ConverterType = Converter<T>;
using WrapperType = typename ConverterType::WrapperType;
using ReturnType = typename ConverterType::ReturnType;
template<typename ExceptionThrower = DefaultExceptionThrower>
static ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value, ExceptionThrower&& exceptionThrower = ExceptionThrower())
{
return Detail::BufferSourceConverter<T, Detail::BufferSourceConverterAllowSharedMode::Allow>::convert(lexicalGlobalObject, value, std::forward<ExceptionThrower>(exceptionThrower));
}
};
} // namespace WebCore

View File

@@ -0,0 +1,104 @@
/*
* 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. AND ITS CONTRIBUTORS ``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 ITS 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.
*/
#pragma once
#include "IDLTypes.h"
#include "JSDOMConvertBase.h"
#include "JSDOMGlobalObject.h"
namespace WebCore {
template<typename T> struct Converter<IDLCallbackFunction<T>> : DefaultConverter<IDLCallbackFunction<T>> {
static constexpr bool conversionHasSideEffects = false;
template<typename ExceptionThrower = DefaultExceptionThrower>
static RefPtr<T> convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value, ExceptionThrower&& exceptionThrower = ExceptionThrower())
{
JSC::VM& vm = JSC::getVM(&lexicalGlobalObject);
auto scope = DECLARE_THROW_SCOPE(vm);
if (!value.isCallable(vm)) {
exceptionThrower(lexicalGlobalObject, scope);
return nullptr;
}
return T::create(vm, JSC::asObject(value));
}
};
template<typename T> struct JSConverter<IDLCallbackFunction<T>> {
static constexpr bool needsState = false;
static constexpr bool needsGlobalObject = false;
template <typename U>
static JSC::JSValue convert(const U& value)
{
return toJS(Detail::getPtrOrRef(value));
}
template<typename U>
static JSC::JSValue convertNewlyCreated(U&& value)
{
return toJSNewlyCreated(std::forward<U>(value));
}
};
template<typename T> struct Converter<IDLCallbackInterface<T>> : DefaultConverter<IDLCallbackInterface<T>> {
template<typename ExceptionThrower = DefaultExceptionThrower>
static RefPtr<T> convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value, ExceptionThrower&& exceptionThrower = ExceptionThrower())
{
JSC::VM& vm = JSC::getVM(&lexicalGlobalObject);
auto scope = DECLARE_THROW_SCOPE(vm);
if (!value.isObject()) {
exceptionThrower(lexicalGlobalObject, scope);
return nullptr;
}
return T::create(vm, JSC::asObject(value));
}
};
template<typename T> struct JSConverter<IDLCallbackInterface<T>> {
static constexpr bool needsState = false;
static constexpr bool needsGlobalObject = false;
template <typename U>
static JSC::JSValue convert(const U& value)
{
return toJS(Detail::getPtrOrRef(value));
}
template<typename U>
static JSC::JSValue convertNewlyCreated(U&& value)
{
return toJSNewlyCreated(std::forward<U>(value));
}
};
} // namespace WebCore

View File

@@ -0,0 +1,53 @@
/*
* Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
* Copyright (C) 2004-2011, 2013, 2016 Apple Inc. All rights reserved.
* Copyright (C) 2007 Samuel Weinig <sam@webkit.org>
* Copyright (C) 2013 Michael Pruett <michael@68k.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "config.h"
#include "JSDOMConvertDate.h"
#include "JavaScriptCore/DateInstance.h"
#include "JavaScriptCore/HeapInlines.h"
#include "JavaScriptCore/JSCJSValueInlines.h"
#include "JavaScriptCore/JSGlobalObject.h"
namespace WebCore {
using namespace JSC;
JSValue jsDate(JSGlobalObject& lexicalGlobalObject, WallTime value)
{
return DateInstance::create(lexicalGlobalObject.vm(), lexicalGlobalObject.dateStructure(), value.secondsSinceEpoch().milliseconds());
}
WallTime valueToDate(JSC::JSGlobalObject& lexicalGlobalObject, JSValue value)
{
double milliseconds = std::numeric_limits<double>::quiet_NaN();
auto& vm = lexicalGlobalObject.vm();
if (value.inherits<DateInstance>(vm))
milliseconds = jsCast<DateInstance*>(value)->internalNumber();
else if (value.isNumber())
milliseconds = value.asNumber();
else if (value.isString())
milliseconds = vm.dateCache.parseDate(&lexicalGlobalObject, vm, value.getString(&lexicalGlobalObject));
return WallTime::fromRawSeconds(Seconds::fromMilliseconds(milliseconds).value());
}
} // namespace WebCore

View File

@@ -0,0 +1,56 @@
/*
* 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. AND ITS CONTRIBUTORS ``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 ITS 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.
*/
#pragma once
#include "IDLTypes.h"
#include "JSDOMConvertBase.h"
#include "JavaScriptCore/JSGlobalObject.h"
#include "wtf/WallTime.h"
namespace WebCore {
JSC::JSValue jsDate(JSC::JSGlobalObject&, WallTime value);
WallTime valueToDate(JSC::JSGlobalObject&, JSC::JSValue); // NaN if the value can't be converted to a date.
template<> struct Converter<IDLDate> : DefaultConverter<IDLDate> {
static WallTime convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value)
{
return valueToDate(lexicalGlobalObject, value);
}
};
template<> struct JSConverter<IDLDate> {
static constexpr bool needsState = true;
static constexpr bool needsGlobalObject = false;
// FIXME: This should be taking a JSDOMGlobalObject and passing it to jsDate.
static JSC::JSValue convert(JSC::JSGlobalObject& lexicalGlobalObject, WallTime value)
{
return jsDate(lexicalGlobalObject, value);
}
};
} // namespace WebCore

View File

@@ -0,0 +1,56 @@
/*
* 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. AND ITS CONTRIBUTORS ``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 ITS 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.
*/
#pragma once
#include "IDLTypes.h"
#include "JSDOMConvertBase.h"
namespace WebCore {
// Specialized by generated code for IDL dictionary conversion.
template<typename T> T convertDictionary(JSC::JSGlobalObject&, JSC::JSValue);
template<typename T> struct Converter<IDLDictionary<T>> : DefaultConverter<IDLDictionary<T>> {
using ReturnType = T;
static ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value)
{
return convertDictionary<T>(lexicalGlobalObject, value);
}
};
template<typename T> struct JSConverter<IDLDictionary<T>> {
static constexpr bool needsState = true;
static constexpr bool needsGlobalObject = true;
static JSC::JSValue convert(JSC::JSGlobalObject& lexicalGlobalObject, JSDOMGlobalObject& globalObject, const T& dictionary)
{
return convertDictionaryToJS(lexicalGlobalObject, globalObject, dictionary);
}
};
} // namespace WebCore

View File

@@ -0,0 +1,70 @@
/*
* 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. AND ITS CONTRIBUTORS ``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 ITS 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.
*/
#pragma once
#include "IDLTypes.h"
#include "JSDOMConvertBase.h"
#include "JSDOMGlobalObject.h"
namespace WebCore {
// Specialized by generated code for IDL enumeration conversion.
template<typename T> std::optional<T> parseEnumeration(JSC::JSGlobalObject&, JSC::JSValue);
template<typename T> const char* expectedEnumerationValues();
// Specialized by generated code for IDL enumeration conversion.
template<typename T> JSC::JSString* convertEnumerationToJS(JSC::JSGlobalObject&, T);
template<typename T> struct Converter<IDLEnumeration<T>> : DefaultConverter<IDLEnumeration<T>> {
template<typename ExceptionThrower = DefaultExceptionThrower>
static T convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value, ExceptionThrower&& exceptionThrower = ExceptionThrower())
{
auto& vm = JSC::getVM(&lexicalGlobalObject);
auto throwScope = DECLARE_THROW_SCOPE(vm);
auto result = parseEnumeration<T>(lexicalGlobalObject, value);
RETURN_IF_EXCEPTION(throwScope, { });
if (UNLIKELY(!result)) {
exceptionThrower(lexicalGlobalObject, throwScope);
return { };
}
return result.value();
}
};
template<typename T> struct JSConverter<IDLEnumeration<T>> {
static constexpr bool needsState = true;
static constexpr bool needsGlobalObject = false;
static JSC::JSValue convert(JSC::JSGlobalObject& lexicalGlobalObject, T value)
{
return convertEnumerationToJS(lexicalGlobalObject, value);
}
};
} // namespace WebCore

View File

@@ -0,0 +1,51 @@
/*
* 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. AND ITS CONTRIBUTORS ``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 ITS 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.
*/
#pragma once
#include "IDLTypes.h"
#include "JSDOMConvertBase.h"
namespace WebCore {
template<typename T> struct Converter<IDLEventListener<T>> : DefaultConverter<IDLEventListener<T>> {
using ReturnType = RefPtr<T>;
template<typename ExceptionThrower = DefaultExceptionThrower>
static ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value, JSC::JSObject& thisObject, ExceptionThrower&& exceptionThrower = ExceptionThrower())
{
auto scope = DECLARE_THROW_SCOPE(JSC::getVM(&lexicalGlobalObject));
if (UNLIKELY(!value.isObject())) {
exceptionThrower(lexicalGlobalObject, scope);
return nullptr;
}
bool isAttribute = false;
return T::create(*asObject(value), thisObject, isAttribute, currentWorld(lexicalGlobalObject));
}
};
} // namespace WebCore

View File

@@ -0,0 +1,105 @@
/*
* 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. AND ITS CONTRIBUTORS ``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 ITS 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.
*/
#pragma once
#include "root.h"
#include "IDLTypes.h"
#include "JSDOMConvertBase.h"
#include "JavaScriptCore/Error.h"
namespace WebCore {
template<typename ImplementationClass> struct JSDOMWrapperConverterTraits;
template<typename T, typename Enable = void>
struct JSToWrappedOverloader {
using ReturnType = typename JSDOMWrapperConverterTraits<T>::ToWrappedReturnType;
using WrapperType = typename JSDOMWrapperConverterTraits<T>::WrapperClass;
static ReturnType toWrapped(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value)
{
return WrapperType::toWrapped(JSC::getVM(&lexicalGlobalObject), value);
}
};
template<typename T>
struct JSToWrappedOverloader<T, typename std::enable_if<JSDOMWrapperConverterTraits<T>::needsState>::type> {
using ReturnType = typename JSDOMWrapperConverterTraits<T>::ToWrappedReturnType;
using WrapperType = typename JSDOMWrapperConverterTraits<T>::WrapperClass;
static ReturnType toWrapped(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value)
{
return WrapperType::toWrapped(lexicalGlobalObject, value);
}
};
template<typename T> struct Converter<IDLInterface<T>> : DefaultConverter<IDLInterface<T>> {
using ReturnType = typename JSDOMWrapperConverterTraits<T>::ToWrappedReturnType;
using WrapperType = typename JSDOMWrapperConverterTraits<T>::WrapperClass;
template<typename ExceptionThrower = DefaultExceptionThrower>
static ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value, ExceptionThrower&& exceptionThrower = ExceptionThrower())
{
auto& vm = JSC::getVM(&lexicalGlobalObject);
auto scope = DECLARE_THROW_SCOPE(vm);
ReturnType object = JSToWrappedOverloader<T>::toWrapped(lexicalGlobalObject, value);
if (UNLIKELY(!object))
exceptionThrower(lexicalGlobalObject, scope);
return object;
}
};
template<typename T> struct JSConverter<IDLInterface<T>> {
static constexpr bool needsState = true;
static constexpr bool needsGlobalObject = true;
template<typename U>
static JSC::JSValue convert(JSC::JSGlobalObject& lexicalGlobalObject, JSDOMGlobalObject& globalObject, const U& value)
{
return toJS(&lexicalGlobalObject, &globalObject, Detail::getPtrOrRef(value));
}
template<typename U>
static JSC::JSValue convertNewlyCreated(JSC::JSGlobalObject& lexicalGlobalObject, JSDOMGlobalObject& globalObject, U&& value)
{
return toJSNewlyCreated(&lexicalGlobalObject, &globalObject, std::forward<U>(value));
}
};
template<typename T> struct VariadicConverter<IDLInterface<T>> {
using Item = std::reference_wrapper<T>;
static std::optional<Item> convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value)
{
auto* result = Converter<IDLInterface<T>>::convert(lexicalGlobalObject, value);
if (!result)
return std::nullopt;
return std::optional<Item> { *result };
}
};
} // namespace WebCore

View File

@@ -0,0 +1,51 @@
/*
* 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. AND ITS CONTRIBUTORS ``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 ITS 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.
*/
#pragma once
#include "IDLTypes.h"
#include "JSDOMConvertBase.h"
#include "JavaScriptCore/JSONObject.h"
namespace WebCore {
template<> struct Converter<IDLJSON> : DefaultConverter<IDLJSON> {
static String convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value)
{
return JSC::JSONStringify(&lexicalGlobalObject, value, 0);
}
};
template<> struct JSConverter<IDLJSON> {
static constexpr bool needsState = true;
static constexpr bool needsGlobalObject = false;
static JSC::JSValue convert(JSC::JSGlobalObject& lexicalGlobalObject, const String& value)
{
return JSC::JSONParse(&lexicalGlobalObject, value);
}
};
} // namespace WebCore

View File

@@ -0,0 +1,50 @@
/*
* 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. AND ITS CONTRIBUTORS ``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 ITS 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.
*/
#pragma once
#include "IDLTypes.h"
#include "JSDOMConvertBase.h"
namespace WebCore {
template<> struct Converter<IDLNull> : DefaultConverter<IDLNull> {
static std::nullptr_t convert(JSC::JSGlobalObject&, JSC::JSValue)
{
return nullptr;
}
};
template<> struct JSConverter<IDLNull> {
static constexpr bool needsState = false;
static constexpr bool needsGlobalObject = false;
static JSC::JSValue convert(std::nullptr_t)
{
return JSC::jsNull();
}
};
} // namespace WebCore

View File

@@ -0,0 +1,150 @@
/*
* 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. AND ITS CONTRIBUTORS ``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 ITS 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.
*/
#pragma once
#include "IDLTypes.h"
#include "JSDOMConvertAny.h"
#include "JSDOMConvertInterface.h"
#include "JSDOMConvertNumbers.h"
#include "JSDOMConvertStrings.h"
namespace WebCore {
namespace Detail {
template<typename IDLType>
struct NullableConversionType;
template<typename IDLType>
struct NullableConversionType {
using Type = typename IDLNullable<IDLType>::ImplementationType;
};
template<typename T>
struct NullableConversionType<IDLInterface<T>> {
using Type = typename Converter<IDLInterface<T>>::ReturnType;
};
template<>
struct NullableConversionType<IDLAny> {
using Type = typename Converter<IDLAny>::ReturnType;
};
}
template<typename T> struct Converter<IDLNullable<T>> : DefaultConverter<IDLNullable<T>> {
using ReturnType = typename Detail::NullableConversionType<T>::Type;
// 1. If Type(V) is not Object, and the conversion to an IDL value is being performed
// due to V being assigned to an attribute whose type is a nullable callback function
// that is annotated with [LegacyTreatNonObjectAsNull], then return the IDL nullable
// type T? value null.
//
// NOTE: Handled elsewhere.
//
// 2. Otherwise, if V is null or undefined, then return the IDL nullable type T? value null.
// 3. Otherwise, return the result of converting V using the rules for the inner IDL type T.
static ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value)
{
if (value.isUndefinedOrNull())
return T::nullValue();
return Converter<T>::convert(lexicalGlobalObject, value);
}
static ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value, JSC::JSObject& thisObject)
{
if (value.isUndefinedOrNull())
return T::nullValue();
return Converter<T>::convert(lexicalGlobalObject, value, thisObject);
}
static ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value, JSDOMGlobalObject& globalObject)
{
if (value.isUndefinedOrNull())
return T::nullValue();
return Converter<T>::convert(lexicalGlobalObject, value, globalObject);
}
template<typename ExceptionThrower = DefaultExceptionThrower>
static ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value, ExceptionThrower&& exceptionThrower)
{
if (value.isUndefinedOrNull())
return T::nullValue();
return Converter<T>::convert(lexicalGlobalObject, value, std::forward<ExceptionThrower>(exceptionThrower));
}
template<typename ExceptionThrower = DefaultExceptionThrower>
static ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value, JSC::JSObject& thisObject, ExceptionThrower&& exceptionThrower)
{
if (value.isUndefinedOrNull())
return T::nullValue();
return Converter<T>::convert(lexicalGlobalObject, value, thisObject, std::forward<ExceptionThrower>(exceptionThrower));
}
template<typename ExceptionThrower = DefaultExceptionThrower>
static ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value, JSDOMGlobalObject& globalObject, ExceptionThrower&& exceptionThrower)
{
if (value.isUndefinedOrNull())
return T::nullValue();
return Converter<T>::convert(lexicalGlobalObject, value, globalObject, std::forward<ExceptionThrower>(exceptionThrower));
}
};
template<typename T> struct JSConverter<IDLNullable<T>> {
using ImplementationType = typename IDLNullable<T>::ImplementationType;
static constexpr bool needsState = JSConverter<T>::needsState;
static constexpr bool needsGlobalObject = JSConverter<T>::needsGlobalObject;
template<typename U>
static JSC::JSValue convert(U&& value)
{
if (T::isNullValue(value))
return JSC::jsNull();
return JSConverter<T>::convert(T::extractValueFromNullable(value));
}
template<typename U>
static JSC::JSValue convert(JSC::JSGlobalObject& lexicalGlobalObject, U&& value)
{
if (T::isNullValue(value))
return JSC::jsNull();
return JSConverter<T>::convert(lexicalGlobalObject, T::extractValueFromNullable(value));
}
template<typename U>
static JSC::JSValue convert(JSC::JSGlobalObject& lexicalGlobalObject, JSDOMGlobalObject& globalObject, U&& value)
{
if (T::isNullValue(value))
return JSC::jsNull();
return JSConverter<T>::convert(lexicalGlobalObject, globalObject, T::extractValueFromNullable(value));
}
template<typename U>
static JSC::JSValue convertNewlyCreated(JSC::JSGlobalObject& lexicalGlobalObject, JSDOMGlobalObject& globalObject, U&& value)
{
if (T::isNullValue(value))
return JSC::jsNull();
return JSConverter<T>::convert(lexicalGlobalObject, globalObject, T::extractValueFromNullable(value));
}
};
} // namespace WebCore

View File

@@ -0,0 +1,379 @@
/*
* Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
* Copyright (C) 2004-2011, 2013, 2016 Apple Inc. All rights reserved.
* Copyright (C) 2007 Samuel Weinig <sam@webkit.org>
* Copyright (C) 2013 Michael Pruett <michael@68k.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "config.h"
#include "JSDOMConvertNumbers.h"
#include "JSDOMExceptionHandling.h"
#include "JavaScriptCore/HeapInlines.h"
#include "JavaScriptCore/JSCJSValueInlines.h"
#include "wtf/MathExtras.h"
#include "wtf/text/StringConcatenateNumbers.h"
#include "wtf/text/WTFString.h"
namespace WebCore {
using namespace JSC;
enum class IntegerConversionConfiguration { Normal,
EnforceRange,
Clamp };
static const int32_t kMaxInt32 = 0x7fffffff;
static const int32_t kMinInt32 = -kMaxInt32 - 1;
static const uint32_t kMaxUInt32 = 0xffffffffU;
static const int64_t kJSMaxInteger = 0x20000000000000LL - 1; // 2^53 - 1, largest integer exactly representable in ECMAScript.
static String rangeErrorString(double value, double min, double max)
{
return makeString("Value ", value, " is outside the range [", min, ", ", max, ']');
}
static double enforceRange(JSGlobalObject& lexicalGlobalObject, double x, double minimum, double maximum)
{
VM& vm = lexicalGlobalObject.vm();
auto scope = DECLARE_THROW_SCOPE(vm);
if (std::isnan(x) || std::isinf(x)) {
throwTypeError(&lexicalGlobalObject, scope, rangeErrorString(x, minimum, maximum));
return 0;
}
x = trunc(x);
if (x < minimum || x > maximum) {
throwTypeError(&lexicalGlobalObject, scope, rangeErrorString(x, minimum, maximum));
return 0;
}
return x;
}
namespace {
template<typename T>
struct IntTypeLimits {
};
template<>
struct IntTypeLimits<int8_t> {
static const int8_t minValue = -128;
static const int8_t maxValue = 127;
static const unsigned numberOfValues = 256; // 2^8
};
template<>
struct IntTypeLimits<uint8_t> {
static const uint8_t maxValue = 255;
static const unsigned numberOfValues = 256; // 2^8
};
template<>
struct IntTypeLimits<int16_t> {
static const short minValue = -32768;
static const short maxValue = 32767;
static const unsigned numberOfValues = 65536; // 2^16
};
template<>
struct IntTypeLimits<uint16_t> {
static const unsigned short maxValue = 65535;
static const unsigned numberOfValues = 65536; // 2^16
};
}
template<typename T, IntegerConversionConfiguration configuration>
static inline T toSmallerInt(JSGlobalObject& lexicalGlobalObject, JSValue value)
{
VM& vm = lexicalGlobalObject.vm();
auto scope = DECLARE_THROW_SCOPE(vm);
static_assert(std::is_signed<T>::value && std::is_integral<T>::value, "Should only be used for signed integral types");
typedef IntTypeLimits<T> LimitsTrait;
// Fast path if the value is already a 32-bit signed integer in the right range.
if (value.isInt32()) {
int32_t d = value.asInt32();
if (d >= LimitsTrait::minValue && d <= LimitsTrait::maxValue)
return static_cast<T>(d);
switch (configuration) {
case IntegerConversionConfiguration::Normal:
break;
case IntegerConversionConfiguration::EnforceRange:
throwTypeError(&lexicalGlobalObject, scope);
return 0;
case IntegerConversionConfiguration::Clamp:
return d < LimitsTrait::minValue ? LimitsTrait::minValue : LimitsTrait::maxValue;
}
d %= LimitsTrait::numberOfValues;
return static_cast<T>(d > LimitsTrait::maxValue ? d - LimitsTrait::numberOfValues : d);
}
double x = value.toNumber(&lexicalGlobalObject);
RETURN_IF_EXCEPTION(scope, 0);
switch (configuration) {
case IntegerConversionConfiguration::Normal:
break;
case IntegerConversionConfiguration::EnforceRange:
return enforceRange(lexicalGlobalObject, x, LimitsTrait::minValue, LimitsTrait::maxValue);
case IntegerConversionConfiguration::Clamp:
return std::isnan(x) ? 0 : clampTo<T>(x);
}
if (std::isnan(x) || std::isinf(x) || !x)
return 0;
x = x < 0 ? -floor(fabs(x)) : floor(fabs(x));
x = fmod(x, LimitsTrait::numberOfValues);
return static_cast<T>(x > LimitsTrait::maxValue ? x - LimitsTrait::numberOfValues : x);
}
template<typename T, IntegerConversionConfiguration configuration>
static inline T toSmallerUInt(JSGlobalObject& lexicalGlobalObject, JSValue value)
{
VM& vm = lexicalGlobalObject.vm();
auto scope = DECLARE_THROW_SCOPE(vm);
static_assert(std::is_unsigned<T>::value && std::is_integral<T>::value, "Should only be used for unsigned integral types");
typedef IntTypeLimits<T> LimitsTrait;
// Fast path if the value is already a 32-bit unsigned integer in the right range.
if (value.isUInt32()) {
uint32_t d = value.asUInt32();
if (d <= LimitsTrait::maxValue)
return static_cast<T>(d);
switch (configuration) {
case IntegerConversionConfiguration::Normal:
return static_cast<T>(d);
case IntegerConversionConfiguration::EnforceRange:
throwTypeError(&lexicalGlobalObject, scope);
return 0;
case IntegerConversionConfiguration::Clamp:
return LimitsTrait::maxValue;
}
}
double x = value.toNumber(&lexicalGlobalObject);
RETURN_IF_EXCEPTION(scope, 0);
switch (configuration) {
case IntegerConversionConfiguration::Normal:
break;
case IntegerConversionConfiguration::EnforceRange:
return enforceRange(lexicalGlobalObject, x, 0, LimitsTrait::maxValue);
case IntegerConversionConfiguration::Clamp:
return std::isnan(x) ? 0 : clampTo<T>(x);
}
if (std::isnan(x) || std::isinf(x) || !x)
return 0;
x = x < 0 ? -floor(fabs(x)) : floor(fabs(x));
x = fmod(x, LimitsTrait::numberOfValues);
if (x < 0)
x += LimitsTrait::numberOfValues;
return static_cast<T>(x);
}
template<> int8_t convertToIntegerEnforceRange<int8_t>(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value)
{
return toSmallerInt<int8_t, IntegerConversionConfiguration::EnforceRange>(lexicalGlobalObject, value);
}
template<> uint8_t convertToIntegerEnforceRange<uint8_t>(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value)
{
return toSmallerUInt<uint8_t, IntegerConversionConfiguration::EnforceRange>(lexicalGlobalObject, value);
}
template<> int8_t convertToIntegerClamp<int8_t>(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value)
{
return toSmallerInt<int8_t, IntegerConversionConfiguration::Clamp>(lexicalGlobalObject, value);
}
template<> uint8_t convertToIntegerClamp<uint8_t>(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value)
{
return toSmallerUInt<uint8_t, IntegerConversionConfiguration::Clamp>(lexicalGlobalObject, value);
}
template<> int8_t convertToInteger<int8_t>(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value)
{
return toSmallerInt<int8_t, IntegerConversionConfiguration::Normal>(lexicalGlobalObject, value);
}
template<> uint8_t convertToInteger<uint8_t>(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value)
{
return toSmallerUInt<uint8_t, IntegerConversionConfiguration::Normal>(lexicalGlobalObject, value);
}
template<> int16_t convertToIntegerEnforceRange<int16_t>(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value)
{
return toSmallerInt<int16_t, IntegerConversionConfiguration::EnforceRange>(lexicalGlobalObject, value);
}
template<> uint16_t convertToIntegerEnforceRange<uint16_t>(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value)
{
return toSmallerUInt<uint16_t, IntegerConversionConfiguration::EnforceRange>(lexicalGlobalObject, value);
}
template<> int16_t convertToIntegerClamp<int16_t>(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value)
{
return toSmallerInt<int16_t, IntegerConversionConfiguration::Clamp>(lexicalGlobalObject, value);
}
template<> uint16_t convertToIntegerClamp<uint16_t>(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value)
{
return toSmallerUInt<uint16_t, IntegerConversionConfiguration::Clamp>(lexicalGlobalObject, value);
}
template<> int16_t convertToInteger<int16_t>(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value)
{
return toSmallerInt<int16_t, IntegerConversionConfiguration::Normal>(lexicalGlobalObject, value);
}
template<> uint16_t convertToInteger<uint16_t>(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value)
{
return toSmallerUInt<uint16_t, IntegerConversionConfiguration::Normal>(lexicalGlobalObject, value);
}
template<> int32_t convertToIntegerEnforceRange<int32_t>(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value)
{
if (value.isInt32())
return value.asInt32();
VM& vm = lexicalGlobalObject.vm();
auto scope = DECLARE_THROW_SCOPE(vm);
double x = value.toNumber(&lexicalGlobalObject);
RETURN_IF_EXCEPTION(scope, 0);
return enforceRange(lexicalGlobalObject, x, kMinInt32, kMaxInt32);
}
template<> uint32_t convertToIntegerEnforceRange<uint32_t>(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value)
{
if (value.isUInt32())
return value.asUInt32();
VM& vm = lexicalGlobalObject.vm();
auto scope = DECLARE_THROW_SCOPE(vm);
double x = value.toNumber(&lexicalGlobalObject);
RETURN_IF_EXCEPTION(scope, 0);
return enforceRange(lexicalGlobalObject, x, 0, kMaxUInt32);
}
template<> int32_t convertToIntegerClamp<int32_t>(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value)
{
if (value.isInt32())
return value.asInt32();
double x = value.toNumber(&lexicalGlobalObject);
return std::isnan(x) ? 0 : clampTo<int32_t>(x);
}
template<> uint32_t convertToIntegerClamp<uint32_t>(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value)
{
if (value.isUInt32())
return value.asUInt32();
double x = value.toNumber(&lexicalGlobalObject);
return std::isnan(x) ? 0 : clampTo<uint32_t>(x);
}
template<> int32_t convertToInteger<int32_t>(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value)
{
return value.toInt32(&lexicalGlobalObject);
}
template<> uint32_t convertToInteger<uint32_t>(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value)
{
return value.toUInt32(&lexicalGlobalObject);
}
template<> int64_t convertToIntegerEnforceRange<int64_t>(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value)
{
if (value.isInt32())
return value.asInt32();
VM& vm = lexicalGlobalObject.vm();
auto scope = DECLARE_THROW_SCOPE(vm);
double x = value.toNumber(&lexicalGlobalObject);
RETURN_IF_EXCEPTION(scope, 0);
return enforceRange(lexicalGlobalObject, x, -kJSMaxInteger, kJSMaxInteger);
}
template<> uint64_t convertToIntegerEnforceRange<uint64_t>(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value)
{
if (value.isUInt32())
return value.asUInt32();
VM& vm = lexicalGlobalObject.vm();
auto scope = DECLARE_THROW_SCOPE(vm);
double x = value.toNumber(&lexicalGlobalObject);
RETURN_IF_EXCEPTION(scope, 0);
return enforceRange(lexicalGlobalObject, x, 0, kJSMaxInteger);
}
template<> int64_t convertToIntegerClamp<int64_t>(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value)
{
if (value.isInt32())
return value.asInt32();
double x = value.toNumber(&lexicalGlobalObject);
return std::isnan(x) ? 0 : static_cast<int64_t>(std::min<double>(std::max<double>(x, -kJSMaxInteger), kJSMaxInteger));
}
template<> uint64_t convertToIntegerClamp<uint64_t>(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value)
{
if (value.isUInt32())
return value.asUInt32();
double x = value.toNumber(&lexicalGlobalObject);
return std::isnan(x) ? 0 : static_cast<uint64_t>(std::min<double>(std::max<double>(x, 0), kJSMaxInteger));
}
template<> int64_t convertToInteger<int64_t>(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value)
{
if (value.isInt32())
return value.asInt32();
double x = value.toNumber(&lexicalGlobalObject);
// Map NaNs and +/-Infinity to 0; convert finite values modulo 2^64.
unsigned long long n;
doubleToInteger(x, n);
return n;
}
template<> uint64_t convertToInteger<uint64_t>(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value)
{
if (value.isUInt32())
return value.asUInt32();
double x = value.toNumber(&lexicalGlobalObject);
// Map NaNs and +/-Infinity to 0; convert finite values modulo 2^64.
unsigned long long n;
doubleToInteger(x, n);
return n;
}
} // namespace WebCore

View File

@@ -0,0 +1,409 @@
/*
* 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. AND ITS CONTRIBUTORS ``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 ITS 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.
*/
#pragma once
#include "IDLTypes.h"
#include "JSDOMConvertBase.h"
#include "JSDOMExceptionHandling.h"
#include "JavaScriptCore/JSCJSValueInlines.h"
#include "JavaScriptCore/PureNaN.h"
namespace WebCore {
// The following functions convert values to integers as per the WebIDL specification.
// The conversion fails if the value cannot be converted to a number or, if EnforceRange is specified,
// the value is outside the range of the destination integer type.
template<typename T> T convertToInteger(JSC::JSGlobalObject&, JSC::JSValue);
template<> WEBCORE_EXPORT int8_t convertToInteger<int8_t>(JSC::JSGlobalObject&, JSC::JSValue);
template<> WEBCORE_EXPORT uint8_t convertToInteger<uint8_t>(JSC::JSGlobalObject&, JSC::JSValue);
template<> WEBCORE_EXPORT int16_t convertToInteger<int16_t>(JSC::JSGlobalObject&, JSC::JSValue);
template<> WEBCORE_EXPORT uint16_t convertToInteger<uint16_t>(JSC::JSGlobalObject&, JSC::JSValue);
template<> WEBCORE_EXPORT int32_t convertToInteger<int32_t>(JSC::JSGlobalObject&, JSC::JSValue);
template<> WEBCORE_EXPORT uint32_t convertToInteger<uint32_t>(JSC::JSGlobalObject&, JSC::JSValue);
template<> WEBCORE_EXPORT int64_t convertToInteger<int64_t>(JSC::JSGlobalObject&, JSC::JSValue);
template<> WEBCORE_EXPORT uint64_t convertToInteger<uint64_t>(JSC::JSGlobalObject&, JSC::JSValue);
template<typename T> T convertToIntegerEnforceRange(JSC::JSGlobalObject&, JSC::JSValue);
template<> WEBCORE_EXPORT int8_t convertToIntegerEnforceRange<int8_t>(JSC::JSGlobalObject&, JSC::JSValue);
template<> WEBCORE_EXPORT uint8_t convertToIntegerEnforceRange<uint8_t>(JSC::JSGlobalObject&, JSC::JSValue);
template<> WEBCORE_EXPORT int16_t convertToIntegerEnforceRange<int16_t>(JSC::JSGlobalObject&, JSC::JSValue);
template<> WEBCORE_EXPORT uint16_t convertToIntegerEnforceRange<uint16_t>(JSC::JSGlobalObject&, JSC::JSValue);
template<> WEBCORE_EXPORT int32_t convertToIntegerEnforceRange<int32_t>(JSC::JSGlobalObject&, JSC::JSValue);
template<> WEBCORE_EXPORT uint32_t convertToIntegerEnforceRange<uint32_t>(JSC::JSGlobalObject&, JSC::JSValue);
template<> WEBCORE_EXPORT int64_t convertToIntegerEnforceRange<int64_t>(JSC::JSGlobalObject&, JSC::JSValue);
template<> WEBCORE_EXPORT uint64_t convertToIntegerEnforceRange<uint64_t>(JSC::JSGlobalObject&, JSC::JSValue);
template<typename T> T convertToIntegerClamp(JSC::JSGlobalObject&, JSC::JSValue);
template<> WEBCORE_EXPORT int8_t convertToIntegerClamp<int8_t>(JSC::JSGlobalObject&, JSC::JSValue);
template<> WEBCORE_EXPORT uint8_t convertToIntegerClamp<uint8_t>(JSC::JSGlobalObject&, JSC::JSValue);
template<> WEBCORE_EXPORT int16_t convertToIntegerClamp<int16_t>(JSC::JSGlobalObject&, JSC::JSValue);
template<> WEBCORE_EXPORT uint16_t convertToIntegerClamp<uint16_t>(JSC::JSGlobalObject&, JSC::JSValue);
template<> WEBCORE_EXPORT int32_t convertToIntegerClamp<int32_t>(JSC::JSGlobalObject&, JSC::JSValue);
template<> WEBCORE_EXPORT uint32_t convertToIntegerClamp<uint32_t>(JSC::JSGlobalObject&, JSC::JSValue);
template<> WEBCORE_EXPORT int64_t convertToIntegerClamp<int64_t>(JSC::JSGlobalObject&, JSC::JSValue);
template<> WEBCORE_EXPORT uint64_t convertToIntegerClamp<uint64_t>(JSC::JSGlobalObject&, JSC::JSValue);
// MARK: -
// MARK: Integer types
template<> struct Converter<IDLByte> : DefaultConverter<IDLByte> {
static int8_t convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value)
{
return convertToInteger<int8_t>(lexicalGlobalObject, value);
}
};
template<> struct JSConverter<IDLByte> {
using Type = typename IDLByte::ImplementationType;
static constexpr bool needsState = false;
static constexpr bool needsGlobalObject = false;
static JSC::JSValue convert(Type value)
{
return JSC::jsNumber(value);
}
};
template<> struct Converter<IDLOctet> : DefaultConverter<IDLOctet> {
static uint8_t convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value)
{
return convertToInteger<uint8_t>(lexicalGlobalObject, value);
}
};
template<> struct JSConverter<IDLOctet> {
using Type = typename IDLOctet::ImplementationType;
static constexpr bool needsState = false;
static constexpr bool needsGlobalObject = false;
static JSC::JSValue convert(Type value)
{
return JSC::jsNumber(value);
}
};
template<> struct Converter<IDLShort> : DefaultConverter<IDLShort> {
static int16_t convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value)
{
return convertToInteger<int16_t>(lexicalGlobalObject, value);
}
};
template<> struct JSConverter<IDLShort> {
using Type = typename IDLShort::ImplementationType;
static constexpr bool needsState = false;
static constexpr bool needsGlobalObject = false;
static JSC::JSValue convert(Type value)
{
return JSC::jsNumber(value);
}
};
template<> struct Converter<IDLUnsignedShort> : DefaultConverter<IDLUnsignedShort> {
static uint16_t convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value)
{
return convertToInteger<uint16_t>(lexicalGlobalObject, value);
}
};
template<> struct JSConverter<IDLUnsignedShort> {
using Type = typename IDLUnsignedShort::ImplementationType;
static constexpr bool needsState = false;
static constexpr bool needsGlobalObject = false;
static JSC::JSValue convert(Type value)
{
return JSC::jsNumber(value);
}
};
template<> struct Converter<IDLLong> : DefaultConverter<IDLLong> {
static inline int32_t convert(JSC::JSGlobalObject&, JSC::ThrowScope&, double number)
{
return JSC::toInt32(number);
}
static int32_t convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value)
{
return convertToInteger<int32_t>(lexicalGlobalObject, value);
}
};
template<> struct JSConverter<IDLLong> {
using Type = typename IDLLong::ImplementationType;
static constexpr bool needsState = false;
static constexpr bool needsGlobalObject = false;
static JSC::JSValue convert(Type value)
{
return JSC::jsNumber(value);
}
};
template<> struct Converter<IDLUnsignedLong> : DefaultConverter<IDLUnsignedLong> {
static uint32_t convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value)
{
return convertToInteger<uint32_t>(lexicalGlobalObject, value);
}
};
template<> struct JSConverter<IDLUnsignedLong> {
using Type = typename IDLUnsignedLong::ImplementationType;
static constexpr bool needsState = false;
static constexpr bool needsGlobalObject = false;
static JSC::JSValue convert(Type value)
{
return JSC::jsNumber(value);
}
};
template<> struct Converter<IDLLongLong> : DefaultConverter<IDLLongLong> {
static int64_t convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value)
{
return convertToInteger<int64_t>(lexicalGlobalObject, value);
}
};
template<> struct JSConverter<IDLLongLong> {
using Type = typename IDLLongLong::ImplementationType;
static constexpr bool needsState = false;
static constexpr bool needsGlobalObject = false;
static JSC::JSValue convert(Type value)
{
return JSC::jsNumber(value);
}
};
template<> struct Converter<IDLUnsignedLongLong> : DefaultConverter<IDLUnsignedLongLong> {
static uint64_t convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value)
{
return convertToInteger<uint64_t>(lexicalGlobalObject, value);
}
};
template<> struct JSConverter<IDLUnsignedLongLong> {
using Type = typename IDLUnsignedLongLong::ImplementationType;
static constexpr bool needsState = false;
static constexpr bool needsGlobalObject = false;
static JSC::JSValue convert(Type value)
{
return JSC::jsNumber(value);
}
};
// MARK: -
// MARK: Annotated Integer types
template<typename T> struct Converter<IDLClampAdaptor<T>> : DefaultConverter<IDLClampAdaptor<T>> {
using ReturnType = typename IDLClampAdaptor<T>::ImplementationType;
static ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value)
{
return convertToIntegerClamp<ReturnType>(lexicalGlobalObject, value);
}
};
template<typename T> struct JSConverter<IDLClampAdaptor<T>> {
using Type = typename IDLClampAdaptor<T>::ImplementationType;
static constexpr bool needsState = false;
static constexpr bool needsGlobalObject = false;
static JSC::JSValue convert(Type value)
{
return JSConverter<T>::convert(value);
}
};
template<typename T> struct Converter<IDLEnforceRangeAdaptor<T>> : DefaultConverter<IDLEnforceRangeAdaptor<T>> {
using ReturnType = typename IDLEnforceRangeAdaptor<T>::ImplementationType;
static ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value)
{
return convertToIntegerEnforceRange<ReturnType>(lexicalGlobalObject, value);
}
};
template<typename T> struct JSConverter<IDLEnforceRangeAdaptor<T>> {
using Type = typename IDLEnforceRangeAdaptor<T>::ImplementationType;
static constexpr bool needsState = false;
static constexpr bool needsGlobalObject = false;
static JSC::JSValue convert(Type value)
{
return JSConverter<T>::convert(value);
}
};
// MARK: -
// MARK: Floating point types
template<> struct Converter<IDLFloat> : DefaultConverter<IDLFloat> {
static inline float convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::ThrowScope& scope, double number)
{
if (UNLIKELY(!std::isfinite(number)))
throwNonFiniteTypeError(lexicalGlobalObject, scope);
return static_cast<float>(number);
}
static float convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value)
{
JSC::VM& vm = JSC::getVM(&lexicalGlobalObject);
auto scope = DECLARE_THROW_SCOPE(vm);
double number = value.toNumber(&lexicalGlobalObject);
RETURN_IF_EXCEPTION(scope, 0.0);
if (UNLIKELY(number < std::numeric_limits<float>::lowest() || number > std::numeric_limits<float>::max()))
throwTypeError(&lexicalGlobalObject, scope, "The provided value is outside the range of a float");
if (UNLIKELY(!std::isfinite(number)))
throwNonFiniteTypeError(lexicalGlobalObject, scope);
return static_cast<float>(number);
}
};
template<> struct JSConverter<IDLFloat> {
using Type = typename IDLFloat::ImplementationType;
static constexpr bool needsState = false;
static constexpr bool needsGlobalObject = false;
static JSC::JSValue convert(Type value)
{
return JSC::jsNumber(value);
}
};
template<> struct Converter<IDLUnrestrictedFloat> : DefaultConverter<IDLUnrestrictedFloat> {
static inline float convert(JSC::JSGlobalObject&, JSC::ThrowScope&, double number)
{
return static_cast<float>(number);
}
static float convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value)
{
JSC::VM& vm = JSC::getVM(&lexicalGlobalObject);
auto scope = DECLARE_THROW_SCOPE(vm);
double number = value.toNumber(&lexicalGlobalObject);
RETURN_IF_EXCEPTION(scope, 0.0);
if (UNLIKELY(number < std::numeric_limits<float>::lowest()))
return -std::numeric_limits<float>::infinity();
if (UNLIKELY(number > std::numeric_limits<float>::max()))
return std::numeric_limits<float>::infinity();
return static_cast<float>(number);
}
};
template<> struct JSConverter<IDLUnrestrictedFloat> {
using Type = typename IDLUnrestrictedFloat::ImplementationType;
static constexpr bool needsState = false;
static constexpr bool needsGlobalObject = false;
static JSC::JSValue convert(Type value)
{
return JSC::jsNumber(value);
}
};
template<> struct Converter<IDLDouble> : DefaultConverter<IDLDouble> {
static inline double convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::ThrowScope& scope, double number)
{
if (UNLIKELY(!std::isfinite(number)))
throwNonFiniteTypeError(lexicalGlobalObject, scope);
return number;
}
static double convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value)
{
JSC::VM& vm = JSC::getVM(&lexicalGlobalObject);
auto scope = DECLARE_THROW_SCOPE(vm);
double number = value.toNumber(&lexicalGlobalObject);
RETURN_IF_EXCEPTION(scope, 0.0);
if (UNLIKELY(!std::isfinite(number)))
throwNonFiniteTypeError(lexicalGlobalObject, scope);
return number;
}
};
template<> struct JSConverter<IDLDouble> {
using Type = typename IDLDouble::ImplementationType;
static constexpr bool needsState = false;
static constexpr bool needsGlobalObject = false;
static JSC::JSValue convert(Type value)
{
ASSERT(!std::isnan(value));
return JSC::jsNumber(value);
}
};
template<> struct Converter<IDLUnrestrictedDouble> : DefaultConverter<IDLUnrestrictedDouble> {
static inline double convert(JSC::JSGlobalObject&, JSC::ThrowScope&, double number)
{
return number;
}
static double convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value)
{
return value.toNumber(&lexicalGlobalObject);
}
};
template<> struct JSConverter<IDLUnrestrictedDouble> {
using Type = typename IDLUnrestrictedDouble::ImplementationType;
static constexpr bool needsState = false;
static constexpr bool needsGlobalObject = false;
static JSC::JSValue convert(Type value)
{
return JSC::jsNumber(JSC::purifyNaN(value));
}
// Add overload for MediaTime.
static JSC::JSValue convert(const MediaTime& value)
{
return JSC::jsNumber(JSC::purifyNaN(value.toDouble()));
}
};
} // namespace WebCore

View File

@@ -0,0 +1,63 @@
/*
* 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. AND ITS CONTRIBUTORS ``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 ITS 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.
*/
#pragma once
#include "IDLTypes.h"
#include "JSDOMConvertBase.h"
#include "JavaScriptCore/StrongInlines.h"
namespace WebCore {
template<> struct Converter<IDLObject> : DefaultConverter<IDLObject> {
static constexpr bool conversionHasSideEffects = false;
template<typename ExceptionThrower = DefaultExceptionThrower>
static JSC::Strong<JSC::JSObject> convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value, ExceptionThrower&& exceptionThrower = ExceptionThrower())
{
JSC::VM& vm = JSC::getVM(&lexicalGlobalObject);
auto scope = DECLARE_THROW_SCOPE(vm);
if (!value.isObject()) {
exceptionThrower(lexicalGlobalObject, scope);
return {};
}
return { vm, JSC::asObject(value) };
}
};
template<> struct JSConverter<IDLObject> {
static constexpr bool needsState = false;
static constexpr bool needsGlobalObject = false;
static JSC::JSValue convert(const JSC::Strong<JSC::JSObject>& value)
{
return value.get();
}
};
} // namespace WebCore

View File

@@ -0,0 +1,87 @@
/*
* Copyright (C) 2017 Yusuke Suzuki <utatane.tea@gmail.com>.
*
* 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. AND ITS CONTRIBUTORS ``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 ITS 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.
*/
#pragma once
#include "IDLTypes.h"
#include "JSDOMConvertBase.h"
#include "JSDOMPromise.h"
#include "WorkerGlobalScope.h"
namespace WebCore {
template<typename T> struct Converter<IDLPromise<T>> : DefaultConverter<IDLPromise<T>> {
using ReturnType = RefPtr<DOMPromise>;
// https://webidl.spec.whatwg.org/#es-promise
template<typename ExceptionThrower = DefaultExceptionThrower>
static ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value, ExceptionThrower&& exceptionThrower = ExceptionThrower())
{
JSC::VM& vm = JSC::getVM(&lexicalGlobalObject);
auto scope = DECLARE_THROW_SCOPE(vm);
auto* globalObject = JSC::jsDynamicCast<JSDOMGlobalObject*>(vm, &lexicalGlobalObject);
if (!globalObject)
return nullptr;
// 1. Let resolve be the original value of %Promise%.resolve.
// 2. Let promise be the result of calling resolve with %Promise% as the this value and V as the single argument value.
auto* promise = JSC::JSPromise::resolvedPromise(globalObject, value);
if (scope.exception()) {
auto* scriptExecutionContext = globalObject->scriptExecutionContext();
if (is<WorkerGlobalScope>(scriptExecutionContext)) {
auto* scriptController = downcast<WorkerGlobalScope>(*scriptExecutionContext).script();
bool terminatorCausedException = vm.isTerminationException(scope.exception());
if (terminatorCausedException || (scriptController && scriptController->isTerminatingExecution())) {
scriptController->forbidExecution();
return nullptr;
}
}
exceptionThrower(lexicalGlobalObject, scope);
return nullptr;
}
ASSERT(promise);
// 3. Return the IDL promise type value that is a reference to the same object as promise.
return DOMPromise::create(*globalObject, *promise);
}
};
template<typename T> struct JSConverter<IDLPromise<T>> {
static constexpr bool needsState = true;
static constexpr bool needsGlobalObject = true;
static JSC::JSValue convert(JSC::JSGlobalObject&, JSDOMGlobalObject&, DOMPromise& promise)
{
return promise.promise();
}
template<template<typename> class U>
static JSC::JSValue convert(JSC::JSGlobalObject& lexicalGlobalObject, JSDOMGlobalObject& globalObject, U<T>& promiseProxy)
{
return promiseProxy.promise(lexicalGlobalObject, globalObject);
}
};
} // namespace WebCore

View File

@@ -0,0 +1,191 @@
/*
* Copyright (C) 2016-2019 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. AND ITS CONTRIBUTORS ``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 ITS 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.
*/
#pragma once
#include "IDLTypes.h"
#include "JSDOMConvertStrings.h"
#include "JSDOMGlobalObject.h"
#include "JavaScriptCore/ObjectConstructor.h"
namespace WebCore {
namespace Detail {
template<typename IDLStringType>
struct IdentifierConverter;
template<> struct IdentifierConverter<IDLDOMString> {
static String convert(JSC::JSGlobalObject& lexicalGlobalObject, const JSC::Identifier& identifier)
{
return identifierToString(lexicalGlobalObject, identifier);
}
};
template<> struct IdentifierConverter<IDLByteString> {
static String convert(JSC::JSGlobalObject& lexicalGlobalObject, const JSC::Identifier& identifier)
{
return identifierToByteString(lexicalGlobalObject, identifier);
}
};
template<> struct IdentifierConverter<IDLUSVString> {
static String convert(JSC::JSGlobalObject& lexicalGlobalObject, const JSC::Identifier& identifier)
{
return identifierToUSVString(lexicalGlobalObject, identifier);
}
};
}
template<typename K, typename V> struct Converter<IDLRecord<K, V>> : DefaultConverter<IDLRecord<K, V>> {
using ReturnType = typename IDLRecord<K, V>::ImplementationType;
using KeyType = typename K::ImplementationType;
using ValueType = typename V::ImplementationType;
static ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value, JSDOMGlobalObject& globalObject)
{
return convertRecord<JSDOMGlobalObject&>(lexicalGlobalObject, value, globalObject);
}
static ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value)
{
return convertRecord(lexicalGlobalObject, value);
}
private:
template<class... Args>
static ReturnType convertRecord(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value, Args... args)
{
auto& vm = JSC::getVM(&lexicalGlobalObject);
auto scope = DECLARE_THROW_SCOPE(vm);
// 1. Let result be a new empty instance of record<K, V>.
// 2. If Type(O) is Undefined or Null, return result.
if (value.isUndefinedOrNull())
return {};
// 3. If Type(O) is not Object, throw a TypeError.
if (!value.isObject()) {
throwTypeError(&lexicalGlobalObject, scope);
return {};
}
JSC::JSObject* object = JSC::asObject(value);
ReturnType result;
HashMap<KeyType, size_t> resultMap;
// 4. Let keys be ? O.[[OwnPropertyKeys]]().
JSC::PropertyNameArray keys(vm, JSC::PropertyNameMode::StringsAndSymbols, JSC::PrivateSymbolMode::Exclude);
object->methodTable(vm)->getOwnPropertyNames(object, &lexicalGlobalObject, keys, JSC::DontEnumPropertiesMode::Include);
RETURN_IF_EXCEPTION(scope, {});
// 5. Repeat, for each element key of keys in List order:
for (auto& key : keys) {
// 1. Let desc be ? O.[[GetOwnProperty]](key).
JSC::PropertySlot slot(object, JSC::PropertySlot::InternalMethodType::GetOwnProperty);
bool hasProperty = object->methodTable(vm)->getOwnPropertySlot(object, &lexicalGlobalObject, key, slot);
RETURN_IF_EXCEPTION(scope, {});
// 2. If desc is not undefined and desc.[[Enumerable]] is true:
// It's necessary to filter enumerable here rather than using DontEnumPropertiesMode::Exclude,
// to prevent an observable extra [[GetOwnProperty]] operation in the case of ProxyObject records.
if (hasProperty && !(slot.attributes() & JSC::PropertyAttribute::DontEnum)) {
// 1. Let typedKey be key converted to an IDL value of type K.
auto typedKey = Detail::IdentifierConverter<K>::convert(lexicalGlobalObject, key);
RETURN_IF_EXCEPTION(scope, {});
// 2. Let value be ? Get(O, key).
JSC::JSValue subValue;
if (LIKELY(!slot.isTaintedByOpaqueObject()))
subValue = slot.getValue(&lexicalGlobalObject, key);
else
subValue = object->get(&lexicalGlobalObject, key);
RETURN_IF_EXCEPTION(scope, {});
// 3. Let typedValue be value converted to an IDL value of type V.
auto typedValue = Converter<V>::convert(lexicalGlobalObject, subValue, args...);
RETURN_IF_EXCEPTION(scope, {});
// 4. Set result[typedKey] to typedValue.
// Note: It's possible that typedKey is already in result if K is USVString and key contains unpaired surrogates.
if constexpr (std::is_same_v<K, IDLUSVString>) {
if (!typedKey.is8Bit()) {
auto addResult = resultMap.add(typedKey, result.size());
if (!addResult.isNewEntry) {
ASSERT(result[addResult.iterator->value].key == typedKey);
result[addResult.iterator->value].value = WTFMove(typedValue);
continue;
}
}
} else
UNUSED_VARIABLE(resultMap);
// 5. Otherwise, append to result a mapping (typedKey, typedValue).
result.append({ WTFMove(typedKey), WTFMove(typedValue) });
}
}
// 6. Return result.
return result;
}
};
template<typename K, typename V> struct JSConverter<IDLRecord<K, V>> {
static constexpr bool needsState = true;
static constexpr bool needsGlobalObject = true;
template<typename MapType>
static JSC::JSValue convert(JSC::JSGlobalObject& lexicalGlobalObject, JSDOMGlobalObject& globalObject, const MapType& map)
{
auto& vm = JSC::getVM(&lexicalGlobalObject);
// 1. Let result be ! ObjectCreate(%ObjectPrototype%).
auto result = constructEmptyObject(&lexicalGlobalObject, globalObject.objectPrototype());
// 2. Repeat, for each mapping (key, value) in D:
for (const auto& keyValuePair : map) {
// 1. Let esKey be key converted to an ECMAScript value.
// Note, this step is not required, as we need the key to be
// an Identifier, not a JSValue.
// 2. Let esValue be value converted to an ECMAScript value.
auto esValue = toJS<V>(lexicalGlobalObject, globalObject, keyValuePair.value);
// 3. Let created be ! CreateDataProperty(result, esKey, esValue).
bool created = result->putDirect(vm, JSC::Identifier::fromString(vm, keyValuePair.key), esValue);
// 4. Assert: created is true.
ASSERT_UNUSED(created, created);
}
// 3. Return result.
return result;
}
};
} // namespace WebCore

View File

@@ -0,0 +1,54 @@
/*
* Copyright (C) 2017 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. AND ITS CONTRIBUTORS ``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 ITS 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.
*/
#pragma once
#include "IDLTypes.h"
#include "JSDOMConvertBase.h"
#include "JSDOMConvertStrings.h"
#include "ScheduledAction.h"
namespace WebCore {
template<> struct Converter<IDLScheduledAction> : DefaultConverter<IDLScheduledAction> {
static std::unique_ptr<ScheduledAction> convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value, JSDOMGlobalObject& globalObject)
{
JSC::VM& vm = JSC::getVM(&lexicalGlobalObject);
auto scope = DECLARE_THROW_SCOPE(vm);
if (!value.isCallable(vm)) {
auto code = Converter<IDLDOMString>::convert(lexicalGlobalObject, value);
RETURN_IF_EXCEPTION(scope, nullptr);
return ScheduledAction::create(globalObject.world(), WTFMove(code));
}
// The value must be an object at this point because no non-object values are callable.
ASSERT(value.isObject());
return ScheduledAction::create(globalObject.world(), JSC::Strong<JSC::Unknown> { vm, JSC::asObject(value) });
}
};
}

View File

@@ -0,0 +1,435 @@
/*
* Copyright (C) 2016-2017 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. AND ITS CONTRIBUTORS ``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 ITS 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.
*/
#pragma once
#include "IDLTypes.h"
#include "JSDOMConvertBase.h"
#include "JSDOMConvertNumbers.h"
#include "JSDOMGlobalObject.h"
#include "JavaScriptCore/IteratorOperations.h"
#include "JavaScriptCore/JSArray.h"
#include "JavaScriptCore/JSGlobalObjectInlines.h"
#include "JavaScriptCore/ObjectConstructor.h"
namespace WebCore {
namespace Detail {
template<typename IDLType>
struct GenericSequenceConverter {
using ReturnType = Vector<typename IDLType::SequenceStorageType>;
static ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSObject* object)
{
return convert(lexicalGlobalObject, object, ReturnType());
}
static ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSObject* object, ReturnType&& result)
{
forEachInIterable(&lexicalGlobalObject, object, [&result](JSC::VM& vm, JSC::JSGlobalObject* lexicalGlobalObject, JSC::JSValue nextValue) {
auto scope = DECLARE_THROW_SCOPE(vm);
auto convertedValue = Converter<IDLType>::convert(*lexicalGlobalObject, nextValue);
if (UNLIKELY(scope.exception()))
return;
result.append(WTFMove(convertedValue));
});
return WTFMove(result);
}
static ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSObject* object, JSC::JSValue method)
{
return convert(lexicalGlobalObject, object, method, ReturnType());
}
static ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSObject* object, JSC::JSValue method, ReturnType&& result)
{
forEachInIterable(lexicalGlobalObject, object, method, [&result](JSC::VM& vm, JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue nextValue) {
auto scope = DECLARE_THROW_SCOPE(vm);
auto convertedValue = Converter<IDLType>::convert(lexicalGlobalObject, nextValue);
if (UNLIKELY(scope.exception()))
return;
result.append(WTFMove(convertedValue));
});
return WTFMove(result);
}
};
// Specialization for numeric types
// FIXME: This is only implemented for the IDLFloatingPointTypes and IDLLong. To add
// support for more numeric types, add an overload of Converter<IDLType>::convert that
// takes a JSGlobalObject, ThrowScope and double as its arguments.
template<typename IDLType>
struct NumericSequenceConverter {
using GenericConverter = GenericSequenceConverter<IDLType>;
using ReturnType = typename GenericConverter::ReturnType;
static ReturnType convertArray(JSC::JSGlobalObject& lexicalGlobalObject, JSC::ThrowScope& scope, JSC::JSArray* array, unsigned length, JSC::IndexingType indexingType, ReturnType&& result)
{
if (indexingType == JSC::Int32Shape) {
for (unsigned i = 0; i < length; i++) {
auto indexValue = array->butterfly()->contiguousInt32().at(array, i).get();
ASSERT(!indexValue || indexValue.isInt32());
if (!indexValue)
result.uncheckedAppend(0);
else
result.uncheckedAppend(indexValue.asInt32());
}
return WTFMove(result);
}
ASSERT(indexingType == JSC::DoubleShape);
for (unsigned i = 0; i < length; i++) {
double doubleValue = array->butterfly()->contiguousDouble().at(array, i);
if (std::isnan(doubleValue))
result.uncheckedAppend(0);
else {
auto convertedValue = Converter<IDLType>::convert(lexicalGlobalObject, scope, doubleValue);
RETURN_IF_EXCEPTION(scope, {});
result.uncheckedAppend(convertedValue);
}
}
return WTFMove(result);
}
static ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value)
{
auto& vm = JSC::getVM(&lexicalGlobalObject);
auto scope = DECLARE_THROW_SCOPE(vm);
if (!value.isObject()) {
throwSequenceTypeError(lexicalGlobalObject, scope);
return {};
}
JSC::JSObject* object = JSC::asObject(value);
if (!JSC::isJSArray(object))
RELEASE_AND_RETURN(scope, GenericConverter::convert(lexicalGlobalObject, object));
JSC::JSArray* array = JSC::asArray(object);
if (!array->isIteratorProtocolFastAndNonObservable())
RELEASE_AND_RETURN(scope, GenericConverter::convert(lexicalGlobalObject, object));
unsigned length = array->length();
ReturnType result;
// If we're not an int32/double array, it's possible that converting a
// JSValue to a number could cause the iterator protocol to change, hence,
// we may need more capacity, or less. In such cases, we use the length
// as a proxy for the capacity we will most likely need (it's unlikely that
// a program is written with a valueOf that will augment the iterator protocol).
// If we are an int32/double array, then length is precisely the capacity we need.
if (!result.tryReserveCapacity(length)) {
// FIXME: Is the right exception to throw?
throwTypeError(&lexicalGlobalObject, scope);
return {};
}
JSC::IndexingType indexingType = array->indexingType() & JSC::IndexingShapeMask;
if (indexingType != JSC::Int32Shape && indexingType != JSC::DoubleShape)
RELEASE_AND_RETURN(scope, GenericConverter::convert(lexicalGlobalObject, object, WTFMove(result)));
return convertArray(lexicalGlobalObject, scope, array, length, indexingType, WTFMove(result));
}
static ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSObject* object, JSC::JSValue method)
{
auto& vm = JSC::getVM(&lexicalGlobalObject);
auto scope = DECLARE_THROW_SCOPE(vm);
if (!JSC::isJSArray(object))
RELEASE_AND_RETURN(scope, GenericConverter::convert(lexicalGlobalObject, object, method));
JSC::JSArray* array = JSC::asArray(object);
if (!array->isIteratorProtocolFastAndNonObservable())
RELEASE_AND_RETURN(scope, GenericConverter::convert(lexicalGlobalObject, object, method));
unsigned length = array->length();
ReturnType result;
// If we're not an int32/double array, it's possible that converting a
// JSValue to a number could cause the iterator protocol to change, hence,
// we may need more capacity, or less. In such cases, we use the length
// as a proxy for the capacity we will most likely need (it's unlikely that
// a program is written with a valueOf that will augment the iterator protocol).
// If we are an int32/double array, then length is precisely the capacity we need.
if (!result.tryReserveCapacity(length)) {
// FIXME: Is the right exception to throw?
throwTypeError(&lexicalGlobalObject, scope);
return {};
}
JSC::IndexingType indexingType = array->indexingType() & JSC::IndexingShapeMask;
if (indexingType != JSC::Int32Shape && indexingType != JSC::DoubleShape)
RELEASE_AND_RETURN(scope, GenericConverter::convert(lexicalGlobalObject, object, method, WTFMove(result)));
return convertArray(lexicalGlobalObject, scope, array, length, indexingType, WTFMove(result));
}
};
template<typename IDLType>
struct SequenceConverter {
using GenericConverter = GenericSequenceConverter<IDLType>;
using ReturnType = typename GenericConverter::ReturnType;
static ReturnType convertArray(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSArray* array)
{
auto& vm = lexicalGlobalObject.vm();
auto scope = DECLARE_THROW_SCOPE(vm);
unsigned length = array->length();
ReturnType result;
if (!result.tryReserveCapacity(length)) {
// FIXME: Is the right exception to throw?
throwTypeError(&lexicalGlobalObject, scope);
return {};
}
JSC::IndexingType indexingType = array->indexingType() & JSC::IndexingShapeMask;
if (indexingType == JSC::ContiguousShape) {
for (unsigned i = 0; i < length; i++) {
auto indexValue = array->butterfly()->contiguous().at(array, i).get();
if (!indexValue)
indexValue = JSC::jsUndefined();
auto convertedValue = Converter<IDLType>::convert(lexicalGlobalObject, indexValue);
RETURN_IF_EXCEPTION(scope, {});
result.uncheckedAppend(convertedValue);
}
return result;
}
for (unsigned i = 0; i < length; i++) {
auto indexValue = array->getDirectIndex(&lexicalGlobalObject, i);
RETURN_IF_EXCEPTION(scope, {});
if (!indexValue)
indexValue = JSC::jsUndefined();
auto convertedValue = Converter<IDLType>::convert(lexicalGlobalObject, indexValue);
RETURN_IF_EXCEPTION(scope, {});
result.uncheckedAppend(convertedValue);
}
return result;
}
static ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value)
{
auto& vm = JSC::getVM(&lexicalGlobalObject);
auto scope = DECLARE_THROW_SCOPE(vm);
if (!value.isObject()) {
throwSequenceTypeError(lexicalGlobalObject, scope);
return {};
}
JSC::JSObject* object = JSC::asObject(value);
if (Converter<IDLType>::conversionHasSideEffects)
RELEASE_AND_RETURN(scope, (GenericConverter::convert(lexicalGlobalObject, object)));
if (!JSC::isJSArray(object))
RELEASE_AND_RETURN(scope, (GenericConverter::convert(lexicalGlobalObject, object)));
JSC::JSArray* array = JSC::asArray(object);
if (!array->isIteratorProtocolFastAndNonObservable())
RELEASE_AND_RETURN(scope, (GenericConverter::convert(lexicalGlobalObject, object)));
RELEASE_AND_RETURN(scope, (convertArray(lexicalGlobalObject, array)));
}
static ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSObject* object, JSC::JSValue method)
{
if (Converter<IDLType>::conversionHasSideEffects)
return GenericConverter::convert(lexicalGlobalObject, object, method);
if (!JSC::isJSArray(object))
return GenericConverter::convert(lexicalGlobalObject, object, method);
JSC::JSArray* array = JSC::asArray(object);
if (!array->isIteratorProtocolFastAndNonObservable())
return GenericConverter::convert(lexicalGlobalObject, object, method);
return convertArray(lexicalGlobalObject, array);
}
};
template<>
struct SequenceConverter<IDLLong> {
using ReturnType = typename GenericSequenceConverter<IDLLong>::ReturnType;
static ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value)
{
return NumericSequenceConverter<IDLLong>::convert(lexicalGlobalObject, value);
}
static ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSObject* object, JSC::JSValue method)
{
return NumericSequenceConverter<IDLLong>::convert(lexicalGlobalObject, object, method);
}
};
template<>
struct SequenceConverter<IDLFloat> {
using ReturnType = typename GenericSequenceConverter<IDLFloat>::ReturnType;
static ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value)
{
return NumericSequenceConverter<IDLFloat>::convert(lexicalGlobalObject, value);
}
static ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSObject* object, JSC::JSValue method)
{
return NumericSequenceConverter<IDLFloat>::convert(lexicalGlobalObject, object, method);
}
};
template<>
struct SequenceConverter<IDLUnrestrictedFloat> {
using ReturnType = typename GenericSequenceConverter<IDLUnrestrictedFloat>::ReturnType;
static ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value)
{
return NumericSequenceConverter<IDLUnrestrictedFloat>::convert(lexicalGlobalObject, value);
}
static ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSObject* object, JSC::JSValue method)
{
return NumericSequenceConverter<IDLUnrestrictedFloat>::convert(lexicalGlobalObject, object, method);
}
};
template<>
struct SequenceConverter<IDLDouble> {
using ReturnType = typename GenericSequenceConverter<IDLDouble>::ReturnType;
static ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value)
{
return NumericSequenceConverter<IDLDouble>::convert(lexicalGlobalObject, value);
}
static ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSObject* object, JSC::JSValue method)
{
return NumericSequenceConverter<IDLDouble>::convert(lexicalGlobalObject, object, method);
}
};
template<>
struct SequenceConverter<IDLUnrestrictedDouble> {
using ReturnType = typename GenericSequenceConverter<IDLUnrestrictedDouble>::ReturnType;
static ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value)
{
return NumericSequenceConverter<IDLUnrestrictedDouble>::convert(lexicalGlobalObject, value);
}
static ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSObject* object, JSC::JSValue method)
{
return NumericSequenceConverter<IDLUnrestrictedDouble>::convert(lexicalGlobalObject, object, method);
}
};
}
template<typename T> struct Converter<IDLSequence<T>> : DefaultConverter<IDLSequence<T>> {
using ReturnType = typename Detail::SequenceConverter<T>::ReturnType;
static ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value)
{
return Detail::SequenceConverter<T>::convert(lexicalGlobalObject, value);
}
static ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSObject* object, JSC::JSValue method)
{
return Detail::SequenceConverter<T>::convert(lexicalGlobalObject, object, method);
}
};
template<typename T> struct JSConverter<IDLSequence<T>> {
static constexpr bool needsState = true;
static constexpr bool needsGlobalObject = true;
template<typename U, size_t inlineCapacity>
static JSC::JSValue convert(JSC::JSGlobalObject& lexicalGlobalObject, JSDOMGlobalObject& globalObject, const Vector<U, inlineCapacity>& vector)
{
JSC::VM& vm = JSC::getVM(&lexicalGlobalObject);
auto scope = DECLARE_THROW_SCOPE(vm);
JSC::MarkedArgumentBuffer list;
for (auto& element : vector) {
auto jsValue = toJS<T>(lexicalGlobalObject, globalObject, element);
RETURN_IF_EXCEPTION(scope, {});
list.append(jsValue);
}
if (UNLIKELY(list.hasOverflowed())) {
throwOutOfMemoryError(&lexicalGlobalObject, scope);
return {};
}
RELEASE_AND_RETURN(scope, JSC::constructArray(&globalObject, static_cast<JSC::ArrayAllocationProfile*>(nullptr), list));
}
};
template<typename T> struct Converter<IDLFrozenArray<T>> : DefaultConverter<IDLFrozenArray<T>> {
using ReturnType = typename Detail::SequenceConverter<T>::ReturnType;
static ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value)
{
return Detail::SequenceConverter<T>::convert(lexicalGlobalObject, value);
}
static ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSObject* object, JSC::JSValue method)
{
return Detail::SequenceConverter<T>::convert(lexicalGlobalObject, object, method);
}
};
template<typename T> struct JSConverter<IDLFrozenArray<T>> {
static constexpr bool needsState = true;
static constexpr bool needsGlobalObject = true;
template<typename U, size_t inlineCapacity>
static JSC::JSValue convert(JSC::JSGlobalObject& lexicalGlobalObject, JSDOMGlobalObject& globalObject, const Vector<U, inlineCapacity>& vector)
{
JSC::VM& vm = JSC::getVM(&lexicalGlobalObject);
auto scope = DECLARE_THROW_SCOPE(vm);
JSC::MarkedArgumentBuffer list;
for (auto& element : vector) {
auto jsValue = toJS<T>(lexicalGlobalObject, globalObject, element);
RETURN_IF_EXCEPTION(scope, {});
list.append(jsValue);
}
if (UNLIKELY(list.hasOverflowed())) {
throwOutOfMemoryError(&lexicalGlobalObject, scope);
return {};
}
auto* array = JSC::constructArray(&globalObject, static_cast<JSC::ArrayAllocationProfile*>(nullptr), list);
RETURN_IF_EXCEPTION(scope, {});
RELEASE_AND_RETURN(scope, JSC::objectConstructorFreeze(&lexicalGlobalObject, array));
}
};
} // namespace WebCore

View File

@@ -0,0 +1,50 @@
/*
* 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. AND ITS CONTRIBUTORS ``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 ITS 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.
*/
#pragma once
#include "IDLTypes.h"
#include "JSDOMConvertStrings.h"
namespace WebCore {
template<typename T> struct Converter<IDLSerializedScriptValue<T>> : DefaultConverter<IDLSerializedScriptValue<T>> {
static RefPtr<T> convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value)
{
return T::create(lexicalGlobalObject, value);
}
};
template<typename T> struct JSConverter<IDLSerializedScriptValue<T>> {
static constexpr bool needsState = true;
static constexpr bool needsGlobalObject = true;
static JSC::JSValue convert(JSC::JSGlobalObject& lexicalGlobalObject, JSDOMGlobalObject& globalObject, RefPtr<T> value)
{
return value ? value->deserialize(lexicalGlobalObject, &globalObject) : JSC::jsNull();
}
};
} // namespace WebCore

View File

@@ -0,0 +1,92 @@
/*
* Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
* Copyright (C) 2004-2011, 2013, 2016 Apple Inc. All rights reserved.
* Copyright (C) 2007 Samuel Weinig <sam@webkit.org>
* Copyright (C) 2013 Michael Pruett <michael@68k.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "config.h"
#include "JSDOMConvertStrings.h"
#include "JSDOMExceptionHandling.h"
#include "JavaScriptCore/HeapInlines.h"
#include "JavaScriptCore/JSCJSValueInlines.h"
#include "wtf/text/StringBuilder.h"
#include "wtf/unicode/CharacterNames.h"
namespace WebCore {
using namespace JSC;
String identifierToString(JSGlobalObject& lexicalGlobalObject, const Identifier& identifier)
{
if (UNLIKELY(identifier.isSymbol())) {
auto scope = DECLARE_THROW_SCOPE(lexicalGlobalObject.vm());
throwTypeError(&lexicalGlobalObject, scope, SymbolCoercionError);
return {};
}
return identifier.string();
}
static inline String stringToByteString(JSGlobalObject& lexicalGlobalObject, JSC::ThrowScope& scope, String&& string)
{
if (!string.isAllLatin1()) {
throwTypeError(&lexicalGlobalObject, scope);
return {};
}
return WTFMove(string);
}
String identifierToByteString(JSGlobalObject& lexicalGlobalObject, const Identifier& identifier)
{
VM& vm = lexicalGlobalObject.vm();
auto scope = DECLARE_THROW_SCOPE(vm);
auto string = identifierToString(lexicalGlobalObject, identifier);
RETURN_IF_EXCEPTION(scope, {});
return stringToByteString(lexicalGlobalObject, scope, WTFMove(string));
}
String valueToByteString(JSGlobalObject& lexicalGlobalObject, JSValue value)
{
VM& vm = lexicalGlobalObject.vm();
auto scope = DECLARE_THROW_SCOPE(vm);
auto string = value.toWTFString(&lexicalGlobalObject);
RETURN_IF_EXCEPTION(scope, {});
return stringToByteString(lexicalGlobalObject, scope, WTFMove(string));
}
String identifierToUSVString(JSGlobalObject& lexicalGlobalObject, const Identifier& identifier)
{
return replaceUnpairedSurrogatesWithReplacementCharacter(identifierToString(lexicalGlobalObject, identifier));
}
String valueToUSVString(JSGlobalObject& lexicalGlobalObject, JSValue value)
{
VM& vm = lexicalGlobalObject.vm();
auto scope = DECLARE_THROW_SCOPE(vm);
auto string = value.toWTFString(&lexicalGlobalObject);
RETURN_IF_EXCEPTION(scope, {});
return replaceUnpairedSurrogatesWithReplacementCharacter(WTFMove(string));
}
} // namespace WebCore

View File

@@ -0,0 +1,214 @@
/*
* Copyright (C) 2016-2019 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. AND ITS CONTRIBUTORS ``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 ITS 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.
*/
#pragma once
#include "IDLTypes.h"
#include "JSDOMConvertBase.h"
#include "StringAdaptors.h"
namespace WebCore {
WEBCORE_EXPORT String identifierToString(JSC::JSGlobalObject&, const JSC::Identifier&);
WEBCORE_EXPORT String identifierToByteString(JSC::JSGlobalObject&, const JSC::Identifier&);
WEBCORE_EXPORT String valueToByteString(JSC::JSGlobalObject&, JSC::JSValue);
WEBCORE_EXPORT String identifierToUSVString(JSC::JSGlobalObject&, const JSC::Identifier&);
WEBCORE_EXPORT String valueToUSVString(JSC::JSGlobalObject&, JSC::JSValue);
inline String propertyNameToString(JSC::PropertyName propertyName)
{
ASSERT(!propertyName.isSymbol());
return propertyName.uid() ? propertyName.uid() : propertyName.publicName();
}
inline AtomString propertyNameToAtomString(JSC::PropertyName propertyName)
{
return AtomString(propertyName.uid() ? propertyName.uid() : propertyName.publicName());
}
// MARK: -
// MARK: String types
template<> struct Converter<IDLDOMString> : DefaultConverter<IDLDOMString> {
static String convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value)
{
return value.toWTFString(&lexicalGlobalObject);
}
};
template<> struct JSConverter<IDLDOMString> {
static constexpr bool needsState = true;
static constexpr bool needsGlobalObject = false;
static JSC::JSValue convert(JSC::JSGlobalObject& lexicalGlobalObject, const String& value)
{
return JSC::jsStringWithCache(JSC::getVM(&lexicalGlobalObject), value);
}
static JSC::JSValue convert(JSC::JSGlobalObject& lexicalGlobalObject, const UncachedString& value)
{
return JSC::jsString(JSC::getVM(&lexicalGlobalObject), value.string);
}
static JSC::JSValue convert(JSC::JSGlobalObject& lexicalGlobalObject, const OwnedString& value)
{
return JSC::jsOwnedString(JSC::getVM(&lexicalGlobalObject), value.string);
}
static JSC::JSValue convert(JSC::JSGlobalObject& lexicalGlobalObject, const URL& value)
{
return JSC::jsOwnedString(JSC::getVM(&lexicalGlobalObject), value.string());
}
};
template<> struct Converter<IDLByteString> : DefaultConverter<IDLByteString> {
static String convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value)
{
return valueToByteString(lexicalGlobalObject, value);
}
};
template<> struct JSConverter<IDLByteString> {
static constexpr bool needsState = true;
static constexpr bool needsGlobalObject = false;
static JSC::JSValue convert(JSC::JSGlobalObject& lexicalGlobalObject, const String& value)
{
return JSC::jsStringWithCache(JSC::getVM(&lexicalGlobalObject), value);
}
static JSC::JSValue convert(JSC::JSGlobalObject& lexicalGlobalObject, const UncachedString& value)
{
return JSC::jsString(JSC::getVM(&lexicalGlobalObject), value.string);
}
static JSC::JSValue convert(JSC::JSGlobalObject& lexicalGlobalObject, const OwnedString& value)
{
return JSC::jsOwnedString(JSC::getVM(&lexicalGlobalObject), value.string);
}
};
template<> struct Converter<IDLUSVString> : DefaultConverter<IDLUSVString> {
static String convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value)
{
return valueToUSVString(lexicalGlobalObject, value);
}
static JSC::JSValue convert(JSC::JSGlobalObject& lexicalGlobalObject, const URL& value)
{
return JSC::jsOwnedString(JSC::getVM(&lexicalGlobalObject), value.string());
}
};
template<> struct JSConverter<IDLUSVString> {
static constexpr bool needsState = true;
static constexpr bool needsGlobalObject = false;
static JSC::JSValue convert(JSC::JSGlobalObject& lexicalGlobalObject, const String& value)
{
return JSC::jsStringWithCache(JSC::getVM(&lexicalGlobalObject), value);
}
static JSC::JSValue convert(JSC::JSGlobalObject& lexicalGlobalObject, const UncachedString& value)
{
return JSC::jsString(JSC::getVM(&lexicalGlobalObject), value.string);
}
static JSC::JSValue convert(JSC::JSGlobalObject& lexicalGlobalObject, const OwnedString& value)
{
return JSC::jsOwnedString(JSC::getVM(&lexicalGlobalObject), value.string);
}
static JSC::JSValue convert(JSC::JSGlobalObject& lexicalGlobalObject, const URL& value)
{
return JSC::jsOwnedString(JSC::getVM(&lexicalGlobalObject), value.string());
}
};
// MARK: -
// MARK: String type adaptors
template<typename T> struct Converter<IDLLegacyNullToEmptyStringAdaptor<T>> : DefaultConverter<IDLLegacyNullToEmptyStringAdaptor<T>> {
static String convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value)
{
if (value.isNull())
return emptyString();
return Converter<T>::convert(lexicalGlobalObject, value);
}
};
template<typename T> struct JSConverter<IDLLegacyNullToEmptyStringAdaptor<T>> {
static constexpr bool needsState = true;
static constexpr bool needsGlobalObject = false;
static JSC::JSValue convert(JSC::JSGlobalObject& lexicalGlobalObject, const String& value)
{
return JSConverter<T>::convert(lexicalGlobalObject, value);
}
};
template<typename T> struct Converter<IDLAtomStringAdaptor<T>> : DefaultConverter<IDLAtomStringAdaptor<T>> {
static AtomString convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value)
{
static_assert(std::is_same<T, IDLDOMString>::value, "This adaptor is only supported for IDLDOMString at the moment.");
return value.toString(&lexicalGlobalObject)->toAtomString(&lexicalGlobalObject);
}
};
template<typename T> struct JSConverter<IDLAtomStringAdaptor<T>> {
static constexpr bool needsState = true;
static constexpr bool needsGlobalObject = false;
static JSC::JSValue convert(JSC::JSGlobalObject& lexicalGlobalObject, const AtomString& value)
{
static_assert(std::is_same<T, IDLDOMString>::value, "This adaptor is only supported for IDLDOMString at the moment.");
return JSConverter<T>::convert(lexicalGlobalObject, value);
}
};
template<typename T> struct Converter<IDLRequiresExistingAtomStringAdaptor<T>> : DefaultConverter<IDLRequiresExistingAtomStringAdaptor<T>> {
static AtomString convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value)
{
static_assert(std::is_same<T, IDLDOMString>::value, "This adaptor is only supported for IDLDOMString at the moment.");
return AtomString(value.toString(&lexicalGlobalObject)->toExistingAtomString(&lexicalGlobalObject));
}
};
template<typename T> struct JSConverter<IDLRequiresExistingAtomStringAdaptor<T>> {
static constexpr bool needsState = true;
static constexpr bool needsGlobalObject = false;
static JSC::JSValue convert(JSC::JSGlobalObject& lexicalGlobalObject, const AtomString& value)
{
static_assert(std::is_same<T, IDLDOMString>::value, "This adaptor is only supported for IDLDOMString at the moment.");
return JSConverter<T>::convert(lexicalGlobalObject, value);
}
};
} // namespace WebCore

View File

@@ -0,0 +1,416 @@
/*
* Copyright (C) 2016-2020 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. AND ITS CONTRIBUTORS ``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 ITS 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.
*/
#pragma once
#include "IDLTypes.h"
#include "JSDOMBinding.h"
#include "JSDOMConvertBase.h"
#include "JSDOMConvertBufferSource.h"
#include "JSDOMConvertInterface.h"
#include "JSDOMConvertNull.h"
#include "JavaScriptCore/IteratorOperations.h"
#include <variant>
namespace WebCore {
template<typename ReturnType, bool enabled>
struct ConditionalReturner;
template<typename ReturnType>
struct ConditionalReturner<ReturnType, true> {
template<typename T>
static std::optional<ReturnType> get(T&& value)
{
return ReturnType(std::forward<T>(value));
}
};
template<typename ReturnType>
struct ConditionalReturner<ReturnType, false> {
template<typename T>
static std::optional<ReturnType> get(T&&)
{
return std::nullopt;
}
};
template<typename ReturnType, typename T, bool enabled>
struct ConditionalConverter;
template<typename ReturnType, typename T>
struct ConditionalConverter<ReturnType, T, true> {
static std::optional<ReturnType> convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value)
{
return ReturnType(Converter<T>::convert(lexicalGlobalObject, value));
}
};
template<typename ReturnType, typename T>
struct ConditionalConverter<ReturnType, T, false> {
static std::optional<ReturnType> convert(JSC::JSGlobalObject&, JSC::JSValue)
{
return std::nullopt;
}
};
template<typename ReturnType, typename T, bool enabled>
struct ConditionalSequenceConverter;
template<typename ReturnType, typename T>
struct ConditionalSequenceConverter<ReturnType, T, true> {
static std::optional<ReturnType> convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSObject* object, JSC::JSValue method)
{
return ReturnType(Converter<T>::convert(lexicalGlobalObject, object, method));
}
};
template<typename ReturnType, typename T>
struct ConditionalSequenceConverter<ReturnType, T, false> {
static std::optional<ReturnType> convert(JSC::JSGlobalObject&, JSC::JSObject*, JSC::JSValue)
{
return std::nullopt;
}
};
namespace Detail {
template<typename List, bool condition>
struct ConditionalFront;
template<typename List>
struct ConditionalFront<List, true> {
using type = brigand::front<List>;
};
template<typename List>
struct ConditionalFront<List, false> {
using type = void;
};
}
template<typename List, bool condition>
using ConditionalFront = typename Detail::ConditionalFront<List, condition>::type;
template<typename... T> struct Converter<IDLUnion<T...>> : DefaultConverter<IDLUnion<T...>> {
using Type = IDLUnion<T...>;
using TypeList = typename Type::TypeList;
using ReturnType = typename Type::ImplementationType;
using NumericTypeList = brigand::filter<TypeList, IsIDLNumber<brigand::_1>>;
static constexpr size_t numberOfNumericTypes = brigand::size<NumericTypeList>::value;
static_assert(numberOfNumericTypes == 0 || numberOfNumericTypes == 1, "There can be 0 or 1 numeric types in an IDLUnion.");
using NumericType = ConditionalFront<NumericTypeList, numberOfNumericTypes != 0>;
using StringTypeList = brigand::filter<TypeList, IsIDLStringOrEnumeration<brigand::_1>>;
static constexpr size_t numberOfStringTypes = brigand::size<StringTypeList>::value;
static_assert(numberOfStringTypes == 0 || numberOfStringTypes == 1, "There can be 0 or 1 string types in an IDLUnion.");
using StringType = ConditionalFront<StringTypeList, numberOfStringTypes != 0>;
using SequenceTypeList = brigand::filter<TypeList, IsIDLSequence<brigand::_1>>;
static constexpr size_t numberOfSequenceTypes = brigand::size<SequenceTypeList>::value;
static_assert(numberOfSequenceTypes == 0 || numberOfSequenceTypes == 1, "There can be 0 or 1 sequence types in an IDLUnion.");
using SequenceType = ConditionalFront<SequenceTypeList, numberOfSequenceTypes != 0>;
using FrozenArrayTypeList = brigand::filter<TypeList, IsIDLFrozenArray<brigand::_1>>;
static constexpr size_t numberOfFrozenArrayTypes = brigand::size<FrozenArrayTypeList>::value;
static_assert(numberOfFrozenArrayTypes == 0 || numberOfFrozenArrayTypes == 1, "There can be 0 or 1 FrozenArray types in an IDLUnion.");
using FrozenArrayType = ConditionalFront<FrozenArrayTypeList, numberOfFrozenArrayTypes != 0>;
using DictionaryTypeList = brigand::filter<TypeList, IsIDLDictionary<brigand::_1>>;
static constexpr size_t numberOfDictionaryTypes = brigand::size<DictionaryTypeList>::value;
static_assert(numberOfDictionaryTypes == 0 || numberOfDictionaryTypes == 1, "There can be 0 or 1 dictionary types in an IDLUnion.");
static constexpr bool hasDictionaryType = numberOfDictionaryTypes != 0;
using DictionaryType = ConditionalFront<DictionaryTypeList, hasDictionaryType>;
using RecordTypeList = brigand::filter<TypeList, IsIDLRecord<brigand::_1>>;
static constexpr size_t numberOfRecordTypes = brigand::size<RecordTypeList>::value;
static_assert(numberOfRecordTypes == 0 || numberOfRecordTypes == 1, "There can be 0 or 1 record types in an IDLUnion.");
static constexpr bool hasRecordType = numberOfRecordTypes != 0;
using RecordType = ConditionalFront<RecordTypeList, hasRecordType>;
using ObjectTypeList = brigand::filter<TypeList, std::is_same<IDLObject, brigand::_1>>;
static constexpr size_t numberOfObjectTypes = brigand::size<ObjectTypeList>::value;
static_assert(numberOfObjectTypes == 0 || numberOfObjectTypes == 1, "There can be 0 or 1 object types in an IDLUnion.");
static constexpr bool hasObjectType = numberOfObjectTypes != 0;
using ObjectType = ConditionalFront<ObjectTypeList, hasObjectType>;
static constexpr bool hasAnyObjectType = (numberOfSequenceTypes + numberOfFrozenArrayTypes + numberOfDictionaryTypes + numberOfRecordTypes + numberOfObjectTypes) > 0;
using InterfaceTypeList = brigand::filter<TypeList, IsIDLInterface<brigand::_1>>;
using TypedArrayTypeList = brigand::filter<TypeList, IsIDLTypedArray<brigand::_1>>;
static ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value)
{
JSC::VM& vm = JSC::getVM(&lexicalGlobalObject);
auto scope = DECLARE_THROW_SCOPE(vm);
// 1. If the union type includes a nullable type and V is null or undefined, then return the IDL value null.
constexpr bool hasNullType = brigand::any<TypeList, std::is_same<IDLNull, brigand::_1>>::value;
if (hasNullType) {
if (value.isUndefinedOrNull())
RELEASE_AND_RETURN(scope, (ConditionalConverter<ReturnType, IDLNull, hasNullType>::convert(lexicalGlobalObject, value).value()));
}
// 2. Let types be the flattened member types of the union type.
// NOTE: Union is expected to be pre-flattented.
// 3. If V is null or undefined then:
if (hasDictionaryType) {
if (value.isUndefinedOrNull()) {
// 1. If types includes a dictionary type, then return the result of converting V to that dictionary type.
RELEASE_AND_RETURN(scope, (ConditionalConverter<ReturnType, DictionaryType, hasDictionaryType>::convert(lexicalGlobalObject, value).value()));
}
}
// 4. If V is a platform object, then:
// 1. If types includes an interface type that V implements, then return the IDL value that is a reference to the object V.
// 2. If types includes object, then return the IDL value that is a reference to the object V.
// (FIXME: Add support for object and step 4.2)
if (brigand::any<TypeList, IsIDLInterface<brigand::_1>>::value) {
std::optional<ReturnType> returnValue;
brigand::for_each<InterfaceTypeList>([&](auto&& type) {
if (returnValue)
return;
using Type = typename WTF::RemoveCVAndReference<decltype(type)>::type::type;
using ImplementationType = typename Type::ImplementationType;
using RawType = typename Type::RawType;
auto castedValue = JSToWrappedOverloader<RawType>::toWrapped(lexicalGlobalObject, value);
if (!castedValue)
return;
returnValue = ReturnType(ImplementationType(castedValue));
});
if (returnValue)
return WTFMove(returnValue.value());
}
// FIXME: Add support for steps 5 & 6.
//
// 5. If V is a DOMException platform object, then:
// 1. If types includes DOMException or Error, then return the result of converting V to that type.
// 2 If types includes object, then return the IDL value that is a reference to the object V.
//
// 6. If Type(V) is Object and V has an [[ErrorData]] internal slot), then:
// 1. If types includes Error, then return the result of converting V to Error.
// 2. If types includes object, then return the IDL value that is a reference to the object V.
// 7. If Type(V) is Object and V has an [[ArrayBufferData]] internal slot, then:
// 1. If types includes ArrayBuffer, then return the result of converting V to ArrayBuffer.
// 2. If types includes object, then return the IDL value that is a reference to the object V.
constexpr bool hasArrayBufferType = brigand::any<TypeList, IsIDLArrayBuffer<brigand::_1>>::value;
if (hasArrayBufferType || hasObjectType) {
auto arrayBuffer = (brigand::any<TypeList, IsIDLArrayBufferAllowShared<brigand::_1>>::value) ? JSC::JSArrayBuffer::toWrappedAllowShared(vm, value) : JSC::JSArrayBuffer::toWrapped(vm, value);
if (arrayBuffer) {
if (hasArrayBufferType)
return ConditionalReturner<ReturnType, hasArrayBufferType>::get(WTFMove(arrayBuffer)).value();
RELEASE_AND_RETURN(scope, (ConditionalConverter<ReturnType, ObjectType, hasObjectType>::convert(lexicalGlobalObject, value).value()));
}
}
constexpr bool hasArrayBufferViewType = brigand::any<TypeList, IsIDLArrayBufferView<brigand::_1>>::value;
if (hasArrayBufferViewType || hasObjectType) {
auto arrayBufferView = (brigand::any<TypeList, IsIDLArrayBufferViewAllowShared<brigand::_1>>::value) ? JSC::JSArrayBufferView::toWrappedAllowShared(vm, value) : JSC::JSArrayBufferView::toWrapped(vm, value);
if (arrayBufferView) {
if (hasArrayBufferViewType)
return ConditionalReturner<ReturnType, hasArrayBufferViewType>::get(WTFMove(arrayBufferView)).value();
RELEASE_AND_RETURN(scope, (ConditionalConverter<ReturnType, ObjectType, hasObjectType>::convert(lexicalGlobalObject, value).value()));
}
}
// 8. If Type(V) is Object and V has a [[DataView]] internal slot, then:
// 1. If types includes DataView, then return the result of converting V to DataView.
// 2. If types includes object, then return the IDL value that is a reference to the object V.
constexpr bool hasDataViewType = brigand::any<TypeList, std::is_same<IDLDataView, brigand::_1>>::value;
if (hasDataViewType || hasObjectType) {
auto dataView = JSC::JSDataView::toWrapped(vm, value);
if (dataView) {
if (hasDataViewType)
return ConditionalReturner<ReturnType, hasDataViewType>::get(WTFMove(dataView)).value();
RELEASE_AND_RETURN(scope, (ConditionalConverter<ReturnType, ObjectType, hasObjectType>::convert(lexicalGlobalObject, value).value()));
}
}
// 9. If Type(V) is Object and V has a [[TypedArrayName]] internal slot, then:
// 1. If types includes a typed array type whose name is the value of Vs [[TypedArrayName]] internal slot, then return the result of converting V to that type.
// 2. If types includes object, then return the IDL value that is a reference to the object V.
// (FIXME: Add support for object and step 9.2)
constexpr bool hasTypedArrayType = brigand::any<TypeList, IsIDLTypedArray<brigand::_1>>::value;
if (hasTypedArrayType) {
std::optional<ReturnType> returnValue;
brigand::for_each<TypedArrayTypeList>([&](auto&& type) {
if (returnValue)
return;
using Type = typename WTF::RemoveCVAndReference<decltype(type)>::type::type;
using ImplementationType = typename Type::ImplementationType;
using WrapperType = typename Converter<Type>::WrapperType;
auto castedValue = (brigand::any<TypeList, IsIDLTypedArrayAllowShared<brigand::_1>>::value) ? WrapperType::toWrappedAllowShared(vm, value) : WrapperType::toWrapped(vm, value);
if (!castedValue)
return;
returnValue = ReturnType(ImplementationType(castedValue));
});
if (returnValue)
return WTFMove(returnValue.value());
}
// FIXME: Add support for step 10.
//
// 10. If IsCallable(V) is true, then:
// 1. If types includes a callback function type, then return the result of converting V to that callback function type.
// 2. If types includes object, then return the IDL value that is a reference to the object V.
// 11. If V is any kind of object, then:
if (hasAnyObjectType) {
if (value.isCell()) {
JSC::JSCell* cell = value.asCell();
if (cell->isObject()) {
auto object = asObject(value);
// 1. If types includes a sequence type, then:
// 1. Let method be the result of GetMethod(V, @@iterator).
// 2. ReturnIfAbrupt(method).
// 3. If method is not undefined, return the result of creating a
// sequence of that type from V and method.
constexpr bool hasSequenceType = numberOfSequenceTypes != 0;
if (hasSequenceType) {
auto method = JSC::iteratorMethod(&lexicalGlobalObject, object);
RETURN_IF_EXCEPTION(scope, ReturnType());
if (!method.isUndefined())
RELEASE_AND_RETURN(scope, (ConditionalSequenceConverter<ReturnType, SequenceType, hasSequenceType>::convert(lexicalGlobalObject, object, method).value()));
}
// 2. If types includes a frozen array type, then:
// 1. Let method be the result of GetMethod(V, @@iterator).
// 2. ReturnIfAbrupt(method).
// 3. If method is not undefined, return the result of creating a
// frozen array of that type from V and method.
constexpr bool hasFrozenArrayType = numberOfFrozenArrayTypes != 0;
if (hasFrozenArrayType) {
auto method = JSC::iteratorMethod(&lexicalGlobalObject, object);
RETURN_IF_EXCEPTION(scope, ReturnType());
if (!method.isUndefined())
RELEASE_AND_RETURN(scope, (ConditionalSequenceConverter<ReturnType, FrozenArrayType, hasFrozenArrayType>::convert(lexicalGlobalObject, object, method).value()));
}
// 3. If types includes a dictionary type, then return the result of
// converting V to that dictionary type.
if (hasDictionaryType)
RELEASE_AND_RETURN(scope, (ConditionalConverter<ReturnType, DictionaryType, hasDictionaryType>::convert(lexicalGlobalObject, value).value()));
// 4. If types includes a record type, then return the result of converting V to that record type.
if (hasRecordType)
RELEASE_AND_RETURN(scope, (ConditionalConverter<ReturnType, RecordType, hasRecordType>::convert(lexicalGlobalObject, value).value()));
// 5. If types includes a callback interface type, then return the result of converting V to that interface type.
// (FIXME: Add support for callback interface type and step 12.5)
// 6. If types includes object, then return the IDL value that is a reference to the object V.
if (hasObjectType)
RELEASE_AND_RETURN(scope, (ConditionalConverter<ReturnType, ObjectType, hasObjectType>::convert(lexicalGlobalObject, value).value()));
}
}
}
// 12. If V is a Boolean value, then:
// 1. If types includes a boolean, then return the result of converting V to boolean.
constexpr bool hasBooleanType = brigand::any<TypeList, std::is_same<IDLBoolean, brigand::_1>>::value;
if (hasBooleanType) {
if (value.isBoolean())
RELEASE_AND_RETURN(scope, (ConditionalConverter<ReturnType, IDLBoolean, hasBooleanType>::convert(lexicalGlobalObject, value).value()));
}
// 13. If V is a Number value, then:
// 1. If types includes a numeric type, then return the result of converting V to that numeric type.
constexpr bool hasNumericType = brigand::size<NumericTypeList>::value != 0;
if (hasNumericType) {
if (value.isNumber())
RELEASE_AND_RETURN(scope, (ConditionalConverter<ReturnType, NumericType, hasNumericType>::convert(lexicalGlobalObject, value).value()));
}
// 14. If types includes a string type, then return the result of converting V to that type.
constexpr bool hasStringType = brigand::size<StringTypeList>::value != 0;
if (hasStringType)
RELEASE_AND_RETURN(scope, (ConditionalConverter<ReturnType, StringType, hasStringType>::convert(lexicalGlobalObject, value).value()));
// 15. If types includes a numeric type, then return the result of converting V to that numeric type.
if (hasNumericType)
RELEASE_AND_RETURN(scope, (ConditionalConverter<ReturnType, NumericType, hasNumericType>::convert(lexicalGlobalObject, value).value()));
// 16. If types includes a boolean, then return the result of converting V to boolean.
if (hasBooleanType)
RELEASE_AND_RETURN(scope, (ConditionalConverter<ReturnType, IDLBoolean, hasBooleanType>::convert(lexicalGlobalObject, value).value()));
// 17. Throw a TypeError.
throwTypeError(&lexicalGlobalObject, scope);
return ReturnType();
}
};
template<typename... T> struct JSConverter<IDLUnion<T...>> {
using Type = IDLUnion<T...>;
using TypeList = typename Type::TypeList;
using ImplementationType = typename Type::ImplementationType;
static constexpr bool needsState = true;
static constexpr bool needsGlobalObject = true;
using Sequence = brigand::make_sequence<brigand::ptrdiff_t<0>, std::variant_size<ImplementationType>::value>;
static JSC::JSValue convert(JSC::JSGlobalObject& lexicalGlobalObject, JSDOMGlobalObject& globalObject, const ImplementationType& variant)
{
auto index = variant.index();
std::optional<JSC::JSValue> returnValue;
brigand::for_each<Sequence>([&](auto&& type) {
using I = typename WTF::RemoveCVAndReference<decltype(type)>::type::type;
if (I::value == index) {
ASSERT(!returnValue);
returnValue = toJS<brigand::at<TypeList, I>>(lexicalGlobalObject, globalObject, std::get<I::value>(variant));
}
});
ASSERT(returnValue);
return returnValue.value();
}
};
// BufferSource specialization. In WebKit, BufferSource is defined as IDLUnion<IDLArrayBufferView, IDLArrayBuffer> as a hack, and it is not compatible to
// annotation described in WebIDL.
template<> struct Converter<IDLAllowSharedAdaptor<IDLUnion<IDLArrayBufferView, IDLArrayBuffer>>> : DefaultConverter<IDLUnion<IDLArrayBufferView, IDLArrayBuffer>> {
static auto convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value) -> decltype(auto)
{
return Converter<IDLUnion<IDLAllowSharedAdaptor<IDLArrayBufferView>, IDLAllowSharedAdaptor<IDLArrayBuffer>>>::convert(lexicalGlobalObject, value);
}
};
} // namespace WebCore

View File

@@ -0,0 +1,74 @@
/*
* Copyright (C) 2016-2021 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. AND ITS CONTRIBUTORS ``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 ITS 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.
*/
#pragma once
#include "IDLTypes.h"
#include "JSDOMConvertBase.h"
#include "wtf/FixedVector.h"
namespace WebCore {
template<typename IDLType>
struct VariadicConverter {
using Item = typename IDLType::ImplementationType;
static std::optional<Item> convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value)
{
auto& vm = JSC::getVM(&lexicalGlobalObject);
auto scope = DECLARE_THROW_SCOPE(vm);
auto result = Converter<IDLType>::convert(lexicalGlobalObject, value);
RETURN_IF_EXCEPTION(scope, std::nullopt);
return result;
}
};
template<typename IDLType> FixedVector<typename VariadicConverter<IDLType>::Item> convertVariadicArguments(JSC::JSGlobalObject& lexicalGlobalObject, JSC::CallFrame& callFrame, size_t startIndex)
{
auto& vm = JSC::getVM(&lexicalGlobalObject);
auto scope = DECLARE_THROW_SCOPE(vm);
size_t length = callFrame.argumentCount();
if (startIndex >= length)
return {};
FixedVector<typename VariadicConverter<IDLType>::Item> result(length - startIndex);
size_t resultIndex = 0;
for (size_t i = startIndex; i < length; ++i) {
auto value = VariadicConverter<IDLType>::convert(lexicalGlobalObject, callFrame.uncheckedArgument(i));
EXCEPTION_ASSERT_UNUSED(scope, !!scope.exception() == !value);
if (!value)
return {};
result[resultIndex] = WTFMove(*value);
resultIndex++;
}
return result;
}
} // namespace WebCore

Some files were not shown because too many files have changed in this diff Show More