| 823 | JSExceptionTracker& exceptionTracker, |
| 824 | IJavaScriptPropertyNamesVisitor& visitor) { |
| 825 | v8::HandleScope handleScope(_isolate); |
| 826 | auto obj = v8::Local<v8::Object>::Cast(fromValdiJSValue(_isolate, object, exceptionTracker)); |
| 827 | if (!exceptionTracker) { |
| 828 | return; |
| 829 | } |
| 830 | if (!obj->IsObject()) { |
| 831 | exceptionTracker.onError("Cannot invoke visitObjectPropertyNames on a non object"); |
| 832 | return; |
| 833 | } |
| 834 | |
| 835 | v8::Local<v8::Context> context = v8::Local<v8::Context>::New(_isolate, _context); |
| 836 | v8::Local<v8::Array> properties; |
| 837 | if (!obj->GetPropertyNames(context).ToLocal(&properties)) { |
| 838 | exceptionTracker.onError("Cannot get property list from object"); |
| 839 | return; |
| 840 | } |
| 841 | |
| 842 | bool shouldContinue = true; |
| 843 | for (uint32_t i = 0; i < properties->Length() && shouldContinue && exceptionTracker; i++) { |
| 844 | v8::Local<v8::Value> ival; |
| 845 | if (!properties->Get(context, i).ToLocal(&ival)) { |
| 846 | // NOTE(rjaber): Should never happen |
| 847 | assert(false); |
| 848 | } |
| 849 | auto propertyName = toValdiJSPropertyName(IndirectV8Persistent::make(_isolate, ival)); |
| 850 | shouldContinue = visitor.visitPropertyName(*this, object, propertyName, exceptionTracker); |
| 851 | } |
| 852 | } |
| 853 | |
| 854 | StringBox V8JavaScriptContext::valueToString(const JSValue& value, JSExceptionTracker& exceptionTracker) { |
| 855 | v8::HandleScope handleScope(_isolate); |
| 856 | v8::Local<v8::Value> val = fromValdiJSValue(_isolate, value, exceptionTracker); |
| 857 | if (!exceptionTracker) { |
| 858 | return StringBox(); |