Skip to content

Commit

Permalink
src: remove calls to recently deprecated V8 APIs
Browse files Browse the repository at this point in the history
Closes: nodejs#52991
PR-URL: nodejs#52996
Fixes: nodejs#52991
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
  • Loading branch information
ajklein authored and bmeck committed Jun 22, 2024
1 parent 54bd13c commit 9879c7c
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 23 deletions.
4 changes: 1 addition & 3 deletions src/module_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -339,8 +339,7 @@ MaybeLocal<Module> ModuleWrap::CompileSourceTextModule(
bool* cache_rejected) {
Isolate* isolate = realm->isolate();
EscapableHandleScope scope(isolate);
ScriptOrigin origin(isolate,
url,
ScriptOrigin origin(url,
line_offset,
column_offset,
true, // is cross origin
Expand Down Expand Up @@ -549,7 +548,6 @@ void ModuleWrap::Evaluate(const FunctionCallbackInfo<Value>& args) {

ShouldNotAbortOnUncaughtScope no_abort_scope(realm->env());
TryCatchScope try_catch(realm->env());
Isolate::SafeForTerminationScope safe_for_termination(isolate);

bool timed_out = false;
bool received_signal = false;
Expand Down
2 changes: 1 addition & 1 deletion src/node_builtins.cc
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ MaybeLocal<Function> BuiltinLoader::LookupAndCompileInternal(
std::string filename_s = std::string("node:") + id;
Local<String> filename =
OneByteString(isolate, filename_s.c_str(), filename_s.size());
ScriptOrigin origin(isolate, filename, 0, 0, true);
ScriptOrigin origin(filename, 0, 0, true);

BuiltinCodeCacheData cached_data{};
{
Expand Down
28 changes: 12 additions & 16 deletions src/node_contextify.cc
Original file line number Diff line number Diff line change
Expand Up @@ -886,16 +886,15 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
host_defined_options->Set(
isolate, loader::HostDefinedOptions::kID, id_symbol);

ScriptOrigin origin(isolate,
filename,
line_offset, // line offset
column_offset, // column offset
true, // is cross origin
-1, // script id
Local<Value>(), // source map URL
false, // is opaque (?)
false, // is WASM
false, // is ES Module
ScriptOrigin origin(filename,
line_offset, // line offset
column_offset, // column offset
true, // is cross origin
-1, // script id
Local<Value>(), // source map URL
false, // is opaque (?)
false, // is WASM
false, // is ES Module
host_defined_options);
ScriptCompiler::Source source(code, origin, cached_data);
ScriptCompiler::CompileOptions compile_options =
Expand Down Expand Up @@ -1006,7 +1005,7 @@ MaybeLocal<Function> CompileFunction(Local<Context> context,
Local<String> filename,
Local<String> content,
std::vector<Local<String>>* parameters) {
ScriptOrigin script_origin(context->GetIsolate(), filename, 0, 0, true);
ScriptOrigin script_origin(filename, 0, 0, true);
ScriptCompiler::Source script_source(content, script_origin);

return ScriptCompiler::CompileFunction(context,
Expand Down Expand Up @@ -1116,7 +1115,6 @@ bool ContextifyScript::EvalMachine(Local<Context> context,
}

TryCatchScope try_catch(env);
Isolate::SafeForTerminationScope safe_for_termination(env->isolate());
ContextifyScript* wrapped_script;
ASSIGN_OR_RETURN_UNWRAP(&wrapped_script, args.Holder(), false);
Local<UnboundScript> unbound_script =
Expand Down Expand Up @@ -1270,8 +1268,7 @@ void ContextifyContext::CompileFunction(
Local<PrimitiveArray> host_defined_options =
loader::ModuleWrap::GetHostDefinedOptions(isolate, id_symbol);

ScriptOrigin origin(isolate,
filename,
ScriptOrigin origin(filename,
line_offset, // line offset
column_offset, // column offset
true, // is cross origin
Expand Down Expand Up @@ -1452,8 +1449,7 @@ static MaybeLocal<Function> CompileFunctionForCJSLoader(Environment* env,
Local<Symbol> symbol = env->vm_dynamic_import_default_internal();
Local<PrimitiveArray> hdo =
loader::ModuleWrap::GetHostDefinedOptions(isolate, symbol);
ScriptOrigin origin(isolate,
filename,
ScriptOrigin origin(filename,
0, // line offset
0, // column offset
true, // is cross origin
Expand Down
3 changes: 0 additions & 3 deletions test/cctest/test_environment.cc
Original file line number Diff line number Diff line change
Expand Up @@ -620,12 +620,9 @@ TEST_F(EnvironmentTest, SetImmediateMicrotasks) {

#ifndef _WIN32 // No SIGINT on Windows.
TEST_F(NodeZeroIsolateTestFixture, CtrlCWithOnlySafeTerminationTest) {
// We need to go through the whole setup dance here because we want to
// set only_terminate_in_safe_scope.
// Allocate and initialize Isolate.
v8::Isolate::CreateParams create_params;
create_params.array_buffer_allocator = allocator.get();
create_params.only_terminate_in_safe_scope = true;
v8::Isolate* isolate = v8::Isolate::Allocate();
CHECK_NOT_NULL(isolate);
platform->RegisterIsolate(isolate, &current_loop);
Expand Down

0 comments on commit 9879c7c

Please sign in to comment.