diff options
author | Anna Henningsen <anna@addaleax.net> | 2017-08-19 18:29:25 +0200 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2017-08-24 20:58:21 +0200 |
commit | 7ce2555896536a6c9e96a8b9fd17b6563137a876 (patch) | |
tree | 51c8b5f5be8cc062d8fdbb4dc752c4b2502b2f56 /lib/_stream_writable.js | |
parent | abced13e29cdf6df2a0d602af4c6c04f1e88a412 (diff) | |
download | android-node-v8-7ce2555896536a6c9e96a8b9fd17b6563137a876.tar.gz android-node-v8-7ce2555896536a6c9e96a8b9fd17b6563137a876.tar.bz2 android-node-v8-7ce2555896536a6c9e96a8b9fd17b6563137a876.zip |
stream: fix Writable instanceof for subclasses
The current custom instanceof for `Writable` subclasses previously
returned false positives for instances of *other* subclasses of
`Writable` because it was inherited by these subclasses.
Fixes: https://github.com/nodejs/node/issues/14943
PR-URL: https://github.com/nodejs/node/pull/14945
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'lib/_stream_writable.js')
-rw-r--r-- | lib/_stream_writable.js | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/_stream_writable.js b/lib/_stream_writable.js index 6e0eaf45b5..7de77958d5 100644 --- a/lib/_stream_writable.js +++ b/lib/_stream_writable.js @@ -179,6 +179,8 @@ if (typeof Symbol === 'function' && Symbol.hasInstance) { value: function(object) { if (realHasInstance.call(this, object)) return true; + if (this !== Writable) + return false; return object && object._writableState instanceof WritableState; } |