elm-lang/Elm — pull request #713 by michaelbjames (2014-07-29 09:29:47+00:00)
Title: bugfix: occasionaly restart would fail from an eventCounter mismatch

I noticed a bug in https://github.com/elm-lang/Elm/pull/712 where restart wouldn't work the first time it was called. It would work the second time, though. Mario would go back to his starting position but the FPS timers weren't firing. The assert:
```
assert(tracePositions[id].length === eventCounter,
"We don't have a 1-1 mapping of trace positions to events");
```
was not true, off-by-one.

By pausing before restarting we prevent events from going halfway through the pipeline and screwing with this assert, and code that follows. It also makes sense that before restarting we should pause. When we click restart, we don't care about any more events flowing through the program. We should stop them from mutating the debugger state by pausing.