Bug 1374680 - Retrieve indent property from the message in the messages types components; r=bgrins
authorNicolas Chevobbe <nchevobbe@mozilla.com>
Thu, 22 Jun 2017 11:57:28 +0200
changeset 418615 2774b700ace8b6b6c850dd7e75904473ce7c95ad
parent 418614 536ed14795b2d4818ba7d47555314444915a3d52
child 418616 5ead239873ba8d8875b8466280c9a538faa61472
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbgrins
bugs1374680
milestone56.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 1374680 - Retrieve indent property from the message in the messages types components; r=bgrins We don't retrieve the indent from the MessageContainer anymore, but from the lowest-level component where we have access to the full message data, i.e. the messages types components (e.g. ConsoleApi, EvaluationResult, … ). MozReview-Commit-ID: JkaIcxnyt3W
devtools/client/webconsole/new-console-output/components/message-container.js
devtools/client/webconsole/new-console-output/components/message-types/console-api-call.js
devtools/client/webconsole/new-console-output/components/message-types/console-command.js
devtools/client/webconsole/new-console-output/components/message-types/evaluation-result.js
devtools/client/webconsole/new-console-output/components/message-types/network-event-message.js
devtools/client/webconsole/new-console-output/components/message-types/page-error.js
devtools/client/webconsole/new-console-output/test/components/console-api-call.test.js
devtools/client/webconsole/new-console-output/test/components/evaluation-result.test.js
devtools/client/webconsole/new-console-output/test/components/network-event-message.test.js
devtools/client/webconsole/new-console-output/test/components/page-error.test.js
--- a/devtools/client/webconsole/new-console-output/components/message-container.js
+++ b/devtools/client/webconsole/new-console-output/components/message-container.js
@@ -65,17 +65,17 @@ const MessageContainer = createClass({
       || networkMessageUpdateChanged
       || loadedObjectPropertiesChanged;
   },
 
   render() {
     const message = this.props.getMessage();
 
     let MessageComponent = getMessageComponent(message);
-    return MessageComponent(Object.assign({message, indent: message.indent}, this.props));
+    return MessageComponent(Object.assign({message}, this.props));
   }
 });
 
 function getMessageComponent(message) {
   switch (message.source) {
     case MESSAGE_SOURCE.CONSOLE_API:
       return componentMap.get("ConsoleApiCall");
     case MESSAGE_SOURCE.NETWORK:
--- a/devtools/client/webconsole/new-console-output/components/message-types/console-api-call.js
+++ b/devtools/client/webconsole/new-console-output/components/message-types/console-api-call.js
@@ -20,40 +20,38 @@ const Message = createFactory(require("d
 
 ConsoleApiCall.displayName = "ConsoleApiCall";
 
 ConsoleApiCall.propTypes = {
   dispatch: PropTypes.func.isRequired,
   message: PropTypes.object.isRequired,
   open: PropTypes.bool,
   serviceContainer: PropTypes.object.isRequired,
-  indent: PropTypes.number.isRequired,
   timestampsVisible: PropTypes.bool.isRequired,
   loadedObjectProperties: PropTypes.object,
 };
 
 ConsoleApiCall.defaultProps = {
   open: false,
-  indent: 0,
 };
 
 function ConsoleApiCall(props) {
   const {
     dispatch,
     message,
     open,
     tableData,
     serviceContainer,
-    indent,
     timestampsVisible,
     repeat,
     loadedObjectProperties,
   } = props;
   const {
     id: messageId,
+    indent,
     source,
     type,
     level,
     stacktrace,
     frame,
     timeStamp,
     parameters,
     messageText,
--- a/devtools/client/webconsole/new-console-output/components/message-types/console-command.js
+++ b/devtools/client/webconsole/new-console-output/components/message-types/console-command.js
@@ -12,37 +12,32 @@ const {
   PropTypes
 } = require("devtools/client/shared/vendor/react");
 const Message = createFactory(require("devtools/client/webconsole/new-console-output/components/message"));
 
 ConsoleCommand.displayName = "ConsoleCommand";
 
 ConsoleCommand.propTypes = {
   message: PropTypes.object.isRequired,
-  indent: PropTypes.number.isRequired,
   timestampsVisible: PropTypes.bool.isRequired,
   serviceContainer: PropTypes.object,
 };
 
-ConsoleCommand.defaultProps = {
-  indent: 0,
-};
-
 /**
  * Displays input from the console.
  */
 function ConsoleCommand(props) {
   const {
-    indent,
     message,
     timestampsVisible,
     serviceContainer,
   } = props;
 
   const {
+    indent,
     source,
     type,
     level,
     messageText: messageBody,
   } = message;
 
   return Message({
     source,
--- a/devtools/client/webconsole/new-console-output/components/message-types/evaluation-result.js
+++ b/devtools/client/webconsole/new-console-output/components/message-types/evaluation-result.js
@@ -14,42 +14,37 @@ const {
 const Message = createFactory(require("devtools/client/webconsole/new-console-output/components/message"));
 const GripMessageBody = require("devtools/client/webconsole/new-console-output/components/grip-message-body");
 
 EvaluationResult.displayName = "EvaluationResult";
 
 EvaluationResult.propTypes = {
   dispatch: PropTypes.func.isRequired,
   message: PropTypes.object.isRequired,
-  indent: PropTypes.number.isRequired,
   timestampsVisible: PropTypes.bool.isRequired,
   serviceContainer: PropTypes.object,
   loadedObjectProperties: PropTypes.object,
 };
 
-EvaluationResult.defaultProps = {
-  indent: 0,
-};
-
 function EvaluationResult(props) {
   const {
     dispatch,
     message,
     serviceContainer,
-    indent,
     timestampsVisible,
     loadedObjectProperties,
   } = props;
 
   const {
     source,
     type,
     helperType,
     level,
     id: messageId,
+    indent,
     exceptionDocURL,
     frame,
     timeStamp,
     parameters,
     notes,
   } = message;
 
   let messageBody;
--- a/devtools/client/webconsole/new-console-output/components/message-types/network-event-message.js
+++ b/devtools/client/webconsole/new-console-output/components/message-types/network-event-message.js
@@ -17,34 +17,29 @@ const { l10n } = require("devtools/clien
 
 NetworkEventMessage.displayName = "NetworkEventMessage";
 
 NetworkEventMessage.propTypes = {
   message: PropTypes.object.isRequired,
   serviceContainer: PropTypes.shape({
     openNetworkPanel: PropTypes.func.isRequired,
   }),
-  indent: PropTypes.number.isRequired,
   timestampsVisible: PropTypes.bool.isRequired,
   networkMessageUpdate: PropTypes.object.isRequired,
 };
 
-NetworkEventMessage.defaultProps = {
-  indent: 0,
-};
-
 function NetworkEventMessage({
-  indent,
   message = {},
   serviceContainer,
   timestampsVisible,
   networkMessageUpdate = {},
 }) {
   const {
     actor,
+    indent,
     source,
     type,
     level,
     request,
     isXHR,
     timeStamp,
   } = message;
 
--- a/devtools/client/webconsole/new-console-output/components/message-types/page-error.js
+++ b/devtools/client/webconsole/new-console-output/components/message-types/page-error.js
@@ -13,37 +13,35 @@ const {
 } = require("devtools/client/shared/vendor/react");
 const Message = createFactory(require("devtools/client/webconsole/new-console-output/components/message"));
 
 PageError.displayName = "PageError";
 
 PageError.propTypes = {
   message: PropTypes.object.isRequired,
   open: PropTypes.bool,
-  indent: PropTypes.number.isRequired,
   timestampsVisible: PropTypes.bool.isRequired,
   serviceContainer: PropTypes.object,
 };
 
 PageError.defaultProps = {
   open: false,
-  indent: 0,
 };
 
 function PageError(props) {
   const {
     dispatch,
     message,
     open,
     serviceContainer,
-    indent,
     timestampsVisible,
   } = props;
   const {
     id: messageId,
+    indent,
     source,
     type,
     level,
     messageText,
     repeat,
     stacktrace,
     frame,
     exceptionDocURL,
--- a/devtools/client/webconsole/new-console-output/test/components/console-api-call.test.js
+++ b/devtools/client/webconsole/new-console-output/test/components/console-api-call.test.js
@@ -81,17 +81,20 @@ describe("ConsoleAPICall component:", ()
         "span.message-body.devtools-monospace + span.message-repeats";
       expect(wrapper.find(selector).length).toBe(1);
     });
 
     it("has the expected indent", () => {
       const message = stubPreparedMessages.get("console.log('foobar', 'test')");
 
       const indent = 10;
-      let wrapper = render(ConsoleApiCall({ message, serviceContainer, indent }));
+      let wrapper = render(ConsoleApiCall({
+        message: Object.assign({}, message, {indent}),
+        serviceContainer
+      }));
       expect(wrapper.find(".indent").prop("style").width)
         .toBe(`${indent * INDENT_WIDTH}px`);
 
       wrapper = render(ConsoleApiCall({ message, serviceContainer}));
       expect(wrapper.find(".indent").prop("style").width).toBe(`0`);
     });
 
     it("renders a timestamp when passed a truthy timestampsVisible prop", () => {
--- a/devtools/client/webconsole/new-console-output/test/components/evaluation-result.test.js
+++ b/devtools/client/webconsole/new-console-output/test/components/evaluation-result.test.js
@@ -76,17 +76,19 @@ describe("EvaluationResult component:", 
     let call = serviceContainer.openLink.getCall(0);
     expect(call.args[0]).toEqual(message.exceptionDocURL);
   });
 
   it("has the expected indent", () => {
     const message = stubPreparedMessages.get("new Date(0)");
 
     const indent = 10;
-    let wrapper = render(EvaluationResult({ message, indent}));
+    let wrapper = render(EvaluationResult({
+      message: Object.assign({}, message, {indent}),
+    }));
     expect(wrapper.find(".indent").prop("style").width)
         .toBe(`${indent * INDENT_WIDTH}px`);
 
     wrapper = render(EvaluationResult({ message}));
     expect(wrapper.find(".indent").prop("style").width).toBe(`0`);
   });
 
   it("has location information", () => {
--- a/devtools/client/webconsole/new-console-output/test/components/network-event-message.test.js
+++ b/devtools/client/webconsole/new-console-output/test/components/network-event-message.test.js
@@ -52,17 +52,20 @@ describe("NetworkEventMessage component:
 
       expect(wrapper.find(".timestamp").length).toBe(0);
     });
 
     it("has the expected indent", () => {
       const message = stubPreparedMessages.get("GET request");
 
       const indent = 10;
-      let wrapper = render(NetworkEventMessage({ message, serviceContainer, indent}));
+      let wrapper = render(NetworkEventMessage({
+        message: Object.assign({}, message, {indent}),
+        serviceContainer
+      }));
       expect(wrapper.find(".indent").prop("style").width)
         .toBe(`${indent * INDENT_WIDTH}px`);
 
       wrapper = render(NetworkEventMessage({ message, serviceContainer }));
       expect(wrapper.find(".indent").prop("style").width).toBe(`0`);
     });
   });
 
--- a/devtools/client/webconsole/new-console-output/test/components/page-error.test.js
+++ b/devtools/client/webconsole/new-console-output/test/components/page-error.test.js
@@ -137,17 +137,20 @@ describe("PageError component:", () => {
       id: message.id,
       type: MESSAGE_OPEN
     });
   });
 
   it("has the expected indent", () => {
     const message = stubPreparedMessages.get("ReferenceError: asdf is not defined");
     const indent = 10;
-    let wrapper = render(PageError({ message, serviceContainer, indent}));
+    let wrapper = render(PageError({
+      message: Object.assign({}, message, {indent}),
+      serviceContainer
+    }));
     expect(wrapper.find(".indent").prop("style").width)
         .toBe(`${indent * INDENT_WIDTH}px`);
 
     wrapper = render(PageError({ message, serviceContainer}));
     expect(wrapper.find(".indent").prop("style").width).toBe(`0`);
   });
 
   it("has empty error notes", () => {