-
Notifications
You must be signed in to change notification settings - Fork 30.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Freezing EventTarget.prototype
breaks MessageChannel
#49259
Comments
That's something node tries to do when it's reasonable but not at all costs. Trying to work around a tampered EventEmitter prototype likely impacts performance and is not a good trade-off. Clobbering EventEmitter is setting yourself up for failure anyway. MessageChannel almost certainly isn't the only thing that's affected. |
@addaleax thoughts? |
That's probably right, although in this case at least it does seem like an issue of leaking implementation internals into userspace. Looking at the code where it fails, it seems fixable by using If this theory is correct, the fix would be replacing
Freezing the ports themselves also breaks things (in a different place) due to the same issue of modifying the underlying object from the implementation. Although I'd prefer that not to be the case either, I realise that that'd a much larger fix involving how functionality is implemented in Node, some of which may even be relied on by existing applications. However, a stronger argument is perhaps that freezing prototypes, in general, and in this particular case, doesn't suddenly break the runtime unexpectedly in other platforms, such as browsers or Deno (since |
@corrideat see https://www.youtube.com/watch?v=SOPC3aLoD4U for context |
PR-URL: #49270 Fixes: #49259 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Matthew Aitken <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]>
PR-URL: #49270 Fixes: #49259 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Matthew Aitken <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]>
PR-URL: nodejs#49270 Fixes: nodejs#49259 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Matthew Aitken <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]>
PR-URL: #49270 Fixes: #49259 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Matthew Aitken <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]>
PR-URL: nodejs/node#49270 Fixes: nodejs/node#49259 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Matthew Aitken <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]>
PR-URL: nodejs/node#49270 Fixes: nodejs/node#49259 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Matthew Aitken <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]>
Version
v19.9.0
Platform
Linux WORKSTATION 5.15.90.1-microsoft-standard-WSL2 #1 SMP Fri Jan 27 02:56:13 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Subsystem
node:internal/worker/io:305:30
What steps will reproduce the bug?
Run the following snippet:
How often does it reproduce? Is there a required condition?
It always reproduces
What is the expected behavior? Why is that the expected behavior?
Freezing prototypes should not affect the behaviour of native methods. In particular, user code should not interfere with internals.
What do you see instead?
Additional information
No response
The text was updated successfully, but these errors were encountered: