Skip to content

Commit

Permalink
chakrashim: enable resourceNameToUrl support
Browse files Browse the repository at this point in the history
Wired up support for calling the node-provided `resourceNameToUrl`
method in the chakrashim inspector.

This reverts commit 3f6ef13.

PR-URL: nodejs#601
Fixes: nodejs#598
Refs: nodejs/node#22251
Reviewed-By: Jimmy Thomson <jithomso@microsoft.com>
Reviewed-By: Seth Brenith <sethb@microsoft.com>
  • Loading branch information
kfarnung committed Sep 19, 2018
1 parent 20e8a3b commit 1110b04
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 16 deletions.
9 changes: 5 additions & 4 deletions deps/chakrashim/src/inspector/v8-debugger-script.cc
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,8 @@ static JsErrorCode GetNamedStringValue(JsValueRef object,
return JsNoError;
}

V8DebuggerScript::V8DebuggerScript(v8::Isolate* isolate,
JsValueRef scriptData,
bool isLiveEdit)
V8DebuggerScript::V8DebuggerScript(v8::Isolate* isolate, JsValueRef scriptData,
bool isLiveEdit, V8InspectorClient* client)
: m_startLine(0),
m_startColumn(0),
m_endColumn(0),
Expand All @@ -125,7 +124,9 @@ V8DebuggerScript::V8DebuggerScript(v8::Isolate* isolate,
String16 urlValue;
if (GetNamedStringValue(scriptData, jsrt::CachedPropertyIdRef::fileName,
&urlValue) == JsNoError) {
m_url = urlValue;
std::unique_ptr<StringBuffer> url =
client->resourceNameToUrl(toStringView(urlValue));
m_url = url ? toString16(url->string()) : urlValue;
} else if (GetNamedStringValue(scriptData,
jsrt::CachedPropertyIdRef::scriptType,
&urlValue) == JsNoError) {
Expand Down
7 changes: 4 additions & 3 deletions deps/chakrashim/src/inspector/v8-debugger-script.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,12 @@

namespace v8_inspector {

class V8InspectorClient;

class V8DebuggerScript {
public:
V8DebuggerScript(v8::Isolate* isolate,
JsValueRef scriptData,
bool isLiveEdit);
V8DebuggerScript(v8::Isolate* isolate, JsValueRef scriptData,
bool isLiveEdit, V8InspectorClient* client);
~V8DebuggerScript();

const String16& scriptId() const { return m_id; }
Expand Down
5 changes: 3 additions & 2 deletions deps/chakrashim/src/inspector/v8-debugger.cc
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ void V8Debugger::getCompiledScripts(
CHAKRA_VERIFY_NOERROR(jsrt::GetIndexedProperty(scripts, i, &script));

result.push_back(wrapUnique(
new V8DebuggerScript(m_isolate, script, false)));
new V8DebuggerScript(m_isolate, script, false, m_inspector->client())));
}
}

Expand Down Expand Up @@ -445,7 +445,8 @@ void V8Debugger::HandleSourceEvents(JsValueRef eventData, bool success) {

if (agent != nullptr) {
agent->didParseSource(
wrapUnique(new V8DebuggerScript(m_isolate, eventData, false)),
wrapUnique(new V8DebuggerScript(m_isolate, eventData, false,
m_inspector->client())),
success);
}
}
Expand Down
7 changes: 0 additions & 7 deletions test/sequential/sequential.status
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,6 @@ test-inspector-contexts : SKIP
test-inspector-scriptparsed-context : SKIP
test-inspector-stop-profile-after-done : SKIP

# These need to be fixed when resourceNameToUrl is wired up.
# https://github.com/nodejs/node-chakracore/issues/598
test-inspector : SKIP
test-inspector-debug-brk-flag : SKIP
test-inspector-exception : SKIP
test-inspector-resource-name-to-url : SKIP

[$jsEngine==chakracore && $system==win32]
# This test can fail depending on the ports that other processes are using
test-inspector-port-cluster : PASS, FLAKY
Expand Down
1 change: 1 addition & 0 deletions test/sequential/test-inspector-resource-name-to-url.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Flags: --inspect
'use strict';
const common = require('../common');

Expand Down

0 comments on commit 1110b04

Please sign in to comment.