Uh oh!
There was an error while loading. Please reload this page.
v8: add a js class for Serializer/Dserializer - #13541
Conversation
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. |
@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. |
| } | ||
| { | ||
| try { |
There was a problem hiding this comment.
Can you use assert.throws() for these.
Calling Serializer/Deserlizer without new crashes node. Adding a js class which just inherits cpp bindings. Added refression tests. Fixes: nodejs#13326
| v8.Serializer(); | ||
| }, | ||
| Error, | ||
| "Class constructor Serializer cannot be invoked without 'new'" |
There was a problem hiding this comment.
Can you do something more like this:
assert.throws(()=>{v8.Serializer();},/^Error:ClassconstructorSerializercannotbeinvokedwithout'new'$/);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. |
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
| class Serializer extends serdesBindings.Serializer {} | ||
| class Deserializer extends serdesBindings.Deserializer {} |
There was a problem hiding this comment.
I'd prefer something like:
const{Serializer: _Serializer,Deserializer: _Deserializer}=process.binding('serdes');// ...classSerializerextends_Serializer{}classDeserializerextends_Deserializer{}| () => { v8.Deserializer(); }, | ||
| /^TypeError: Class constructor Deserializer cannot be invoked without 'new'$/ | ||
| ); | ||
| } |
There was a problem hiding this comment.
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
955a1bbCompare| const { Buffer } = require('buffer'); | ||
| const { Serializer, Deserializer } = process.binding('serdes'); | ||
| const { | ||
| Serializer: _Serializer, |
There was a problem hiding this comment.
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
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 <refack@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
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 <refack@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
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)