@@ -1386,6 +1386,11 @@ InternalCallbackScope::InternalCallbackScope(Environment* env,
1386
1386
CHECK (!object.IsEmpty ());
1387
1387
}
1388
1388
1389
+ if (!env->can_call_into_js ()) {
1390
+ failed_ = true ;
1391
+ return ;
1392
+ }
1393
+
1389
1394
HandleScope handle_scope (env->isolate ());
1390
1395
// If you hit this assertion, you forgot to enter the v8::Context first.
1391
1396
CHECK_EQ (env->context (), env->isolate ()->GetCurrentContext ());
@@ -1433,6 +1438,7 @@ void InternalCallbackScope::Close() {
1433
1438
1434
1439
Environment::TickInfo* tick_info = env_->tick_info ();
1435
1440
1441
+ if (!env_->can_call_into_js ()) return ;
1436
1442
if (tick_info->length () == 0 ) {
1437
1443
env_->isolate ()->RunMicrotasks ();
1438
1444
}
@@ -1452,6 +1458,8 @@ void InternalCallbackScope::Close() {
1452
1458
CHECK_EQ (env_->current_async_id (), 0 );
1453
1459
CHECK_EQ (env_->trigger_id (), 0 );
1454
1460
1461
+ if (!env_->can_call_into_js ()) return ;
1462
+
1455
1463
if (env_->tick_callback_function ()->Call (process, 0 , nullptr ).IsEmpty ()) {
1456
1464
failed_ = true ;
1457
1465
}
@@ -4756,6 +4764,7 @@ inline int Start(Isolate* isolate, IsolateData* isolate_data,
4756
4764
4757
4765
const int exit_code = EmitExit (&env);
4758
4766
4767
+ env.set_can_call_into_js (false );
4759
4768
env.RunCleanup ();
4760
4769
RunAtExit (&env);
4761
4770
uv_key_delete (&thread_local_env);
0 commit comments