Showing the changes to libraries/script-engine/src/v8/ScriptObjectV8Proxy.cpp (1 of 6 files). Show all
Unified · Split
| @@ -32,7 +32,7 @@ Q_DECLARE_METATYPE(QSharedPointer<ScriptVariantV8Proxy>) · 31 unmodified lines | ||
| 32 | 32 | // Value of internal field with index 0 when object contains ScriptObjectV8Proxy pointer in internal field 1 |
| 33 | 33 | static const void *internalPointsToQObjectProxy = (void *)0x13370000; |
| 34 | 34 | static const void *internalPointsToQVariantProxy = (void *)0x13371000; |
| 35 | −static const void *internalPointsToSignalProxy = (void *)0x13372000; | |
| 35 | +//static const void *internalPointsToSignalProxy = (void *)0x13372000; | |
| 36 | 36 | static const void *internalPointsToMethodProxy = (void *)0x13373000; |
| 37 | 37 | |
| 38 | 38 | // Used strictly to replace the "this" object value for property access. May expand to a full context element |
| @@ -328,7 +328,7 @@ QString ScriptObjectV8Proxy::name() const { · 289 unmodified lines | ||
| 328 | 328 | ScriptObjectV8Proxy::QueryFlags ScriptObjectV8Proxy::queryProperty(const V8ScriptValue& object, const V8ScriptString& name, QueryFlags flags, uint* id) { |
| 329 | 329 | v8::HandleScope handleScope(_engine->getIsolate()); |
| 330 | 330 | // V8TODO: this might be inefficient when there's large number of properties |
| 331 | − v8::Local<v8::Context> context = _engine->getContext(); | |
| 331 | + //v8::Local<v8::Context> context = _engine->getContext(); | |
| 332 | 332 | v8::String::Utf8Value nameStr(_engine->getIsolate(), name.constGet()); |
| 333 | 333 | |
| 334 | 334 | // check for methods |
| @@ -473,7 +473,7 @@ V8ScriptValue ScriptObjectV8Proxy::property(const V8ScriptValue& object, const V · 138 unmodified lines | ||
| 473 | 473 | qDebug(scriptengine) << "Method with QMetaType::UnknownType " << metaObject->className() << " " << (*iter).name(); |
| 474 | 474 | } |
| 475 | 475 | } //V8TODO: is new method created during every call? It needs to be cached instead |
| 476 | − bool isMethodDefined = false; | |
| 476 | + //bool isMethodDefined = false; | |
| 477 | 477 | v8::Local<v8::Value> property; |
| 478 | 478 | if(_v8Object.Get(_engine->getIsolate())->GetInternalField(2).As<v8::Object>()->Get(_engine->getContext(), name.constGet()).ToLocal(&property)) { |
| 479 | 479 | if (!property->IsUndefined()) { |
| @@ -1140,14 +1140,24 @@ void ScriptSignalV8Proxy::connect(ScriptValue arg0, ScriptValue arg1) { · 660 unmodified lines | ||
| 1140 | 1140 | bool foundIt = false; |
| 1141 | 1141 | for (int idx = 0; idx < length && !foundIt; ++idx) { |
| 1142 | 1142 | v8::Local<v8::Value> entry = destArray->Get(destFunctionContext, idx).ToLocalChecked(); |
| 1143 | − newArray->Set(destFunctionContext, idx, entry); | |
| 1143 | + if (!newArray->Set(destFunctionContext, idx, entry).FromMaybe(false)) { | |
| 1144 | + Q_ASSERT(false); | |
| 1145 | + } | |
| 1146 | + } | |
| 1147 | + if (!newArray->Set(destFunctionContext, length, v8ThisObject.get()).FromMaybe(false)) { | |
| 1148 | + Q_ASSERT(false); | |
| 1149 | + } | |
| 1150 | + if (!destFunction->Set(destFunctionContext, destDataName, newArray).FromMaybe(false)) { | |
| 1151 | + Q_ASSERT(false); | |
| 1144 | 1152 | } |
| 1145 | − newArray->Set(destFunctionContext, length, v8ThisObject.get()); | |
| 1146 | − destFunction->Set(destFunctionContext, destDataName, newArray); | |
| 1147 | 1153 | } else { |
| 1148 | 1154 | v8::Local<v8::Array> newArray = v8::Array::New(isolate, 1); |
| 1149 | − newArray->Set(destFunctionContext, 0, v8ThisObject.get()); | |
| 1150 | − destFunction->Set(destFunctionContext, destDataName, newArray); | |
| 1155 | + if (!newArray->Set(destFunctionContext, 0, v8ThisObject.get()).FromMaybe(false)) { | |
| 1156 | + Q_ASSERT(false); | |
| 1157 | + } | |
| 1158 | + if (destFunction->Set(destFunctionContext, destDataName, newArray).FromMaybe(false)) { | |
| 1159 | + Q_ASSERT(false); | |
| 1160 | + } | |
| 1151 | 1161 | } |
| 1152 | 1162 | /*{ |
| 1153 | 1163 | V8ScriptValueList args; |
| @@ -1245,12 +1255,16 @@ void ScriptSignalV8Proxy::disconnect(ScriptValue arg0, ScriptValue arg1) { · 91 unmodified lines | ||
| 1245 | 1255 | //args << idx << 1; |
| 1246 | 1256 | //destData.property("splice").call(destData, args); |
| 1247 | 1257 | } else { |
| 1248 | − newArray->Set(destFunctionContext, newIndex, entry); | |
| 1258 | + if (!newArray->Set(destFunctionContext, newIndex, entry).FromMaybe(false)) { | |
| 1259 | + Q_ASSERT(false); | |
| 1260 | + } | |
| 1249 | 1261 | newIndex++; |
| 1250 | 1262 | } |
| 1251 | 1263 | } |
| 1252 | 1264 | Q_ASSERT(foundIt); |
| 1253 | − destFunction->Set(destFunctionContext, destDataName, newArray); | |
| 1265 | + if (!destFunction->Set(destFunctionContext, destDataName, newArray).FromMaybe(false)) { | |
| 1266 | + Q_ASSERT(false); | |
| 1267 | + } | |
| 1254 | 1268 | } else { |
| 1255 | 1269 | Q_ASSERT(false); |
| 1256 | 1270 | } |