worker: make MessagePort constructor non-callable#28032
Closed
addaleax wants to merge 1 commit intonodejs:masterfrom
Closed
worker: make MessagePort constructor non-callable#28032addaleax wants to merge 1 commit intonodejs:masterfrom
addaleax wants to merge 1 commit intonodejs:masterfrom
Conversation
Trott
approved these changes
Jun 2, 2019
Member
Trott
left a comment
There was a problem hiding this comment.
LGTM if CI is green. I guess since worker_threads are still Experimental, this can technically still land as a patch in 12.x even if it is deemed semver-major. (But I'm OK if we'd rather be cautious. Fine either way.)
TimothyGu
approved these changes
Jun 3, 2019
Collaborator
joyeecheung
reviewed
Jun 5, 2019
src/node_messaging.cc
Outdated
Member
There was a problem hiding this comment.
Can't we just use ConstructorBehavior::kThrow for this? If there is a particular reason for throwing our own style of errors I think that's worth a comment..
Member
Author
There was a problem hiding this comment.
@joyeecheung Yeah, it doesn’t work because that also removes the prototype property. I’m adding a comment, though.
09d50f0 to
9902484
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
jasnell
approved these changes
Jun 10, 2019
Refactor the C++ code for creating `MessagePort`s to skip calling the constructor and instead directly instantiating the `InstanceTemplate`, and always throw an error from the `MessagePort` constructor. This aligns behaviour with the web, and creating single `MessagePort`s does not make sense anyway.
9902484 to
a28b289
Compare
This comment has been minimized.
This comment has been minimized.
chjj
added a commit
to chjj/bthreads
that referenced
this pull request
Jun 11, 2019
Member
Member
|
Landed in 0640526 |
Trott
pushed a commit
to Trott/io.js
that referenced
this pull request
Jun 13, 2019
Refactor the C++ code for creating `MessagePort`s to skip calling the constructor and instead directly instantiating the `InstanceTemplate`, and always throw an error from the `MessagePort` constructor. This aligns behaviour with the web, and creating single `MessagePort`s does not make sense anyway. PR-URL: nodejs#28032 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
BridgeAR
pushed a commit
that referenced
this pull request
Jun 17, 2019
Refactor the C++ code for creating `MessagePort`s to skip calling the constructor and instead directly instantiating the `InstanceTemplate`, and always throw an error from the `MessagePort` constructor. This aligns behaviour with the web, and creating single `MessagePort`s does not make sense anyway. PR-URL: #28032 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Merged
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.
Refactor the C++ code for creating
MessagePorts to skip calling theconstructor and instead directly instantiating the
InstanceTemplate,and always throw an error from the
MessagePortconstructor.This aligns behaviour with the web, and creating single
MessagePortsdoes not make sense anyway.
This is technically a breaking change and I’d be happy to split out the added throw into a separate PR out of caution, if anybody considers that a good idea.
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes