Synchronous Object.observe but Asynchronous Object.unobserve ?

Erik Arvidsson erik.arvidsson at gmail.com
Thu Nov 1 18:38:29 PDT 2012


On Thu, Nov 1, 2012 at 4:32 PM, Andrea Giammarchi
<andrea.giammarchi at gmail.com> wrote:
> Just wondering if this is actually meant/expected, I am talking about the
> example here:
>
> http://wiki.ecmascript.org/doku.php?id=harmony:observe#example

I'm not sure I understand your point. The example is not normative and
it doesn't say anything about timing.

> and the fact it should show something in console while in my opinion that
> should show nothing since the Object.unobserve is called in the same "tick"

The delivery of the mutation records is async, not the calls to
Object.observe or Object.unobserve.

> Then I read the algo and I wonder if this won't create many problems, i.e.
> enabling a new way to leak objects through observers that should not be
> called once the object is not observed anymore, specially because there's no
> way to understand if the object is observed or not, isn't it?

Leak in what sense? Memory, security?

If someone has access to a non frozen object they can observe changes
to its data properties. This is not a new capability, it can be done
today by polling or rewriting them as accessors.

> Thanks for any sort of clarification.

I'm not sure that answer your questions?

-- 
erik


More information about the es-discuss mailing list