Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

repl: Prevent REPL crash when tab-completed with Proxy objects #2120

Closed

Commits on Jul 7, 2015

  1. repl: Prevent REPL crash when tab-completed with Proxy objects

    If the proxy objects don't have a valid `hasOwnPropertyNames` trap,
    REPL crashes with a `TypeError`, as per the bug report
    nodejs#2119
    
        > var proxy = Proxy.create({ fix: function() { return {}; } });
        undefined
        > proxy.<tab>
        TypeError: Proxy handler #<Object> has no 'getOwnPropertyNames' trap
            at Function.getOwnPropertyNames (native)
            at repl.js:644:40
            at REPLServer.defaultEval (repl.js:169:5)
            at bound (domain.js:254:14)
            at REPLServer.runBound [as eval] (domain.js:267:12)
            at REPLServer.complete (repl.js:639:14)
            at REPLServer.complete [as completer] (repl.js:207:10)
            at REPLServer.Interface._tabComplete (readline.js:377:8)
            at REPLServer.Interface._ttyWrite (readline.js:845:14)
            at ReadStream.onkeypress (readline.js:105:10)
    
    This patch traps the error thrown and suppresses it.
    thefourtheye committed Jul 7, 2015
    Configuration menu
    Copy the full SHA
    fc1ae90 View commit details
    Browse the repository at this point in the history