From 9c7cf7138d48369afdab072879f896ab962a3cf5 Mon Sep 17 00:00:00 2001 From: Brian Hackett Date: Fri, 16 Aug 2019 20:55:19 +0000 Subject: [PATCH] Bug 1573966 - Fix variable previewing when using cached pause data, r=loganfsmyth. Differential Revision: https://phabricator.services.mozilla.com/D42067 --HG-- extra : moz-landing-system : lando --- .../mochitest/browser_dbg_rr_stepping-02.js | 10 ++++++++++ devtools/server/actors/replay/control.js | 7 +++---- devtools/server/actors/replay/debugger.js | 14 +++++++++----- devtools/server/actors/replay/replay.js | 2 ++ 4 files changed, 24 insertions(+), 9 deletions(-) diff --git a/devtools/client/webreplay/mochitest/browser_dbg_rr_stepping-02.js b/devtools/client/webreplay/mochitest/browser_dbg_rr_stepping-02.js index ee9705402c9c..6ed0a3bd7f45 100644 --- a/devtools/client/webreplay/mochitest/browser_dbg_rr_stepping-02.js +++ b/devtools/client/webreplay/mochitest/browser_dbg_rr_stepping-02.js @@ -23,6 +23,16 @@ add_task(async function() { await stepInToLine(threadFront, 30); await stepOverToLine(threadFront, 31); await stepOverToLine(threadFront, 32); + + // Check that the scopes pane shows the value of the local variable. + await waitForPaused(dbg); + for (let i = 1; ; i++) { + if (getScopeLabel(dbg, i) == "c") { + is("NaN", getScopeValue(dbg, i)); + break; + } + } + await stepOverToLine(threadFront, 33); await reverseStepOverToLine(threadFront, 32); await stepOutToLine(threadFront, 27); diff --git a/devtools/server/actors/replay/control.js b/devtools/server/actors/replay/control.js index 8b2aeae51a5c..233770e1efbc 100644 --- a/devtools/server/actors/replay/control.js +++ b/devtools/server/actors/replay/control.js @@ -1097,13 +1097,12 @@ function waitUntilPauseFinishes() { return; } - while (true) { + while (gPauseMode != PauseModes.PAUSED) { gActiveChild.waitUntilPaused(); - if (pointEquals(gActiveChild.pausePoint(), gPausePoint)) { - return; - } pokeChild(gActiveChild); } + + gActiveChild.waitUntilPaused(); } // Synchronously send a child to the specific point and pause. diff --git a/devtools/server/actors/replay/debugger.js b/devtools/server/actors/replay/debugger.js index 558db91d933b..b6d35ea38570 100644 --- a/devtools/server/actors/replay/debugger.js +++ b/devtools/server/actors/replay/debugger.js @@ -408,7 +408,7 @@ ReplayDebugger.prototype = { if (!this._objects[data.id]) { this._addObject(data); } - this._getObject(data.id)._names = names; + this._getObject(data.id)._setNames(names); } for (const frame of pauseData.frames) { @@ -1297,6 +1297,13 @@ ReplayDebuggerEnvironment.prototype = { return this._data.optimizedOut; }, + _setNames(names) { + this._names = {}; + names.forEach(({ name, value }) => { + this._names[name] = this._dbg._convertValue(value); + }); + }, + _ensureNames() { if (!this._names) { const names = this._dbg._sendRequestAllowDiverge( @@ -1306,10 +1313,7 @@ ReplayDebuggerEnvironment.prototype = { }, [] ); - this._names = {}; - names.forEach(({ name, value }) => { - this._names[name] = this._dbg._convertValue(value); - }); + this._setNames(names); } }, diff --git a/devtools/server/actors/replay/replay.js b/devtools/server/actors/replay/replay.js index edab8a67b7e1..e589e0f52f85 100644 --- a/devtools/server/actors/replay/replay.js +++ b/devtools/server/actors/replay/replay.js @@ -1471,6 +1471,8 @@ function getPauseData() { const names = getEnvironmentNames(env); rv.environments[id] = { data, names }; + names.forEach(({ value }) => addValue(value, true)); + addObject(data.callee); addEnvironment(data.parent); }