Porting over some uncommitted hacks, I don't remember what they were
for, although it looks like some chrome thing.