Allow deno_buf with null alloc_ptr to be memcpy'd

This is a temporary hack to allow for easier restructuring of
the serialization code as we move Flatbuffer stuff from C++ to Rust.
This commit is contained in:
Ryan Dahl 2018-07-23 14:11:41 -04:00
parent b87e6d5604
commit b79ce93010
3 changed files with 49 additions and 6 deletions

View file

@ -134,3 +134,14 @@ global.ErrorHandling = () => {
};
eval("\n\n notdefined()\n//# sourceURL=helloworld.js");
};
global.SendNullAllocPtr = () => {
deno.recv(msg => {
assert(msg instanceof Uint8Array);
assert(msg.byteLength === 4);
assert(msg[0] === "a".charCodeAt(0));
assert(msg[1] === "b".charCodeAt(0));
assert(msg[2] === "c".charCodeAt(0));
assert(msg[3] === "d".charCodeAt(0));
});
};