No bug - Sort breakpoints by selected location. r=davidwalsh
authorJason Laster <jlaster@mozilla.com>
Tue, 12 Mar 2019 16:08:47 +0000
changeset 524559 d468fbd73e73a1b6a9ef4a848370ae71407b3b60
parent 524558 648288669490287a12d7c1368d56d2b3c838fde2
child 524560 e2316f37b9882820db8e31203058cbecb004de64
push id2032
push userffxbld-merge
push dateMon, 13 May 2019 09:36:57 +0000
treeherdermozilla-release@455c1065dcbe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdavidwalsh
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 - Sort breakpoints by selected location. r=davidwalsh Differential Revision: https://phabricator.services.mozilla.com/D23140
devtools/client/debugger/new/src/selectors/breakpointSources.js
devtools/client/debugger/new/src/utils/breakpoint/index.js
--- a/devtools/client/debugger/new/src/selectors/breakpointSources.js
+++ b/devtools/client/debugger/new/src/selectors/breakpointSources.js
@@ -8,36 +8,32 @@ import { sortBy, uniq } from "lodash";
 import { createSelector } from "reselect";
 import {
   getSources,
   getBreakpointsList,
   getSelectedSource
 } from "../selectors";
 import { getFilename } from "../utils/source";
 import { getSelectedLocation } from "../utils/source-maps";
+import { sortSelectedBreakpoints } from "../utils/breakpoint";
 
 import type { Source, Breakpoint } from "../types";
 import type { Selector, SourcesMap } from "../reducers/types";
 
 export type BreakpointSources = Array<{
   source: Source,
   breakpoints: Breakpoint[]
 }>;
 
 function getBreakpointsForSource(
   source: Source,
   selectedSource: ?Source,
   breakpoints: Breakpoint[]
 ) {
-  return breakpoints
-    .sort(
-      (a, b) =>
-        getSelectedLocation(a, selectedSource).line -
-        getSelectedLocation(b, selectedSource).line
-    )
+  return sortSelectedBreakpoints(breakpoints, selectedSource)
     .filter(
       bp =>
         !bp.options.hidden &&
         !bp.loading &&
         (bp.text || bp.originalText || bp.options.condition || bp.disabled)
     )
     .filter(
       bp => getSelectedLocation(bp, selectedSource).sourceId == source.id
--- a/devtools/client/debugger/new/src/utils/breakpoint/index.js
+++ b/devtools/client/debugger/new/src/utils/breakpoint/index.js
@@ -227,17 +227,17 @@ export function getSelectedText(
 ) {
   return selectedSource && isGenerated(selectedSource)
     ? breakpoint.text
     : breakpoint.originalText;
 }
 
 export function sortSelectedBreakpoints(
   breakpoints: Breakpoint[],
-  selectedSource: Source
+  selectedSource: ?Source
 ): Breakpoint[] {
   return sortBy(breakpoints, [
     // Priority: line number, undefined column, column number
     bp => getSelectedLocation(bp, selectedSource).line,
     bp => {
       const location = getSelectedLocation(bp, selectedSource);
       return location.column === undefined || location.column;
     }