Bug 877164 - Crash if document init fails. r=smaug, a=lsblakk