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

Method doJsCall

valdi/src/valdi/runtime/JavaScript/ValueFunctionWithJSValue.cpp:96–123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

94 return _allowSyncCall;
95}
96
97Value ValueFunctionWithJSValue::doJsCall(JavaScriptEntryParameters& jsEntry,
98 const Value* parameters,
99 size_t parametersSize,
100 ExceptionTracker* exceptionTracker,
101 bool ignoreRetValue) {
102 VALDI_TRACE_META("Valdi.callJsFunction", getFunctionName());
103
104 auto jsValue = getJsValue(jsEntry.jsContext, jsEntry.exceptionTracker);
105 if (!jsEntry.exceptionTracker) {
106 if (_ignoreIfValdiContextIsDestroyed) {
107 jsEntry.exceptionTracker.clearError();
108 } else if (exceptionTracker != nullptr) {
109 exceptionTracker->onError(jsEntry.exceptionTracker.extractError());
110 }
111 return Value::undefined();
112 }
113
114 auto retValue = callJsFunction(jsEntry, jsValue, parameters, parametersSize, ignoreRetValue);
115 if (!jsEntry.exceptionTracker && exceptionTracker != nullptr) {
116 exceptionTracker->onError(jsEntry.exceptionTracker.extractError());
117 }
118
119 if (_isSingleCall) {
120 clearJsValue(jsEntry.jsContext);
121 }
122
123 return retValue;
124}
125
126void ValueFunctionWithJSValue::setIgnoreIfValdiContextIsDestroyed(bool ignoreIfValdiContextIsDestroyed) {

Callers 4

callSyncMethod · 0.95
operator()Method · 0.95
callPromiseMethod · 0.95
callSyncWithDeadlineMethod · 0.95

Calls 3

clearErrorMethod · 0.80
extractErrorMethod · 0.80
onErrorMethod · 0.65

Tested by

no test coverage detected