summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/api/debugger.md5
-rw-r--r--src/inspector_socket_server.cc21
-rw-r--r--src/inspector_socket_server.h2
3 files changed, 22 insertions, 6 deletions
diff --git a/doc/api/debugger.md b/doc/api/debugger.md
index e7e39e5634..5a5e1cd7c7 100644
--- a/doc/api/debugger.md
+++ b/doc/api/debugger.md
@@ -187,12 +187,15 @@ flag instead of `--inspect`.
$ node --inspect index.js
Debugger listening on 127.0.0.1:9229.
To start debugging, open the following URL in Chrome:
- chrome-devtools://devtools/bundled/inspector.html?experiments=true&v8only=true&ws=127.0.0.1:9229/dc9010dd-f8b8-4ac5-a510-c1a114ec7d29
+ chrome-devtools://devtools/bundled/js_app.html?experiments=true&v8only=true&ws=127.0.0.1:9229/dc9010dd-f8b8-4ac5-a510-c1a114ec7d29
```
(In the example above, the UUID dc9010dd-f8b8-4ac5-a510-c1a114ec7d29
at the end of the URL is generated on the fly, it varies in different
debugging sessions.)
+If the Chrome browser is older than 66.0.3345.0,
+use `inspector.html` instead of `js_app.html` in the above URL.
+
[Chrome DevTools Protocol]: https://chromedevtools.github.io/devtools-protocol/
[V8 Inspector]: #debugger_v8_inspector_integration_for_node_js
diff --git a/src/inspector_socket_server.cc b/src/inspector_socket_server.cc
index d5eb1b75c8..174dc7c726 100644
--- a/src/inspector_socket_server.cc
+++ b/src/inspector_socket_server.cc
@@ -334,16 +334,27 @@ void InspectorSocketServer::SendListResponse(InspectorSocket* socket,
detected_host = FormatHostPort(socket->GetHost(),
session->server_port());
}
- std::ostringstream frontend_url;
- frontend_url << "chrome-devtools://devtools/bundled";
- frontend_url << "/inspector.html?experiments=true&v8only=true&ws=";
- frontend_url << FormatAddress(detected_host, id, false);
- target_map["devtoolsFrontendUrl"] += frontend_url.str();
+ std::string formatted_address = FormatAddress(detected_host, id, false);
+ target_map["devtoolsFrontendUrl"] = GetFrontendURL(false,
+ formatted_address);
+ // The compat URL is for Chrome browsers older than 66.0.3345.0
+ target_map["devtoolsFrontendUrlCompat"] = GetFrontendURL(true,
+ formatted_address);
target_map["webSocketDebuggerUrl"] = FormatAddress(detected_host, id, true);
}
SendHttpResponse(socket, MapsToString(response));
}
+std::string InspectorSocketServer::GetFrontendURL(bool is_compat,
+ const std::string &formatted_address) {
+ std::ostringstream frontend_url;
+ frontend_url << "chrome-devtools://devtools/bundled/";
+ frontend_url << (is_compat ? "inspector" : "js_app");
+ frontend_url << ".html?experiments=true&v8only=true&ws=";
+ frontend_url << formatted_address;
+ return frontend_url.str();
+}
+
bool InspectorSocketServer::Start() {
CHECK_NE(delegate_, nullptr);
CHECK_EQ(state_, ServerState::kNew);
diff --git a/src/inspector_socket_server.h b/src/inspector_socket_server.h
index b8d98e13a2..bbc2195095 100644
--- a/src/inspector_socket_server.h
+++ b/src/inspector_socket_server.h
@@ -81,6 +81,8 @@ class InspectorSocketServer {
void SendListResponse(InspectorSocket* socket, const std::string& host,
SocketSession* session);
+ std::string GetFrontendURL(bool is_compat,
+ const std::string &formatted_address);
bool TargetExists(const std::string& id);
enum class ServerState {kNew, kRunning, kStopping, kStopped};