forked from nodejs/node
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This enables inspector support for contexts created using the vm module. Fixes: nodejs#7593 Fixes: nodejs#12096 Refs: nodejs#9272
- Loading branch information
Showing
6 changed files
with
79 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
'use strict'; | ||
const common = require('../common'); | ||
common.skipIfInspectorDisabled(); | ||
const assert = require('assert'); | ||
const helper = require('./inspector-helper.js'); | ||
|
||
function setupExpectBreakInContext() { | ||
return function(message) { | ||
if ('Debugger.paused' === message['method']) { | ||
const callFrame = message['params']['callFrames'][0]; | ||
assert.strictEqual(callFrame['functionName'], 'testfn'); | ||
return true; | ||
} | ||
}; | ||
} | ||
|
||
function testBreakpointInContext(session) { | ||
console.log('[test]', | ||
'Verifying debugger stops on start (--inspect-brk option)'); | ||
const commands = [ | ||
{ 'method': 'Runtime.enable' }, | ||
{ 'method': 'Debugger.enable' }, | ||
{ 'method': 'Runtime.runIfWaitingForDebugger' } | ||
]; | ||
session | ||
.sendInspectorCommands(commands) | ||
.expectMessages(setupExpectBreakInContext()); | ||
} | ||
|
||
function resume(session) { | ||
session | ||
.sendInspectorCommands({ 'method': 'Debugger.resume'}) | ||
.disconnect(true); | ||
} | ||
|
||
function runTests(harness) { | ||
harness | ||
.runFrontendSession([ | ||
testBreakpointInContext, | ||
resume, | ||
]).expectShutDown(0); | ||
} | ||
|
||
const script = 'require("vm").runInNewContext(' + | ||
'"function testfn() {debugger};testfn();")'; | ||
|
||
helper.startNodeForInspectorTest(runTests, '--inspect-brk', script); |