From 8f00cc9c0e78b95e4de14b9b9e1a7df20935e948 Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Fri, 29 Nov 2024 18:45:33 +0100 Subject: [PATCH] build: remove context-aware patch (#44862) --- patches/node/.patches | 1 - ...t_to_context_aware_module_prevention.patch | 35 ------------------- 2 files changed, 36 deletions(-) delete mode 100644 patches/node/chore_add_context_to_context_aware_module_prevention.patch diff --git a/patches/node/.patches b/patches/node/.patches index aeca7c7c4e19a..4c2a5729f5da2 100644 --- a/patches/node/.patches +++ b/patches/node/.patches @@ -6,7 +6,6 @@ pass_all_globals_through_require.patch build_modify_js2c_py_to_allow_injection_of_original-fs_and_custom_embedder_js.patch refactor_allow_embedder_overriding_of_internal_fs_calls.patch chore_allow_the_node_entrypoint_to_be_a_builtin_module.patch -chore_add_context_to_context_aware_module_prevention.patch fix_handle_boringssl_and_openssl_incompatibilities.patch fix_crypto_tests_to_run_with_bssl.patch fix_account_for_debugger_agent_race_condition.patch diff --git a/patches/node/chore_add_context_to_context_aware_module_prevention.patch b/patches/node/chore_add_context_to_context_aware_module_prevention.patch deleted file mode 100644 index c74109225a7f4..0000000000000 --- a/patches/node/chore_add_context_to_context_aware_module_prevention.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Samuel Attard -Date: Wed, 22 May 2019 13:34:18 -0700 -Subject: chore: add context to context aware module prevention - -This patch adds extra context to why we prevent non-context-aware Node.js -modules from being used in the renderer process. This should be upstreamed as -a customizable error message. - -diff --git a/src/node_binding.cc b/src/node_binding.cc -index b5c0a93d83ab4d4f6792d0eb648e7198de874bcf..0fd01987c29b06b91944d18266ba67994c1fac45 100644 ---- a/src/node_binding.cc -+++ b/src/node_binding.cc -@@ -4,6 +4,7 @@ - #include "node_builtins.h" - #include "node_errors.h" - #include "node_external_reference.h" -+#include "node_process.h" - #include "util.h" - - #include -@@ -495,7 +496,12 @@ void DLOpen(const FunctionCallbackInfo& args) { - if (mp->nm_context_register_func == nullptr) { - if (env->force_context_aware()) { - dlib->Close(); -- THROW_ERR_NON_CONTEXT_AWARE_DISABLED(env); -+ char errmsg[1024]; -+ snprintf(errmsg, -+ sizeof(errmsg), -+ "Loading non-context-aware native module in renderer: '%s'. See https://github.com/electron/electron/issues/18397.", -+ *filename); -+ env->ThrowError(errmsg); - return false; - } - }