prevent dereferencing undefined & unregister dangling callback

when a frame src changes, and goes from a document with spiritual to
a document without spiritual in scope, there are dangling callbacks
performed on a context that was not spiritualized