No bug - Add mapped location formatters.
authorJason Laster <jlaster@mozilla.com>
Fri, 08 Mar 2019 15:46:28 +0000
changeset 521167 cd9ef3b60bc3
parent 521166 fc19e9b1f6bb
child 521168 2ccf4b1b18ad
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
No bug - Add mapped location formatters. Differential Revision: https://phabricator.services.mozilla.com/D22721
devtools/client/debugger/new/src/utils/dbg.js
--- a/devtools/client/debugger/new/src/utils/dbg.js
+++ b/devtools/client/debugger/new/src/utils/dbg.js
@@ -41,22 +41,34 @@ function bindSelectors(obj: Object): Obj
   }, {});
 }
 
 function getCM() {
   const cm: any = document.querySelector(".CodeMirror");
   return cm && cm.CodeMirror;
 }
 
-function _formatColumnBreapoints(dbg: Object) {
-  console.log(
-    dbg.selectors.formatColumnBreakpoints(
-      dbg.selectors.visibleColumnBreakpoints()
-    )
+function formatMappedLocation(mappedLocation) {
+  const { location, generatedLocation } = mappedLocation;
+  return {
+    original: `(${location.line}, ${location.column})`,
+    generated: `(${generatedLocation.line}, ${generatedLocation.column})`
+  };
+}
+
+function formatMappedLocations(locations) {
+  return console.table(locations.map(loc => formatMappedLocation(loc)));
+}
+
+function formatSelectedColumnBreakpoints(dbg) {
+  const positions = dbg.selectors.getBreakpointPositionsForSource(
+    dbg.selectors.getSelectedSource().id
   );
+
+  return formatMappedLocations(positions);
 }
 
 export function setupHelper(obj: Object) {
   const selectors = bindSelectors(obj);
   const dbg: Object = {
     ...obj,
     selectors,
     prefs,
@@ -68,17 +80,19 @@ export function setupHelper(obj: Object)
       findSource: url => findSource(dbg, url),
       findSources: url => findSources(dbg, url),
       evaluate: expression => evaluate(dbg, expression),
       sendPacketToThread: packet => sendPacketToThread(dbg, packet),
       sendPacket: packet => sendPacket(dbg, packet),
       dumpThread: () => sendPacketToThread(dbg, { type: "dumpThread" })
     },
     formatters: {
-      visibleColumnBreakpoints: () => _formatColumnBreapoints(dbg)
+      mappedLocations: locations => formatMappedLocations(locations),
+      mappedLocation: location => formatMappedLocation(location),
+      selectedColumnBreakpoints: () => formatSelectedColumnBreakpoints(dbg)
     },
     _telemetry: {
       events: {}
     }
   };
 
   window.dbg = dbg;