on master help sign in
fixed restart-snapshot bug
commit0d1c2ab5e3738d9f7171e8722adb037cbce7d40a authorMichael James <michael@michaelbjames.com> dateThu 7 Aug 2014, 13:49 (12 years ago) parente7dce9e
1 file changed+12−11
runtime/Debugger.js+12−11
runtime/Debugger.js+12−11
@@ -175,22 +175,23 @@ function debugModule(module, runtime) {
175175 var pauseDelay = Date.now() - pauseTime;
176176 runtime.timer.addDelay(pauseDelay);
177177 programPaused = false;
178− if (position > 0) {
179− // If we're not unpausing at the head, then we need to dump the
180− // events that are ahead of where we're continuing.
181− var lastSnapshotPosition = Math.floor(position / EVENTS_PER_SAVE);
182− eventsUntilSnapshot = EVENTS_PER_SAVE - (position % EVENTS_PER_SAVE);
183− snapshots = snapshots.slice(0, lastSnapshotPosition + 1);
184178
179+ // we need to dump the events that are ahead of where we're continuing.
180+ var lastSnapshotPosition = Math.floor(position / EVENTS_PER_SAVE);
181+ eventsUntilSnapshot = EVENTS_PER_SAVE - (position % EVENTS_PER_SAVE);
182+ snapshots = snapshots.slice(0, lastSnapshotPosition + 1);
183+
184+ if (position > 0) {
185185 var lastEventTime = recordedEvents[position-1].timestep;
186186 var scrubTime = runtime.timer.now() - lastEventTime;
187187 runtime.timer.addDelay(scrubTime);
188−
189− recordedEvents = recordedEvents.slice(0, position);
190− tracePath.clearTracesAfter(position);
191− runtime.debuggerStatus.eventCounter = position;
192− executeCallbacks(asyncCallbacks, false);
193188 }
189+
190+ recordedEvents = recordedEvents.slice(0, position);
191+ tracePath.clearTracesAfter(position);
192+ runtime.debuggerStatus.eventCounter = position;
193+ executeCallbacks(asyncCallbacks, false);
194+
194195 tracePath.startRecording();
195196 }
196197