ecmascript-object-observe icon indicating copy to clipboard operation
ecmascript-object-observe copied to clipboard

[[Notifier]]'s realm depends on the caller of the GetNotifier abstract operation

Open ajklein opened this issue 10 years ago • 6 comments

[[Notifier]] is initialized to undefined when an object is created. This means that, for example:

// Realm1
var obj = {};

...

// Realm2
otherRealm.obj.foo = 'bar'

obj's [[Notifier]] is now in Realm 2, since GetNotifier is called by EnqueueChangeRecord.

Ideally the [[Notifier]] should belong to the same realm as the object, but this might have implementation difficulties in some engines.

ajklein avatar Dec 15 '14 21:12 ajklein

Like I said in #3, we could use the realm of the callback function. This probably means that we need some intermediate objects since we don't know the realm of an object and we don't know the realm until we get to the callback.

arv avatar Dec 15 '14 22:12 arv

Which callback function? Objects only have one notifier. Are you suggesting we give them multiple notifiers, one per realm that's observing them?

ajklein avatar Dec 15 '14 22:12 ajklein

Yes. That is isomorphic to what I was trying to say.

arv avatar Dec 15 '14 22:12 arv

Aha! Multiple notifier objects seems like it might be a bigger change...

ajklein avatar Dec 15 '14 22:12 ajklein

We can have a single [[Notifier]] but create the user observable objects in the same realms as the callback functions.

arv avatar Dec 15 '14 22:12 arv

Closing this in favor for #3

arv avatar Jan 20 '15 20:01 arv