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

Method evalModuleSync

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

Source from the content-addressed store, hash-verified

3174Ref<JSStackTraceProvider> JavaScriptRuntime::captureCurrentStackTrace() {
3175 if (_javaScriptContext == nullptr) {
3176 return nullptr;
3177 }
3178
3179 // Debugger and force flags always enable stack trace capture
3180 bool shouldCapture = _forceStackTraceCapture || _enableDebugger;
3181
3182 auto listener = getListener();
3183 if (!shouldCapture && listener && isInJsThread()) {
3184 auto currentContext = Context::currentRef();
3185 if (currentContext != nullptr && !currentContext->getScopeName().isEmpty()) {
3186 auto runtimeTweaks = listener->getRuntimeTweaks();
3187 shouldCapture = runtimeTweaks != nullptr && runtimeTweaks->enableScopedContextStackTraceCapture();
3188 }
3189 }
3190
3191 if (!shouldCapture) {
3192 return nullptr;
3193 }
3194
3195 return doCaptureCurrentStackTrace(*_javaScriptContext);
3196}
3197
3198void JavaScriptRuntime::setForceStackTraceCapture(bool force) {
3199 _forceStackTraceCapture = force;
3200}
3201
3202Ref<JSStackTraceProvider> JavaScriptRuntime::doCaptureCurrentStackTrace(IJavaScriptContext& jsContext) {
3203 JSExceptionTracker exceptionTracker(jsContext);

Callers 2

doEvalScriptMethod · 0.80
doPostInitMethod · 0.80

Calls 5

importModuleMethod · 0.95
extractErrorMethod · 0.80
insertMethod · 0.65
valueMethod · 0.65
VoidClass · 0.50

Tested by

no test coverage detected