Skip to content

Commit 9493df4

Browse files
committed
chakrashim: enable resourceNameToUrl support
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>
1 parent 99bdf0e commit 9493df4

3 files changed

Lines changed: 12 additions & 9 deletions

File tree

deps/chakrashim/src/inspector/v8-debugger-script.cc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,8 @@ static JsErrorCode GetNamedStringValue(JsValueRef object,
102102
return JsNoError;
103103
}
104104

105-
V8DebuggerScript::V8DebuggerScript(v8::Isolate* isolate,
106-
JsValueRef scriptData,
107-
bool isLiveEdit)
105+
V8DebuggerScript::V8DebuggerScript(v8::Isolate* isolate, JsValueRef scriptData,
106+
bool isLiveEdit, V8InspectorClient* client)
108107
: m_startLine(0),
109108
m_startColumn(0),
110109
m_endColumn(0),
@@ -125,7 +124,9 @@ V8DebuggerScript::V8DebuggerScript(v8::Isolate* isolate,
125124
String16 urlValue;
126125
if (GetNamedStringValue(scriptData, jsrt::CachedPropertyIdRef::fileName,
127126
&urlValue) == JsNoError) {
128-
m_url = urlValue;
127+
std::unique_ptr<StringBuffer> url =
128+
client->resourceNameToUrl(toStringView(urlValue));
129+
m_url = url ? toString16(url->string()) : urlValue;
129130
} else if (GetNamedStringValue(scriptData,
130131
jsrt::CachedPropertyIdRef::scriptType,
131132
&urlValue) == JsNoError) {

deps/chakrashim/src/inspector/v8-debugger-script.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,12 @@
3737

3838
namespace v8_inspector {
3939

40+
class V8InspectorClient;
41+
4042
class V8DebuggerScript {
4143
public:
42-
V8DebuggerScript(v8::Isolate* isolate,
43-
JsValueRef scriptData,
44-
bool isLiveEdit);
44+
V8DebuggerScript(v8::Isolate* isolate, JsValueRef scriptData,
45+
bool isLiveEdit, V8InspectorClient* client);
4546
~V8DebuggerScript();
4647

4748
const String16& scriptId() const { return m_id; }

deps/chakrashim/src/inspector/v8-debugger.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ void V8Debugger::getCompiledScripts(
9090
CHAKRA_VERIFY_NOERROR(jsrt::GetIndexedProperty(scripts, i, &script));
9191

9292
result.push_back(wrapUnique(
93-
new V8DebuggerScript(m_isolate, script, false)));
93+
new V8DebuggerScript(m_isolate, script, false, m_inspector->client())));
9494
}
9595
}
9696

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

446446
if (agent != nullptr) {
447447
agent->didParseSource(
448-
wrapUnique(new V8DebuggerScript(m_isolate, eventData, false)),
448+
wrapUnique(new V8DebuggerScript(m_isolate, eventData, false,
449+
m_inspector->client())),
449450
success);
450451
}
451452
}

0 commit comments

Comments
 (0)