On Tue Apr 15 16:17:21 2025 +0000, Gabriel Ivăncescu wrote:
Ugh, while this works, it creates a cyclic ref when XMLHttpRequest is used, which won't even get cleaned up now (it needs the CC integration). I've been thinking of ways how to do avoid it or create it on demand (like for InterpretedFunction's prototype), but I wasn't able to find a solution. Because it's a method, we can't use on-demand getter or on-demand function (especially since it can get stored to a variable and called way later). We also can't convert HostConstructor to pure jsdisp since it's referenced from the mshtml window (so there would be no point, it would still be a cross mshtml-jscript cyclic ref). Storing a direct ref to the window (since we only need the window to construct) is pointless since it's also a cyclic ref (in fact, just having the prop should be?), i.e. window->XMLHttpRequest ctor->create->window. So there's really no way apart from creating it on demand which is not possible because it's a method. I guess I could add a flag or something to hijack the create_builtin_function somehow if that's even worth attempting, but anyway I'll let it for next MR if desirable. Also I couldn't reuse HostConstructor since the function itself doesn't work with `new` operator (added tests) so I added a new function type that's mostly a wrapper.
We don't need to store window reference, we have `get_script_global` now. I hope hope we can avoid a new functiton type.