Bug 1585407 - setPendingSelectedLocation loses line/column r=jlast
authorwartmanm <mattheww@skyward.com>
Fri, 04 Oct 2019 00:25:20 +0000
changeset 496259 cffcebd1e74b797881524755c0e3eb2aee81db26
parent 496258 9ba22ed9e1faf20d7c6e08cd5aaf895377f300da
child 496260 a36c7c7c50fea67a6d630b8486fb88d398ad192a
push id36647
push usernerli@mozilla.com
push dateFri, 04 Oct 2019 04:09:18 +0000
treeherdermozilla-central@678d4d2c3c4d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjlast
bugs1585407
milestone71.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
Bug 1585407 - setPendingSelectedLocation loses line/column r=jlast Differential Revision: https://phabricator.services.mozilla.com/D47802
devtools/client/debugger/src/actions/sources/select.js
devtools/client/debugger/src/actions/sources/tests/select.spec.js
devtools/client/debugger/src/reducers/sources.js
--- a/devtools/client/debugger/src/actions/sources/select.js
+++ b/devtools/client/debugger/src/actions/sources/select.js
@@ -53,22 +53,23 @@ export const setSelectedLocation = (
   cx,
   source,
   location,
 });
 
 export const setPendingSelectedLocation = (
   cx: Context,
   url: string,
-  options: Object
+  options?: PartialPosition
 ) => ({
   type: "SET_PENDING_SELECTED_LOCATION",
   cx,
-  url: url,
-  line: options.location ? options.location.line : null,
+  url,
+  line: options ? options.line : null,
+  column: options ? options.column : null,
 });
 
 export const clearSelectedLocation = (cx: Context) => ({
   type: "CLEAR_SELECTED_LOCATION",
   cx,
 });
 
 /**
@@ -80,17 +81,17 @@ export const clearSelectedLocation = (cx
  * debugger.
  *
  * @memberof actions/sources
  * @static
  */
 export function selectSourceURL(
   cx: Context,
   url: string,
-  options: PartialPosition = {}
+  options?: PartialPosition
 ) {
   return async ({ dispatch, getState, sourceMaps }: ThunkArgs) => {
     const source = getSourceByURL(getState(), url);
     if (!source) {
       return dispatch(setPendingSelectedLocation(cx, url, options));
     }
 
     const sourceId = source.id;
--- a/devtools/client/debugger/src/actions/sources/tests/select.spec.js
+++ b/devtools/client/debugger/src/actions/sources/tests/select.spec.js
@@ -185,24 +185,25 @@ describe("sources", () => {
     // clear value
     dispatch(actions.clearSelectedLocation(cx));
     expect(getSelectedLocation(getState())).toEqual(null);
   });
 
   it("sets and clears pending selected location correctly", () => {
     const { dispatch, getState, cx } = createStore(mockCommandClient);
     const url = "testURL";
-    const options = { location: { line: "testLine" } };
+    const options = { line: "testLine", column: "testColumn" };
 
     // set value
     dispatch(actions.setPendingSelectedLocation(cx, url, options));
     const setResult = getState().sources.pendingSelectedLocation;
     expect(setResult).toEqual({
       url,
-      line: options.location.line,
+      line: options.line,
+      column: options.column,
     });
 
     // clear value
     dispatch(actions.clearSelectedLocation(cx));
     const clearResult = getState().sources.pendingSelectedLocation;
     expect(clearResult).toEqual({ url: "" });
   });
 
--- a/devtools/client/debugger/src/reducers/sources.js
+++ b/devtools/client/debugger/src/reducers/sources.js
@@ -198,16 +198,17 @@ function update(
         selectedLocation: null,
         pendingSelectedLocation: location,
       };
 
     case "SET_PENDING_SELECTED_LOCATION":
       location = {
         url: action.url,
         line: action.line,
+        column: action.column,
       };
 
       prefs.pendingSelectedLocation = location;
       return { ...state, pendingSelectedLocation: location };
 
     case "LOAD_SOURCE_TEXT":
       return updateLoadedState(state, action);