Bug 1350217 - Remove redundant shared module dependencies r?honza draft
authorRicky Chien <ricky060709@gmail.com>
Wed, 29 Mar 2017 15:21:25 +0800
changeset 552930 34fb20124e1d6e41fbf108d4dd007263fd978ab8
parent 552929 2dcd3f91009ee18788310f7286d2a1d0f754b4f8
child 621949 cca05749664c18e3303e55fdbf059f4dbb770d05
push id51510
push userbmo:rchien@mozilla.com
push dateWed, 29 Mar 2017 07:47:25 +0000
reviewershonza
bugs1350217
milestone55.0a1
Bug 1350217 - Remove redundant shared module dependencies r?honza MozReview-Commit-ID: GhQn2RKfDgq
devtools/client/netmonitor/src/components/request-list-content.js
devtools/client/netmonitor/src/components/request-list-header.js
--- a/devtools/client/netmonitor/src/components/request-list-content.js
+++ b/devtools/client/netmonitor/src/components/request-list-content.js
@@ -1,15 +1,14 @@
 /* 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 { KeyCodes } = require("devtools/client/shared/keycodes");
 const {
   createClass,
   createFactory,
   DOM,
   PropTypes,
 } = require("devtools/client/shared/vendor/react");
 const { connect } = require("devtools/client/shared/vendor/react-redux");
 const { HTMLTooltip } = require("devtools/client/shared/widgets/tooltip/HTMLTooltip");
@@ -171,46 +170,46 @@ const RequestListContent = createClass({
   onScroll() {
     this.tooltip.hide();
   },
 
   /**
    * Handler for keyboard events. For arrow up/down, page up/down, home/end,
    * move the selection up or down.
    */
-  onKeyDown(e) {
+  onKeyDown(evt) {
     let delta;
 
-    switch (e.keyCode) {
-      case KeyCodes.DOM_VK_UP:
-      case KeyCodes.DOM_VK_LEFT:
+    switch (evt.key) {
+      case "ArrowUp":
+      case "ArrowLeft":
         delta = -1;
         break;
-      case KeyCodes.DOM_VK_DOWN:
-      case KeyCodes.DOM_VK_RIGHT:
+      case "ArrowDown":
+      case "ArrowRight":
         delta = +1;
         break;
-      case KeyCodes.DOM_VK_PAGE_UP:
+      case "PageUp":
         delta = "PAGE_UP";
         break;
-      case KeyCodes.DOM_VK_PAGE_DOWN:
+      case "PageDown":
         delta = "PAGE_DOWN";
         break;
-      case KeyCodes.DOM_VK_HOME:
+      case "Home":
         delta = -Infinity;
         break;
-      case KeyCodes.DOM_VK_END:
+      case "End":
         delta = +Infinity;
         break;
     }
 
     if (delta) {
       // Prevent scrolling when pressing navigation keys.
-      e.preventDefault();
-      e.stopPropagation();
+      evt.preventDefault();
+      evt.stopPropagation();
       this.props.onSelectDelta(delta);
     }
   },
 
   onContextMenu(evt) {
     evt.preventDefault();
     this.contextMenu.open(evt);
   },
--- a/devtools/client/netmonitor/src/components/request-list-header.js
+++ b/devtools/client/netmonitor/src/components/request-list-header.js
@@ -5,17 +5,16 @@
 "use strict";
 
 const {
   createClass,
   PropTypes,
   DOM,
 } = require("devtools/client/shared/vendor/react");
 const { connect } = require("devtools/client/shared/vendor/react-redux");
-const { setNamedTimeout } = require("devtools/client/shared/widgets/view-helpers");
 const Actions = require("../actions/index");
 const { getWaterfallScale } = require("../selectors/index");
 const { getFormattedTime } = require("../utils/format-utils");
 const { L10N } = require("../utils/l10n");
 const WaterfallBackground = require("../waterfall-background");
 
 const { div, button } = DOM;
 
@@ -66,20 +65,20 @@ const RequestListHeader = createClass({
     this.background.destroy();
     this.background = null;
     window.removeEventListener("resize", this.resizeWaterfall);
   },
 
   resizeWaterfall() {
     // Measure its width and update the 'waterfallWidth' property in the store.
     // The 'waterfallWidth' will be further updated on every window resize.
-    setNamedTimeout("resize-events", 50, () => {
-      const { width } = this.refs.header.getBoundingClientRect();
+    setTimeout(() => {
+      let { width } = this.refs.header.getBoundingClientRect();
       this.props.resizeWaterfall(width);
-    });
+    }, 50);
   },
 
   render() {
     const { sort, scale, waterfallWidth, onHeaderClick } = this.props;
 
     return div(
       { className: "devtools-toolbar requests-list-toolbar" },
       div({ className: "toolbar-labels" },