@@ -357,9 +357,42 @@ Local<Context> NewContext(Isolate* isolate,
357
357
if (!InitializeContext (context)) {
358
358
return Local<Context>();
359
359
}
360
+
361
+ InitializeContextRuntime (context);
362
+
360
363
return context;
361
364
}
362
365
366
+ // This runs at runtime, regardless of whether the context
367
+ // is created from a snapshot.
368
+ void InitializeContextRuntime (Local<Context> context) {
369
+ Isolate* isolate = context->GetIsolate ();
370
+ HandleScope handle_scope (isolate);
371
+
372
+ // Delete `Intl.v8BreakIterator`
373
+ // https://github.com/nodejs/node/issues/14909
374
+ Local<String> intl_string = FIXED_ONE_BYTE_STRING (isolate, " Intl" );
375
+ Local<String> break_iter_string =
376
+ FIXED_ONE_BYTE_STRING (isolate, " v8BreakIterator" );
377
+ Local<Value> intl_v;
378
+ if (context->Global ()->Get (context, intl_string).ToLocal (&intl_v) &&
379
+ intl_v->IsObject ()) {
380
+ Local<Object> intl = intl_v.As <Object>();
381
+ intl->Delete (context, break_iter_string).FromJust ();
382
+ }
383
+
384
+ // Delete `Atomics.wake`
385
+ // https://github.com/nodejs/node/issues/21219
386
+ Local<String> atomics_string = FIXED_ONE_BYTE_STRING (isolate, " Atomics" );
387
+ Local<String> wake_string = FIXED_ONE_BYTE_STRING (isolate, " wake" );
388
+ Local<Value> atomics_v;
389
+ if (context->Global ()->Get (context, atomics_string).ToLocal (&atomics_v) &&
390
+ atomics_v->IsObject ()) {
391
+ Local<Object> atomics = atomics_v.As <Object>();
392
+ atomics->Delete (context, wake_string).FromJust ();
393
+ }
394
+ }
395
+
363
396
bool InitializeContext (Local<Context> context) {
364
397
Isolate* isolate = context->GetIsolate ();
365
398
HandleScope handle_scope (isolate);
@@ -386,7 +419,6 @@ bool InitializeContext(Local<Context> context) {
386
419
}
387
420
388
421
static const char * context_files[] = {" internal/per_context/primordials" ,
389
- " internal/per_context/setup" ,
390
422
" internal/per_context/domexception" ,
391
423
nullptr };
392
424
0 commit comments