Bug 1429803 - Properly populate response header columns; r=rickychien
authorJan Odvarko <odvarko@gmail.com>
Thu, 18 Jan 2018 14:55:58 +0100
changeset 403913 83a578a1c62dd990167d555e25c17ebe9a722956
parent 403823 026401920e32e641eb42b068a16d7dd9e86c66a4
child 403914 8592fd84fc79597063b8ea3b19af8f8528bd02b8
push id33446
push usernerli@mozilla.com
push dateThu, 15 Feb 2018 19:28:20 +0000
treeherdermozilla-central@dc9ba6649af7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrickychien
bugs1429803
milestone60.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 1429803 - Properly populate response header columns; r=rickychien MozReview-Commit-ID: 3FS6QtUS8yB
devtools/client/netmonitor/src/components/RequestListColumnResponseHeader.js
devtools/client/netmonitor/src/components/RequestListItem.js
--- a/devtools/client/netmonitor/src/components/RequestListColumnResponseHeader.js
+++ b/devtools/client/netmonitor/src/components/RequestListColumnResponseHeader.js
@@ -2,32 +2,46 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 const { Component } = require("devtools/client/shared/vendor/react");
 const dom = require("devtools/client/shared/vendor/react-dom-factories");
 const PropTypes = require("devtools/client/shared/vendor/react-prop-types");
-const { getResponseHeader } = require("../utils/request-utils");
+const {
+  getResponseHeader,
+  fetchNetworkUpdatePacket
+} = require("../utils/request-utils");
 
 const { div } = dom;
 
 /**
  * Renders a response header column in the requests list.  The actual
  * header to show is passed as a prop.
  */
 class RequestListColumnResponseHeader extends Component {
   static get propTypes() {
     return {
+      connector: PropTypes.object.isRequired,
       item: PropTypes.object.isRequired,
       header: PropTypes.string.isRequired,
     };
   }
 
+  componentDidMount() {
+    let { item, connector } = this.props;
+    fetchNetworkUpdatePacket(connector.requestData, item, ["responseHeaders"]);
+  }
+
+  componentWillReceiveProps(nextProps) {
+    let { item, connector } = nextProps;
+    fetchNetworkUpdatePacket(connector.requestData, item, ["responseHeaders"]);
+  }
+
   shouldComponentUpdate(nextProps) {
     const currHeader = getResponseHeader(this.props.item, this.props.header);
     const nextHeader = getResponseHeader(nextProps.item, nextProps.header);
     return currHeader !== nextHeader;
   }
 
   render() {
     let header = getResponseHeader(this.props.item, this.props.header);
--- a/devtools/client/netmonitor/src/components/RequestListItem.js
+++ b/devtools/client/netmonitor/src/components/RequestListItem.js
@@ -258,17 +258,21 @@ class RequestListItem extends Component 
         }),
         columns.latency && RequestListColumnTime({
           connector,
           item,
           firstRequestStartedMillis,
           type: "latency",
         }),
         ...RESPONSE_HEADERS.filter(header => columns[header]).map(
-          header => RequestListColumnResponseHeader({ item, header }),
+          header => RequestListColumnResponseHeader({
+            connector,
+            item,
+            header
+          }),
         ),
         columns.waterfall && RequestListColumnWaterfall({
           connector,
           firstRequestStartedMillis,
           item,
           onWaterfallMouseDown,
         }),
       )