Bug 123527

Summary: Provide a way to iterate over WeakMap
Product: WebKit Reporter: Timothy Hatcher <timothy>
Component: JavaScriptCoreAssignee: Oliver Hunt <oliver>
Status: NEW ---    
Severity: Normal CC: ggaren, joepeck, oliver
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Desired Use Case in the Inspector none

Description Timothy Hatcher 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.
Comment 1 Geoffrey Garen 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.
Comment 2 Timothy Hatcher 2013-11-07 16:12:57 PST
Lets do it then!
Comment 3 Oliver Hunt 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)
Comment 4 Timothy Hatcher 2013-11-07 16:18:50 PST
Any API would do. We would need the key and value pairs.