object: Fully use GjsMaybeOwned wrapper
Previously, when not needing to keep a JS wrapper object alive, we would unroot it from the GjsMaybeOwned that is part of its private struct, and instead move it to a JS::Heap wrapper in the GObject's qdata where it was kept as a weak pointer. By adding switch_to_rooted() and switch_to_unrooted() API to GjsMaybeOwned, we can instead use GjsMaybeOwned for both cases. We also need to add an update_after_gc() method in order to store a weak pointer in the GjsMaybeOwned, since we will need to update the pointer's location after every garbage collection in SpiderMonkey 38. Because we still need to get to the object's private struct given the GObject, we can use the object's qdata for that purpose instead. There is one test that must be skipped for the time being: SpiderMonkey 31's garbage collector is not smart enough to collect the object right after switch_to_unrooted(). This test passes in SpiderMonkey 38. https://bugzilla.gnome.org/show_bug.cgi?id=776966
parent
ea43a1c4
Please register or sign in to comment