| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/jsruntime/qv4proxy.cpp |
| Source code | Switch to Preprocessed file |
| Line | Source | Count | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 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 | - | |||||||||||||||||||
| 46 | using namespace QV4; | - | ||||||||||||||||||
| 47 | - | |||||||||||||||||||
| 48 | DEFINE_OBJECT_VTABLE(ProxyObject); | - | ||||||||||||||||||
| 49 | - | |||||||||||||||||||
| 50 | void 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 blockExecuted by:
| 1148 | ||||||||||||||||||
| 57 | - | |||||||||||||||||||
| 58 | ReturnedValue 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)
| 38-365 | ||||||||||||||||||
| 63 | return scope.engine->throwTypeError(); executed 38 times by 1 test: return scope.engine->throwTypeError();Executed by:
| 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())
| 0-366 | ||||||||||||||||||
| 70 | return Encode::undefined(); never executed: return Encode::undefined(); | 0 | ||||||||||||||||||
| 71 | if (trap->isNullOrUndefined())
| 176-190 | ||||||||||||||||||
| 72 | return target->get(id, receiver, hasProperty); executed 190 times by 1 test: return target->get(id, receiver, hasProperty);Executed by:
| 190 | ||||||||||||||||||
| 73 | if (!trap->isFunctionObject())
| 8-168 | ||||||||||||||||||
| 74 | return scope.engine->throwTypeError(); executed 8 times by 1 test: return scope.engine->throwTypeError();Executed by:
| 8 | ||||||||||||||||||
| 75 | if (hasProperty)
| 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()) {
| 48-108 | ||||||||||||||||||
| 87 | if (attributes.isData() && !attributes.isWritable()) {
| 16-44 | ||||||||||||||||||
| 88 | if (!trapResult->sameValue(targetDesc->value))
| 8 | ||||||||||||||||||
| 89 | return scope.engine->throwTypeError(); executed 8 times by 1 test: return scope.engine->throwTypeError();Executed by:
| 8 | ||||||||||||||||||
| 90 | } executed 8 times by 1 test: end of blockExecuted by:
| 8 | ||||||||||||||||||
| 91 | if (attributes.isAccessor() && targetDesc->value.isUndefined()) {
| 8-36 | ||||||||||||||||||
| 92 | if (!trapResult->isUndefined())
| 0-8 | ||||||||||||||||||
| 93 | return scope.engine->throwTypeError(); executed 8 times by 1 test: return scope.engine->throwTypeError();Executed by:
| 8 | ||||||||||||||||||
| 94 | } never executed: end of block | 0 | ||||||||||||||||||
| 95 | } executed 44 times by 1 test: end of blockExecuted by:
| 44 | ||||||||||||||||||
| 96 | return trapResult->asReturnedValue(); executed 152 times by 1 test: return trapResult->asReturnedValue();Executed by:
| 152 | ||||||||||||||||||
| 97 | } | - | ||||||||||||||||||
| 98 | - | |||||||||||||||||||
| 99 | bool 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)
| 12-111 | ||||||||||||||||||
| 104 | return scope.engine->throwTypeError(); executed 12 times by 1 test: return scope.engine->throwTypeError();Executed by:
| 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())
| 0-112 | ||||||||||||||||||
| 111 | return Encode::undefined(); never executed: return Encode::undefined(); | 0 | ||||||||||||||||||
| 112 | if (trap->isNullOrUndefined())
| 40-72 | ||||||||||||||||||
| 113 | return target->put(id, value, receiver); executed 40 times by 1 test: return target->put(id, value, receiver);Executed by:
| 40 | ||||||||||||||||||
| 114 | if (!trap->isFunctionObject())
| 8-63 | ||||||||||||||||||
| 115 | return scope.engine->throwTypeError(); executed 8 times by 1 test: return scope.engine->throwTypeError();Executed by:
| 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())
| 28-35 | ||||||||||||||||||
| 125 | return false; executed 28 times by 1 test: return false;Executed by:
| 28 | ||||||||||||||||||
| 126 | ScopedProperty targetDesc(scope); | - | ||||||||||||||||||
| 127 | PropertyAttributes attributes = target->getOwnProperty(id, targetDesc); | - | ||||||||||||||||||
| 128 | if (attributes != Attr_Invalid && !attributes.isConfigurable()) {
| 0-36 | ||||||||||||||||||
| 129 | if (attributes.isData() && !attributes.isWritable()) {
| 4-12 | ||||||||||||||||||
| 130 | if (!value.sameValue(targetDesc->value))
| 0-8 | ||||||||||||||||||
| 131 | return scope.engine->throwTypeError(); executed 8 times by 1 test: return scope.engine->throwTypeError();Executed by:
| 8 | ||||||||||||||||||
| 132 | } never executed: end of block | 0 | ||||||||||||||||||
| 133 | if (attributes.isAccessor() && targetDesc->set.isUndefined())
| 4-12 | ||||||||||||||||||
| 134 | return scope.engine->throwTypeError(); executed 8 times by 1 test: return scope.engine->throwTypeError();Executed by:
| 8 | ||||||||||||||||||
| 135 | } executed 8 times by 1 test: end of blockExecuted by:
| 8 | ||||||||||||||||||
| 136 | return true; executed 20 times by 1 test: return true;Executed by:
| 20 | ||||||||||||||||||
| 137 | } | - | ||||||||||||||||||
| 138 | - | |||||||||||||||||||
| 139 | bool 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)
| 4-60 | ||||||||||||||||||
| 144 | return scope.engine->throwTypeError(); executed 4 times by 1 test: return scope.engine->throwTypeError();Executed by:
| 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:
| 60 | ||||||||||||||||||
| 150 | ScopedValue trap(scope, handler->get(deleteProp)); | - | ||||||||||||||||||
| 151 | if (scope.hasException())
| 0-60 | ||||||||||||||||||
| 152 | return Encode::undefined(); never executed: return Encode::undefined(); | 0 | ||||||||||||||||||
| 153 | if (trap->isNullOrUndefined())
| 12-48 | ||||||||||||||||||
| 154 | return target->deleteProperty(id); executed 12 times by 1 test: return target->deleteProperty(id);Executed by:
| 12 | ||||||||||||||||||
| 155 | if (!trap->isFunctionObject())
| 4-44 | ||||||||||||||||||
| 156 | return scope.engine->throwTypeError(); executed 4 times by 1 test: return scope.engine->throwTypeError();Executed by:
| 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())
| 16-28 | ||||||||||||||||||
| 165 | return false; executed 28 times by 1 test: return false;Executed by:
| 28 | ||||||||||||||||||
| 166 | ScopedProperty targetDesc(scope); | - | ||||||||||||||||||
| 167 | PropertyAttributes attributes = target->getOwnProperty(id, targetDesc); | - | ||||||||||||||||||
| 168 | if (attributes == Attr_Invalid)
| 4-12 | ||||||||||||||||||
| 169 | return true; executed 12 times by 1 test: return true;Executed by:
| 12 | ||||||||||||||||||
| 170 | if (!attributes.isConfigurable())
| 0-4 | ||||||||||||||||||
| 171 | return scope.engine->throwTypeError(); executed 4 times by 1 test: return scope.engine->throwTypeError();Executed by:
| 4 | ||||||||||||||||||
| 172 | return true; never executed: return true; | 0 | ||||||||||||||||||
| 173 | } | - | ||||||||||||||||||
| 174 | - | |||||||||||||||||||
| 175 | bool 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)
| 4-40 | ||||||||||||||||||
| 180 | return scope.engine->throwTypeError(); executed 4 times by 1 test: return scope.engine->throwTypeError();Executed by:
| 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:
| 40 | ||||||||||||||||||
| 186 | ScopedValue trap(scope, handler->get(hasProp)); | - | ||||||||||||||||||
| 187 | if (scope.hasException())
| 0-40 | ||||||||||||||||||
| 188 | return Encode::undefined(); never executed: return Encode::undefined(); | 0 | ||||||||||||||||||
| 189 | if (trap->isNullOrUndefined())
| 8-32 | ||||||||||||||||||
| 190 | return target->hasProperty(id); executed 8 times by 1 test: return target->hasProperty(id);Executed by:
| 8 | ||||||||||||||||||
| 191 | if (!trap->isFunctionObject())
| 4-28 | ||||||||||||||||||
| 192 | return scope.engine->throwTypeError(); executed 4 times by 1 test: return scope.engine->throwTypeError();Executed by:
| 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();
| 0-28 | ||||||||||||||||||
| 197 | - | |||||||||||||||||||
| 198 | ScopedValue trapResult(scope, static_cast<const FunctionObject *>(trap.ptr)->call(cdata)); | - | ||||||||||||||||||
| 199 | bool result = trapResult->toBoolean(); | - | ||||||||||||||||||
| 200 | if (!result) {
| 8-20 | ||||||||||||||||||
| 201 | ScopedProperty targetDesc(scope); | - | ||||||||||||||||||
| 202 | PropertyAttributes attributes = target->getOwnProperty(id, targetDesc); | - | ||||||||||||||||||
| 203 | if (attributes != Attr_Invalid) {
| 8-12 | ||||||||||||||||||
| 204 | if (!attributes.isConfigurable() || !target->isExtensible())
| 4-8 | ||||||||||||||||||
| 205 | return scope.engine->throwTypeError(); executed 8 times by 1 test: return scope.engine->throwTypeError();Executed by:
| 8 | ||||||||||||||||||
| 206 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||
| 207 | } executed 12 times by 1 test: end of blockExecuted by:
| 12 | ||||||||||||||||||
| 208 | return result; executed 20 times by 1 test: return result;Executed by:
| 20 | ||||||||||||||||||
| 209 | } | - | ||||||||||||||||||
| 210 | - | |||||||||||||||||||
| 211 | PropertyAttributes 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) {
| 4-96 | ||||||||||||||||||
| 216 | scope.engine->throwTypeError(); | - | ||||||||||||||||||
| 217 | return Attr_Invalid; executed 4 times by 1 test: return Attr_Invalid;Executed by:
| 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:
| 96 | ||||||||||||||||||
| 224 | ScopedValue trap(scope, handler->get(deleteProp)); | - | ||||||||||||||||||
| 225 | if (scope.hasException())
| 0-96 | ||||||||||||||||||
| 226 | return Attr_Invalid; never executed: return Attr_Invalid; | 0 | ||||||||||||||||||
| 227 | if (trap->isNullOrUndefined())
| 24-72 | ||||||||||||||||||
| 228 | return target->getOwnProperty(id, p); executed 24 times by 1 test: return target->getOwnProperty(id, p);Executed by:
| 24 | ||||||||||||||||||
| 229 | if (!trap->isFunctionObject()) {
| 4-68 | ||||||||||||||||||
| 230 | scope.engine->throwTypeError(); | - | ||||||||||||||||||
| 231 | return Attr_Invalid; executed 4 times by 1 test: return Attr_Invalid;Executed by:
| 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();
| 0-68 | ||||||||||||||||||
| 237 | - | |||||||||||||||||||
| 238 | ScopedValue trapResult(scope, static_cast<const FunctionObject *>(trap.ptr)->call(cdata)); | - | ||||||||||||||||||
| 239 | if (!trapResult->isObject() && !trapResult->isUndefined()) {
| 16-44 | ||||||||||||||||||
| 240 | scope.engine->throwTypeError(); | - | ||||||||||||||||||
| 241 | return Attr_Invalid; executed 16 times by 1 test: return Attr_Invalid;Executed by:
| 16 | ||||||||||||||||||
| 242 | } | - | ||||||||||||||||||
| 243 | - | |||||||||||||||||||
| 244 | ScopedProperty targetDesc(scope); | - | ||||||||||||||||||
| 245 | PropertyAttributes targetAttributes = target->getOwnProperty(id, targetDesc); | - | ||||||||||||||||||
| 246 | if (trapResult->isUndefined()) {
| 24-28 | ||||||||||||||||||
| 247 | p->value = Encode::undefined(); | - | ||||||||||||||||||
| 248 | if (targetAttributes == Attr_Invalid) {
| 12-16 | ||||||||||||||||||
| 249 | p->value = Encode::undefined(); | - | ||||||||||||||||||
| 250 | return Attr_Invalid; executed 12 times by 1 test: return Attr_Invalid;Executed by:
| 12 | ||||||||||||||||||
| 251 | } | - | ||||||||||||||||||
| 252 | if (!targetAttributes.isConfigurable() || !target->isExtensible()) {
| 4-12 | ||||||||||||||||||
| 253 | scope.engine->throwTypeError(); | - | ||||||||||||||||||
| 254 | return Attr_Invalid; executed 8 times by 1 test: return Attr_Invalid;Executed by:
| 8 | ||||||||||||||||||
| 255 | } | - | ||||||||||||||||||
| 256 | return Attr_Invalid; executed 8 times by 1 test: return Attr_Invalid;Executed by:
| 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()) {
| 8-16 | ||||||||||||||||||
| 270 | if (targetAttributes == Attr_Invalid || !targetAttributes.isConfigurable()) {
| 4-12 | ||||||||||||||||||
| 271 | scope.engine->throwTypeError(); | - | ||||||||||||||||||
| 272 | return Attr_Invalid; executed 8 times by 1 test: return Attr_Invalid;Executed by:
| 8 | ||||||||||||||||||
| 273 | } | - | ||||||||||||||||||
| 274 | } executed 8 times by 1 test: end of blockExecuted by:
| 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:
| 16 | ||||||||||||||||||
| 279 | } | - | ||||||||||||||||||
| 280 | - | |||||||||||||||||||
| 281 | bool 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) {
| 4-76 | ||||||||||||||||||
| 286 | scope.engine->throwTypeError(); | - | ||||||||||||||||||
| 287 | return false; executed 4 times by 1 test: return false;Executed by:
| 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:
| 76 | ||||||||||||||||||
| 294 | ScopedValue trap(scope, handler->get(prop)); | - | ||||||||||||||||||
| 295 | if (scope.hasException())
| 0-76 | ||||||||||||||||||
| 296 | return false; never executed: return false; | 0 | ||||||||||||||||||
| 297 | if (trap->isNullOrUndefined())
| 28-48 | ||||||||||||||||||
| 298 | return target->defineOwnProperty(id, p, attrs); executed 28 times by 1 test: return target->defineOwnProperty(id, p, attrs);Executed by:
| 28 | ||||||||||||||||||
| 299 | if (!trap->isFunctionObject()) {
| 4-44 | ||||||||||||||||||
| 300 | scope.engine->throwTypeError(); | - | ||||||||||||||||||
| 301 | return false; executed 4 times by 1 test: return false;Executed by:
| 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();
| 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)
| 12-32 | ||||||||||||||||||
| 312 | return false; executed 12 times by 1 test: return false;Executed by:
| 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();
| 8-24 | ||||||||||||||||||
| 318 | if (targetAttributes == Attr_Invalid) {
| 12-20 | ||||||||||||||||||
| 319 | if (!extensibleTarget || settingConfigFalse) {
| 4-8 | ||||||||||||||||||
| 320 | scope.engine->throwTypeError(); | - | ||||||||||||||||||
| 321 | return false; executed 8 times by 1 test: return false;Executed by:
| 8 | ||||||||||||||||||
| 322 | } | - | ||||||||||||||||||
| 323 | } else { executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||
| 324 | // ### | - | ||||||||||||||||||
| 325 | // if IsCompatiblePropertyDescriptor(extensibleTarget, Desc, targetDesc) is false throw a type error. | - | ||||||||||||||||||
| 326 | if (settingConfigFalse && targetAttributes.isConfigurable()) {
| 4-12 | ||||||||||||||||||
| 327 | scope.engine->throwTypeError(); | - | ||||||||||||||||||
| 328 | return false; executed 4 times by 1 test: return false;Executed by:
| 4 | ||||||||||||||||||
| 329 | } | - | ||||||||||||||||||
| 330 | } executed 16 times by 1 test: end of blockExecuted by:
| 16 | ||||||||||||||||||
| 331 | - | |||||||||||||||||||
| 332 | return true; executed 20 times by 1 test: return true;Executed by:
| 20 | ||||||||||||||||||
| 333 | } | - | ||||||||||||||||||
| 334 | - | |||||||||||||||||||
| 335 | bool ProxyObject::virtualIsExtensible(const Managed *m) | - | ||||||||||||||||||
| 336 | { | - | ||||||||||||||||||
| 337 | Scope scope(m); | - | ||||||||||||||||||
| 338 | const ProxyObject *o = static_cast<const ProxyObject *>(m); | - | ||||||||||||||||||
| 339 | if (!o->d()->handler)
| 4-80 | ||||||||||||||||||
| 340 | return scope.engine->throwTypeError(); executed 4 times by 1 test: return scope.engine->throwTypeError();Executed by:
| 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:
| 80 | ||||||||||||||||||
| 346 | ScopedValue trap(scope, handler->get(hasProp)); | - | ||||||||||||||||||
| 347 | if (scope.hasException())
| 0-80 | ||||||||||||||||||
| 348 | return Encode::undefined(); never executed: return Encode::undefined(); | 0 | ||||||||||||||||||
| 349 | if (trap->isNullOrUndefined())
| 12-68 | ||||||||||||||||||
| 350 | return target->isExtensible(); executed 12 times by 1 test: return target->isExtensible();Executed by:
| 12 | ||||||||||||||||||
| 351 | if (!trap->isFunctionObject())
| 4-64 | ||||||||||||||||||
| 352 | return scope.engine->throwTypeError(); executed 4 times by 1 test: return scope.engine->throwTypeError();Executed by:
| 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()) {
| 16-48 | ||||||||||||||||||
| 360 | scope.engine->throwTypeError(); | - | ||||||||||||||||||
| 361 | return false; executed 16 times by 1 test: return false;Executed by:
| 16 | ||||||||||||||||||
| 362 | } | - | ||||||||||||||||||
| 363 | return result; executed 48 times by 1 test: return result;Executed by:
| 48 | ||||||||||||||||||
| 364 | } | - | ||||||||||||||||||
| 365 | - | |||||||||||||||||||
| 366 | bool ProxyObject::virtualPreventExtensions(Managed *m) | - | ||||||||||||||||||
| 367 | { | - | ||||||||||||||||||
| 368 | Scope scope(m); | - | ||||||||||||||||||
| 369 | const ProxyObject *o = static_cast<const ProxyObject *>(m); | - | ||||||||||||||||||
| 370 | if (!o->d()->handler)
| 4-52 | ||||||||||||||||||
| 371 | return scope.engine->throwTypeError(); executed 4 times by 1 test: return scope.engine->throwTypeError();Executed by:
| 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:
| 52 | ||||||||||||||||||
| 377 | ScopedValue trap(scope, handler->get(hasProp)); | - | ||||||||||||||||||
| 378 | if (scope.hasException())
| 0-52 | ||||||||||||||||||
| 379 | return Encode::undefined(); never executed: return Encode::undefined(); | 0 | ||||||||||||||||||
| 380 | if (trap->isNullOrUndefined())
| 12-40 | ||||||||||||||||||
| 381 | return target->preventExtensions(); executed 12 times by 1 test: return target->preventExtensions();Executed by:
| 12 | ||||||||||||||||||
| 382 | if (!trap->isFunctionObject())
| 4-36 | ||||||||||||||||||
| 383 | return scope.engine->throwTypeError(); executed 4 times by 1 test: return scope.engine->throwTypeError();Executed by:
| 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()) {
| 4-20 | ||||||||||||||||||
| 391 | scope.engine->throwTypeError(); | - | ||||||||||||||||||
| 392 | return false; executed 4 times by 1 test: return false;Executed by:
| 4 | ||||||||||||||||||
| 393 | } | - | ||||||||||||||||||
| 394 | return result; executed 32 times by 1 test: return result;Executed by:
| 32 | ||||||||||||||||||
| 395 | } | - | ||||||||||||||||||
| 396 | - | |||||||||||||||||||
| 397 | Heap::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) {
| 4-75 | ||||||||||||||||||
| 402 | scope.engine->throwTypeError(); | - | ||||||||||||||||||
| 403 | return nullptr; executed 4 times by 1 test: return nullptr;Executed by:
| 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:
| 75 | ||||||||||||||||||
| 410 | ScopedValue trap(scope, handler->get(name)); | - | ||||||||||||||||||
| 411 | if (scope.hasException())
| 4-71 | ||||||||||||||||||
| 412 | return nullptr; executed 4 times by 1 test: return nullptr;Executed by:
| 4 | ||||||||||||||||||
| 413 | if (trap->isNullOrUndefined())
| 16-55 | ||||||||||||||||||
| 414 | return target->getPrototypeOf(); executed 16 times by 1 test: return target->getPrototypeOf();Executed by:
| 16 | ||||||||||||||||||
| 415 | if (!trap->isFunctionObject()) {
| 4-52 | ||||||||||||||||||
| 416 | scope.engine->throwTypeError(); | - | ||||||||||||||||||
| 417 | return nullptr; executed 4 times by 1 test: return nullptr;Executed by:
| 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()) {
| 0-51 | ||||||||||||||||||
| 425 | scope.engine->throwTypeError(); | - | ||||||||||||||||||
| 426 | return nullptr; executed 32 times by 1 test: return nullptr;Executed by:
| 32 | ||||||||||||||||||
| 427 | } | - | ||||||||||||||||||
| 428 | Heap::Object *proto = trapResult->isNull() ? nullptr : static_cast<Heap::Object *>(trapResult->heapObject());
| 0-20 | ||||||||||||||||||
| 429 | if (!target->isExtensible()) {
| 8-12 | ||||||||||||||||||
| 430 | Heap::Object *targetProto = target->getPrototypeOf(); | - | ||||||||||||||||||
| 431 | if (proto != targetProto) {
| 4-8 | ||||||||||||||||||
| 432 | scope.engine->throwTypeError(); | - | ||||||||||||||||||
| 433 | return nullptr; executed 4 times by 1 test: return nullptr;Executed by:
| 4 | ||||||||||||||||||
| 434 | } | - | ||||||||||||||||||
| 435 | } executed 8 times by 1 test: end of blockExecuted by:
| 8 | ||||||||||||||||||
| 436 | return proto; executed 16 times by 1 test: return proto;Executed by:
| 16 | ||||||||||||||||||
| 437 | } | - | ||||||||||||||||||
| 438 | - | |||||||||||||||||||
| 439 | bool 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) {
| 4-120 | ||||||||||||||||||
| 444 | scope.engine->throwTypeError(); | - | ||||||||||||||||||
| 445 | return false; executed 4 times by 1 test: return false;Executed by:
| 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:
| 120 | ||||||||||||||||||
| 452 | ScopedValue trap(scope, handler->get(name)); | - | ||||||||||||||||||
| 453 | if (scope.hasException())
| 4-116 | ||||||||||||||||||
| 454 | return false; executed 4 times by 1 test: return false;Executed by:
| 4 | ||||||||||||||||||
| 455 | if (trap->isNullOrUndefined())
| 8-108 | ||||||||||||||||||
| 456 | return target->setPrototypeOf(p); executed 8 times by 1 test: return target->setPrototypeOf(p);Executed by:
| 8 | ||||||||||||||||||
| 457 | if (!trap->isFunctionObject()) {
| 4-104 | ||||||||||||||||||
| 458 | scope.engine->throwTypeError(); | - | ||||||||||||||||||
| 459 | return false; executed 4 times by 1 test: return false;Executed by:
| 4 | ||||||||||||||||||
| 460 | } | - | ||||||||||||||||||
| 461 | - | |||||||||||||||||||
| 462 | JSCallData cdata(scope, 2, nullptr, handler); | - | ||||||||||||||||||
| 463 | cdata.args[0] = target; | - | ||||||||||||||||||
| 464 | cdata.args[1] = p ? p->asReturnedValue() : Encode::null();
| 4-100 | ||||||||||||||||||
| 465 | - | |||||||||||||||||||
| 466 | ScopedValue trapResult(scope, static_cast<const FunctionObject *>(trap.ptr)->call(cdata)); | - | ||||||||||||||||||
| 467 | bool result = trapResult->toBoolean(); | - | ||||||||||||||||||
| 468 | if (!result)
| 40-64 | ||||||||||||||||||
| 469 | return false; executed 40 times by 1 test: return false;Executed by:
| 40 | ||||||||||||||||||
| 470 | if (!target->isExtensible()) {
| 28-36 | ||||||||||||||||||
| 471 | Heap::Object *targetProto = target->getPrototypeOf(); | - | ||||||||||||||||||
| 472 | if (p->d() != targetProto) {
| 12-16 | ||||||||||||||||||
| 473 | scope.engine->throwTypeError(); | - | ||||||||||||||||||
| 474 | return false; executed 16 times by 1 test: return false;Executed by:
| 16 | ||||||||||||||||||
| 475 | } | - | ||||||||||||||||||
| 476 | } executed 12 times by 1 test: end of blockExecuted by:
| 12 | ||||||||||||||||||
| 477 | return true; executed 48 times by 1 test: return true;Executed by:
| 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 | - | |||||||||||||||||||
| 490 | DEFINE_OBJECT_VTABLE(Proxy); | - | ||||||||||||||||||
| 491 | - | |||||||||||||||||||
| 492 | void 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:
| 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:
| 98427 | ||||||||||||||||||
| 499 | ctor->defineReadonlyConfigurableProperty(scope.engine->id_length(), Primitive::fromInt32(2)); | - | ||||||||||||||||||
| 500 | } executed 98523 times by 153 tests: end of blockExecuted by:
| 98523 | ||||||||||||||||||
| 501 | - | |||||||||||||||||||
| 502 | ReturnedValue 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())
| 0-1208 | ||||||||||||||||||
| 506 | return scope.engine->throwTypeError(); executed 48 times by 1 test: return scope.engine->throwTypeError();Executed by:
| 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>())
| 80-1081 | ||||||||||||||||||
| 511 | if (!ptarget->d()->handler)
| 4-76 | ||||||||||||||||||
| 512 | return scope.engine->throwTypeError(); executed 4 times by 1 test: return scope.engine->throwTypeError();Executed by:
| 4 | ||||||||||||||||||
| 513 | if (const ProxyObject *phandler = handler->as<ProxyObject>())
| 16-1146 | ||||||||||||||||||
| 514 | if (!phandler->d()->handler)
| 4-12 | ||||||||||||||||||
| 515 | return scope.engine->throwTypeError(); executed 4 times by 1 test: return scope.engine->throwTypeError();Executed by:
| 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:
| 1148 | ||||||||||||||||||
| 519 | } | - | ||||||||||||||||||
| 520 | - | |||||||||||||||||||
| 521 | ReturnedValue 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:
| 4 | ||||||||||||||||||
| 524 | } | - | ||||||||||||||||||
| 525 | - | |||||||||||||||||||
| 526 | ReturnedValue 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())
| 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:
| 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:
| 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:
| 150 | ||||||||||||||||||
| 542 | } | - | ||||||||||||||||||
| 543 | - | |||||||||||||||||||
| 544 | ReturnedValue 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:
| 118 | ||||||||||||||||||
| 553 | } | - | ||||||||||||||||||
| Source code | Switch to Preprocessed file |