From 2ed9171fde99bc2392ffe4e52eaa6d95e5a431b8 Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Thu, 10 Apr 2025 18:01:06 +0200 Subject: [PATCH] src: enter and lock isolate properly in json parser --- src/json_parser.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/json_parser.cc b/src/json_parser.cc index 878028d0d2dd61..36d51e7d89d961 100644 --- a/src/json_parser.cc +++ b/src/json_parser.cc @@ -18,6 +18,7 @@ bool JSONParser::Parse(const std::string& content) { DCHECK(!parsed_); Isolate* isolate = isolate_.get(); + v8::Locker locker(isolate); v8::Isolate::Scope isolate_scope(isolate); v8::HandleScope handle_scope(isolate); @@ -47,6 +48,7 @@ bool JSONParser::Parse(const std::string& content) { std::optional JSONParser::GetTopLevelStringField( std::string_view field) { Isolate* isolate = isolate_.get(); + v8::Locker locker(isolate); v8::Isolate::Scope isolate_scope(isolate); v8::HandleScope handle_scope(isolate); @@ -73,6 +75,7 @@ std::optional JSONParser::GetTopLevelStringField( std::optional JSONParser::GetTopLevelBoolField(std::string_view field) { Isolate* isolate = isolate_.get(); + v8::Locker locker(isolate); v8::Isolate::Scope isolate_scope(isolate); v8::HandleScope handle_scope(isolate); @@ -105,6 +108,8 @@ std::optional JSONParser::GetTopLevelBoolField(std::string_view field) { std::optional JSONParser::GetTopLevelStringDict( std::string_view field) { Isolate* isolate = isolate_.get(); + v8::Locker locker(isolate); + v8::Isolate::Scope isolate_scope(isolate); v8::HandleScope handle_scope(isolate); Local context = context_.Get(isolate); Local content_object = content_.Get(isolate);