-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
lib: make safe primordials safe to iterate #36391
Conversation
This comment has been minimized.
This comment has been minimized.
My original implementation didn't take into account that Note that I'm using |
@addaleax This change affects code running during Worker termination, you may want to review this. I tried to be extra careful, but I may have missed something somewhere. |
git blame points at you for this warning added in f17e414: node/lib/internal/source_map/source_map_cache.js Lines 183 to 186 in cf53748
|
Can we add a test for the edge case this fixes? |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@Trott Good call, the added test highlighted a bug which provides a way for workers to get out of |
Landed in 7c80817...0a5969c |
PR-URL: #36391 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Backporting this to v12.x would be nice as it fixes a potential bug with the Worker implementation, but backporters would have to remove use of null coalescing operator. |
PR-URL: #36391 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This lands cleanly on v14.x but then it fails to build. |
PR-URL: nodejs#36391 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
MapIterator
andSetIterator
are user-mutable, I think it makes sense to be able to iterate overSafeMap
andSafeSet
without calling possibly-user-mutated code.Note that patterns such as
for (const [key, value] of safeMap)
would still be potentially "unsafe" as it executes%ArrayIteratorPrototype%.next
when destructuring, which may have been mutated in user-land.Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes