Keep in mind that es-discuss has hosted frequent, detailed discussions on the topic of weak references and it is quite possible that they could be introduced in ES7 or ES8 (at least based on what has been said on the list), due to their requirement for solving certain problems in large-scale applications. Explicit disposal and manual cycle-breaking are both incredibly error prone, so if a weak reference mechanism can simplify mozilla JS and make it more robust, fears of exposing GC behavior to chrome and other privileged JS do not seem like they should override utilitarian concerns.
On Thu, Mar 20, 2014 at 3:37 AM, David Rajchenbach-Teller <dtel...@mozilla.com> wrote: > So basically, you want to add a finalizer for JS component? > > Note that we already have a weak (post-mortem) finalization module for > JS, hidden somewhere in mozilla-central. It's not meant to be used for > performance critical code, and it provides no guarantees about cycles, > but if this is necessary, I could rework it in something a bit > faster/more robust. > > Cheers, > David > > On 3/20/14 1:25 AM, smaug wrote: >> And we could add a flag to WrappedJS so that it would call some callback >> when it is about >> to go away. That would let cleanup of WeakPromise happen asap. >> Basically keep a hashtable wrappedjs -> >> objects_implementing_callback_interface_foo. >> Then when adding an object to the hashtable, wrappedjs would get marked >> with a flag, that >> it should look at the hashtable when it is going away, and if there is >> value in the hashtable, >> call the foo. >> >> This cleanup mechanism could be used with weak observers and weak >> listeners too. >> >> >> -Olli >> _______________________________________________ >> dev-platform mailing list >> dev-platform@lists.mozilla.org >> https://lists.mozilla.org/listinfo/dev-platform > > > -- > David Rajchenbach-Teller, PhD > Performance Team, Mozilla > _______________________________________________ > dev-platform mailing list > dev-platform@lists.mozilla.org > https://lists.mozilla.org/listinfo/dev-platform _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform