FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

worker: make MessagePort constructor non-callable by addaleax · Pull Request #28032 · nodejs/node · GitHub

/ node Public

worker: make MessagePort constructor non-callable - #28032

Closed
addaleax wants to merge 1 commit into
nodejs:masterfrom
addaleax:messageport-constructor-callable
Closed

worker: make MessagePort constructor non-callable#28032
addaleax wants to merge 1 commit into
nodejs:masterfrom
addaleax:messageport-constructor-callable

Conversation

addaleax commented Jun 2, 2019

Copy link
Copy Markdown
Member

Refactor the C++ code for creating MessagePorts 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 MessagePorts
does 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), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

addaleax added the worker Issues and PRs related to Worker support. label Jun 2, 2019

Trott left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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.)

BridgeAR added the author ready PRs that have at least one approval, no outstanding review comments, and a CI started. label Jun 4, 2019

nodejs-github-bot commented Jun 4, 2019
edited
Loading

Copy link
Copy Markdown
Collaborator

Comment thread test/wpt/test-url.js Outdated
Comment thread src/node_messaging.cc Outdated

joyeecheung Jun 5, 2019
edited
Loading

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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..

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

@joyeecheung Yeah, it doesn’t work because that also removes the prototype property. I’m adding a comment, though.

addaleax force-pushed the messageport-constructor-callable branch from 09d50f0 to 9902484 Compare June 9, 2019 17:55

This comment has been minimized.

This comment has been minimized.

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.
addaleax force-pushed the messageport-constructor-callable branch from 9902484 to a28b289 Compare June 10, 2019 15:31

This comment has been minimized.

chjj added a commit to chjj/bthreads that referenced this pull request Jun 11, 2019

Trott commented Jun 13, 2019

Copy link
Copy Markdown
Member

Trott commented Jun 13, 2019

Copy link
Copy Markdown
Member

Landed in 0640526

Trott closed this Jun 13, 2019
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>
BridgeAR mentioned this pull request Jun 17, 2019
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

Labels

author ready PRs that have at least one approval, no outstanding review comments, and a CI started. worker Issues and PRs related to Worker support.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants


Back | FazBrowse Home | New Git URL