chore: bump Node.js to v16.2.0 (#29244)
This commit is contained in:
parent
9a7e61cfc0
commit
542abcd6fd
51 changed files with 1829 additions and 1499 deletions
|
@ -49,7 +49,7 @@ namespace {
|
|||
|
||||
// Initialize Node.js cli options to pass to Node.js
|
||||
// See https://nodejs.org/api/cli.html#cli_options
|
||||
void SetNodeCliFlags() {
|
||||
int SetNodeCliFlags() {
|
||||
// Options that are unilaterally disallowed
|
||||
const std::unordered_set<base::StringPiece, base::StringPieceHash>
|
||||
disallowed = {"--openssl-config", "--use-bundled-ca", "--use-openssl-ca",
|
||||
|
@ -74,6 +74,10 @@ void SetNodeCliFlags() {
|
|||
if (disallowed.count(stripped) != 0) {
|
||||
LOG(ERROR) << "The Node.js cli flag " << stripped
|
||||
<< " is not supported in Electron";
|
||||
// Node.js returns 9 from ProcessGlobalArgs for any errors encountered
|
||||
// when setting up cli flags and env vars. Since we're outlawing these
|
||||
// flags (making them errors) return 9 here for consistency.
|
||||
return 9;
|
||||
} else {
|
||||
args.push_back(option);
|
||||
}
|
||||
|
@ -83,7 +87,8 @@ void SetNodeCliFlags() {
|
|||
|
||||
// Node.js itself will output parsing errors to
|
||||
// console so we don't need to handle that ourselves
|
||||
ProcessGlobalArgs(&args, nullptr, &errors, node::kDisallowedInEnvironment);
|
||||
return ProcessGlobalArgs(&args, nullptr, &errors,
|
||||
node::kDisallowedInEnvironment);
|
||||
}
|
||||
|
||||
#if defined(MAS_BUILD)
|
||||
|
@ -156,7 +161,6 @@ int NodeMain(int argc, char* argv[]) {
|
|||
int exit_code = 1;
|
||||
{
|
||||
// Feed gin::PerIsolateData with a task runner.
|
||||
argv = uv_setup_args(argc, argv);
|
||||
uv_loop_t* loop = uv_default_loop();
|
||||
auto uv_task_runner = base::MakeRefCounted<UvTaskRunner>(loop);
|
||||
base::ThreadTaskRunnerHandle handle(uv_task_runner);
|
||||
|
@ -170,11 +174,15 @@ int NodeMain(int argc, char* argv[]) {
|
|||
NodeBindings::RegisterBuiltinModules();
|
||||
|
||||
// Parse and set Node.js cli flags.
|
||||
SetNodeCliFlags();
|
||||
int flags_exit_code = SetNodeCliFlags();
|
||||
if (flags_exit_code != 0)
|
||||
exit(flags_exit_code);
|
||||
|
||||
int exec_argc;
|
||||
const char** exec_argv;
|
||||
node::Init(&argc, const_cast<const char**>(argv), &exec_argc, &exec_argv);
|
||||
node::InitializationResult result =
|
||||
node::InitializeOncePerProcess(argc, argv);
|
||||
|
||||
if (result.early_return)
|
||||
exit(result.exit_code);
|
||||
|
||||
gin::V8Initializer::LoadV8Snapshot(
|
||||
gin::V8Initializer::V8SnapshotFileType::kWithAdditionalContext);
|
||||
|
@ -201,11 +209,8 @@ int NodeMain(int argc, char* argv[]) {
|
|||
isolate_data = node::CreateIsolateData(isolate, loop, gin_env.platform());
|
||||
CHECK_NE(nullptr, isolate_data);
|
||||
|
||||
std::vector<std::string> args(argv, argv + argc); // NOLINT
|
||||
std::vector<std::string> exec_args(exec_argv,
|
||||
exec_argv + exec_argc); // NOLINT
|
||||
env = node::CreateEnvironment(isolate_data, gin_env.context(), args,
|
||||
exec_args);
|
||||
env = node::CreateEnvironment(isolate_data, gin_env.context(),
|
||||
result.args, result.exec_args);
|
||||
CHECK_NOT_NULL(env);
|
||||
|
||||
node::IsolateSettings is;
|
||||
|
@ -240,7 +245,7 @@ int NodeMain(int argc, char* argv[]) {
|
|||
}
|
||||
|
||||
v8::HandleScope scope(isolate);
|
||||
node::LoadEnvironment(env);
|
||||
node::LoadEnvironment(env, node::StartExecutionCallback{});
|
||||
|
||||
env->set_trace_sync_io(env->options()->trace_sync_io);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue