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?
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.
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).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With