@@ -15,27 +15,37 @@ This patch is expected to be deleted once we catch up with a Node.js
15
15
upgrade that includes the original Node.js commit above.
16
16
17
17
diff --git a/src/module_wrap.cc b/src/module_wrap.cc
18
- index ff658ec88e5161cd66536ee6e95dba675b16eccc..9bbb8ab908d8d992abb43254860d51f57f56387b 100644
18
+ index 0f0b16fcdd8a97bba60faeff09300dd8102cf02c..094d12ffe99500af700a591f5cb33e7d7b247ed1 100644
19
19
--- a/src/module_wrap.cc
20
20
+++ b/src/module_wrap.cc
21
- @@ -202 ,8 +202 ,7 @@ void ModuleWrap::New(const FunctionCallbackInfo<Value>& args) {
22
- }
23
-
24
- Local<String> source_text = args[2].As<String>( );
25
- - ScriptOrigin origin(isolate,
26
- - url,
27
- + ScriptOrigin origin(url,
28
- line_offset,
29
- column_offset,
30
- true, // is cross origin
31
- @@ -464 ,7 +463 ,6 @@ void ModuleWrap::Evaluate(const FunctionCallbackInfo<Value>& args) {
21
+ @@ -304 ,8 +304 ,7 @@ MaybeLocal<Module> ModuleWrap::CompileSourceTextModule(
22
+ bool* cache_rejected) {
23
+ Isolate* isolate = realm->isolate();
24
+ EscapableHandleScope scope(isolate );
25
+ - ScriptOrigin origin(isolate,
26
+ - url,
27
+ + ScriptOrigin origin(url,
28
+ line_offset,
29
+ column_offset,
30
+ true, // is cross origin
31
+ @@ -500 ,7 +499 ,6 @@ void ModuleWrap::Evaluate(const FunctionCallbackInfo<Value>& args) {
32
32
33
33
ShouldNotAbortOnUncaughtScope no_abort_scope(realm->env());
34
34
TryCatchScope try_catch(realm->env());
35
35
- Isolate::SafeForTerminationScope safe_for_termination(isolate);
36
36
37
37
bool timed_out = false;
38
38
bool received_signal = false;
39
+ @@ -1009,8 +1007,7 @@ void ModuleWrap::CreateRequiredModuleFacade(
40
+ ASSIGN_OR_RETURN_UNWRAP(&original, wrap);
41
+
42
+ // Use the same facade source and URL to hit the compilation cache.
43
+ - ScriptOrigin origin(isolate,
44
+ - env->required_module_facade_url_string(),
45
+ + ScriptOrigin origin(env->required_module_facade_url_string(),
46
+ 0, // line offset
47
+ 0, // column offset
48
+ true, // is cross origin
39
49
diff --git a/src/node_builtins.cc b/src/node_builtins.cc
40
50
index 4bf80aa6cc6385dc376fd0a3538efc27fe5bd0a2..3e37aa8b0c9696cceb3f3cfab9721f38c74a2fba 100644
41
51
--- a/src/node_builtins.cc
@@ -50,36 +60,20 @@ index 4bf80aa6cc6385dc376fd0a3538efc27fe5bd0a2..3e37aa8b0c9696cceb3f3cfab9721f38
50
60
BuiltinCodeCacheData cached_data{};
51
61
{
52
62
diff --git a/src/node_contextify.cc b/src/node_contextify.cc
53
- index 6456d87d4202c013aafe071adbac06852b3ae2c1..28ba7dbe66a44a43c39e3d75edf0be9513bcf732 100644
63
+ index c8ccf38eaaeaccf3715b742e7e64cf7803dbb392..a3f70f6cba773d0a7a00aca96a1687c1e2ae38e6 100644
54
64
--- a/src/node_contextify.cc
55
65
+++ b/src/node_contextify.cc
56
- @@ -877,16 +877,15 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
66
+ @@ -878,8 +878,7 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
57
67
host_defined_options->Set(
58
68
isolate, loader::HostDefinedOptions::kID, id_symbol);
59
69
60
70
- ScriptOrigin origin(isolate,
61
71
- filename,
62
- - line_offset, // line offset
63
- - column_offset, // column offset
64
- - true, // is cross origin
65
- - -1, // script id
66
- - Local<Value>(), // source map URL
67
- - false, // is opaque (?)
68
- - false, // is WASM
69
- - false, // is ES Module
70
72
+ ScriptOrigin origin(filename,
71
- + line_offset, // line offset
72
- + column_offset, // column offset
73
- + true, // is cross origin
74
- + -1, // script id
75
- + Local<Value>(), // source map URL
76
- + false, // is opaque (?)
77
- + false, // is WASM
78
- + false, // is ES Module
79
- host_defined_options);
80
- ScriptCompiler::Source source(code, origin, cached_data);
81
- ScriptCompiler::CompileOptions compile_options =
82
- @@ -998,7 +997,7 @@ MaybeLocal<Function> CompileFunction(Local<Context> context,
73
+ line_offset, // line offset
74
+ column_offset, // column offset
75
+ true, // is cross origin
76
+ @@ -999,7 +998,7 @@ MaybeLocal<Function> CompileFunction(Local<Context> context,
83
77
Local<String> filename,
84
78
Local<String> content,
85
79
std::vector<Local<String>>* parameters) {
@@ -88,81 +82,34 @@ index 6456d87d4202c013aafe071adbac06852b3ae2c1..28ba7dbe66a44a43c39e3d75edf0be95
88
82
ScriptCompiler::Source script_source(content, script_origin);
89
83
90
84
return ScriptCompiler::CompileFunction(context,
91
- @@ -1108 ,7 +1107 ,6 @@ bool ContextifyScript::EvalMachine(Local<Context> context,
85
+ @@ -1109 ,7 +1108 ,6 @@ bool ContextifyScript::EvalMachine(Local<Context> context,
92
86
}
93
87
94
88
TryCatchScope try_catch(env);
95
89
- Isolate::SafeForTerminationScope safe_for_termination(env->isolate());
96
90
ContextifyScript* wrapped_script;
97
91
ASSIGN_OR_RETURN_UNWRAP(&wrapped_script, args.This(), false);
98
92
Local<UnboundScript> unbound_script =
99
- @@ -1286 ,8 +1284 ,7 @@ void ContextifyContext::CompileFunction(
93
+ @@ -1278 ,8 +1276 ,7 @@ void ContextifyContext::CompileFunction(
100
94
Local<PrimitiveArray> host_defined_options =
101
- GetHostDefinedOptions(isolate, id_symbol);
102
- ScriptCompiler::Source source =
103
- - GetCommonJSSourceInstance(isolate,
104
- - code,
105
- + GetCommonJSSourceInstance(code,
106
- filename,
107
- line_offset,
108
- column_offset,
109
- @@ -1342,15 +1339,13 @@ void ContextifyContext::CompileFunction(
110
- }
95
+ loader::ModuleWrap::GetHostDefinedOptions(isolate, id_symbol);
111
96
112
- ScriptCompiler::Source ContextifyContext::GetCommonJSSourceInstance(
113
- - Isolate* isolate,
114
- Local<String> code,
115
- Local<String> filename,
116
- int line_offset,
117
- int column_offset,
118
- Local<PrimitiveArray> host_defined_options,
119
- ScriptCompiler::CachedData* cached_data) {
120
97
- ScriptOrigin origin(isolate,
121
98
- filename,
122
99
+ ScriptOrigin origin(filename,
123
100
line_offset, // line offset
124
101
column_offset, // column offset
125
102
true, // is cross origin
126
- @@ -1528,7 +1523,7 @@ void ContextifyContext::ContainsModuleSyntax(
127
- Local<PrimitiveArray> host_defined_options =
128
- GetHostDefinedOptions(isolate, id_symbol);
129
- ScriptCompiler::Source source = GetCommonJSSourceInstance(
130
- - isolate, code, filename, 0, 0, host_defined_options, nullptr);
131
- + code, filename, 0, 0, host_defined_options, nullptr);
132
- ScriptCompiler::CompileOptions options = GetCompileOptions(source);
133
-
134
- std::vector<Local<String>> params = GetCJSParameters(env->isolate_data());
135
- @@ -1576,7 +1571,7 @@ void ContextifyContext::ContainsModuleSyntax(
136
- code,
137
- String::NewFromUtf8(isolate, "})();").ToLocalChecked());
138
- ScriptCompiler::Source wrapped_source = GetCommonJSSourceInstance(
139
- - isolate, code, filename, 0, 0, host_defined_options, nullptr);
140
- + code, filename, 0, 0, host_defined_options, nullptr);
141
- std::ignore = ScriptCompiler::CompileFunction(
142
- context,
143
- &wrapped_source,
144
- @@ -1629,8 +1624,7 @@ static void CompileFunctionForCJSLoader(
145
-
103
+ @@ -1466,8 +1463,7 @@ static MaybeLocal<Function> CompileFunctionForCJSLoader(
146
104
Local<Symbol> symbol = env->vm_dynamic_import_default_internal();
147
- Local<PrimitiveArray> hdo = GetHostDefinedOptions(isolate, symbol);
105
+ Local<PrimitiveArray> hdo =
106
+ loader::ModuleWrap::GetHostDefinedOptions(isolate, symbol);
148
107
- ScriptOrigin origin(isolate,
149
108
- filename,
150
109
+ ScriptOrigin origin(filename,
151
110
0, // line offset
152
111
0, // column offset
153
112
true, // is cross origin
154
- diff --git a/src/node_contextify.h b/src/node_contextify.h
155
- index 517e3f44d324900222e1da961a4cd60bbb4a85f9..10715c7eb07715cc11e49734bd54747dad95f6a4 100644
156
- --- a/src/node_contextify.h
157
- +++ b/src/node_contextify.h
158
- @@ -99,7 +99,6 @@ class ContextifyContext : public BaseObject {
159
- v8::Local<v8::Symbol> id_symbol,
160
- const errors::TryCatchScope& try_catch);
161
- static v8::ScriptCompiler::Source GetCommonJSSourceInstance(
162
- - v8::Isolate* isolate,
163
- v8::Local<v8::String> code,
164
- v8::Local<v8::String> filename,
165
- int line_offset,
166
113
diff --git a/test/cctest/test_environment.cc b/test/cctest/test_environment.cc
167
114
index 64e38c83006a004ebc3519a5e9f8b04263244514..14e82cc80ff73084fb43b2ef07febfd2667a0abc 100644
168
115
--- a/test/cctest/test_environment.cc
0 commit comments