Bug 1576318 Part 4 - Add testing method to get the debugger requests and associated stacks for the current pause, r=loganfsmyth.

Depends on D43320

Differential Revision: https://phabricator.services.mozilla.com/D43321

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Brian Hackett 2019-08-30 17:10:57 +00:00
Родитель f8e6ccaf6b
Коммит ad74710129
4 изменённых файлов: 29 добавлений и 3 удалений

Просмотреть файл

@ -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;
}
}

Просмотреть файл

@ -120,6 +120,10 @@ ReplayDebugger.prototype = {
return this._control.cachedPoints();
},
replayDebuggerRequests() {
return this._control.debuggerRequests();
},
addDebuggee() {},
removeAllDebuggees() {},

Просмотреть файл

@ -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, {

Просмотреть файл

@ -154,6 +154,13 @@ const threadSpec = generateActorSpec({
ignoreCaughtExceptions: Arg(1, "string"),
},
},
// For testing.
debuggerRequests: {
response: {
value: RetVal("array:json"),
},
},
},
});