-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
test: add node::MakeCallback() test coverage #3478
Conversation
Technically |
}), 1337)); | ||
|
||
const recv = { | ||
one: common.mustCall(function(x) { |
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.
Why pass x
?
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.
Oh, copy/paste error probably. I'll remove that.
Aside from my first comment and a question, tests LGTM. |
@bnoordhuis I see, but what about your comment on changing behavior to use the function's context instead? Does it still make sense to do the Value-to-Object conversion here nodejs/nan#499 or should that be reverted as well? |
That doesn't work right when the function is created in another context (see the test at the bottom of the file.) You could take the receiver's context if |
I don't think it matters for this test (no I/O, no timers) but how would you test it otherwise? I suppose I could move more logic to C++ land but on second thought, maybe this should be addressed in MakeCallback() instead: maintain a call depth counter and only flush the queue when it's zero. Thoughts? |
Sorry. Let's not hold up this PR for an unrelated issue. For reference this has mainly been discussed in nodejs/nan#284 and nodejs/node-v0.x-archive#9245. I'm taking another stab at it, but something about the timing of when things are called throw me off. LGTM |
Thanks Trevor, landed in 3a091d2. |
PR-URL: #3478 Reviewed-By: Trevor Norris <[email protected]>
Should this be LTS? Sorry if this ends up being noise, but I'm unsure if this additional test is tied to a change in v8 or if it would be a useful addition to the LTS test suite. |
/cc @jasnell |
Not strictly necessary but wouldn't hurt. |
PR-URL: #3478 Reviewed-By: Trevor Norris <[email protected]>
PR-URL: #3478 Reviewed-By: Trevor Norris <[email protected]>
Landed in v4.x-staging in d94f4b8 |
PR-URL: #3478 Reviewed-By: Trevor Norris <[email protected]>
R=@trevnorris?
/cc @kkoopa - this is why you can't have
Local<Value>
as the receiver, it wouldn't pass these tests. :-)CI: https://ci.nodejs.org/job/node-test-pull-request/559/