This matches the behavior of other browsers. (cherry picked from commit e1eeb93cc6095a47371d23db0bbf55eb30215cee)