| 609 | } |
| 610 | |
| 611 | void V8JavaScriptContext::setObjectProperty(const JSValue& object, |
| 612 | const std::string_view& propertyName, |
| 613 | const JSValue& propertyValue, |
| 614 | bool enumerable, |
| 615 | JSExceptionTracker& exceptionTracker) { |
| 616 | v8::HandleScope handleScope(_isolate); |
| 617 | auto obj = v8::Local<v8::Object>::Cast(fromValdiJSValue(_isolate, object, exceptionTracker)); |
| 618 | if (!exceptionTracker) { |
| 619 | return; |
| 620 | } |
| 621 | auto val = fromValdiJSValue(_isolate, propertyValue, exceptionTracker); |
| 622 | if (!exceptionTracker) { |
| 623 | return; |
| 624 | } |
| 625 | v8::Local<v8::String> key; |
| 626 | if (!v8::String::NewFromUtf8( |
| 627 | _isolate, propertyName.data(), v8::NewStringType::kNormal, static_cast<uint32_t>(propertyName.length())) |
| 628 | .ToLocal(&key)) { |
| 629 | exceptionTracker.onError("Failed to create a string key object"); |
| 630 | return; |
| 631 | } |
| 632 | v8::Local<v8::Context> context = v8::Local<v8::Context>::New(_isolate, _context); |
| 633 | setObjectPropertyHelper(context, obj, key, val, enumerable, exceptionTracker); |
| 634 | } |
| 635 | |
| 636 | void V8JavaScriptContext::setObjectProperty(const JSValue& object, |
| 637 | const JSPropertyName& propertyName, |
no test coverage detected