Web Replay: Playback position updates should be sent before the next event loop input is dispatched
https://bugs.webkit.org/show_bug.cgi?id=137162

Reviewed by Timothy Hatcher.

Source/WebCore:

To drive playback position updates in the Inspector UI, we send playbackHitPosition protocol
messages as the replay backend dispatches inputs. However, right now the semantics of that
message are muddy. The update is sent *after* the input at the offset is dispatched. This leads
to unexpected results if the debugger pauses while the input is being dispatched: the frontend
will only know about the previous (stale) playback position when the debugger pauses.

With this patch, the backend sends the playbackHitPosition(segmentOffset=n, inputOffset=m)
message when backend is about to dispatch input m, but has not yet begun to do so. Thus, any
subsequent page execution events (profiling, debugger pauses, etc) until the next
playbackHitPosition are caused by input m's being dispatched.

* inspector/protocol/Replay.json: Clarify the message's semantics.
* replay/ReplayController.cpp:
(WebCore::ReplayController::willDispatchInput):
(WebCore::ReplayController::didDispatchInput):

Source/WebInspectorUI:

Pausing playback from the UI was broken because of a typo. Fix this, and rename
stopPlayback to cancelPlayback.

* UserInterface/Controllers/ReplayManager.js:
(WebInspector.ReplayManager.prototype.switchSession.if):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@174037 268f45cc-cd09-0410-ab3c-d52691b4dbfc