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
v8: add a js class for Serializer/Dserializer#13541
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
zimbabao commented Jun 8, 2017 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
Calling Serializer/Deserlizer without new crashes node. Adding a js class which just inherits cpp bindings. Fixes: nodejs#13326
bnoordhuis commented Jun 8, 2017
Can you add some regression tests? There were some gotchas around I expect it throws an 'illegal invocation' exception but it would be good to verify that. |
addaleax commented Jun 8, 2017
It does, we already extend it :) |
bnoordhuis commented Jun 8, 2017
I mean when you extend the class that this PR introduces. |
TimothyGu commented Jun 8, 2017 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
@bnoordhuis, the classes this PR introduces are already extended further down the file by |
bnoordhuis commented Jun 8, 2017
Okay. Regression tests for the other issues would still be good though. |
Calling Serializer/Deserlizer without new crashes node. Adding a js class which just inherits cpp bindings. Fixes: nodejs#13326
zimbabao commented Jun 8, 2017
@bnoordhuis : Added regression tests. |
test/parallel/test-v8-serdes.js Outdated
| } | ||
| { | ||
| try{ |
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.
Can you use assert.throws() for these.
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 : Made suggested changes.
Calling Serializer/Deserlizer without new crashes node. Adding a js class which just inherits cpp bindings. Added refression tests. Fixes: nodejs#13326
test/parallel/test-v8-serdes.js Outdated
| v8.Serializer(); | ||
| }, | ||
| Error, | ||
| "Class constructor Serializer cannot be invoked without 'new'" |
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.
Can you do something more like this:
assert.throws(()=>{v8.Serializer();},/^Error:ClassconstructorSerializercannotbeinvokedwithout'new'$/);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 : Done
88817fa to b72ec9cComparemscdex commented Jun 8, 2017
There are typos in the commit message(s): s/Dserializer/Deserializer/ |
b72ec9c to cfb934eComparezimbabao commented Jun 8, 2017
@mscdex : Thanks, fixed |
zimbabao commented Jun 8, 2017
Can somebody fire a CI job for this. |
mscdex commented Jun 8, 2017 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
s/refression/regression/ in commit message(s) too. |
Calling Serializer/Deserializer without new crashes node. Adding a js class which just inherits cpp bindings. Added regression tests. Fixes: nodejs#13326
cfb934e to 9643c6cComparezimbabao commented Jun 8, 2017
@mscdex : Fixed on top review. |
mscdex commented Jun 9, 2017
addaleax left a comment
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.
Still LGTM
lib/v8.js Outdated
| classSerializerextendsserdesBindings.Serializer{} | ||
| classDeserializerextendsserdesBindings.Deserializer{} |
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'd prefer something like:
const{Serializer: _Serializer,Deserializer: _Deserializer}=process.binding('serdes');// ...classSerializerextends_Serializer{}classDeserializerextends_Deserializer{}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.
Will resend.
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.
@jasnell : Made changes and added a note.
| ()=>{v8.Deserializer();}, | ||
| /^TypeError:ClassconstructorDeserializercannotbeinvokedwithout'new'$/ | ||
| ); | ||
| } |
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.
Should likely also add a note to the documentation clarifying the requirement
Calling Serializer/Deserializer without new crashes node. Adding a js class which just inherits cpp bindings. Added regression tests. Fixes: nodejs#13326
47cccbe to 955a1bbComparelib/v8.js Outdated
| const{ Buffer }=require('buffer'); | ||
| const{ Serializer, Deserializer }=process.binding('serdes'); | ||
| const{ | ||
| Serializer: _Serializer, |
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.
Can you indent two spaces only?
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.
Done. BTW jslint didn't catch that error. May be we should add a rule?
Calling Serializer/Deserializer without new crashes node. Adding a js class which just inherits cpp bindings. Added regression tests. Fixes: nodejs#13326
TimothyGu commented Jun 10, 2017
Another CI run: https://ci.nodejs.org/job/node-test-pull-request/8588/ |
zimbabao commented Jun 10, 2017
Tests pass on my mac osx sierra laptop. Above failures looks related to CI, can somebody start another run?. |
addaleax commented Jun 10, 2017
Yea, CI is a bit problematic right now, I’m not sure another run would solve much. This code isn’t platform-specific, though, so I think this is okay. |
zimbabao commented Jun 10, 2017
@addaleax : Thanks, anything else for landing this?. |
addaleax commented Jun 10, 2017
@zimbabao Our rules say that we’ll need to wait until tomorrow to land this, but nothing from your side I think. :) |
refack left a comment
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.
LGTM % docs
refack commented Jun 10, 2017
arm: #13603 |
addaleax commented Jun 12, 2017
Landed in 12fd63d, thanks for the PR! |
Calling Serializer/Deserializer without new crashes node. Adding a js class which just inherits cpp bindings. Added regression tests. Fixes: #13326 PR-URL: #13541 Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
Calling Serializer/Deserializer without new crashes node. Adding a js class which just inherits cpp bindings. Added regression tests. Fixes: #13326 PR-URL: #13541 Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
Fixes: #13326 Refs: #13541 PR-URL: #36549 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]>
Fixes: #13326 Refs: #13541 PR-URL: #36549 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]>
Fixes: #13326 Refs: #13541 PR-URL: #36549 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]>
Calling Serializer/Deserlizer without new crashes node.
Adding a js class which just inherits cpp bindings.
Fixes: #13326
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes (test failing on master too)Affected core subsystem(s)