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 20, 2018
1 parent 99bdf0e commit 9493df4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 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

0 comments on commit 9493df4

Please sign in to comment.