Skip to content

throw null and throw undefined crash in repl #16545

@IonicaBizau

Description

@IonicaBizau
  • Version: 8.6.0
  • Platform: macOS
  • Subsystem: High Sierra

While setTimeout(function(){throw null},0) doesn't crash anymore (as reported in #12373 and fixed in #14306), throw null (also throw undefined) seem to crash the toplevel.

I'd be happy to contribute if you give me a bit of guidance. 😄

$ node --version
v8.6.0
$ node
> throw null
TypeError: Cannot read property 'message' of null
    at REPLServer.defaultEval (repl.js:257:16)
    at bound (domain.js:301:14)
    at REPLServer.runBound [as eval] (domain.js:314:12)
    at REPLServer.onLine (repl.js:440:10)
    at emitOne (events.js:120:20)
    at REPLServer.emit (events.js:210:7)
    at REPLServer.Interface._onLine (readline.js:282:10)
    at REPLServer.Interface._line (readline.js:631:8)
    at REPLServer.Interface._ttyWrite (readline.js:911:14)
    at REPLServer.self._ttyWrite (repl.js:509:7)
> setTimeout(function() { throw null }, 0)
Timeout {
  _called: false,
  _idleTimeout: 1,
  _idlePrev: 
   TimersList {
     _idleNext: [Circular],
     _idlePrev: [Circular],
     _timer: Timer { '0': [Function: listOnTimeout], _list: [Circular] },
     _unrefed: false,
     msecs: 1,
     nextTick: false },
  _idleNext: 
   TimersList {
     _idleNext: [Circular],
     _idlePrev: [Circular],
     _timer: Timer { '0': [Function: listOnTimeout], _list: [Circular] },
     _unrefed: false,
     msecs: 1,
     nextTick: false },
  _idleStart: 8459,
  _onTimeout: [Function],
  _timerArgs: undefined,
  _repeat: null,
  _destroyed: false,
  domain: 
   Domain {
     domain: null,
     _events: { error: [Function: debugDomainError] },
     _eventsCount: 1,
     _maxListeners: undefined,
     members: [] },
  [Symbol(asyncId)]: 118,
  [Symbol(triggerAsyncId)]: 5 }
> Thrown: null

Metadata

Metadata

Assignees

No one assigned

    Labels

    replIssues and PRs related to the REPL subsystem.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions