| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 5019b54 commit 8adaa13
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -392,12 +392,13 @@ Environment* CreateEnvironment( | |||
| 392 | 392 | // options than the global parse call. | |
| 393 | 393 | Environment* env = new Environment( | |
| 394 | 394 | isolate_data, context, args, exec_args, nullptr, flags, thread_id); | |
| 395 | + | ||
| 395 | 396 | #if HAVE_INSPECTOR | |
| 396 | 397 | if (env->should_create_inspector()) { | |
| 397 | 398 | if (inspector_parent_handle) { | |
| 398 | - env->InitializeInspector( | ||
| 399 | - std::move(static_cast<InspectorParentHandleImpl*>( | ||
| 400 | - inspector_parent_handle.get())->impl)); | ||
| 399 | + env->InitializeInspector(std::move( | ||
| 400 | + static_cast<InspectorParentHandleImpl*>(inspector_parent_handle.get()) | ||
| 401 | + ->impl)); | ||
| 401 | 402 | } else { | |
| 402 | 403 | env->InitializeInspector({}); | |
| 403 | 404 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -180,19 +180,8 @@ NodeMainInstance::CreateMainEnvironment(int* exit_code) { | |||
| 180 | 180 | context = NewContext(isolate_); | |
| 181 | 181 | CHECK(!context.IsEmpty()); | |
| 182 | 182 | Context::Scope context_scope(context); | |
| 183 | - env.reset(new Environment(isolate_data_.get(), | ||
| 184 | - context, | ||
| 185 | - args_, | ||
| 186 | - exec_args_, | ||
| 187 | - nullptr, | ||
| 188 | - EnvironmentFlags::kDefaultFlags, | ||
| 189 | - {})); | ||
| 190 | - #if HAVE_INSPECTOR | ||
| 191 | - env->InitializeInspector({}); | ||
| 192 | - #endif | ||
| 193 | - if (env->principal_realm()->RunBootstrapping().IsEmpty()) { | ||
| 194 | - return nullptr; | ||
| 195 | - } | ||
| 183 | + env.reset( | ||
| 184 | + CreateEnvironment(isolate_data_.get(), context, args_, exec_args_)); | ||
| 196 | 185 | } | |
| 197 | 186 | ||
| 198 | 187 | return env; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1159,16 +1159,21 @@ int SnapshotBuilder::Generate(SnapshotData* out, | |||
| 1159 | 1159 | Context::Scope context_scope(main_context); | |
| 1160 | 1160 | ||
| 1161 | 1161 | // Create the environment. | |
| 1162 | - env = new Environment(main_instance->isolate_data(), | ||
| 1163 | - main_context, | ||
| 1164 | - args, | ||
| 1165 | - exec_args, | ||
| 1166 | - nullptr, | ||
| 1167 | - node::EnvironmentFlags::kDefaultFlags, | ||
| 1168 | - {}); | ||
| 1169 | - | ||
| 1170 | - // Run scripts in lib/internal/bootstrap/ | ||
| 1171 | - if (env->principal_realm()->RunBootstrapping().IsEmpty()) { | ||
| 1162 | + // It's not guaranteed that a context that goes through | ||
| 1163 | + // v8_inspector::V8Inspector::contextCreated() is runtime-independent, | ||
| 1164 | + // so do not start the inspector on the main context when building | ||
| 1165 | + // the default snapshot. | ||
| 1166 | + uint64_t env_flags = EnvironmentFlags::kDefaultFlags | | ||
| 1167 | + EnvironmentFlags::kNoCreateInspector; | ||
| 1168 | + | ||
| 1169 | + env = CreateEnvironment(main_instance->isolate_data(), | ||
| 1170 | + main_context, | ||
| 1171 | + args, | ||
| 1172 | + exec_args, | ||
| 1173 | + static_cast<EnvironmentFlags::Flags>(env_flags)); | ||
| 1174 | + | ||
| 1175 | + // This already ran scripts in lib/internal/bootstrap/, if it fails return | ||
| 1176 | + if (env == nullptr) { | ||
| 1172 | 1177 | return BOOTSTRAP_ERROR; | |
| 1173 | 1178 | } | |
| 1174 | 1179 | // If --build-snapshot is true, lib/internal/main/mksnapshot.js would be | |
| Back | FazBrowse Home | New Git URL |
0 commit comments