mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
663 B
27 lines
663 B
/*global SharedArrayBuffer*/
|
|
'use strict';
|
|
// Flags: --harmony-sharedarraybuffer
|
|
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const v8 = require('v8');
|
|
|
|
{
|
|
const sab = new SharedArrayBuffer(64);
|
|
const uint8array = new Uint8Array(sab);
|
|
const ID = 42;
|
|
|
|
const ser = new v8.Serializer();
|
|
ser._getSharedArrayBufferId = common.mustCall(() => ID);
|
|
ser.writeHeader();
|
|
|
|
ser.writeValue(uint8array);
|
|
|
|
const des = new v8.Deserializer(ser.releaseBuffer());
|
|
des.readHeader();
|
|
des.transferArrayBuffer(ID, sab);
|
|
|
|
const value = des.readValue();
|
|
assert.strictEqual(value.buffer, sab);
|
|
assert.notStrictEqual(value, uint8array);
|
|
}
|
|
|