stream: fix Writable subclass instanceof checks#9088
Closed
addaleax wants to merge 3 commits intonodejs:masterfrom
Closed
stream: fix Writable subclass instanceof checks#9088addaleax wants to merge 3 commits intonodejs:masterfrom
Writable subclass instanceof checks#9088addaleax wants to merge 3 commits intonodejs:masterfrom
Conversation
2a4b068 introduced a regression in where checking `instanceof` would fail for `Writable` subclasses inside the subclass constructor, i.e. before `Writable()` was called. Also, calling `null instanceof Writable` or `undefined instanceof Writable` would fail due to accessing the `_writableState` property of the target object. This fixes these problems. Ref: nodejs#8834 (comment)
4 tasks
Closed
Member
Author
|
CI: https://ci.nodejs.org/job/node-test-commit/5601/ /cc @nodejs/streams |
Contributor
|
/cc @mcollina |
mcollina
reviewed
Oct 14, 2016
| value: function(object) { | ||
| if (realHasInstance.call(this, object)) | ||
| return true; | ||
|
|
Member
There was a problem hiding this comment.
how does this affect LazyTransform?
Member
Author
There was a problem hiding this comment.
@mcollina It works fine (otherwise there are failing tests). LazyTransform is only affected by the conditional in the Writable constructor, and that’s left unchanged here,
Member
There was a problem hiding this comment.
can you update the comment below and maybe move it to the constructor then.
Fishrock123
approved these changes
Oct 14, 2016
Contributor
|
Is this good to land? |
Member
|
LGTM |
1 similar comment
Contributor
|
LGTM |
Contributor
|
Landing before the 48h minimum so we can get a non-broken version of v6 out |
Contributor
|
Landed in 7922830 |
evanlucas
pushed a commit
that referenced
this pull request
Oct 14, 2016
2a4b068 introduced a regression in where checking `instanceof` would fail for `Writable` subclasses inside the subclass constructor, i.e. before `Writable()` was called. Also, calling `null instanceof Writable` or `undefined instanceof Writable` would fail due to accessing the `_writableState` property of the target object. This fixes these problems. PR-URL: #9088 Ref: #8834 (comment) Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Evan Lucas <evanlucas@me.com>
evanlucas
pushed a commit
that referenced
this pull request
Oct 14, 2016
2a4b068 introduced a regression in where checking `instanceof` would fail for `Writable` subclasses inside the subclass constructor, i.e. before `Writable()` was called. Also, calling `null instanceof Writable` or `undefined instanceof Writable` would fail due to accessing the `_writableState` property of the target object. This fixes these problems. PR-URL: #9088 Ref: #8834 (comment) Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Evan Lucas <evanlucas@me.com>
evanlucas
pushed a commit
that referenced
this pull request
Oct 14, 2016
2a4b068 introduced a regression in where checking `instanceof` would fail for `Writable` subclasses inside the subclass constructor, i.e. before `Writable()` was called. Also, calling `null instanceof Writable` or `undefined instanceof Writable` would fail due to accessing the `_writableState` property of the target object. This fixes these problems. PR-URL: #9088 Ref: #8834 (comment) Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Evan Lucas <evanlucas@me.com>
Merged
evanlucas
added a commit
that referenced
this pull request
Oct 14, 2016
evanlucas
added a commit
that referenced
this pull request
Oct 15, 2016
jasnell
pushed a commit
that referenced
this pull request
Oct 17, 2016
2a4b068 introduced a regression in where checking `instanceof` would fail for `Writable` subclasses inside the subclass constructor, i.e. before `Writable()` was called. Also, calling `null instanceof Writable` or `undefined instanceof Writable` would fail due to accessing the `_writableState` property of the target object. This fixes these problems. PR-URL: #9088 Ref: #8834 (comment) Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Evan Lucas <evanlucas@me.com>
imyller
added a commit
to imyller/meta-nodejs
that referenced
this pull request
Oct 17, 2016
* build: Fix building with shared zlib. (Bradley T. Hughes) [#9077](nodejs/node#9077) * stream: fix `Writable` subclass instanceof checks (Anna Henningsen) [#9088](nodejs/node#9088) * timers: fix regression with clearImmediate() (Brian White) [#9086](nodejs/node#9086) Signed-off-by: Ilkka Myller <ilkka.myller@nodefield.com>
imyller
added a commit
to imyller/meta-nodejs
that referenced
this pull request
Oct 17, 2016
* build: Fix building with shared zlib. (Bradley T. Hughes) [#9077](nodejs/node#9077) * stream: fix `Writable` subclass instanceof checks (Anna Henningsen) [#9088](nodejs/node#9088) * timers: fix regression with clearImmediate() (Brian White) [#9086](nodejs/node#9086) Signed-off-by: Ilkka Myller <ilkka.myller@nodefield.com>
This was referenced Nov 30, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Checklist
make -j8 test(UNIX), orvcbuild test nosign(Windows) passesAffected core subsystem(s)
stream
Description of change
2a4b068 introduced a regression in where checking
instanceofwould fail forWritablesubclasses inside the subclass constructor, i.e. beforeWritable()was called.Also, calling
null instanceof Writableorundefined instanceof Writablewould fail due to accessing the_writableStateproperty of the target object.This fixes these problems.
Ref: #8834 (comment)