blob: fe5344aeb4ab226b23c186f67740789c464242a2 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
#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<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;
}
}
|