fix: handle no env in externsion world set up (#19101)

Previously when GetEnvironment returned null this extension setup
crashed.
This commit is contained in:
Samuel Attard
2019-07-03 15:42:06 -07:00
committed by GitHub
parent da64fae690
commit e6108740c0

View File

@@ -202,8 +202,11 @@ void AtomRendererClient::SetupMainWorldOverrides(
node::FIXED_ONE_BYTE_STRING(isolate, "nodeProcess"),
node::FIXED_ONE_BYTE_STRING(isolate, "isolatedWorld")};
auto* env = GetEnvironment(render_frame);
DCHECK(env);
std::vector<v8::Local<v8::Value>> isolated_bundle_args = {
GetEnvironment(render_frame)->process_object(),
env->process_object(),
GetContext(render_frame->GetWebFrame(), isolate)->Global()};
node::per_process::native_module_loader.CompileAndCall(
@@ -222,8 +225,12 @@ void AtomRendererClient::SetupExtensionWorldOverrides(
node::FIXED_ONE_BYTE_STRING(isolate, "isolatedWorld"),
node::FIXED_ONE_BYTE_STRING(isolate, "worldId")};
auto* env = GetEnvironment(render_frame);
if (!env)
return;
std::vector<v8::Local<v8::Value>> isolated_bundle_args = {
GetEnvironment(render_frame)->process_object(),
env->process_object(),
GetContext(render_frame->GetWebFrame(), isolate)->Global(),
v8::Integer::New(isolate, world_id)};