Bug 1315922 - fix react/prop-types issues in client/memory;r=gregtatum draft
authorJulian Descottes <jdescottes@mozilla.com>
Thu, 05 Jan 2017 17:11:20 +0100
changeset 463315 41283e79b7b13827115421527df5ee4efbdcec50
parent 463314 50613c273124683551f540162d44dbf91d42cad8
child 463316 205c462d21285a87d7c846b437ea481ea27b454c
push id42014
push userjdescottes@mozilla.com
push dateWed, 18 Jan 2017 20:17:21 +0000
reviewersgregtatum
bugs1315922
milestone53.0a1
Bug 1315922 - fix react/prop-types issues in client/memory;r=gregtatum MozReview-Commit-ID: 7o1QhSNOKGi
devtools/client/memory/components/census-tree-item.js
devtools/client/memory/components/dominator-tree-item.js
devtools/client/memory/components/dominator-tree.js
devtools/client/memory/components/snapshot-list-item.js
--- a/devtools/client/memory/components/census-tree-item.js
+++ b/devtools/client/memory/components/census-tree-item.js
@@ -1,22 +1,42 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * 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 { isSavedFrame } = require("devtools/shared/DevToolsUtils");
-const { DOM: dom, createClass, createFactory } = require("devtools/client/shared/vendor/react");
+const {
+  DOM: dom,
+  createClass,
+  createFactory,
+  PropTypes
+} = require("devtools/client/shared/vendor/react");
 const { L10N, formatNumber, formatPercent } = require("../utils");
 const Frame = createFactory(require("devtools/client/shared/components/frame"));
 const { TREE_ROW_HEIGHT } = require("../constants");
+const models = require("../models");
 
 module.exports = createClass({
   displayName: "CensusTreeItem",
 
+  propTypes: {
+    arrow: PropTypes.any,
+    depth: PropTypes.number.isRequired,
+    diffing: models.app.diffing,
+    expanded: PropTypes.bool.isRequired,
+    focused: PropTypes.bool.isRequired,
+    getPercentBytes: PropTypes.func.isRequired,
+    getPercentCount: PropTypes.func.isRequired,
+    inverted: PropTypes.bool,
+    item: PropTypes.object.isRequired,
+    onViewIndividuals: PropTypes.func.isRequired,
+    onViewSourceInDebugger: PropTypes.func.isRequired,
+  },
+
   shouldComponentUpdate(nextProps, nextState) {
     return this.props.item != nextProps.item
       || this.props.depth != nextProps.depth
       || this.props.expanded != nextProps.expanded
       || this.props.focused != nextProps.focused
       || this.props.diffing != nextProps.diffing;
   },
 
--- a/devtools/client/memory/components/dominator-tree-item.js
+++ b/devtools/client/memory/components/dominator-tree-item.js
@@ -20,16 +20,17 @@ const Separator = createFactory(createCl
 
 module.exports = createClass({
   displayName: "DominatorTreeItem",
 
   propTypes: {
     item: PropTypes.object.isRequired,
     depth: PropTypes.number.isRequired,
     arrow: PropTypes.object,
+    expanded: PropTypes.bool.isRequired,
     focused: PropTypes.bool.isRequired,
     getPercentSize: PropTypes.func.isRequired,
     onViewSourceInDebugger: PropTypes.func.isRequired,
   },
 
   shouldComponentUpdate(nextProps, nextState) {
     return this.props.item != nextProps.item
       || this.props.depth != nextProps.depth
--- a/devtools/client/memory/components/dominator-tree.js
+++ b/devtools/client/memory/components/dominator-tree.js
@@ -109,16 +109,17 @@ module.exports = createClass({
   displayName: "DominatorTree",
 
   propTypes: {
     dominatorTree: dominatorTreeModel.isRequired,
     onLoadMoreSiblings: PropTypes.func.isRequired,
     onViewSourceInDebugger: PropTypes.func.isRequired,
     onExpand: PropTypes.func.isRequired,
     onCollapse: PropTypes.func.isRequired,
+    onFocus: PropTypes.func.isRequired,
   },
 
   shouldComponentUpdate(nextProps, nextState) {
     // Safe to use referential equality here because all of our mutations on
     // dominator tree models use immutableUpdate in a persistent manner. The
     // exception to the rule are mutations of the expanded set, however we take
     // care that the dominatorTree model itself is still re-allocated when
     // mutations to the expanded set occur. Because of the re-allocations, we
--- a/devtools/client/memory/components/snapshot-list-item.js
+++ b/devtools/client/memory/components/snapshot-list-item.js
@@ -9,27 +9,28 @@ const {
   L10N,
   getSnapshotTitle,
   getSnapshotTotals,
   getStatusText,
   snapshotIsDiffable,
   getSavedCensus
 } = require("../utils");
 const { diffingState } = require("../constants");
-const { snapshot: snapshotModel } = require("../models");
+const { snapshot: snapshotModel, app: appModel } = require("../models");
 
 module.exports = createClass({
   displayName: "SnapshotListItem",
 
   propTypes: {
     onClick: PropTypes.func.isRequired,
     onSave: PropTypes.func.isRequired,
     onDelete: PropTypes.func.isRequired,
     item: snapshotModel.isRequired,
     index: PropTypes.number.isRequired,
+    diffing: appModel.diffing,
   },
 
   render() {
     let { item: snapshot, onClick, onSave, onDelete, diffing } = this.props;
     let className = `snapshot-list-item ${snapshot.selected ? " selected" : ""}`;
     let statusText = getStatusText(snapshot.state);
     let wantThrobber = !!statusText;
     let title = getSnapshotTitle(snapshot);