Showing the changes to libraries/script-engine/src/v8/ScriptEngineV8.cpp (1 of 4 files). Show all
Unified · Split
| @@ -821,6 +821,9 @@ ScriptValue ScriptEngineV8::evaluateInClosure(const ScriptValue& _closure, · 820 unmodified lines | ||
| 821 | 821 | |
| 822 | 822 | ScriptValue result; |
| 823 | 823 | //auto context = pushContext(); |
| 824 | + | |
| 825 | + // V8TODO: a lot of functions rely on _v8Context, which was not updated here | |
| 826 | + // It might cause trouble | |
| 824 | 827 | { |
| 825 | 828 | v8::Context::Scope contextScope(closureContext); |
| 826 | 829 | const V8ScriptValue& closure = unwrappedClosure->toV8Value(); |
| @@ -1527,6 +1530,32 @@ QString ScriptEngineV8::scriptValueDebugDetails(const ScriptValue &value) { · 700 unmodified lines | ||
| 1527 | 1530 | return scriptValueDebugDetailsV8(v8Value); |
| 1528 | 1531 | } |
| 1529 | 1532 | |
| 1533 | +QString ScriptEngineV8::scriptValueDebugListMembers(const ScriptValue &value) { | |
| 1534 | + V8ScriptValue v8Value = ScriptValueV8Wrapper::fullUnwrap(this, value); | |
| 1535 | + return scriptValueDebugDetailsV8(v8Value); | |
| 1536 | +} | |
| 1537 | + | |
| 1538 | +QString ScriptEngineV8::scriptValueDebugListMembersV8(const V8ScriptValue &v8Value) { | |
| 1539 | + v8::Locker locker(_v8Isolate); | |
| 1540 | + v8::Isolate::Scope isolateScope(_v8Isolate); | |
| 1541 | + v8::HandleScope handleScope(_v8Isolate); | |
| 1542 | + v8::Context::Scope contextScope(getContext()); | |
| 1543 | + | |
| 1544 | + QString membersString(""); | |
| 1545 | + if (v8Value.constGet()->IsObject()) { | |
| 1546 | + v8::Local<v8::String> membersStringV8; | |
| 1547 | + v8::Local<v8::Object> object = v8::Local<v8::Object>::Cast(v8Value.constGet()); | |
| 1548 | + auto names = object->GetPropertyNames(getContext()).ToLocalChecked(); | |
| 1549 | + if (v8::JSON::Stringify(getContext(), object).ToLocal(&membersStringV8)) { | |
| 1550 | + membersString = QString(*v8::String::Utf8Value(_v8Isolate, membersStringV8)); | |
| 1551 | + } | |
| 1552 | + membersString = QString(*v8::String::Utf8Value(_v8Isolate, membersStringV8)); | |
| 1553 | + } else { | |
| 1554 | + membersString = QString(" Is not an object"); | |
| 1555 | + } | |
| 1556 | + return membersString; | |
| 1557 | +} | |
| 1558 | + | |
| 1530 | 1559 | QString ScriptEngineV8::scriptValueDebugDetailsV8(const V8ScriptValue &v8Value) { |
| 1531 | 1560 | v8::Locker locker(_v8Isolate); |
| 1532 | 1561 | v8::Isolate::Scope isolateScope(_v8Isolate); |