--- a/devtools/client/netmonitor/constants.js
+++ b/devtools/client/netmonitor/constants.js
@@ -1,20 +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 general = {
- FILTER_SEARCH_DELAY: 200,
- // 100 KB in bytes
- SOURCE_SYNTAX_HIGHLIGHT_MAX_FILE_SIZE: 102400,
-};
-
const actionTypes = {
ADD_REQUEST: "ADD_REQUEST",
ADD_TIMING_MARKER: "ADD_TIMING_MARKER",
BATCH_ACTIONS: "BATCH_ACTIONS",
BATCH_ENABLE: "BATCH_ENABLE",
CLEAR_REQUESTS: "CLEAR_REQUESTS",
CLEAR_TIMING_MARKERS: "CLEAR_TIMING_MARKERS",
CLONE_SELECTED_REQUEST: "CLONE_SELECTED_REQUEST",
@@ -44,9 +38,83 @@ const ACTIVITY_TYPE = {
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);
+// The panel's window global is an EventEmitter firing the following events:
+const EVENTS = {
+ // When the monitored target begins and finishes navigating.
+ TARGET_WILL_NAVIGATE: "NetMonitor:TargetWillNavigate",
+ TARGET_DID_NAVIGATE: "NetMonitor:TargetNavigate",
+
+ // When a network or timeline event is received.
+ // See https://developer.mozilla.org/docs/Tools/Web_Console/remoting for
+ // more information about what each packet is supposed to deliver.
+ NETWORK_EVENT: "NetMonitor:NetworkEvent",
+ TIMELINE_EVENT: "NetMonitor:TimelineEvent",
+
+ // When a network event is added to the view
+ REQUEST_ADDED: "NetMonitor:RequestAdded",
+
+ // When request headers begin and finish receiving.
+ UPDATING_REQUEST_HEADERS: "NetMonitor:NetworkEventUpdating:RequestHeaders",
+ RECEIVED_REQUEST_HEADERS: "NetMonitor:NetworkEventUpdated:RequestHeaders",
+
+ // When request cookies begin and finish receiving.
+ UPDATING_REQUEST_COOKIES: "NetMonitor:NetworkEventUpdating:RequestCookies",
+ RECEIVED_REQUEST_COOKIES: "NetMonitor:NetworkEventUpdated:RequestCookies",
+
+ // When request post data begins and finishes receiving.
+ UPDATING_REQUEST_POST_DATA: "NetMonitor:NetworkEventUpdating:RequestPostData",
+ RECEIVED_REQUEST_POST_DATA: "NetMonitor:NetworkEventUpdated:RequestPostData",
+
+ // When security information begins and finishes receiving.
+ UPDATING_SECURITY_INFO: "NetMonitor::NetworkEventUpdating:SecurityInfo",
+ RECEIVED_SECURITY_INFO: "NetMonitor::NetworkEventUpdated:SecurityInfo",
+
+ // When response headers begin and finish receiving.
+ UPDATING_RESPONSE_HEADERS: "NetMonitor:NetworkEventUpdating:ResponseHeaders",
+ RECEIVED_RESPONSE_HEADERS: "NetMonitor:NetworkEventUpdated:ResponseHeaders",
+
+ // When response cookies begin and finish receiving.
+ UPDATING_RESPONSE_COOKIES: "NetMonitor:NetworkEventUpdating:ResponseCookies",
+ RECEIVED_RESPONSE_COOKIES: "NetMonitor:NetworkEventUpdated:ResponseCookies",
+
+ // When event timings begin and finish receiving.
+ UPDATING_EVENT_TIMINGS: "NetMonitor:NetworkEventUpdating:EventTimings",
+ RECEIVED_EVENT_TIMINGS: "NetMonitor:NetworkEventUpdated:EventTimings",
+
+ // When response content begins, updates and finishes receiving.
+ STARTED_RECEIVING_RESPONSE: "NetMonitor:NetworkEventUpdating:ResponseStart",
+ UPDATING_RESPONSE_CONTENT: "NetMonitor:NetworkEventUpdating:ResponseContent",
+ RECEIVED_RESPONSE_CONTENT: "NetMonitor:NetworkEventUpdated:ResponseContent",
+
+ // When the request post params are displayed in the UI.
+ REQUEST_POST_PARAMS_DISPLAYED: "NetMonitor:RequestPostParamsAvailable",
+
+ // When the image response thumbnail is displayed in the UI.
+ RESPONSE_IMAGE_THUMBNAIL_DISPLAYED:
+ "NetMonitor:ResponseImageThumbnailAvailable",
+
+ // Fired when charts have been displayed in the PerformanceStatisticsView.
+ PLACEHOLDER_CHARTS_DISPLAYED: "NetMonitor:PlaceholderChartsDisplayed",
+ PRIMED_CACHE_CHART_DISPLAYED: "NetMonitor:PrimedChartsDisplayed",
+ EMPTY_CACHE_CHART_DISPLAYED: "NetMonitor:EmptyChartsDisplayed",
+
+ // Fired once the NetMonitorController establishes a connection to the debug
+ // target.
+ CONNECTED: "connected",
+};
+
+const general = {
+ ACTIVITY_TYPE,
+ EVENTS,
+ FILTER_SEARCH_DELAY: 200,
+ // 100 KB in bytes
+ SOURCE_SYNTAX_HIGHLIGHT_MAX_FILE_SIZE: 102400,
+};
+
+// flatten constants
+module.exports = Object.assign({}, general, actionTypes);
deleted file mode 100644
--- a/devtools/client/netmonitor/events.js
+++ /dev/null
@@ -1,72 +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/. */
-
-"use strict";
-
-// The panel's window global is an EventEmitter firing the following events:
-const EVENTS = {
- // When the monitored target begins and finishes navigating.
- TARGET_WILL_NAVIGATE: "NetMonitor:TargetWillNavigate",
- TARGET_DID_NAVIGATE: "NetMonitor:TargetNavigate",
-
- // When a network or timeline event is received.
- // See https://developer.mozilla.org/docs/Tools/Web_Console/remoting for
- // more information about what each packet is supposed to deliver.
- NETWORK_EVENT: "NetMonitor:NetworkEvent",
- TIMELINE_EVENT: "NetMonitor:TimelineEvent",
-
- // When a network event is added to the view
- REQUEST_ADDED: "NetMonitor:RequestAdded",
-
- // When request headers begin and finish receiving.
- UPDATING_REQUEST_HEADERS: "NetMonitor:NetworkEventUpdating:RequestHeaders",
- RECEIVED_REQUEST_HEADERS: "NetMonitor:NetworkEventUpdated:RequestHeaders",
-
- // When request cookies begin and finish receiving.
- UPDATING_REQUEST_COOKIES: "NetMonitor:NetworkEventUpdating:RequestCookies",
- RECEIVED_REQUEST_COOKIES: "NetMonitor:NetworkEventUpdated:RequestCookies",
-
- // When request post data begins and finishes receiving.
- UPDATING_REQUEST_POST_DATA: "NetMonitor:NetworkEventUpdating:RequestPostData",
- RECEIVED_REQUEST_POST_DATA: "NetMonitor:NetworkEventUpdated:RequestPostData",
-
- // When security information begins and finishes receiving.
- UPDATING_SECURITY_INFO: "NetMonitor::NetworkEventUpdating:SecurityInfo",
- RECEIVED_SECURITY_INFO: "NetMonitor::NetworkEventUpdated:SecurityInfo",
-
- // When response headers begin and finish receiving.
- UPDATING_RESPONSE_HEADERS: "NetMonitor:NetworkEventUpdating:ResponseHeaders",
- RECEIVED_RESPONSE_HEADERS: "NetMonitor:NetworkEventUpdated:ResponseHeaders",
-
- // When response cookies begin and finish receiving.
- UPDATING_RESPONSE_COOKIES: "NetMonitor:NetworkEventUpdating:ResponseCookies",
- RECEIVED_RESPONSE_COOKIES: "NetMonitor:NetworkEventUpdated:ResponseCookies",
-
- // When event timings begin and finish receiving.
- UPDATING_EVENT_TIMINGS: "NetMonitor:NetworkEventUpdating:EventTimings",
- RECEIVED_EVENT_TIMINGS: "NetMonitor:NetworkEventUpdated:EventTimings",
-
- // When response content begins, updates and finishes receiving.
- STARTED_RECEIVING_RESPONSE: "NetMonitor:NetworkEventUpdating:ResponseStart",
- UPDATING_RESPONSE_CONTENT: "NetMonitor:NetworkEventUpdating:ResponseContent",
- RECEIVED_RESPONSE_CONTENT: "NetMonitor:NetworkEventUpdated:ResponseContent",
-
- // When the request post params are displayed in the UI.
- REQUEST_POST_PARAMS_DISPLAYED: "NetMonitor:RequestPostParamsAvailable",
-
- // When the image response thumbnail is displayed in the UI.
- RESPONSE_IMAGE_THUMBNAIL_DISPLAYED:
- "NetMonitor:ResponseImageThumbnailAvailable",
-
- // Fired when charts have been displayed in the PerformanceStatisticsView.
- PLACEHOLDER_CHARTS_DISPLAYED: "NetMonitor:PlaceholderChartsDisplayed",
- PRIMED_CACHE_CHART_DISPLAYED: "NetMonitor:PrimedChartsDisplayed",
- EMPTY_CACHE_CHART_DISPLAYED: "NetMonitor:EmptyChartsDisplayed",
-
- // Fired once the NetMonitorController establishes a connection to the debug
- // target.
- CONNECTED: "connected",
-};
-
-exports.EVENTS = EVENTS;
--- a/devtools/client/netmonitor/moz.build
+++ b/devtools/client/netmonitor/moz.build
@@ -10,17 +10,16 @@ DIRS += [
'reducers',
'selectors',
'shared',
'utils',
]
DevToolsModules(
'constants.js',
- 'events.js',
'netmonitor-controller.js',
'panel.js',
'request-list-context-menu.js',
'request-list-tooltip.js',
'store.js',
'waterfall-background.js',
)
--- a/devtools/client/netmonitor/netmonitor-controller.js
+++ b/devtools/client/netmonitor/netmonitor-controller.js
@@ -3,18 +3,17 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const Services = require("Services");
const EventEmitter = require("devtools/shared/event-emitter");
const { TimelineFront } = require("devtools/shared/fronts/timeline");
const { CurlUtils } = require("devtools/client/shared/curl");
-const { ACTIVITY_TYPE } = require("./constants");
-const { EVENTS } = require("./events");
+const { ACTIVITY_TYPE, EVENTS } = require("./constants");
const { configureStore } = require("./store");
const Actions = require("./actions/index");
const {
fetchHeaders,
formDataURI,
} = require("./utils/request-utils");
const {
getRequestById,
--- a/devtools/client/netmonitor/test/browser_net_clear.js
+++ b/devtools/client/netmonitor/test/browser_net_clear.js
@@ -8,17 +8,17 @@
*/
add_task(function* () {
let { tab, monitor } = yield initNetMonitor(SIMPLE_URL);
info("Starting test... ");
let { document, gStore, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/actions/index");
- let { EVENTS } = windowRequire("devtools/client/netmonitor/events");
+ let { EVENTS } = windowRequire("devtools/client/netmonitor/constants");
let detailsPane = document.querySelector("#details-pane");
let detailsPanelToggleButton = document.querySelector(".network-details-panel-toggle");
let clearButton = document.querySelector("#requests-menu-clear-button");
gStore.dispatch(Actions.batchEnable(false));
// Make sure we start in a sane state
assertNoRequestState();
--- a/devtools/client/netmonitor/test/browser_net_icon-preview.js
+++ b/devtools/client/netmonitor/test/browser_net_icon-preview.js
@@ -9,18 +9,17 @@
add_task(function* () {
let { tab, monitor } = yield initNetMonitor(CONTENT_TYPE_WITHOUT_CACHE_URL);
info("Starting test... ");
let { document, gStore, windowRequire, NetMonitorController } =
monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/actions/index");
- let { ACTIVITY_TYPE } = windowRequire("devtools/client/netmonitor/constants");
- let { EVENTS } = windowRequire("devtools/client/netmonitor/events");
+ let { ACTIVITY_TYPE, EVENTS } = windowRequire("devtools/client/netmonitor/constants");
gStore.dispatch(Actions.batchEnable(false));
let wait = waitForEvents();
yield performRequests();
yield wait;
info("Checking the image thumbnail when all items are shown.");
--- a/devtools/client/netmonitor/test/browser_net_image-tooltip.js
+++ b/devtools/client/netmonitor/test/browser_net_image-tooltip.js
@@ -10,18 +10,17 @@ const IMAGE_TOOLTIP_REQUESTS = 1;
* Tests if image responses show a popup in the requests menu when hovered.
*/
add_task(function* test() {
let { tab, monitor } = yield initNetMonitor(IMAGE_TOOLTIP_URL);
info("Starting test... ");
let { document, gStore, windowRequire, NetMonitorController } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/actions/index");
- let { ACTIVITY_TYPE } = windowRequire("devtools/client/netmonitor/constants");
- let { EVENTS } = windowRequire("devtools/client/netmonitor/events");
+ let { ACTIVITY_TYPE, EVENTS } = windowRequire("devtools/client/netmonitor/constants");
let {
getDisplayedRequests,
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/selectors/index");
let toolboxDoc = monitor.toolbox.doc;
gStore.dispatch(Actions.batchEnable(false));
--- a/devtools/client/netmonitor/test/browser_net_page-nav.js
+++ b/devtools/client/netmonitor/test/browser_net_page-nav.js
@@ -8,17 +8,17 @@
* action in the network monitor.
*/
add_task(function* () {
let { tab, monitor } = yield initNetMonitor(SIMPLE_URL);
info("Starting test... ");
let { windowRequire } = monitor.panelWin;
- let { EVENTS } = windowRequire("devtools/client/netmonitor/events");
+ let { EVENTS } = windowRequire("devtools/client/netmonitor/constants");
yield testNavigate();
yield testNavigateBack();
yield testClose();
function* testNavigate() {
info("Navigating forward...");
--- a/devtools/client/netmonitor/test/browser_net_pane-toggle.js
+++ b/devtools/client/netmonitor/test/browser_net_pane-toggle.js
@@ -8,17 +8,17 @@
*/
add_task(function* () {
let { tab, monitor } = yield initNetMonitor(SIMPLE_URL);
info("Starting test... ");
let { document, gStore, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/actions/index");
- let { EVENTS } = windowRequire("devtools/client/netmonitor/events");
+ let { EVENTS } = windowRequire("devtools/client/netmonitor/constants");
let {
getSelectedRequest,
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/selectors/index");
gStore.dispatch(Actions.batchEnable(false));
let toggleButton = document.querySelector(".network-details-panel-toggle");
--- a/devtools/client/netmonitor/test/browser_net_reload-markers.js
+++ b/devtools/client/netmonitor/test/browser_net_reload-markers.js
@@ -7,17 +7,17 @@
* Tests if the empty-requests reload button works.
*/
add_task(function* () {
let { monitor } = yield initNetMonitor(SIMPLE_URL);
info("Starting test... ");
let { document, windowRequire } = monitor.panelWin;
- let { EVENTS } = windowRequire("devtools/client/netmonitor/events");
+ let { EVENTS } = windowRequire("devtools/client/netmonitor/constants");
let button = document.querySelector("#requests-menu-reload-notice-button");
button.click();
let markers = [];
monitor.panelWin.on(EVENTS.TIMELINE_EVENT, (_, marker) => {
markers.push(marker);
});
--- a/devtools/client/netmonitor/test/browser_net_security-error.js
+++ b/devtools/client/netmonitor/test/browser_net_security-error.js
@@ -6,17 +6,17 @@
/**
* Test that Security details tab shows an error message with broken connections.
*/
add_task(function* () {
let { tab, monitor } = yield initNetMonitor(CUSTOM_GET_URL);
let { document, gStore, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/actions/index");
- let { EVENTS } = windowRequire("devtools/client/netmonitor/events");
+ let { EVENTS } = windowRequire("devtools/client/netmonitor/constants");
gStore.dispatch(Actions.batchEnable(false));
info("Requesting a resource that has a certificate problem.");
let wait = waitForSecurityBrokenNetworkEvent();
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
content.wrappedJSObject.performRequests(1, "https://nocert.example.com");
--- a/devtools/client/netmonitor/test/browser_net_simple-request-data.js
+++ b/devtools/client/netmonitor/test/browser_net_simple-request-data.js
@@ -10,17 +10,17 @@
function test() {
let { L10N } = require("devtools/client/netmonitor/utils/l10n");
initNetMonitor(SIMPLE_SJS).then(({ tab, monitor }) => {
info("Starting test... ");
let { document, gStore, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/actions/index");
- let { EVENTS } = windowRequire("devtools/client/netmonitor/events");
+ let { EVENTS } = windowRequire("devtools/client/netmonitor/constants");
let {
getDisplayedRequests,
getSelectedRequest,
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/selectors/index");
gStore.dispatch(Actions.batchEnable(false));
--- a/devtools/client/netmonitor/test/browser_net_simple-request-details.js
+++ b/devtools/client/netmonitor/test/browser_net_simple-request-details.js
@@ -10,17 +10,17 @@
add_task(function* () {
let { L10N } = require("devtools/client/netmonitor/utils/l10n");
let { tab, monitor } = yield initNetMonitor(SIMPLE_SJS);
info("Starting test... ");
let { document, gStore, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/actions/index");
- let { EVENTS } = windowRequire("devtools/client/netmonitor/events");
+ let { EVENTS } = windowRequire("devtools/client/netmonitor/constants");
let {
getDisplayedRequests,
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/selectors/index");
gStore.dispatch(Actions.batchEnable(false));
let wait = waitForNetworkEvents(monitor, 1);
--- a/devtools/client/netmonitor/test/browser_net_simple-request.js
+++ b/devtools/client/netmonitor/test/browser_net_simple-request.js
@@ -13,17 +13,17 @@
* 4) Number of requests displayed
*/
add_task(function* () {
let { tab, monitor } = yield initNetMonitor(SIMPLE_URL);
info("Starting test... ");
let { document, gStore, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/actions/index");
- let { EVENTS } = windowRequire("devtools/client/netmonitor/events");
+ let { EVENTS } = windowRequire("devtools/client/netmonitor/constants");
let {
getDisplayedRequests,
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/selectors/index");
gStore.dispatch(Actions.batchEnable(false));
is(document.querySelector(".network-details-panel-toggle").hasAttribute("disabled"),
--- a/devtools/client/netmonitor/test/browser_net_throttle.js
+++ b/devtools/client/netmonitor/test/browser_net_throttle.js
@@ -12,17 +12,17 @@ add_task(function* () {
function* throttleTest(actuallyThrottle) {
requestLongerTimeout(2);
let { monitor } = yield initNetMonitor(SIMPLE_URL);
let { document, gStore, windowRequire, NetMonitorController } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/actions/index");
let { ACTIVITY_TYPE } = windowRequire("devtools/client/netmonitor/constants");
- let { EVENTS } = windowRequire("devtools/client/netmonitor/events");
+ let { EVENTS } = windowRequire("devtools/client/netmonitor/constants");
let {
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/selectors/index");
info("Starting test... (actuallyThrottle = " + actuallyThrottle + ")");
// When throttling, must be smaller than the length of the content
// of SIMPLE_URL in bytes.
--- a/devtools/client/netmonitor/test/browser_net_truncate.js
+++ b/devtools/client/netmonitor/test/browser_net_truncate.js
@@ -16,17 +16,17 @@ function test() {
// Another slow test on Linux debug.
requestLongerTimeout(2);
initNetMonitor(URL).then(({ tab, monitor }) => {
info("Starting test... ");
let { document, gStore, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/actions/index");
- let { EVENTS } = windowRequire("devtools/client/netmonitor/events");
+ let { EVENTS } = windowRequire("devtools/client/netmonitor/constants");
let {
getDisplayedRequests,
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/selectors/index");
gStore.dispatch(Actions.batchEnable(false));
waitForNetworkEvents(monitor, 1)
--- a/devtools/client/netmonitor/test/head.js
+++ b/devtools/client/netmonitor/test/head.js
@@ -5,17 +5,17 @@
"use strict";
// shared-head.js handles imports, constants, and utility functions
Services.scriptloader.loadSubScript(
"chrome://mochitests/content/browser/devtools/client/framework/test/shared-head.js",
this);
-const { EVENTS } = require("devtools/client/netmonitor/events");
+const { EVENTS } = require("devtools/client/netmonitor/constants");
var { Toolbox } = require("devtools/client/framework/toolbox");
const {
decodeUnicodeUrl,
getUrlBaseName,
getUrlQuery,
getUrlHost,
} = require("devtools/client/netmonitor/utils/request-utils");