| 372 | Valdi::JSValueRef JavaScriptCoreContext::onNewBool(bool boolean) { |
| 373 | return returnJSValueRef(JSValueMakeBoolean(getJSGlobalContext(), boolean), kJSTypeBoolean); |
| 374 | } |
| 375 | |
| 376 | Valdi::JSValueRef JavaScriptCoreContext::onNewNumber(int32_t number) { |
| 377 | return onNewNumber(static_cast<double>(number)); |
| 378 | } |
| 379 | |
| 380 | Valdi::JSValueRef JavaScriptCoreContext::onNewNumber(double number) { |
| 381 | auto context = getJSGlobalContext(); |
| 382 | return returnJSValueRef(JSValueMakeNumber(context, number), kJSTypeNumber); |
| 383 | } |
| 384 | |
| 385 | Valdi::JSValueRef JavaScriptCoreContext::newStringUTF8(const std::string_view& str, |
| 386 | Valdi::JSExceptionTracker& exceptionTracker) { |
| 387 | // JSStringCreateWithUTF8CString (used by newPropertyName) internally calls strlen(), |
| 388 | // truncating strings with embedded null bytes. Use JSStringCreateWithCharacters instead, |
| 389 | // which takes an explicit length. JSCore uses UTF-16 internally, so both paths do the |
| 390 | // same conversion — this one just handles null bytes correctly. |
| 391 | auto utf16 = Valdi::utf8ToUtf16(str.data(), str.size()); |
nothing calls this directly
no test coverage detected