Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34.3k
repl: Prevent REPL crash when tab-completed with Proxy objects#2120
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
Uh oh!
There was an error while loading. Please reload this page.
Conversation
thefourtheye commented Jul 7, 2015
I don't know how to write a test for this, as we need to
I am not sure how to do both of them in the same test. |
evanlucas commented Jul 7, 2015
To force the flags, take a look at https://github.com/nodejs/io.js/blob/master/test/sequential/test-debug-args.js#L2 |
rlidwka commented Jul 7, 2015
Can something else except proxy objects cause Also, I'm not sure adding an error message is useful. Maybe just silencing that particular error would be better. |
thefourtheye commented Jul 7, 2015
@evanlucas I tried that now and it doesn't work. This is the patch which I tried, It still throws a @rlidwka We can tighten the error checking, but silencing it will not give a hint to the user. Will that be okay? |
evanlucas commented Jul 7, 2015
Did you still get the ReferenceError running it with |
thefourtheye commented Jul 7, 2015
@evanlucas Awesome, it works :-) Thanks for the help. I removed the error check as suggested by @rlidwka now. |
46d7896 to df87261CompareThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use either the referenceErrors or completionCount variable here (see the rest of the test). This test is known to fail silently.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cjihrig Oh, why not common.mustCall then? That should work here, right? I think that would make the tests better, without explicitly counting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That should work for the tests using completionCount.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cjihrig commented Jul 7, 2015
This can no longer be merged. |
cjihrig commented Jul 7, 2015
Not a huge fan of just dropping errors, but it's also just REPL tab completion. LGTM |
b77a4c9 to c598b9aCompareIf 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.
c598b9a to fc1ae90Comparethefourtheye commented Jul 7, 2015
@cjihrig Thanks for reviewing and notifying about the merge conflict :-) I rebased and squashed the commits. @rlidwka@evanlucas PTAL :-) |
evanlucas commented Jul 10, 2015
CI: https://jenkins-iojs.nodesource.com/job/iojs+any-pr+multi/139/ LGTM if CI is happy |
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: #2120Fixes: #2119 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Evan Lucas <[email protected]>
evanlucas commented Jul 10, 2015
Landed in 59f6b5d with a slightly modified commit message to conform to the collaborator guidelines. Thanks @thefourtheye! |
thefourtheye commented Jul 10, 2015
@evanlucas Thanks :-) Can we close the actual bug report now itself or we ll wait for the fix to be released? |
evanlucas commented Jul 10, 2015
Good call. I forgot about that. Done |
If the proxy objects don't have a valid
hasOwnPropertyNamestrap,REPL crashes with a
TypeError, as per the bug report#2119
This patch traps the error thrown and issues Error message.