Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/jsruntime/qv4proxy.cpp |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||||||||
2 | using namespace QV4; | - | ||||||||||||||||||
3 | - | |||||||||||||||||||
4 | const QV4::VTable ProxyObject::static_vtbl = { (std::is_same<ProxyObject::SuperClass, Object>::value) ? nullptr : &ProxyObject::SuperClass::static_vtbl, (sizeof(ProxyObject::Data) + sizeof(QV4::Value) - 1)/sizeof(QV4::Value), (sizeof(ProxyObject::Data) + (ProxyObject::NInlineProperties*sizeof(QV4::Value)) + QV4::Chunk::SlotSize - 1)/QV4::Chunk::SlotSize*QV4::Chunk::SlotSize/sizeof(QV4::Value) - (sizeof(ProxyObject::Data) + sizeof(QV4::Value) - 1)/sizeof(QV4::Value), ProxyObject::IsExecutionContext, ProxyObject::IsString, ProxyObject::IsObject, ProxyObject::IsFunctionObject, ProxyObject::IsErrorObject, ProxyObject::IsArrayData, ProxyObject::IsStringOrSymbol, ProxyObject::MyType, { 0, 0, 0, 0 }, "ProxyObject", ProxyObject::virtualDestroy, ProxyObject::Data::markObjects, ProxyObject::virtualIsEqualTo, ProxyObject::virtualGet, ProxyObject::virtualPut, ProxyObject::virtualDeleteProperty, ProxyObject::virtualHasProperty, ProxyObject::virtualGetOwnProperty, ProxyObject::virtualDefineOwnProperty, ProxyObject::virtualIsExtensible, ProxyObject::virtualPreventExtensions, ProxyObject::virtualGetPrototypeOf, ProxyObject::virtualSetPrototypeOf, ProxyObject::virtualGetLength, ProxyObject::virtualAdvanceIterator, ProxyObject::virtualInstanceOf, ProxyObject::virtualCall, ProxyObject::virtualCallAsConstructor, }; | - | ||||||||||||||||||
5 | - | |||||||||||||||||||
6 | void Heap::ProxyObject::init(const QV4::Object *target, const QV4::Object *handler) | - | ||||||||||||||||||
7 | { | - | ||||||||||||||||||
8 | Object::init(); | - | ||||||||||||||||||
9 | ExecutionEngine *e = internalClass->engine; | - | ||||||||||||||||||
10 | this->target.set(e, target->d()); | - | ||||||||||||||||||
11 | this->handler.set(e, handler->d()); | - | ||||||||||||||||||
12 | } executed 1148 times by 1 test: end of block Executed by:
| 1148 | ||||||||||||||||||
13 | - | |||||||||||||||||||
14 | ReturnedValue ProxyObject::virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty) | - | ||||||||||||||||||
15 | { | - | ||||||||||||||||||
16 | Scope scope(m); | - | ||||||||||||||||||
17 | const ProxyObject *o = static_cast<const ProxyObject *>(m); | - | ||||||||||||||||||
18 | if (!o->d()->handler
| 38-365 | ||||||||||||||||||
19 | return executed 38 times by 1 test: scope.engine->throwTypeError();return scope.engine->throwTypeError(); Executed by:
executed 38 times by 1 test: return scope.engine->throwTypeError(); Executed by:
| 38 | ||||||||||||||||||
20 | - | |||||||||||||||||||
21 | ScopedObject target(scope, o->d()->target); | - | ||||||||||||||||||
22 | ((target) ? static_cast<void>(0) : qt_assert("target", __FILE__, 66)); | - | ||||||||||||||||||
23 | ScopedObject handler(scope, o->d()->handler); | - | ||||||||||||||||||
24 | ScopedValue trap(scope, handler->get(scope.engine->id_get())); | - | ||||||||||||||||||
25 | if (scope.hasException()
| 0-366 | ||||||||||||||||||
26 | return never executed: Encode::undefined();return Encode::undefined(); never executed: return Encode::undefined(); | 0 | ||||||||||||||||||
27 | if (trap->isNullOrUndefined()
| 176-190 | ||||||||||||||||||
28 | return executed 190 times by 1 test: target->get(id, receiver, hasProperty);return target->get(id, receiver, hasProperty); Executed by:
executed 190 times by 1 test: return target->get(id, receiver, hasProperty); Executed by:
| 190 | ||||||||||||||||||
29 | if (!trap->isFunctionObject()
| 8-168 | ||||||||||||||||||
30 | return executed 8 times by 1 test: scope.engine->throwTypeError();return scope.engine->throwTypeError(); Executed by:
executed 8 times by 1 test: return scope.engine->throwTypeError(); Executed by:
| 8 | ||||||||||||||||||
31 | if (hasProperty
| 0-168 | ||||||||||||||||||
32 | * never executed: hasProperty = true;*hasProperty = true; never executed: *hasProperty = true; | 0 | ||||||||||||||||||
33 | - | |||||||||||||||||||
34 | JSCallData cdata(scope, 3, nullptr, handler); | - | ||||||||||||||||||
35 | cdata.args[0] = target; | - | ||||||||||||||||||
36 | cdata.args[1] = id.toStringOrSymbol(scope.engine); | - | ||||||||||||||||||
37 | cdata.args[2] = *receiver; | - | ||||||||||||||||||
38 | - | |||||||||||||||||||
39 | ScopedValue trapResult(scope, static_cast<const FunctionObject *>(trap.ptr)->call(cdata)); | - | ||||||||||||||||||
40 | ScopedProperty targetDesc(scope); | - | ||||||||||||||||||
41 | PropertyAttributes attributes = target->getOwnProperty(id, targetDesc); | - | ||||||||||||||||||
42 | if (attributes != Attr_Invalid
| 48-108 | ||||||||||||||||||
43 | if (attributes.isData()
| 16-44 | ||||||||||||||||||
44 | if (!trapResult->sameValue(targetDesc->value)
| 8 | ||||||||||||||||||
45 | return executed 8 times by 1 test: scope.engine->throwTypeError();return scope.engine->throwTypeError(); Executed by:
executed 8 times by 1 test: return scope.engine->throwTypeError(); Executed by:
| 8 | ||||||||||||||||||
46 | } executed 8 times by 1 test: end of block Executed by:
| 8 | ||||||||||||||||||
47 | if (attributes.isAccessor()
| 8-36 | ||||||||||||||||||
48 | if (!trapResult->isUndefined()
| 0-8 | ||||||||||||||||||
49 | return executed 8 times by 1 test: scope.engine->throwTypeError();return scope.engine->throwTypeError(); Executed by:
executed 8 times by 1 test: return scope.engine->throwTypeError(); Executed by:
| 8 | ||||||||||||||||||
50 | } never executed: end of block | 0 | ||||||||||||||||||
51 | } executed 44 times by 1 test: end of block Executed by:
| 44 | ||||||||||||||||||
52 | return executed 152 times by 1 test: trapResult->asReturnedValue();return trapResult->asReturnedValue(); Executed by:
executed 152 times by 1 test: return trapResult->asReturnedValue(); Executed by:
| 152 | ||||||||||||||||||
53 | } | - | ||||||||||||||||||
54 | - | |||||||||||||||||||
55 | bool ProxyObject::virtualPut(Managed *m, PropertyKey id, const Value &value, Value *receiver) | - | ||||||||||||||||||
56 | { | - | ||||||||||||||||||
57 | Scope scope(m); | - | ||||||||||||||||||
58 | const ProxyObject *o = static_cast<const ProxyObject *>(m); | - | ||||||||||||||||||
59 | if (!o->d()->handler
| 12-111 | ||||||||||||||||||
60 | return executed 12 times by 1 test: scope.engine->throwTypeError();return scope.engine->throwTypeError(); Executed by:
executed 12 times by 1 test: return scope.engine->throwTypeError(); Executed by:
| 12 | ||||||||||||||||||
61 | - | |||||||||||||||||||
62 | ScopedObject target(scope, o->d()->target); | - | ||||||||||||||||||
63 | ((target) ? static_cast<void>(0) : qt_assert("target", __FILE__, 107)); | - | ||||||||||||||||||
64 | ScopedObject handler(scope, o->d()->handler); | - | ||||||||||||||||||
65 | ScopedValue trap(scope, handler->get(scope.engine->id_set())); | - | ||||||||||||||||||
66 | if (scope.hasException()
| 0-112 | ||||||||||||||||||
67 | return never executed: Encode::undefined();return Encode::undefined(); never executed: return Encode::undefined(); | 0 | ||||||||||||||||||
68 | if (trap->isNullOrUndefined()
| 40-72 | ||||||||||||||||||
69 | return executed 40 times by 1 test: target->put(id, value, receiver);return target->put(id, value, receiver); Executed by:
executed 40 times by 1 test: return target->put(id, value, receiver); Executed by:
| 40 | ||||||||||||||||||
70 | if (!trap->isFunctionObject()
| 8-63 | ||||||||||||||||||
71 | return executed 8 times by 1 test: scope.engine->throwTypeError();return scope.engine->throwTypeError(); Executed by:
executed 8 times by 1 test: return scope.engine->throwTypeError(); Executed by:
| 8 | ||||||||||||||||||
72 | - | |||||||||||||||||||
73 | JSCallData cdata(scope, 4, nullptr, handler); | - | ||||||||||||||||||
74 | cdata.args[0] = target; | - | ||||||||||||||||||
75 | cdata.args[1] = id.toStringOrSymbol(scope.engine); | - | ||||||||||||||||||
76 | cdata.args[2] = value; | - | ||||||||||||||||||
77 | cdata.args[3] = *receiver; | - | ||||||||||||||||||
78 | - | |||||||||||||||||||
79 | ScopedValue trapResult(scope, static_cast<const FunctionObject *>(trap.ptr)->call(cdata)); | - | ||||||||||||||||||
80 | if (!trapResult->toBoolean()
| 28-35 | ||||||||||||||||||
81 | return executed 28 times by 1 test: false;return false; Executed by:
executed 28 times by 1 test: return false; Executed by:
| 28 | ||||||||||||||||||
82 | ScopedProperty targetDesc(scope); | - | ||||||||||||||||||
83 | PropertyAttributes attributes = target->getOwnProperty(id, targetDesc); | - | ||||||||||||||||||
84 | if (attributes != Attr_Invalid
| 0-36 | ||||||||||||||||||
85 | if (attributes.isData()
| 4-12 | ||||||||||||||||||
86 | if (!value.sameValue(targetDesc->value)
| 0-8 | ||||||||||||||||||
87 | return executed 8 times by 1 test: scope.engine->throwTypeError();return scope.engine->throwTypeError(); Executed by:
executed 8 times by 1 test: return scope.engine->throwTypeError(); Executed by:
| 8 | ||||||||||||||||||
88 | } never executed: end of block | 0 | ||||||||||||||||||
89 | if (attributes.isAccessor()
| 4-12 | ||||||||||||||||||
90 | return executed 8 times by 1 test: scope.engine->throwTypeError();return scope.engine->throwTypeError(); Executed by:
executed 8 times by 1 test: return scope.engine->throwTypeError(); Executed by:
| 8 | ||||||||||||||||||
91 | } executed 8 times by 1 test: end of block Executed by:
| 8 | ||||||||||||||||||
92 | return executed 20 times by 1 test: true;return true; Executed by:
executed 20 times by 1 test: return true; Executed by:
| 20 | ||||||||||||||||||
93 | } | - | ||||||||||||||||||
94 | - | |||||||||||||||||||
95 | bool ProxyObject::virtualDeleteProperty(Managed *m, PropertyKey id) | - | ||||||||||||||||||
96 | { | - | ||||||||||||||||||
97 | Scope scope(m); | - | ||||||||||||||||||
98 | const ProxyObject *o = static_cast<const ProxyObject *>(m); | - | ||||||||||||||||||
99 | if (!o->d()->handler
| 4-60 | ||||||||||||||||||
100 | return executed 4 times by 1 test: scope.engine->throwTypeError();return scope.engine->throwTypeError(); Executed by:
executed 4 times by 1 test: return scope.engine->throwTypeError(); Executed by:
| 4 | ||||||||||||||||||
101 | - | |||||||||||||||||||
102 | ScopedObject target(scope, o->d()->target); | - | ||||||||||||||||||
103 | ((target) ? static_cast<void>(0) : qt_assert("target", __FILE__, 147)); | - | ||||||||||||||||||
104 | ScopedObject handler(scope, o->d()->handler); | - | ||||||||||||||||||
105 | ScopedString deleteProp(scope, scope.engine->newString(([]() noexcept -> QString { enum { Size = sizeof(u"" "deleteProperty")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "deleteProperty" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 60 times by 1 test: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 60 times by 1 test: }())));return qstring_literal_temp; Executed by:
| 60 | ||||||||||||||||||
106 | ScopedValue trap(scope, handler->get(deleteProp)); | - | ||||||||||||||||||
107 | if (scope.hasException()
| 0-60 | ||||||||||||||||||
108 | return never executed: Encode::undefined();return Encode::undefined(); never executed: return Encode::undefined(); | 0 | ||||||||||||||||||
109 | if (trap->isNullOrUndefined()
| 12-48 | ||||||||||||||||||
110 | return executed 12 times by 1 test: target->deleteProperty(id);return target->deleteProperty(id); Executed by:
executed 12 times by 1 test: return target->deleteProperty(id); Executed by:
| 12 | ||||||||||||||||||
111 | if (!trap->isFunctionObject()
| 4-44 | ||||||||||||||||||
112 | return executed 4 times by 1 test: scope.engine->throwTypeError();return scope.engine->throwTypeError(); Executed by:
executed 4 times by 1 test: return scope.engine->throwTypeError(); Executed by:
| 4 | ||||||||||||||||||
113 | - | |||||||||||||||||||
114 | JSCallData cdata(scope, 3, nullptr, handler); | - | ||||||||||||||||||
115 | cdata.args[0] = target; | - | ||||||||||||||||||
116 | cdata.args[1] = id.toStringOrSymbol(scope.engine); | - | ||||||||||||||||||
117 | cdata.args[2] = o->d(); | - | ||||||||||||||||||
118 | - | |||||||||||||||||||
119 | ScopedValue trapResult(scope, static_cast<const FunctionObject *>(trap.ptr)->call(cdata)); | - | ||||||||||||||||||
120 | if (!trapResult->toBoolean()
| 16-28 | ||||||||||||||||||
121 | return executed 28 times by 1 test: false;return false; Executed by:
executed 28 times by 1 test: return false; Executed by:
| 28 | ||||||||||||||||||
122 | ScopedProperty targetDesc(scope); | - | ||||||||||||||||||
123 | PropertyAttributes attributes = target->getOwnProperty(id, targetDesc); | - | ||||||||||||||||||
124 | if (attributes == Attr_Invalid
| 4-12 | ||||||||||||||||||
125 | return executed 12 times by 1 test: true;return true; Executed by:
executed 12 times by 1 test: return true; Executed by:
| 12 | ||||||||||||||||||
126 | if (!attributes.isConfigurable()
| 0-4 | ||||||||||||||||||
127 | return executed 4 times by 1 test: scope.engine->throwTypeError();return scope.engine->throwTypeError(); Executed by:
executed 4 times by 1 test: return scope.engine->throwTypeError(); Executed by:
| 4 | ||||||||||||||||||
128 | return never executed: true;return true; never executed: return true; | 0 | ||||||||||||||||||
129 | } | - | ||||||||||||||||||
130 | - | |||||||||||||||||||
131 | bool ProxyObject::virtualHasProperty(const Managed *m, PropertyKey id) | - | ||||||||||||||||||
132 | { | - | ||||||||||||||||||
133 | Scope scope(m); | - | ||||||||||||||||||
134 | const ProxyObject *o = static_cast<const ProxyObject *>(m); | - | ||||||||||||||||||
135 | if (!o->d()->handler
| 4-40 | ||||||||||||||||||
136 | return executed 4 times by 1 test: scope.engine->throwTypeError();return scope.engine->throwTypeError(); Executed by:
executed 4 times by 1 test: return scope.engine->throwTypeError(); Executed by:
| 4 | ||||||||||||||||||
137 | - | |||||||||||||||||||
138 | ScopedObject target(scope, o->d()->target); | - | ||||||||||||||||||
139 | ((target) ? static_cast<void>(0) : qt_assert("target", __FILE__, 183)); | - | ||||||||||||||||||
140 | ScopedObject handler(scope, o->d()->handler); | - | ||||||||||||||||||
141 | ScopedString hasProp(scope, scope.engine->newString(([]() noexcept -> QString { enum { Size = sizeof(u"" "has")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "has" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 40 times by 1 test: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 40 times by 1 test: }())));return qstring_literal_temp; Executed by:
| 40 | ||||||||||||||||||
142 | ScopedValue trap(scope, handler->get(hasProp)); | - | ||||||||||||||||||
143 | if (scope.hasException()
| 0-40 | ||||||||||||||||||
144 | return never executed: Encode::undefined();return Encode::undefined(); never executed: return Encode::undefined(); | 0 | ||||||||||||||||||
145 | if (trap->isNullOrUndefined()
| 8-32 | ||||||||||||||||||
146 | return executed 8 times by 1 test: target->hasProperty(id);return target->hasProperty(id); Executed by:
executed 8 times by 1 test: return target->hasProperty(id); Executed by:
| 8 | ||||||||||||||||||
147 | if (!trap->isFunctionObject()
| 4-28 | ||||||||||||||||||
148 | return executed 4 times by 1 test: scope.engine->throwTypeError();return scope.engine->throwTypeError(); Executed by:
executed 4 times by 1 test: return scope.engine->throwTypeError(); Executed by:
| 4 | ||||||||||||||||||
149 | - | |||||||||||||||||||
150 | JSCallData cdata(scope, 2, nullptr, handler); | - | ||||||||||||||||||
151 | cdata.args[0] = target; | - | ||||||||||||||||||
152 | cdata.args[1] = id.isArrayIndex()
| 0-28 | ||||||||||||||||||
153 | - | |||||||||||||||||||
154 | ScopedValue trapResult(scope, static_cast<const FunctionObject *>(trap.ptr)->call(cdata)); | - | ||||||||||||||||||
155 | bool result = trapResult->toBoolean(); | - | ||||||||||||||||||
156 | if (!result
| 8-20 | ||||||||||||||||||
157 | ScopedProperty targetDesc(scope); | - | ||||||||||||||||||
158 | PropertyAttributes attributes = target->getOwnProperty(id, targetDesc); | - | ||||||||||||||||||
159 | if (attributes != Attr_Invalid
| 8-12 | ||||||||||||||||||
160 | if (!attributes.isConfigurable()
| 4-8 | ||||||||||||||||||
161 | return executed 8 times by 1 test: scope.engine->throwTypeError();return scope.engine->throwTypeError(); Executed by:
executed 8 times by 1 test: return scope.engine->throwTypeError(); Executed by:
| 8 | ||||||||||||||||||
162 | } executed 4 times by 1 test: end of block Executed by:
| 4 | ||||||||||||||||||
163 | } executed 12 times by 1 test: end of block Executed by:
| 12 | ||||||||||||||||||
164 | return executed 20 times by 1 test: result;return result; Executed by:
executed 20 times by 1 test: return result; Executed by:
| 20 | ||||||||||||||||||
165 | } | - | ||||||||||||||||||
166 | - | |||||||||||||||||||
167 | PropertyAttributes ProxyObject::virtualGetOwnProperty(Managed *m, PropertyKey id, Property *p) | - | ||||||||||||||||||
168 | { | - | ||||||||||||||||||
169 | Scope scope(m); | - | ||||||||||||||||||
170 | const ProxyObject *o = static_cast<const ProxyObject *>(m); | - | ||||||||||||||||||
171 | if (!o->d()->handler
| 4-96 | ||||||||||||||||||
172 | scope.engine->throwTypeError(); | - | ||||||||||||||||||
173 | return executed 4 times by 1 test: Attr_Invalid;return Attr_Invalid; Executed by:
executed 4 times by 1 test: return Attr_Invalid; Executed by:
| 4 | ||||||||||||||||||
174 | } | - | ||||||||||||||||||
175 | - | |||||||||||||||||||
176 | ScopedObject target(scope, o->d()->target); | - | ||||||||||||||||||
177 | ((target) ? static_cast<void>(0) : qt_assert("target", __FILE__, 221)); | - | ||||||||||||||||||
178 | ScopedObject handler(scope, o->d()->handler); | - | ||||||||||||||||||
179 | ScopedString deleteProp(scope, scope.engine->newString(([]() noexcept -> QString { enum { Size = sizeof(u"" "getOwnPropertyDescriptor")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "getOwnPropertyDescriptor" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 96 times by 1 test: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 96 times by 1 test: }())));return qstring_literal_temp; Executed by:
| 96 | ||||||||||||||||||
180 | ScopedValue trap(scope, handler->get(deleteProp)); | - | ||||||||||||||||||
181 | if (scope.hasException()
| 0-96 | ||||||||||||||||||
182 | return never executed: Attr_Invalid;return Attr_Invalid; never executed: return Attr_Invalid; | 0 | ||||||||||||||||||
183 | if (trap->isNullOrUndefined()
| 24-72 | ||||||||||||||||||
184 | return executed 24 times by 1 test: target->getOwnProperty(id, p);return target->getOwnProperty(id, p); Executed by:
executed 24 times by 1 test: return target->getOwnProperty(id, p); Executed by:
| 24 | ||||||||||||||||||
185 | if (!trap->isFunctionObject()
| 4-68 | ||||||||||||||||||
186 | scope.engine->throwTypeError(); | - | ||||||||||||||||||
187 | return executed 4 times by 1 test: Attr_Invalid;return Attr_Invalid; Executed by:
executed 4 times by 1 test: return Attr_Invalid; Executed by:
| 4 | ||||||||||||||||||
188 | } | - | ||||||||||||||||||
189 | - | |||||||||||||||||||
190 | JSCallData cdata(scope, 2, nullptr, handler); | - | ||||||||||||||||||
191 | cdata.args[0] = target; | - | ||||||||||||||||||
192 | cdata.args[1] = id.isArrayIndex()
| 0-68 | ||||||||||||||||||
193 | - | |||||||||||||||||||
194 | ScopedValue trapResult(scope, static_cast<const FunctionObject *>(trap.ptr)->call(cdata)); | - | ||||||||||||||||||
195 | if (!trapResult->isObject()
| 16-44 | ||||||||||||||||||
196 | scope.engine->throwTypeError(); | - | ||||||||||||||||||
197 | return executed 16 times by 1 test: Attr_Invalid;return Attr_Invalid; Executed by:
executed 16 times by 1 test: return Attr_Invalid; Executed by:
| 16 | ||||||||||||||||||
198 | } | - | ||||||||||||||||||
199 | - | |||||||||||||||||||
200 | ScopedProperty targetDesc(scope); | - | ||||||||||||||||||
201 | PropertyAttributes targetAttributes = target->getOwnProperty(id, targetDesc); | - | ||||||||||||||||||
202 | if (trapResult->isUndefined()
| 24-28 | ||||||||||||||||||
203 | p->value = Encode::undefined(); | - | ||||||||||||||||||
204 | if (targetAttributes == Attr_Invalid
| 12-16 | ||||||||||||||||||
205 | p->value = Encode::undefined(); | - | ||||||||||||||||||
206 | return executed 12 times by 1 test: Attr_Invalid;return Attr_Invalid; Executed by:
executed 12 times by 1 test: return Attr_Invalid; Executed by:
| 12 | ||||||||||||||||||
207 | } | - | ||||||||||||||||||
208 | if (!targetAttributes.isConfigurable()
| 4-12 | ||||||||||||||||||
209 | scope.engine->throwTypeError(); | - | ||||||||||||||||||
210 | return executed 8 times by 1 test: Attr_Invalid;return Attr_Invalid; Executed by:
executed 8 times by 1 test: return Attr_Invalid; Executed by:
| 8 | ||||||||||||||||||
211 | } | - | ||||||||||||||||||
212 | return executed 8 times by 1 test: Attr_Invalid;return Attr_Invalid; Executed by:
executed 8 times by 1 test: return Attr_Invalid; Executed by:
| 8 | ||||||||||||||||||
213 | } | - | ||||||||||||||||||
214 | - | |||||||||||||||||||
215 | - | |||||||||||||||||||
216 | ScopedProperty resultDesc(scope); | - | ||||||||||||||||||
217 | PropertyAttributes resultAttributes; | - | ||||||||||||||||||
218 | ObjectPrototype::toPropertyDescriptor(scope.engine, trapResult, resultDesc, &resultAttributes); | - | ||||||||||||||||||
219 | resultDesc->fullyPopulated(&resultAttributes); | - | ||||||||||||||||||
220 | - | |||||||||||||||||||
221 | - | |||||||||||||||||||
222 | - | |||||||||||||||||||
223 | - | |||||||||||||||||||
224 | - | |||||||||||||||||||
225 | if (!resultAttributes.isConfigurable()
| 8-16 | ||||||||||||||||||
226 | if (targetAttributes == Attr_Invalid
| 4-12 | ||||||||||||||||||
227 | scope.engine->throwTypeError(); | - | ||||||||||||||||||
228 | return executed 8 times by 1 test: Attr_Invalid;return Attr_Invalid; Executed by:
executed 8 times by 1 test: return Attr_Invalid; Executed by:
| 8 | ||||||||||||||||||
229 | } | - | ||||||||||||||||||
230 | } executed 8 times by 1 test: end of block Executed by:
| 8 | ||||||||||||||||||
231 | - | |||||||||||||||||||
232 | p->value = resultDesc->value; | - | ||||||||||||||||||
233 | p->set = resultDesc->set; | - | ||||||||||||||||||
234 | return executed 16 times by 1 test: resultAttributes;return resultAttributes; Executed by:
executed 16 times by 1 test: return resultAttributes; Executed by:
| 16 | ||||||||||||||||||
235 | } | - | ||||||||||||||||||
236 | - | |||||||||||||||||||
237 | bool ProxyObject::virtualDefineOwnProperty(Managed *m, PropertyKey id, const Property *p, PropertyAttributes attrs) | - | ||||||||||||||||||
238 | { | - | ||||||||||||||||||
239 | Scope scope(m); | - | ||||||||||||||||||
240 | const ProxyObject *o = static_cast<const ProxyObject *>(m); | - | ||||||||||||||||||
241 | if (!o->d()->handler
| 4-76 | ||||||||||||||||||
242 | scope.engine->throwTypeError(); | - | ||||||||||||||||||
243 | return executed 4 times by 1 test: false;return false; Executed by:
executed 4 times by 1 test: return false; Executed by:
| 4 | ||||||||||||||||||
244 | } | - | ||||||||||||||||||
245 | - | |||||||||||||||||||
246 | ScopedObject target(scope, o->d()->target); | - | ||||||||||||||||||
247 | ((target) ? static_cast<void>(0) : qt_assert("target", __FILE__, 291)); | - | ||||||||||||||||||
248 | ScopedObject handler(scope, o->d()->handler); | - | ||||||||||||||||||
249 | ScopedString prop(scope, scope.engine->newString(([]() noexcept -> QString { enum { Size = sizeof(u"" "defineProperty")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "defineProperty" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 76 times by 1 test: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 76 times by 1 test: }())));return qstring_literal_temp; Executed by:
| 76 | ||||||||||||||||||
250 | ScopedValue trap(scope, handler->get(prop)); | - | ||||||||||||||||||
251 | if (scope.hasException()
| 0-76 | ||||||||||||||||||
252 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||
253 | if (trap->isNullOrUndefined()
| 28-48 | ||||||||||||||||||
254 | return executed 28 times by 1 test: target->defineOwnProperty(id, p, attrs);return target->defineOwnProperty(id, p, attrs); Executed by:
executed 28 times by 1 test: return target->defineOwnProperty(id, p, attrs); Executed by:
| 28 | ||||||||||||||||||
255 | if (!trap->isFunctionObject()
| 4-44 | ||||||||||||||||||
256 | scope.engine->throwTypeError(); | - | ||||||||||||||||||
257 | return executed 4 times by 1 test: false;return false; Executed by:
executed 4 times by 1 test: return false; Executed by:
| 4 | ||||||||||||||||||
258 | } | - | ||||||||||||||||||
259 | - | |||||||||||||||||||
260 | JSCallData cdata(scope, 3, nullptr, handler); | - | ||||||||||||||||||
261 | cdata.args[0] = target; | - | ||||||||||||||||||
262 | cdata.args[1] = id.isArrayIndex()
| 0-44 | ||||||||||||||||||
263 | cdata.args[2] = ObjectPrototype::fromPropertyDescriptor(scope.engine, p, attrs); | - | ||||||||||||||||||
264 | - | |||||||||||||||||||
265 | ScopedValue trapResult(scope, static_cast<const FunctionObject *>(trap.ptr)->call(cdata)); | - | ||||||||||||||||||
266 | bool result = trapResult->toBoolean(); | - | ||||||||||||||||||
267 | if (!result
| 12-32 | ||||||||||||||||||
268 | return executed 12 times by 1 test: false;return false; Executed by:
executed 12 times by 1 test: return false; Executed by:
| 12 | ||||||||||||||||||
269 | - | |||||||||||||||||||
270 | ScopedProperty targetDesc(scope); | - | ||||||||||||||||||
271 | PropertyAttributes targetAttributes = target->getOwnProperty(id, targetDesc); | - | ||||||||||||||||||
272 | bool extensibleTarget = target->isExtensible(); | - | ||||||||||||||||||
273 | bool settingConfigFalse = attrs.hasConfigurable()
| 8-24 | ||||||||||||||||||
274 | if (targetAttributes == Attr_Invalid
| 12-20 | ||||||||||||||||||
275 | if (!extensibleTarget
| 4-8 | ||||||||||||||||||
276 | scope.engine->throwTypeError(); | - | ||||||||||||||||||
277 | return executed 8 times by 1 test: false;return false; Executed by:
executed 8 times by 1 test: return false; Executed by:
| 8 | ||||||||||||||||||
278 | } | - | ||||||||||||||||||
279 | } executed 4 times by 1 test: else {end of block Executed by:
| 4 | ||||||||||||||||||
280 | - | |||||||||||||||||||
281 | - | |||||||||||||||||||
282 | if (settingConfigFalse
| 4-12 | ||||||||||||||||||
283 | scope.engine->throwTypeError(); | - | ||||||||||||||||||
284 | return executed 4 times by 1 test: false;return false; Executed by:
executed 4 times by 1 test: return false; Executed by:
| 4 | ||||||||||||||||||
285 | } | - | ||||||||||||||||||
286 | } executed 16 times by 1 test: end of block Executed by:
| 16 | ||||||||||||||||||
287 | - | |||||||||||||||||||
288 | return executed 20 times by 1 test: true;return true; Executed by:
executed 20 times by 1 test: return true; Executed by:
| 20 | ||||||||||||||||||
289 | } | - | ||||||||||||||||||
290 | - | |||||||||||||||||||
291 | bool ProxyObject::virtualIsExtensible(const Managed *m) | - | ||||||||||||||||||
292 | { | - | ||||||||||||||||||
293 | Scope scope(m); | - | ||||||||||||||||||
294 | const ProxyObject *o = static_cast<const ProxyObject *>(m); | - | ||||||||||||||||||
295 | if (!o->d()->handler
| 4-80 | ||||||||||||||||||
296 | return executed 4 times by 1 test: scope.engine->throwTypeError();return scope.engine->throwTypeError(); Executed by:
executed 4 times by 1 test: return scope.engine->throwTypeError(); Executed by:
| 4 | ||||||||||||||||||
297 | - | |||||||||||||||||||
298 | ScopedObject target(scope, o->d()->target); | - | ||||||||||||||||||
299 | ((target) ? static_cast<void>(0) : qt_assert("target", __FILE__, 343)); | - | ||||||||||||||||||
300 | ScopedObject handler(scope, o->d()->handler); | - | ||||||||||||||||||
301 | ScopedString hasProp(scope, scope.engine->newString(([]() noexcept -> QString { enum { Size = sizeof(u"" "isExtensible")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "isExtensible" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 80 times by 1 test: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 80 times by 1 test: }())));return qstring_literal_temp; Executed by:
| 80 | ||||||||||||||||||
302 | ScopedValue trap(scope, handler->get(hasProp)); | - | ||||||||||||||||||
303 | if (scope.hasException()
| 0-80 | ||||||||||||||||||
304 | return never executed: Encode::undefined();return Encode::undefined(); never executed: return Encode::undefined(); | 0 | ||||||||||||||||||
305 | if (trap->isNullOrUndefined()
| 12-68 | ||||||||||||||||||
306 | return executed 12 times by 1 test: target->isExtensible();return target->isExtensible(); Executed by:
executed 12 times by 1 test: return target->isExtensible(); Executed by:
| 12 | ||||||||||||||||||
307 | if (!trap->isFunctionObject()
| 4-64 | ||||||||||||||||||
308 | return executed 4 times by 1 test: scope.engine->throwTypeError();return scope.engine->throwTypeError(); Executed by:
executed 4 times by 1 test: return scope.engine->throwTypeError(); Executed by:
| 4 | ||||||||||||||||||
309 | - | |||||||||||||||||||
310 | JSCallData cdata(scope, 1, nullptr, handler); | - | ||||||||||||||||||
311 | cdata.args[0] = target; | - | ||||||||||||||||||
312 | - | |||||||||||||||||||
313 | ScopedValue trapResult(scope, static_cast<const FunctionObject *>(trap.ptr)->call(cdata)); | - | ||||||||||||||||||
314 | bool result = trapResult->toBoolean(); | - | ||||||||||||||||||
315 | if (result != target->isExtensible()
| 16-48 | ||||||||||||||||||
316 | scope.engine->throwTypeError(); | - | ||||||||||||||||||
317 | return executed 16 times by 1 test: false;return false; Executed by:
executed 16 times by 1 test: return false; Executed by:
| 16 | ||||||||||||||||||
318 | } | - | ||||||||||||||||||
319 | return executed 48 times by 1 test: result;return result; Executed by:
executed 48 times by 1 test: return result; Executed by:
| 48 | ||||||||||||||||||
320 | } | - | ||||||||||||||||||
321 | - | |||||||||||||||||||
322 | bool ProxyObject::virtualPreventExtensions(Managed *m) | - | ||||||||||||||||||
323 | { | - | ||||||||||||||||||
324 | Scope scope(m); | - | ||||||||||||||||||
325 | const ProxyObject *o = static_cast<const ProxyObject *>(m); | - | ||||||||||||||||||
326 | if (!o->d()->handler
| 4-52 | ||||||||||||||||||
327 | return executed 4 times by 1 test: scope.engine->throwTypeError();return scope.engine->throwTypeError(); Executed by:
executed 4 times by 1 test: return scope.engine->throwTypeError(); Executed by:
| 4 | ||||||||||||||||||
328 | - | |||||||||||||||||||
329 | ScopedObject target(scope, o->d()->target); | - | ||||||||||||||||||
330 | ((target) ? static_cast<void>(0) : qt_assert("target", __FILE__, 374)); | - | ||||||||||||||||||
331 | ScopedObject handler(scope, o->d()->handler); | - | ||||||||||||||||||
332 | ScopedString hasProp(scope, scope.engine->newString(([]() noexcept -> QString { enum { Size = sizeof(u"" "preventExtensions")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "preventExtensions" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 52 times by 1 test: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 52 times by 1 test: }())));return qstring_literal_temp; Executed by:
| 52 | ||||||||||||||||||
333 | ScopedValue trap(scope, handler->get(hasProp)); | - | ||||||||||||||||||
334 | if (scope.hasException()
| 0-52 | ||||||||||||||||||
335 | return never executed: Encode::undefined();return Encode::undefined(); never executed: return Encode::undefined(); | 0 | ||||||||||||||||||
336 | if (trap->isNullOrUndefined()
| 12-40 | ||||||||||||||||||
337 | return executed 12 times by 1 test: target->preventExtensions();return target->preventExtensions(); Executed by:
executed 12 times by 1 test: return target->preventExtensions(); Executed by:
| 12 | ||||||||||||||||||
338 | if (!trap->isFunctionObject()
| 4-36 | ||||||||||||||||||
339 | return executed 4 times by 1 test: scope.engine->throwTypeError();return scope.engine->throwTypeError(); Executed by:
executed 4 times by 1 test: return scope.engine->throwTypeError(); Executed by:
| 4 | ||||||||||||||||||
340 | - | |||||||||||||||||||
341 | JSCallData cdata(scope, 1, nullptr, handler); | - | ||||||||||||||||||
342 | cdata.args[0] = target; | - | ||||||||||||||||||
343 | - | |||||||||||||||||||
344 | ScopedValue trapResult(scope, static_cast<const FunctionObject *>(trap.ptr)->call(cdata)); | - | ||||||||||||||||||
345 | bool result = trapResult->toBoolean(); | - | ||||||||||||||||||
346 | if (result
| 4-20 | ||||||||||||||||||
347 | scope.engine->throwTypeError(); | - | ||||||||||||||||||
348 | return executed 4 times by 1 test: false;return false; Executed by:
executed 4 times by 1 test: return false; Executed by:
| 4 | ||||||||||||||||||
349 | } | - | ||||||||||||||||||
350 | return executed 32 times by 1 test: result;return result; Executed by:
executed 32 times by 1 test: return result; Executed by:
| 32 | ||||||||||||||||||
351 | } | - | ||||||||||||||||||
352 | - | |||||||||||||||||||
353 | Heap::Object *ProxyObject::virtualGetPrototypeOf(const Managed *m) | - | ||||||||||||||||||
354 | { | - | ||||||||||||||||||
355 | Scope scope(m); | - | ||||||||||||||||||
356 | const ProxyObject *o = static_cast<const ProxyObject *>(m); | - | ||||||||||||||||||
357 | if (!o->d()->handler
| 4-75 | ||||||||||||||||||
358 | scope.engine->throwTypeError(); | - | ||||||||||||||||||
359 | return executed 4 times by 1 test: nullptr;return nullptr; Executed by:
executed 4 times by 1 test: return nullptr; Executed by:
| 4 | ||||||||||||||||||
360 | } | - | ||||||||||||||||||
361 | - | |||||||||||||||||||
362 | ScopedObject target(scope, o->d()->target); | - | ||||||||||||||||||
363 | ((target) ? static_cast<void>(0) : qt_assert("target", __FILE__, 407)); | - | ||||||||||||||||||
364 | ScopedObject handler(scope, o->d()->handler); | - | ||||||||||||||||||
365 | ScopedString name(scope, scope.engine->newString(([]() noexcept -> QString { enum { Size = sizeof(u"" "getPrototypeOf")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "getPrototypeOf" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 75 times by 1 test: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 75 times by 1 test: }())));return qstring_literal_temp; Executed by:
| 75 | ||||||||||||||||||
366 | ScopedValue trap(scope, handler->get(name)); | - | ||||||||||||||||||
367 | if (scope.hasException()
| 4-71 | ||||||||||||||||||
368 | return executed 4 times by 1 test: nullptr;return nullptr; Executed by:
executed 4 times by 1 test: return nullptr; Executed by:
| 4 | ||||||||||||||||||
369 | if (trap->isNullOrUndefined()
| 16-55 | ||||||||||||||||||
370 | return executed 16 times by 1 test: target->getPrototypeOf();return target->getPrototypeOf(); Executed by:
executed 16 times by 1 test: return target->getPrototypeOf(); Executed by:
| 16 | ||||||||||||||||||
371 | if (!trap->isFunctionObject()
| 4-52 | ||||||||||||||||||
372 | scope.engine->throwTypeError(); | - | ||||||||||||||||||
373 | return executed 4 times by 1 test: nullptr;return nullptr; Executed by:
executed 4 times by 1 test: return nullptr; Executed by:
| 4 | ||||||||||||||||||
374 | } | - | ||||||||||||||||||
375 | - | |||||||||||||||||||
376 | JSCallData cdata(scope, 1, nullptr, handler); | - | ||||||||||||||||||
377 | cdata.args[0] = target; | - | ||||||||||||||||||
378 | - | |||||||||||||||||||
379 | ScopedValue trapResult(scope, static_cast<const FunctionObject *>(trap.ptr)->call(cdata)); | - | ||||||||||||||||||
380 | if (!trapResult->isNull()
| 0-51 | ||||||||||||||||||
381 | scope.engine->throwTypeError(); | - | ||||||||||||||||||
382 | return executed 32 times by 1 test: nullptr;return nullptr; Executed by:
executed 32 times by 1 test: return nullptr; Executed by:
| 32 | ||||||||||||||||||
383 | } | - | ||||||||||||||||||
384 | Heap::Object *proto = trapResult->isNull()
| 0-20 | ||||||||||||||||||
385 | if (!target->isExtensible()
| 8-12 | ||||||||||||||||||
386 | Heap::Object *targetProto = target->getPrototypeOf(); | - | ||||||||||||||||||
387 | if (proto != targetProto
| 4-8 | ||||||||||||||||||
388 | scope.engine->throwTypeError(); | - | ||||||||||||||||||
389 | return executed 4 times by 1 test: nullptr;return nullptr; Executed by:
executed 4 times by 1 test: return nullptr; Executed by:
| 4 | ||||||||||||||||||
390 | } | - | ||||||||||||||||||
391 | } executed 8 times by 1 test: end of block Executed by:
| 8 | ||||||||||||||||||
392 | return executed 16 times by 1 test: proto;return proto; Executed by:
executed 16 times by 1 test: return proto; Executed by:
| 16 | ||||||||||||||||||
393 | } | - | ||||||||||||||||||
394 | - | |||||||||||||||||||
395 | bool ProxyObject::virtualSetPrototypeOf(Managed *m, const Object *p) | - | ||||||||||||||||||
396 | { | - | ||||||||||||||||||
397 | Scope scope(m); | - | ||||||||||||||||||
398 | const ProxyObject *o = static_cast<const ProxyObject *>(m); | - | ||||||||||||||||||
399 | if (!o->d()->handler
| 4-120 | ||||||||||||||||||
400 | scope.engine->throwTypeError(); | - | ||||||||||||||||||
401 | return executed 4 times by 1 test: false;return false; Executed by:
executed 4 times by 1 test: return false; Executed by:
| 4 | ||||||||||||||||||
402 | } | - | ||||||||||||||||||
403 | - | |||||||||||||||||||
404 | ScopedObject target(scope, o->d()->target); | - | ||||||||||||||||||
405 | ((target) ? static_cast<void>(0) : qt_assert("target", __FILE__, 449)); | - | ||||||||||||||||||
406 | ScopedObject handler(scope, o->d()->handler); | - | ||||||||||||||||||
407 | ScopedString name(scope, scope.engine->newString(([]() noexcept -> QString { enum { Size = sizeof(u"" "setPrototypeOf")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "setPrototypeOf" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 120 times by 1 test: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 120 times by 1 test: }())));return qstring_literal_temp; Executed by:
| 120 | ||||||||||||||||||
408 | ScopedValue trap(scope, handler->get(name)); | - | ||||||||||||||||||
409 | if (scope.hasException()
| 4-116 | ||||||||||||||||||
410 | return executed 4 times by 1 test: false;return false; Executed by:
executed 4 times by 1 test: return false; Executed by:
| 4 | ||||||||||||||||||
411 | if (trap->isNullOrUndefined()
| 8-108 | ||||||||||||||||||
412 | return executed 8 times by 1 test: target->setPrototypeOf(p);return target->setPrototypeOf(p); Executed by:
executed 8 times by 1 test: return target->setPrototypeOf(p); Executed by:
| 8 | ||||||||||||||||||
413 | if (!trap->isFunctionObject()
| 4-104 | ||||||||||||||||||
414 | scope.engine->throwTypeError(); | - | ||||||||||||||||||
415 | return executed 4 times by 1 test: false;return false; Executed by:
executed 4 times by 1 test: return false; Executed by:
| 4 | ||||||||||||||||||
416 | } | - | ||||||||||||||||||
417 | - | |||||||||||||||||||
418 | JSCallData cdata(scope, 2, nullptr, handler); | - | ||||||||||||||||||
419 | cdata.args[0] = target; | - | ||||||||||||||||||
420 | cdata.args[1] = p
| 4-100 | ||||||||||||||||||
421 | - | |||||||||||||||||||
422 | ScopedValue trapResult(scope, static_cast<const FunctionObject *>(trap.ptr)->call(cdata)); | - | ||||||||||||||||||
423 | bool result = trapResult->toBoolean(); | - | ||||||||||||||||||
424 | if (!result
| 40-64 | ||||||||||||||||||
425 | return executed 40 times by 1 test: false;return false; Executed by:
executed 40 times by 1 test: return false; Executed by:
| 40 | ||||||||||||||||||
426 | if (!target->isExtensible()
| 28-36 | ||||||||||||||||||
427 | Heap::Object *targetProto = target->getPrototypeOf(); | - | ||||||||||||||||||
428 | if (p->d() != targetProto
| 12-16 | ||||||||||||||||||
429 | scope.engine->throwTypeError(); | - | ||||||||||||||||||
430 | return executed 16 times by 1 test: false;return false; Executed by:
executed 16 times by 1 test: return false; Executed by:
| 16 | ||||||||||||||||||
431 | } | - | ||||||||||||||||||
432 | } executed 12 times by 1 test: end of block Executed by:
| 12 | ||||||||||||||||||
433 | return executed 48 times by 1 test: true;return true; Executed by:
executed 48 times by 1 test: return true; Executed by:
| 48 | ||||||||||||||||||
434 | } | - | ||||||||||||||||||
435 | const QV4::VTable Proxy::static_vtbl = { (std::is_same<Proxy::SuperClass, Object>::value) ? nullptr : &Proxy::SuperClass::static_vtbl, (sizeof(Proxy::Data) + sizeof(QV4::Value) - 1)/sizeof(QV4::Value), (sizeof(Proxy::Data) + (Proxy::NInlineProperties*sizeof(QV4::Value)) + QV4::Chunk::SlotSize - 1)/QV4::Chunk::SlotSize*QV4::Chunk::SlotSize/sizeof(QV4::Value) - (sizeof(Proxy::Data) + sizeof(QV4::Value) - 1)/sizeof(QV4::Value), Proxy::IsExecutionContext, Proxy::IsString, Proxy::IsObject, Proxy::IsFunctionObject, Proxy::IsErrorObject, Proxy::IsArrayData, Proxy::IsStringOrSymbol, Proxy::MyType, { 0, 0, 0, 0 }, "Proxy", Proxy::virtualDestroy, Proxy::Data::markObjects, Proxy::virtualIsEqualTo, Proxy::virtualGet, Proxy::virtualPut, Proxy::virtualDeleteProperty, Proxy::virtualHasProperty, Proxy::virtualGetOwnProperty, Proxy::virtualDefineOwnProperty, Proxy::virtualIsExtensible, Proxy::virtualPreventExtensions, Proxy::virtualGetPrototypeOf, Proxy::virtualSetPrototypeOf, Proxy::virtualGetLength, Proxy::virtualAdvanceIterator, Proxy::virtualInstanceOf, Proxy::virtualCall, Proxy::virtualCallAsConstructor, }; | - | ||||||||||||||||||
436 | - | |||||||||||||||||||
437 | void Heap::Proxy::init(QV4::ExecutionContext *ctx) | - | ||||||||||||||||||
438 | { | - | ||||||||||||||||||
439 | Heap::FunctionObject::init(ctx, ([]() noexcept -> QString { enum { Size = sizeof(u"" "Proxy")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Proxy" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 97881 times by 153 tests: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 97881 times by 153 tests: }()));return qstring_literal_temp; Executed by:
| 97881 | ||||||||||||||||||
440 | - | |||||||||||||||||||
441 | Scope scope(ctx); | - | ||||||||||||||||||
442 | Scoped<QV4::Proxy> ctor(scope, this); | - | ||||||||||||||||||
443 | ctor->defineDefaultProperty(([]() noexcept -> QString { enum { Size = sizeof(u"" "revocable")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "revocable" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 98427 times by 153 tests: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 98427 times by 153 tests: }()), QV4::Proxy::method_revocable, 2);return qstring_literal_temp; Executed by:
| 98427 | ||||||||||||||||||
444 | ctor->defineReadonlyConfigurableProperty(scope.engine->id_length(), Primitive::fromInt32(2)); | - | ||||||||||||||||||
445 | } executed 98523 times by 153 tests: end of block Executed by:
| 98523 | ||||||||||||||||||
446 | - | |||||||||||||||||||
447 | ReturnedValue Proxy::virtualCallAsConstructor(const FunctionObject *f, const Value *argv, int argc, const Value *) | - | ||||||||||||||||||
448 | { | - | ||||||||||||||||||
449 | Scope scope(f); | - | ||||||||||||||||||
450 | if (argc < 2
| 0-1208 | ||||||||||||||||||
451 | return executed 48 times by 1 test: scope.engine->throwTypeError();return scope.engine->throwTypeError(); Executed by:
executed 48 times by 1 test: return scope.engine->throwTypeError(); Executed by:
| 48 | ||||||||||||||||||
452 | - | |||||||||||||||||||
453 | const Object *target = static_cast<const Object *>(argv); | - | ||||||||||||||||||
454 | const Object *handler = static_cast<const Object *>(argv + 1); | - | ||||||||||||||||||
455 | if (const
| 80-1081 | ||||||||||||||||||
456 | if (!ptarget->d()->handler
| 4-76 | ||||||||||||||||||
457 | return executed 4 times by 1 test: scope.engine->throwTypeError();return scope.engine->throwTypeError(); Executed by:
executed 4 times by 1 test: return scope.engine->throwTypeError(); Executed by:
| 4 | ||||||||||||||||||
458 | if (const
| 16-1146 | ||||||||||||||||||
459 | if (!phandler->d()->handler
| 4-12 | ||||||||||||||||||
460 | return executed 4 times by 1 test: scope.engine->throwTypeError();return scope.engine->throwTypeError(); Executed by:
executed 4 times by 1 test: return scope.engine->throwTypeError(); Executed by:
| 4 | ||||||||||||||||||
461 | - | |||||||||||||||||||
462 | ScopedObject o(scope, scope.engine->memoryManager->allocate<ProxyObject>(target, handler)); | - | ||||||||||||||||||
463 | return executed 1148 times by 1 test: o->asReturnedValue();return o->asReturnedValue(); Executed by:
executed 1148 times by 1 test: return o->asReturnedValue(); Executed by:
| 1148 | ||||||||||||||||||
464 | } | - | ||||||||||||||||||
465 | - | |||||||||||||||||||
466 | ReturnedValue Proxy::virtualCall(const FunctionObject *f, const Value *, const Value *, int) | - | ||||||||||||||||||
467 | { | - | ||||||||||||||||||
468 | return executed 4 times by 1 test: f->engine()->throwTypeError();return f->engine()->throwTypeError(); Executed by:
executed 4 times by 1 test: return f->engine()->throwTypeError(); Executed by:
| 4 | ||||||||||||||||||
469 | } | - | ||||||||||||||||||
470 | - | |||||||||||||||||||
471 | ReturnedValue Proxy::method_revocable(const FunctionObject *f, const Value *, const Value *argv, int argc) | - | ||||||||||||||||||
472 | { | - | ||||||||||||||||||
473 | Scope scope(f); | - | ||||||||||||||||||
474 | ScopedObject proxy(scope, Proxy::virtualCallAsConstructor(f, argv, argc, f)); | - | ||||||||||||||||||
475 | if (scope.hasException()
| 0-149 | ||||||||||||||||||
476 | return never executed: Encode::undefined();return Encode::undefined(); never executed: return Encode::undefined(); | 0 | ||||||||||||||||||
477 | - | |||||||||||||||||||
478 | ScopedString revoke(scope, scope.engine->newString(([]() noexcept -> QString { enum { Size = sizeof(u"" "revoke")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "revoke" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 149 times by 1 test: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 149 times by 1 test: }())));return qstring_literal_temp; Executed by:
| 149 | ||||||||||||||||||
479 | ScopedFunctionObject revoker(scope, createBuiltinFunction(scope.engine, revoke, method_revoke, 0)); | - | ||||||||||||||||||
480 | revoker->defineDefaultProperty(scope.engine->symbol_revokableProxy(), proxy); | - | ||||||||||||||||||
481 | - | |||||||||||||||||||
482 | ScopedObject o(scope, scope.engine->newObject()); | - | ||||||||||||||||||
483 | ScopedString p(scope, scope.engine->newString(([]() noexcept -> QString { enum { Size = sizeof(u"" "proxy")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "proxy" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 150 times by 1 test: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 150 times by 1 test: }())));return qstring_literal_temp; Executed by:
| 150 | ||||||||||||||||||
484 | o->defineDefaultProperty(p, proxy); | - | ||||||||||||||||||
485 | o->defineDefaultProperty(revoke, revoker); | - | ||||||||||||||||||
486 | return executed 150 times by 1 test: o->asReturnedValue();return o->asReturnedValue(); Executed by:
executed 150 times by 1 test: return o->asReturnedValue(); Executed by:
| 150 | ||||||||||||||||||
487 | } | - | ||||||||||||||||||
488 | - | |||||||||||||||||||
489 | ReturnedValue Proxy::method_revoke(const FunctionObject *f, const Value *, const Value *, int) | - | ||||||||||||||||||
490 | { | - | ||||||||||||||||||
491 | Scope scope(f); | - | ||||||||||||||||||
492 | Scoped<ProxyObject> proxy(scope, f->get(scope.engine->symbol_revokableProxy())); | - | ||||||||||||||||||
493 | ((proxy) ? static_cast<void>(0) : qt_assert("proxy", __FILE__, 548)); | - | ||||||||||||||||||
494 | - | |||||||||||||||||||
495 | proxy->d()->target.set(scope.engine, nullptr); | - | ||||||||||||||||||
496 | proxy->d()->handler.set(scope.engine, nullptr); | - | ||||||||||||||||||
497 | return executed 118 times by 1 test: Encode::undefined();return Encode::undefined(); Executed by:
executed 118 times by 1 test: return Encode::undefined(); Executed by:
| 118 | ||||||||||||||||||
498 | } | - | ||||||||||||||||||
Switch to Source code | Preprocessed file |