On 3/21/14 10:14 PM, Jim Blandy wrote:
It's true that when I read, "We are discovering a lot of leaks in JS
implemented DOM objects", I wasn't sure what he was referring to...

He means APIs exposed to the web whose implementation is a JS component.

So typically these are objects whose useful lifetime depends on what the web page is doing with them. As long as they're reachable from the web page, they need to stay alive and functioning.

And in cases when them being "functioning" means them being able to receive notifications from some other piece of chrome JS, we get the problem described here: how do we know when to tell that other piece of chrome JS to forget about us?

But the same question carries over: isn't there some way to tie the
registration / unregistration of observers / listeners to something more
directly connected to the notification recipient becoming uninteresting?

I'm not sure there is.  :(

That is, there's usually some point well before the notification
recipient becomes garbage that it becomes uninteresting. Hence my
mention of DOM node insertion / removal.

Note that DOM nodes that are not in the document tree are "interesting" from the point of view of the web page: they can fire events, load images, be painted to canvases, etc, etc. Unfortunately, the way the web platform works is that anything reachable is potentially interesting. Attempts to cut that off lead to bugs like https://bugzilla.mozilla.org/show_bug.cgi?id=986542 :(

-Boris

_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to