On Wed Feb 26 22:09:23 2025 +0000, Jacek Caban wrote:
But on top of that I had to add code to deal with this migration and
to move it from one context to another (on jscript side), while unlinking all the props, which basically reset the jsdisp while keeping its memory address. I think I'll have to do something similar now. That sounds ugly, I hope we can avoid that. If it's just about the comparison, there are things like `IObjectIdentity`, I'm not sure without a closer look.
Sorry for the delay, I had an emergency to take care of today.
`IObjectIdentity` isn't going to work, the problem itself isn't that we get a different jsdisp by itself. `disp_cmp` already checks for the host object, in this particular case GetOuterDispatch results in the outer window.
The problem is that the old iframe's inner window is detached on navigation. Thus, GetOuterDispatch will return the inner window's disp instead of the outer window, so it will mismatch. This isn't a problem if we "migrate" the jsdisp though, but that's not pretty as you said.
I remember I had a patch awhile ago to deal with this issue (and add tests to confirm it) by storing strong (cyclic) ref between inner and outer windows, maybe I need to revive it. But that one was also "not very pretty" and I had to drop it.
At this point I don't know what to do anymore with this particular problem, it keeps popping up and I can't find a "clean" solution. Maybe I'm missing something, but should I revive the outer window<->inner window cyclic ref patch again?
Anyway I think that patch is better (in functionality/correctness) than the jsdisp migration, and since both aren't pretty I guess it's a better contender.