@@ -87,7 +87,8 @@ function debugModule(module, runtime) {
8787 tracePath.stopRecording();
8888 }
8989 else {
90− executeCallbacks(asyncCallbacks);
90+ // executeCallbacks should only be called when continuing, not when restarting.
91+ //executeCallbacks(asyncCallbacks, false);
9192 tracePath.startRecording();
9293 }
9394 }
@@ -142,8 +143,10 @@ function debuggerInit(debugModule, runtime) {
142143
143144 function restartProgram() {
144145 resetProgram();
146+ debugModule.tracePath.clearTraces();
145147 debugModule.clearRecordedEvents();
146− executeCallbacks(debugModule.initialAsyncCallbacks);
148+ debugModule.setPaused(false);
149+ executeCallbacks(debugModule.initialAsyncCallbacks, true);
147150 }
148151
149152 function pauseProgram() {
@@ -328,9 +331,9 @@ function tracePathInit(runtime) {
328331}
329332
330333
331−function executeCallbacks(callbacks) {
334+function executeCallbacks(callbacks, reexecute) {
332335 callbacks.forEach(function(timer) {
333− if (!timer.executed) {
336+ if (reexecute || !timer.executed) {
334337 var func = timer.func;
335338 func();
336339 }