jQuery.fx.tick insufficiently guards against timer queue manipulation
Description
jQuery.fx.tick executes each queued timer in turn, maintaining its place when it removes a finished animation. However, .stop and .finish can also remove timers from the queue, and when invoked while tick is iterating (i.e., from animation callbacks) can cause it to lose its place, skipping over one or more animations. This is often harmless (since the animation is revisited in the next tick), but can introduce visible stutter or (in a pathological case that I didn't bother demonstrating) starve an animation outright.
Additionally, because tick iterates to the end of the queue, new animations get processed twice in their first tick.
We should fix both by making the three functions more aware of and cooperative with each other.
Link to test cases
Source: jquery/jquery