Check and prevent reentrancy to the JSAPI during finalization

Keep track of whether the runtime is currently doing GC sweeping,
and prevent calling JS code at that time. This could happen with
dangling signal connections or widgets/actors that are not properly
destroyed, and causes an assert failure with debug libmozjs (and
a crash otherwise)

https://bugzilla.gnome.org/show_bug.cgi?id=725024