OpenCoverage

qv4proxy.cpp

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/jsruntime/qv4proxy.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2018 The Qt Company Ltd.-
4** Contact: https://www.qt.io/licensing/-
5**-
6** This file is part of the QtQml module of the Qt Toolkit.-
7**-
8** $QT_BEGIN_LICENSE:LGPL$-
9** Commercial License Usage-
10** Licensees holding valid commercial Qt licenses may use this file in-
11** accordance with the commercial license agreement provided with the-
12** Software or, alternatively, in accordance with the terms contained in-
13** a written agreement between you and The Qt Company. For licensing terms-
14** and conditions see https://www.qt.io/terms-conditions. For further-
15** information use the contact form at https://www.qt.io/contact-us.-
16**-
17** GNU Lesser General Public License Usage-
18** Alternatively, this file may be used under the terms of the GNU Lesser-
19** General Public License version 3 as published by the Free Software-
20** Foundation and appearing in the file LICENSE.LGPL3 included in the-
21** packaging of this file. Please review the following information to-
22** ensure the GNU Lesser General Public License version 3 requirements-
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.-
24**-
25** GNU General Public License Usage-
26** Alternatively, this file may be used under the terms of the GNU-
27** General Public License version 2.0 or (at your option) the GNU General-
28** Public license version 3 or any later version approved by the KDE Free-
29** Qt Foundation. The licenses are as published by the Free Software-
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3-
31** included in the packaging of this file. Please review the following-
32** information to ensure the GNU General Public License requirements will-
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and-
34** https://www.gnu.org/licenses/gpl-3.0.html.-
35**-
36** $QT_END_LICENSE$-
37**-
38****************************************************************************/-
39-
40-
41#include "qv4proxy_p.h"-
42#include "qv4symbol_p.h"-
43#include "qv4jscall_p.h"-
44#include "qv4objectproto_p.h"-
45-
46using namespace QV4;-
47-
48DEFINE_OBJECT_VTABLE(ProxyObject);-
49-
50void Heap::ProxyObject::init(const QV4::Object *target, const QV4::Object *handler)-
51{-
52 Object::init();-
53 ExecutionEngine *e = internalClass->engine;-
54 this->target.set(e, target->d());-
55 this->handler.set(e, handler->d());-
56}
executed 1148 times by 1 test: end of block
Executed by:
  • tst_ecmascripttests
1148
57-
58ReturnedValue ProxyObject::virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty)-
59{-
60 Scope scope(m);-
61 const ProxyObject *o = static_cast<const ProxyObject *>(m);-
62 if (!o->d()->handler)
!o->d()->handlerDescription
TRUEevaluated 38 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 365 times by 1 test
Evaluated by:
  • tst_ecmascripttests
38-365
63 return scope.engine->throwTypeError();
executed 38 times by 1 test: return scope.engine->throwTypeError();
Executed by:
  • tst_ecmascripttests
38
64-
65 ScopedObject target(scope, o->d()->target);-
66 Q_ASSERT(target);-
67 ScopedObject handler(scope, o->d()->handler);-
68 ScopedValue trap(scope, handler->get(scope.engine->id_get()));-
69 if (scope.hasException())
scope.hasException()Description
TRUEnever evaluated
FALSEevaluated 366 times by 1 test
Evaluated by:
  • tst_ecmascripttests
0-366
70 return Encode::undefined();
never executed: return Encode::undefined();
0
71 if (trap->isNullOrUndefined())
trap->isNullOrUndefined()Description
TRUEevaluated 190 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 176 times by 1 test
Evaluated by:
  • tst_ecmascripttests
176-190
72 return target->get(id, receiver, hasProperty);
executed 190 times by 1 test: return target->get(id, receiver, hasProperty);
Executed by:
  • tst_ecmascripttests
190
73 if (!trap->isFunctionObject())
!trap->isFunctionObject()Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 168 times by 1 test
Evaluated by:
  • tst_ecmascripttests
8-168
74 return scope.engine->throwTypeError();
executed 8 times by 1 test: return scope.engine->throwTypeError();
Executed by:
  • tst_ecmascripttests
8
75 if (hasProperty)
hasPropertyDescription
TRUEnever evaluated
FALSEevaluated 168 times by 1 test
Evaluated by:
  • tst_ecmascripttests
0-168
76 *hasProperty = true;
never executed: *hasProperty = true;
0
77-
78 JSCallData cdata(scope, 3, nullptr, handler);-
79 cdata.args[0] = target;-
80 cdata.args[1] = id.toStringOrSymbol(scope.engine);-
81 cdata.args[2] = *receiver;-
82-
83 ScopedValue trapResult(scope, static_cast<const FunctionObject *>(trap.ptr)->call(cdata));-
84 ScopedProperty targetDesc(scope);-
85 PropertyAttributes attributes = target->getOwnProperty(id, targetDesc);-
86 if (attributes != Attr_Invalid && !attributes.isConfigurable()) {
attributes != Attr_InvalidDescription
TRUEevaluated 108 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 60 times by 1 test
Evaluated by:
  • tst_ecmascripttests
!attributes.isConfigurable()Description
TRUEevaluated 60 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 48 times by 1 test
Evaluated by:
  • tst_ecmascripttests
48-108
87 if (attributes.isData() && !attributes.isWritable()) {
attributes.isData()Description
TRUEevaluated 44 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 16 times by 1 test
Evaluated by:
  • tst_ecmascripttests
!attributes.isWritable()Description
TRUEevaluated 16 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 28 times by 1 test
Evaluated by:
  • tst_ecmascripttests
16-44
88 if (!trapResult->sameValue(targetDesc->value))
!trapResult->s...etDesc->value)Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_ecmascripttests
8
89 return scope.engine->throwTypeError();
executed 8 times by 1 test: return scope.engine->throwTypeError();
Executed by:
  • tst_ecmascripttests
8
90 }
executed 8 times by 1 test: end of block
Executed by:
  • tst_ecmascripttests
8
91 if (attributes.isAccessor() && targetDesc->value.isUndefined()) {
attributes.isAccessor()Description
TRUEevaluated 16 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 36 times by 1 test
Evaluated by:
  • tst_ecmascripttests
targetDesc->va....isUndefined()Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_ecmascripttests
8-36
92 if (!trapResult->isUndefined())
!trapResult->isUndefined()Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEnever evaluated
0-8
93 return scope.engine->throwTypeError();
executed 8 times by 1 test: return scope.engine->throwTypeError();
Executed by:
  • tst_ecmascripttests
8
94 }
never executed: end of block
0
95 }
executed 44 times by 1 test: end of block
Executed by:
  • tst_ecmascripttests
44
96 return trapResult->asReturnedValue();
executed 152 times by 1 test: return trapResult->asReturnedValue();
Executed by:
  • tst_ecmascripttests
152
97}-
98-
99bool ProxyObject::virtualPut(Managed *m, PropertyKey id, const Value &value, Value *receiver)-
100{-
101 Scope scope(m);-
102 const ProxyObject *o = static_cast<const ProxyObject *>(m);-
103 if (!o->d()->handler)
!o->d()->handlerDescription
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 111 times by 1 test
Evaluated by:
  • tst_ecmascripttests
12-111
104 return scope.engine->throwTypeError();
executed 12 times by 1 test: return scope.engine->throwTypeError();
Executed by:
  • tst_ecmascripttests
12
105-
106 ScopedObject target(scope, o->d()->target);-
107 Q_ASSERT(target);-
108 ScopedObject handler(scope, o->d()->handler);-
109 ScopedValue trap(scope, handler->get(scope.engine->id_set()));-
110 if (scope.hasException())
scope.hasException()Description
TRUEnever evaluated
FALSEevaluated 112 times by 1 test
Evaluated by:
  • tst_ecmascripttests
0-112
111 return Encode::undefined();
never executed: return Encode::undefined();
0
112 if (trap->isNullOrUndefined())
trap->isNullOrUndefined()Description
TRUEevaluated 40 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 72 times by 1 test
Evaluated by:
  • tst_ecmascripttests
40-72
113 return target->put(id, value, receiver);
executed 40 times by 1 test: return target->put(id, value, receiver);
Executed by:
  • tst_ecmascripttests
40
114 if (!trap->isFunctionObject())
!trap->isFunctionObject()Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 63 times by 1 test
Evaluated by:
  • tst_ecmascripttests
8-63
115 return scope.engine->throwTypeError();
executed 8 times by 1 test: return scope.engine->throwTypeError();
Executed by:
  • tst_ecmascripttests
8
116-
117 JSCallData cdata(scope, 4, nullptr, handler);-
118 cdata.args[0] = target;-
119 cdata.args[1] = id.toStringOrSymbol(scope.engine);-
120 cdata.args[2] = value;-
121 cdata.args[3] = *receiver;-
122-
123 ScopedValue trapResult(scope, static_cast<const FunctionObject *>(trap.ptr)->call(cdata));-
124 if (!trapResult->toBoolean())
!trapResult->toBoolean()Description
TRUEevaluated 28 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 35 times by 1 test
Evaluated by:
  • tst_ecmascripttests
28-35
125 return false;
executed 28 times by 1 test: return false;
Executed by:
  • tst_ecmascripttests
28
126 ScopedProperty targetDesc(scope);-
127 PropertyAttributes attributes = target->getOwnProperty(id, targetDesc);-
128 if (attributes != Attr_Invalid && !attributes.isConfigurable()) {
attributes != Attr_InvalidDescription
TRUEevaluated 36 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEnever evaluated
!attributes.isConfigurable()Description
TRUEevaluated 24 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_ecmascripttests
0-36
129 if (attributes.isData() && !attributes.isWritable()) {
attributes.isData()Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_ecmascripttests
!attributes.isWritable()Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_ecmascripttests
4-12
130 if (!value.sameValue(targetDesc->value))
!value.sameVal...etDesc->value)Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEnever evaluated
0-8
131 return scope.engine->throwTypeError();
executed 8 times by 1 test: return scope.engine->throwTypeError();
Executed by:
  • tst_ecmascripttests
8
132 }
never executed: end of block
0
133 if (attributes.isAccessor() && targetDesc->set.isUndefined())
attributes.isAccessor()Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_ecmascripttests
targetDesc->set.isUndefined()Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_ecmascripttests
4-12
134 return scope.engine->throwTypeError();
executed 8 times by 1 test: return scope.engine->throwTypeError();
Executed by:
  • tst_ecmascripttests
8
135 }
executed 8 times by 1 test: end of block
Executed by:
  • tst_ecmascripttests
8
136 return true;
executed 20 times by 1 test: return true;
Executed by:
  • tst_ecmascripttests
20
137}-
138-
139bool ProxyObject::virtualDeleteProperty(Managed *m, PropertyKey id)-
140{-
141 Scope scope(m);-
142 const ProxyObject *o = static_cast<const ProxyObject *>(m);-
143 if (!o->d()->handler)
!o->d()->handlerDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 60 times by 1 test
Evaluated by:
  • tst_ecmascripttests
4-60
144 return scope.engine->throwTypeError();
executed 4 times by 1 test: return scope.engine->throwTypeError();
Executed by:
  • tst_ecmascripttests
4
145-
146 ScopedObject target(scope, o->d()->target);-
147 Q_ASSERT(target);-
148 ScopedObject handler(scope, o->d()->handler);-
149 ScopedString deleteProp(scope, scope.engine->newString(QStringLiteral("deleteProperty")));
executed 60 times by 1 test: return qstring_literal_temp;
Executed by:
  • tst_ecmascripttests
60
150 ScopedValue trap(scope, handler->get(deleteProp));-
151 if (scope.hasException())
scope.hasException()Description
TRUEnever evaluated
FALSEevaluated 60 times by 1 test
Evaluated by:
  • tst_ecmascripttests
0-60
152 return Encode::undefined();
never executed: return Encode::undefined();
0
153 if (trap->isNullOrUndefined())
trap->isNullOrUndefined()Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 48 times by 1 test
Evaluated by:
  • tst_ecmascripttests
12-48
154 return target->deleteProperty(id);
executed 12 times by 1 test: return target->deleteProperty(id);
Executed by:
  • tst_ecmascripttests
12
155 if (!trap->isFunctionObject())
!trap->isFunctionObject()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 44 times by 1 test
Evaluated by:
  • tst_ecmascripttests
4-44
156 return scope.engine->throwTypeError();
executed 4 times by 1 test: return scope.engine->throwTypeError();
Executed by:
  • tst_ecmascripttests
4
157-
158 JSCallData cdata(scope, 3, nullptr, handler);-
159 cdata.args[0] = target;-
160 cdata.args[1] = id.toStringOrSymbol(scope.engine);-
161 cdata.args[2] = o->d(); // ### fix receiver handling-
162-
163 ScopedValue trapResult(scope, static_cast<const FunctionObject *>(trap.ptr)->call(cdata));-
164 if (!trapResult->toBoolean())
!trapResult->toBoolean()Description
TRUEevaluated 28 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 16 times by 1 test
Evaluated by:
  • tst_ecmascripttests
16-28
165 return false;
executed 28 times by 1 test: return false;
Executed by:
  • tst_ecmascripttests
28
166 ScopedProperty targetDesc(scope);-
167 PropertyAttributes attributes = target->getOwnProperty(id, targetDesc);-
168 if (attributes == Attr_Invalid)
attributes == Attr_InvalidDescription
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_ecmascripttests
4-12
169 return true;
executed 12 times by 1 test: return true;
Executed by:
  • tst_ecmascripttests
12
170 if (!attributes.isConfigurable())
!attributes.isConfigurable()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEnever evaluated
0-4
171 return scope.engine->throwTypeError();
executed 4 times by 1 test: return scope.engine->throwTypeError();
Executed by:
  • tst_ecmascripttests
4
172 return true;
never executed: return true;
0
173}-
174-
175bool ProxyObject::virtualHasProperty(const Managed *m, PropertyKey id)-
176{-
177 Scope scope(m);-
178 const ProxyObject *o = static_cast<const ProxyObject *>(m);-
179 if (!o->d()->handler)
!o->d()->handlerDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 40 times by 1 test
Evaluated by:
  • tst_ecmascripttests
4-40
180 return scope.engine->throwTypeError();
executed 4 times by 1 test: return scope.engine->throwTypeError();
Executed by:
  • tst_ecmascripttests
4
181-
182 ScopedObject target(scope, o->d()->target);-
183 Q_ASSERT(target);-
184 ScopedObject handler(scope, o->d()->handler);-
185 ScopedString hasProp(scope, scope.engine->newString(QStringLiteral("has")));
executed 40 times by 1 test: return qstring_literal_temp;
Executed by:
  • tst_ecmascripttests
40
186 ScopedValue trap(scope, handler->get(hasProp));-
187 if (scope.hasException())
scope.hasException()Description
TRUEnever evaluated
FALSEevaluated 40 times by 1 test
Evaluated by:
  • tst_ecmascripttests
0-40
188 return Encode::undefined();
never executed: return Encode::undefined();
0
189 if (trap->isNullOrUndefined())
trap->isNullOrUndefined()Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 32 times by 1 test
Evaluated by:
  • tst_ecmascripttests
8-32
190 return target->hasProperty(id);
executed 8 times by 1 test: return target->hasProperty(id);
Executed by:
  • tst_ecmascripttests
8
191 if (!trap->isFunctionObject())
!trap->isFunctionObject()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 28 times by 1 test
Evaluated by:
  • tst_ecmascripttests
4-28
192 return scope.engine->throwTypeError();
executed 4 times by 1 test: return scope.engine->throwTypeError();
Executed by:
  • tst_ecmascripttests
4
193-
194 JSCallData cdata(scope, 2, nullptr, handler);-
195 cdata.args[0] = target;-
196 cdata.args[1] = id.isArrayIndex() ? Primitive::fromUInt32(id.asArrayIndex()).toString(scope.engine) : id.asStringOrSymbol();
id.isArrayIndex()Description
TRUEnever evaluated
FALSEevaluated 28 times by 1 test
Evaluated by:
  • tst_ecmascripttests
0-28
197-
198 ScopedValue trapResult(scope, static_cast<const FunctionObject *>(trap.ptr)->call(cdata));-
199 bool result = trapResult->toBoolean();-
200 if (!result) {
!resultDescription
TRUEevaluated 20 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_ecmascripttests
8-20
201 ScopedProperty targetDesc(scope);-
202 PropertyAttributes attributes = target->getOwnProperty(id, targetDesc);-
203 if (attributes != Attr_Invalid) {
attributes != Attr_InvalidDescription
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_ecmascripttests
8-12
204 if (!attributes.isConfigurable() || !target->isExtensible())
!attributes.isConfigurable()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_ecmascripttests
!target->isExtensible()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_ecmascripttests
4-8
205 return scope.engine->throwTypeError();
executed 8 times by 1 test: return scope.engine->throwTypeError();
Executed by:
  • tst_ecmascripttests
8
206 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_ecmascripttests
4
207 }
executed 12 times by 1 test: end of block
Executed by:
  • tst_ecmascripttests
12
208 return result;
executed 20 times by 1 test: return result;
Executed by:
  • tst_ecmascripttests
20
209}-
210-
211PropertyAttributes ProxyObject::virtualGetOwnProperty(Managed *m, PropertyKey id, Property *p)-
212{-
213 Scope scope(m);-
214 const ProxyObject *o = static_cast<const ProxyObject *>(m);-
215 if (!o->d()->handler) {
!o->d()->handlerDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 96 times by 1 test
Evaluated by:
  • tst_ecmascripttests
4-96
216 scope.engine->throwTypeError();-
217 return Attr_Invalid;
executed 4 times by 1 test: return Attr_Invalid;
Executed by:
  • tst_ecmascripttests
4
218 }-
219-
220 ScopedObject target(scope, o->d()->target);-
221 Q_ASSERT(target);-
222 ScopedObject handler(scope, o->d()->handler);-
223 ScopedString deleteProp(scope, scope.engine->newString(QStringLiteral("getOwnPropertyDescriptor")));
executed 96 times by 1 test: return qstring_literal_temp;
Executed by:
  • tst_ecmascripttests
96
224 ScopedValue trap(scope, handler->get(deleteProp));-
225 if (scope.hasException())
scope.hasException()Description
TRUEnever evaluated
FALSEevaluated 96 times by 1 test
Evaluated by:
  • tst_ecmascripttests
0-96
226 return Attr_Invalid;
never executed: return Attr_Invalid;
0
227 if (trap->isNullOrUndefined())
trap->isNullOrUndefined()Description
TRUEevaluated 24 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 72 times by 1 test
Evaluated by:
  • tst_ecmascripttests
24-72
228 return target->getOwnProperty(id, p);
executed 24 times by 1 test: return target->getOwnProperty(id, p);
Executed by:
  • tst_ecmascripttests
24
229 if (!trap->isFunctionObject()) {
!trap->isFunctionObject()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 68 times by 1 test
Evaluated by:
  • tst_ecmascripttests
4-68
230 scope.engine->throwTypeError();-
231 return Attr_Invalid;
executed 4 times by 1 test: return Attr_Invalid;
Executed by:
  • tst_ecmascripttests
4
232 }-
233-
234 JSCallData cdata(scope, 2, nullptr, handler);-
235 cdata.args[0] = target;-
236 cdata.args[1] = id.isArrayIndex() ? Primitive::fromUInt32(id.asArrayIndex()).toString(scope.engine) : id.asStringOrSymbol();
id.isArrayIndex()Description
TRUEnever evaluated
FALSEevaluated 68 times by 1 test
Evaluated by:
  • tst_ecmascripttests
0-68
237-
238 ScopedValue trapResult(scope, static_cast<const FunctionObject *>(trap.ptr)->call(cdata));-
239 if (!trapResult->isObject() && !trapResult->isUndefined()) {
!trapResult->isObject()Description
TRUEevaluated 44 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 24 times by 1 test
Evaluated by:
  • tst_ecmascripttests
!trapResult->isUndefined()Description
TRUEevaluated 16 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 28 times by 1 test
Evaluated by:
  • tst_ecmascripttests
16-44
240 scope.engine->throwTypeError();-
241 return Attr_Invalid;
executed 16 times by 1 test: return Attr_Invalid;
Executed by:
  • tst_ecmascripttests
16
242 }-
243-
244 ScopedProperty targetDesc(scope);-
245 PropertyAttributes targetAttributes = target->getOwnProperty(id, targetDesc);-
246 if (trapResult->isUndefined()) {
trapResult->isUndefined()Description
TRUEevaluated 28 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 24 times by 1 test
Evaluated by:
  • tst_ecmascripttests
24-28
247 p->value = Encode::undefined();-
248 if (targetAttributes == Attr_Invalid) {
targetAttribut...= Attr_InvalidDescription
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 16 times by 1 test
Evaluated by:
  • tst_ecmascripttests
12-16
249 p->value = Encode::undefined();-
250 return Attr_Invalid;
executed 12 times by 1 test: return Attr_Invalid;
Executed by:
  • tst_ecmascripttests
12
251 }-
252 if (!targetAttributes.isConfigurable() || !target->isExtensible()) {
!targetAttribu...Configurable()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_ecmascripttests
!target->isExtensible()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_ecmascripttests
4-12
253 scope.engine->throwTypeError();-
254 return Attr_Invalid;
executed 8 times by 1 test: return Attr_Invalid;
Executed by:
  • tst_ecmascripttests
8
255 }-
256 return Attr_Invalid;
executed 8 times by 1 test: return Attr_Invalid;
Executed by:
  • tst_ecmascripttests
8
257 }-
258-
259 //bool extensibleTarget = target->isExtensible();-
260 ScopedProperty resultDesc(scope);-
261 PropertyAttributes resultAttributes;-
262 ObjectPrototype::toPropertyDescriptor(scope.engine, trapResult, resultDesc, &resultAttributes);-
263 resultDesc->fullyPopulated(&resultAttributes);-
264-
265 // ###-
266 //Let valid be IsCompatiblePropertyDescriptor(extensibleTarget, resultDesc, targetDesc).-
267 //If valid is false, throw a TypeError exception.-
268-
269 if (!resultAttributes.isConfigurable()) {
!resultAttribu...Configurable()Description
TRUEevaluated 16 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_ecmascripttests
8-16
270 if (targetAttributes == Attr_Invalid || !targetAttributes.isConfigurable()) {
targetAttribut...= Attr_InvalidDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_ecmascripttests
!targetAttribu...Configurable()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_ecmascripttests
4-12
271 scope.engine->throwTypeError();-
272 return Attr_Invalid;
executed 8 times by 1 test: return Attr_Invalid;
Executed by:
  • tst_ecmascripttests
8
273 }-
274 }
executed 8 times by 1 test: end of block
Executed by:
  • tst_ecmascripttests
8
275-
276 p->value = resultDesc->value;-
277 p->set = resultDesc->set;-
278 return resultAttributes;
executed 16 times by 1 test: return resultAttributes;
Executed by:
  • tst_ecmascripttests
16
279}-
280-
281bool ProxyObject::virtualDefineOwnProperty(Managed *m, PropertyKey id, const Property *p, PropertyAttributes attrs)-
282{-
283 Scope scope(m);-
284 const ProxyObject *o = static_cast<const ProxyObject *>(m);-
285 if (!o->d()->handler) {
!o->d()->handlerDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 76 times by 1 test
Evaluated by:
  • tst_ecmascripttests
4-76
286 scope.engine->throwTypeError();-
287 return false;
executed 4 times by 1 test: return false;
Executed by:
  • tst_ecmascripttests
4
288 }-
289-
290 ScopedObject target(scope, o->d()->target);-
291 Q_ASSERT(target);-
292 ScopedObject handler(scope, o->d()->handler);-
293 ScopedString prop(scope, scope.engine->newString(QStringLiteral("defineProperty")));
executed 76 times by 1 test: return qstring_literal_temp;
Executed by:
  • tst_ecmascripttests
76
294 ScopedValue trap(scope, handler->get(prop));-
295 if (scope.hasException())
scope.hasException()Description
TRUEnever evaluated
FALSEevaluated 76 times by 1 test
Evaluated by:
  • tst_ecmascripttests
0-76
296 return false;
never executed: return false;
0
297 if (trap->isNullOrUndefined())
trap->isNullOrUndefined()Description
TRUEevaluated 28 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 48 times by 1 test
Evaluated by:
  • tst_ecmascripttests
28-48
298 return target->defineOwnProperty(id, p, attrs);
executed 28 times by 1 test: return target->defineOwnProperty(id, p, attrs);
Executed by:
  • tst_ecmascripttests
28
299 if (!trap->isFunctionObject()) {
!trap->isFunctionObject()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 44 times by 1 test
Evaluated by:
  • tst_ecmascripttests
4-44
300 scope.engine->throwTypeError();-
301 return false;
executed 4 times by 1 test: return false;
Executed by:
  • tst_ecmascripttests
4
302 }-
303-
304 JSCallData cdata(scope, 3, nullptr, handler);-
305 cdata.args[0] = target;-
306 cdata.args[1] = id.isArrayIndex() ? Primitive::fromUInt32(id.asArrayIndex()).toString(scope.engine) : id.asStringOrSymbol();
id.isArrayIndex()Description
TRUEnever evaluated
FALSEevaluated 44 times by 1 test
Evaluated by:
  • tst_ecmascripttests
0-44
307 cdata.args[2] = ObjectPrototype::fromPropertyDescriptor(scope.engine, p, attrs);-
308-
309 ScopedValue trapResult(scope, static_cast<const FunctionObject *>(trap.ptr)->call(cdata));-
310 bool result = trapResult->toBoolean();-
311 if (!result)
!resultDescription
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 32 times by 1 test
Evaluated by:
  • tst_ecmascripttests
12-32
312 return false;
executed 12 times by 1 test: return false;
Executed by:
  • tst_ecmascripttests
12
313-
314 ScopedProperty targetDesc(scope);-
315 PropertyAttributes targetAttributes = target->getOwnProperty(id, targetDesc);-
316 bool extensibleTarget = target->isExtensible();-
317 bool settingConfigFalse = attrs.hasConfigurable() && !attrs.isConfigurable();
attrs.hasConfigurable()Description
TRUEevaluated 24 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_ecmascripttests
!attrs.isConfigurable()Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_ecmascripttests
8-24
318 if (targetAttributes == Attr_Invalid) {
targetAttribut...= Attr_InvalidDescription
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 20 times by 1 test
Evaluated by:
  • tst_ecmascripttests
12-20
319 if (!extensibleTarget || settingConfigFalse) {
!extensibleTargetDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_ecmascripttests
settingConfigFalseDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_ecmascripttests
4-8
320 scope.engine->throwTypeError();-
321 return false;
executed 8 times by 1 test: return false;
Executed by:
  • tst_ecmascripttests
8
322 }-
323 } else {
executed 4 times by 1 test: end of block
Executed by:
  • tst_ecmascripttests
4
324 // ###-
325 // if IsCompatiblePropertyDescriptor(extensibleTarget, Desc, targetDesc) is false throw a type error.-
326 if (settingConfigFalse && targetAttributes.isConfigurable()) {
settingConfigFalseDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_ecmascripttests
targetAttribut...Configurable()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_ecmascripttests
4-12
327 scope.engine->throwTypeError();-
328 return false;
executed 4 times by 1 test: return false;
Executed by:
  • tst_ecmascripttests
4
329 }-
330 }
executed 16 times by 1 test: end of block
Executed by:
  • tst_ecmascripttests
16
331-
332 return true;
executed 20 times by 1 test: return true;
Executed by:
  • tst_ecmascripttests
20
333}-
334-
335bool ProxyObject::virtualIsExtensible(const Managed *m)-
336{-
337 Scope scope(m);-
338 const ProxyObject *o = static_cast<const ProxyObject *>(m);-
339 if (!o->d()->handler)
!o->d()->handlerDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 80 times by 1 test
Evaluated by:
  • tst_ecmascripttests
4-80
340 return scope.engine->throwTypeError();
executed 4 times by 1 test: return scope.engine->throwTypeError();
Executed by:
  • tst_ecmascripttests
4
341-
342 ScopedObject target(scope, o->d()->target);-
343 Q_ASSERT(target);-
344 ScopedObject handler(scope, o->d()->handler);-
345 ScopedString hasProp(scope, scope.engine->newString(QStringLiteral("isExtensible")));
executed 80 times by 1 test: return qstring_literal_temp;
Executed by:
  • tst_ecmascripttests
80
346 ScopedValue trap(scope, handler->get(hasProp));-
347 if (scope.hasException())
scope.hasException()Description
TRUEnever evaluated
FALSEevaluated 80 times by 1 test
Evaluated by:
  • tst_ecmascripttests
0-80
348 return Encode::undefined();
never executed: return Encode::undefined();
0
349 if (trap->isNullOrUndefined())
trap->isNullOrUndefined()Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 68 times by 1 test
Evaluated by:
  • tst_ecmascripttests
12-68
350 return target->isExtensible();
executed 12 times by 1 test: return target->isExtensible();
Executed by:
  • tst_ecmascripttests
12
351 if (!trap->isFunctionObject())
!trap->isFunctionObject()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 64 times by 1 test
Evaluated by:
  • tst_ecmascripttests
4-64
352 return scope.engine->throwTypeError();
executed 4 times by 1 test: return scope.engine->throwTypeError();
Executed by:
  • tst_ecmascripttests
4
353-
354 JSCallData cdata(scope, 1, nullptr, handler);-
355 cdata.args[0] = target;-
356-
357 ScopedValue trapResult(scope, static_cast<const FunctionObject *>(trap.ptr)->call(cdata));-
358 bool result = trapResult->toBoolean();-
359 if (result != target->isExtensible()) {
result != targ...isExtensible()Description
TRUEevaluated 16 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 48 times by 1 test
Evaluated by:
  • tst_ecmascripttests
16-48
360 scope.engine->throwTypeError();-
361 return false;
executed 16 times by 1 test: return false;
Executed by:
  • tst_ecmascripttests
16
362 }-
363 return result;
executed 48 times by 1 test: return result;
Executed by:
  • tst_ecmascripttests
48
364}-
365-
366bool ProxyObject::virtualPreventExtensions(Managed *m)-
367{-
368 Scope scope(m);-
369 const ProxyObject *o = static_cast<const ProxyObject *>(m);-
370 if (!o->d()->handler)
!o->d()->handlerDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 52 times by 1 test
Evaluated by:
  • tst_ecmascripttests
4-52
371 return scope.engine->throwTypeError();
executed 4 times by 1 test: return scope.engine->throwTypeError();
Executed by:
  • tst_ecmascripttests
4
372-
373 ScopedObject target(scope, o->d()->target);-
374 Q_ASSERT(target);-
375 ScopedObject handler(scope, o->d()->handler);-
376 ScopedString hasProp(scope, scope.engine->newString(QStringLiteral("preventExtensions")));
executed 52 times by 1 test: return qstring_literal_temp;
Executed by:
  • tst_ecmascripttests
52
377 ScopedValue trap(scope, handler->get(hasProp));-
378 if (scope.hasException())
scope.hasException()Description
TRUEnever evaluated
FALSEevaluated 52 times by 1 test
Evaluated by:
  • tst_ecmascripttests
0-52
379 return Encode::undefined();
never executed: return Encode::undefined();
0
380 if (trap->isNullOrUndefined())
trap->isNullOrUndefined()Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 40 times by 1 test
Evaluated by:
  • tst_ecmascripttests
12-40
381 return target->preventExtensions();
executed 12 times by 1 test: return target->preventExtensions();
Executed by:
  • tst_ecmascripttests
12
382 if (!trap->isFunctionObject())
!trap->isFunctionObject()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 36 times by 1 test
Evaluated by:
  • tst_ecmascripttests
4-36
383 return scope.engine->throwTypeError();
executed 4 times by 1 test: return scope.engine->throwTypeError();
Executed by:
  • tst_ecmascripttests
4
384-
385 JSCallData cdata(scope, 1, nullptr, handler);-
386 cdata.args[0] = target;-
387-
388 ScopedValue trapResult(scope, static_cast<const FunctionObject *>(trap.ptr)->call(cdata));-
389 bool result = trapResult->toBoolean();-
390 if (result && target->isExtensible()) {
resultDescription
TRUEevaluated 16 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 20 times by 1 test
Evaluated by:
  • tst_ecmascripttests
target->isExtensible()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_ecmascripttests
4-20
391 scope.engine->throwTypeError();-
392 return false;
executed 4 times by 1 test: return false;
Executed by:
  • tst_ecmascripttests
4
393 }-
394 return result;
executed 32 times by 1 test: return result;
Executed by:
  • tst_ecmascripttests
32
395}-
396-
397Heap::Object *ProxyObject::virtualGetPrototypeOf(const Managed *m)-
398{-
399 Scope scope(m);-
400 const ProxyObject *o = static_cast<const ProxyObject *>(m);-
401 if (!o->d()->handler) {
!o->d()->handlerDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 75 times by 1 test
Evaluated by:
  • tst_ecmascripttests
4-75
402 scope.engine->throwTypeError();-
403 return nullptr;
executed 4 times by 1 test: return nullptr;
Executed by:
  • tst_ecmascripttests
4
404 }-
405-
406 ScopedObject target(scope, o->d()->target);-
407 Q_ASSERT(target);-
408 ScopedObject handler(scope, o->d()->handler);-
409 ScopedString name(scope, scope.engine->newString(QStringLiteral("getPrototypeOf")));
executed 75 times by 1 test: return qstring_literal_temp;
Executed by:
  • tst_ecmascripttests
75
410 ScopedValue trap(scope, handler->get(name));-
411 if (scope.hasException())
scope.hasException()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 71 times by 1 test
Evaluated by:
  • tst_ecmascripttests
4-71
412 return nullptr;
executed 4 times by 1 test: return nullptr;
Executed by:
  • tst_ecmascripttests
4
413 if (trap->isNullOrUndefined())
trap->isNullOrUndefined()Description
TRUEevaluated 16 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 55 times by 1 test
Evaluated by:
  • tst_ecmascripttests
16-55
414 return target->getPrototypeOf();
executed 16 times by 1 test: return target->getPrototypeOf();
Executed by:
  • tst_ecmascripttests
16
415 if (!trap->isFunctionObject()) {
!trap->isFunctionObject()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 52 times by 1 test
Evaluated by:
  • tst_ecmascripttests
4-52
416 scope.engine->throwTypeError();-
417 return nullptr;
executed 4 times by 1 test: return nullptr;
Executed by:
  • tst_ecmascripttests
4
418 }-
419-
420 JSCallData cdata(scope, 1, nullptr, handler);-
421 cdata.args[0] = target;-
422-
423 ScopedValue trapResult(scope, static_cast<const FunctionObject *>(trap.ptr)->call(cdata));-
424 if (!trapResult->isNull() && !trapResult->isObject()) {
!trapResult->isNull()Description
TRUEevaluated 51 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEnever evaluated
!trapResult->isObject()Description
TRUEevaluated 32 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 20 times by 1 test
Evaluated by:
  • tst_ecmascripttests
0-51
425 scope.engine->throwTypeError();-
426 return nullptr;
executed 32 times by 1 test: return nullptr;
Executed by:
  • tst_ecmascripttests
32
427 }-
428 Heap::Object *proto = trapResult->isNull() ? nullptr : static_cast<Heap::Object *>(trapResult->heapObject());
trapResult->isNull()Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • tst_ecmascripttests
0-20
429 if (!target->isExtensible()) {
!target->isExtensible()Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_ecmascripttests
8-12
430 Heap::Object *targetProto = target->getPrototypeOf();-
431 if (proto != targetProto) {
proto != targetProtoDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_ecmascripttests
4-8
432 scope.engine->throwTypeError();-
433 return nullptr;
executed 4 times by 1 test: return nullptr;
Executed by:
  • tst_ecmascripttests
4
434 }-
435 }
executed 8 times by 1 test: end of block
Executed by:
  • tst_ecmascripttests
8
436 return proto;
executed 16 times by 1 test: return proto;
Executed by:
  • tst_ecmascripttests
16
437}-
438-
439bool ProxyObject::virtualSetPrototypeOf(Managed *m, const Object *p)-
440{-
441 Scope scope(m);-
442 const ProxyObject *o = static_cast<const ProxyObject *>(m);-
443 if (!o->d()->handler) {
!o->d()->handlerDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 120 times by 1 test
Evaluated by:
  • tst_ecmascripttests
4-120
444 scope.engine->throwTypeError();-
445 return false;
executed 4 times by 1 test: return false;
Executed by:
  • tst_ecmascripttests
4
446 }-
447-
448 ScopedObject target(scope, o->d()->target);-
449 Q_ASSERT(target);-
450 ScopedObject handler(scope, o->d()->handler);-
451 ScopedString name(scope, scope.engine->newString(QStringLiteral("setPrototypeOf")));
executed 120 times by 1 test: return qstring_literal_temp;
Executed by:
  • tst_ecmascripttests
120
452 ScopedValue trap(scope, handler->get(name));-
453 if (scope.hasException())
scope.hasException()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 116 times by 1 test
Evaluated by:
  • tst_ecmascripttests
4-116
454 return false;
executed 4 times by 1 test: return false;
Executed by:
  • tst_ecmascripttests
4
455 if (trap->isNullOrUndefined())
trap->isNullOrUndefined()Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 108 times by 1 test
Evaluated by:
  • tst_ecmascripttests
8-108
456 return target->setPrototypeOf(p);
executed 8 times by 1 test: return target->setPrototypeOf(p);
Executed by:
  • tst_ecmascripttests
8
457 if (!trap->isFunctionObject()) {
!trap->isFunctionObject()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 104 times by 1 test
Evaluated by:
  • tst_ecmascripttests
4-104
458 scope.engine->throwTypeError();-
459 return false;
executed 4 times by 1 test: return false;
Executed by:
  • tst_ecmascripttests
4
460 }-
461-
462 JSCallData cdata(scope, 2, nullptr, handler);-
463 cdata.args[0] = target;-
464 cdata.args[1] = p ? p->asReturnedValue() : Encode::null();
pDescription
TRUEevaluated 100 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_ecmascripttests
4-100
465-
466 ScopedValue trapResult(scope, static_cast<const FunctionObject *>(trap.ptr)->call(cdata));-
467 bool result = trapResult->toBoolean();-
468 if (!result)
!resultDescription
TRUEevaluated 40 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 64 times by 1 test
Evaluated by:
  • tst_ecmascripttests
40-64
469 return false;
executed 40 times by 1 test: return false;
Executed by:
  • tst_ecmascripttests
40
470 if (!target->isExtensible()) {
!target->isExtensible()Description
TRUEevaluated 28 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 36 times by 1 test
Evaluated by:
  • tst_ecmascripttests
28-36
471 Heap::Object *targetProto = target->getPrototypeOf();-
472 if (p->d() != targetProto) {
p->d() != targetProtoDescription
TRUEevaluated 16 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_ecmascripttests
12-16
473 scope.engine->throwTypeError();-
474 return false;
executed 16 times by 1 test: return false;
Executed by:
  • tst_ecmascripttests
16
475 }-
476 }
executed 12 times by 1 test: end of block
Executed by:
  • tst_ecmascripttests
12
477 return true;
executed 48 times by 1 test: return true;
Executed by:
  • tst_ecmascripttests
48
478}-
479-
480//ReturnedValue ProxyObject::virtualCallAsConstructor(const FunctionObject *f, const Value *argv, int argc, const Value *)-
481//{-
482-
483//}-
484-
485//ReturnedValue ProxyObject::call(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc)-
486//{-
487-
488//}-
489-
490DEFINE_OBJECT_VTABLE(Proxy);-
491-
492void Heap::Proxy::init(QV4::ExecutionContext *ctx)-
493{-
494 Heap::FunctionObject::init(ctx, QStringLiteral("Proxy"));
executed 97881 times by 153 tests: return qstring_literal_temp;
Executed by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_ecmascripttests
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_parserstress
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugclient
  • tst_qqmldebugjs
  • tst_qqmldebuglocal
  • tst_qqmldebugservice
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • ...
97881
495-
496 Scope scope(ctx);-
497 Scoped<QV4::Proxy> ctor(scope, this);-
498 ctor->defineDefaultProperty(QStringLiteral("revocable"), QV4::Proxy::method_revocable, 2);
executed 98427 times by 153 tests: return qstring_literal_temp;
Executed by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_ecmascripttests
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_parserstress
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugclient
  • tst_qqmldebugjs
  • tst_qqmldebuglocal
  • tst_qqmldebugservice
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • ...
98427
499 ctor->defineReadonlyConfigurableProperty(scope.engine->id_length(), Primitive::fromInt32(2));-
500}
executed 98523 times by 153 tests: end of block
Executed by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_ecmascripttests
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_parserstress
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugclient
  • tst_qqmldebugjs
  • tst_qqmldebuglocal
  • tst_qqmldebugservice
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • ...
98523
501-
502ReturnedValue Proxy::virtualCallAsConstructor(const FunctionObject *f, const Value *argv, int argc, const Value *)-
503{-
504 Scope scope(f);-
505 if (argc < 2 || !argv[0].isObject() || !argv[1].isObject())
argc < 2Description
TRUEnever evaluated
FALSEevaluated 1208 times by 1 test
Evaluated by:
  • tst_ecmascripttests
!argv[0].isObject()Description
TRUEevaluated 24 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 1183 times by 1 test
Evaluated by:
  • tst_ecmascripttests
!argv[1].isObject()Description
TRUEevaluated 24 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 1161 times by 1 test
Evaluated by:
  • tst_ecmascripttests
0-1208
506 return scope.engine->throwTypeError();
executed 48 times by 1 test: return scope.engine->throwTypeError();
Executed by:
  • tst_ecmascripttests
48
507-
508 const Object *target = static_cast<const Object *>(argv);-
509 const Object *handler = static_cast<const Object *>(argv + 1);-
510 if (const ProxyObject *ptarget = target->as<ProxyObject>())
const ProxyObj...ProxyObject>()Description
TRUEevaluated 80 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 1081 times by 1 test
Evaluated by:
  • tst_ecmascripttests
80-1081
511 if (!ptarget->d()->handler)
!ptarget->d()->handlerDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 76 times by 1 test
Evaluated by:
  • tst_ecmascripttests
4-76
512 return scope.engine->throwTypeError();
executed 4 times by 1 test: return scope.engine->throwTypeError();
Executed by:
  • tst_ecmascripttests
4
513 if (const ProxyObject *phandler = handler->as<ProxyObject>())
const ProxyObj...ProxyObject>()Description
TRUEevaluated 16 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 1146 times by 1 test
Evaluated by:
  • tst_ecmascripttests
16-1146
514 if (!phandler->d()->handler)
!phandler->d()->handlerDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_ecmascripttests
4-12
515 return scope.engine->throwTypeError();
executed 4 times by 1 test: return scope.engine->throwTypeError();
Executed by:
  • tst_ecmascripttests
4
516-
517 ScopedObject o(scope, scope.engine->memoryManager->allocate<ProxyObject>(target, handler));-
518 return o->asReturnedValue();
executed 1148 times by 1 test: return o->asReturnedValue();
Executed by:
  • tst_ecmascripttests
1148
519}-
520-
521ReturnedValue Proxy::virtualCall(const FunctionObject *f, const Value *, const Value *, int)-
522{-
523 return f->engine()->throwTypeError();
executed 4 times by 1 test: return f->engine()->throwTypeError();
Executed by:
  • tst_ecmascripttests
4
524}-
525-
526ReturnedValue Proxy::method_revocable(const FunctionObject *f, const Value *, const Value *argv, int argc)-
527{-
528 Scope scope(f);-
529 ScopedObject proxy(scope, Proxy::virtualCallAsConstructor(f, argv, argc, f));-
530 if (scope.hasException())
scope.hasException()Description
TRUEnever evaluated
FALSEevaluated 149 times by 1 test
Evaluated by:
  • tst_ecmascripttests
0-149
531 return Encode::undefined();
never executed: return Encode::undefined();
0
532-
533 ScopedString revoke(scope, scope.engine->newString(QStringLiteral("revoke")));
executed 149 times by 1 test: return qstring_literal_temp;
Executed by:
  • tst_ecmascripttests
149
534 ScopedFunctionObject revoker(scope, createBuiltinFunction(scope.engine, revoke, method_revoke, 0));-
535 revoker->defineDefaultProperty(scope.engine->symbol_revokableProxy(), proxy);-
536-
537 ScopedObject o(scope, scope.engine->newObject());-
538 ScopedString p(scope, scope.engine->newString(QStringLiteral("proxy")));
executed 150 times by 1 test: return qstring_literal_temp;
Executed by:
  • tst_ecmascripttests
150
539 o->defineDefaultProperty(p, proxy);-
540 o->defineDefaultProperty(revoke, revoker);-
541 return o->asReturnedValue();
executed 150 times by 1 test: return o->asReturnedValue();
Executed by:
  • tst_ecmascripttests
150
542}-
543-
544ReturnedValue Proxy::method_revoke(const FunctionObject *f, const Value *, const Value *, int)-
545{-
546 Scope scope(f);-
547 Scoped<ProxyObject> proxy(scope, f->get(scope.engine->symbol_revokableProxy()));-
548 Q_ASSERT(proxy);-
549-
550 proxy->d()->target.set(scope.engine, nullptr);-
551 proxy->d()->handler.set(scope.engine, nullptr);-
552 return Encode::undefined();
executed 118 times by 1 test: return Encode::undefined();
Executed by:
  • tst_ecmascripttests
118
553}-
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.2.0