| 804 | if (!exceptionTracker) { |
| 805 | return nullptr; |
| 806 | } |
| 807 | v8::Local<v8::Context> context = v8::Local<v8::Context>::New(_isolate, _context); |
| 808 | v8::Local<v8::String> string; |
| 809 | if (!val->ToString(context).ToLocal(&string)) { |
| 810 | exceptionTracker.onError("Failed to convert value to static string"); |
| 811 | return nullptr; |
| 812 | } |
| 813 | |
| 814 | const int length = string->Utf8Length(_isolate); |
| 815 | Ref<StaticString> str = StaticString::makeUTF8(length); |
| 816 | string->WriteUtf8(_isolate, str->utf8Data(), length); |
| 817 | |
| 818 | return str; |
| 819 | } |
| 820 | |
| 821 | bool V8JavaScriptContext::valueToBool(const JSValue& value, JSExceptionTracker& exceptionTracker) { |
| 822 | v8::HandleScope handleScope(_isolate); |
| 823 | |
| 824 | auto val_ = fromValdiJSValue(_isolate, value, exceptionTracker); |
| 825 | if (!exceptionTracker) { |
| 826 | return false; |
no test coverage detected