ecmascript-object-observe
ecmascript-object-observe copied to clipboard
[[Notifier]]'s realm depends on the caller of the GetNotifier abstract operation
[[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.
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.
Which callback function? Objects only have one notifier. Are you suggesting we give them multiple notifiers, one per realm that's observing them?
Yes. That is isomorphic to what I was trying to say.
Aha! Multiple notifier objects seems like it might be a bigger change...
We can have a single [[Notifier]] but create the user observable objects in the same realms as the callback functions.
Closing this in favor for #3