It seems checking against null works, but is it a correct method? How can I correctly check that object is not dead? And where is the definition of dead object?
null
This is likely due to holding zombie compartments. If you are storing a window in a variable you should use weak reference, otherwise it will keep the process alive.
window
Great read right here:
https://developer.mozilla.org/en-US/docs/Zombie_compartments
This is how to use weak references: https://developer.mozilla.org/en-US/docs/Components.utils.getWeakReference
A dead object, is holding a strong (keep alive) reference to a DOM element (usually) that persists even after it was destroyed in the DOM.
Sometimes checking if it is undefined or null does not work, a trick I saw once and use sometimes is to check if parentNode exists (so not null or undefined).
1.4m articles
1.4m replys
5 comments
57.0k users