}
}
+Object.defineProperty(Buffer.prototype, 'parent', {
+ enumerable: true,
+ get () {
+ if (!(this instanceof Buffer)) {
+ return undefined
+ }
+ return this.buffer
+ }
+})
+
Object.defineProperty(Buffer.prototype, 'offset', {
enumerable: true,
get () {
} else {
common.printSkipMessage('missing crypto');
}
-/*
+
var ps = Buffer.poolSize;
Buffer.poolSize = 0;
assert(Buffer.allocUnsafe(1).parent instanceof ArrayBuffer);
Buffer.poolSize = ps;
-*/
+
// Test Buffer.copy() segfault
assert.throws(() => Buffer.allocUnsafe(10).copy(),
/TypeError: argument should be a Buffer/);
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);