History

More fixes for V8

ksuprynowicz committed 3 years ago

Commit 97137c71 parent 2f9f78f9 files · +214 −72Browse files

Showing the changes to libraries/script-engine/src/v8/ScriptObjectV8Proxy.cpp (1 of 9 files). Show all

Unified · Split

libraries/script-engine/src/v8/ScriptObjectV8Proxy.cpp+13−5
@@ -657,6 +657,10 @@ void ScriptMethodV8Proxy::call(const v8::FunctionCallbackInfo<v8::Value>& argume · 656 unmodified lines
657657 int bestMeta = 0;
658658 int bestConversionPenaltyScore = 0;
659659
660+ if(fullName() == "SettingsScriptingInterface::getValue") {
661+ printf("SettingsScriptingInterface::getValue");
662+ }
663+
660664 for (int i = 0; i < num_metas; i++) {
661665 const QMetaMethod& meta = _metas[i];
662666 int methodNumArgs = meta.parameterCount();
@@ -783,21 +787,25 @@ void ScriptMethodV8Proxy::call(const v8::FunctionCallbackInfo<v8::Value>& argume · 120 unmodified lines
783787 int methodArgTypeId = meta.parameterType(arg);
784788 Q_ASSERT(methodArgTypeId != QMetaType::UnknownType);
785789 v8::Local<v8::Value> argVal = arguments[arg];
786− if (methodArgTypeId != scriptValueTypeId && methodArgTypeId != QMetaType::QVariant) {
790+ if (methodArgTypeId != scriptValueTypeId) {
787791 QVariant varArgVal;
788792 if (!_engine->castValueToVariant(V8ScriptValue(isolate, argVal), varArgVal, methodArgTypeId)) {
789793 QByteArray methodTypeName = QMetaType(methodArgTypeId).name();
790794 QByteArray argTypeName = _engine->valueType(V8ScriptValue(isolate, argVal)).toLatin1();
791− isolate->ThrowError(v8::String::NewFromUtf8(isolate, QString("Native call of %1 failed: Cannot convert parameter %2 from %3 to %4")
792− .arg(fullName()).arg(arg+1).arg(argTypeName, methodTypeName).toStdString().c_str()).ToLocalChecked());
795+ QString errorMessage = QString("Native call of %1 failed: Cannot convert parameter %2 from %3 to %4")
796+ .arg(fullName()).arg(arg+1).arg(argTypeName, methodTypeName);
797+ qDebug(scriptengine) << errorMessage;
798+ isolate->ThrowError(v8::String::NewFromUtf8(isolate, errorMessage.toStdString().c_str()).ToLocalChecked());
793799 //context->throwError(V8ScriptContext::TypeError, QString("Native call of %1 failed: Cannot convert parameter %2 from %3 to %4")
794800 // .arg(fullName()).arg(arg+1).arg(argTypeName, methodTypeName));
795801 return;
796802 }
797803 }
798804 }
799−
800− isolate->ThrowError(v8::String::NewFromUtf8(isolate, QString("Native call of %1 failed: could not locate an overload with the requested arguments").arg(fullName()).toStdString().c_str()).ToLocalChecked());
805+ QString errorMessage = QString("Native call of %1 failed: could not locate an overload with the requested arguments").arg(fullName());
806+ qDebug(scriptengine) << errorMessage;
807+ isolate->ThrowError(v8::String::NewFromUtf8(isolate, errorMessage.toStdString().c_str()).ToLocalChecked());
808+ // V8TODO: it happens sometimes for some reason
801809 Q_ASSERT(false); // really shouldn't have gotten here -- it didn't work before and it's working now?
802810 return;
803811 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t