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