NEW123527
Provide a way to iterate over WeakMap
https://bugs.webkit.org/show_bug.cgi?id=123527
Summary Provide a way to iterate over WeakMap
Timothy Hatcher
Reported 2013-10-30 13:46:19 PDT
Created attachment 215559 [details] Desired Use Case in the Inspector For the Inspector, we want to start using WeakMap for our event listener and dispatch base Object prototype. However, WeakMap can't be enumerated at all, unlike Map. I understand this is a design decision baked into ES6. But it really limits the uses to WeakMap.
Attachments
Desired Use Case in the Inspector (6.35 KB, application/x-javascript)
2013-10-30 13:46 PDT, Timothy Hatcher
no flags
Geoffrey Garen
Comment 1 2013-11-01 13:33:57 PDT
I believe the spec folks objected based on the fact that iteration would make GC behavior observable. I'm not sure I agree with that objection. Given that a WebKit-only client would use WeakMap iteration, it might be worth implementing even if other browsers don't implement it.
Timothy Hatcher
Comment 2 2013-11-07 16:12:57 PST
Lets do it then!
Oliver Hunt
Comment 3 2013-11-07 16:16:03 PST
(In reply to comment #1) > I believe the spec folks objected based on the fact that iteration would make GC behavior observable. I'm not sure I agree with that objection. Given that a WebKit-only client would use WeakMap iteration, it might be worth implementing even if other browsers don't implement it. Yes, my plan was to make this a privileged API (In reply to comment #2) > Lets do it then! Would you be okay with a magical "get an array of entries" style API? (This simplifies the semantics dramatically)
Timothy Hatcher
Comment 4 2013-11-07 16:18:50 PST
Any API would do. We would need the key and value pairs.
Note You need to log in before you can comment on or make changes to this bug.