summaryrefslogtreecommitdiffstats
path: root/devtools/client/debugger/src/utils/selected-location.js
blob: c590f6e8ed79c8a7b0f2924e381671e53500ff7d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */

import { isOriginalId } from "devtools/client/shared/source-map-loader/index";

export function getSelectedLocation(mappedLocation, context) {
  if (!context) {
    return mappedLocation.location;
  }

  const sourceId = context.sourceId || context.id;
  return isOriginalId(sourceId)
    ? mappedLocation.location
    : mappedLocation.generatedLocation;
}