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

Method symbolicateError

valdi/src/valdi/runtime/JavaScript/JavaScriptRuntime.cpp:3034–3078  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3032 auto it = _modules.find(resourceId);
3033 if (it != _modules.end()) {
3034 auto moduleContainer = it->second;
3035 _modules.erase(it);
3036
3037 onModuleUnloaded(resourceId, entry);
3038 if (!entry.exceptionTracker) {
3039 onRecoverableError("onModuleUnloaded", entry.exceptionTracker);
3040 }
3041
3042 moduleContainer->didUnload();
3043 }
3044 }
3045}
3046
3047void JavaScriptRuntime::registerJavaScriptModuleFactory(const Ref<JavaScriptModuleFactory>& moduleFactory) {
3048 dispatchOnJsThreadUnattributed([=](JavaScriptEntryParameters& entry) {
3049 _moduleFactories.push_back(moduleFactory);
3050 auto modulePath = moduleFactory->getModulePath();
3051 auto pathResult = entry.jsContext.newStringUTF8(modulePath.toStringView(), entry.exceptionTracker);
3052 if (!entry.exceptionTracker) {
3053 onRecoverableError("registerJavaScriptModuleFactory", entry.exceptionTracker);
3054 return;
3055 }
3056
3057 auto lambdaFunction = makeShared<JSFunctionWithCallable>(
3058 ReferenceInfoBuilder().withObject(modulePath), [=](JSFunctionNativeCallContext& callContext) -> JSValueRef {
3059 JavaScriptContextEntry jsEntry(_globalContext);
3060 return moduleFactory->loadModule(callContext.getContext(),
3061 ReferenceInfoBuilder(callContext.getReferenceInfo()),
3062 callContext.getExceptionTracker());
3063 });
3064
3065 auto functionResult = entry.jsContext.newFunction(lambdaFunction, entry.exceptionTracker);
3066 if (!entry.exceptionTracker) {
3067 onRecoverableError("registerJavaScriptModuleFactory", entry.exceptionTracker);
3068 return;
3069 }
3070
3071 std::initializer_list<JSValueRef> params = {std::move(pathResult), std::move(functionResult)};
3072
3073 JSFunctionCallContext callContext(entry.jsContext, params.begin(), params.size(), entry.exceptionTracker);
3074
3075 entry.jsContext.callObjectProperty(
3076 _moduleLoader.get(), _propertyNameIndex.getJsName(kRegisterModulePropertyName), callContext);
3077 if (!entry.exceptionTracker) {
3078 onRecoverableError("registerJavaScriptModuleFactory", entry.exceptionTracker);
3079 return;
3080 }
3081 });

Callers 2

getStackTraceMethod · 0.45

Calls 11

toResultMethod · 0.80
getJsValueMethod · 0.80
toRetainedResultMethod · 0.80
clearErrorMethod · 0.80
valueMethod · 0.65
errorMethod · 0.65
getMethod · 0.65
emptyMethod · 0.45
getObjectPropertyMethod · 0.45
successMethod · 0.45
callObjectAsFunctionMethod · 0.45

Tested by

no test coverage detected