tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 2aeb9fe5a0e8a22608123381aee8c7be798ad17c
parent a69ab4fc578f5ad2c6d24bc55da1d08e6d41542e
Author: Alexandre Poirot <poirot.alex@gmail.com>
Date:   Mon,  6 Oct 2025 12:40:32 +0000

Bug 1917012 - [devtools] Remove now-unecessary selectMayBePrettyPrintedLocation intermediate action. r=devtools-reviewers,bomsy

We can now call the common source selection action as everything about pretty printed source
is now managed into selectLocation's `mayBeSelectMappedSource` helper.

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

Diffstat:
Mdevtools/client/debugger/src/actions/sources/select.js | 23-----------------------
Mdevtools/client/debugger/src/components/PrimaryPanes/SourcesTree.js | 15++++++---------
2 files changed, 6 insertions(+), 32 deletions(-)

diff --git a/devtools/client/debugger/src/actions/sources/select.js b/devtools/client/debugger/src/actions/sources/select.js @@ -90,29 +90,6 @@ export function selectSourceURL(url, options) { } /** - * Function dedicated to the Source Tree. - * - * This would automatically select the pretty printed source - * if one exists for the passed source. - * - * We aren't relying on selectLocation's mayBeSelectMappedSource logic - * as the (0,0) location (line 0, column 0) may not be mapped - * and wouldn't be resolved to the pretty printed source. - */ -export function selectMayBePrettyPrintedLocation(location) { - return async ({ dispatch, getState }) => { - const sourceIsPrettyPrinted = isPrettyPrinted(getState(), location.source); - if (sourceIsPrettyPrinted) { - const prettySource = getPrettySource(getState(), location.source.id); - if (prettySource) { - location = createLocation({ source: prettySource }); - } - } - await dispatch(selectSpecificLocation(location)); - }; -} - -/** * Wrapper around selectLocation, which creates the location object for us. * Note that it ignores the currently selected source and will select * the precise generated/original source passed as argument. diff --git a/devtools/client/debugger/src/components/PrimaryPanes/SourcesTree.js b/devtools/client/debugger/src/components/PrimaryPanes/SourcesTree.js @@ -19,7 +19,6 @@ const MenuButton = require("resource://devtools/client/shared/components/menu/Me const MenuItem = require("resource://devtools/client/shared/components/menu/MenuItem.js"); const MenuList = require("resource://devtools/client/shared/components/menu/MenuList.js"); import { prefs } from "../../utils/prefs"; -import { createLocation } from "../../utils/location"; // Selectors import { @@ -69,7 +68,7 @@ class SourcesTree extends Component { focusItem: PropTypes.func.isRequired, focused: PropTypes.object, projectRoot: PropTypes.string.isRequired, - selectMayBePrettyPrintedLocation: PropTypes.func.isRequired, + selectSource: PropTypes.func.isRequired, setExpandedState: PropTypes.func.isRequired, rootItems: PropTypes.array.isRequired, clearProjectDirectoryRoot: PropTypes.func.isRequired, @@ -107,12 +106,10 @@ class SourcesTree extends Component { } selectSourceItem = item => { - // Use a dedicated selection method to handle edgecases around pretty printed sources - // When a source is pretty printed, the `item.source` still refers to the minified source, - // whereas we expect to open the pretty printed version (if it exists). - this.props.selectMayBePrettyPrintedLocation( - createLocation({ source: item.source, sourceActor: item.sourceActor }) - ); + // Note that when the source is pretty printed, `item.source` still refers to the minified source. + // `mayBeSelectMappedSource` function within selectSource/selectLocation action will handle this edgecase + // and ensure selecting the pretty printed source, if relevant. + this.props.selectSource(item.source, item.sourceActor); }; onFocus = item => { @@ -447,7 +444,7 @@ const mapStateToProps = state => { }; export default connect(mapStateToProps, { - selectMayBePrettyPrintedLocation: actions.selectMayBePrettyPrintedLocation, + selectSource: actions.selectSource, setExpandedState: actions.setExpandedState, focusItem: actions.focusItem, clearProjectDirectoryRoot: actions.clearProjectDirectoryRoot,