Skip to content

Commit ad42da3

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 <[email protected]> Reviewed-By: Seth Brenith <[email protected]>
1 parent 58a4693 commit ad42da3

File tree

5 files changed

+13
-16
lines changed

5 files changed

+13
-16
lines changed

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

+5-4
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

+4-3
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

+3-2
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
}

test/sequential/sequential.status

-7
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,6 @@ test-inspector-contexts : SKIP
3434
test-inspector-scriptparsed-context : SKIP
3535
test-inspector-stop-profile-after-done : SKIP
3636

37-
# These need to be fixed when resourceNameToUrl is wired up.
38-
# https://github.com/nodejs/node-chakracore/issues/598
39-
test-inspector : SKIP
40-
test-inspector-debug-brk-flag : SKIP
41-
test-inspector-exception : SKIP
42-
test-inspector-resource-name-to-url : SKIP
43-
4437
[$jsEngine==chakracore && $system==win32]
4538
# This test can fail depending on the ports that other processes are using
4639
test-inspector-port-cluster : PASS, FLAKY

test/sequential/test-inspector-resource-name-to-url.js

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Flags: --inspect
12
'use strict';
23
const common = require('../common');
34

0 commit comments

Comments
 (0)