@@ -3497,35 +3497,19 @@ Local<Context> NewContext(Isolate* isolate,
34973497 auto context = Context::New (isolate, nullptr , object_template);
34983498 if (context.IsEmpty ()) return context;
34993499 HandleScope handle_scope (isolate);
3500+
35003501 context->SetEmbedderData (
35013502 ContextEmbedderIndex::kAllowWasmCodeGeneration , True (isolate));
35023503
3503- auto intl_key = FIXED_ONE_BYTE_STRING (isolate, " Intl" );
3504- auto break_iter_key = FIXED_ONE_BYTE_STRING (isolate, " v8BreakIterator" );
3505- Local<Value> intl_v;
3506- if (context->Global ()->Get (context, intl_key).ToLocal (&intl_v) &&
3507- intl_v->IsObject ()) {
3508- Local<Object> intl = intl_v.As <Object>();
3509- intl->Delete (context, break_iter_key).FromJust ();
3510- }
3511-
3512- // https://github.com/nodejs/node/issues/21219
3513- // TODO(devsnek): remove when v8 supports Atomics.notify
3514- auto atomics_key = FIXED_ONE_BYTE_STRING (isolate, " Atomics" );
3515- Local<Value> atomics_v;
3516- if (context->Global ()->Get (context, atomics_key).ToLocal (&atomics_v) &&
3517- atomics_v->IsObject ()) {
3518- Local<Object> atomics = atomics_v.As <Object>();
3519- auto wake_key = FIXED_ONE_BYTE_STRING (isolate, " wake" );
3520-
3521- Local<Value> wake = atomics->Get (context, wake_key).ToLocalChecked ();
3522- auto notify_key = FIXED_ONE_BYTE_STRING (isolate, " notify" );
3523-
3524- v8::PropertyDescriptor desc (wake, true );
3525- desc.set_enumerable (false );
3526- desc.set_configurable (true );
3527-
3528- atomics->DefineProperty (context, notify_key, desc).ToChecked ();
3504+ {
3505+ // Run lib/internal/per_context.js
3506+ Context::Scope context_scope (context);
3507+ Local<String> per_context = NodePerContextSource (isolate);
3508+ v8::ScriptCompiler::Source per_context_src (per_context, nullptr );
3509+ Local<v8::Script> s = v8::ScriptCompiler::Compile (
3510+ context,
3511+ &per_context_src).ToLocalChecked ();
3512+ s->Run (context).ToLocalChecked ();
35293513 }
35303514
35313515 return context;
0 commit comments