| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent f4777c7 commit 2fd140b
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -29,13 +29,15 @@ namespace node { | |||
| 29 | 29 | namespace { | |
| 30 | 30 | ||
| 31 | 31 | const char DEVTOOLS_PATH[] = "/node"; | |
| 32 | + const char DEVTOOLS_HASH[] = "521e5b7e2b7cc66b4006a8a54cb9c4e57494a5ef"; | ||
| 32 | 33 | ||
| 33 | 34 | void PrintDebuggerReadyMessage(int port) { | |
| 34 | 35 | fprintf(stderr, "Debugger listening on port %d.\n" | |
| 35 | 36 | "To start debugging, open the following URL in Chrome:\n" | |
| 36 | 37 | " chrome-devtools://devtools/remote/serve_file/" | |
| 37 | - "@521e5b7e2b7cc66b4006a8a54cb9c4e57494a5ef/inspector.html?" | ||
| 38 | - "experiments=true&v8only=true&ws=localhost:%d/node\n", port, port); | ||
| 38 | + "@%s/inspector.html?" | ||
| 39 | + "experiments=true&v8only=true&ws=localhost:%d/node\n", | ||
| 40 | + port, DEVTOOLS_HASH, port); | ||
| 39 | 41 | } | |
| 40 | 42 | ||
| 41 | 43 | bool AcceptsConnection(inspector_socket_t* socket, const char* path) { | |
@@ -89,18 +91,19 @@ void SendVersionResponse(inspector_socket_t* socket) { | |||
| 89 | 91 | SendHttpResponse(socket, buffer, len); | |
| 90 | 92 | } | |
| 91 | 93 | ||
| 92 | - void SendTargentsListResponse(inspector_socket_t* socket) { | ||
| 94 | + void SendTargentsListResponse(inspector_socket_t* socket, int port) { | ||
| 93 | 95 | const char LIST_RESPONSE_TEMPLATE[] = | |
| 94 | 96 | "[ {" | |
| 95 | 97 | " \"description\": \"node.js instance\"," | |
| 96 | 98 | " \"devtoolsFrontendUrl\": " | |
| 97 | 99 | "\"https://chrome-devtools-frontend.appspot.com/serve_file/" | |
| 98 | - "@4604d24a75168768584760ba56d175507941852f/inspector.html\"," | ||
| 100 | + "@%s/inspector.html?experiments=true&v8only=true" | ||
| 101 | + "&ws=localhost:%d%s\"," | ||
| 99 | 102 | " \"faviconUrl\": \"https://nodejs.org/static/favicon.ico\"," | |
| 100 | 103 | " \"id\": \"%d\"," | |
| 101 | 104 | " \"title\": \"%s\"," | |
| 102 | 105 | " \"type\": \"node\"," | |
| 103 | - " \"webSocketDebuggerUrl\": \"ws://%s\"" | ||
| 106 | + " \"webSocketDebuggerUrl\": \"ws://localhost:%d%s\"" | ||
| 104 | 107 | "} ]"; | |
| 105 | 108 | char buffer[sizeof(LIST_RESPONSE_TEMPLATE) + 4096]; | |
| 106 | 109 | char title[2048]; // uv_get_process_title trims the title if too long | |
@@ -114,12 +117,13 @@ void SendTargentsListResponse(inspector_socket_t* socket) { | |||
| 114 | 117 | c++; | |
| 115 | 118 | } | |
| 116 | 119 | size_t len = snprintf(buffer, sizeof(buffer), LIST_RESPONSE_TEMPLATE, | |
| 117 | - getpid(), title, DEVTOOLS_PATH); | ||
| 120 | + DEVTOOLS_HASH, port, DEVTOOLS_PATH, getpid(), | ||
| 121 | + title, port, DEVTOOLS_PATH); | ||
| 118 | 122 | ASSERT_LT(len, sizeof(buffer)); | |
| 119 | 123 | SendHttpResponse(socket, buffer, len); | |
| 120 | 124 | } | |
| 121 | 125 | ||
| 122 | - bool RespondToGet(inspector_socket_t* socket, const char* path) { | ||
| 126 | + bool RespondToGet(inspector_socket_t* socket, const char* path, int port) { | ||
| 123 | 127 | const char PATH[] = "/json"; | |
| 124 | 128 | const char PATH_LIST[] = "/json/list"; | |
| 125 | 129 | const char PATH_VERSION[] = "/json/version"; | |
@@ -128,7 +132,7 @@ bool RespondToGet(inspector_socket_t* socket, const char* path) { | |||
| 128 | 132 | SendVersionResponse(socket); | |
| 129 | 133 | } else if (!strncmp(PATH_LIST, path, sizeof(PATH_LIST)) || | |
| 130 | 134 | !strncmp(PATH, path, sizeof(PATH))) { | |
| 131 | - SendTargentsListResponse(socket); | ||
| 135 | + SendTargentsListResponse(socket, port); | ||
| 132 | 136 | } else if (!strncmp(path, PATH_ACTIVATE, sizeof(PATH_ACTIVATE) - 1) && | |
| 133 | 137 | atoi(path + (sizeof(PATH_ACTIVATE) - 1)) == getpid()) { | |
| 134 | 138 | const char TARGET_ACTIVATED[] = "Target activated"; | |
@@ -348,7 +352,7 @@ bool Agent::OnInspectorHandshakeIO(inspector_socket_t* socket, | |||
| 348 | 352 | Agent* agent = static_cast<Agent*>(socket->data); | |
| 349 | 353 | switch (state) { | |
| 350 | 354 | case kInspectorHandshakeHttpGet: | |
| 351 | - return RespondToGet(socket, path); | ||
| 355 | + return RespondToGet(socket, path, agent->port_); | ||
| 352 | 356 | case kInspectorHandshakeUpgrading: | |
| 353 | 357 | return AcceptsConnection(socket, path); | |
| 354 | 358 | case kInspectorHandshakeUpgraded: | |
| Back | FazBrowse Home | New Git URL |
0 commit comments