fix: potential async_hooks
crash in NotifyWindowRestore
on Windows (#40576)
* fix: potential async_hooks crash in NotifyWindowRestore on Windows * fix: don't use CallbackScope for Error objects
This commit is contained in:
parent
db2bf1a0d1
commit
8104c7908a
4 changed files with 60 additions and 10 deletions
|
@ -13,6 +13,14 @@ v8::Local<v8::Value> CallMethodWithArgs(v8::Isolate* isolate,
|
|||
v8::Local<v8::Object> obj,
|
||||
const char* method,
|
||||
ValueVector* args) {
|
||||
// Only set up the node::CallbackScope if there's a node environment.
|
||||
std::unique_ptr<node::CallbackScope> callback_scope;
|
||||
if (node::Environment::GetCurrent(isolate)) {
|
||||
v8::HandleScope handle_scope(isolate);
|
||||
callback_scope = std::make_unique<node::CallbackScope>(
|
||||
isolate, v8::Object::New(isolate), node::async_context{0, 0});
|
||||
}
|
||||
|
||||
// Perform microtask checkpoint after running JavaScript.
|
||||
gin_helper::MicrotasksScope microtasks_scope(
|
||||
isolate, obj->GetCreationContextChecked()->GetMicrotaskQueue(), true);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue