On 3/23/14 2:55 AM, Jim Blandy wrote:
I hope we're not talking past each other... the visible behavior of
Services.obs.addObserver("glurph", () => { alert("Glurph!"); }, true)
(pretending that the function supported nsIWeakReference) depends on
when the GC notices the function is garbage. No?
Ah, I see. Yes, it does. And functions do in fact support
nsIWeakReference.
Let me make sure I understand your proposal correctly.
Say we have this:
observerService.addSettingObserver("data-changed", obj, "cache", null)
and someone sets a "data-changed" notification. If I understand your
proposal correctly, that will do some equivalent of "obj.cache = null",
assuming "obj" is still alive, right?
But doing "obj.cache = null" can in fact invoke an arbitrary setter on
obj (and if we use defineProperty, we run into proxies being able to
intercept even that). I guess we could require that "obj" is a
non-proxy object which has "cache" as an own non-configurable writable
data property to remove that hazard?
-Boris
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform