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 6a696d1

Browse filesBrowse files
seishunaddaleax
authored andcommitted
inspector: fix crash on exception
Fixes: #13438 PR-URL: #13455 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com>
1 parent 0ca4bd1 commit 6a696d1
Copy full SHA for 6a696d1

File tree

Expand file treeCollapse file tree

2 files changed

+67
-1
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+67
-1
lines changed
Open diff view settings
Collapse file

‎src/inspector_agent.cc‎

Copy file name to clipboardExpand all lines: src/inspector_agent.cc
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,9 @@ void CallAndPauseOnStart(
371371
v8::MaybeLocal<v8::Value> retval =
372372
args[0].As<v8::Function>()->Call(env->context(), args[1],
373373
call_args.size(), call_args.data());
374-
args.GetReturnValue().Set(retval.ToLocalChecked());
374+
if (!retval.IsEmpty()) {
375+
args.GetReturnValue().Set(retval.ToLocalChecked());
376+
}
375377
}
376378

377379
// Used in NodeInspectorClient::currentTimeMS() below.
Collapse file
+64Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
'use strict';
2+
const common = require('../common');
3+
4+
common.skipIfInspectorDisabled();
5+
6+
const assert = require('assert');
7+
const helper = require('./inspector-helper.js');
8+
const path = require('path');
9+
10+
const script = path.join(common.fixturesDir, 'throws_error.js');
11+
12+
13+
function setupExpectBreakOnLine(line, url, session) {
14+
return function(message) {
15+
if ('Debugger.paused' === message['method']) {
16+
const callFrame = message['params']['callFrames'][0];
17+
const location = callFrame['location'];
18+
assert.strictEqual(url, session.scriptUrlForId(location['scriptId']));
19+
assert.strictEqual(line, location['lineNumber']);
20+
return true;
21+
}
22+
};
23+
}
24+
25+
function testBreakpointOnStart(session) {
26+
const commands = [
27+
{ 'method': 'Runtime.enable' },
28+
{ 'method': 'Debugger.enable' },
29+
{ 'method': 'Debugger.setPauseOnExceptions',
30+
'params': {'state': 'none'} },
31+
{ 'method': 'Debugger.setAsyncCallStackDepth',
32+
'params': {'maxDepth': 0} },
33+
{ 'method': 'Profiler.enable' },
34+
{ 'method': 'Profiler.setSamplingInterval',
35+
'params': {'interval': 100} },
36+
{ 'method': 'Debugger.setBlackboxPatterns',
37+
'params': {'patterns': []} },
38+
{ 'method': 'Runtime.runIfWaitingForDebugger' }
39+
];
40+
41+
session
42+
.sendInspectorCommands(commands)
43+
.expectMessages(setupExpectBreakOnLine(0, script, session));
44+
}
45+
46+
function testWaitsForFrontendDisconnect(session, harness) {
47+
console.log('[test]', 'Verify node waits for the frontend to disconnect');
48+
session.sendInspectorCommands({ 'method': 'Debugger.resume'})
49+
.expectStderrOutput('Waiting for the debugger to disconnect...')
50+
.disconnect(true);
51+
}
52+
53+
function runTests(harness) {
54+
harness
55+
.runFrontendSession([
56+
testBreakpointOnStart,
57+
testWaitsForFrontendDisconnect
58+
]).expectShutDown(1);
59+
}
60+
61+
helper.startNodeForInspectorTest(runTests,
62+
undefined,
63+
undefined,
64+
script);

0 commit comments

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