From 90c50a6c2af6bded9071dc022284a80a2db3bf71 Mon Sep 17 00:00:00 2001 From: Rajaram Gaunker Date: Thu, 8 Jun 2017 01:17:02 -0700 Subject: [PATCH] v8: add a js class for Serializer/Dserializer Calling Serializer/Deserlizer without new crashes node. Adding a js class which just inherits cpp bindings. Fixes: https://github.com/nodejs/node/issues/13326 --- test/parallel/test-v8-serdes.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/parallel/test-v8-serdes.js b/test/parallel/test-v8-serdes.js index d3a879fc225353..2e7d164d6889db 100644 --- a/test/parallel/test-v8-serdes.js +++ b/test/parallel/test-v8-serdes.js @@ -131,3 +131,19 @@ const objects = [ assert.deepStrictEqual(v8.deserialize(buf), expectedResult); } + +{ + try { + v8.Serializer(); + } catch (e) { + const m = "Class constructor Serializer cannot be invoked without 'new'"; + assert.strictEqual(e.message, m); + } + + try { + v8.Deserializer(); + } catch (e) { + const m = "Class constructor Deserializer cannot be invoked without 'new'"; + assert.strictEqual(e.message, m); + } +}