| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 02f1e64 commit 3061cb5
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,31 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + | ||
| 3 | + // Verify that the line containing console.log is reported as a top stack frame | ||
| 4 | + // of the consoleAPICalled notification. | ||
| 5 | + // Changing this will break many Inspector protocol clients, including | ||
| 6 | + // debuggers that use that value for navigating from console messages to code. | ||
| 7 | + | ||
| 8 | + const common = require('../common'); | ||
| 9 | + common.skipIfInspectorDisabled(); | ||
| 10 | + | ||
| 11 | + const assert = require('assert'); | ||
| 12 | + const { Session } = require('inspector'); | ||
| 13 | + const { basename } = require('path'); | ||
| 14 | + | ||
| 15 | + function logMessage() { | ||
| 16 | + console.log('Log a message'); | ||
| 17 | + } | ||
| 18 | + | ||
| 19 | + const session = new Session(); | ||
| 20 | + let topFrame; | ||
| 21 | + session.once('Runtime.consoleAPICalled', (notification) => { | ||
| 22 | + topFrame = (notification.params.stackTrace.callFrames[0]); | ||
| 23 | + }); | ||
| 24 | + session.connect(); | ||
| 25 | + session.post('Runtime.enable'); | ||
| 26 | + | ||
| 27 | + logMessage(); // Triggers Inspector notification | ||
| 28 | + | ||
| 29 | + session.disconnect(); | ||
| 30 | + assert.strictEqual(basename(topFrame.url), basename(__filename)); | ||
| 31 | + assert.strictEqual(topFrame.lineNumber, 15); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments