chore: remove custom Node.js debugger (#25587)
This commit is contained in:
parent
b980d1bd6b
commit
b807cabe1b
10 changed files with 32 additions and 209 deletions
|
@ -4,7 +4,6 @@ refactor_alter_child_process_fork_to_use_execute_script_with.patch
|
|||
feat_add_uv_loop_watcher_queue_code.patch
|
||||
feat_initialize_asar_support.patch
|
||||
expose_get_builtin_module_function.patch
|
||||
fix_build_and_expose_inspector_agent.patch
|
||||
fix_expose_internalcallbackscope.patch
|
||||
build_add_gn_build_files.patch
|
||||
fix_add_default_values_for_enable_lto_and_build_v8_with_gn_in.patch
|
||||
|
@ -30,5 +29,5 @@ update_tests_after_increasing_typed_array_size.patch
|
|||
feat_add_implementation_of_v8_platform_postjob.patch
|
||||
crypto_update_certdata_to_nss_3_56.patch
|
||||
fix_-wincompatible-pointer-types-discards-qualifiers_error.patch
|
||||
fix_allow_preventing_initializeinspector_in_env.patch
|
||||
fix_add_v8_enable_reverse_jsargs_defines_in_common_gypi.patch
|
||||
fix_allow_preventing_initializeinspector_in_env.patch
|
||||
|
|
|
@ -1,18 +1,17 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Shelley Vohr <shelley.vohr@gmail.com>
|
||||
Date: Tue, 1 Sep 2020 19:30:08 -0700
|
||||
Date: Tue, 22 Sep 2020 19:44:30 -0700
|
||||
Subject: fix: allow preventing InitializeInspector in env
|
||||
|
||||
https://github.com/nodejs/node/commit/8c5ad1392f30cfe6b107e9bd85f4cb918ba04aab
|
||||
made it such that env->InitializeInspector was called in CreateEnvironment
|
||||
no matter what, which creates an issue for embedders seeking to manage
|
||||
the InspectorAgent themselves as Electron does. This adds a new
|
||||
no matter what, which creates an issue for Electron, as the V8 inspector
|
||||
already exists in the renderer process and therefore we only want to
|
||||
initialize it in the browser process. This adds a new
|
||||
EnvironmentFlags option which allows preventing that invocation.
|
||||
|
||||
This will be upstreamed.
|
||||
|
||||
diff --git a/src/api/environment.cc b/src/api/environment.cc
|
||||
index 4fa2d4175fb318f560b7b9a8ed8baa091d3ed6a2..7bd899c5933ac2e6178d650632699e19e85c00c9 100644
|
||||
index 4fa2d4175fb318f560b7b9a8ed8baa091d3ed6a2..cf6115d04ba3c184937c5db85c9d7ebc78ed3db7 100644
|
||||
--- a/src/api/environment.cc
|
||||
+++ b/src/api/environment.cc
|
||||
@@ -358,12 +358,14 @@ Environment* CreateEnvironment(
|
||||
|
@ -25,7 +24,7 @@ index 4fa2d4175fb318f560b7b9a8ed8baa091d3ed6a2..7bd899c5933ac2e6178d650632699e19
|
|||
- inspector_parent_handle.get())->impl));
|
||||
- } else {
|
||||
- env->InitializeInspector({});
|
||||
+ if (!env->should_not_initialize_inspector()) {
|
||||
+ if (env->should_initialize_inspector()) {
|
||||
+ if (inspector_parent_handle) {
|
||||
+ env->InitializeInspector(
|
||||
+ std::move(static_cast<InspectorParentHandleImpl*>(
|
||||
|
@ -37,34 +36,34 @@ index 4fa2d4175fb318f560b7b9a8ed8baa091d3ed6a2..7bd899c5933ac2e6178d650632699e19
|
|||
#endif
|
||||
|
||||
diff --git a/src/env-inl.h b/src/env-inl.h
|
||||
index 623e9d4e429c03bb267539a318166f3ef3b9c501..8fc5f720764dd4ca536ae01ca78b2c7e3e9fd007 100644
|
||||
index 623e9d4e429c03bb267539a318166f3ef3b9c501..52a122a51049238547ff662bed1a10b346f3af00 100644
|
||||
--- a/src/env-inl.h
|
||||
+++ b/src/env-inl.h
|
||||
@@ -833,6 +833,10 @@ inline bool Environment::owns_inspector() const {
|
||||
return flags_ & EnvironmentFlags::kOwnsInspector;
|
||||
}
|
||||
|
||||
+inline bool Environment::should_not_initialize_inspector() const {
|
||||
+ return flags_ & EnvironmentFlags::kNoInitializeInspector;
|
||||
+}
|
||||
+
|
||||
inline bool Environment::tracks_unmanaged_fds() const {
|
||||
@@ -837,6 +837,10 @@ inline bool Environment::tracks_unmanaged_fds() const {
|
||||
return flags_ & EnvironmentFlags::kTrackUnmanagedFds;
|
||||
}
|
||||
|
||||
+inline bool Environment::should_initialize_inspector() const {
|
||||
+ return (flags_ & EnvironmentFlags::kNoInitializeInspector) == 0;
|
||||
+}
|
||||
+
|
||||
bool Environment::filehandle_close_warning() const {
|
||||
return emit_filehandle_warning_;
|
||||
}
|
||||
diff --git a/src/env.h b/src/env.h
|
||||
index 38d17f4e18aa38fde2c2f59a9816c8fb0f65fd51..4b9c2780f9736cb8bde60f40abb9aac9d53160a1 100644
|
||||
index 38d17f4e18aa38fde2c2f59a9816c8fb0f65fd51..4fe2eb3b7699efcab87c377743a955effbbfd9de 100644
|
||||
--- a/src/env.h
|
||||
+++ b/src/env.h
|
||||
@@ -1019,6 +1019,7 @@ class Environment : public MemoryRetainer {
|
||||
|
||||
inline bool is_main_thread() const;
|
||||
inline bool should_not_register_esm_loader() const;
|
||||
+ inline bool should_not_initialize_inspector() const;
|
||||
@@ -1022,6 +1022,7 @@ class Environment : public MemoryRetainer {
|
||||
inline bool owns_process_state() const;
|
||||
inline bool owns_inspector() const;
|
||||
inline bool tracks_unmanaged_fds() const;
|
||||
+ inline bool should_initialize_inspector() const;
|
||||
inline uint64_t thread_id() const;
|
||||
inline worker::Worker* worker_context() const;
|
||||
Environment* worker_parent_env() const;
|
||||
diff --git a/src/node.h b/src/node.h
|
||||
index 80acb3f9f04ef8e6c363cf31384af4037abeeb87..6b657f6941b8f96da08b6397e01e19a2763edf8f 100644
|
||||
index 80acb3f9f04ef8e6c363cf31384af4037abeeb87..22f037b0b26f39f9ce94c4a364b27cf204366cb9 100644
|
||||
--- a/src/node.h
|
||||
+++ b/src/node.h
|
||||
@@ -424,7 +424,11 @@ enum Flags : uint64_t {
|
||||
|
@ -73,9 +72,9 @@ index 80acb3f9f04ef8e6c363cf31384af4037abeeb87..6b657f6941b8f96da08b6397e01e19a2
|
|||
// by fs.open() and fs.close(), and close them during FreeEnvironment().
|
||||
- kTrackUnmanagedFds = 1 << 4
|
||||
+ kTrackUnmanagedFds = 1 << 4,
|
||||
+ // This flag should be set to prevent InspectorAgent initialization from
|
||||
+ // within the environment. This is used by embedders who wish to manage the
|
||||
+ // InspectorAgent themselves.
|
||||
+ // Controls whether or not the Environment should call InitializeInspector.
|
||||
+ // This control is needed by embedders who may not want to initialize the V8
|
||||
+ // inspector in situations where it already exists.
|
||||
+ kNoInitializeInspector = 1 << 5
|
||||
};
|
||||
} // namespace EnvironmentFlags
|
||||
|
|
|
@ -1,65 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Shelley Vohr <shelley.vohr@gmail.com>
|
||||
Date: Mon, 30 Jul 2018 15:18:11 -0700
|
||||
Subject: fix: build and expose inspector agent
|
||||
|
||||
Node inspector initialization happens in a different start-up function in node.cc, which we don't call in Electron. This allows for us to use the inspector agent in electron/atom/browser/node_debugger.cc
|
||||
|
||||
diff --git a/src/inspector_agent.cc b/src/inspector_agent.cc
|
||||
index e6ab76abf56168041108972d54d741af988342b4..7de9d75e49a08625bbd37f5bfcee3f88c5fa978d 100644
|
||||
--- a/src/inspector_agent.cc
|
||||
+++ b/src/inspector_agent.cc
|
||||
@@ -203,7 +203,7 @@ const int CONTEXT_GROUP_ID = 1;
|
||||
|
||||
std::string GetWorkerLabel(node::Environment* env) {
|
||||
std::ostringstream result;
|
||||
- result << "Worker[" << env->thread_id() << "]";
|
||||
+ result << "Electron Worker[" << env->thread_id() << "]";
|
||||
return result.str();
|
||||
}
|
||||
|
||||
@@ -458,7 +458,7 @@ class NodeInspectorClient : public V8InspectorClient {
|
||||
client_ = V8Inspector::create(env->isolate(), this);
|
||||
// TODO(bnoordhuis) Make name configurable from src/node.cc.
|
||||
std::string name =
|
||||
- is_main_ ? GetHumanReadableProcessName() : GetWorkerLabel(env);
|
||||
+ is_main_ ? "Electron Main Context" : GetWorkerLabel(env);
|
||||
ContextInfo info(name);
|
||||
info.is_default = true;
|
||||
contextCreated(env->context(), info);
|
||||
diff --git a/src/inspector_agent.h b/src/inspector_agent.h
|
||||
index efd090c49b4311bcf3d8b717d6e5c65553849aed..a508ddd43ce613441eae759cd6110b6cc15819e4 100644
|
||||
--- a/src/inspector_agent.h
|
||||
+++ b/src/inspector_agent.h
|
||||
@@ -6,7 +6,9 @@
|
||||
#error("This header can only be used when inspector is enabled")
|
||||
#endif
|
||||
|
||||
+#include "node.h"
|
||||
#include "node_options.h"
|
||||
+#include "node_platform.h"
|
||||
#include "v8.h"
|
||||
|
||||
#include <cstddef>
|
||||
@@ -40,7 +42,7 @@ class InspectorSessionDelegate {
|
||||
= 0;
|
||||
};
|
||||
|
||||
-class Agent {
|
||||
+class NODE_EXTERN Agent {
|
||||
public:
|
||||
explicit Agent(node::Environment* env);
|
||||
~Agent();
|
||||
diff --git a/src/inspector_io.cc b/src/inspector_io.cc
|
||||
index d3bd1911214f83fbf841a91bf01072d4c12fe870..01b92d5b6b17015eb6037978b36ab20b7d2ad651 100644
|
||||
--- a/src/inspector_io.cc
|
||||
+++ b/src/inspector_io.cc
|
||||
@@ -14,6 +14,8 @@
|
||||
#include "util-inl.h"
|
||||
#include "zlib.h"
|
||||
|
||||
+#include "libplatform/libplatform.h"
|
||||
+
|
||||
#include <deque>
|
||||
#include <cstring>
|
||||
#include <vector>
|
Loading…
Add table
Add a link
Reference in a new issue