summaryrefslogtreecommitdiffstats
path: root/devtools/client/debugger/src/utils/selected-location.js
diff options
context:
space:
mode:
Diffstat (limited to 'devtools/client/debugger/src/utils/selected-location.js')
-rw-r--r--devtools/client/debugger/src/utils/selected-location.js15
1 files changed, 15 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..628186ff22
--- /dev/null
+++ b/devtools/client/debugger/src/utils/selected-location.js
@@ -0,0 +1,15 @@
+/* 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/>. */
+
+export function getSelectedLocation(mappedLocation, context) {
+ if (!context) {
+ return mappedLocation.location;
+ }
+
+ // `context` may be a location or directly a source object.
+ const source = context.source || context;
+ return source.isOriginal
+ ? mappedLocation.location
+ : mappedLocation.generatedLocation;
+}