On Wed Dec 7 21:51:47 2022 +0000, Jacek Caban wrote:
I meant something like cycle collector participant. Note that only one per object type is needed, not one per object instance. In practice, when annotating a reference, when we know the type of referenced thing, we may pass that information to CC/GC. It doesn't even need to be accessible from object itself (although it could be convenient and having IUnknown for scope chain doesn't sound too bad).
Since we take care of not holding cyclic refs already in mshtml
builtins (non-JS objects) We have some cycles, that's how nsIDOMNode <-> HTMLNode works, for example. We depend on cycle collector to handle it.
What I mean is, we can't mix a mshtml object's refs with jscript one
to create cyclic refs between them Of course we can, here is an example:
var div = document.createElement("div"), div2 = document.createElement("div"); div.appendChild(div2); div2.prop = { d: div };
The whole point of integrating it is to handle such cases. We already have CC integration, so something like following example will be collected (and potentially broken by your proxies; I didn't look at recent version, but I recall pointing it out in the very early version of your patches):
var div = document.createElement("div"), div2 = document.createElement("div"); div.appendChild(div2); div2.prop = div;
But to fix the first example, GC/CC needs to be able to handle all kinds of objects: JS, MSHTML and Gecko.
I see, thanks for the example, that gives me some stuff to think about. It's not really broken right now with my proxy patches, it just won't ever be collected by the jscript GC so it will leak, because all refs to the mshtml obj block the GC from collecting it, except the `jsdisp`'s.