mirror of
https://github.com/overte-org/overte.git
synced 2025-07-26 01:36:55 +02:00
Some V8 debuging messages
This commit is contained in:
parent
a47f5e1102
commit
9fe7f9aa52
4 changed files with 24 additions and 3 deletions
|
@ -1410,3 +1410,12 @@ void ScriptEngineV8::compileTest() {
|
||||||
Q_ASSERT(false);
|
Q_ASSERT(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*QStringList ScriptEngineV8::getCurrentStackTrace() {
|
||||||
|
v8::Local<v8::StackTrace> stackTrace = v8::StackTrace::CurrentStackTrace(_v8Isolate, 100);
|
||||||
|
QStringList backtrace;
|
||||||
|
for (int n = 0; n < stackTrace->GetFrameCount(); n++) {
|
||||||
|
v8::Local<v8::StackFrame> stackFrame = stackTrace->GetFrame(_v8Isolate, n);
|
||||||
|
|
||||||
|
}
|
||||||
|
}*/
|
|
@ -180,6 +180,8 @@ public: // not for public use, but I don't like how Qt strings this along with p
|
||||||
v8::EscapableHandleScope handleScope(_v8Isolate);
|
v8::EscapableHandleScope handleScope(_v8Isolate);
|
||||||
return handleScope.Escape(_v8Context.Get(_v8Isolate));
|
return handleScope.Escape(_v8Context.Get(_v8Isolate));
|
||||||
}
|
}
|
||||||
|
// Useful for debugging
|
||||||
|
//QStringList getCurrentStackTrace();
|
||||||
|
|
||||||
using ObjectWrapperMap = QMap<QObject*, QWeakPointer<ScriptObjectV8Proxy>>;
|
using ObjectWrapperMap = QMap<QObject*, QWeakPointer<ScriptObjectV8Proxy>>;
|
||||||
mutable QMutex _qobjectWrapperMapProtect;
|
mutable QMutex _qobjectWrapperMapProtect;
|
||||||
|
|
|
@ -375,6 +375,9 @@ bool ScriptEngineV8::castValueToVariant(const V8ScriptValue& v8Val, QVariant& de
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// V8TODO
|
// V8TODO
|
||||||
|
errorMessage = QString() + "Conversion failure: " + QString(*v8::String::Utf8Value(_v8Isolate, val->ToDetailString(getConstContext()).ToLocalChecked()))
|
||||||
|
+ "to variant. Destination type: " + QMetaType::typeName(destTypeId);
|
||||||
|
qDebug() << errorMessage;
|
||||||
Q_ASSERT(false);
|
Q_ASSERT(false);
|
||||||
//dest = val->ToVariant();
|
//dest = val->ToVariant();
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -206,7 +206,7 @@ ScriptValue ScriptValueV8Wrapper::property(quint32 arrayIndex, const ScriptValue
|
||||||
return ScriptValue(new ScriptValueV8Wrapper(_engine, std::move(result)));
|
return ScriptValue(new ScriptValueV8Wrapper(_engine, std::move(result)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
qCritical() << "Failed to get property, parent of value: " << arrayIndex << " is not a V8 object, reported type: " << QString(*v8::String::Utf8Value(isolate, _value.constGet()->TypeOf(isolate)));
|
qDebug() << "Failed to get property, parent of value: " << arrayIndex << " is not a V8 object, reported type: " << QString(*v8::String::Utf8Value(isolate, _value.constGet()->TypeOf(isolate)));
|
||||||
return _engine->undefinedValue();
|
return _engine->undefinedValue();
|
||||||
/*v8::Local<v8::Value> nullValue = v8::Null(_engine->getIsolate());
|
/*v8::Local<v8::Value> nullValue = v8::Null(_engine->getIsolate());
|
||||||
V8ScriptValue nullScriptValue(_engine->getIsolate(), std::move(nullValue));
|
V8ScriptValue nullScriptValue(_engine->getIsolate(), std::move(nullValue));
|
||||||
|
@ -241,7 +241,14 @@ void ScriptValueV8Wrapper::setProperty(const QString& name, const ScriptValue& v
|
||||||
qDebug(scriptengine) << "Failed to set property";
|
qDebug(scriptengine) << "Failed to set property";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
qDebug(scriptengine) << "Failed to set property - parent is not an object";
|
v8::Local<v8::String> details;
|
||||||
|
QString detailsString("");
|
||||||
|
if(_value.get()->ToDetailString(_engine->getContext()).ToLocal(&details)) {
|
||||||
|
v8::String::Utf8Value utf8Value(isolate,details);
|
||||||
|
detailsString = *utf8Value;
|
||||||
|
}
|
||||||
|
qDebug(scriptengine) << "Failed to set property:" + name + " - parent is not an object. Parent details: " + " Type: " + QString(*v8::String::Utf8Value(isolate, _value.constGet()->TypeOf(isolate)));
|
||||||
|
qDebug(scriptengine) << _engine->currentContext()->backtrace();
|
||||||
}
|
}
|
||||||
//V8TODO: what about flags?
|
//V8TODO: what about flags?
|
||||||
//_value.setProperty(name, unwrapped, (V8ScriptValue::PropertyFlags)(int)flags);
|
//_value.setProperty(name, unwrapped, (V8ScriptValue::PropertyFlags)(int)flags);
|
||||||
|
@ -260,7 +267,7 @@ void ScriptValueV8Wrapper::setProperty(quint32 arrayIndex, const ScriptValue& va
|
||||||
qDebug(scriptengine) << "Failed to set property";
|
qDebug(scriptengine) << "Failed to set property";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
qDebug(scriptengine) << "Failed to set property - parent is not an object";
|
qDebug(scriptengine) << "Failed to set property: " + QString(arrayIndex) + " - parent is not an object";
|
||||||
}
|
}
|
||||||
//V8TODO: what about flags?
|
//V8TODO: what about flags?
|
||||||
//_value.setProperty(arrayIndex, unwrapped, (V8ScriptValue::PropertyFlags)(int)flags);
|
//_value.setProperty(arrayIndex, unwrapped, (V8ScriptValue::PropertyFlags)(int)flags);
|
||||||
|
|
Loading…
Reference in a new issue