Bug 878751 - Port a bug fix from Chrome back to Mozilla. r=jlebar a=akeybl