Bug 1641731 - Prefer pausing in original locations. r=davidwalsh
authorJason Laster <jlaster@mozilla.com>
Fri, 29 May 2020 15:23:30 +0000
changeset 533019 4f075f06004d2ae96f22413fd051e9feadd63bea
parent 533018 4a2c49e70cc10a55d840016dcf39b8262e40a125
child 533020 b6d02786fcdc9ee79f126318433473195c05d083
push id37461
push userccoroiu@mozilla.com
push dateFri, 29 May 2020 21:46:31 +0000
treeherdermozilla-central@a58cc68b0c51 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdavidwalsh
bugs1641731
milestone78.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1641731 - Prefer pausing in original locations. r=davidwalsh Differential Revision: https://phabricator.services.mozilla.com/D77158
devtools/client/debugger/src/actions/pause/paused.js
devtools/client/debugger/test/mochitest/browser_dbg-sourcemaps.js
devtools/client/debugger/test/mochitest/browser_dbg-stepping.js
devtools/client/debugger/test/mochitest/helpers.js
--- a/devtools/client/debugger/src/actions/pause/paused.js
+++ b/devtools/client/debugger/src/actions/pause/paused.js
@@ -9,17 +9,17 @@ import {
   getSelectedFrame,
   getThreadContext,
   getIsPaused,
 } from "../../selectors";
 
 import { mapFrames, fetchFrames } from ".";
 import { removeBreakpoint } from "../breakpoints";
 import { evaluateExpressions } from "../expressions";
-import { selectLocation } from "../sources";
+import { selectSpecificLocation } from "../sources";
 import assert from "../../utils/assert";
 
 import { fetchScopes } from "./fetchScopes";
 
 import type { Pause } from "../../types";
 import type { ThunkArgs } from "../types";
 
 /**
@@ -50,17 +50,17 @@ export function paused(pauseInfo: Pause)
     if (hiddenBreakpoint) {
       dispatch(removeBreakpoint(cx, hiddenBreakpoint));
     }
 
     await dispatch(mapFrames(cx));
 
     const selectedFrame = getSelectedFrame(getState(), thread);
     if (selectedFrame) {
-      await dispatch(selectLocation(cx, selectedFrame.location));
+      await dispatch(selectSpecificLocation(cx, selectedFrame.location));
     }
 
     await dispatch(fetchScopes(cx));
 
     // Run after fetching scoping data so that it may make use of the sourcemap
     // expression mappings for local variables.
     const atException = why.type == "exception";
     if (!atException || !isEvaluatingExpression(getState(), thread)) {
--- a/devtools/client/debugger/test/mochitest/browser_dbg-sourcemaps.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-sourcemaps.js
@@ -12,17 +12,17 @@ add_task(async function() {
     "doc-sourcemaps.html",
     "entry.js",
     "output.js",
     "times2.js",
     "opts.js"
   );
   const {
     selectors: { getBreakpointCount },
-    getState
+    getState,
   } = dbg;
 
   ok(true, "Original sources exist");
   const bundleSrc = findSource(dbg, "bundle.js");
 
   // Check that the original sources appear in the source tree
   await clickElement(dbg, "sourceDirectoryLabel", 4);
   await assertSourceCount(dbg, 9);
@@ -57,28 +57,29 @@ add_task(async function() {
   assertPausedLocation(dbg);
 
   await stepIn(dbg);
   assertPausedLocation(dbg);
 
   await dbg.actions.jumpToMappedSelectedLocation(getContext(dbg));
   await stepOver(dbg);
   assertPausedLocation(dbg);
-  assertDebugLine(dbg, 71);
+  assertDebugLine(dbg, 3);
 
   await dbg.actions.jumpToMappedSelectedLocation(getContext(dbg));
   await stepOut(dbg);
   assertPausedLocation(dbg);
+
   assertDebugLine(dbg, 16);
 });
 
 function assertBreakpointExists(dbg, source, line) {
   const {
     selectors: { getBreakpoint },
-    getState
+    getState,
   } = dbg;
 
   ok(
     getBreakpoint({ sourceId: source.id, line }),
     "Breakpoint has correct line"
   );
 }
 
@@ -102,12 +103,12 @@ async function getLineEl(dbg, line) {
 async function clickGutter(dbg, line) {
   const el = await codeMirrorGutterElement(dbg, line);
   clickDOMElement(dbg, el);
 }
 
 async function waitForBreakpointCount(dbg, count) {
   const {
     selectors: { getBreakpointCount },
-    getState
+    getState,
   } = dbg;
   await waitForState(dbg, state => getBreakpointCount() == count);
 }
--- a/devtools/client/debugger/test/mochitest/browser_dbg-stepping.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-stepping.js
@@ -20,11 +20,11 @@ add_task(async function test() {
   await stepIn(dbg);
   await stepIn(dbg);
   await stepIn(dbg);
   await stepIn(dbg);
   await stepIn(dbg);
   await stepIn(dbg);
   await stepIn(dbg);
 
-  assertDebugLine(dbg, 42271);
+  assertDebugLine(dbg, 7679);
   assertPausedLocation(dbg);
 });
--- a/devtools/client/debugger/test/mochitest/helpers.js
+++ b/devtools/client/debugger/test/mochitest/helpers.js
@@ -357,18 +357,18 @@ function assertDebugLine(dbg, line, colu
 
   if (!lineInfo.wrapClass) {
     const pauseLine = getVisibleSelectedFrameLine(dbg);
     ok(false, `Expected pause line on line ${line}, it is on ${pauseLine}`);
     return;
   }
 
   ok(
-    lineInfo.wrapClass.includes("new-debug-line"),
-    "Line is highlighted as paused"
+    lineInfo?.wrapClass.includes("new-debug-line"),
+    `Line ${line} is not highlighted as paused`
   );
 
   const debugLine =
     findElement(dbg, "debugLine") || findElement(dbg, "debugErrorLine");
 
   is(
     findAllElements(dbg, "debugLine").length +
       findAllElements(dbg, "debugErrorLine").length,