Bug 1001833 - "TypeError: can't access dead object" due leaks of event/dom module

Shouldn't this be `if (!window)` ?