@@ -108,22 +108,21 @@ function debugModule(module, runtime) {
108 recordedEvents = events.slice();
108 recordedEvents = events.slice();
111− function setPausedAt(v, position) {
111+ function setPaused() {
112− programPaused = v;
112+ programPaused = true;
113− if (programPaused) {
114− clearAsyncCallbacks();
113+ clearAsyncCallbacks();
115− tracePath.stopRecording();
114+ tracePath.stopRecording();
118− // executeCallbacks should only be called when continuing, not when restarting.
117+ function setContinue(position) {
118+ programPaused = false;
119− if(position > 0) {
119+ if (position > 0) {
120− // If we're unpausing not at the head, then we need to dump the
120+ // If we're not unpausing at the head, then we need to dump the
121− // events that are ahead of where we're continuing.
121+ // events that are ahead of where we're continuing.
122− recordedEvents = recordedEvents.slice(0,position);
122+ recordedEvents = recordedEvents.slice(0,position);
123− executeCallbacks(asyncCallbacks, false);
123+ executeCallbacks(asyncCallbacks, false);
125− tracePath.startRecording();
125+ tracePath.startRecording();
129 function getPaused() {
128 function getPaused() {
@@ -167,7 +166,8 @@ function debugModule(module, runtime) {
167 copyRecordedEvents: copyRecordedEvents,
166 copyRecordedEvents: copyRecordedEvents,
168 loadRecordedEvents: loadRecordedEvents,
167 loadRecordedEvents: loadRecordedEvents,
169 getPaused: getPaused,
168 getPaused: getPaused,
170− setPausedAt: setPausedAt,
169+ setPaused: setPaused,
170+ setContinue: setContinue,
171 tracePath: tracePath,
171 tracePath: tracePath,
172 watchTracker: watchTracker,
172 watchTracker: watchTracker,
@@ -187,12 +187,12 @@ function debuggerInit(debugModule, runtime, hotSwapState /* =undefined */) {
187 debugModule.watchTracker.clear();
187 debugModule.watchTracker.clear();
188 debugModule.tracePath.clearTraces();
188 debugModule.tracePath.clearTraces();
189 debugModule.clearRecordedEvents();
189 debugModule.clearRecordedEvents();
190− debugModule.setPausedAt(false, 0);
190+ debugModule.setContinue(0);
191 executeCallbacks(debugModule.initialAsyncCallbacks, true);
191 executeCallbacks(debugModule.initialAsyncCallbacks, true);
194 function pauseProgram() {
194 function pauseProgram() {
195− debugModule.setPausedAt(true);
195+ debugModule.setPaused();
196 eventCounter = debugModule.getRecordedEventsLength();
196 eventCounter = debugModule.getRecordedEventsLength();
@@ -209,13 +209,13 @@ function debuggerInit(debugModule, runtime, hotSwapState /* =undefined */) {
209 debugModule.tracePath.clearTraces();
209 debugModule.tracePath.clearTraces();
210 debugModule.tracePath.startRecording();
210 debugModule.tracePath.startRecording();
211 stepTo(index);
211 stepTo(index);
212− debugModule.setPausedAt(false, eventCounter);
212+ debugModule.setContinue(eventCounter);
216 function stepTo(index) {
216 function stepTo(index) {
217 if (!debugModule.getPaused()) {
217 if (!debugModule.getPaused()) {
218− debugModule.setPausedAt(true);
218+ debugModule.setPaused();
219 resetProgram();
219 resetProgram();
@@ -283,8 +283,8 @@ function debuggerInit(debugModule, runtime, hotSwapState /* =undefined */) {
283 // and the new modules are being generated. So we can ask the
283 // and the new modules are being generated. So we can ask the
284 // debugging console what it thinks the pause state is and go
284 // debugging console what it thinks the pause state is and go
285 // from there.
285 // from there.
286− var pauseState = top.debug.paused;
286+ var paused = top.debug.paused;
287− debugModule.setPausedAt(true);
287+ debugModule.setPaused();
288 debugModule.loadRecordedEvents(hotSwapState.recordedEvents);
288 debugModule.loadRecordedEvents(hotSwapState.recordedEvents);
290 // draw new trace path
290 // draw new trace path
@@ -293,7 +293,11 @@ function debuggerInit(debugModule, runtime, hotSwapState /* =undefined */) {
293 debugModule.tracePath.stopRecording();
293 debugModule.tracePath.stopRecording();
295 stepTo(hotSwapState.eventCounter);
295 stepTo(hotSwapState.eventCounter);
297+ debugModule.setPaused();
296− debugModule.setPausedAt(pauseState, hotSwapState.eventCounter);
299+ debugModule.setContinue(hotSwapState.eventCounter);
299 runtime.node.parentNode.appendChild(debugModule.tracePath.canvas);
303 runtime.node.parentNode.appendChild(debugModule.tracePath.canvas);