Check window === null before continuing

Firefox 24 + SDK 1.14 = error