Files
electron/patches/node/chore_split_createenvironment_into_createenvironment_and.patch
Electron Bot 9713fa09e7 chore: bump node to v12.8.0 (master) (#19521)
* chore: bump node in DEPS to v12.7.0

* chore: update node patches v12.6 to v12.7

Removed patches that are no longer necessary because we've upstreamed few changes already, and 3 way merge others

* fix: update build gn patch

* chore: bump node in DEPS to v12.8.0

* chore: update node patches v12.7 to v12.8

Removed patches that are no longer necessary because we've upstreamed few changes already, and 3 way merge others

* fix: Add patch to revert crypto createhash changes

The original node commit contains changes/calls to functions that are not supported in boringssl.

* disable node tests

* Remove outdated patch, already merged upstream
2019-08-12 17:29:34 -07:00

70 lines
2.8 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Samuel Attard <sattard@slack-corp.com>
Date: Wed, 17 Jul 2019 14:45:59 -0700
Subject: chore: split CreateEnvironment into CreateEnvironment and
BootstrapEnvironment
This allows us to run operations on a created but not yet bootstrapped
environment such as setting up an InspectorAgent
diff --git a/src/api/environment.cc b/src/api/environment.cc
index 443f49320b2e6720f932fcfcefdbe6e539594964..4d79af9ec2a7b476c5f86f3882f4fb63afafc53e 100644
--- a/src/api/environment.cc
+++ b/src/api/environment.cc
@@ -263,7 +263,8 @@ Environment* CreateEnvironment(IsolateData* isolate_data,
int argc,
const char* const* argv,
int exec_argc,
- const char* const* exec_argv) {
+ const char* const* exec_argv,
+ bool bootstrap) {
Isolate* isolate = context->GetIsolate();
HandleScope handle_scope(isolate);
Context::Scope context_scope(context);
@@ -281,9 +282,16 @@ Environment* CreateEnvironment(IsolateData* isolate_data,
Environment::kOwnsProcessState |
Environment::kOwnsInspector));
env->InitializeLibuv(per_process::v8_is_profiling);
- if (env->RunBootstrapping().IsEmpty()) {
+ if (bootstrap && !BootstrapEnvironment(env)) {
return nullptr;
}
+ return env;
+}
+
+bool BootstrapEnvironment(Environment* env) {
+ if (env->RunBootstrapping().IsEmpty()) {
+ return false;
+ }
std::vector<Local<String>> parameters = {
env->require_string(),
@@ -296,9 +304,10 @@ Environment* CreateEnvironment(IsolateData* isolate_data,
if (ExecuteBootstrapper(
env, "internal/bootstrap/environment", &parameters, &arguments)
.IsEmpty()) {
- return nullptr;
+ return false;
}
- return env;
+
+ return true;
}
void FreeEnvironment(Environment* env) {
diff --git a/src/node.h b/src/node.h
index c51fb1a6a6e497a091e2ba0b147e3d7b6a4d685c..211f00cca65eeba317a03af36411a19a6befae18 100644
--- a/src/node.h
+++ b/src/node.h
@@ -330,7 +330,9 @@ NODE_EXTERN Environment* CreateEnvironment(IsolateData* isolate_data,
int argc,
const char* const* argv,
int exec_argc,
- const char* const* exec_argv);
+ const char* const* exec_argv,
+ bool bootstrap = true);
+NODE_EXTERN bool BootstrapEnvironment(Environment* env);
NODE_EXTERN void LoadEnvironment(Environment* env);
NODE_EXTERN void FreeEnvironment(Environment* env);