From 0e337ae9d2b8dbe48157e6096684d435ce8abda3 Mon Sep 17 00:00:00 2001 From: GauthamBanasandra Date: Fri, 29 Jun 2018 14:37:55 +0530 Subject: [PATCH] [MB-30395] Use js_app.html as the landing page for debugger * As per https://github.com/nodejs/node/pull/21385 and https://chromium.googlesource.com/chromium/src/+/f7efc442c8dc9108f057144983987e74ddc6a0d4 we need to use js_app.html instead of inspector.html * This patch also fixes the inconsistency in symbol mapping caused due to adding handler headers. Change-Id: I23884175d7e8ce9fa798869659b44ba2a0ee0dca Reviewed-on: http://review.couchbase.org/97722 Well-Formed: Build Bot Reviewed-by: Sriram Melkote Tested-by: Gautham B A --- third_party/inspector/inspector_socket_server.cc | 4 ++-- v8_consumer/src/transpiler.cc | 6 ++++-- v8_consumer/src/transpiler.js | 3 ++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/third_party/inspector/inspector_socket_server.cc b/third_party/inspector/inspector_socket_server.cc index cd7cc305..fcca5130 100644 --- a/third_party/inspector/inspector_socket_server.cc +++ b/third_party/inspector/inspector_socket_server.cc @@ -106,7 +106,7 @@ void PrintDebuggerReadyMessage(const std::string& host, for (const std::string& id : ids) { std::string frontend_url; frontend_url = "chrome-devtools://devtools/bundled"; - frontend_url += "/inspector.html?experiments=true&v8only=true&ws="; + frontend_url += "/js_app.html?experiments=true&v8only=true&ws="; frontend_url += FormatWsAddress(host, port, id, false); fprintf(out, "%s\n", frontend_url.c_str()); fprintf(stderr, "Debugger starting on %s\n", frontend_url.c_str()); @@ -384,7 +384,7 @@ void InspectorSocketServer::SendListResponse(InspectorSocket* socket) { GetSocketHost(&socket->tcp, &host); std::ostringstream frontend_url; frontend_url << "chrome-devtools://devtools/bundled"; - frontend_url << "/inspector.html?experiments=true&v8only=true&ws="; + frontend_url << "/js_app.html?experiments=true&v8only=true&ws="; frontend_url << FormatWsAddress(host, port, id, false); target_map["devtoolsFrontendUrl"] += frontend_url.str(); target_map["webSocketDebuggerUrl"] = diff --git a/v8_consumer/src/transpiler.cc b/v8_consumer/src/transpiler.cc index 290bcb4d..d364bb91 100644 --- a/v8_consumer/src/transpiler.cc +++ b/v8_consumer/src/transpiler.cc @@ -162,10 +162,12 @@ std::string Transpiler::JsFormat(const std::string &handler_code) { std::string Transpiler::GetSourceMap(const std::string &handler_code, const std::string &src_filename) { v8::HandleScope handle_scope(isolate_); - v8::Local args[2]; + v8::Local args[4]; args[0] = v8Str(isolate_, handler_code); args[1] = v8Str(isolate_, src_filename); - auto result = ExecTranspiler("getSourceMap", args, 2); + args[2] = v8Array(isolate_, handler_headers_); + args[3] = v8Array(isolate_, handler_footers_); + auto result = ExecTranspiler("getSourceMap", args, 4); v8::String::Utf8Value utf8result(result); return *utf8result; diff --git a/v8_consumer/src/transpiler.js b/v8_consumer/src/transpiler.js index ef8bb90f..a3f07805 100644 --- a/v8_consumer/src/transpiler.js +++ b/v8_consumer/src/transpiler.js @@ -99,7 +99,8 @@ function jsFormat(code) { return escodegen.generate(ast); } -function getSourceMap(code, sourceFileName) { +function getSourceMap(code, sourceFileName, headers, footers) { + code = AddHeadersAndFooters(code, headers, footers); var ast = getAst(code, sourceFileName); return escodegen.generate(ast, { sourceMap: true,