| 271 | setExceptionToTracker(exceptionTracker); |
| 272 | return Valdi::JSValueRef(); |
| 273 | } |
| 274 | |
| 275 | return toRetainedJSValueRef(value); |
| 276 | } |
| 277 | |
| 278 | bool QuickJSJavaScriptContext::checkCall(Valdi::JSExceptionTracker& exceptionTracker, int retValue) { |
| 279 | if (retValue < 0) { |
| 280 | setExceptionToTracker(exceptionTracker); |
| 281 | return false; |
| 282 | } |
| 283 | return true; |
| 284 | } |
| 285 | |
| 286 | Valdi::JSValueRef QuickJSJavaScriptContext::getGlobalObject(Valdi::JSExceptionTracker& exceptionTracker) { |
| 287 | auto guard = _threadAccessChecker.guard(); |
| 288 | return checkCallAndGetValue(exceptionTracker, JS_GetGlobalObject(_context)); |
| 289 | } |
| 290 | |
| 291 | bool QuickJSJavaScriptContext::supportsPreCompilation() const { |
| 292 | return true; |
| 293 | } |
| 294 | |
| 295 | Valdi::BytesView QuickJSJavaScriptContext::preCompile(const std::string_view& script, |
| 296 | const std::string_view& sourceFilename, |
| 297 | Valdi::JSExceptionTracker& exceptionTracker) { |
| 298 | auto guard = _threadAccessChecker.guard(); |
| 299 | auto formattedScript = Valdi::formatJsModule(script); |
| 300 | |
| 301 | auto evalResult = checkCallAndGetValue(exceptionTracker, |
| 302 | JS_Eval(_context, |
| 303 | reinterpret_cast<const char*>(formattedScript.data()), |
| 304 | formattedScript.length(), |
| 305 | sourceFilename.data(), |
nothing calls this directly
no test coverage detected