@@ -65,7 +65,7 @@ using JsStackFrames = std::vector<JsStackFrame>;
6565
6666struct JsStackTrace {
6767 // The frames in the stack trace
68- std::vector<JsStackFrame> frames;
68+ JsStackFrames frames;
6969 // JSON serialized string of the async state
7070 std::string async_state;
7171};
@@ -534,6 +534,7 @@ void RegisterThreadInternal(
534534// Function to register a thread and update its last seen time
535535void RegisterThread (const FunctionCallbackInfo<Value> &args) {
536536 auto isolate = args.GetIsolate ();
537+ auto context = isolate->GetCurrentContext ();
537538
538539 if (args.Length () == 1 && args[0 ]->IsString ()) {
539540 v8::String::Utf8Value utf8 (isolate, args[0 ]);
@@ -546,10 +547,9 @@ void RegisterThread(const FunctionCallbackInfo<Value> &args) {
546547
547548 auto obj = args[0 ].As <Object>();
548549 auto async_local_storage_val =
549- obj->Get (isolate->GetCurrentContext (),
550- String::NewFromUtf8 (isolate, " asyncLocalStorage" ,
551- NewStringType::kInternalized )
552- .ToLocalChecked ());
550+ obj->Get (context, String::NewFromUtf8 (isolate, " asyncLocalStorage" ,
551+ NewStringType::kInternalized )
552+ .ToLocalChecked ());
553553
554554 if (async_local_storage_val.IsEmpty () ||
555555 !async_local_storage_val.ToLocalChecked ()->IsObject ()) {
@@ -566,10 +566,9 @@ void RegisterThread(const FunctionCallbackInfo<Value> &args) {
566566 std::nullopt ;
567567
568568 auto storage_key_val =
569- obj->Get (isolate->GetCurrentContext (),
570- String::NewFromUtf8 (isolate, " stateLookup" ,
571- NewStringType::kInternalized )
572- .ToLocalChecked ());
569+ obj->Get (context, String::NewFromUtf8 (isolate, " stateLookup" ,
570+ NewStringType::kInternalized )
571+ .ToLocalChecked ());
573572
574573 if (!storage_key_val.IsEmpty ()) {
575574
@@ -581,7 +580,7 @@ void RegisterThread(const FunctionCallbackInfo<Value> &args) {
581580 std::vector<v8::Global<v8::Value>> keys_vec;
582581 uint32_t length = arr->Length ();
583582 for (uint32_t i = 0 ; i < length; ++i) {
584- auto maybeEl = arr->Get (isolate-> GetCurrentContext () , i);
583+ auto maybeEl = arr->Get (context , i);
585584 if (maybeEl.IsEmpty ())
586585 continue ;
587586 auto el = maybeEl.ToLocalChecked ();
0 commit comments