Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a3e8829

Browse filesBrowse files
dgozmanMylesBorins
authored andcommitted
inspector: do not hardcode Debugger.CallFrameId in tests
Debugger.CallFrameId is defined as an opaque string [1]. Some tests currently hardcode the value, relying on undocumented internal details of V8. This makes it hard for V8 to change the internal representation. We should instead use the reported call frame id from the Debugger.paused event directly. This is how every inspector client does it. [1] https://chromedevtools.github.io/devtools-protocol/tot/Debugger/#type-CallFrameId PR-URL: #35570 Reviewed-By: Aleksei Koziatinskii <ak239spb@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Rich Trott <rtrott@gmail.com>
1 parent 5fea51b commit a3e8829
Copy full SHA for a3e8829

File tree

Expand file treeCollapse file tree

3 files changed

+13
-4
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

3 files changed

+13
-4
lines changed
Open diff view settings
Collapse file

‎test/common/inspector-helper.js‎

Copy file name to clipboardExpand all lines: test/common/inspector-helper.js
+9Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ class InspectorSession {
130130
this._unprocessedNotifications = [];
131131
this._notificationCallback = null;
132132
this._scriptsIdsByUrl = new Map();
133+
this._pausedDetails = null;
133134

134135
let buffer = Buffer.alloc(0);
135136
socket.on('data', (data) => {
@@ -179,6 +180,10 @@ class InspectorSession {
179180
this.mainScriptId = scriptId;
180181
}
181182
}
183+
if (message.method === 'Debugger.paused')
184+
this._pausedDetails = message.params;
185+
if (message.method === 'Debugger.resumed')
186+
this._pausedDetails = null;
182187

183188
if (this._notificationCallback) {
184189
// In case callback needs to install another
@@ -267,6 +272,10 @@ class InspectorSession {
267272
`break on ${url}:${line}`);
268273
}
269274

275+
pausedDetails() {
276+
return this._pausedDetails;
277+
}
278+
270279
_matchesConsoleOutputNotification(notification, type, values) {
271280
if (!Array.isArray(values))
272281
values = [ values ];
Collapse file

‎test/parallel/test-inspector-esm.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-inspector-esm.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ async function testBreakpoint(session) {
7878

7979
let { result } = await session.send({
8080
'method': 'Debugger.evaluateOnCallFrame', 'params': {
81-
'callFrameId': '{"ordinal":0,"injectedScriptId":1}',
81+
'callFrameId': session.pausedDetails().callFrames[0].callFrameId,
8282
'expression': 'k + t',
8383
'objectGroup': 'console',
8484
'includeCommandLineAPI': true,
Collapse file

‎test/sequential/test-inspector.js‎

Copy file name to clipboardExpand all lines: test/sequential/test-inspector.js
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ async function testBreakpoint(session) {
116116

117117
let { result } = await session.send({
118118
'method': 'Debugger.evaluateOnCallFrame', 'params': {
119-
'callFrameId': '{"ordinal":0,"injectedScriptId":1}',
119+
'callFrameId': session.pausedDetails().callFrames[0].callFrameId,
120120
'expression': 'k + t',
121121
'objectGroup': 'console',
122122
'includeCommandLineAPI': true,
@@ -150,7 +150,7 @@ async function testI18NCharacters(session) {
150150
const chars = 'טֶ字и';
151151
session.send({
152152
'method': 'Debugger.evaluateOnCallFrame', 'params': {
153-
'callFrameId': '{"ordinal":0,"injectedScriptId":1}',
153+
'callFrameId': session.pausedDetails().callFrames[0].callFrameId,
154154
'expression': `console.log("${chars}")`,
155155
'objectGroup': 'console',
156156
'includeCommandLineAPI': true,
@@ -276,7 +276,7 @@ async function testCommandLineAPI(session) {
276276
result = await session.send(
277277
{
278278
'method': 'Debugger.evaluateOnCallFrame', 'params': {
279-
'callFrameId': '{"ordinal":0,"injectedScriptId":1}',
279+
'callFrameId': session.pausedDetails().callFrames[0].callFrameId,
280280
'expression': `(
281281
require(${printBModuleStr}),
282282
require.cache[${printBModuleStr}].parent.id

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.