diff --git a/src/node_serdes.cc b/src/node_serdes.cc index 27b4e9e8b49e6b..58ce70b2e08b5e 100644 --- a/src/node_serdes.cc +++ b/src/node_serdes.cc @@ -282,6 +282,7 @@ DeserializerContext::DeserializerContext(Environment* env, length_(Buffer::Length(buffer)), deserializer_(env->isolate(), data_, length_, this) { object()->Set(env->context(), env->buffer_string(), buffer).FromJust(); + deserializer_.SetExpectInlineWasm(true); MakeWeak(); } diff --git a/test/parallel/test-v8-serdes.js b/test/parallel/test-v8-serdes.js index 242f0e1bdae576..3f88503546f453 100644 --- a/test/parallel/test-v8-serdes.js +++ b/test/parallel/test-v8-serdes.js @@ -4,6 +4,7 @@ const { internalBinding } = require('internal/test/binding'); const common = require('../common'); +const fixtures = require('../common/fixtures'); const assert = require('assert'); const v8 = require('v8'); const os = require('os'); @@ -11,6 +12,8 @@ const os = require('os'); const circular = {}; circular.circular = circular; +const wasmModule = new WebAssembly.Module(fixtures.readSync('test.wasm')); + const objects = [ { foo: 'bar' }, { bar: 'baz' }, @@ -20,7 +23,8 @@ const objects = [ undefined, null, 42, - circular + circular, + wasmModule ]; const hostObject = new (internalBinding('js_stream').JSStream)(); @@ -230,3 +234,9 @@ const deserializerTypeError = /^TypeError: buffer must be a TypedArray or a DataView$/, ); } + +{ + const deserializedWasmModule = v8.deserialize(v8.serialize(wasmModule)); + const instance = new WebAssembly.Instance(deserializedWasmModule); + assert.strictEqual(instance.exports.addTwo(10, 20), 30); +}