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

Method getJsValue

valdi/src/valdi/runtime/JavaScript/JSValueRefHolder.cpp:79–91  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

77}
78
79JSValue JSValueRefHolder::getJsValue(IJavaScriptContext& jsContext, JSExceptionTracker& exceptionTracker) const {
80 auto jsValue = jsContext.getStashedJSValue(_jsValueId);
81 if (!jsValue) {
82 auto errorMessage = STRING_FORMAT(
83 "Cannot unwrap JS value reference '{}' as it was disposed. Reference was taken from context {}",
84 _referenceInfo,
85 _context->getIdAndPathString());
86 throwReferenceError(exceptionTracker, Error(errorMessage, ErrorCodes::Composer::CANNOT_UNWRAP_DISPOSED_JS_VALUE));
87 return JSValue();
88 }
89
90 return jsValue.value();
91}
92
93void JSValueRefHolder::clearJsValue(IJavaScriptContext& jsContext) {
94 auto lock = _context->lock();

Callers 15

doOnCompleteMethod · 0.80
doCancelMethod · 0.80
getStackTraceMethod · 0.80
unwrapJSValueIfNeededFunction · 0.80
setJsContextHandlerMethod · 0.80
runtimeLoadModuleMethod · 0.80
notifyErrorHandlerFunction · 0.80
callModuleFunctionMethod · 0.80
registerTypeConverterMethod · 0.80

Calls 5

getStashedJSValueMethod · 0.80
getIdAndPathStringMethod · 0.80
JSValueClass · 0.70
valueMethod · 0.65
ErrorInterface · 0.50

Tested by

no test coverage detected