| 730 | } |
| 731 | |
| 732 | void V8JavaScriptContext::visitObjectPropertyNames(const JSValue& object, |
| 733 | JSExceptionTracker& exceptionTracker, |
| 734 | IJavaScriptPropertyNamesVisitor& visitor) { |
| 735 | v8::HandleScope handleScope(_isolate); |
| 736 | auto obj = v8::Local<v8::Object>::Cast(fromValdiJSValue(_isolate, object, exceptionTracker)); |
| 737 | if (!exceptionTracker) { |
| 738 | return; |
| 739 | } |
| 740 | if (!obj->IsObject()) { |
| 741 | exceptionTracker.onError("Cannot invoke visitObjectPropertyNames on a non object"); |
| 742 | return; |
| 743 | } |
| 744 | |
| 745 | v8::Local<v8::Context> context = v8::Local<v8::Context>::New(_isolate, _context); |
| 746 | v8::Local<v8::Array> properties; |
| 747 | if (!obj->GetPropertyNames(context).ToLocal(&properties)) { |
| 748 | exceptionTracker.onError("Cannot get property list from object"); |
| 749 | return; |
| 750 | } |
| 751 | |
| 752 | bool shouldContinue = true; |
| 753 | for (uint32_t i = 0; i < properties->Length() && shouldContinue && exceptionTracker; i++) { |
| 754 | v8::Local<v8::Value> ival; |
| 755 | if (!properties->Get(context, i).ToLocal(&ival)) { |
| 756 | // NOTE(rjaber): Should never happen |
| 757 | assert(false); |
| 758 | } |
| 759 | auto propertyName = toValdiJSPropertyName(IndirectV8Persistent::make(_isolate, ival)); |
| 760 | shouldContinue = visitor.visitPropertyName(*this, object, propertyName, exceptionTracker); |
| 761 | } |
| 762 | } |
| 763 | |
| 764 | StringBox V8JavaScriptContext::valueToString(const JSValue& value, JSExceptionTracker& exceptionTracker) { |
| 765 | v8::HandleScope handleScope(_isolate); |
no test coverage detected