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

Method getObjectPropertyForIndex

valdi/src/valdi/v8/V8JavaScriptContext.cpp:561–585  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

559 return JSValueRef();
560 }
561
562 auto key = fromValdiJSPropertyName(_isolate, propertyName, exceptionTracker);
563 if (!exceptionTracker) {
564 return JSValueRef();
565 }
566 v8::Local<v8::Context> context = v8::Local<v8::Context>::New(_isolate, _context);
567
568 auto maybeVal = obj->Get(context, key);
569 v8::Local<v8::Value> retval;
570 if (!maybeVal.ToLocal(&retval)) {
571 return newUndefined();
572 }
573 return toRetainedJSValueRef(IndirectV8Persistent::make(_isolate, retval));
574}
575
576JSValueRef V8JavaScriptContext::getObjectPropertyForIndex(const JSValue& object,
577 size_t index,
578 JSExceptionTracker& exceptionTracker) {
579 v8::HandleScope handleScope(_isolate);
580 auto local = fromValdiJSValue(_isolate, object, exceptionTracker);
581 if (!exceptionTracker) {
582 return JSValueRef();
583 }
584
585 if (!local->IsObject()) {
586 exceptionTracker.onError("Cannot getObject property on non object value");
587 return JSValueRef();
588 }

Callers 8

jsArrayToValueFunction · 0.45
visitES6CollectionMethod · 0.45
getArrayItemMethod · 0.45
setProtobufRepeatedFieldFunction · 0.45
getMessageIndexesFunction · 0.45
codepointsToStrMethod · 0.45
mainFunction · 0.45

Calls 6

ToLocalMethod · 0.80
fromValdiJSValueFunction · 0.70
onErrorMethod · 0.65
NewFunction · 0.50
CastFunction · 0.50
GetMethod · 0.45

Tested by

no test coverage detected