worker: reduce MessagePort prototype to documented API#23037
Closed
addaleax wants to merge 6 commits intonodejs:masterfrom
Closed
worker: reduce MessagePort prototype to documented API#23037addaleax wants to merge 6 commits intonodejs:masterfrom
MessagePort prototype to documented API#23037addaleax wants to merge 6 commits intonodejs:masterfrom
Conversation
This reduces unintended exposure of internals.
`MessagePort` is special because it has to be a C++ API that is exposed to userland. Therefore, there is a number of internal methods on its native prototype; this commit reduces this set of methods to only what is documented in the API.
devsnek
approved these changes
Sep 23, 2018
targos
approved these changes
Sep 23, 2018
lpinca
approved these changes
Sep 23, 2018
lib/internal/worker.js
Outdated
| Worker: WorkerImpl, | ||
| getEnvMessagePort, | ||
| threadId | ||
| threadId, |
Member
There was a problem hiding this comment.
Nit: this triggers my OCD, can we make this consistent with the above destructuring assignment?
Member
Author
There was a problem hiding this comment.
Sorry, this was leftover from addressing the previous review comment … the comma is gone now :)
BridgeAR
approved these changes
Sep 23, 2018
| [ | ||
| 'ref', 'unref', 'start', 'close', 'postMessage', 'onmessage', | ||
| 'constructor' | ||
| ].sort()); |
Member
There was a problem hiding this comment.
Nit: why should the array not be pre-sorted as in: [ 'close', 'constructor', 'onmessage', 'postMessage', 'ref', 'start', 'unref' ]?
Member
Author
jasnell
approved these changes
Sep 23, 2018
Member
Author
addaleax
added a commit
that referenced
this pull request
Sep 25, 2018
This reduces unintended exposure of internals. PR-URL: #23037 Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com>
addaleax
added a commit
that referenced
this pull request
Sep 25, 2018
`MessagePort` is special because it has to be a C++ API that is exposed to userland. Therefore, there is a number of internal methods on its native prototype; this commit reduces this set of methods to only what is documented in the API. PR-URL: #23037 Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com>
targos
pushed a commit
that referenced
this pull request
Sep 27, 2018
This reduces unintended exposure of internals. PR-URL: #23037 Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com>
targos
pushed a commit
that referenced
this pull request
Sep 27, 2018
`MessagePort` is special because it has to be a C++ API that is exposed to userland. Therefore, there is a number of internal methods on its native prototype; this commit reduces this set of methods to only what is documented in the API. PR-URL: #23037 Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com>
This was referenced Oct 10, 2018
This was referenced Oct 11, 2018
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.
worker: hide MessagePort init function behind symbol
This reduces unintended exposure of internals.
worker: reduce
MessagePortprototype to documented APIMessagePortis special because it has to be a C++ APIthat is exposed to userland. Therefore, there is a number
of internal methods on its native prototype; this commit
reduces this set of methods to only what is documented in
the API.
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes