Closed
Description
- Version: 12.2.0
- Platform: Windows 10, Linux Ubuntu 18.0, Mac HighSierra
- Subsystem: inspector
Accessing this
in static class field initialization context in some conditions crashes the process. This seems to be related both to Node.js inspector and Chrome devtool inspector.
Here is an automated repro:
'use strict';
~class{a(){}};
debugger;
class A{static a = this};
if(process.argv.includes('test')) return;
const cp = require('child_process');
const proc1 = cp.spawn(process.execPath, ['--inspect-brk', __filename, 'test']);
const proc2 = cp.spawn(process.execPath, ['inspect', '-p', proc1.pid]);
proc1.on('exit', (code, signal) => {
if(code) console.log('Exit code: ' + code.toString(16).toUpperCase());
if(signal) console.log('Exit signal: ' + signal);
});
setTimeout(() => proc2.stdin.write('c\n'), 1000);
setTimeout(() => proc2.stdin.write('s\n'), 1100);
setTimeout(() => proc2.stdin.write('repl\n'), 1200);
setTimeout(() => proc2.stdin.write('this\n'), 1300);
Save as main.js
, then run node main.js
Output:
Exit code: C0000005 // On Windows
Exit signal: SIGSEGV // On Linux and Mac