@@ -269,7 +269,11 @@ function debugModule(module, runtime) {
272+// The debuggerHistory variable is passed in on hotswap. It represents
273+// the a state of the debugger for it to assume during init. It contains
274+// the paused state of the debugger, the recorded events, and the current
275+// event being processed.
272−function debuggerInit(debugModule, runtime, hotSwapState /* =undefined */) {
276+function debuggerInit(debugModule, runtime, debuggerHistory /* =undefined */) {
273 var currentEventIndex = 0;
277 var currentEventIndex = 0;
275 function resetProgram(position) {
279 function resetProgram(position) {
@@ -349,6 +353,7 @@ function debuggerInit(debugModule, runtime, hotSwapState /* =undefined */) {
349 continueIndex = getMaxSteps();
353 continueIndex = getMaxSteps();
356+ paused: debugModule.getPaused(),
352 recordedEvents: debugModule.copyRecordedEvents(),
357 recordedEvents: debugModule.copyRecordedEvents(),
353 currentEventIndex: continueIndex
358 currentEventIndex: continueIndex
@@ -360,15 +365,15 @@ function debuggerInit(debugModule, runtime, hotSwapState /* =undefined */) {
360 parentNode.removeChild(runtime.node);
365 parentNode.removeChild(runtime.node);
363− if (hotSwapState) {
368+ if (debuggerHistory) {
364 // The problem is that we want to previous paused state. But
369 // The problem is that we want to previous paused state. But
365 // by the time JS reaches here, the old code has been swapped out
370 // by the time JS reaches here, the old code has been swapped out
366 // and the new modules are being generated. So we can ask the
371 // and the new modules are being generated. So we can ask the
367 // debugging console what it thinks the pause state is and go
372 // debugging console what it thinks the pause state is and go
368 // from there.
373 // from there.
369− var paused = top.debug.paused;
374+ var paused = debuggerHistory.paused;
370 debugModule.setPaused();
375 debugModule.setPaused();
371− debugModule.loadRecordedEvents(hotSwapState.recordedEvents);
376+ debugModule.loadRecordedEvents(debuggerHistory.recordedEvents);
372 var index = getMaxSteps();
377 var index = getMaxSteps();
373 runtime.debuggerStatus.eventCounter = 0;
378 runtime.debuggerStatus.eventCounter = 0;
374 debugModule.tracePath.clearTraces();
379 debugModule.tracePath.clearTraces();
@@ -384,9 +389,9 @@ function debuggerInit(debugModule, runtime, hotSwapState /* =undefined */) {
385 debugModule.tracePath.stopRecording();
390 debugModule.tracePath.stopRecording();
387− stepTo(hotSwapState.currentEventIndex);
392+ stepTo(debuggerHistory.currentEventIndex);
388 if (!paused) {
393 if (!paused) {
389− debugModule.setContinue(hotSwapState.currentEventIndex);
394+ debugModule.setContinue(debuggerHistory.currentEventIndex);