--- a/devtools/client/jar.mn
+++ b/devtools/client/jar.mn
@@ -9,18 +9,17 @@ 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-controller.js (netmonitor/netmonitor-controller.js)
- content/netmonitor/netmonitor-view.js (netmonitor/netmonitor-view.js)
+ content/netmonitor/netmonitor.js (netmonitor/netmonitor.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,9 +25,26 @@ 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",
};
-module.exports = Object.assign({}, general, actionTypes);
+// 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);
--- 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 dumpn, $, NetMonitorView, gNetwork */
+/* globals window, 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 { NetMonitorView } = monitor.panelWin;
+ let { NetMonitorController, 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 = monitor._controller.webConsoleClient;
+ let client = NetMonitorController.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,16 +14,18 @@ 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,61 +1,40 @@
/* 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, Actions */
-/* exported loader */
+/* globals window, NetMonitorView, gStore, dumpn */
"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 {EVENTS} = require("./events");
+const { ACTIVITY_TYPE } = require("./constants");
+const { EVENTS } = require("./events");
+const { configureStore } = require("./store");
const Actions = require("./actions/index");
const { getDisplayedRequestById } = require("./selectors/index");
+const { Prefs } = require("./prefs");
-XPCOMUtils.defineConstant(this, "EVENTS", EVENTS);
-XPCOMUtils.defineConstant(this, "ACTIVITY_TYPE", ACTIVITY_TYPE);
-XPCOMUtils.defineConstant(this, "Editor", Editor);
+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",
+ "resource://devtools/client/shared/widgets/Chart.jsm");
-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.
*
@@ -734,17 +713,17 @@ NetworkEventsHandler.prototype = {
getString: function (stringGrip) {
return this.webConsoleClient.getString(stringGrip);
}
};
/**
* Convenient way of emitting events from the panel window.
*/
-EventEmitter.decorate(this);
+EventEmitter.decorate(window);
/**
* Preliminary setup for the NetMonitorController object.
*/
NetMonitorController.TargetEventsHandler = new TargetEventsHandler();
NetMonitorController.NetworkEventsHandler = new NetworkEventsHandler();
/**
@@ -754,19 +733,9 @@ Object.defineProperties(window, {
"gNetwork": {
get: function () {
return NetMonitorController.NetworkEventsHandler;
},
configurable: true
}
});
-/**
- * Helper method for debugging.
- * @param string
- */
-function dumpn(str) {
- if (wantLogging) {
- dump("NET-FRONTEND: " + str + "\n");
- }
-}
-
-var wantLogging = Services.prefs.getBoolPref("devtools.debugger.log");
+exports.NetMonitorController = NetMonitorController;
--- a/devtools/client/netmonitor/netmonitor-view.js
+++ b/devtools/client/netmonitor/netmonitor-view.js
@@ -1,32 +1,31 @@
/* 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 Prefs, setInterval, setTimeout, clearInterval, clearTimeout, btoa */
-/* exported $, $all */
+/* globals $, gStore, NetMonitorController, dumpn */
"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");
-var {Prefs} = require("./prefs");
-
-// Initialize the global redux variables
-var gStore = configureStore();
+const { ACTIVITY_TYPE } = require("./constants");
+const Actions = require("./actions/index");
+const { Prefs } = require("./prefs");
// 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.
@@ -232,23 +231,16 @@ 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
@@ -282,8 +274,10 @@ 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;
new file mode 100644
--- /dev/null
+++ b/devtools/client/netmonitor/netmonitor.js
@@ -0,0 +1,60 @@
+/* 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,18 +7,17 @@
<?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-controller.js"/>
- <script type="text/javascript" src="netmonitor-view.js"/>
+ <script type="text/javascript" src="netmonitor.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,20 +9,17 @@ 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._view = this.panelWin.NetMonitorView;
- this._controller = this.panelWin.NetMonitorController;
- this._controller._target = this.target;
- this._controller._toolbox = this._toolbox;
+ this._netmonitor = new iframeWindow.Netmonitor(toolbox);
EventEmitter.decorate(this);
}
exports.NetMonitorPanel = NetMonitorPanel;
NetMonitorPanel.prototype = {
/**
@@ -41,17 +38,18 @@ 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._controller.startupNetMonitor();
+ yield this._netmonitor.init();
+
this.isReady = true;
this.emit("ready");
deferred.resolve(this);
return this._opening;
}),
// DevToolPanel API
@@ -62,15 +60,15 @@ NetMonitorPanel.prototype = {
destroy: Task.async(function* () {
if (this._destroying) {
return this._destroying;
}
let deferred = promise.defer();
this._destroying = deferred.promise;
- yield this._controller.shutdownNetMonitor();
+ yield this._netmonitor.destroy();
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,22 +1,27 @@
/* 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 */
-/* globals $ */
+/* eslint-disable mozilla/reject-some-requires */
+/* globals $, window, document, NetMonitorView */
"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,30 +1,29 @@
/* 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, dumpn, $, gNetwork, EVENTS, Prefs,
- NetMonitorController, NetMonitorView */
+/* globals window, dumpn, $, gNetwork, 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,14 +1,13 @@
/* 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 */
-/* globals dumpn, $, NetMonitorView */
+/* globals window, 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,24 +8,23 @@
*/
add_task(function* () {
requestLongerTimeout(2);
let { tab, monitor } = yield initNetMonitor(FILTERING_URL);
info("Starting test... ");
- let { $, NetMonitorView, gStore } = monitor.panelWin;
+ let { $, NetMonitorView, gStore, windowRequire } = monitor.panelWin;
let { RequestsMenu } = NetMonitorView;
- let winRequire = monitor.panelWin.require;
let { getDisplayedRequestsSummary } =
- winRequire("devtools/client/netmonitor/selectors/index");
- let { L10N } = winRequire("devtools/client/netmonitor/l10n");
- let { PluralForm } = winRequire("devtools/shared/plural-form");
+ windowRequire("devtools/client/netmonitor/selectors/index");
+ let { L10N } = windowRequire("devtools/client/netmonitor/l10n");
+ let { PluralForm } = windowRequire("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._controller.client,
+ ok(!monitor.panelWin.NetMonitorController.client,
"There shouldn't be a client available after destruction.");
- ok(!monitor._controller.tabClient,
+ ok(!monitor.panelWin.NetMonitorController.tabClient,
"There shouldn't be a tabClient available after destruction.");
- ok(!monitor._controller.webConsoleClient,
+ ok(!monitor.panelWin.NetMonitorController.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._view,
+ ok(monitor.panelWin.NetMonitorView,
`The network monitor view object exists (${tag}).`);
- ok(monitor._controller,
+ ok(monitor.panelWin.NetMonitorController,
`The network monitor controller object exists (${tag}).`);
- ok(monitor._controller._startup,
+ ok(monitor.panelWin.NetMonitorController._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._controller.tabClient,
+ ok(monitor.panelWin.NetMonitorController.tabClient,
`There should be a tabClient available at this point (${tag}).`);
- ok(monitor._controller.webConsoleClient,
+ ok(monitor.panelWin.NetMonitorController.webConsoleClient,
`There should be a webConsoleClient available at this point (${tag}).`);
- ok(monitor._controller.timelineFront,
+ ok(monitor.panelWin.NetMonitorController.timelineFront,
`There should be a timelineFront available at this point (${tag}).`);
}
function checkIfDestroyed(tag) {
gInfo("Checking if destruction is ok.");
- gOk(monitor._view,
+ gOk(monitor.panelWin.NetMonitorView,
`The network monitor view object still exists (${tag}).`);
- gOk(monitor._controller,
+ gOk(monitor.panelWin.NetMonitorController,
`The network monitor controller object still exists (${tag}).`);
- gOk(monitor._controller._shutdown,
+ gOk(monitor.panelWin.NetMonitorController._shutdown,
`The network monitor controller object still exists and is destroyed (${tag}).`);
- gOk(!monitor._controller.tabClient,
+ gOk(!monitor.panelWin.NetMonitorController.tabClient,
`There shouldn't be a tabClient available after destruction (${tag}).`);
- gOk(!monitor._controller.webConsoleClient,
+ gOk(!monitor.panelWin.NetMonitorController.webConsoleClient,
`There shouldn't be a webConsoleClient available after destruction (${tag}).`);
- gOk(!monitor._controller.timelineFront,
+ gOk(!monitor.panelWin.NetMonitorController.timelineFront,
`There shouldn't be a timelineFront available after destruction (${tag}).`);
}
executeSoon(() => {
checkIfInitialized(1);
- monitor._controller.startupNetMonitor()
+ monitor.panelWin.NetMonitorController.startupNetMonitor()
.then(() => {
info("Starting up again shouldn't do anything special.");
checkIfInitialized(2);
- return monitor._controller.connect();
+ return monitor.panelWin.NetMonitorController.connect();
})
.then(() => {
info("Connecting again shouldn't do anything special.");
checkIfInitialized(3);
return teardown(monitor);
})
.then(finish);
});
registerCleanupFunction(() => {
checkIfDestroyed(1);
- monitor._controller.shutdownNetMonitor()
+ monitor.panelWin.NetMonitorController.shutdownNetMonitor()
.then(() => {
gInfo("Shutting down again shouldn't do anything special.");
checkIfDestroyed(2);
- return monitor._controller.disconnect();
+ return monitor.panelWin.NetMonitorController.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 = monitor._controller.webConsoleClient;
+ let client = NetMonitorController.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,30 +9,31 @@
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");
- netmonitor._view.RequestsMenu.lazyUpdate = false;
+ let { RequestsMenu } = netmonitor.panelWin.NetMonitorView;
+ 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 netmonitor._view.RequestsMenu.items) {
+ for (let item of 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,