| 697 | v8::Local<v8::Context> context = v8::Local<v8::Context>::New(_isolate, _context); |
| 698 | return obj->Has(context, key).FromMaybe(false); |
| 699 | } |
| 700 | |
| 701 | void V8JavaScriptContext::setObjectProperty(const JSValue& object, |
| 702 | const std::string_view& propertyName, |
| 703 | const JSValue& propertyValue, |
| 704 | bool enumerable, |
| 705 | JSExceptionTracker& exceptionTracker) { |
| 706 | v8::HandleScope handleScope(_isolate); |
| 707 | auto obj = v8::Local<v8::Object>::Cast(fromValdiJSValue(_isolate, object, exceptionTracker)); |
| 708 | if (!exceptionTracker) { |
| 709 | return; |
| 710 | } |
| 711 | auto val = fromValdiJSValue(_isolate, propertyValue, exceptionTracker); |
| 712 | if (!exceptionTracker) { |
| 713 | return; |
| 714 | } |
| 715 | v8::Local<v8::String> key; |
| 716 | if (!v8::String::NewFromUtf8( |
| 717 | _isolate, propertyName.data(), v8::NewStringType::kNormal, static_cast<uint32_t>(propertyName.length())) |
| 718 | .ToLocal(&key)) { |
| 719 | exceptionTracker.onError("Failed to create a string key object"); |
| 720 | return; |
| 721 | } |
| 722 | v8::Local<v8::Context> context = v8::Local<v8::Context>::New(_isolate, _context); |
| 723 | setObjectPropertyHelper(context, obj, key, val, enumerable, exceptionTracker); |
no test coverage detected