Bug 1026310, use proper check for popup visibility, r=MattN