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 crash on tab completion. #2119

Closed
hemanth opened this issue Jul 7, 2015 · 2 comments
Closed

REPL crash on tab completion. #2119

hemanth opened this issue Jul 7, 2015 · 2 comments
Labels
repl Issues and PRs related to the REPL subsystem.

Comments

@hemanth
Copy link
Contributor

hemanth commented Jul 7, 2015

$ iojs  --version
v2.3.3

$ iojs  --harmony-proxies
var proxy = Proxy.create({ fix: function() { return {}; } });

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)
@mscdex mscdex added the repl Issues and PRs related to the REPL subsystem. label Jul 7, 2015
thefourtheye added a commit to thefourtheye/io.js that referenced this issue Jul 7, 2015
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.
evanlucas pushed a commit that referenced this issue Jul 10, 2015
If the proxy objects don't have a valid `hasOwnPropertyNames` trap,
REPL crashes with a `TypeError`, as per the bug report
#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.

PR-URL: #2120
Fixes: #2119
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Evan Lucas <[email protected]>
@evanlucas
Copy link
Contributor

Fixed by 59f6b5d.

@hemanth
Copy link
Contributor Author

hemanth commented Jul 13, 2015

try-catch hmm I shall read repl.js next time ;) 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
repl Issues and PRs related to the REPL subsystem.
Projects
None yet
Development

No branches or pull requests

3 participants