Bug 1527122 - [release 125] spread the options object inside the pendingBreakpoint (#7818). r=dwalsh
authorHubert Boma Manilla <b4bomsy@gmail.com>
Mon, 11 Feb 2019 16:59:36 -0800
changeset 458632 b953067ffeafef1f86bd50fc64527baa35b0ef25
parent 458631 01c2f5e1c6db10ab9d40fe717bd17770fa6a524c
child 458633 3bcdb1bf19fc6f2ab5e6f370b64510330d5667ad
push id111861
push userjlaster@mozilla.com
push dateTue, 12 Feb 2019 06:20:44 +0000
treeherdermozilla-inbound@1c7af47c1ba4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdwalsh
bugs1527122
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
Bug 1527122 - [release 125] spread the options object inside the pendingBreakpoint (#7818). r=dwalsh
devtools/client/debugger/new/src/actions/breakpoints/addBreakpoint.js
devtools/client/debugger/new/src/actions/breakpoints/tests/syncing.spec.js
devtools/client/debugger/new/src/actions/tests/__snapshots__/pending-breakpoints.spec.js.snap
devtools/client/debugger/new/src/actions/tests/helpers/breakpoints.js
devtools/client/debugger/new/src/components/SecondaryPanes/Breakpoints/tests/BreakpointsContextMenu.spec.js
devtools/client/debugger/new/src/reducers/tests/breakpoints.spec.js
devtools/client/debugger/new/src/utils/breakpoint/index.js
--- a/devtools/client/debugger/new/src/actions/breakpoints/addBreakpoint.js
+++ b/devtools/client/debugger/new/src/actions/breakpoints/addBreakpoint.js
@@ -136,17 +136,17 @@ export function addBreakpoint(
         location
       );
     }
 
     if (!breakpointPosition) {
       return;
     }
 
-    const breakpoint = createBreakpoint(breakpointPosition, options);
+    const breakpoint = createBreakpoint(breakpointPosition, { options });
 
     return dispatch({
       type: "ADD_BREAKPOINT",
       breakpoint,
       [PROMISE]: addBreakpointPromise(getState, client, sourceMaps, breakpoint)
     });
   };
 }
--- a/devtools/client/debugger/new/src/actions/breakpoints/tests/syncing.spec.js
+++ b/devtools/client/debugger/new/src/actions/breakpoints/tests/syncing.spec.js
@@ -93,21 +93,22 @@ function pendingBreakpoint(overrides) {
     },
     astLocation: {
       name: undefined,
       offset: {
         line: 3
       },
       index: 0
     },
-    condition: null,
+    options: {
+      logValue: "",
+      hidden: false
+    },
     disabled: false,
-    hidden: false,
     loading: false,
-    options: {},
     text: "",
     ...overrides
   };
 }
 
 function newGeneratedLocation(line) {
   return {
     sourceUrl: "http://localhost:8000/gen.js",
--- a/devtools/client/debugger/new/src/actions/tests/__snapshots__/pending-breakpoints.spec.js.snap
+++ b/devtools/client/debugger/new/src/actions/tests/__snapshots__/pending-breakpoints.spec.js.snap
@@ -5,30 +5,32 @@ Object {
   "http://localhost:8000/examples/bar.js:5:": Object {
     "astLocation": Object {
       "index": 0,
       "name": undefined,
       "offset": Object {
         "line": 5,
       },
     },
-    "condition": null,
     "disabled": false,
     "generatedLocation": Object {
       "column": undefined,
       "line": 5,
       "sourceUrl": "http://localhost:8000/examples/bar.js",
     },
-    "hidden": false,
     "location": Object {
       "column": undefined,
       "line": 5,
       "sourceId": "",
       "sourceUrl": "http://localhost:8000/examples/bar.js",
     },
+    "options": Object {
+      "condition": null,
+      "hidden": false,
+    },
   },
 }
 `;
 
 exports[`when adding breakpoints a corresponding pending breakpoint should be added 1`] = `
 Object {
   "astLocation": Object {
     "index": 0,
--- a/devtools/client/debugger/new/src/actions/tests/helpers/breakpoints.js
+++ b/devtools/client/debugger/new/src/actions/tests/helpers/breakpoints.js
@@ -20,19 +20,21 @@ export function mockPendingBreakpoint(ov
     },
     astLocation: {
       name: undefined,
       offset: {
         line: line || 5
       },
       index: 0
     },
-    condition: condition || null,
-    disabled: disabled || false,
-    hidden: hidden || false
+    options: {
+      condition: condition || null,
+      hidden: hidden || false
+    },
+    disabled: disabled || false
   };
 }
 
 export function generateBreakpoint(
   filename: string,
   line: number = 5,
   column: number = 0
 ) {
--- a/devtools/client/debugger/new/src/components/SecondaryPanes/Breakpoints/tests/BreakpointsContextMenu.spec.js
+++ b/devtools/client/debugger/new/src/components/SecondaryPanes/Breakpoints/tests/BreakpointsContextMenu.spec.js
@@ -25,35 +25,53 @@ function generateDefaults(disabled) {
   const breakpoints = [
     createBreakpoint(
       {
         line: 1,
         column: undefined,
         sourceId: "source-https://example.com/main.js",
         sourceUrl: "https://example.com/main.js"
       },
-      { id: "source-https://example.com/main.js:1:", disabled: disabled }
+      {
+        id: "https://example.com/main.js:1:",
+        disabled: disabled,
+        options: {
+          condition: "",
+          logValue: "",
+          hidden: false
+        }
+      }
     ),
     createBreakpoint(
       {
         line: 2,
         column: undefined,
         sourceId: "source-https://example.com/main.js",
         sourceUrl: "https://example.com/main.js"
       },
-      { id: "source-https://example.com/main.js:2:", disabled: disabled }
+      {
+        id: "https://example.com/main.js:2:",
+        disabled: disabled,
+        options: {
+          hidden: false
+        }
+      }
     ),
     createBreakpoint(
       {
         line: 3,
         column: undefined,
         sourceId: "source-https://example.com/main.js",
         sourceUrl: "https://example.com/main.js"
       },
-      { id: "source-https://example.com/main.js:3:", disabled: disabled }
+      {
+        id: "https://example.com/main.js:3:",
+        disabled: disabled,
+        options: {}
+      }
     )
   ];
 
   const props = {
     breakpoints,
     breakpoint: breakpoints[0],
     removeBreakpoint: jest.fn(),
     removeBreakpoints: jest.fn(),
--- a/devtools/client/debugger/new/src/reducers/tests/breakpoints.spec.js
+++ b/devtools/client/debugger/new/src/reducers/tests/breakpoints.spec.js
@@ -19,21 +19,24 @@ function initializeStateWith(data) {
   state.breakpoints = data;
   return state;
 }
 
 describe("Breakpoints Selectors", () => {
   it("it gets a breakpoint for an original source", () => {
     const sourceId = "server1.conn1.child1/source1/originalSource";
     const matchingBreakpoints = {
-      id1: createBreakpoint({ line: 1, sourceId: sourceId })
+      id1: createBreakpoint({ line: 1, sourceId: sourceId }, { options: {} })
     };
 
     const otherBreakpoints = {
-      id2: createBreakpoint({ line: 1, sourceId: "not-this-source" })
+      id2: createBreakpoint(
+        { line: 1, sourceId: "not-this-source" },
+        { options: {} }
+      )
     };
 
     const data = {
       ...matchingBreakpoints,
       ...otherBreakpoints
     };
 
     const breakpoints = initializeStateWith(data);
@@ -50,27 +53,33 @@ describe("Breakpoints Selectors", () => 
   it("it gets a breakpoint for a generated source", () => {
     const generatedSourceId = "random-source";
     const matchingBreakpoints = {
       id1: createBreakpoint(
         {
           line: 1,
           sourceId: "original-source-id-1"
         },
-        { generatedLocation: { line: 1, sourceId: generatedSourceId } }
+        {
+          generatedLocation: { line: 1, sourceId: generatedSourceId },
+          options: {}
+        }
       )
     };
 
     const otherBreakpoints = {
       id2: createBreakpoint(
         {
           line: 1,
           sourceId: "original-source-id-2"
         },
-        { generatedLocation: { line: 1, sourceId: "not-this-source" } }
+        {
+          generatedLocation: { line: 1, sourceId: "not-this-source" },
+          options: {}
+        }
       )
     };
 
     const data = {
       ...matchingBreakpoints,
       ...otherBreakpoints
     };
 
--- a/devtools/client/debugger/new/src/utils/breakpoint/index.js
+++ b/devtools/client/debugger/new/src/utils/breakpoint/index.js
@@ -164,37 +164,35 @@ export function breakpointExists(state: 
   return currentBp && !currentBp.disabled;
 }
 
 export function createBreakpoint(
   location: SourceLocation,
   overrides: Object = {}
 ): Breakpoint {
   const {
-    condition,
     disabled,
-    hidden,
     generatedLocation,
     astLocation,
     text,
     originalText,
-    logValue
+    options
   } = overrides;
 
   const defaultASTLocation = {
     name: undefined,
     offset: location,
     index: 0
   };
   const properties = {
     id: makeBreakpointId(location),
     options: {
-      condition: condition || null,
-      logValue: logValue || null,
-      hidden: hidden || false
+      condition: options.condition || null,
+      logValue: options.logValue || null,
+      hidden: options.hidden || false
     },
     disabled: disabled || false,
     loading: false,
     astLocation: astLocation || defaultASTLocation,
     generatedLocation: generatedLocation || location,
     location,
     text,
     originalText