Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qv4proxy_p.h
Go to the documentation of this file.
1// Copyright (C) 2018 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant
4#ifndef QV4PROXY_P_H
5#define QV4PROXY_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include "qv4object_p.h"
20
22
23namespace QV4 {
24
25namespace Heap {
26
27#define ProxyObjectMembers(class, Member)
28 Member(class, Pointer, Object *, target)
29 Member(class, Pointer, Object *, handler)
30
32 DECLARE_MARKOBJECTS(ProxyObject)
33
34 void init(const QV4::Object *target, const QV4::Object *handler);
35};
36
38 void init(const QV4::FunctionObject *target, const QV4::Object *handler);
39};
40
42
43#define ProxyMembers(class, Member)
44 Member(class, Pointer, Symbol *, revokableProxySymbol)
45
46DECLARE_HEAP_OBJECT(Proxy, FunctionObject) {
47 DECLARE_MARKOBJECTS(Proxy)
48
49 void init(ExecutionEngine *engine);
50};
51
52}
53
54/*
55 * The inheritance from FunctionObject is a hack. Regular proxy objects are no function objects.
56 * But this helps implement the proxy for function objects, where we need this and thus gives us
57 * all the virtual methods from ProxyObject without having to duplicate them.
58 *
59 * But it does require a few hacks to make sure we don't recognize regular proxy objects as function
60 * objects in the runtime.
61 */
63 V4_OBJECT2(ProxyObject, Object)
65 V4_INTERNALCLASS(ProxyObject)
66
67 static ReturnedValue virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty);
68 static bool virtualPut(Managed *m, PropertyKey id, const Value &value, Value *receiver);
69 static bool virtualDeleteProperty(Managed *m, PropertyKey id);
70 static bool virtualHasProperty(const Managed *m, PropertyKey id);
71 static PropertyAttributes virtualGetOwnProperty(const Managed *m, PropertyKey id, Property *p);
72 static bool virtualDefineOwnProperty(Managed *m, PropertyKey id, const Property *p, PropertyAttributes attrs);
73 static bool virtualIsExtensible(const Managed *m);
74 static bool virtualPreventExtensions(Managed *);
75 static Heap::Object *virtualGetPrototypeOf(const Managed *);
76 static bool virtualSetPrototypeOf(Managed *, const Object *);
77 static OwnPropertyKeyIterator *virtualOwnPropertyKeys(const Object *m, Value *iteratorTarget);
78};
79
81 V4_OBJECT2(ProxyFunctionObject, FunctionObject)
83 V4_INTERNALCLASS(ProxyFunctionObject)
84
85 static ReturnedValue virtualCall(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc);
86};
87
93
95{
96 V4_OBJECT2(Proxy, FunctionObject)
97
98 static ReturnedValue virtualCallAsConstructor(const FunctionObject *f, const Value *argv, int argc, const Value *);
99 static ReturnedValue virtualCall(const FunctionObject *, const Value *thisObject, const Value *argv, int argc);
100
101 static ReturnedValue method_revocable(const FunctionObject *, const Value *thisObject, const Value *argv, int argc);
102
103 static ReturnedValue method_revoke(const FunctionObject *, const Value *thisObject, const Value *argv, int argc);
104};
105
106}
107
108QT_END_NAMESPACE
109
110#endif // QV4ECMAOBJECTS_P_H
DECLARE_HEAP_OBJECT(DynamicFunctionObject, FunctionObject)
Definition qjsvalue.h:23
#define Q_MANAGED_TYPE(type)
#define V4_INTERNALCLASS(c)
DEFINE_OBJECT_VTABLE(Proxy)
DEFINE_OBJECT_VTABLE(ProxyObject)
DEFINE_OBJECT_VTABLE(ProxyConstructorObject)
DEFINE_OBJECT_VTABLE(ProxyFunctionObject)
void init(const QV4::FunctionObject *target, const QV4::Object *handler)
Definition qv4proxy.cpp:27
static ReturnedValue virtualCall(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc)
Definition qv4proxy.cpp:682
static bool virtualPut(Managed *m, PropertyKey id, const Value &value, Value *receiver)
Definition qv4proxy.cpp:80
static bool virtualIsExtensible(const Managed *m)
Definition qv4proxy.cpp:330
static bool virtualHasProperty(const Managed *m, PropertyKey id)
Definition qv4proxy.cpp:158
static bool virtualPreventExtensions(Managed *)
Definition qv4proxy.cpp:364
static Heap::Object * virtualGetPrototypeOf(const Managed *)
Definition qv4proxy.cpp:398
static bool virtualDefineOwnProperty(Managed *m, PropertyKey id, const Property *p, PropertyAttributes attrs)
Definition qv4proxy.cpp:273
static ReturnedValue virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty)
Definition qv4proxy.cpp:36
static bool virtualSetPrototypeOf(Managed *, const Object *)
Definition qv4proxy.cpp:443
static OwnPropertyKeyIterator * virtualOwnPropertyKeys(const Object *m, Value *iteratorTarget)
Definition qv4proxy.cpp:540
static bool virtualDeleteProperty(Managed *m, PropertyKey id)
Definition qv4proxy.cpp:121
static PropertyAttributes virtualGetOwnProperty(const Managed *m, PropertyKey id, Property *p)
Definition qv4proxy.cpp:197
static ReturnedValue virtualCall(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
Definition qv4proxy.cpp:753
static ReturnedValue method_revocable(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
Definition qv4proxy.cpp:758
static ReturnedValue method_revoke(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
Definition qv4proxy.cpp:781