In FF 11 at least, the same event can be triggered twice in close succession (e.g. ended), so be careful in any handler code.
External references: