From c433060f2042dba84a53930b59f8f8dd9b018ac5 Mon Sep 17 00:00:00 2001 From: Cosmin Sabou Date: Mon, 15 Apr 2019 20:46:25 +0300 Subject: [PATCH] Backed out changeset f057b78337e7 (bug 1544436) for debugger failures on addToTree.js CLOSED TREE --- devtools/client/debugger/src/actions/pause/paused.js | 6 ++++++ .../client/debugger/src/utils/sources-tree/addToTree.js | 3 ++- .../client/debugger/src/utils/sources-tree/createTree.js | 7 ++++--- .../src/utils/sources-tree/tests/addToTree.spec.js | 1 - .../client/debugger/src/utils/sources-tree/updateTree.js | 3 ++- 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/devtools/client/debugger/src/actions/pause/paused.js b/devtools/client/debugger/src/actions/pause/paused.js index 54e454039dda..04e31c1349d1 100644 --- a/devtools/client/debugger/src/actions/pause/paused.js +++ b/devtools/client/debugger/src/actions/pause/paused.js @@ -7,6 +7,7 @@ import { getHiddenBreakpoint, isEvaluatingExpression, getSelectedFrame, + wasStepping, getThreadContext } from "../../selectors"; @@ -14,6 +15,7 @@ import { mapFrames } from "."; import { removeBreakpoint } from "../breakpoints"; import { evaluateExpressions } from "../expressions"; import { selectLocation } from "../sources"; +import { togglePaneCollapse } from "../ui"; import assert from "../../utils/assert"; import { fetchScopes } from "./fetchScopes"; @@ -58,6 +60,10 @@ export function paused(pauseInfo: Pause) { await dispatch(selectLocation(cx, selectedFrame.location)); } + if (!wasStepping(getState(), thread)) { + dispatch(togglePaneCollapse("end", false)); + } + await dispatch(fetchScopes(cx)); // Run after fetching scoping data so that it may make use of the sourcemap diff --git a/devtools/client/debugger/src/utils/sources-tree/addToTree.js b/devtools/client/debugger/src/utils/sources-tree/addToTree.js index 81bc88193032..4692de6875ad 100644 --- a/devtools/client/debugger/src/utils/sources-tree/addToTree.js +++ b/devtools/client/debugger/src/utils/sources-tree/addToTree.js @@ -157,7 +157,8 @@ function addSourceToNode( export function addToTree( tree: TreeDirectory, source: Source, - debuggeeHost: ?string + debuggeeHost: ?string, + projectRoot: string ) { const url = getURL(source, debuggeeHost); diff --git a/devtools/client/debugger/src/utils/sources-tree/createTree.js b/devtools/client/debugger/src/utils/sources-tree/createTree.js index 7eed7b6cdf1f..687bf023d2f5 100644 --- a/devtools/client/debugger/src/utils/sources-tree/createTree.js +++ b/devtools/client/debugger/src/utils/sources-tree/createTree.js @@ -14,16 +14,17 @@ import type { TreeDirectory } from "./types"; type Params = { sources: SourcesMap, - debuggeeUrl: string + debuggeeUrl: string, + projectRoot: string }; -export function createTree({ sources, debuggeeUrl }: Params) { +export function createTree({ sources, debuggeeUrl, projectRoot }: Params) { const uncollapsedTree = createDirectoryNode("root", "", []); const debuggeeHost = getDomain(debuggeeUrl); for (const sourceId in sources) { const source = sources[sourceId]; - addToTree(uncollapsedTree, source, debuggeeHost); + addToTree(uncollapsedTree, source, debuggeeHost, projectRoot); } const sourceTree = collapseTree((uncollapsedTree: TreeDirectory)); diff --git a/devtools/client/debugger/src/utils/sources-tree/tests/addToTree.spec.js b/devtools/client/debugger/src/utils/sources-tree/tests/addToTree.spec.js index 39668315f7f5..52cc76491a07 100644 --- a/devtools/client/debugger/src/utils/sources-tree/tests/addToTree.spec.js +++ b/devtools/client/debugger/src/utils/sources-tree/tests/addToTree.spec.js @@ -106,7 +106,6 @@ describe("sources-tree", () => { const tree = createDirectoryNode("root", "", []); addToTree(tree, source1, "http://example.com/", ""); - console.log(formatTree(tree)); expect(formatTree(tree)).toMatchSnapshot(); }); diff --git a/devtools/client/debugger/src/utils/sources-tree/updateTree.js b/devtools/client/debugger/src/utils/sources-tree/updateTree.js index fa7760b4a043..3c512c793f18 100644 --- a/devtools/client/debugger/src/utils/sources-tree/updateTree.js +++ b/devtools/client/debugger/src/utils/sources-tree/updateTree.js @@ -34,6 +34,7 @@ export function updateTree({ newSources, prevSources, debuggeeUrl, + projectRoot, uncollapsedTree, sourceTree }: Params) { @@ -41,7 +42,7 @@ export function updateTree({ const debuggeeHost = getDomain(debuggeeUrl); for (const source of newSet) { - addToTree(uncollapsedTree, source, debuggeeHost); + addToTree(uncollapsedTree, source, debuggeeHost, projectRoot); } const newSourceTree = collapseTree(uncollapsedTree);