Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
buffer: only check if instance is Uint8Array
Native Buffer method calls do not require anything from the prototype. So it is unnecessary to check if the Object's prototype is equal to Buffer.prototype. This fixes an issue that prevents Buffer from being inherited the ES5 way. Now the following will work: function A(n) { const b = new Buffer(n); Object.setPrototypeOf(b, A.prototype); return b; } Object.setPrototypeOf(A.prototype, Buffer.prototype); Object.setPrototypeOf(A, Buffer); console.log(new A(4)); Fix: #2882 PR-URL: #3080 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
- Loading branch information