diff options
author | Sakthipriyan Vairamani <thechargingvolcano@gmail.com> | 2016-08-28 21:21:23 +0530 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2016-09-08 23:33:25 +0200 |
commit | c21458a15dcbff405b18a680e9ed18863567736b (patch) | |
tree | 9dc07d7d5d673a3e19f3978bac6c91fff0145cb6 /test/parallel/test-buffer-arraybuffer.js | |
parent | e9b6fbbf170d4ef0031d3194d4c0148269037030 (diff) | |
download | android-node-v8-c21458a15dcbff405b18a680e9ed18863567736b.tar.gz android-node-v8-c21458a15dcbff405b18a680e9ed18863567736b.tar.bz2 android-node-v8-c21458a15dcbff405b18a680e9ed18863567736b.zip |
buffer: expose underlying buffer object always
If the Buffer object's length is zero, or equal to the underlying
buffer object's length, `parent` property returns `undefined`.
> new Buffer(0).parent
undefined
> new Buffer(Buffer.poolSize).parent
undefined
This patch makes the buffer objects to consistently expose the buffer
object via the `parent` property, always.
Fixes: https://github.com/nodejs/node/issues/8266
PR-URL: https://github.com/nodejs/node/pull/8311
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test/parallel/test-buffer-arraybuffer.js')
-rw-r--r-- | test/parallel/test-buffer-arraybuffer.js | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/test/parallel/test-buffer-arraybuffer.js b/test/parallel/test-buffer-arraybuffer.js index 6ffe2c43da..f40c43939f 100644 --- a/test/parallel/test-buffer-arraybuffer.js +++ b/test/parallel/test-buffer-arraybuffer.js @@ -13,9 +13,7 @@ const buf = Buffer.from(ab); assert.ok(buf instanceof Buffer); -// For backwards compatibility of old .parent property test that if buf is not -// a slice then .parent should be undefined. -assert.equal(buf.parent, undefined); +assert.equal(buf.parent, buf.buffer); assert.equal(buf.buffer, ab); assert.equal(buf.length, ab.byteLength); |