@@ -11,10 +11,10 @@ its own blended handler between Node and Blink.
11
11
Not upstreamable.
12
12
13
13
diff --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
15
15
--- a/lib/internal/modules/esm/utils.js
16
16
+++ b/lib/internal/modules/esm/utils.js
17
- @@ -22 ,7 +22 ,7 @@ const {
17
+ @@ -23 ,7 +23 ,7 @@ const {
18
18
ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING,
19
19
ERR_INVALID_ARG_VALUE,
20
20
} = require('internal/errors').codes;
@@ -23,14 +23,14 @@ index 41077285452eac05766a22c2e1d252868e7e548b..2246e57efcf0b95903644d643ad55727
23
23
const {
24
24
loadPreloadModules,
25
25
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 .
28
28
*/
29
- function initializeESM(isLoaderWorker = false) {
29
+ function initializeESM(forceDefaultLoader = false) {
30
30
+ const shouldSetOnIsolate = !getEmbedderOptions().shouldNotRegisterESMLoader;
31
- _isLoaderWorker = isLoaderWorker ;
31
+ _forceDefaultLoader = forceDefaultLoader ;
32
32
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
34
34
// track of for different ESM modules.
35
35
- setInitializeImportMetaObjectCallback(initializeImportMetaObject);
36
36
- setImportModuleDynamicallyCallback(importModuleDynamicallyCallback);
@@ -40,10 +40,10 @@ index 41077285452eac05766a22c2e1d252868e7e548b..2246e57efcf0b95903644d643ad55727
40
40
41
41
/**
42
42
diff --git a/src/module_wrap.cc b/src/module_wrap.cc
43
- index 52c30dcb47d1faba0c2267e4381a624e450baa02..ba4c1a0d5a987e4d410b49f5c47166943bd101a6 100644
43
+ index 895ff3a5948add3513700ecc2f32fce4c2fbe4eb..3182a5e4aad2ba0be2b6769edb696b815ce39a61 100644
44
44
--- a/src/module_wrap.cc
45
45
+++ b/src/module_wrap.cc
46
- @@ -547 ,7 +547 ,7 @@ MaybeLocal<Module> ModuleWrap::ResolveModuleCallback(
46
+ @@ -554 ,7 +554 ,7 @@ MaybeLocal<Module> ModuleWrap::ResolveModuleCallback(
47
47
return module->module_.Get(isolate);
48
48
}
49
49
@@ -52,31 +52,31 @@ index 52c30dcb47d1faba0c2267e4381a624e450baa02..ba4c1a0d5a987e4d410b49f5c4716694
52
52
Local<Context> context,
53
53
Local<v8::Data> host_defined_options,
54
54
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);
57
57
HandleScope handle_scope(isolate);
58
58
59
59
- CHECK_EQ(args.Length(), 1);
60
60
+ CHECK_EQ(args.Length(), 2);
61
61
CHECK(args[0]->IsFunction());
62
62
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);
64
64
65
65
- isolate->SetHostImportModuleDynamicallyCallback(ImportModuleDynamically);
66
66
+ if (args[1]->IsBoolean() && args[1]->BooleanValue(isolate))
67
67
+ isolate->SetHostImportModuleDynamicallyCallback(ImportModuleDynamically);
68
68
}
69
69
70
70
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();
74
74
75
75
- CHECK_EQ(args.Length(), 1);
76
76
+ CHECK_EQ(args.Length(), 2);
77
77
CHECK(args[0]->IsFunction());
78
78
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);
80
80
81
81
- isolate->SetHostInitializeImportMetaObjectCallback(
82
82
- HostInitializeImportMetaObjectCallback);
0 commit comments