diff --git a/devtools/server/actors/replay/control.js b/devtools/server/actors/replay/control.js index d3e0740ad952..06309067a107 100644 --- a/devtools/server/actors/replay/control.js +++ b/devtools/server/actors/replay/control.js @@ -1033,6 +1033,13 @@ let gPausePoint = null; // In ARRIVING mode, the requests must be sent once the child arrives. const gDebuggerRequests = []; +function addDebuggerRequest(request) { + gDebuggerRequests.push({ + request, + stack: Error().stack, + }); +} + function setPauseState(mode, point, child) { assert(mode); const idString = child ? ` #${child.id}` : ""; @@ -1077,7 +1084,7 @@ function sendActiveChildToPausePoint() { gActiveChild.sendManifest({ contents: { kind: "batchDebuggerRequest", - requests: gDebuggerRequests, + requests: gDebuggerRequests.map(r => r.request), }, onFinished(finishData) { assert(!finishData || !finishData.restoredCheckpoint); @@ -1823,7 +1830,7 @@ const gControl = { gActiveChild.divergedFromRecording = true; } - gDebuggerRequests.push(request); + addDebuggerRequest(request); return data.response; }, @@ -1860,6 +1867,10 @@ const gControl = { unscannedRegions, cachedPoints, + debuggerRequests() { + return gDebuggerRequests; + }, + getPauseData() { // If the child has not arrived at the pause point yet, see if there is // cached pause data for this point already which we can immediately return. @@ -1868,7 +1879,7 @@ const gControl = { if (data) { // After the child pauses, it will need to generate the pause data so // that any referenced objects will be instantiated. - gDebuggerRequests.push({ type: "pauseData" }); + addDebuggerRequest({ type: "pauseData" }); return data; } } diff --git a/devtools/server/actors/replay/debugger.js b/devtools/server/actors/replay/debugger.js index 9dbda280de73..d0321dc72b49 100644 --- a/devtools/server/actors/replay/debugger.js +++ b/devtools/server/actors/replay/debugger.js @@ -120,6 +120,10 @@ ReplayDebugger.prototype = { return this._control.cachedPoints(); }, + replayDebuggerRequests() { + return this._control.debuggerRequests(); + }, + addDebuggee() {}, removeAllDebuggees() {}, diff --git a/devtools/server/actors/thread.js b/devtools/server/actors/thread.js index 92373850b1a9..cf7af51128a9 100644 --- a/devtools/server/actors/thread.js +++ b/devtools/server/actors/thread.js @@ -2127,6 +2127,10 @@ const ThreadActor = ActorClassWithSpec(threadSpec, { const loc = this.sources.getFrameLocation(frame); dump(`${prefix} (${loc.line}, ${loc.column})\n`); }, + + debuggerRequests() { + return this.dbg.replayDebuggerRequests(); + }, }); Object.assign(ThreadActor.prototype.requestTypes, { diff --git a/devtools/shared/specs/thread.js b/devtools/shared/specs/thread.js index 15fdbce74ffe..36ea041498c9 100644 --- a/devtools/shared/specs/thread.js +++ b/devtools/shared/specs/thread.js @@ -154,6 +154,13 @@ const threadSpec = generateActorSpec({ ignoreCaughtExceptions: Arg(1, "string"), }, }, + + // For testing. + debuggerRequests: { + response: { + value: RetVal("array:json"), + }, + }, }, });