Re: [whatwg/dom] What realm should be used for creating events from "fire an event" (#352)

> Firefox may use the target's relevant Realm

It does.  Specifically, in Firefox construction of an event requires passing in an EventTarget.  The Realm used for the event is then whatever the Realm of the EventTarget is at the point when the event's script representation is first created.  In practice, I think the observable effect is that the Realm is whatever the Realm of the target is at the point when the event itself is created, but in theory if you have a C++ listener for the event that does something that triggers page script and the page script changes the target's Realm before any JS listeners for the event end up running, the event JS reflection _could_ be created later than the event itself and after the target has changed Realms.

> at least as far as I can tell by testing the prototypes (they were not swizzled)

One could actually change the Realm of the underlying object without swizzling the prototypes (e.g. to maintain an invariant that the Realm and hence origin of all nodes in a node tree is the same).  This would only be observable through APIs that use relevant Realm directly....  We could just ask Microsoft what Edge is really doing.

> Maybe it is going by the realm of the target's document?

What happens for targets that aren't nodes?

> I think maybe we should standardize on using target's relevant Realm

That seems perfectly acceptable to me, since it matches Gecko's behavior anyway, more or less.  ;)

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/352#issuecomment-256473441

Received on Wednesday, 26 October 2016 20:53:44 UTC