fix($sce): do not assume $document[0] exists

this is important to that people can mock $window without having to add stuff that angular uses internally into it

Closes #9661