Use cases for WeakMap
bzbarsky at MIT.EDU
Mon May 16 11:16:24 PDT 2011
On 5/16/11 1:48 PM, Brendan Eich wrote:
>> For the use case mentioned by Boris in this thread, where a FF
>> extension needs to attach metadata to an object it doesn't seem likely
>> that the mapping will get lost and need to be GCed before the objects
>> that have the metadata attached.
> The add-on easily can outlive the content window or iframe containing the wrapped object, you're right. But it can go the other way too: add-on disabling or add-on specific reset clears the add-on state, including weak maps, while the content DOM wrapped objects live blithely on.
Indeed. Once you stop debugging, Firebug may well want to throw away
all the state it needed to debug.
More information about the es-discuss