I have a robin that has done the same thing for years now. It does it at the car window too. I heard or read somewhere it's just a bird defending it's territory. It thinks it sees a rival in the window. My young cat does it sometimes too. So I tend to believe the rival theory.