Backed out changeset f09e9013044d (bug 1309866) for causing Bug 1322685 after merge
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Fri, 09 Dec 2016 15:42:55 +0100
changeset 325488 f74a13482aa727cf0ed3a332b22886f222eeea08
parent 325487 a0b88dac1929c24e5ce3a4886e30d1692bea29be
child 325489 6a75cf810d963de5b83c3aacb4c776604474302f
push id24
push usermaklebus@msu.edu
push dateTue, 20 Dec 2016 03:11:33 +0000
bugs1309866, 1322685
milestone53.0a1
backs outf09e9013044d352d51c3dea33826884188a59622
Backed out changeset f09e9013044d (bug 1309866) for causing Bug 1322685 after merge
devtools/client/jar.mn
devtools/client/netmonitor/constants.js
devtools/client/netmonitor/details-view.js
devtools/client/netmonitor/har/test/browser_net_har_throttle_upload.js
devtools/client/netmonitor/moz.build
devtools/client/netmonitor/netmonitor-controller.js
devtools/client/netmonitor/netmonitor-view.js
devtools/client/netmonitor/netmonitor.js
devtools/client/netmonitor/netmonitor.xul
devtools/client/netmonitor/panel.js
devtools/client/netmonitor/performance-statistics-view.js
devtools/client/netmonitor/requests-menu-view.js
devtools/client/netmonitor/sidebar-view.js
devtools/client/netmonitor/test/browser_net_footer-summary.js
devtools/client/netmonitor/test/browser_net_page-nav.js
devtools/client/netmonitor/test/browser_net_simple-init.js
devtools/client/netmonitor/test/browser_net_throttle.js
devtools/client/styleeditor/test/browser_styleeditor_fetch-from-cache.js
--- a/devtools/client/jar.mn
+++ b/devtools/client/jar.mn
@@ -9,17 +9,18 @@ devtools.jar:
     content/shared/widgets/widgets.css (shared/widgets/widgets.css)
     content/shared/widgets/VariablesView.xul (shared/widgets/VariablesView.xul)
     content/projecteditor/chrome/content/projecteditor.xul (projecteditor/chrome/content/projecteditor.xul)
     content/projecteditor/lib/helpers/readdir.js (projecteditor/lib/helpers/readdir.js)
     content/projecteditor/chrome/content/projecteditor-loader.xul (projecteditor/chrome/content/projecteditor-loader.xul)
     content/projecteditor/chrome/content/projecteditor-test.xul (projecteditor/chrome/content/projecteditor-test.xul)
     content/projecteditor/chrome/content/projecteditor-loader.js (projecteditor/chrome/content/projecteditor-loader.js)
     content/netmonitor/netmonitor.xul (netmonitor/netmonitor.xul)
-    content/netmonitor/netmonitor.js (netmonitor/netmonitor.js)
+    content/netmonitor/netmonitor-controller.js (netmonitor/netmonitor-controller.js)
+    content/netmonitor/netmonitor-view.js (netmonitor/netmonitor-view.js)
     content/webconsole/webconsole.xul (webconsole/webconsole.xul)
 *   content/scratchpad/scratchpad.xul (scratchpad/scratchpad.xul)
     content/scratchpad/scratchpad.js (scratchpad/scratchpad.js)
     content/shared/splitview.css (shared/splitview.css)
     content/shared/theme-switching.js (shared/theme-switching.js)
     content/shared/frame-script-utils.js (shared/frame-script-utils.js)
     content/styleeditor/styleeditor.xul (styleeditor/styleeditor.xul)
     content/storage/storage.xul (storage/storage.xul)
--- a/devtools/client/netmonitor/constants.js
+++ b/devtools/client/netmonitor/constants.js
@@ -25,26 +25,9 @@ const actionTypes = {
   SORT_BY: "SORT_BY",
   TOGGLE_FILTER_TYPE: "TOGGLE_FILTER_TYPE",
   ENABLE_FILTER_TYPE_ONLY: "ENABLE_FILTER_TYPE_ONLY",
   SET_FILTER_TEXT: "SET_FILTER_TEXT",
   OPEN_SIDEBAR: "OPEN_SIDEBAR",
   WATERFALL_RESIZE: "WATERFALL_RESIZE",
 };
 
-// Descriptions for what this frontend is currently doing.
-const ACTIVITY_TYPE = {
-  // Standing by and handling requests normally.
-  NONE: 0,
-
-  // Forcing the target to reload with cache enabled or disabled.
-  RELOAD: {
-    WITH_CACHE_ENABLED: 1,
-    WITH_CACHE_DISABLED: 2,
-    WITH_CACHE_DEFAULT: 3
-  },
-
-  // Enabling or disabling the cache without triggering a reload.
-  ENABLE_CACHE: 3,
-  DISABLE_CACHE: 4
-};
-
-module.exports = Object.assign({ ACTIVITY_TYPE }, general, actionTypes);
+module.exports = Object.assign({}, general, actionTypes);
--- a/devtools/client/netmonitor/details-view.js
+++ b/devtools/client/netmonitor/details-view.js
@@ -1,20 +1,20 @@
 /* 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/. */
 
+/* import-globals-from ./netmonitor-controller.js */
 /* eslint-disable mozilla/reject-some-requires */
-/* globals window, dumpn, $, NetMonitorView, gNetwork */
+/* globals dumpn, $, NetMonitorView, gNetwork */
 
 "use strict";
 
 const promise = require("promise");
 const EventEmitter = require("devtools/shared/event-emitter");
-const Editor = require("devtools/client/sourceeditor/editor");
 const { Heritage } = require("devtools/client/shared/widgets/view-helpers");
 const { Task } = require("devtools/shared/task");
 const { ToolSidebar } = require("devtools/client/framework/sidebar");
 const { VariablesView } = require("resource://devtools/client/shared/widgets/VariablesView.jsm");
 const { VariablesViewController } = require("resource://devtools/client/shared/widgets/VariablesViewController.jsm");
 const { EVENTS } = require("./events");
 const { L10N } = require("./l10n");
 const { Filters } = require("./filter-predicates");
--- a/devtools/client/netmonitor/har/test/browser_net_har_throttle_upload.js
+++ b/devtools/client/netmonitor/har/test/browser_net_har_throttle_upload.js
@@ -11,33 +11,33 @@ add_task(function* () {
 });
 
 function* throttleUploadTest(actuallyThrottle) {
   let { tab, monitor } = yield initNetMonitor(
     HAR_EXAMPLE_URL + "html_har_post-data-test-page.html");
 
   info("Starting test... (actuallyThrottle = " + actuallyThrottle + ")");
 
-  let { NetMonitorController, NetMonitorView } = monitor.panelWin;
+  let { NetMonitorView } = monitor.panelWin;
   let { RequestsMenu } = NetMonitorView;
 
   const size = 4096;
   const uploadSize = actuallyThrottle ? size / 3 : 0;
 
   const request = {
     "NetworkMonitor.throttleData": {
       latencyMean: 0,
       latencyMax: 0,
       downloadBPSMean: 200000,
       downloadBPSMax: 200000,
       uploadBPSMean: uploadSize,
       uploadBPSMax: uploadSize,
     },
   };
-  let client = NetMonitorController.webConsoleClient;
+  let client = monitor._controller.webConsoleClient;
 
   info("sending throttle request");
   let deferred = promise.defer();
   client.setPreferences(request, response => {
     deferred.resolve(response);
   });
   yield deferred.promise;
 
--- a/devtools/client/netmonitor/moz.build
+++ b/devtools/client/netmonitor/moz.build
@@ -14,18 +14,16 @@ DIRS += [
 
 DevToolsModules(
     'constants.js',
     'custom-request-view.js',
     'details-view.js',
     'events.js',
     'filter-predicates.js',
     'l10n.js',
-    'netmonitor-controller.js',
-    'netmonitor-view.js',
     'panel.js',
     'performance-statistics-view.js',
     'prefs.js',
     'request-list-context-menu.js',
     'request-utils.js',
     'requests-menu-view.js',
     'sidebar-view.js',
     'sort-predicates.js',
--- a/devtools/client/netmonitor/netmonitor-controller.js
+++ b/devtools/client/netmonitor/netmonitor-controller.js
@@ -1,41 +1,62 @@
 /* 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/. */
 
 /* eslint-disable mozilla/reject-some-requires */
-/* globals window, NetMonitorView, gStore, dumpn */
+/* globals window, NetMonitorView, gStore, Actions */
+/* exported loader */
 
 "use strict";
 
+var { utils: Cu } = Components;
+
+// Descriptions for what this frontend is currently doing.
+const ACTIVITY_TYPE = {
+  // Standing by and handling requests normally.
+  NONE: 0,
+
+  // Forcing the target to reload with cache enabled or disabled.
+  RELOAD: {
+    WITH_CACHE_ENABLED: 1,
+    WITH_CACHE_DISABLED: 2,
+    WITH_CACHE_DEFAULT: 3
+  },
+
+  // Enabling or disabling the cache without triggering a reload.
+  ENABLE_CACHE: 3,
+  DISABLE_CACHE: 4
+};
+
+var BrowserLoaderModule = {};
+Cu.import("resource://devtools/client/shared/browser-loader.js", BrowserLoaderModule);
+var { loader, require } = BrowserLoaderModule.BrowserLoader({
+  baseURI: "resource://devtools/client/netmonitor/",
+  window
+});
+
 const promise = require("promise");
 const Services = require("Services");
 const {XPCOMUtils} = require("resource://gre/modules/XPCOMUtils.jsm");
 const EventEmitter = require("devtools/shared/event-emitter");
 const Editor = require("devtools/client/sourceeditor/editor");
 const {TimelineFront} = require("devtools/shared/fronts/timeline");
 const {Task} = require("devtools/shared/task");
-const { ACTIVITY_TYPE } = require("./constants");
-const { EVENTS } = require("./events");
-const { configureStore } = require("./store");
+const {EVENTS} = require("./events");
 const Actions = require("./actions/index");
 const { getDisplayedRequestById } = require("./selectors/index");
-const { Prefs } = require("./prefs");
 
-XPCOMUtils.defineConstant(window, "EVENTS", EVENTS);
-XPCOMUtils.defineConstant(window, "ACTIVITY_TYPE", ACTIVITY_TYPE);
-XPCOMUtils.defineConstant(window, "Editor", Editor);
-XPCOMUtils.defineConstant(window, "Prefs", Prefs);
-XPCOMUtils.defineLazyModuleGetter(window, "Chart",
+XPCOMUtils.defineConstant(this, "EVENTS", EVENTS);
+XPCOMUtils.defineConstant(this, "ACTIVITY_TYPE", ACTIVITY_TYPE);
+XPCOMUtils.defineConstant(this, "Editor", Editor);
+
+XPCOMUtils.defineLazyModuleGetter(this, "Chart",
   "resource://devtools/client/shared/widgets/Chart.jsm");
 
-// Initialize the global Redux store
-window.gStore = configureStore();
-
 /**
  * Object defining the network monitor controller components.
  */
 var NetMonitorController = {
   /**
    * Initializes the view and connects the monitor client.
    *
    * @return object
@@ -713,17 +734,17 @@ NetworkEventsHandler.prototype = {
   getString: function (stringGrip) {
     return this.webConsoleClient.getString(stringGrip);
   }
 };
 
 /**
  * Convenient way of emitting events from the panel window.
  */
-EventEmitter.decorate(window);
+EventEmitter.decorate(this);
 
 /**
  * Preliminary setup for the NetMonitorController object.
  */
 NetMonitorController.TargetEventsHandler = new TargetEventsHandler();
 NetMonitorController.NetworkEventsHandler = new NetworkEventsHandler();
 
 /**
@@ -733,9 +754,19 @@ Object.defineProperties(window, {
   "gNetwork": {
     get: function () {
       return NetMonitorController.NetworkEventsHandler;
     },
     configurable: true
   }
 });
 
-exports.NetMonitorController = NetMonitorController;
+/**
+ * Helper method for debugging.
+ * @param string
+ */
+function dumpn(str) {
+  if (wantLogging) {
+    dump("NET-FRONTEND: " + str + "\n");
+  }
+}
+
+var wantLogging = Services.prefs.getBoolPref("devtools.debugger.log");
--- a/devtools/client/netmonitor/netmonitor-view.js
+++ b/devtools/client/netmonitor/netmonitor-view.js
@@ -1,31 +1,32 @@
 /* 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/. */
 
+/* import-globals-from ./netmonitor-controller.js */
 /* eslint-disable mozilla/reject-some-requires */
-/* globals $, gStore, NetMonitorController, dumpn */
+/* globals Prefs, setInterval, setTimeout, clearInterval, clearTimeout, btoa */
+/* exported $, $all */
 
 "use strict";
 
 const { testing: isTesting } = require("devtools/shared/flags");
-const promise = require("promise");
-const Editor = require("devtools/client/sourceeditor/editor");
-const { Task } = require("devtools/shared/task");
 const { ViewHelpers } = require("devtools/client/shared/widgets/view-helpers");
+const { configureStore } = require("./store");
 const { RequestsMenuView } = require("./requests-menu-view");
 const { CustomRequestView } = require("./custom-request-view");
 const { ToolbarView } = require("./toolbar-view");
 const { SidebarView } = require("./sidebar-view");
 const { DetailsView } = require("./details-view");
 const { PerformanceStatisticsView } = require("./performance-statistics-view");
-const { ACTIVITY_TYPE } = require("./constants");
-const Actions = require("./actions/index");
-const { Prefs } = require("./prefs");
+var {Prefs} = require("./prefs");
+
+// Initialize the global redux variables
+var gStore = configureStore();
 
 // ms
 const WDA_DEFAULT_VERIFY_INTERVAL = 50;
 
 // Use longer timeout during testing as the tests need this process to succeed
 // and two seconds is quite short on slow debug builds. The timeout here should
 // be at least equal to the general mochitest timeout of 45 seconds so that this
 // never gets hit during testing.
@@ -231,16 +232,23 @@ var NetMonitorView = {
   },
 
   _body: null,
   _detailsPane: null,
   _editorPromises: new Map()
 };
 
 /**
+ * DOM query helper.
+ * TODO: Move it into "dom-utils.js" module and "require" it when needed.
+ */
+var $ = (selector, target = document) => target.querySelector(selector);
+var $all = (selector, target = document) => target.querySelectorAll(selector);
+
+/**
  * Makes sure certain properties are available on all objects in a data store.
  *
  * @param Store dataStore
  *        A Redux store for which to check the availability of properties.
  * @param array mandatoryFields
  *        A list of strings representing properties of objects in dataStore.
  * @return object
  *         A promise resolved when all objects in dataStore contain the
@@ -274,10 +282,8 @@ function whenDataAvailable(dataStore, ma
  * Preliminary setup for the NetMonitorView object.
  */
 NetMonitorView.Toolbar = new ToolbarView();
 NetMonitorView.Sidebar = new SidebarView();
 NetMonitorView.NetworkDetails = new DetailsView();
 NetMonitorView.RequestsMenu = new RequestsMenuView();
 NetMonitorView.CustomRequest = new CustomRequestView();
 NetMonitorView.PerformanceStatistics = new PerformanceStatisticsView();
-
-exports.NetMonitorView = NetMonitorView;
deleted file mode 100644
--- a/devtools/client/netmonitor/netmonitor.js
+++ /dev/null
@@ -1,60 +0,0 @@
-/* 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/. */
-
-/* globals window, document, NetMonitorController, NetMonitorView */
-/* exported Netmonitor, NetMonitorController, NetMonitorView, $, $all, dumpn */
-
-"use strict";
-
-const Cu = Components.utils;
-const { Services } = Cu.import("resource://gre/modules/Services.jsm", {});
-const { BrowserLoader } = Cu.import("resource://devtools/client/shared/browser-loader.js", {});
-
-function Netmonitor(toolbox) {
-  const { require } = BrowserLoader({
-    baseURI: "resource://devtools/client/netmonitor/",
-    window,
-    commonLibRequire: toolbox.browserRequire,
-  });
-
-  window.windowRequire = require;
-
-  const { NetMonitorController } = require("./netmonitor-controller.js");
-  const { NetMonitorView } = require("./netmonitor-view.js");
-
-  window.NetMonitorController = NetMonitorController;
-  window.NetMonitorView = NetMonitorView;
-
-  NetMonitorController._toolbox = toolbox;
-  NetMonitorController._target = toolbox.target;
-}
-
-Netmonitor.prototype = {
-  init() {
-    return window.NetMonitorController.startupNetMonitor();
-  },
-
-  destroy() {
-    return window.NetMonitorController.shutdownNetMonitor();
-  }
-};
-
-/**
- * DOM query helper.
- * TODO: Move it into "dom-utils.js" module and "require" it when needed.
- */
-var $ = (selector, target = document) => target.querySelector(selector);
-var $all = (selector, target = document) => target.querySelectorAll(selector);
-
-/**
- * Helper method for debugging.
- * @param string
- */
-function dumpn(str) {
-  if (wantLogging) {
-    dump("NET-FRONTEND: " + str + "\n");
-  }
-}
-
-var wantLogging = Services.prefs.getBoolPref("devtools.debugger.log");
--- a/devtools/client/netmonitor/netmonitor.xul
+++ b/devtools/client/netmonitor/netmonitor.xul
@@ -7,17 +7,18 @@
 <?xml-stylesheet href="chrome://devtools/skin/widgets.css" type="text/css"?>
 <?xml-stylesheet href="chrome://devtools/skin/netmonitor.css" type="text/css"?>
 
 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         xmlns:html="http://www.w3.org/1999/xhtml">
 
   <script type="application/javascript;version=1.8"
           src="chrome://devtools/content/shared/theme-switching.js"/>
-  <script type="text/javascript" src="netmonitor.js"/>
+  <script type="text/javascript" src="netmonitor-controller.js"/>
+  <script type="text/javascript" src="netmonitor-view.js"/>
 
   <deck id="body"
         class="theme-sidebar"
         flex="1"
         data-localization-bundle="devtools/client/locales/netmonitor.properties">
 
     <vbox id="network-inspector-view" flex="1">
       <html:div xmlns="http://www.w3.org/1999/xhtml"
--- a/devtools/client/netmonitor/panel.js
+++ b/devtools/client/netmonitor/panel.js
@@ -9,17 +9,20 @@ const EventEmitter = require("devtools/s
 const { Task } = require("devtools/shared/task");
 const { localizeMarkup } = require("devtools/shared/l10n");
 
 function NetMonitorPanel(iframeWindow, toolbox) {
   this.panelWin = iframeWindow;
   this.panelDoc = iframeWindow.document;
   this._toolbox = toolbox;
 
-  this._netmonitor = new iframeWindow.Netmonitor(toolbox);
+  this._view = this.panelWin.NetMonitorView;
+  this._controller = this.panelWin.NetMonitorController;
+  this._controller._target = this.target;
+  this._controller._toolbox = this._toolbox;
 
   EventEmitter.decorate(this);
 }
 
 exports.NetMonitorPanel = NetMonitorPanel;
 
 NetMonitorPanel.prototype = {
   /**
@@ -38,18 +41,17 @@ NetMonitorPanel.prototype = {
     let deferred = promise.defer();
     this._opening = deferred.promise;
 
     // Local monitoring needs to make the target remote.
     if (!this.target.isRemote) {
       yield this.target.makeRemote();
     }
 
-    yield this._netmonitor.init();
-
+    yield this._controller.startupNetMonitor();
     this.isReady = true;
     this.emit("ready");
 
     deferred.resolve(this);
     return this._opening;
   }),
 
   // DevToolPanel API
@@ -60,15 +62,15 @@ NetMonitorPanel.prototype = {
 
   destroy: Task.async(function* () {
     if (this._destroying) {
       return this._destroying;
     }
     let deferred = promise.defer();
     this._destroying = deferred.promise;
 
-    yield this._netmonitor.destroy();
+    yield this._controller.shutdownNetMonitor();
     this.emit("destroyed");
 
     deferred.resolve();
     return this._destroying;
   })
 };
--- a/devtools/client/netmonitor/performance-statistics-view.js
+++ b/devtools/client/netmonitor/performance-statistics-view.js
@@ -1,27 +1,22 @@
 /* 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/. */
 
-/* eslint-disable mozilla/reject-some-requires */
-/* globals $, window, document, NetMonitorView */
+/* import-globals-from ./netmonitor-controller.js */
+/* globals $ */
 
 "use strict";
 
-const {XPCOMUtils} = require("resource://gre/modules/XPCOMUtils.jsm");
 const {PluralForm} = require("devtools/shared/plural-form");
 const {Filters} = require("./filter-predicates");
 const {L10N} = require("./l10n");
-const {EVENTS} = require("./events");
 const Actions = require("./actions/index");
 
-XPCOMUtils.defineLazyModuleGetter(this, "Chart",
-  "resource://devtools/client/shared/widgets/Chart.jsm");
-
 const REQUEST_TIME_DECIMALS = 2;
 const CONTENT_SIZE_DECIMALS = 2;
 
 // px
 const NETWORK_ANALYSIS_PIE_CHART_DIAMETER = 200;
 
 /**
  * Functions handling the performance statistics view.
--- a/devtools/client/netmonitor/requests-menu-view.js
+++ b/devtools/client/netmonitor/requests-menu-view.js
@@ -1,29 +1,30 @@
 /* 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/. */
 
-/* globals window, dumpn, $, gNetwork, NetMonitorController, NetMonitorView */
+/* eslint-disable mozilla/reject-some-requires */
+/* globals window, dumpn, $, gNetwork, EVENTS, Prefs,
+           NetMonitorController, NetMonitorView */
 
 "use strict";
 
 const { Task } = require("devtools/shared/task");
 const { HTMLTooltip } = require("devtools/client/shared/widgets/tooltip/HTMLTooltip");
 const { setNamedTimeout } = require("devtools/client/shared/widgets/view-helpers");
 const { CurlUtils } = require("devtools/client/shared/curl");
 const { L10N } = require("./l10n");
 const { EVENTS } = require("./events");
 const { createElement, createFactory } = require("devtools/client/shared/vendor/react");
 const ReactDOM = require("devtools/client/shared/vendor/react-dom");
 const { Provider } = require("devtools/client/shared/vendor/react-redux");
 const RequestList = createFactory(require("./components/request-list"));
 const RequestListContextMenu = require("./request-list-context-menu");
 const Actions = require("./actions/index");
-const { Prefs } = require("./prefs");
 
 const {
   formDataURI,
   writeHeaderText,
   loadCauseString
 } = require("./request-utils");
 
 const {
--- a/devtools/client/netmonitor/sidebar-view.js
+++ b/devtools/client/netmonitor/sidebar-view.js
@@ -1,13 +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/. */
 
-/* globals window, dumpn, $, NetMonitorView */
+/* import-globals-from ./netmonitor-controller.js */
+/* globals dumpn, $, NetMonitorView */
 
 "use strict";
 
 const { Task } = require("devtools/shared/task");
 const { EVENTS } = require("./events");
 
 /**
  * Functions handling the sidebar details view.
--- a/devtools/client/netmonitor/test/browser_net_footer-summary.js
+++ b/devtools/client/netmonitor/test/browser_net_footer-summary.js
@@ -8,23 +8,24 @@
  */
 
 add_task(function* () {
   requestLongerTimeout(2);
 
   let { tab, monitor } = yield initNetMonitor(FILTERING_URL);
   info("Starting test... ");
 
-  let { $, NetMonitorView, gStore, windowRequire } = monitor.panelWin;
+  let { $, NetMonitorView, gStore } = monitor.panelWin;
   let { RequestsMenu } = NetMonitorView;
 
+  let winRequire = monitor.panelWin.require;
   let { getDisplayedRequestsSummary } =
-    windowRequire("devtools/client/netmonitor/selectors/index");
-  let { L10N } = windowRequire("devtools/client/netmonitor/l10n");
-  let { PluralForm } = windowRequire("devtools/shared/plural-form");
+    winRequire("devtools/client/netmonitor/selectors/index");
+  let { L10N } = winRequire("devtools/client/netmonitor/l10n");
+  let { PluralForm } = winRequire("devtools/shared/plural-form");
 
   RequestsMenu.lazyUpdate = false;
   testStatus();
 
   for (let i = 0; i < 2; i++) {
     info(`Performing requests in batch #${i}`);
     let wait = waitForNetworkEvents(monitor, 8);
     yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
--- a/devtools/client/netmonitor/test/browser_net_page-nav.js
+++ b/devtools/client/netmonitor/test/browser_net_page-nav.js
@@ -54,16 +54,16 @@ add_task(function* () {
 
   function* testClose() {
     info("Closing...");
 
     let onDestroyed = monitor.once("destroyed");
     removeTab(tab);
     yield onDestroyed;
 
-    ok(!monitor.panelWin.NetMonitorController.client,
+    ok(!monitor._controller.client,
       "There shouldn't be a client available after destruction.");
-    ok(!monitor.panelWin.NetMonitorController.tabClient,
+    ok(!monitor._controller.tabClient,
       "There shouldn't be a tabClient available after destruction.");
-    ok(!monitor.panelWin.NetMonitorController.webConsoleClient,
+    ok(!monitor._controller.webConsoleClient,
       "There shouldn't be a webConsoleClient available after destruction.");
   }
 });
--- a/devtools/client/netmonitor/test/browser_net_simple-init.js
+++ b/devtools/client/netmonitor/test/browser_net_simple-init.js
@@ -17,77 +17,77 @@ function test() {
     info("Starting test... ");
 
     is(tab.linkedBrowser.currentURI.spec, SIMPLE_URL,
       "The current tab's location is the correct one.");
 
     function checkIfInitialized(tag) {
       info(`Checking if initialization is ok (${tag}).`);
 
-      ok(monitor.panelWin.NetMonitorView,
+      ok(monitor._view,
         `The network monitor view object exists (${tag}).`);
-      ok(monitor.panelWin.NetMonitorController,
+      ok(monitor._controller,
         `The network monitor controller object exists (${tag}).`);
-      ok(monitor.panelWin.NetMonitorController._startup,
+      ok(monitor._controller._startup,
         `The network monitor controller object exists and is initialized (${tag}).`);
 
       ok(monitor.isReady,
         `The network monitor panel appears to be ready (${tag}).`);
 
-      ok(monitor.panelWin.NetMonitorController.tabClient,
+      ok(monitor._controller.tabClient,
         `There should be a tabClient available at this point (${tag}).`);
-      ok(monitor.panelWin.NetMonitorController.webConsoleClient,
+      ok(monitor._controller.webConsoleClient,
         `There should be a webConsoleClient available at this point (${tag}).`);
-      ok(monitor.panelWin.NetMonitorController.timelineFront,
+      ok(monitor._controller.timelineFront,
         `There should be a timelineFront available at this point (${tag}).`);
     }
 
     function checkIfDestroyed(tag) {
       gInfo("Checking if destruction is ok.");
 
-      gOk(monitor.panelWin.NetMonitorView,
+      gOk(monitor._view,
         `The network monitor view object still exists (${tag}).`);
-      gOk(monitor.panelWin.NetMonitorController,
+      gOk(monitor._controller,
         `The network monitor controller object still exists (${tag}).`);
-      gOk(monitor.panelWin.NetMonitorController._shutdown,
+      gOk(monitor._controller._shutdown,
         `The network monitor controller object still exists and is destroyed (${tag}).`);
 
-      gOk(!monitor.panelWin.NetMonitorController.tabClient,
+      gOk(!monitor._controller.tabClient,
         `There shouldn't be a tabClient available after destruction (${tag}).`);
-      gOk(!monitor.panelWin.NetMonitorController.webConsoleClient,
+      gOk(!monitor._controller.webConsoleClient,
         `There shouldn't be a webConsoleClient available after destruction (${tag}).`);
-      gOk(!monitor.panelWin.NetMonitorController.timelineFront,
+      gOk(!monitor._controller.timelineFront,
         `There shouldn't be a timelineFront available after destruction (${tag}).`);
     }
 
     executeSoon(() => {
       checkIfInitialized(1);
 
-      monitor.panelWin.NetMonitorController.startupNetMonitor()
+      monitor._controller.startupNetMonitor()
         .then(() => {
           info("Starting up again shouldn't do anything special.");
           checkIfInitialized(2);
-          return monitor.panelWin.NetMonitorController.connect();
+          return monitor._controller.connect();
         })
         .then(() => {
           info("Connecting again shouldn't do anything special.");
           checkIfInitialized(3);
           return teardown(monitor);
         })
         .then(finish);
     });
 
     registerCleanupFunction(() => {
       checkIfDestroyed(1);
 
-      monitor.panelWin.NetMonitorController.shutdownNetMonitor()
+      monitor._controller.shutdownNetMonitor()
         .then(() => {
           gInfo("Shutting down again shouldn't do anything special.");
           checkIfDestroyed(2);
-          return monitor.panelWin.NetMonitorController.disconnect();
+          return monitor._controller.disconnect();
         })
         .then(() => {
           gInfo("Disconnecting again shouldn't do anything special.");
           checkIfDestroyed(3);
         });
     });
   });
 }
--- a/devtools/client/netmonitor/test/browser_net_throttle.js
+++ b/devtools/client/netmonitor/test/browser_net_throttle.js
@@ -27,17 +27,17 @@ function* throttleTest(actuallyThrottle)
       latencyMean: 0,
       latencyMax: 0,
       downloadBPSMean: size,
       downloadBPSMax: size,
       uploadBPSMean: 10000,
       uploadBPSMax: 10000,
     },
   };
-  let client = NetMonitorController.webConsoleClient;
+  let client = monitor._controller.webConsoleClient;
 
   info("sending throttle request");
   let deferred = promise.defer();
   client.setPreferences(request, response => {
     deferred.resolve(response);
   });
   yield deferred.promise;
 
--- a/devtools/client/styleeditor/test/browser_styleeditor_fetch-from-cache.js
+++ b/devtools/client/styleeditor/test/browser_styleeditor_fetch-from-cache.js
@@ -9,31 +9,30 @@
 const TEST_URL = TEST_BASE_HTTP + "doc_uncached.html";
 
 add_task(function* () {
   info("Opening netmonitor");
   let tab = yield addTab("about:blank");
   let target = TargetFactory.forTab(tab);
   let toolbox = yield gDevTools.showToolbox(target, "netmonitor");
   let netmonitor = toolbox.getPanel("netmonitor");
-  let { RequestsMenu } = netmonitor.panelWin.NetMonitorView;
-  RequestsMenu.lazyUpdate = false;
+  netmonitor._view.RequestsMenu.lazyUpdate = false;
 
   info("Navigating to test page");
   yield navigateTo(TEST_URL);
 
   info("Opening Style Editor");
   let styleeditor = yield toolbox.selectTool("styleeditor");
 
   info("Waiting for the source to be loaded.");
   yield styleeditor.UI.editors[0].getSourceEditor();
 
   info("Checking Netmonitor contents.");
   let items = [];
-  for (let item of RequestsMenu.items) {
+  for (let item of netmonitor._view.RequestsMenu.items) {
     if (item.url.endsWith("doc_uncached.css")) {
       items.push(item);
     }
   }
 
   is(items.length, 2,
      "Got two requests for doc_uncached.css after Style Editor was loaded.");
   ok(items[1].fromCache,