From 6e8b9aea44f98afd54b8a7dbd1fa810a1bed43d6 Mon Sep 17 00:00:00 2001 From: David Walsh Date: Tue, 16 Jul 2019 13:22:32 +0000 Subject: [PATCH] Bug 1564243 - Don't show map scopes for pretty sources r=jlast Differential Revision: https://phabricator.services.mozilla.com/D38113 --HG-- extra : moz-landing-system : lando --- .../src/components/SecondaryPanes/index.js | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/devtools/client/debugger/src/components/SecondaryPanes/index.js b/devtools/client/debugger/src/components/SecondaryPanes/index.js index 2989c54162fc..ff93d1b51565 100644 --- a/devtools/client/debugger/src/components/SecondaryPanes/index.js +++ b/devtools/client/debugger/src/components/SecondaryPanes/index.js @@ -24,6 +24,7 @@ import { getWorkers, getCurrentThread, getThreadContext, + getSourceFromId, } from "../../selectors"; import AccessibleImage from "../shared/AccessibleImage"; @@ -45,7 +46,13 @@ import Scopes from "./Scopes"; import "./SecondaryPanes.css"; -import type { Expression, Frame, WorkerList, ThreadContext } from "../../types"; +import type { + Expression, + Frame, + WorkerList, + ThreadContext, + Source, +} from "../../types"; type AccordionPaneItem = { header: string, @@ -88,6 +95,7 @@ type Props = { shouldPauseOnExceptions: boolean, shouldPauseOnCaughtExceptions: boolean, workers: WorkerList, + source: ?Source, toggleShortcutsModal: () => void, toggleAllBreakpoints: typeof actions.toggleAllBreakpoints, toggleMapScopes: typeof actions.toggleMapScopes, @@ -228,9 +236,13 @@ class SecondaryPanes extends Component { } getScopesButtons() { - const { selectedFrame, mapScopesEnabled } = this.props; + const { selectedFrame, mapScopesEnabled, source } = this.props; - if (!selectedFrame || isGeneratedId(selectedFrame.location.sourceId)) { + if ( + !selectedFrame || + isGeneratedId(selectedFrame.location.sourceId) || + (source && source.isPrettyPrinted) + ) { return null; } @@ -487,6 +499,7 @@ function getRenderWhyPauseDelay(state, thread) { const mapStateToProps = state => { const thread = getCurrentThread(state); + const selectedFrame = getSelectedFrame(state, thread); return { cx: getThreadContext(state), @@ -496,11 +509,13 @@ const mapStateToProps = state => { breakpointsDisabled: getBreakpointsDisabled(state), isWaitingOnBreak: getIsWaitingOnBreak(state, thread), renderWhyPauseDelay: getRenderWhyPauseDelay(state, thread), - selectedFrame: getSelectedFrame(state, thread), + selectedFrame, mapScopesEnabled: isMapScopesEnabled(state), shouldPauseOnExceptions: getShouldPauseOnExceptions(state), shouldPauseOnCaughtExceptions: getShouldPauseOnCaughtExceptions(state), workers: getWorkers(state), + source: + selectedFrame && getSourceFromId(state, selectedFrame.location.sourceId), }; };