MCPcopy Create free account
hub / github.com/Snapchat/Valdi / setObjectProperty

Method setObjectProperty

valdi/src/valdi/v8/V8JavaScriptContext.cpp:611–634  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

609 if (indirect.isEmpty()) {
610 exceptionTracker.onError("Object cannot be dereferenced");
611 return JSValueRef();
612 }
613 return toRetainedJSValueRef(indirect);
614}
615
616JSValueRef V8JavaScriptContext::getObjectProperty(const JSValue& object,
617 const std::string_view& propertyName,
618 JSExceptionTracker& exceptionTracker) {
619 auto propertyKey = newPropertyName(propertyName);
620 return getObjectProperty(object, propertyKey.get(), exceptionTracker);
621}
622
623JSValueRef V8JavaScriptContext::getObjectProperty(const JSValue& object,
624 const JSPropertyName& propertyName,
625 JSExceptionTracker& exceptionTracker) {
626 v8::HandleScope handleScope(_isolate);
627 auto obj = v8::Local<v8::Object>::Cast(fromValdiJSValue(_isolate, object, exceptionTracker));
628 if (!exceptionTracker) {
629 return JSValueRef();
630 }
631
632 if (!obj->IsObject()) {
633 exceptionTracker.onError("Cannot getObject property on non object value");
634 return JSValueRef();
635 }
636
637 auto key = fromValdiJSPropertyName(_isolate, propertyName, exceptionTracker);

Callers 1

mainFunction · 0.45

Calls 11

setObjectPropertyHelperFunction · 0.85
ToLocalMethod · 0.80
fromValdiJSValueFunction · 0.70
fromValdiJSPropertyNameFunction · 0.70
onErrorMethod · 0.65
CastFunction · 0.50
NewFunction · 0.50
dataMethod · 0.45
lengthMethod · 0.45
ValueMethod · 0.45

Tested by

no test coverage detected