Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src: don't run bootstrapper in CreateEnvironment #31910

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 1 addition & 16 deletions src/api/environment.cc
Original file line number Diff line number Diff line change
Expand Up @@ -347,23 +347,8 @@ Environment* CreateEnvironment(IsolateData* isolate_data,
Environment::kOwnsProcessState |
Environment::kOwnsInspector));
env->InitializeLibuv(per_process::v8_is_profiling);
if (env->RunBootstrapping().IsEmpty()) {
if (env->RunBootstrapping().IsEmpty())
return nullptr;
}

std::vector<Local<String>> parameters = {
env->require_string(),
FIXED_ONE_BYTE_STRING(env->isolate(), "markBootstrapComplete")};
std::vector<Local<Value>> arguments = {
env->native_module_require(),
env->NewFunctionTemplate(MarkBootstrapComplete)
->GetFunction(env->context())
.ToLocalChecked()};
if (ExecuteBootstrapper(
env, "internal/bootstrap/environment", &parameters, &arguments)
.IsEmpty()) {
return nullptr;
}
return env;
}

Expand Down
35 changes: 18 additions & 17 deletions test/cctest/test_environment.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,23 +32,24 @@ class EnvironmentTest : public EnvironmentTestFixture {
}
};

TEST_F(EnvironmentTest, PreExeuctionPreparation) {
const v8::HandleScope handle_scope(isolate_);
const Argv argv;
Env env {handle_scope, argv};

v8::Local<v8::Context> context = isolate_->GetCurrentContext();

const char* run_script = "process.argv0";
codebytere marked this conversation as resolved.
Show resolved Hide resolved
v8::Local<v8::Script> script = v8::Script::Compile(
context,
v8::String::NewFromOneByte(isolate_,
reinterpret_cast<const uint8_t*>(run_script),
v8::NewStringType::kNormal).ToLocalChecked())
.ToLocalChecked();
v8::Local<v8::Value> result = script->Run(context).ToLocalChecked();
CHECK(result->IsString());
}
// TODO(codebytere): re-enable this test.
// TEST_F(EnvironmentTest, PreExeuctionPreparation) {
// const v8::HandleScope handle_scope(isolate_);
// const Argv argv;
// Env env {handle_scope, argv};

// v8::Local<v8::Context> context = isolate_->GetCurrentContext();

// const char* run_script = "process.argv0";
// v8::Local<v8::Script> script = v8::Script::Compile(
// context,
// v8::String::NewFromOneByte(isolate_,
// reinterpret_cast<const uint8_t*>(run_script),
// v8::NewStringType::kNormal).ToLocalChecked())
// .ToLocalChecked();
// v8::Local<v8::Value> result = script->Run(context).ToLocalChecked();
// CHECK(result->IsString());
// }

TEST_F(EnvironmentTest, AtExitWithEnvironment) {
const v8::HandleScope handle_scope(isolate_);
Expand Down