diff --git a/patches/node/.patches b/patches/node/.patches index 7d119718f66fb..53a97879366df 100644 --- a/patches/node/.patches +++ b/patches/node/.patches @@ -32,7 +32,6 @@ chore_allow_the_node_entrypoint_to_be_a_builtin_module.patch inherit_electron_crashpad_pipe_name_in_child_process.patch fixme_revert_crypto_add_support_for_rsa-pss_keys.patch chore_re-add_compileandcall_this_should_be_added_as_a_helper_in.patch -src_expose_maybeinitializecontext_to_allow_existing_contexts.patch fix_extern_the_nativemoduleenv_and_options_parser_for_debug_builds.patch chore_read_nobrowserglobals_from_global_not_process.patch chore_split_createenvironment_into_createenvironment_and.patch diff --git a/patches/node/src_expose_maybeinitializecontext_to_allow_existing_contexts.patch b/patches/node/src_expose_maybeinitializecontext_to_allow_existing_contexts.patch deleted file mode 100644 index 1b6d310f81dcf..0000000000000 --- a/patches/node/src_expose_maybeinitializecontext_to_allow_existing_contexts.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Samuel Attard -Date: Thu, 4 Jul 2019 15:57:09 -0700 -Subject: src: expose MaybeInitializeContext to allow existing contexts - -Splits the node.js specific tweak intialization of NewContext into a new -helper MaybeInitializeContext so that embedders with existing contexts -can still use them in a node Environment now that primordials are -initialized and required so early. - -diff --git a/src/api/environment.cc b/src/api/environment.cc -index 35e8666ef771c56a1bcd441c99d4483a0d3e90bf..443f49320b2e6720f932fcfcefdbe6e539594964 100644 ---- a/src/api/environment.cc -+++ b/src/api/environment.cc -@@ -357,6 +357,13 @@ Local NewContext(Isolate* isolate, - Local object_template) { - auto context = Context::New(isolate, nullptr, object_template); - if (context.IsEmpty()) return context; -+ -+ return MaybeInitializeContext(context, object_template); -+} -+ -+Local MaybeInitializeContext(Local context, -+ Local object_template) { -+ Isolate* isolate = context->GetIsolate(); - HandleScope handle_scope(isolate); - - context->SetEmbedderData(ContextEmbedderIndex::kAllowWasmCodeGeneration, -diff --git a/src/node.h b/src/node.h -index a2b47d1cf984ec36994b477b371cdf262191ab9c..c51fb1a6a6e497a091e2ba0b147e3d7b6a4d685c 100644 ---- a/src/node.h -+++ b/src/node.h -@@ -303,6 +303,14 @@ NODE_EXTERN v8::Local NewContext( - v8::Local object_template = - v8::Local()); - -+// Runs Node.js-specific tweaks on an already constructed context -+// This is not dead code, it is exposed for embedders so that they -+// can construct their own context and still use it in a node Environment. -+NODE_EXTERN v8::Local MaybeInitializeContext( -+ v8::Local context, -+ v8::Local object_template = -+ v8::Local()); -+ - // If `platform` is passed, it will be used to register new Worker instances. - // It can be `nullptr`, in which case creating new Workers inside of - // Environments that use this `IsolateData` will not work. diff --git a/shell/renderer/atom_renderer_client.cc b/shell/renderer/atom_renderer_client.cc index 031f06e73d72e..c5fb8e85edb7f 100644 --- a/shell/renderer/atom_renderer_client.cc +++ b/shell/renderer/atom_renderer_client.cc @@ -121,11 +121,10 @@ void AtomRendererClient::DidCreateScriptContext( node::tracing::TraceEventHelper::SetAgent(node::CreateAgent()); // Setup node environment for each window. - v8::Local context = - node::MaybeInitializeContext(renderer_context); - DCHECK(!context.IsEmpty()); + DCHECK(node::InitializeContext(renderer_context)); node::Environment* env = - node_bindings_->CreateEnvironment(context, nullptr, true); + node_bindings_->CreateEnvironment(renderer_context, nullptr, true); + // If we have disabled the site instance overrides we should prevent loading // any non-context aware native module if (command_line->HasSwitch(switches::kDisableElectronSiteInstanceOverrides)) diff --git a/shell/renderer/web_worker_observer.cc b/shell/renderer/web_worker_observer.cc index 30e1bfcfab09a..5e10ac8244c22 100644 --- a/shell/renderer/web_worker_observer.cc +++ b/shell/renderer/web_worker_observer.cc @@ -48,10 +48,9 @@ void WebWorkerObserver::ContextCreated(v8::Local worker_context) { node_bindings_->PrepareMessageLoop(); // Setup node environment for each window. - v8::Local context = node::MaybeInitializeContext(worker_context); - DCHECK(!context.IsEmpty()); + DCHECK(node::InitializeContext(worker_context)); node::Environment* env = - node_bindings_->CreateEnvironment(context, nullptr, true); + node_bindings_->CreateEnvironment(worker_context, nullptr, true); // Add Electron extended APIs. electron_bindings_->BindTo(env->isolate(), env->process_object());