Did you look at integrating it with the rest of MSHTML? While we will need a standalone GC implementation for regular ActiveScript hosts, MSHTML will ultimately need something better to handle cycles that involve MSHTML or even Gecko objects. While we may initially have JS-only GC, it's fine to not implement the whole thing right away, it would be good to have understanding of further work to make sure that this goes in the right direction.
We already have some integration with Gecko cycle collector in MSHTML and we will probably need to extend it somehow to handle JS objects. It currently requires all reference counting to use `nsCycleCollectingAutoRefCnt`, so it's not very practical for JS. Gecko has some dedicated handling for its own JS objects in CC, but it's obviously not very useful for jscript.
For artificial testing, one could use something like:
It would be more interesting to have proper tests. You may, for example, add an external object that uses `CHECK_EXPECT()` in its destructor, add that object as a property of an interesting JS object and then check it with `CHECK_CALLED()`. I'd expect GC to trigger when script context is released, but there is also global JS function `CollectGarbage()` that could be used to trigger it. On related note, the initial implementation could trigger only inside `CollectGarbage()` and periodic run could be added in a separated patch.