Bug 962299 - Follow-up: safety improvements and fixes. r=bustage