Bug 1309866 - Use toolbox loader to load common libs into Netmonitor r=Honza

MozReview-Commit-ID: nENUb4FV61

--HG--
extra : rebase_source : cd462745c8f72091a9b42261e9a7c514ff1496f5
This commit is contained in:
Jarda Snajdr 2016-11-23 16:49:44 +01:00
Родитель 2df219dc2b
Коммит b524278047
18 изменённых файлов: 151 добавлений и 110 удалений

Просмотреть файл

@ -14,8 +14,7 @@ devtools.jar:
content/projecteditor/chrome/content/projecteditor-test.xul (projecteditor/chrome/content/projecteditor-test.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/projecteditor/chrome/content/projecteditor-loader.js (projecteditor/chrome/content/projecteditor-loader.js)
content/netmonitor/netmonitor.xul (netmonitor/netmonitor.xul) content/netmonitor/netmonitor.xul (netmonitor/netmonitor.xul)
content/netmonitor/netmonitor-controller.js (netmonitor/netmonitor-controller.js) content/netmonitor/netmonitor.js (netmonitor/netmonitor.js)
content/netmonitor/netmonitor-view.js (netmonitor/netmonitor-view.js)
content/webconsole/webconsole.xul (webconsole/webconsole.xul) content/webconsole/webconsole.xul (webconsole/webconsole.xul)
* content/scratchpad/scratchpad.xul (scratchpad/scratchpad.xul) * content/scratchpad/scratchpad.xul (scratchpad/scratchpad.xul)
content/scratchpad/scratchpad.js (scratchpad/scratchpad.js) content/scratchpad/scratchpad.js (scratchpad/scratchpad.js)

Просмотреть файл

@ -30,4 +30,21 @@ const actionTypes = {
WATERFALL_RESIZE: "WATERFALL_RESIZE", 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);

Просмотреть файл

@ -2,14 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* import-globals-from ./netmonitor-controller.js */
/* eslint-disable mozilla/reject-some-requires */ /* eslint-disable mozilla/reject-some-requires */
/* globals dumpn, $, NetMonitorView, gNetwork */ /* globals window, dumpn, $, NetMonitorView, gNetwork */
"use strict"; "use strict";
const promise = require("promise"); const promise = require("promise");
const EventEmitter = require("devtools/shared/event-emitter"); const EventEmitter = require("devtools/shared/event-emitter");
const Editor = require("devtools/client/sourceeditor/editor");
const { Heritage } = require("devtools/client/shared/widgets/view-helpers"); const { Heritage } = require("devtools/client/shared/widgets/view-helpers");
const { Task } = require("devtools/shared/task"); const { Task } = require("devtools/shared/task");
const { ToolSidebar } = require("devtools/client/framework/sidebar"); const { ToolSidebar } = require("devtools/client/framework/sidebar");

Просмотреть файл

@ -16,7 +16,7 @@ function* throttleUploadTest(actuallyThrottle) {
info("Starting test... (actuallyThrottle = " + actuallyThrottle + ")"); info("Starting test... (actuallyThrottle = " + actuallyThrottle + ")");
let { NetMonitorView } = monitor.panelWin; let { NetMonitorController, NetMonitorView } = monitor.panelWin;
let { RequestsMenu } = NetMonitorView; let { RequestsMenu } = NetMonitorView;
const size = 4096; const size = 4096;
@ -32,7 +32,7 @@ function* throttleUploadTest(actuallyThrottle) {
uploadBPSMax: uploadSize, uploadBPSMax: uploadSize,
}, },
}; };
let client = monitor._controller.webConsoleClient; let client = NetMonitorController.webConsoleClient;
info("sending throttle request"); info("sending throttle request");
let deferred = promise.defer(); let deferred = promise.defer();

Просмотреть файл

@ -19,6 +19,8 @@ DevToolsModules(
'events.js', 'events.js',
'filter-predicates.js', 'filter-predicates.js',
'l10n.js', 'l10n.js',
'netmonitor-controller.js',
'netmonitor-view.js',
'panel.js', 'panel.js',
'performance-statistics-view.js', 'performance-statistics-view.js',
'prefs.js', 'prefs.js',

Просмотреть файл

@ -3,37 +3,10 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* eslint-disable mozilla/reject-some-requires */ /* eslint-disable mozilla/reject-some-requires */
/* globals window, NetMonitorView, gStore, Actions */ /* globals window, NetMonitorView, gStore, dumpn */
/* exported loader */
"use strict"; "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 promise = require("promise");
const Services = require("Services"); const Services = require("Services");
const {XPCOMUtils} = require("resource://gre/modules/XPCOMUtils.jsm"); const {XPCOMUtils} = require("resource://gre/modules/XPCOMUtils.jsm");
@ -41,17 +14,23 @@ const EventEmitter = require("devtools/shared/event-emitter");
const Editor = require("devtools/client/sourceeditor/editor"); const Editor = require("devtools/client/sourceeditor/editor");
const {TimelineFront} = require("devtools/shared/fronts/timeline"); const {TimelineFront} = require("devtools/shared/fronts/timeline");
const {Task} = require("devtools/shared/task"); const {Task} = require("devtools/shared/task");
const { ACTIVITY_TYPE } = require("./constants");
const { EVENTS } = require("./events"); const { EVENTS } = require("./events");
const { configureStore } = require("./store");
const Actions = require("./actions/index"); const Actions = require("./actions/index");
const { getDisplayedRequestById } = require("./selectors/index"); const { getDisplayedRequestById } = require("./selectors/index");
const { Prefs } = require("./prefs");
XPCOMUtils.defineConstant(this, "EVENTS", EVENTS); XPCOMUtils.defineConstant(window, "EVENTS", EVENTS);
XPCOMUtils.defineConstant(this, "ACTIVITY_TYPE", ACTIVITY_TYPE); XPCOMUtils.defineConstant(window, "ACTIVITY_TYPE", ACTIVITY_TYPE);
XPCOMUtils.defineConstant(this, "Editor", Editor); XPCOMUtils.defineConstant(window, "Editor", Editor);
XPCOMUtils.defineConstant(window, "Prefs", Prefs);
XPCOMUtils.defineLazyModuleGetter(this, "Chart", XPCOMUtils.defineLazyModuleGetter(window, "Chart",
"resource://devtools/client/shared/widgets/Chart.jsm"); "resource://devtools/client/shared/widgets/Chart.jsm");
// Initialize the global Redux store
window.gStore = configureStore();
/** /**
* Object defining the network monitor controller components. * Object defining the network monitor controller components.
*/ */
@ -739,7 +718,7 @@ NetworkEventsHandler.prototype = {
/** /**
* Convenient way of emitting events from the panel window. * Convenient way of emitting events from the panel window.
*/ */
EventEmitter.decorate(this); EventEmitter.decorate(window);
/** /**
* Preliminary setup for the NetMonitorController object. * Preliminary setup for the NetMonitorController object.
@ -759,14 +738,4 @@ Object.defineProperties(window, {
} }
}); });
/** 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");

Просмотреть файл

@ -2,26 +2,25 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* import-globals-from ./netmonitor-controller.js */
/* eslint-disable mozilla/reject-some-requires */ /* eslint-disable mozilla/reject-some-requires */
/* globals Prefs, setInterval, setTimeout, clearInterval, clearTimeout, btoa */ /* globals $, gStore, NetMonitorController, dumpn */
/* exported $, $all */
"use strict"; "use strict";
const { testing: isTesting } = require("devtools/shared/flags"); 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 { ViewHelpers } = require("devtools/client/shared/widgets/view-helpers");
const { configureStore } = require("./store");
const { RequestsMenuView } = require("./requests-menu-view"); const { RequestsMenuView } = require("./requests-menu-view");
const { CustomRequestView } = require("./custom-request-view"); const { CustomRequestView } = require("./custom-request-view");
const { ToolbarView } = require("./toolbar-view"); const { ToolbarView } = require("./toolbar-view");
const { SidebarView } = require("./sidebar-view"); const { SidebarView } = require("./sidebar-view");
const { DetailsView } = require("./details-view"); const { DetailsView } = require("./details-view");
const { PerformanceStatisticsView } = require("./performance-statistics-view"); const { PerformanceStatisticsView } = require("./performance-statistics-view");
var {Prefs} = require("./prefs"); const { ACTIVITY_TYPE } = require("./constants");
const Actions = require("./actions/index");
// Initialize the global redux variables const { Prefs } = require("./prefs");
var gStore = configureStore();
// ms // ms
const WDA_DEFAULT_VERIFY_INTERVAL = 50; const WDA_DEFAULT_VERIFY_INTERVAL = 50;
@ -236,13 +235,6 @@ var NetMonitorView = {
_editorPromises: new Map() _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. * Makes sure certain properties are available on all objects in a data store.
* *
@ -287,3 +279,5 @@ NetMonitorView.NetworkDetails = new DetailsView();
NetMonitorView.RequestsMenu = new RequestsMenuView(); NetMonitorView.RequestsMenu = new RequestsMenuView();
NetMonitorView.CustomRequest = new CustomRequestView(); NetMonitorView.CustomRequest = new CustomRequestView();
NetMonitorView.PerformanceStatistics = new PerformanceStatisticsView(); NetMonitorView.PerformanceStatistics = new PerformanceStatisticsView();
exports.NetMonitorView = NetMonitorView;

Просмотреть файл

@ -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");

Просмотреть файл

@ -12,8 +12,7 @@
<script type="application/javascript;version=1.8" <script type="application/javascript;version=1.8"
src="chrome://devtools/content/shared/theme-switching.js"/> src="chrome://devtools/content/shared/theme-switching.js"/>
<script type="text/javascript" src="netmonitor-controller.js"/> <script type="text/javascript" src="netmonitor.js"/>
<script type="text/javascript" src="netmonitor-view.js"/>
<deck id="body" <deck id="body"
class="theme-sidebar" class="theme-sidebar"

Просмотреть файл

@ -14,10 +14,7 @@ function NetMonitorPanel(iframeWindow, toolbox) {
this.panelDoc = iframeWindow.document; this.panelDoc = iframeWindow.document;
this._toolbox = toolbox; this._toolbox = toolbox;
this._view = this.panelWin.NetMonitorView; this._netmonitor = new iframeWindow.Netmonitor(toolbox);
this._controller = this.panelWin.NetMonitorController;
this._controller._target = this.target;
this._controller._toolbox = this._toolbox;
EventEmitter.decorate(this); EventEmitter.decorate(this);
} }
@ -46,7 +43,8 @@ NetMonitorPanel.prototype = {
yield this.target.makeRemote(); yield this.target.makeRemote();
} }
yield this._controller.startupNetMonitor(); yield this._netmonitor.init();
this.isReady = true; this.isReady = true;
this.emit("ready"); this.emit("ready");
@ -67,7 +65,7 @@ NetMonitorPanel.prototype = {
let deferred = promise.defer(); let deferred = promise.defer();
this._destroying = deferred.promise; this._destroying = deferred.promise;
yield this._controller.shutdownNetMonitor(); yield this._netmonitor.destroy();
this.emit("destroyed"); this.emit("destroyed");
deferred.resolve(); deferred.resolve();

Просмотреть файл

@ -2,16 +2,21 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * 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 $ */ /* globals $, window, document, NetMonitorView */
"use strict"; "use strict";
const {XPCOMUtils} = require("resource://gre/modules/XPCOMUtils.jsm");
const {PluralForm} = require("devtools/shared/plural-form"); const {PluralForm} = require("devtools/shared/plural-form");
const {Filters} = require("./filter-predicates"); const {Filters} = require("./filter-predicates");
const {L10N} = require("./l10n"); const {L10N} = require("./l10n");
const {EVENTS} = require("./events");
const Actions = require("./actions/index"); const Actions = require("./actions/index");
XPCOMUtils.defineLazyModuleGetter(this, "Chart",
"resource://devtools/client/shared/widgets/Chart.jsm");
const REQUEST_TIME_DECIMALS = 2; const REQUEST_TIME_DECIMALS = 2;
const CONTENT_SIZE_DECIMALS = 2; const CONTENT_SIZE_DECIMALS = 2;

Просмотреть файл

@ -2,9 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* eslint-disable mozilla/reject-some-requires */ /* globals window, dumpn, $, gNetwork, NetMonitorController, NetMonitorView */
/* globals window, dumpn, $, gNetwork, EVENTS, Prefs,
NetMonitorController, NetMonitorView */
"use strict"; "use strict";
@ -20,6 +18,7 @@ const { Provider } = require("devtools/client/shared/vendor/react-redux");
const RequestList = createFactory(require("./components/request-list")); const RequestList = createFactory(require("./components/request-list"));
const RequestListContextMenu = require("./request-list-context-menu"); const RequestListContextMenu = require("./request-list-context-menu");
const Actions = require("./actions/index"); const Actions = require("./actions/index");
const { Prefs } = require("./prefs");
const { const {
formDataURI, formDataURI,

Просмотреть файл

@ -2,8 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* import-globals-from ./netmonitor-controller.js */ /* globals window, dumpn, $, NetMonitorView */
/* globals dumpn, $, NetMonitorView */
"use strict"; "use strict";

Просмотреть файл

@ -13,14 +13,13 @@ add_task(function* () {
let { tab, monitor } = yield initNetMonitor(FILTERING_URL); let { tab, monitor } = yield initNetMonitor(FILTERING_URL);
info("Starting test... "); info("Starting test... ");
let { $, NetMonitorView, gStore } = monitor.panelWin; let { $, NetMonitorView, gStore, windowRequire } = monitor.panelWin;
let { RequestsMenu } = NetMonitorView; let { RequestsMenu } = NetMonitorView;
let winRequire = monitor.panelWin.require;
let { getDisplayedRequestsSummary } = let { getDisplayedRequestsSummary } =
winRequire("devtools/client/netmonitor/selectors/index"); windowRequire("devtools/client/netmonitor/selectors/index");
let { L10N } = winRequire("devtools/client/netmonitor/l10n"); let { L10N } = windowRequire("devtools/client/netmonitor/l10n");
let { PluralForm } = winRequire("devtools/shared/plural-form"); let { PluralForm } = windowRequire("devtools/shared/plural-form");
RequestsMenu.lazyUpdate = false; RequestsMenu.lazyUpdate = false;
testStatus(); testStatus();

Просмотреть файл

@ -59,11 +59,11 @@ add_task(function* () {
removeTab(tab); removeTab(tab);
yield onDestroyed; yield onDestroyed;
ok(!monitor._controller.client, ok(!monitor.panelWin.NetMonitorController.client,
"There shouldn't be a client available after destruction."); "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."); "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."); "There shouldn't be a webConsoleClient available after destruction.");
} }
}); });

Просмотреть файл

@ -22,50 +22,50 @@ function test() {
function checkIfInitialized(tag) { function checkIfInitialized(tag) {
info(`Checking if initialization is ok (${tag}).`); info(`Checking if initialization is ok (${tag}).`);
ok(monitor._view, ok(monitor.panelWin.NetMonitorView,
`The network monitor view object exists (${tag}).`); `The network monitor view object exists (${tag}).`);
ok(monitor._controller, ok(monitor.panelWin.NetMonitorController,
`The network monitor controller object exists (${tag}).`); `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}).`); `The network monitor controller object exists and is initialized (${tag}).`);
ok(monitor.isReady, ok(monitor.isReady,
`The network monitor panel appears to be ready (${tag}).`); `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}).`); `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}).`); `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}).`); `There should be a timelineFront available at this point (${tag}).`);
} }
function checkIfDestroyed(tag) { function checkIfDestroyed(tag) {
gInfo("Checking if destruction is ok."); gInfo("Checking if destruction is ok.");
gOk(monitor._view, gOk(monitor.panelWin.NetMonitorView,
`The network monitor view object still exists (${tag}).`); `The network monitor view object still exists (${tag}).`);
gOk(monitor._controller, gOk(monitor.panelWin.NetMonitorController,
`The network monitor controller object still exists (${tag}).`); `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}).`); `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}).`); `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}).`); `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}).`); `There shouldn't be a timelineFront available after destruction (${tag}).`);
} }
executeSoon(() => { executeSoon(() => {
checkIfInitialized(1); checkIfInitialized(1);
monitor._controller.startupNetMonitor() monitor.panelWin.NetMonitorController.startupNetMonitor()
.then(() => { .then(() => {
info("Starting up again shouldn't do anything special."); info("Starting up again shouldn't do anything special.");
checkIfInitialized(2); checkIfInitialized(2);
return monitor._controller.connect(); return monitor.panelWin.NetMonitorController.connect();
}) })
.then(() => { .then(() => {
info("Connecting again shouldn't do anything special."); info("Connecting again shouldn't do anything special.");
@ -78,11 +78,11 @@ function test() {
registerCleanupFunction(() => { registerCleanupFunction(() => {
checkIfDestroyed(1); checkIfDestroyed(1);
monitor._controller.shutdownNetMonitor() monitor.panelWin.NetMonitorController.shutdownNetMonitor()
.then(() => { .then(() => {
gInfo("Shutting down again shouldn't do anything special."); gInfo("Shutting down again shouldn't do anything special.");
checkIfDestroyed(2); checkIfDestroyed(2);
return monitor._controller.disconnect(); return monitor.panelWin.NetMonitorController.disconnect();
}) })
.then(() => { .then(() => {
gInfo("Disconnecting again shouldn't do anything special."); gInfo("Disconnecting again shouldn't do anything special.");

Просмотреть файл

@ -32,7 +32,7 @@ function* throttleTest(actuallyThrottle) {
uploadBPSMax: 10000, uploadBPSMax: 10000,
}, },
}; };
let client = monitor._controller.webConsoleClient; let client = NetMonitorController.webConsoleClient;
info("sending throttle request"); info("sending throttle request");
let deferred = promise.defer(); let deferred = promise.defer();

Просмотреть файл

@ -14,7 +14,8 @@ add_task(function* () {
let target = TargetFactory.forTab(tab); let target = TargetFactory.forTab(tab);
let toolbox = yield gDevTools.showToolbox(target, "netmonitor"); let toolbox = yield gDevTools.showToolbox(target, "netmonitor");
let netmonitor = toolbox.getPanel("netmonitor"); let netmonitor = toolbox.getPanel("netmonitor");
netmonitor._view.RequestsMenu.lazyUpdate = false; let { RequestsMenu } = netmonitor.panelWin.NetMonitorView;
RequestsMenu.lazyUpdate = false;
info("Navigating to test page"); info("Navigating to test page");
yield navigateTo(TEST_URL); yield navigateTo(TEST_URL);
@ -27,7 +28,7 @@ add_task(function* () {
info("Checking Netmonitor contents."); info("Checking Netmonitor contents.");
let items = []; let items = [];
for (let item of netmonitor._view.RequestsMenu.items) { for (let item of RequestsMenu.items) {
if (item.url.endsWith("doc_uncached.css")) { if (item.url.endsWith("doc_uncached.css")) {
items.push(item); items.push(item);
} }