On Mon Oct 9 15:39:26 2023 +0000, Jacek Caban wrote:
Accessing the outer window from an inner window (such as its event target) should always be valid, even if the outer window isn't currently referring to the same inner window, because it's supposed to proxy all requests
to the
"current" inner window.
Why would we want non-current inner window to be able to initiate events? Generally previous HTML windows shouldn't be messing current one and detaching them seems like a nice way of enforcing it.
From the point of view of a script, there is only one window, so the event target is the outer window's (which forwards to the current inner window), and we already have tests for it.
There's other places that use the inner window though, which makes it inconsistent with this, so it solves that problem. I also have other patches later that will get it in line with this, and it's also cleaner, IMO. We also don't have to deal with the potential NULL outer window everywhere (which I suspect isn't even correct, we don't have tests for it, so I guess it was added just to prevent implementation detail crashes? pretty sure native would just return outer window ref in the first place).
Anyway the point I'm trying to say is that the inner window shouldn't, in practice, be "available" as a reference, so if we hold it anywhere (like we do internally), it *must* act like it's on the outer window. This patch does that. Scripts will need to obtain ref to the outer window at some point, but like I said those patches will come later.
So in this case it wouldn't make a difference and this patch is just a simplification + consistency with implementation details, so we can continue using inner window internally without issue.