-
Notifications
You must be signed in to change notification settings - Fork 30k
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
process: Cast promise rejection reason to string #11640
Conversation
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.
I don't think we need a message test for this. A "normal" test in test/parallel/
that uses common.expectWarning()
should do.
Definitely agree that all this needs is a simple |
From the source and my tests, it looks like A test like the following generates two warnings with different names, so I can't ensure the warning matches. I could 'use strict';
// ensure this doesn't crash
Promise.reject(Symbol());
I've got a change that allows |
Can you split the changes to |
This allows the common.checkWarning() test method to accept a map of warning names to description(s), to allow testing code that generates multiple types of warnings.
The unhandled promise rejection warning uses a template literal and prints the reason a promise was rejected. If rejecting with a symbol, the symbol failed to convert to a string and the process crashed. Now, symbols are casted to strings and the process does not crash. Fixes: #11637
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.
request to not have a message test has been addressed
Landed in 765be6c...a3132b0, thanks for the PR! |
This allows the common.checkWarning() test method to accept a map of warning names to description(s), to allow testing code that generates multiple types of warnings. PR-URL: #11640 Reviewed-By: Anna Henningsen <anna@addaleax.net>
The unhandled promise rejection warning uses a template literal and prints the reason a promise was rejected. If rejecting with a symbol, the symbol failed to convert to a string and the process crashed. Now, symbols are casted to strings and the process does not crash. Fixes: #11637 PR-URL: #11640 Reviewed-By: Anna Henningsen <anna@addaleax.net>
This allows the common.checkWarning() test method to accept a map of warning names to description(s), to allow testing code that generates multiple types of warnings. PR-URL: #11640 Reviewed-By: Anna Henningsen <anna@addaleax.net>
The unhandled promise rejection warning uses a template literal and prints the reason a promise was rejected. If rejecting with a symbol, the symbol failed to convert to a string and the process crashed. Now, symbols are casted to strings and the process does not crash. Fixes: #11637 PR-URL: #11640 Reviewed-By: Anna Henningsen <anna@addaleax.net>
Symbol is only one example among many of something which throws when trying to call Promise.reject({toString(){throw 0;}}) |
This allows the common.checkWarning() test method to accept a map of warning names to description(s), to allow testing code that generates multiple types of warnings. PR-URL: #11640 Reviewed-By: Anna Henningsen <anna@addaleax.net>
The unhandled promise rejection warning uses a template literal and prints the reason a promise was rejected. If rejecting with a symbol, the symbol failed to convert to a string and the process crashed. Now, symbols are casted to strings and the process does not crash. Fixes: #11637 PR-URL: #11640 Reviewed-By: Anna Henningsen <anna@addaleax.net>
Notable changes: * **crypto**: - add randomFill and randomFillSync (Evan Lucas) #10209 * **meta**: Added new collaborators - add lucamaraschi to collaborators (Luca Maraschi) #12538 - add DavidCai1993 to collaborators (David Cai) #12435 - add jkrems to collaborators (Jan Krems) #12427 - add AnnaMag to collaborators (AnnaMag) #12414 * **process**: - fix crash when Promise rejection is a Symbol (Cameron Little) #11640 * **url**: - make WHATWG URL more spec compliant (Timothy Gu) #12507 * **v8**: - fix stack overflow in recursive method (Ben Noordhuis) #12460 - fix build errors with g++ 7 (Ben Noordhuis) #12392 PR-URL: #12775
This allows the common.checkWarning() test method to accept a map of warning names to description(s), to allow testing code that generates multiple types of warnings. PR-URL: #11640 Reviewed-By: Anna Henningsen <anna@addaleax.net>
The unhandled promise rejection warning uses a template literal and prints the reason a promise was rejected. If rejecting with a symbol, the symbol failed to convert to a string and the process crashed. Now, symbols are casted to strings and the process does not crash. Fixes: #11637 PR-URL: #11640 Reviewed-By: Anna Henningsen <anna@addaleax.net>
Notable changes: * **crypto**: - add randomFill and randomFillSync (Evan Lucas) #10209 * **meta**: Added new collaborators - add lucamaraschi to collaborators (Luca Maraschi) #12538 - add DavidCai1993 to collaborators (David Cai) #12435 - add jkrems to collaborators (Jan Krems) #12427 - add AnnaMag to collaborators (AnnaMag) #12414 * **process**: - fix crash when Promise rejection is a Symbol (Cameron Little) #11640 * **url**: - make WHATWG URL more spec compliant (Timothy Gu) #12507 * **v8**: - fix stack overflow in recursive method (Ben Noordhuis) #12460 - fix build errors with g++ 7 (Ben Noordhuis) #12392 PR-URL: #12775
This allows the common.checkWarning() test method to accept a map of warning names to description(s), to allow testing code that generates multiple types of warnings. PR-URL: #11640 Reviewed-By: Anna Henningsen <anna@addaleax.net>
The unhandled promise rejection warning uses a template literal and prints the reason a promise was rejected. If rejecting with a symbol, the symbol failed to convert to a string and the process crashed. Now, symbols are casted to strings and the process does not crash. Fixes: #11637 PR-URL: #11640 Reviewed-By: Anna Henningsen <anna@addaleax.net>
Notable changes: * **crypto**: - add randomFill and randomFillSync (Evan Lucas) #10209 * **meta**: Added new collaborators - add lucamaraschi to collaborators (Luca Maraschi) #12538 - add DavidCai1993 to collaborators (David Cai) #12435 - add jkrems to collaborators (Jan Krems) #12427 - add AnnaMag to collaborators (AnnaMag) #12414 * **process**: - fix crash when Promise rejection is a Symbol (Cameron Little) #11640 * **url**: - make WHATWG URL more spec compliant (Timothy Gu) #12507 * **v8**: - fix stack overflow in recursive method (Ben Noordhuis) #12460 - fix build errors with g++ 7 (Ben Noordhuis) #12392 PR-URL: #12775
Notable changes: * **crypto**: - add randomFill and randomFillSync (Evan Lucas) #10209 * **meta**: Added new collaborators - add lucamaraschi to collaborators (Luca Maraschi) #12538 - add DavidCai1993 to collaborators (David Cai) #12435 - add jkrems to collaborators (Jan Krems) #12427 - add AnnaMag to collaborators (AnnaMag) #12414 * **process**: - fix crash when Promise rejection is a Symbol (Cameron Little) #11640 * **url**: - make WHATWG URL more spec compliant (Timothy Gu) #12507 * **v8**: - fix stack overflow in recursive method (Ben Noordhuis) #12460 - fix build errors with g++ 7 (Ben Noordhuis) #12392 PR-URL: #12775
Notable changes: * **crypto**: - add randomFill and randomFillSync (Evan Lucas) nodejs/node#10209 * **meta**: Added new collaborators - add lucamaraschi to collaborators (Luca Maraschi) nodejs/node#12538 - add DavidCai1993 to collaborators (David Cai) nodejs/node#12435 - add jkrems to collaborators (Jan Krems) nodejs/node#12427 - add AnnaMag to collaborators (AnnaMag) nodejs/node#12414 * **process**: - fix crash when Promise rejection is a Symbol (Cameron Little) nodejs/node#11640 * **url**: - make WHATWG URL more spec compliant (Timothy Gu) nodejs/node#12507 * **v8**: - fix stack overflow in recursive method (Ben Noordhuis) nodejs/node#12460 - fix build errors with g++ 7 (Ben Noordhuis) nodejs/node#12392 PR-URL: nodejs/node#12775 Signed-off-by: Ilkka Myller <ilkka.myller@nodefield.com>
Notable changes: * **crypto**: - add randomFill and randomFillSync (Evan Lucas) nodejs#10209 * **meta**: Added new collaborators - add lucamaraschi to collaborators (Luca Maraschi) nodejs#12538 - add DavidCai1993 to collaborators (David Cai) nodejs#12435 - add jkrems to collaborators (Jan Krems) nodejs#12427 - add AnnaMag to collaborators (AnnaMag) nodejs#12414 * **process**: - fix crash when Promise rejection is a Symbol (Cameron Little) nodejs#11640 * **url**: - make WHATWG URL more spec compliant (Timothy Gu) nodejs#12507 * **v8**: - fix stack overflow in recursive method (Ben Noordhuis) nodejs#12460 - fix build errors with g++ 7 (Ben Noordhuis) nodejs#12392 PR-URL: nodejs#12775
Should this land on 6.x? It sounds like it fixes a crash, so should be, but it also sounds like a change in error messages. |
ping cc/ @addaleax |
@gibfahn Yes, it should. :) |
people backporting this: see my above comment, which I just opened a new issue for at #13771. The fix in this PR doesn't actually handle the full extent of the problem. |
Does it make things worse? As long as it doesn't regess things (and hopefully is an improvement) then it should be fine to backport. |
It's definitely an improvement, just not a complete solution. And I'd expect a complete solution to subsume this one. |
Sure, but any "complete solution" will be a commit on top of this one, so if we don't backport this first we'll get merge conflicts when we try to cherry-pick the complete solution. |
Is anyone willing to backport this to v6.x-staging? If yes please follow the guide and raise a backport PR, if no let me know or add the |
The unhandled promise rejection warning uses a template literal and
prints the reason a promise was rejected. If rejecting with a symbol,
the symbol failed to convert to a string and the process crashed. Now,
symbols are casted to strings and the process does not crash.
Fixes: #11637
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes[ ] documentation is changed or addedAffected core subsystem(s)
process