-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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: prefer iterable weak set than WeakRefs in AbortSignal.any #54943
Conversation
bdcc36b
to
2a7a07f
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #54943 +/- ##
==========================================
+ Coverage 88.06% 88.08% +0.01%
==========================================
Files 651 651
Lines 183451 183567 +116
Branches 35821 35866 +45
==========================================
+ Hits 161564 161692 +128
+ Misses 15133 15130 -3
+ Partials 6754 6745 -9
|
I don't think this is clearer or aligns any more or less with the spec than the previous implementation to be honest. If there is a spec compliance issue, please add a WPT with a failing case before (but passing after) this change |
@benjamingr Hi Benjamin, thanks for the review. I actually thought about that since this doesn't fix any WPT. However, there is one behaviour change and one benefit that I saw initially.
This might be trivial, but those are my thoughts : ) |
Every JavaScript set is an ordered set (on its insertion/iteration order). This (iteration order) is actually why the DOM spec typically uses an ordered set. This is weird but the language works like this - it's also why the WPTs related to order passed. I think the relevant part is whatwg/dom#1152 (comment) between Domenic/Scott in which case I agree with Domenic it made the spec code cleaner, I'm not sure that translates to our code. Cancellation semantics and weak collections/refs are both notoriously tricky and going through a new collection here doesn't help. (I appreciate your effort here and engagement, I hope the fact I don't like this change doesn't come off as less appreciating of the work put here - more people to engage around these areas is greatly appreciated so thanks 🙏 ) |
I missed that. That makes sense.
Not at all. I only raised this as to get others' ideas. I leared a lot from the conversation. Thanks! |
The dom spec specified the usage of weak sets for dependent and source signals. This came from a discussion in the original dom spec PR, which explicitly stated "weak sets" rather than "a set of weak references" to avoid extra
new WeakRef
andderef
when interacting with the signals. This PR makes that behavior spec compliant.