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

Method newArrayBuffer

valdi/src/valdi/v8/V8JavaScriptContext.cpp:420–436  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

418
419 v8::TryCatch catcher(_isolate);
420 auto context = _context.Get(_isolate);
421 v8::Context::Scope contextScope(context);
422 v8::Local<v8::String> string;
423 if (!jsValue->ToString(context).ToLocal(&string)) {
424 storeCaughtException(catcher, "Cannot format bigint", exceptionTracker);
425 return nullptr;
426 }
427 v8::String::Utf8Value decimal(_isolate, string);
428 if (*decimal == nullptr) {
429 storeCaughtException(catcher, "Cannot encode BigInt decimal string", exceptionTracker);
430 return nullptr;
431 }
432 return BigInt::make(std::string_view(*decimal, static_cast<size_t>(decimal.length())), exceptionTracker);
433}
434
435void V8JavaScriptContext::storeCaughtException(v8::TryCatch& catcher,
436 const char* message,
437 JSExceptionTracker& exceptionTracker) {
438 if (catcher.HasCaught()) {
439 exceptionTracker.storeException(

Callers 4

runtimeHeapDumpMethod · 0.45
strToCodepointsMethod · 0.45
codepointsToStrMethod · 0.45

Calls 6

unsafeBridgeRetainFunction · 0.85
getMethod · 0.65
NewFunction · 0.50
emptyMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected