summaryrefslogtreecommitdiffstats
path: root/devtools/client/debugger/src/utils/selected-location.js
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--devtools/client/debugger/src/utils/selected-location.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/devtools/client/debugger/src/utils/selected-location.js b/devtools/client/debugger/src/utils/selected-location.js
new file mode 100644
index 0000000000..c590f6e8ed
--- /dev/null
+++ b/devtools/client/debugger/src/utils/selected-location.js
@@ -0,0 +1,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;
+}