@@ -11,10 +11,10 @@ its own blended handler between Node and Blink.
1111Not upstreamable.
1212
1313diff --git a/lib/internal/modules/esm/utils.js b/lib/internal/modules/esm/utils.js
14- index 41077285452eac05766a22c2e1d252868e7e548b..2246e57efcf0b95903644d643ad5572717ecdaf4 100644
14+ index 003ae7eb987f03611444f02695bc8582e0ac6a67..bbf1df480bc6ec90ee3ac29312dc89ff8bf94ab3 100644
1515--- a/lib/internal/modules/esm/utils.js
1616+++ b/lib/internal/modules/esm/utils.js
17- @@ -22 ,7 +22 ,7 @@ const {
17+ @@ -23 ,7 +23 ,7 @@ const {
1818 ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING,
1919 ERR_INVALID_ARG_VALUE,
2020 } = require('internal/errors').codes;
@@ -23,14 +23,14 @@ index 41077285452eac05766a22c2e1d252868e7e548b..2246e57efcf0b95903644d643ad55727
2323 const {
2424 loadPreloadModules,
2525 initializeFrozenIntrinsics,
26- @@ -190 ,12 +190 ,13 @@ let _isLoaderWorker = false;
27- * @param {boolean} [isLoaderWorker =false] - A boolean indicating whether the loader is a worker or not .
26+ @@ -221 ,12 +221 ,13 @@ let _forceDefaultLoader = false;
27+ * @param {boolean} [forceDefaultLoader =false] - A boolean indicating disabling custom loaders .
2828 */
29- function initializeESM(isLoaderWorker = false) {
29+ function initializeESM(forceDefaultLoader = false) {
3030+ const shouldSetOnIsolate = !getEmbedderOptions().shouldNotRegisterESMLoader;
31- _isLoaderWorker = isLoaderWorker ;
31+ _forceDefaultLoader = forceDefaultLoader ;
3232 initializeDefaultConditions();
33- // Setup per-isolate callbacks that locate data or callbacks that we keep
33+ // Setup per-realm callbacks that locate data or callbacks that we keep
3434 // track of for different ESM modules.
3535- setInitializeImportMetaObjectCallback(initializeImportMetaObject);
3636- setImportModuleDynamicallyCallback(importModuleDynamicallyCallback);
@@ -40,10 +40,10 @@ index 41077285452eac05766a22c2e1d252868e7e548b..2246e57efcf0b95903644d643ad55727
4040
4141 /**
4242diff --git a/src/module_wrap.cc b/src/module_wrap.cc
43- index 52c30dcb47d1faba0c2267e4381a624e450baa02..ba4c1a0d5a987e4d410b49f5c47166943bd101a6 100644
43+ index 895ff3a5948add3513700ecc2f32fce4c2fbe4eb..3182a5e4aad2ba0be2b6769edb696b815ce39a61 100644
4444--- a/src/module_wrap.cc
4545+++ b/src/module_wrap.cc
46- @@ -547 ,7 +547 ,7 @@ MaybeLocal<Module> ModuleWrap::ResolveModuleCallback(
46+ @@ -554 ,7 +554 ,7 @@ MaybeLocal<Module> ModuleWrap::ResolveModuleCallback(
4747 return module->module_.Get(isolate);
4848 }
4949
@@ -52,31 +52,31 @@ index 52c30dcb47d1faba0c2267e4381a624e450baa02..ba4c1a0d5a987e4d410b49f5c4716694
5252 Local<Context> context,
5353 Local<v8::Data> host_defined_options,
5454 Local<Value> resource_name,
55- @@ -608 ,12 +608 ,13 @@ void ModuleWrap::SetImportModuleDynamicallyCallback(
56- Environment* env = Environment ::GetCurrent(args);
55+ @@ -618 ,12 +618 ,13 @@ void ModuleWrap::SetImportModuleDynamicallyCallback(
56+ Realm* realm = Realm ::GetCurrent(args);
5757 HandleScope handle_scope(isolate);
5858
5959- CHECK_EQ(args.Length(), 1);
6060+ CHECK_EQ(args.Length(), 2);
6161 CHECK(args[0]->IsFunction());
6262 Local<Function> import_callback = args[0].As<Function>();
63- env ->set_host_import_module_dynamically_callback(import_callback);
63+ realm ->set_host_import_module_dynamically_callback(import_callback);
6464
6565- isolate->SetHostImportModuleDynamicallyCallback(ImportModuleDynamically);
6666+ if (args[1]->IsBoolean() && args[1]->BooleanValue(isolate))
6767+ isolate->SetHostImportModuleDynamicallyCallback(ImportModuleDynamically);
6868 }
6969
7070 void ModuleWrap::HostInitializeImportMetaObjectCallback(
71- @@ -650 ,13 +651 ,14 @@ void ModuleWrap::SetInitializeImportMetaObjectCallback(
72- Environment* env = Environment ::GetCurrent(args);
73- Isolate* isolate = env ->isolate();
71+ @@ -665 ,13 +666 ,14 @@ void ModuleWrap::SetInitializeImportMetaObjectCallback(
72+ Realm* realm = Realm ::GetCurrent(args);
73+ Isolate* isolate = realm ->isolate();
7474
7575- CHECK_EQ(args.Length(), 1);
7676+ CHECK_EQ(args.Length(), 2);
7777 CHECK(args[0]->IsFunction());
7878 Local<Function> import_meta_callback = args[0].As<Function>();
79- env ->set_host_initialize_import_meta_object_callback(import_meta_callback);
79+ realm ->set_host_initialize_import_meta_object_callback(import_meta_callback);
8080
8181- isolate->SetHostInitializeImportMetaObjectCallback(
8282- HostInitializeImportMetaObjectCallback);
0 commit comments