If GC-allocated object wants to own a function it should use HeapFunction because using SafeFunction will almost always lead to a leak.
Some HTML elements, e.g. HTMLMediaElement, need to take action when the document becomes inactive.