| 373 | auto guard = _threadAccessChecker.guard(); |
| 374 | const auto* cString = JS_AtomToCString(_context, fromValdiJSPropertyName(propertyName)); |
| 375 | if (cString == nullptr) { |
| 376 | return Valdi::StringBox(); |
| 377 | } |
| 378 | |
| 379 | auto convertedString = Valdi::StringCache::makeStringFromCLiteral(cString); |
| 380 | |
| 381 | JS_FreeCString(_context, cString); |
| 382 | |
| 383 | return convertedString; |
| 384 | } |
| 385 | |
| 386 | Valdi::JSValueRef QuickJSJavaScriptContext::newObject(Valdi::JSExceptionTracker& exceptionTracker) { |
| 387 | auto guard = _threadAccessChecker.guard(); |
| 388 | return checkCallAndGetValue(exceptionTracker, JS_NewObject(_context)); |
| 389 | } |
| 390 | |
| 391 | Valdi::JSValueRef QuickJSJavaScriptContext::newFunction(const Valdi::Ref<Valdi::JSFunction>& callable, |
| 392 | Valdi::JSExceptionTracker& exceptionTracker) { |
| 393 | auto guard = _threadAccessChecker.guard(); |
| 394 | // TODO(simon): Use functionName |
| 395 | |
| 396 | auto functionObject = |
| 397 | checkCallAndGetValue(exceptionTracker, JS_NewObjectProtoClass(_context, _functionPrototype, _functionClassID)); |
| 398 | if (!exceptionTracker) { |
| 399 | return Valdi::JSValueRef(); |
| 400 | } |
| 401 | |
| 402 | setObjectCallable(fromValdiJSValue(functionObject.get()), callable); |
| 403 | |
| 404 | if (!callable->getReferenceInfo().getName().isEmpty()) { |
| 405 | auto value = newStringUTF8(callable->getReferenceInfo().getName().toStringView(), exceptionTracker); |
| 406 | if (!exceptionTracker) { |
| 407 | return Valdi::JSValueRef(); |
| 408 | } |
| 409 |
nothing calls this directly
no test coverage detected