--- a/devtools/client/framework/test/browser_ignore_toolbox_network_requests.js
+++ b/devtools/client/framework/test/browser_ignore_toolbox_network_requests.js
@@ -18,17 +18,17 @@ add_task(function* () {
let tab = yield addTab(URL_ROOT + "doc_viewsource.html");
let target = TargetFactory.forTab(tab);
let toolbox = yield gDevTools.showToolbox(target, "styleeditor");
let panel = toolbox.getPanel("styleeditor");
is(panel.UI.editors.length, 1, "correct number of editors opened");
let monitor = yield toolbox.selectTool("netmonitor");
- let { gStore, windowRequire } = monitor.panelWin;
+ let { store, windowRequire } = monitor.panelWin;
- is(gStore.getState().requests.requests.size, 0, "No network requests appear in the network panel");
+ is(store.getState().requests.requests.size, 0, "No network requests appear in the network panel");
yield gDevTools.closeToolbox(target);
tab = target = toolbox = panel = null;
gBrowser.removeCurrentTab();
flags.testing = isTesting;
});
--- a/devtools/client/netmonitor/src/har/test/browser_net_har_copy_all_as_har.js
+++ b/devtools/client/netmonitor/src/har/test/browser_net_har_copy_all_as_har.js
@@ -6,21 +6,22 @@
/**
* Basic tests for exporting Network panel content into HAR format.
*/
add_task(function* () {
let { tab, monitor } = yield initNetMonitor(SIMPLE_URL);
info("Starting test... ");
- let { actions, windowRequire } = monitor.panelWin;
+ let { store, windowRequire } = monitor.panelWin;
+ let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let RequestListContextMenu = windowRequire(
"devtools/client/netmonitor/src/request-list-context-menu");
- actions.batchEnable(false);
+ store.dispatch(Actions.batchEnable(false));
let wait = waitForNetworkEvents(monitor, 1);
tab.linkedBrowser.reload();
yield wait;
let contextMenu = new RequestListContextMenu({});
yield contextMenu.copyAllAsHar();
--- a/devtools/client/netmonitor/src/har/test/browser_net_har_post_data.js
+++ b/devtools/client/netmonitor/src/har/test/browser_net_har_post_data.js
@@ -7,21 +7,22 @@
* Tests for exporting POST data into HAR format.
*/
add_task(function* () {
let { tab, monitor } = yield initNetMonitor(
HAR_EXAMPLE_URL + "html_har_post-data-test-page.html");
info("Starting test... ");
- let { actions, windowRequire } = monitor.panelWin;
+ let { store, windowRequire } = monitor.panelWin;
+ let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let RequestListContextMenu = windowRequire(
"devtools/client/netmonitor/src/request-list-context-menu");
- actions.batchEnable(false);
+ store.dispatch(Actions.batchEnable(false));
// Execute one POST request on the page and wait till its done.
let wait = waitForNetworkEvents(monitor, 0, 1);
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
content.wrappedJSObject.executeTest();
});
yield wait;
--- a/devtools/client/netmonitor/src/har/test/browser_net_har_throttle_upload.js
+++ b/devtools/client/netmonitor/src/har/test/browser_net_har_throttle_upload.js
@@ -11,23 +11,24 @@ 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 { actions, windowRequire } = monitor.panelWin;
+ let { store, windowRequire } = monitor.panelWin;
+ let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let { setPreferences } =
windowRequire("devtools/client/netmonitor/src/connector/index");
let RequestListContextMenu = windowRequire(
"devtools/client/netmonitor/src/request-list-context-menu");
- actions.batchEnable(false);
+ store.dispatch(Actions.batchEnable(false));
const size = 4096;
const uploadSize = actuallyThrottle ? size / 3 : 0;
const request = {
"NetworkMonitor.throttleData": {
latencyMean: 0,
latencyMax: 0,
--- a/devtools/client/netmonitor/test/browser.ini
+++ b/devtools/client/netmonitor/test/browser.ini
@@ -116,17 +116,16 @@ skip-if = (os == 'linux' && debug && bit
[browser_net_json-long.js]
[browser_net_json-malformed.js]
[browser_net_json_custom_mime.js]
[browser_net_json_text_mime.js]
[browser_net_jsonp.js]
[browser_net_large-response.js]
[browser_net_leak_on_tab_close.js]
[browser_net_open_request_in_tab.js]
-[browser_net_page-nav.js]
[browser_net_pane-collapse.js]
[browser_net_pane-toggle.js]
[browser_net_post-data-01.js]
[browser_net_post-data-02.js]
[browser_net_post-data-03.js]
[browser_net_post-data-04.js]
[browser_net_prefs-and-l10n.js]
[browser_net_prefs-reload.js]
@@ -142,17 +141,16 @@ skip-if = (os == 'linux' && debug && bit
[browser_net_security-icon-click.js]
[browser_net_security-redirect.js]
[browser_net_security-state.js]
[browser_net_security-tab-deselect.js]
[browser_net_security-tab-visibility.js]
[browser_net_security-warnings.js]
[browser_net_send-beacon.js]
[browser_net_send-beacon-other-tab.js]
-[browser_net_simple-init.js]
[browser_net_simple-request-data.js]
[browser_net_simple-request-details.js]
skip-if = true # Bug 1258809
[browser_net_simple-request.js]
[browser_net_sort-01.js]
[browser_net_sort-02.js]
[browser_net_statistics-01.js]
[browser_net_statistics-02.js]
--- a/devtools/client/netmonitor/test/browser_net_accessibility-01.js
+++ b/devtools/client/netmonitor/test/browser_net_accessibility-01.js
@@ -9,20 +9,20 @@
add_task(function* () {
let { tab, monitor } = yield initNetMonitor(CUSTOM_GET_URL);
info("Starting test... ");
// It seems that this test may be slow on Ubuntu builds running on ec2.
requestLongerTimeout(2);
- let { document, gStore, windowRequire } = monitor.panelWin;
+ let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
- gStore.dispatch(Actions.batchEnable(false));
+ store.dispatch(Actions.batchEnable(false));
let count = 0;
function check(selectedIndex, panelVisibility) {
info("Performing check " + (count++) + ".");
let requestItems = Array.from(document.querySelectorAll(".request-list-item"));
is(requestItems.findIndex((item) => item.matches(".selected")), selectedIndex,
"The selected item in the requests menu was incorrect.");
@@ -33,51 +33,51 @@ add_task(function* () {
let wait = waitForNetworkEvents(monitor, 2);
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
content.wrappedJSObject.performRequests(2);
});
yield wait;
check(-1, false);
- gStore.dispatch(Actions.selectDelta(+Infinity));
+ store.dispatch(Actions.selectDelta(+Infinity));
check(1, true);
- gStore.dispatch(Actions.selectDelta(-Infinity));
+ store.dispatch(Actions.selectDelta(-Infinity));
check(0, true);
- gStore.dispatch(Actions.selectDelta(+1));
+ store.dispatch(Actions.selectDelta(+1));
check(1, true);
- gStore.dispatch(Actions.selectDelta(-1));
+ store.dispatch(Actions.selectDelta(-1));
check(0, true);
- gStore.dispatch(Actions.selectDelta(+10));
+ store.dispatch(Actions.selectDelta(+10));
check(1, true);
- gStore.dispatch(Actions.selectDelta(-10));
+ store.dispatch(Actions.selectDelta(-10));
check(0, true);
wait = waitForNetworkEvents(monitor, 18);
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
content.wrappedJSObject.performRequests(18);
});
yield wait;
- gStore.dispatch(Actions.selectDelta(+Infinity));
+ store.dispatch(Actions.selectDelta(+Infinity));
check(19, true);
- gStore.dispatch(Actions.selectDelta(-Infinity));
+ store.dispatch(Actions.selectDelta(-Infinity));
check(0, true);
- gStore.dispatch(Actions.selectDelta(+1));
+ store.dispatch(Actions.selectDelta(+1));
check(1, true);
- gStore.dispatch(Actions.selectDelta(-1));
+ store.dispatch(Actions.selectDelta(-1));
check(0, true);
- gStore.dispatch(Actions.selectDelta(+10));
+ store.dispatch(Actions.selectDelta(+10));
check(10, true);
- gStore.dispatch(Actions.selectDelta(-10));
+ store.dispatch(Actions.selectDelta(-10));
check(0, true);
- gStore.dispatch(Actions.selectDelta(+100));
+ store.dispatch(Actions.selectDelta(+100));
check(19, true);
- gStore.dispatch(Actions.selectDelta(-100));
+ store.dispatch(Actions.selectDelta(-100));
check(0, true);
return teardown(monitor);
});
--- a/devtools/client/netmonitor/test/browser_net_accessibility-02.js
+++ b/devtools/client/netmonitor/test/browser_net_accessibility-02.js
@@ -9,20 +9,20 @@
add_task(function* () {
let { tab, monitor } = yield initNetMonitor(CUSTOM_GET_URL);
info("Starting test... ");
// It seems that this test may be slow on Ubuntu builds running on ec2.
requestLongerTimeout(2);
- let { window, document, gStore, windowRequire } = monitor.panelWin;
+ let { window, document, windowRequire, store } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
- gStore.dispatch(Actions.batchEnable(false));
+ store.dispatch(Actions.batchEnable(false));
let count = 0;
function check(selectedIndex, panelVisibility) {
info("Performing check " + (count++) + ".");
let requestItems = Array.from(document.querySelectorAll(".request-list-item"));
is(requestItems.findIndex((item) => item.matches(".selected")), selectedIndex,
"The selected item in the requests menu was incorrect.");
--- a/devtools/client/netmonitor/test/browser_net_api-calls.js
+++ b/devtools/client/netmonitor/test/browser_net_api-calls.js
@@ -7,24 +7,24 @@
* Tests whether API call URLs (without a filename) are correctly displayed
* (including Unicode)
*/
add_task(function* () {
let { tab, monitor } = yield initNetMonitor(API_CALLS_URL);
info("Starting test... ");
- let { document, gStore, windowRequire } = monitor.panelWin;
+ let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let {
getDisplayedRequests,
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
- gStore.dispatch(Actions.batchEnable(false));
+ store.dispatch(Actions.batchEnable(false));
const REQUEST_URIS = [
"http://example.com/api/fileName.xml",
"http://example.com/api/file%E2%98%A2.xml",
"http://example.com/api/ascii/get/",
"http://example.com/api/unicode/%E2%98%A2/",
"http://example.com/api/search/?q=search%E2%98%A2"
];
@@ -33,17 +33,17 @@ add_task(function* () {
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
content.wrappedJSObject.performRequests();
});
yield wait;
REQUEST_URIS.forEach(function (uri, index) {
verifyRequestItemTarget(
document,
- getDisplayedRequests(gStore.getState()),
- getSortedRequests(gStore.getState()).get(index),
+ getDisplayedRequests(store.getState()),
+ getSortedRequests(store.getState()).get(index),
"GET",
uri
);
});
yield teardown(monitor);
});
--- a/devtools/client/netmonitor/test/browser_net_autoscroll.js
+++ b/devtools/client/netmonitor/test/browser_net_autoscroll.js
@@ -5,19 +5,21 @@
/**
* Bug 863102 - Automatically scroll down upon new network requests.
*/
add_task(function* () {
requestLongerTimeout(4);
let { monitor } = yield initNetMonitor(INFINITE_GET_URL, true);
- let { document, gStore, windowRequire } = monitor.panelWin;
+ let { document, windowRequire, store } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
+ store.dispatch(Actions.batchEnable(false));
+
// Wait until the first request makes the empty notice disappear
yield waitForRequestListToAppear();
let requestsContainer = document.querySelector(".requests-list-contents");
ok(requestsContainer, "Container element exists as expected.");
// (1) Check that the scroll position is maintained at the bottom
// when the requests overflow the vertical size of the container.
@@ -42,17 +44,17 @@ add_task(function* () {
requestsContainer.scrollTop = requestsContainer.scrollHeight;
ok(scrolledToBottom(requestsContainer), "Set scroll position to bottom.");
yield waitForNetworkEvents(monitor, 8);
yield waitForScroll();
ok(true, "Still scrolled to bottom.");
// (4) Now select an item in the list and check that additional requests
// do not change the scroll position.
- gStore.dispatch(Actions.selectRequestByIndex(0));
+ store.dispatch(Actions.selectRequestByIndex(0));
yield waitForNetworkEvents(monitor, 8);
yield waitSomeTime();
is(requestsContainer.scrollTop, 0, "Did not scroll.");
// Done: clean up.
return teardown(monitor);
function waitForRequestListToAppear() {
--- a/devtools/client/netmonitor/test/browser_net_brotli.js
+++ b/devtools/client/netmonitor/test/browser_net_brotli.js
@@ -11,35 +11,35 @@ const BROTLI_REQUESTS = 1;
*/
add_task(function* () {
let { L10N } = require("devtools/client/netmonitor/src/utils/l10n");
let { tab, monitor } = yield initNetMonitor(BROTLI_URL);
info("Starting test... ");
- let { document, gStore, windowRequire } = monitor.panelWin;
+ let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let {
getDisplayedRequests,
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
- gStore.dispatch(Actions.batchEnable(false));
+ store.dispatch(Actions.batchEnable(false));
let wait = waitForNetworkEvents(monitor, BROTLI_REQUESTS);
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
content.wrappedJSObject.performRequests();
});
yield wait;
verifyRequestItemTarget(
document,
- getDisplayedRequests(gStore.getState()),
- getSortedRequests(gStore.getState()).get(0),
+ getDisplayedRequests(store.getState()),
+ getSortedRequests(store.getState()).get(0),
"GET", HTTPS_CONTENT_TYPE_SJS + "?fmt=br", {
status: 200,
statusText: "Connected",
type: "plain",
fullMimeType: "text/plain",
transferred: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 10),
size: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 64),
time: true
--- a/devtools/client/netmonitor/test/browser_net_cached-status.js
+++ b/devtools/client/netmonitor/test/browser_net_cached-status.js
@@ -6,24 +6,24 @@
/**
* Tests if cached requests have the correct status code
*/
add_task(function* () {
let { tab, monitor } = yield initNetMonitor(STATUS_CODES_URL, true);
info("Starting test... ");
- let { document, gStore, windowRequire } = monitor.panelWin;
+ let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let {
getDisplayedRequests,
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
- gStore.dispatch(Actions.batchEnable(false));
+ store.dispatch(Actions.batchEnable(false));
const REQUEST_DATA = [
{
method: "GET",
uri: STATUS_CODES_SJS + "?sts=ok&cached",
details: {
status: 200,
statusText: "OK",
@@ -91,18 +91,18 @@ add_task(function* () {
info("Performing requests #2...");
yield performRequestsAndWait();
let index = 0;
for (let request of REQUEST_DATA) {
info("Verifying request #" + index);
yield verifyRequestItemTarget(
document,
- getDisplayedRequests(gStore.getState()),
- getSortedRequests(gStore.getState()).get(index),
+ getDisplayedRequests(store.getState()),
+ getSortedRequests(store.getState()).get(index),
request.method,
request.uri,
request.details
);
index++;
}
--- a/devtools/client/netmonitor/test/browser_net_cause.js
+++ b/devtools/client/netmonitor/test/browser_net_cause.js
@@ -84,38 +84,39 @@ add_task(function* () {
// the initNetMonitor function clears the network request list after the
// page is loaded. That's why we first load a bogus page from SIMPLE_URL,
// and only then load the real thing from CAUSE_URL - we want to catch
// all the requests the page is making, not only the XHRs.
// We can't use about:blank here, because initNetMonitor checks that the
// page has actually made at least one request.
let { tab, monitor } = yield initNetMonitor(SIMPLE_URL);
- let { document, gStore, windowRequire } = monitor.panelWin;
+ let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let {
getDisplayedRequests,
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
- gStore.dispatch(Actions.batchEnable(false));
+ store.dispatch(Actions.batchEnable(false));
+
let wait = waitForNetworkEvents(monitor, EXPECTED_REQUESTS.length);
tab.linkedBrowser.loadURI(CAUSE_URL);
yield wait;
- is(gStore.getState().requests.requests.size, EXPECTED_REQUESTS.length,
+ is(store.getState().requests.requests.size, EXPECTED_REQUESTS.length,
"All the page events should be recorded.");
EXPECTED_REQUESTS.forEach((spec, i) => {
let { method, url, causeType, causeUri, stack } = spec;
- let requestItem = getSortedRequests(gStore.getState()).get(i);
+ let requestItem = getSortedRequests(store.getState()).get(i);
verifyRequestItemTarget(
document,
- getDisplayedRequests(gStore.getState()),
+ getDisplayedRequests(store.getState()),
requestItem,
method,
url,
{ cause: { type: causeType, loadingDocumentUri: causeUri } }
);
let { stacktrace } = requestItem.cause;
let stackLen = stacktrace ? stacktrace.length : 0;
@@ -143,14 +144,14 @@ add_task(function* () {
}
});
// Sort the requests by cause and check the order
EventUtils.sendMouseEvent({ type: "click" },
document.querySelector("#requests-list-cause-button"));
let expectedOrder = EXPECTED_REQUESTS.map(r => r.causeType).sort();
expectedOrder.forEach((expectedCause, i) => {
- const cause = getSortedRequests(gStore.getState()).get(i).cause.type;
+ const cause = getSortedRequests(store.getState()).get(i).cause.type;
is(cause, expectedCause, `The request #${i} has the expected cause after sorting`);
});
yield teardown(monitor);
});
--- a/devtools/client/netmonitor/test/browser_net_cause_redirect.js
+++ b/devtools/client/netmonitor/test/browser_net_cause_redirect.js
@@ -14,30 +14,30 @@ add_task(function* () {
{ status: 302, hasStack: true },
// Serves HTTPS, sets the Strict-Transport-Security header, no stack
{ status: 200, hasStack: false },
// Second request to HTTP redirects to HTTPS internally
{ status: 200, hasStack: true },
];
let { tab, monitor } = yield initNetMonitor(CUSTOM_GET_URL);
- let { gStore, windowRequire } = monitor.panelWin;
+ let { store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let {
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
- gStore.dispatch(Actions.batchEnable(false));
+ store.dispatch(Actions.batchEnable(false));
let wait = waitForNetworkEvents(monitor, EXPECTED_REQUESTS.length);
yield performRequests(2, HSTS_SJS);
yield wait;
EXPECTED_REQUESTS.forEach(({status, hasStack}, i) => {
- let item = getSortedRequests(gStore.getState()).get(i);
+ let item = getSortedRequests(store.getState()).get(i);
is(item.status, status, `Request #${i} has the expected status`);
let { stacktrace } = item.cause;
let stackLen = stacktrace ? stacktrace.length : 0;
if (hasStack) {
ok(stacktrace, `Request #${i} has a stacktrace`);
--- a/devtools/client/netmonitor/test/browser_net_clear.js
+++ b/devtools/client/netmonitor/test/browser_net_clear.js
@@ -6,23 +6,23 @@
/**
* Tests if the clear button empties the request menu.
*/
add_task(function* () {
let { tab, monitor } = yield initNetMonitor(SIMPLE_URL);
info("Starting test... ");
- let { document, gStore, windowRequire } = monitor.panelWin;
+ let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let { EVENTS } = windowRequire("devtools/client/netmonitor/src/constants");
let detailsPanelToggleButton = document.querySelector(".network-details-panel-toggle");
let clearButton = document.querySelector(".requests-list-clear-button");
- gStore.dispatch(Actions.batchEnable(false));
+ store.dispatch(Actions.batchEnable(false));
// Make sure we start in a sane state
assertNoRequestState();
// Load one request and assert it shows up in the list
let networkEvent = monitor.panelWin.once(EVENTS.NETWORK_EVENT);
tab.linkedBrowser.reload();
yield networkEvent;
@@ -55,24 +55,24 @@ add_task(function* () {
"The details pane should not be visible clicking 'clear'.");
return teardown(monitor);
/**
* Asserts the state of the network monitor when one request has loaded
*/
function assertSingleRequestState() {
- is(gStore.getState().requests.requests.size, 1,
+ is(store.getState().requests.requests.size, 1,
"The request menu should have one item at this point.");
is(detailsPanelToggleButton.hasAttribute("disabled"), false,
"The pane toggle button should be enabled after a request is made.");
}
/**
* Asserts the state of the network monitor when no requests have loaded
*/
function assertNoRequestState() {
- is(gStore.getState().requests.requests.size, 0,
+ is(store.getState().requests.requests.size, 0,
"The request menu should be empty at this point.");
is(detailsPanelToggleButton.hasAttribute("disabled"), true,
"The pane toggle button should be disabled when the request menu is cleared.");
}
});
--- a/devtools/client/netmonitor/test/browser_net_columns_last_column.js
+++ b/devtools/client/netmonitor/test/browser_net_columns_last_column.js
@@ -6,20 +6,20 @@
/**
* Tests that last visible column can't be hidden
*/
add_task(function* () {
let { monitor } = yield initNetMonitor(SIMPLE_URL);
info("Starting test... ");
- let { document, gStore, parent } = monitor.panelWin;
+ let { document, store, parent } = monitor.panelWin;
- for (let [column, shown] of gStore.getState().ui.columns) {
- let visibleColumns = [...gStore.getState().ui.columns]
+ for (let [column, shown] of store.getState().ui.columns) {
+ let visibleColumns = [...store.getState().ui.columns]
.filter(([_, visible]) => visible);
if (visibleColumns.length === 1) {
yield testLastMenuItem(column);
break;
}
if (shown) {
--- a/devtools/client/netmonitor/test/browser_net_columns_showhide.js
+++ b/devtools/client/netmonitor/test/browser_net_columns_showhide.js
@@ -6,19 +6,19 @@
/**
* Test showing/hiding columns.
*/
add_task(function* () {
let { monitor } = yield initNetMonitor(SIMPLE_URL);
info("Starting test... ");
- let { document, gStore, parent } = monitor.panelWin;
+ let { document, store, parent } = monitor.panelWin;
- for (let [column, shown] of gStore.getState().ui.columns) {
+ for (let [column, shown] of store.getState().ui.columns) {
if (shown) {
yield testVisibleColumnContextMenuItem(column, document, parent);
yield testHiddenColumnContextMenuItem(column, document, parent);
} else {
yield testHiddenColumnContextMenuItem(column, document, parent);
yield testVisibleColumnContextMenuItem(column, document, parent);
}
}
--- a/devtools/client/netmonitor/test/browser_net_complex-params.js
+++ b/devtools/client/netmonitor/test/browser_net_complex-params.js
@@ -7,21 +7,21 @@
* Tests whether complex request params and payload sent via POST are
* displayed correctly.
*/
add_task(function* () {
let { tab, monitor } = yield initNetMonitor(PARAMS_URL);
info("Starting test... ");
- let { document, gStore, windowRequire } = monitor.panelWin;
+ let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let { L10N } = windowRequire("devtools/client/netmonitor/src/utils/l10n");
- gStore.dispatch(Actions.batchEnable(false));
+ store.dispatch(Actions.batchEnable(false));
let wait = waitForNetworkEvents(monitor, 1, 6);
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
content.wrappedJSObject.performRequests();
});
yield wait;
wait = waitForDOM(document, "#params-panel .tree-section", 2);
--- a/devtools/client/netmonitor/test/browser_net_content-type.js
+++ b/devtools/client/netmonitor/test/browser_net_content-type.js
@@ -6,127 +6,127 @@
/**
* Tests if different response content types are handled correctly.
*/
add_task(function* () {
let { tab, monitor } = yield initNetMonitor(CONTENT_TYPE_WITHOUT_CACHE_URL);
info("Starting test... ");
- let { document, gStore, windowRequire } = monitor.panelWin;
+ let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let { L10N } = windowRequire("devtools/client/netmonitor/src/utils/l10n");
let {
getDisplayedRequests,
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
- gStore.dispatch(Actions.batchEnable(false));
+ store.dispatch(Actions.batchEnable(false));
let wait = waitForNetworkEvents(monitor, CONTENT_TYPE_WITHOUT_CACHE_REQUESTS);
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
content.wrappedJSObject.performRequests();
});
yield wait;
verifyRequestItemTarget(
document,
- getDisplayedRequests(gStore.getState()),
- getSortedRequests(gStore.getState()).get(0),
+ getDisplayedRequests(store.getState()),
+ getSortedRequests(store.getState()).get(0),
"GET",
CONTENT_TYPE_SJS + "?fmt=xml",
{
status: 200,
statusText: "OK",
type: "xml",
fullMimeType: "text/xml; charset=utf-8",
size: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 42),
time: true
}
);
verifyRequestItemTarget(
document,
- getDisplayedRequests(gStore.getState()),
- getSortedRequests(gStore.getState()).get(1),
+ getDisplayedRequests(store.getState()),
+ getSortedRequests(store.getState()).get(1),
"GET",
CONTENT_TYPE_SJS + "?fmt=css",
{
status: 200,
statusText: "OK",
type: "css",
fullMimeType: "text/css; charset=utf-8",
size: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 34),
time: true
}
);
verifyRequestItemTarget(
document,
- getDisplayedRequests(gStore.getState()),
- getSortedRequests(gStore.getState()).get(2),
+ getDisplayedRequests(store.getState()),
+ getSortedRequests(store.getState()).get(2),
"GET",
CONTENT_TYPE_SJS + "?fmt=js",
{
status: 200,
statusText: "OK",
type: "js",
fullMimeType: "application/javascript; charset=utf-8",
size: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 34),
time: true
}
);
verifyRequestItemTarget(
document,
- getDisplayedRequests(gStore.getState()),
- getSortedRequests(gStore.getState()).get(3),
+ getDisplayedRequests(store.getState()),
+ getSortedRequests(store.getState()).get(3),
"GET",
CONTENT_TYPE_SJS + "?fmt=json",
{
status: 200,
statusText: "OK",
type: "json",
fullMimeType: "application/json; charset=utf-8",
size: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 29),
time: true
}
);
verifyRequestItemTarget(
document,
- getDisplayedRequests(gStore.getState()),
- getSortedRequests(gStore.getState()).get(4),
+ getDisplayedRequests(store.getState()),
+ getSortedRequests(store.getState()).get(4),
"GET",
CONTENT_TYPE_SJS + "?fmt=bogus",
{
status: 404,
statusText: "Not Found",
type: "html",
fullMimeType: "text/html; charset=utf-8",
size: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 24),
time: true
}
);
verifyRequestItemTarget(
document,
- getDisplayedRequests(gStore.getState()),
- getSortedRequests(gStore.getState()).get(5),
+ getDisplayedRequests(store.getState()),
+ getSortedRequests(store.getState()).get(5),
"GET",
TEST_IMAGE,
{
fuzzyUrl: true,
status: 200,
statusText: "OK",
type: "png",
fullMimeType: "image/png",
size: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 580),
time: true
}
);
verifyRequestItemTarget(
document,
- getDisplayedRequests(gStore.getState()),
- getSortedRequests(gStore.getState()).get(6),
+ getDisplayedRequests(store.getState()),
+ getSortedRequests(store.getState()).get(6),
"GET",
CONTENT_TYPE_SJS + "?fmt=gzip",
{
status: 200,
statusText: "OK",
type: "plain",
fullMimeType: "text/plain",
transferred: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 73),
@@ -275,20 +275,20 @@ add_task(function* () {
EventUtils.sendMouseEvent({ type: "mousedown" },
document.querySelectorAll(".request-list-item")[index]);
}
}
function* selectIndexAndWaitForJSONView(index) {
let tabpanel = document.querySelector("#response-panel");
let waitDOM = waitForDOM(tabpanel, ".treeTable");
- gStore.dispatch(Actions.selectRequestByIndex(index));
+ store.dispatch(Actions.selectRequestByIndex(index));
yield waitDOM;
}
function* selectIndexAndWaitForImageView(index) {
let tabpanel = document.querySelector("#response-panel");
let waitDOM = waitForDOM(tabpanel, ".response-image");
- gStore.dispatch(Actions.selectRequestByIndex(index));
+ store.dispatch(Actions.selectRequestByIndex(index));
let [imageNode] = yield waitDOM;
yield once(imageNode, "load");
}
});
--- a/devtools/client/netmonitor/test/browser_net_copy_headers.js
+++ b/devtools/client/netmonitor/test/browser_net_copy_headers.js
@@ -6,29 +6,29 @@
/**
* Tests if copying a request's request/response headers works.
*/
add_task(function* () {
let { tab, monitor } = yield initNetMonitor(SIMPLE_URL);
info("Starting test... ");
- let { document, gStore, windowRequire } = monitor.panelWin;
+ let { document, store, windowRequire } = monitor.panelWin;
let {
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
let wait = waitForNetworkEvents(monitor, 1);
tab.linkedBrowser.reload();
yield wait;
EventUtils.sendMouseEvent({ type: "mousedown" },
document.querySelectorAll(".request-list-item")[0]);
- let requestItem = getSortedRequests(gStore.getState()).get(0);
+ let requestItem = getSortedRequests(store.getState()).get(0);
let { method, httpVersion, status, statusText } = requestItem;
EventUtils.sendMouseEvent({ type: "contextmenu" },
document.querySelectorAll(".request-list-item")[0]);
const EXPECTED_REQUEST_HEADERS = [
`${method} ${SIMPLE_URL} ${httpVersion}`,
"Host: example.com",
--- a/devtools/client/netmonitor/test/browser_net_copy_params.js
+++ b/devtools/client/netmonitor/test/browser_net_copy_params.js
@@ -6,20 +6,20 @@
/**
* Tests whether copying a request item's parameters works.
*/
add_task(function* () {
let { tab, monitor } = yield initNetMonitor(PARAMS_URL);
info("Starting test... ");
- let { document, gStore, windowRequire } = monitor.panelWin;
+ let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
- gStore.dispatch(Actions.batchEnable(false));
+ store.dispatch(Actions.batchEnable(false));
let wait = waitForNetworkEvents(monitor, 1, 6);
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
content.wrappedJSObject.performRequests();
});
yield wait;
yield testCopyUrlParamsHidden(0, false);
@@ -92,17 +92,17 @@ add_task(function* () {
"The \"Copy POST Data\" context menu item should" + (hidden ? " " : " not ") +
"be hidden.");
}
function* testCopyPostData(index, postData) {
// Wait for formDataSections and requestPostData state are ready in redux store
// since copyPostData API needs to read these state.
yield waitUntil(() => {
- let { requests } = gStore.getState().requests;
+ let { requests } = store.getState().requests;
let actIDs = Object.keys(requests.toJS());
let { formDataSections, requestPostData } = requests.get(actIDs[index]).toJS();
return formDataSections && requestPostData;
});
EventUtils.sendMouseEvent({ type: "mousedown" },
document.querySelectorAll(".request-list-item")[index]);
EventUtils.sendMouseEvent({ type: "contextmenu" },
document.querySelectorAll(".request-list-item")[index]);
--- a/devtools/client/netmonitor/test/browser_net_copy_url.js
+++ b/devtools/client/netmonitor/test/browser_net_copy_url.js
@@ -6,33 +6,33 @@
/**
* Tests if copying a request's url works.
*/
add_task(function* () {
let { tab, monitor } = yield initNetMonitor(CUSTOM_GET_URL);
info("Starting test... ");
- let { document, gStore, windowRequire } = monitor.panelWin;
+ let { document, store, windowRequire } = monitor.panelWin;
let {
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
let wait = waitForNetworkEvents(monitor, 1);
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
content.wrappedJSObject.performRequests(1);
});
yield wait;
EventUtils.sendMouseEvent({ type: "mousedown" },
document.querySelectorAll(".request-list-item")[0]);
EventUtils.sendMouseEvent({ type: "contextmenu" },
document.querySelectorAll(".request-list-item")[0]);
- let requestItem = getSortedRequests(gStore.getState()).get(0);
+ let requestItem = getSortedRequests(store.getState()).get(0);
yield waitForClipboardPromise(function setup() {
monitor.panelWin.parent.document
.querySelector("#request-list-context-copy-url").click();
}, requestItem.url);
yield teardown(monitor);
});
--- a/devtools/client/netmonitor/test/browser_net_cors_requests.js
+++ b/devtools/client/netmonitor/test/browser_net_cors_requests.js
@@ -5,41 +5,41 @@
/**
* Test that CORS preflight requests are displayed by network monitor
*/
add_task(function* () {
let { tab, monitor } = yield initNetMonitor(CORS_URL);
- let { document, gStore, windowRequire } = monitor.panelWin;
+ let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let {
getDisplayedRequests,
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
- gStore.dispatch(Actions.batchEnable(false));
+ store.dispatch(Actions.batchEnable(false));
let wait = waitForNetworkEvents(monitor, 1, 1);
info("Performing a CORS request");
let requestUrl = "http://test1.example.com" + CORS_SJS_PATH;
yield ContentTask.spawn(tab.linkedBrowser, requestUrl, function* (url) {
content.wrappedJSObject.performRequests(url, "triggering/preflight", "post-data");
});
info("Waiting until the requests appear in netmonitor");
yield wait;
info("Checking the preflight and flight methods");
["OPTIONS", "POST"].forEach((method, index) => {
verifyRequestItemTarget(
document,
- getDisplayedRequests(gStore.getState()),
- getSortedRequests(gStore.getState()).get(index),
+ getDisplayedRequests(store.getState()),
+ getSortedRequests(store.getState()).get(index),
method,
requestUrl
);
});
yield teardown(monitor);
});
--- a/devtools/client/netmonitor/test/browser_net_curl-utils.js
+++ b/devtools/client/netmonitor/test/browser_net_curl-utils.js
@@ -8,36 +8,36 @@
*/
const { Curl, CurlUtils } = require("devtools/client/shared/curl");
add_task(function* () {
let { tab, monitor } = yield initNetMonitor(CURL_UTILS_URL);
info("Starting test... ");
- let { gStore, windowRequire } = monitor.panelWin;
+ let { store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let {
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
- let { getLongString } = windowRequire("devtools/client/netmonitor/src/utils/client");
+ let { getLongString } = windowRequire("devtools/client/netmonitor/src/connector/index");
- gStore.dispatch(Actions.batchEnable(false));
+ store.dispatch(Actions.batchEnable(false));
let wait = waitForNetworkEvents(monitor, 1, 3);
yield ContentTask.spawn(tab.linkedBrowser, SIMPLE_SJS, function* (url) {
content.wrappedJSObject.performRequests(url);
});
yield wait;
let requests = {
- get: getSortedRequests(gStore.getState()).get(0),
- post: getSortedRequests(gStore.getState()).get(1),
- multipart: getSortedRequests(gStore.getState()).get(2),
- multipartForm: getSortedRequests(gStore.getState()).get(3),
+ get: getSortedRequests(store.getState()).get(0),
+ post: getSortedRequests(store.getState()).get(1),
+ multipart: getSortedRequests(store.getState()).get(2),
+ multipartForm: getSortedRequests(store.getState()).get(3),
};
let data = yield createCurlData(requests.get, getLongString);
testFindHeader(data);
data = yield createCurlData(requests.post, getLongString);
testIsUrlEncodedRequest(data);
testWritePostDataTextParams(data);
--- a/devtools/client/netmonitor/test/browser_net_cyrillic-01.js
+++ b/devtools/client/netmonitor/test/browser_net_cyrillic-01.js
@@ -6,35 +6,35 @@
/**
* Tests if cyrillic text is rendered correctly in the source editor.
*/
add_task(function* () {
let { tab, monitor } = yield initNetMonitor(CYRILLIC_URL);
info("Starting test... ");
- let { document, gStore, windowRequire } = monitor.panelWin;
+ let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let {
getDisplayedRequests,
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
- gStore.dispatch(Actions.batchEnable(false));
+ store.dispatch(Actions.batchEnable(false));
let wait = waitForNetworkEvents(monitor, 1);
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
content.wrappedJSObject.performRequests();
});
yield wait;
verifyRequestItemTarget(
document,
- getDisplayedRequests(gStore.getState()),
- getSortedRequests(gStore.getState()).get(0),
+ getDisplayedRequests(store.getState()),
+ getSortedRequests(store.getState()).get(0),
"GET",
CONTENT_TYPE_SJS + "?fmt=txt",
{
status: 200,
statusText: "DA DA DA"
}
);
--- a/devtools/client/netmonitor/test/browser_net_cyrillic-02.js
+++ b/devtools/client/netmonitor/test/browser_net_cyrillic-02.js
@@ -7,30 +7,30 @@
* Tests if cyrillic text is rendered correctly in the source editor
* when loaded directly from an HTML page.
*/
add_task(function* () {
let { tab, monitor } = yield initNetMonitor(CYRILLIC_URL);
info("Starting test... ");
- let { document, gStore, windowRequire } = monitor.panelWin;
+ let { document, store, windowRequire } = monitor.panelWin;
let {
getDisplayedRequests,
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
let wait = waitForNetworkEvents(monitor, 1);
tab.linkedBrowser.reload();
yield wait;
verifyRequestItemTarget(
document,
- getDisplayedRequests(gStore.getState()),
- getSortedRequests(gStore.getState()).get(0),
+ getDisplayedRequests(store.getState()),
+ getSortedRequests(store.getState()).get(0),
"GET",
CYRILLIC_URL,
{
status: 200,
statusText: "OK"
});
wait = waitForDOM(document, "#headers-panel");
--- a/devtools/client/netmonitor/test/browser_net_filter-01.js
+++ b/devtools/client/netmonitor/test/browser_net_filter-01.js
@@ -125,43 +125,43 @@ const EXPECTED_REQUESTS = [
status: 101,
statusText: "Switching Protocols",
}
}
];
add_task(function* () {
let { monitor } = yield initNetMonitor(FILTERING_URL);
- let { document, gStore, windowRequire } = monitor.panelWin;
+ let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let {
getDisplayedRequests,
getSelectedRequest,
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
- gStore.dispatch(Actions.batchEnable(false));
+ store.dispatch(Actions.batchEnable(false));
function setFreetextFilter(value) {
- gStore.dispatch(Actions.setRequestFilterText(value));
+ store.dispatch(Actions.setRequestFilterText(value));
}
info("Starting test... ");
let wait = waitForNetworkEvents(monitor, 9);
loadCommonFrameScript();
yield performRequestsInContent(REQUESTS_WITH_MEDIA_AND_FLASH_AND_WS);
yield wait;
EventUtils.sendMouseEvent({ type: "mousedown" },
document.querySelectorAll(".request-list-item")[0]);
- isnot(getSelectedRequest(gStore.getState()), null,
+ isnot(getSelectedRequest(store.getState()), null,
"There should be a selected item in the requests menu.");
- is(getSelectedIndex(gStore.getState()), 0,
+ is(getSelectedIndex(store.getState()), 0,
"The first item should be selected in the requests menu.");
is(!!document.querySelector(".network-details-panel"), true,
"The network details panel should render correctly.");
// First test with single filters...
testFilterButtons(monitor, "all");
testContents([1, 1, 1, 1, 1, 1, 1, 1, 1]);
@@ -311,23 +311,23 @@ add_task(function* () {
function getSelectedIndex(state) {
if (!state.requests.selectedId) {
return -1;
}
return getSortedRequests(state).findIndex(r => r.id === state.requests.selectedId);
}
function testContents(visibility) {
- isnot(getSelectedRequest(gStore.getState()), undefined,
+ isnot(getSelectedRequest(store.getState()), undefined,
"There should still be a selected item after filtering.");
- is(getSelectedIndex(gStore.getState()), 0,
+ is(getSelectedIndex(store.getState()), 0,
"The first item should be still selected after filtering.");
- const items = getSortedRequests(gStore.getState());
- const visibleItems = getDisplayedRequests(gStore.getState());
+ const items = getSortedRequests(store.getState());
+ const visibleItems = getDisplayedRequests(store.getState());
is(items.size, visibility.length,
"There should be a specific amount of items in the requests menu.");
is(visibleItems.size, visibility.filter(e => e).length,
"There should be a specific amount of visible items in the requests menu.");
for (let i = 0; i < visibility.length; i++) {
let itemId = items.get(i).id;
@@ -336,18 +336,18 @@ add_task(function* () {
is(isThere, shouldBeVisible,
`The item at index ${i} has visibility=${shouldBeVisible}`);
if (shouldBeVisible) {
let { method, url, data } = EXPECTED_REQUESTS[i];
verifyRequestItemTarget(
document,
- getDisplayedRequests(gStore.getState()),
- getSortedRequests(gStore.getState()).get(i),
+ getDisplayedRequests(store.getState()),
+ getSortedRequests(store.getState()).get(i),
method,
url,
data
);
}
}
}
});
--- a/devtools/client/netmonitor/test/browser_net_filter-02.js
+++ b/devtools/client/netmonitor/test/browser_net_filter-02.js
@@ -131,37 +131,37 @@ const EXPECTED_REQUESTS = [
add_task(function* () {
let { monitor } = yield initNetMonitor(FILTERING_URL);
info("Starting test... ");
// It seems that this test may be slow on Ubuntu builds running on ec2.
requestLongerTimeout(2);
- let { document, gStore, windowRequire } = monitor.panelWin;
+ let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let {
getDisplayedRequests,
getSelectedRequest,
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
- gStore.dispatch(Actions.batchEnable(false));
+ store.dispatch(Actions.batchEnable(false));
let wait = waitForNetworkEvents(monitor, 9);
loadCommonFrameScript();
yield performRequestsInContent(REQUESTS_WITH_MEDIA_AND_FLASH_AND_WS);
yield wait;
EventUtils.sendMouseEvent({ type: "mousedown" },
document.querySelectorAll(".request-list-item")[0]);
- isnot(getSelectedRequest(gStore.getState()), null,
+ isnot(getSelectedRequest(store.getState()), null,
"There should be a selected item in the requests menu.");
- is(getSelectedIndex(gStore.getState()), 0,
+ is(getSelectedIndex(store.getState()), 0,
"The first item should be selected in the requests menu.");
is(!!document.querySelector(".network-details-panel"), true,
"The network details panel should be visible after toggle button was pressed.");
testFilterButtons(monitor, "all");
testContents([1, 1, 1, 1, 1, 1, 1, 1, 1]);
info("Testing html filtering.");
@@ -201,25 +201,25 @@ add_task(function* () {
function getSelectedIndex(state) {
if (!state.requests.selectedId) {
return -1;
}
return getSortedRequests(state).findIndex(r => r.id === state.requests.selectedId);
}
function testContents(visibility) {
- isnot(getSelectedRequest(gStore.getState()), null,
+ isnot(getSelectedRequest(store.getState()), null,
"There should still be a selected item after filtering.");
- is(getSelectedIndex(gStore.getState()), 0,
+ is(getSelectedIndex(store.getState()), 0,
"The first item should be still selected after filtering.");
is(!!document.querySelector(".network-details-panel"), true,
"The network details panel should still be visible after filtering.");
- const items = getSortedRequests(gStore.getState());
- const visibleItems = getDisplayedRequests(gStore.getState());
+ const items = getSortedRequests(store.getState());
+ const visibleItems = getDisplayedRequests(store.getState());
is(items.size, visibility.length,
"There should be a specific amount of items in the requests menu.");
is(visibleItems.size, visibility.filter(e => e).length,
"There should be a specific amount of visible items in the requests menu.");
for (let i = 0; i < visibility.length; i++) {
let itemId = items.get(i).id;
@@ -230,18 +230,18 @@ add_task(function* () {
}
for (let i = 0; i < EXPECTED_REQUESTS.length; i++) {
let { method, url, data } = EXPECTED_REQUESTS[i];
for (let j = i; j < visibility.length; j += EXPECTED_REQUESTS.length) {
if (visibility[j]) {
verifyRequestItemTarget(
document,
- getDisplayedRequests(gStore.getState()),
- getSortedRequests(gStore.getState()).get(i),
+ getDisplayedRequests(store.getState()),
+ getSortedRequests(store.getState()).get(i),
method,
url,
data
);
}
}
}
}
--- a/devtools/client/netmonitor/test/browser_net_filter-03.js
+++ b/devtools/client/netmonitor/test/browser_net_filter-03.js
@@ -22,44 +22,44 @@ const REQUESTS_WITH_MEDIA = BASIC_REQUES
add_task(function* () {
let { monitor } = yield initNetMonitor(FILTERING_URL);
info("Starting test... ");
// It seems that this test may be slow on Ubuntu builds running on ec2.
requestLongerTimeout(2);
- let { document, gStore, windowRequire } = monitor.panelWin;
+ let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let {
getDisplayedRequests,
getSelectedRequest,
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
- gStore.dispatch(Actions.batchEnable(false));
+ store.dispatch(Actions.batchEnable(false));
// The test assumes that the first HTML request here has a longer response
// body than the other HTML requests performed later during the test.
let requests = Cu.cloneInto(REQUESTS_WITH_MEDIA, {});
let newres = "res=<p>" + new Array(10).join(Math.random(10)) + "</p>";
requests[0].url = requests[0].url.replace("res=undefined", newres);
loadCommonFrameScript();
let wait = waitForNetworkEvents(monitor, 7);
yield performRequestsInContent(requests);
yield wait;
EventUtils.sendMouseEvent({ type: "mousedown" },
document.querySelectorAll(".request-list-item")[0]);
- isnot(getSelectedRequest(gStore.getState()), null,
+ isnot(getSelectedRequest(store.getState()), null,
"There should be a selected item in the requests menu.");
- is(getSelectedIndex(gStore.getState()), 0,
+ is(getSelectedIndex(store.getState()), 0,
"The first item should be selected in the requests menu.");
is(!!document.querySelector(".network-details-panel"), true,
"The network details panel should be visible after toggle button was pressed.");
testFilterButtons(monitor, "all");
testContents([0, 1, 2, 3, 4, 5, 6], 7, 0);
info("Sorting by size, ascending.");
@@ -106,21 +106,21 @@ add_task(function* () {
function getSelectedIndex(state) {
if (!state.requests.selectedId) {
return -1;
}
return getSortedRequests(state).findIndex(r => r.id === state.requests.selectedId);
}
function testContents(order, visible, selection) {
- isnot(getSelectedRequest(gStore.getState()), null,
+ isnot(getSelectedRequest(store.getState()), null,
"There should still be a selected item after filtering.");
- is(getSelectedIndex(gStore.getState()), selection,
+ is(getSelectedIndex(store.getState()), selection,
"The first item should be still selected after filtering.");
is(!!document.querySelector(".network-details-panel"), true,
"The network details panel should still be visible after filtering.");
- is(getSortedRequests(gStore.getState()).length, order.length,
+ is(getSortedRequests(store.getState()).length, order.length,
"There should be a specific amount of items in the requests menu.");
- is(getDisplayedRequests(gStore.getState()).length, visible,
+ is(getDisplayedRequests(store.getState()).length, visible,
"There should be a specific amount of visible items in the requests menu.");
}
});
--- a/devtools/client/netmonitor/test/browser_net_filter-04.js
+++ b/devtools/client/netmonitor/test/browser_net_filter-04.js
@@ -31,21 +31,21 @@ const REQUESTS_WITH_MEDIA_AND_FLASH_AND_
add_task(function* () {
Services.prefs.setCharPref("devtools.netmonitor.filters",
'["bogus", "js", "alsobogus"]');
let { monitor } = yield initNetMonitor(FILTERING_URL);
info("Starting test... ");
- let { document, gStore, windowRequire } = monitor.panelWin;
+ let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let { Prefs } = windowRequire("devtools/client/netmonitor/src/utils/prefs");
- gStore.dispatch(Actions.batchEnable(false));
+ store.dispatch(Actions.batchEnable(false));
is(Prefs.filters.length, 3,
"All the filter types should be loaded.");
is(Prefs.filters[0], "bogus",
"The first filter type is invalid, but loaded anyway.");
let wait = waitForNetworkEvents(monitor, 9);
loadCommonFrameScript();
--- a/devtools/client/netmonitor/test/browser_net_filter-flags.js
+++ b/devtools/client/netmonitor/test/browser_net_filter-flags.js
@@ -105,27 +105,27 @@ const EXPECTED_REQUESTS = [
type: "plain",
fullMimeType: "text/plain; charset=utf-8"
}
},
];
add_task(function* () {
let { monitor } = yield initNetMonitor(FILTERING_URL);
- let { document, gStore, windowRequire } = monitor.panelWin;
+ let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let {
getDisplayedRequests,
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
- gStore.dispatch(Actions.batchEnable(false));
+ store.dispatch(Actions.batchEnable(false));
function setFreetextFilter(value) {
- gStore.dispatch(Actions.setRequestFilterText(value));
+ store.dispatch(Actions.setRequestFilterText(value));
}
info("Starting test... ");
let waitNetwork = waitForNetworkEvents(monitor, 8);
loadCommonFrameScript();
yield performRequestsInContent(REQUESTS);
yield waitNetwork;
@@ -185,18 +185,18 @@ add_task(function* () {
// Test regex filter
setFreetextFilter("regexp:content.*?Sam");
testContents([1, 0, 0, 0, 0, 0, 0, 0]);
yield teardown(monitor);
function testContents(visibility) {
- const items = getSortedRequests(gStore.getState());
- const visibleItems = getDisplayedRequests(gStore.getState());
+ const items = getSortedRequests(store.getState());
+ const visibleItems = getDisplayedRequests(store.getState());
is(items.size, visibility.length,
"There should be a specific amount of items in the requests menu.");
is(visibleItems.size, visibility.filter(e => e).length,
"There should be a specific amount of visible items in the requests menu.");
for (let i = 0; i < visibility.length; i++) {
let itemId = items.get(i).id;
@@ -204,18 +204,18 @@ add_task(function* () {
let isThere = visibleItems.some(r => r.id == itemId);
is(isThere, shouldBeVisible,
`The item at index ${i} has visibility=${shouldBeVisible}`);
if (shouldBeVisible) {
let { method, url, data } = EXPECTED_REQUESTS[i];
verifyRequestItemTarget(
document,
- getDisplayedRequests(gStore.getState()),
- getSortedRequests(gStore.getState()).get(i),
+ getDisplayedRequests(store.getState()),
+ getSortedRequests(store.getState()).get(i),
method,
url,
data
);
}
}
}
});
--- a/devtools/client/netmonitor/test/browser_net_footer-summary.js
+++ b/devtools/client/netmonitor/test/browser_net_footer-summary.js
@@ -13,24 +13,24 @@ add_task(function* () {
getFormattedTime
} = require("devtools/client/netmonitor/src/utils/format-utils");
requestLongerTimeout(2);
let { tab, monitor } = yield initNetMonitor(FILTERING_URL);
info("Starting test... ");
- let { document, gStore, windowRequire } = monitor.panelWin;
+ let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let { getDisplayedRequestsSummary } =
windowRequire("devtools/client/netmonitor/src/selectors/index");
let { L10N } = windowRequire("devtools/client/netmonitor/src/utils/l10n");
let { PluralForm } = windowRequire("devtools/shared/plural-form");
- gStore.dispatch(Actions.batchEnable(false));
+ store.dispatch(Actions.batchEnable(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* () {
content.wrappedJSObject.performRequests('{ "getMedia": true, "getFlash": true }');
});
@@ -44,17 +44,17 @@ add_task(function* () {
EventUtils.sendMouseEvent({ type: "click" }, buttonEl);
testStatus();
}
}
yield teardown(monitor);
function testStatus() {
- let state = gStore.getState();
+ let state = store.getState();
let totalRequestsCount = state.requests.requests.size;
let requestsSummary = getDisplayedRequestsSummary(state);
info(`Current requests: ${requestsSummary.count} of ${totalRequestsCount}.`);
let valueCount = document.querySelector(".requests-list-network-summary-count")
.textContent;
info("Current summary count: " + valueCount);
let expectedCount = PluralForm.get(requestsSummary.count,
--- a/devtools/client/netmonitor/test/browser_net_frame.js
+++ b/devtools/client/netmonitor/test/browser_net_frame.js
@@ -153,53 +153,53 @@ add_task(function* () {
// the initNetMonitor function clears the network request list after the
// page is loaded. That's why we first load a bogus page from SIMPLE_URL,
// and only then load the real thing from TOP_URL - we want to catch
// all the requests the page is making, not only the XHRs.
// We can't use about:blank here, because initNetMonitor checks that the
// page has actually made at least one request.
let { tab, monitor } = yield initNetMonitor(SIMPLE_URL);
- let { document, gStore, windowRequire } = monitor.panelWin;
+ let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let {
getDisplayedRequests,
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
- gStore.dispatch(Actions.batchEnable(false));
+ store.dispatch(Actions.batchEnable(false));
tab.linkedBrowser.loadURI(TOP_URL, null, null);
yield waitForNetworkEvents(monitor, REQUEST_COUNT);
- is(gStore.getState().requests.requests.size, REQUEST_COUNT,
+ is(store.getState().requests.requests.size, REQUEST_COUNT,
"All the page events should be recorded.");
// While there is a defined order for requests in each document separately, the requests
// from different documents may interleave in various ways that change per test run, so
// there is not a single order when considering all the requests together.
let currentTop = 0;
let currentSub = 0;
for (let i = 0; i < REQUEST_COUNT; i++) {
- let requestItem = getSortedRequests(gStore.getState()).get(i);
+ let requestItem = getSortedRequests(store.getState()).get(i);
let itemUrl = requestItem.url;
let itemCauseUri = requestItem.cause.loadingDocumentUri;
let spec;
if (itemUrl == SUB_URL || itemCauseUri == SUB_URL) {
spec = EXPECTED_REQUESTS_SUB[currentSub++];
} else {
spec = EXPECTED_REQUESTS_TOP[currentTop++];
}
let { method, url, causeType, causeUri, stack } = spec;
verifyRequestItemTarget(
document,
- getDisplayedRequests(gStore.getState()),
+ getDisplayedRequests(store.getState()),
requestItem,
method,
url,
{ cause: { type: causeType, loadingDocumentUri: causeUri } }
);
let { stacktrace } = requestItem.cause;
let stackLen = stacktrace ? stacktrace.length : 0;
--- a/devtools/client/netmonitor/test/browser_net_header-docs.js
+++ b/devtools/client/netmonitor/test/browser_net_header-docs.js
@@ -6,35 +6,35 @@
/**
* Tests if "Learn More" links are correctly displayed
* next to headers.
*/
add_task(function* () {
let { tab, monitor } = yield initNetMonitor(POST_DATA_URL);
info("Starting test... ");
- let { document, gStore, windowRequire } = monitor.panelWin;
+ let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let {
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
let { getHeadersURL } = require("devtools/client/netmonitor/src/utils/mdn-utils");
- gStore.dispatch(Actions.batchEnable(false));
+ store.dispatch(Actions.batchEnable(false));
let wait = waitForNetworkEvents(monitor, 0, 2);
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
content.wrappedJSObject.performRequests();
});
yield wait;
EventUtils.sendMouseEvent({ type: "click" },
document.querySelectorAll(".request-list-item")[0]);
- testShowLearnMore(getSortedRequests(gStore.getState()).get(0));
+ testShowLearnMore(getSortedRequests(store.getState()).get(0));
return teardown(monitor);
/*
* Tests that a "Learn More" button is only shown if
* and only if a header is documented in MDN.
*/
function testShowLearnMore(data) {
--- a/devtools/client/netmonitor/test/browser_net_icon-preview.js
+++ b/devtools/client/netmonitor/test/browser_net_icon-preview.js
@@ -7,37 +7,37 @@
* Tests if image responses show a thumbnail in the requests menu.
*/
add_task(function* () {
let { tab, monitor } = yield initNetMonitor(CONTENT_TYPE_WITHOUT_CACHE_URL);
const SELECTOR = ".requests-list-icon[src]";
info("Starting test... ");
- let { document, gStore, windowRequire } = monitor.panelWin;
+ let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
- let { NetMonitorController } =
- windowRequire("devtools/client/netmonitor/src/netmonitor-controller");
+ let { triggerActivity } =
+ windowRequire("devtools/client/netmonitor/src/connector/index");
let { ACTIVITY_TYPE } = windowRequire("devtools/client/netmonitor/src/constants");
- gStore.dispatch(Actions.batchEnable(false));
+ store.dispatch(Actions.batchEnable(false));
let wait = waitForNetworkEvents(monitor, CONTENT_TYPE_WITHOUT_CACHE_REQUESTS);
yield performRequests();
yield wait;
yield waitUntil(() => !!document.querySelector(SELECTOR));
info("Checking the image thumbnail when all items are shown.");
checkImageThumbnail();
- gStore.dispatch(Actions.sortBy("contentSize"));
+ store.dispatch(Actions.sortBy("contentSize"));
info("Checking the image thumbnail when all items are sorted.");
checkImageThumbnail();
- gStore.dispatch(Actions.toggleRequestFilterType("images"));
+ store.dispatch(Actions.toggleRequestFilterType("images"));
info("Checking the image thumbnail when only images are shown.");
checkImageThumbnail();
info("Reloading the debuggee and performing all requests again...");
wait = waitForNetworkEvents(monitor, CONTENT_TYPE_WITHOUT_CACHE_REQUESTS);
yield reloadAndPerformRequests();
yield wait;
yield waitUntil(() => !!document.querySelector(SELECTOR));
@@ -49,17 +49,17 @@ add_task(function* () {
function performRequests() {
return ContentTask.spawn(tab.linkedBrowser, {}, function* () {
content.wrappedJSObject.performRequests();
});
}
function* reloadAndPerformRequests() {
- yield NetMonitorController.triggerActivity(ACTIVITY_TYPE.RELOAD.WITH_CACHE_ENABLED);
+ yield triggerActivity(ACTIVITY_TYPE.RELOAD.WITH_CACHE_ENABLED);
yield performRequests();
}
function checkImageThumbnail() {
is(document.querySelectorAll(SELECTOR).length, 1,
"There should be only one image request with a thumbnail displayed.");
is(document.querySelector(SELECTOR).src, TEST_IMAGE_DATA_URI,
"The image requests-list-icon thumbnail is displayed correctly.");
--- a/devtools/client/netmonitor/test/browser_net_image-tooltip.js
+++ b/devtools/client/netmonitor/test/browser_net_image-tooltip.js
@@ -9,24 +9,24 @@ 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);
const SELECTOR = ".requests-list-icon[src]";
info("Starting test... ");
- let { document, gStore, windowRequire } = monitor.panelWin;
+ let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
- let { NetMonitorController } =
- windowRequire("devtools/client/netmonitor/src/netmonitor-controller");
+ let { triggerActivity } =
+ windowRequire("devtools/client/netmonitor/src/connector/index");
let { ACTIVITY_TYPE } = windowRequire("devtools/client/netmonitor/src/constants");
let toolboxDoc = monitor.panelWin.parent.document;
- gStore.dispatch(Actions.batchEnable(false));
+ store.dispatch(Actions.batchEnable(false));
let onEvents = waitForNetworkEvents(monitor, IMAGE_TOOLTIP_REQUESTS);
yield performRequests();
yield onEvents;
yield waitUntil(() => !!document.querySelector(SELECTOR));
info("Checking the image thumbnail after a few requests were made...");
yield showTooltipAndVerify(document.querySelectorAll(".request-list-item")[0]);
@@ -35,17 +35,17 @@ add_task(function* test() {
// the icon for the request of the next test.
info("Checking the image thumbnail gets hidden...");
yield hideTooltipAndVerify(document.querySelectorAll(".request-list-item")[0]);
// +1 extra document reload
onEvents = waitForNetworkEvents(monitor, IMAGE_TOOLTIP_REQUESTS + 1);
info("Reloading the debuggee and performing all requests again...");
- yield NetMonitorController.triggerActivity(ACTIVITY_TYPE.RELOAD.WITH_CACHE_ENABLED);
+ yield triggerActivity(ACTIVITY_TYPE.RELOAD.WITH_CACHE_ENABLED);
yield performRequests();
yield onEvents;
yield waitUntil(() => !!document.querySelector(SELECTOR));
info("Checking the image thumbnail after a reload.");
yield showTooltipAndVerify(document.querySelectorAll(".request-list-item")[1]);
info("Checking if the image thumbnail is hidden when mouse leaves the menu widget");
--- a/devtools/client/netmonitor/test/browser_net_json-b64.js
+++ b/devtools/client/netmonitor/test/browser_net_json-b64.js
@@ -7,20 +7,20 @@
* Tests if JSON responses encoded in base64 are handled correctly.
*/
add_task(function* () {
let { L10N } = require("devtools/client/netmonitor/src/utils/l10n");
let { tab, monitor } = yield initNetMonitor(JSON_B64_URL);
info("Starting test... ");
- let { document, gStore, windowRequire } = monitor.panelWin;
+ let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
- gStore.dispatch(Actions.batchEnable(false));
+ store.dispatch(Actions.batchEnable(false));
let wait = waitForNetworkEvents(monitor, 1);
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
content.wrappedJSObject.performRequests();
});
yield wait;
wait = waitForDOM(document, "#response-panel");
--- a/devtools/client/netmonitor/test/browser_net_json-long.js
+++ b/devtools/client/netmonitor/test/browser_net_json-long.js
@@ -12,35 +12,35 @@ add_task(function* () {
let { tab, monitor } = yield initNetMonitor(JSON_LONG_URL);
info("Starting test... ");
// This is receiving over 80 KB of json and will populate over 6000 items
// in a variables view instance. Debug builds are slow.
requestLongerTimeout(4);
- let { document, gStore, windowRequire } = monitor.panelWin;
+ let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let {
getDisplayedRequests,
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
- gStore.dispatch(Actions.batchEnable(false));
+ store.dispatch(Actions.batchEnable(false));
let wait = waitForNetworkEvents(monitor, 1);
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
content.wrappedJSObject.performRequests();
});
yield wait;
verifyRequestItemTarget(
document,
- getDisplayedRequests(gStore.getState()),
- getSortedRequests(gStore.getState()).get(0),
+ getDisplayedRequests(store.getState()),
+ getSortedRequests(store.getState()).get(0),
"GET",
CONTENT_TYPE_SJS + "?fmt=json-long",
{
status: 200,
statusText: "OK",
type: "json",
fullMimeType: "text/json; charset=utf-8",
size: L10N.getFormatStr("networkMenu.sizeKB",
--- a/devtools/client/netmonitor/test/browser_net_json-malformed.js
+++ b/devtools/client/netmonitor/test/browser_net_json-malformed.js
@@ -7,35 +7,35 @@
* Tests if malformed JSON responses are handled correctly.
*/
add_task(function* () {
let { L10N } = require("devtools/client/netmonitor/src/utils/l10n");
let { tab, monitor } = yield initNetMonitor(JSON_MALFORMED_URL);
info("Starting test... ");
- let { document, gStore, windowRequire } = monitor.panelWin;
+ let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let {
getDisplayedRequests,
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
- gStore.dispatch(Actions.batchEnable(false));
+ store.dispatch(Actions.batchEnable(false));
let wait = waitForNetworkEvents(monitor, 1);
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
content.wrappedJSObject.performRequests();
});
yield wait;
verifyRequestItemTarget(
document,
- getDisplayedRequests(gStore.getState()),
- getSortedRequests(gStore.getState()).get(0),
+ getDisplayedRequests(store.getState()),
+ getSortedRequests(store.getState()).get(0),
"GET",
CONTENT_TYPE_SJS + "?fmt=json-malformed",
{
status: 200,
statusText: "OK",
type: "json",
fullMimeType: "text/json; charset=utf-8"
});
--- a/devtools/client/netmonitor/test/browser_net_json-null.js
+++ b/devtools/client/netmonitor/test/browser_net_json-null.js
@@ -6,21 +6,21 @@
/**
* Tests if JSON responses containing null values are properly displayed.
*/
add_task(function* () {
let { tab, monitor } = yield initNetMonitor(JSON_BASIC_URL + "?name=null");
info("Starting test... ");
- let { document, gStore, windowRequire } = monitor.panelWin;
+ let { document, store, windowRequire } = monitor.panelWin;
let { L10N } = windowRequire("devtools/client/netmonitor/src/utils/l10n");
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
- gStore.dispatch(Actions.batchEnable(false));
+ store.dispatch(Actions.batchEnable(false));
let wait = waitForNetworkEvents(monitor, 1);
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
content.wrappedJSObject.performRequests();
});
yield wait;
yield openResponsePanel();
--- a/devtools/client/netmonitor/test/browser_net_json_custom_mime.js
+++ b/devtools/client/netmonitor/test/browser_net_json_custom_mime.js
@@ -6,36 +6,36 @@
/**
* Tests if JSON responses with unusal/custom MIME types are handled correctly.
*/
add_task(function* () {
let { tab, monitor } = yield initNetMonitor(JSON_CUSTOM_MIME_URL);
info("Starting test... ");
- let { document, gStore, windowRequire } = monitor.panelWin;
+ let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let { L10N } = windowRequire("devtools/client/netmonitor/src/utils/l10n");
let {
getDisplayedRequests,
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
- gStore.dispatch(Actions.batchEnable(false));
+ store.dispatch(Actions.batchEnable(false));
let wait = waitForNetworkEvents(monitor, 1);
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
content.wrappedJSObject.performRequests();
});
yield wait;
verifyRequestItemTarget(
document,
- getDisplayedRequests(gStore.getState()),
- getSortedRequests(gStore.getState()).get(0),
+ getDisplayedRequests(store.getState()),
+ getSortedRequests(store.getState()).get(0),
"GET",
CONTENT_TYPE_SJS + "?fmt=json-custom-mime",
{
status: 200,
statusText: "OK",
type: "x-bigcorp-json",
fullMimeType: "text/x-bigcorp-json; charset=utf-8",
size: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 41),
--- a/devtools/client/netmonitor/test/browser_net_json_text_mime.js
+++ b/devtools/client/netmonitor/test/browser_net_json_text_mime.js
@@ -8,35 +8,35 @@
*/
add_task(function* () {
let { L10N } = require("devtools/client/netmonitor/src/utils/l10n");
let { tab, monitor } = yield initNetMonitor(JSON_TEXT_MIME_URL);
info("Starting test... ");
- let { document, gStore, windowRequire } = monitor.panelWin;
+ let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let {
getDisplayedRequests,
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
- gStore.dispatch(Actions.batchEnable(false));
+ store.dispatch(Actions.batchEnable(false));
let wait = waitForNetworkEvents(monitor, 1);
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
content.wrappedJSObject.performRequests();
});
yield wait;
verifyRequestItemTarget(
document,
- getDisplayedRequests(gStore.getState()),
- getSortedRequests(gStore.getState()).get(0),
+ getDisplayedRequests(store.getState()),
+ getSortedRequests(store.getState()).get(0),
"GET",
CONTENT_TYPE_SJS + "?fmt=json-text-mime",
{
status: 200,
statusText: "OK",
type: "plain",
fullMimeType: "text/plain; charset=utf-8",
size: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 41),
--- a/devtools/client/netmonitor/test/browser_net_jsonp.js
+++ b/devtools/client/netmonitor/test/browser_net_jsonp.js
@@ -8,49 +8,49 @@
*/
add_task(function* () {
let { L10N } = require("devtools/client/netmonitor/src/utils/l10n");
let { tab, monitor } = yield initNetMonitor(JSONP_URL);
info("Starting test... ");
- let { document, gStore, windowRequire } = monitor.panelWin;
+ let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let {
getDisplayedRequests,
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
- gStore.dispatch(Actions.batchEnable(false));
+ store.dispatch(Actions.batchEnable(false));
let wait = waitForNetworkEvents(monitor, 2);
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
content.wrappedJSObject.performRequests();
});
yield wait;
verifyRequestItemTarget(
document,
- getDisplayedRequests(gStore.getState()),
- getSortedRequests(gStore.getState()).get(0),
+ getDisplayedRequests(store.getState()),
+ getSortedRequests(store.getState()).get(0),
"GET",
CONTENT_TYPE_SJS + "?fmt=jsonp&jsonp=$_0123Fun",
{
status: 200,
statusText: "OK",
type: "json",
fullMimeType: "text/json; charset=utf-8",
size: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 41),
time: true
});
verifyRequestItemTarget(
document,
- getDisplayedRequests(gStore.getState()),
- getSortedRequests(gStore.getState()).get(1),
+ getDisplayedRequests(store.getState()),
+ getSortedRequests(store.getState()).get(1),
"GET",
CONTENT_TYPE_SJS + "?fmt=jsonp2&jsonp=$_4567Sad",
{
status: 200,
statusText: "OK",
type: "json",
fullMimeType: "text/json; charset=utf-8",
size: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 54),
--- a/devtools/client/netmonitor/test/browser_net_large-response.js
+++ b/devtools/client/netmonitor/test/browser_net_large-response.js
@@ -12,35 +12,35 @@ const HTML_LONG_URL = CONTENT_TYPE_SJS +
add_task(function* () {
let { tab, monitor } = yield initNetMonitor(CUSTOM_GET_URL);
info("Starting test... ");
// This test could potentially be slow because over 100 KB of stuff
// is going to be requested and displayed in the source editor.
requestLongerTimeout(2);
- let { document, gStore, windowRequire } = monitor.panelWin;
+ let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let {
getDisplayedRequests,
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
- gStore.dispatch(Actions.batchEnable(false));
+ store.dispatch(Actions.batchEnable(false));
let wait = waitForNetworkEvents(monitor, 1);
yield ContentTask.spawn(tab.linkedBrowser, HTML_LONG_URL, function* (url) {
content.wrappedJSObject.performRequests(1, url);
});
yield wait;
verifyRequestItemTarget(
document,
- getDisplayedRequests(gStore.getState()),
- getSortedRequests(gStore.getState()).get(0),
+ getDisplayedRequests(store.getState()),
+ getSortedRequests(store.getState()).get(0),
"GET",
CONTENT_TYPE_SJS + "?fmt=html-long",
{
status: 200,
statusText: "OK"
});
wait = waitForDOM(document, "#response-panel .CodeMirror-code");
--- a/devtools/client/netmonitor/test/browser_net_open_request_in_tab.js
+++ b/devtools/client/netmonitor/test/browser_net_open_request_in_tab.js
@@ -6,20 +6,20 @@
/**
* Tests if Open in new tab works.
*/
add_task(function* () {
let { tab, monitor } = yield initNetMonitor(CUSTOM_GET_URL);
info("Starting test...");
- let { document, gStore, windowRequire } = monitor.panelWin;
+ let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
- gStore.dispatch(Actions.batchEnable(false));
+ store.dispatch(Actions.batchEnable(false));
let wait = waitForNetworkEvents(monitor, 1);
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
content.wrappedJSObject.performRequests(1);
});
yield wait;
EventUtils.sendMouseEvent({ type: "mousedown" },
deleted file mode 100644
--- a/devtools/client/netmonitor/test/browser_net_page-nav.js
+++ /dev/null
@@ -1,72 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-/**
- * Tests if page navigation ("close", "navigate", etc.) triggers an appropriate
- * action in the network monitor.
- */
-
-add_task(function* () {
- let { tab, monitor } = yield initNetMonitor(SIMPLE_URL);
- info("Starting test... ");
-
- let { windowRequire } = monitor.panelWin;
- let { NetMonitorController } =
- windowRequire("devtools/client/netmonitor/src/netmonitor-controller");
- let { EVENTS } = windowRequire("devtools/client/netmonitor/src/constants");
-
- yield testNavigate();
- yield testNavigateBack();
- yield testClose();
-
- function* testNavigate() {
- info("Navigating forward...");
-
- let onWillNav = monitor.panelWin.once(EVENTS.TARGET_WILL_NAVIGATE);
- let onDidNav = monitor.panelWin.once(EVENTS.TARGET_DID_NAVIGATE);
-
- tab.linkedBrowser.loadURI(NAVIGATE_URL);
- yield onWillNav;
-
- is(tab.linkedBrowser.currentURI.spec, SIMPLE_URL,
- "Target started navigating to the correct location.");
-
- yield onDidNav;
- is(tab.linkedBrowser.currentURI.spec, NAVIGATE_URL,
- "Target finished navigating to the correct location.");
- }
-
- function* testNavigateBack() {
- info("Navigating backward...");
-
- let onWillNav = monitor.panelWin.once(EVENTS.TARGET_WILL_NAVIGATE);
- let onDidNav = monitor.panelWin.once(EVENTS.TARGET_DID_NAVIGATE);
-
- tab.linkedBrowser.loadURI(SIMPLE_URL);
- yield onWillNav;
-
- is(tab.linkedBrowser.currentURI.spec, NAVIGATE_URL,
- "Target started navigating back to the previous location.");
-
- yield onDidNav;
- is(tab.linkedBrowser.currentURI.spec, SIMPLE_URL,
- "Target finished navigating back to the previous location.");
- }
-
- function* testClose() {
- info("Closing...");
-
- let onDestroyed = monitor.once("destroyed");
- removeTab(tab);
- yield onDestroyed;
-
- ok(!NetMonitorController.client,
- "There shouldn't be a client available after destruction.");
- ok(!NetMonitorController.tabClient,
- "There shouldn't be a tabClient available after destruction.");
- ok(!NetMonitorController.webConsoleClient,
- "There shouldn't be a webConsoleClient available after destruction.");
- }
-});
--- a/devtools/client/netmonitor/test/browser_net_pane-toggle.js
+++ b/devtools/client/netmonitor/test/browser_net_pane-toggle.js
@@ -6,76 +6,76 @@
/**
* Tests if toggling the details pane works as expected.
*/
add_task(function* () {
let { tab, monitor } = yield initNetMonitor(SIMPLE_URL);
info("Starting test... ");
- let { document, gStore, windowRequire } = monitor.panelWin;
+ let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let { EVENTS } = windowRequire("devtools/client/netmonitor/src/constants");
let {
getSelectedRequest,
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
- gStore.dispatch(Actions.batchEnable(false));
+ store.dispatch(Actions.batchEnable(false));
let toggleButton = document.querySelector(".network-details-panel-toggle");
is(toggleButton.hasAttribute("disabled"), true,
"The pane toggle button should be disabled when the frontend is opened.");
is(toggleButton.classList.contains("pane-collapsed"), true,
"The pane toggle button should indicate that the details pane is " +
"collapsed when the frontend is opened.");
is(!!document.querySelector(".network-details-panel"), false,
"The details pane should be hidden when the frontend is opened.");
- is(getSelectedRequest(gStore.getState()), null,
+ is(getSelectedRequest(store.getState()), null,
"There should be no selected item in the requests menu.");
let networkEvent = monitor.panelWin.once(EVENTS.NETWORK_EVENT);
tab.linkedBrowser.reload();
yield networkEvent;
is(toggleButton.hasAttribute("disabled"), false,
"The pane toggle button should be enabled after the first request.");
is(toggleButton.classList.contains("pane-collapsed"), true,
"The pane toggle button should still indicate that the details pane is " +
"collapsed after the first request.");
is(!!document.querySelector(".network-details-panel"), false,
"The details pane should still be hidden after the first request.");
- is(getSelectedRequest(gStore.getState()), null,
+ is(getSelectedRequest(store.getState()), null,
"There should still be no selected item in the requests menu.");
EventUtils.sendMouseEvent({ type: "click" }, toggleButton);
is(toggleButton.hasAttribute("disabled"), false,
"The pane toggle button should still be enabled after being pressed.");
is(toggleButton.classList.contains("pane-collapsed"), false,
"The pane toggle button should now indicate that the details pane is " +
"not collapsed anymore after being pressed.");
is(!!document.querySelector(".network-details-panel"), true,
"The details pane should not be hidden after toggle button was pressed.");
- isnot(getSelectedRequest(gStore.getState()), null,
+ isnot(getSelectedRequest(store.getState()), null,
"There should be a selected item in the requests menu.");
- is(getSelectedIndex(gStore.getState()), 0,
+ is(getSelectedIndex(store.getState()), 0,
"The first item should be selected in the requests menu.");
EventUtils.sendMouseEvent({ type: "click" }, toggleButton);
is(toggleButton.hasAttribute("disabled"), false,
"The pane toggle button should still be enabled after being pressed again.");
is(toggleButton.classList.contains("pane-collapsed"), true,
"The pane toggle button should now indicate that the details pane is " +
"collapsed after being pressed again.");
is(!!document.querySelector(".network-details-panel"), false,
"The details pane should now be hidden after the toggle button was pressed again.");
- is(getSelectedRequest(gStore.getState()), null,
+ is(getSelectedRequest(store.getState()), null,
"There should now be no selected item in the requests menu.");
yield teardown(monitor);
function getSelectedIndex(state) {
if (!state.requests.selectedId) {
return -1;
}
--- a/devtools/client/netmonitor/test/browser_net_post-data-01.js
+++ b/devtools/client/netmonitor/test/browser_net_post-data-01.js
@@ -11,50 +11,50 @@ add_task(function* () {
let { L10N } = require("devtools/client/netmonitor/src/utils/l10n");
// Set a higher panel height in order to get full CodeMirror content
Services.prefs.setIntPref("devtools.toolbox.footer.height", 400);
let { tab, monitor } = yield initNetMonitor(POST_DATA_URL);
info("Starting test... ");
- let { document, gStore, windowRequire } = monitor.panelWin;
+ let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let {
getDisplayedRequests,
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
- gStore.dispatch(Actions.batchEnable(false));
+ store.dispatch(Actions.batchEnable(false));
let wait = waitForNetworkEvents(monitor, 0, 2);
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
content.wrappedJSObject.performRequests();
});
yield wait;
verifyRequestItemTarget(
document,
- getDisplayedRequests(gStore.getState()),
- getSortedRequests(gStore.getState()).get(0),
+ getDisplayedRequests(store.getState()),
+ getSortedRequests(store.getState()).get(0),
"POST",
SIMPLE_SJS + "?foo=bar&baz=42&type=urlencoded",
{
status: 200,
statusText: "Och Aye",
type: "plain",
fullMimeType: "text/plain; charset=utf-8",
size: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 12),
time: true
}
);
verifyRequestItemTarget(
document,
- getDisplayedRequests(gStore.getState()),
- getSortedRequests(gStore.getState()).get(1),
+ getDisplayedRequests(store.getState()),
+ getSortedRequests(store.getState()).get(1),
"POST",
SIMPLE_SJS + "?foo=bar&baz=42&type=multipart",
{
status: 200,
statusText: "Och Aye",
type: "plain",
fullMimeType: "text/plain; charset=utf-8",
size: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 12),
--- a/devtools/client/netmonitor/test/browser_net_post-data-02.js
+++ b/devtools/client/netmonitor/test/browser_net_post-data-02.js
@@ -9,20 +9,20 @@
*/
add_task(function* () {
let { L10N } = require("devtools/client/netmonitor/src/utils/l10n");
let { tab, monitor } = yield initNetMonitor(POST_RAW_URL);
info("Starting test... ");
- let { document, gStore, windowRequire } = monitor.panelWin;
+ let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
- gStore.dispatch(Actions.batchEnable(false));
+ store.dispatch(Actions.batchEnable(false));
let wait = waitForNetworkEvents(monitor, 0, 1);
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
content.wrappedJSObject.performRequests();
});
yield wait;
// Wait for all tree view updated by react
--- a/devtools/client/netmonitor/test/browser_net_post-data-03.js
+++ b/devtools/client/netmonitor/test/browser_net_post-data-03.js
@@ -9,20 +9,20 @@
*/
add_task(function* () {
let { L10N } = require("devtools/client/netmonitor/src/utils/l10n");
let { tab, monitor } = yield initNetMonitor(POST_RAW_WITH_HEADERS_URL);
info("Starting test... ");
- let { document, gStore, windowRequire } = monitor.panelWin;
+ let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
- gStore.dispatch(Actions.batchEnable(false));
+ store.dispatch(Actions.batchEnable(false));
let wait = waitForNetworkEvents(monitor, 0, 1);
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
content.wrappedJSObject.performRequests();
});
yield wait;
// Wait for all tree view updated by react
--- a/devtools/client/netmonitor/test/browser_net_post-data-04.js
+++ b/devtools/client/netmonitor/test/browser_net_post-data-04.js
@@ -9,20 +9,20 @@
*/
add_task(function* () {
let { L10N } = require("devtools/client/netmonitor/src/utils/l10n");
let { tab, monitor } = yield initNetMonitor(POST_JSON_URL);
info("Starting test... ");
- let { document, gStore, windowRequire } = monitor.panelWin;
+ let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
- gStore.dispatch(Actions.batchEnable(false));
+ store.dispatch(Actions.batchEnable(false));
let wait = waitForNetworkEvents(monitor, 0, 1);
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
content.wrappedJSObject.performRequests();
});
yield wait;
// Wait for all tree view updated by react
--- a/devtools/client/netmonitor/test/browser_net_prefs-reload.js
+++ b/devtools/client/netmonitor/test/browser_net_prefs-reload.js
@@ -20,17 +20,17 @@ add_task(function* () {
requestLongerTimeout(3);
// Use these getters instead of caching instances inside the panel win,
// since the tool is reopened a bunch of times during this test
// and the instances will differ.
let getDoc = () => monitor.panelWin.document;
let getPrefs = () => monitor.panelWin
.windowRequire("devtools/client/netmonitor/src/utils/prefs").Prefs;
- let getStore = () => monitor.panelWin.gStore;
+ let getStore = () => monitor.panelWin.store;
let getState = () => getStore().getState();
let prefsToCheck = {
filters: {
// A custom new value to be used for the verified preference.
newValue: ["html", "css"],
// Getter used to retrieve the current value from the frontend, in order
// to verify that the pref was applied properly.
--- a/devtools/client/netmonitor/test/browser_net_raw_headers.js
+++ b/devtools/client/netmonitor/test/browser_net_raw_headers.js
@@ -6,23 +6,23 @@
/**
* Tests if showing raw headers works.
*/
add_task(function* () {
let { tab, monitor } = yield initNetMonitor(POST_DATA_URL);
info("Starting test... ");
- let { document, gStore, windowRequire } = monitor.panelWin;
+ let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let {
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
- gStore.dispatch(Actions.batchEnable(false));
+ store.dispatch(Actions.batchEnable(false));
let wait = waitForNetworkEvents(monitor, 0, 2);
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
content.wrappedJSObject.performRequests();
});
yield wait;
wait = waitForDOM(document, ".headers-overview");
@@ -30,17 +30,17 @@ add_task(function* () {
document.querySelectorAll(".request-list-item")[0]);
yield wait;
wait = waitForDOM(document, ".raw-headers-container textarea", 2);
EventUtils.sendMouseEvent({ type: "click" },
document.querySelectorAll(".headers-summary .devtools-button")[1]);
yield wait;
- testShowRawHeaders(getSortedRequests(gStore.getState()).get(0));
+ testShowRawHeaders(getSortedRequests(store.getState()).get(0));
EventUtils.sendMouseEvent({ type: "click" },
document.querySelectorAll(".headers-summary .devtools-button")[1]);
testHideRawHeaders(document);
return teardown(monitor);
--- a/devtools/client/netmonitor/test/browser_net_req-resp-bodies.js
+++ b/devtools/client/netmonitor/test/browser_net_req-resp-bodies.js
@@ -8,24 +8,24 @@
*/
add_task(function* () {
let { L10N } = require("devtools/client/netmonitor/src/utils/l10n");
let { tab, monitor } = yield initNetMonitor(JSON_LONG_URL);
info("Starting test... ");
- let { document, gStore, windowRequire } = monitor.panelWin;
+ let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let {
getDisplayedRequests,
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
- gStore.dispatch(Actions.batchEnable(false));
+ store.dispatch(Actions.batchEnable(false));
// Perform first batch of requests.
let wait = waitForNetworkEvents(monitor, 1);
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
content.wrappedJSObject.performRequests();
});
yield wait;
@@ -55,18 +55,18 @@ add_task(function* () {
verifyRequest(1);
return teardown(monitor);
function verifyRequest(index) {
verifyRequestItemTarget(
document,
- getDisplayedRequests(gStore.getState()),
- getSortedRequests(gStore.getState()).get(index),
+ getDisplayedRequests(store.getState()),
+ getSortedRequests(store.getState()).get(index),
"GET",
CONTENT_TYPE_SJS + "?fmt=json-long",
{
status: 200,
statusText: "OK",
type: "json",
fullMimeType: "text/json; charset=utf-8",
size: L10N.getFormatStr("networkMenu.sizeKB",
--- a/devtools/client/netmonitor/test/browser_net_resend.js
+++ b/devtools/client/netmonitor/test/browser_net_resend.js
@@ -11,55 +11,55 @@ const ADD_QUERY = "t1=t2";
const ADD_HEADER = "Test-header: true";
const ADD_UA_HEADER = "User-Agent: Custom-Agent";
const ADD_POSTDATA = "&t3=t4";
add_task(function* () {
let { tab, monitor } = yield initNetMonitor(POST_DATA_URL);
info("Starting test... ");
- let { document, gStore, windowRequire } = monitor.panelWin;
+ let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let {
getSelectedRequest,
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
- gStore.dispatch(Actions.batchEnable(false));
+ store.dispatch(Actions.batchEnable(false));
let wait = waitForNetworkEvents(monitor, 0, 2);
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
content.wrappedJSObject.performRequests();
});
yield wait;
- let origItem = getSortedRequests(gStore.getState()).get(0);
+ let origItem = getSortedRequests(store.getState()).get(0);
- gStore.dispatch(Actions.selectRequest(origItem.id));
+ store.dispatch(Actions.selectRequest(origItem.id));
// add a new custom request cloned from selected request
- gStore.dispatch(Actions.cloneSelectedRequest());
+ store.dispatch(Actions.cloneSelectedRequest());
testCustomForm(origItem);
- let customItem = getSelectedRequest(gStore.getState());
+ let customItem = getSelectedRequest(store.getState());
testCustomItem(customItem, origItem);
// edit the custom request
yield editCustomForm();
// FIXME: reread the customItem, it's been replaced by a new object (immutable!)
- customItem = getSelectedRequest(gStore.getState());
+ customItem = getSelectedRequest(store.getState());
testCustomItemChanged(customItem, origItem);
// send the new request
wait = waitForNetworkEvents(monitor, 0, 1);
- gStore.dispatch(Actions.sendCustomRequest());
+ store.dispatch(Actions.sendCustomRequest());
yield wait;
- let sentItem = getSelectedRequest(gStore.getState());
+ let sentItem = getSelectedRequest(store.getState());
testSentRequest(sentItem, origItem);
return teardown(monitor);
function testCustomItem(item, orig) {
is(item.method, orig.method, "item is showing the same method as original request");
is(item.url, orig.url, "item is showing the same URL as original request");
}
--- a/devtools/client/netmonitor/test/browser_net_resend_cors.js
+++ b/devtools/client/netmonitor/test/browser_net_resend_cors.js
@@ -7,54 +7,54 @@
* Tests if resending a CORS request avoids the security checks and doesn't send
* a preflight OPTIONS request (bug 1270096 and friends)
*/
add_task(function* () {
let { tab, monitor } = yield initNetMonitor(CORS_URL);
info("Starting test... ");
- let { gStore, windowRequire } = monitor.panelWin;
+ let { store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let {
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
- gStore.dispatch(Actions.batchEnable(false));
+ store.dispatch(Actions.batchEnable(false));
let requestUrl = "http://test1.example.com" + CORS_SJS_PATH;
info("Waiting for OPTIONS, then POST");
let wait = waitForNetworkEvents(monitor, 1, 1);
yield ContentTask.spawn(tab.linkedBrowser, requestUrl, function* (url) {
content.wrappedJSObject.performRequests(url, "triggering/preflight", "post-data");
});
yield wait;
const METHODS = ["OPTIONS", "POST"];
- const ITEMS = METHODS.map((val, i) => getSortedRequests(gStore.getState()).get(i));
+ const ITEMS = METHODS.map((val, i) => getSortedRequests(store.getState()).get(i));
// Check the requests that were sent
ITEMS.forEach((item, i) => {
is(item.method, METHODS[i], `The ${item.method} request has the right method`);
is(item.url, requestUrl, `The ${item.method} request has the right URL`);
});
// Resend both requests without modification. Wait for resent OPTIONS, then POST.
// POST is supposed to have no preflight OPTIONS request this time (CORS is disabled)
let onRequests = waitForNetworkEvents(monitor, 1, 0);
ITEMS.forEach((item) => {
info(`Selecting the ${item.method} request`);
- gStore.dispatch(Actions.selectRequest(item.id));
+ store.dispatch(Actions.selectRequest(item.id));
info("Cloning the selected request into a custom clone");
- gStore.dispatch(Actions.cloneSelectedRequest());
+ store.dispatch(Actions.cloneSelectedRequest());
info("Sending the cloned request (without change)");
- gStore.dispatch(Actions.sendCustomRequest());
+ store.dispatch(Actions.sendCustomRequest());
});
info("Waiting for both resent requests");
yield onRequests;
// Check the resent requests
ITEMS.forEach((item, i) => {
is(item.method, METHODS[i], `The ${item.method} request has the right method`);
--- a/devtools/client/netmonitor/test/browser_net_resend_headers.js
+++ b/devtools/client/netmonitor/test/browser_net_resend_headers.js
@@ -6,46 +6,46 @@
/**
* Test if custom request headers are not ignored (bug 1270096 and friends)
*/
add_task(function* () {
let { monitor } = yield initNetMonitor(SIMPLE_SJS);
info("Starting test... ");
- let { gStore, windowRequire } = monitor.panelWin;
+ let { store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
- let { NetMonitorController } =
- windowRequire("devtools/client/netmonitor/src/netmonitor-controller");
+ let { sendHTTPRequest } =
+ windowRequire("devtools/client/netmonitor/src/connector/index");
let {
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
- gStore.dispatch(Actions.batchEnable(false));
+ store.dispatch(Actions.batchEnable(false));
let requestUrl = SIMPLE_SJS;
let requestHeaders = [
{ name: "Host", value: "fakehost.example.com" },
{ name: "User-Agent", value: "Testzilla" },
{ name: "Referer", value: "http://example.com/referrer" },
{ name: "Accept", value: "application/jarda"},
{ name: "Accept-Encoding", value: "compress, identity, funcoding" },
{ name: "Accept-Language", value: "cs-CZ" }
];
let wait = waitForNetworkEvents(monitor, 0, 1);
- NetMonitorController.webConsoleClient.sendHTTPRequest({
+ sendHTTPRequest({
url: requestUrl,
method: "POST",
headers: requestHeaders,
body: "Hello"
});
yield wait;
- let item = getSortedRequests(gStore.getState()).get(0);
+ let item = getSortedRequests(store.getState()).get(0);
is(item.method, "POST", "The request has the right method");
is(item.url, requestUrl, "The request has the right URL");
for (let { name, value } of item.requestHeaders.headers) {
info(`Request header: ${name}: ${value}`);
}
function hasRequestHeader(name, value) {
--- a/devtools/client/netmonitor/test/browser_net_security-details.js
+++ b/devtools/client/netmonitor/test/browser_net_security-details.js
@@ -4,20 +4,20 @@
"use strict";
/**
* Test that Security details tab contains the expected data.
*/
add_task(function* () {
let { tab, monitor } = yield initNetMonitor(CUSTOM_GET_URL);
- let { document, gStore, windowRequire } = monitor.panelWin;
+ let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
- gStore.dispatch(Actions.batchEnable(false));
+ store.dispatch(Actions.batchEnable(false));
info("Performing a secure request.");
const REQUESTS_URL = "https://example.com" + CORS_SJS_PATH;
let wait = waitForNetworkEvents(monitor, 1);
yield ContentTask.spawn(tab.linkedBrowser, REQUESTS_URL, function* (url) {
content.wrappedJSObject.performRequests(1, url);
});
yield wait;
--- a/devtools/client/netmonitor/test/browser_net_security-error.js
+++ b/devtools/client/netmonitor/test/browser_net_security-error.js
@@ -4,21 +4,21 @@
"use strict";
/**
* 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 { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let { EVENTS } = windowRequire("devtools/client/netmonitor/src/constants");
- gStore.dispatch(Actions.batchEnable(false));
+ store.dispatch(Actions.batchEnable(false));
info("Requesting a resource that has a certificate problem.");
let requestsDone = waitForSecurityBrokenNetworkEvent();
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
content.wrappedJSObject.performRequests(1, "https://nocert.example.com");
});
yield requestsDone;
--- a/devtools/client/netmonitor/test/browser_net_security-icon-click.js
+++ b/devtools/client/netmonitor/test/browser_net_security-icon-click.js
@@ -4,26 +4,26 @@
"use strict";
/**
* Test that clicking on the security indicator opens the security details tab.
*/
add_task(function* () {
let { tab, monitor } = yield initNetMonitor(CUSTOM_GET_URL);
- let { document, gStore, windowRequire } = monitor.panelWin;
+ let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
- gStore.dispatch(Actions.batchEnable(false));
+ store.dispatch(Actions.batchEnable(false));
info("Requesting a resource over HTTPS.");
yield performRequestAndWait("https://example.com" + CORS_SJS_PATH + "?request_2");
yield performRequestAndWait("https://example.com" + CORS_SJS_PATH + "?request_1");
- is(gStore.getState().requests.requests.size, 2, "Two events event logged.");
+ is(store.getState().requests.requests.size, 2, "Two events event logged.");
yield clickAndTestSecurityIcon();
info("Selecting headers panel again.");
EventUtils.sendMouseEvent({ type: "click" },
document.querySelector("#headers-tab"));
info("Sorting the items by filename.");
--- a/devtools/client/netmonitor/test/browser_net_security-redirect.js
+++ b/devtools/client/netmonitor/test/browser_net_security-redirect.js
@@ -5,28 +5,28 @@
/**
* Test a http -> https redirect shows secure icon only for redirected https
* request.
*/
add_task(function* () {
let { tab, monitor } = yield initNetMonitor(CUSTOM_GET_URL);
- let { document, gStore, windowRequire } = monitor.panelWin;
+ let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
- gStore.dispatch(Actions.batchEnable(false));
+ store.dispatch(Actions.batchEnable(false));
let wait = waitForNetworkEvents(monitor, 2);
yield ContentTask.spawn(tab.linkedBrowser, HTTPS_REDIRECT_SJS, function* (url) {
content.wrappedJSObject.performRequests(1, url);
});
yield wait;
- is(gStore.getState().requests.requests.size, 2,
+ is(store.getState().requests.requests.size, 2,
"There were two requests due to redirect.");
let [
initialSecurityIcon,
redirectSecurityIcon,
] = document.querySelectorAll(".requests-security-state-icon");
ok(initialSecurityIcon.classList.contains("security-state-insecure"),
--- a/devtools/client/netmonitor/test/browser_net_security-state.js
+++ b/devtools/client/netmonitor/test/browser_net_security-state.js
@@ -12,20 +12,20 @@ add_task(function* () {
const EXPECTED_SECURITY_STATES = {
"test1.example.com": "security-state-insecure",
"example.com": "security-state-secure",
"nocert.example.com": "security-state-broken",
"localhost": "security-state-local",
};
let { tab, monitor } = yield initNetMonitor(CUSTOM_GET_URL);
- let { document, gStore, windowRequire } = monitor.panelWin;
+ let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
- gStore.dispatch(Actions.batchEnable(false));
+ store.dispatch(Actions.batchEnable(false));
yield performRequests();
for (let subitemNode of Array.from(document.querySelectorAll(
"requests-list-column.requests-list-security-and-domain"))) {
let domain = subitemNode.querySelector(".requests-list-domain").textContent;
info("Found a request to " + domain);
@@ -81,17 +81,17 @@ add_task(function* () {
yield done;
done = waitForSecurityBrokenNetworkEvent(true);
info("Requesting a resource over HTTP to localhost.");
yield executeRequests(1, "http://localhost" + CORS_SJS_PATH);
yield done;
const expectedCount = Object.keys(EXPECTED_SECURITY_STATES).length;
- is(gStore.getState().requests.requests.size,
+ is(store.getState().requests.requests.size,
expectedCount,
expectedCount + " events logged.");
}
/**
* Returns a promise that's resolved once a request with security issues is
* completed.
*/
--- a/devtools/client/netmonitor/test/browser_net_security-tab-deselect.js
+++ b/devtools/client/netmonitor/test/browser_net_security-tab-deselect.js
@@ -5,20 +5,20 @@
/**
* Test that security details tab is no longer selected if an insecure request
* is selected.
*/
add_task(function* () {
let { tab, monitor } = yield initNetMonitor(CUSTOM_GET_URL);
- let { document, gStore, windowRequire } = monitor.panelWin;
+ let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
- gStore.dispatch(Actions.batchEnable(false));
+ store.dispatch(Actions.batchEnable(false));
info("Performing requests.");
let wait = waitForNetworkEvents(monitor, 2);
const REQUEST_URLS = [
"https://example.com" + CORS_SJS_PATH,
"http://example.com" + CORS_SJS_PATH,
];
yield ContentTask.spawn(tab.linkedBrowser, REQUEST_URLS, function* (urls) {
--- a/devtools/client/netmonitor/test/browser_net_security-tab-visibility.js
+++ b/devtools/client/netmonitor/test/browser_net_security-tab-visibility.js
@@ -27,22 +27,22 @@ add_task(function* () {
isBroken: true,
visibleOnNewEvent: false,
visibleOnSecurityInfo: true,
visibleOnceComplete: true,
}
];
let { tab, monitor } = yield initNetMonitor(CUSTOM_GET_URL);
- let { document, gStore, windowRequire } = monitor.panelWin;
+ let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let { getSelectedRequest } =
windowRequire("devtools/client/netmonitor/src/selectors/index");
- gStore.dispatch(Actions.batchEnable(false));
+ store.dispatch(Actions.batchEnable(false));
for (let testcase of TEST_DATA) {
info("Testing Security tab visibility for " + testcase.desc);
let onNewItem = monitor.panelWin.once(EVENTS.NETWORK_EVENT);
let onSecurityInfo = monitor.panelWin.once(EVENTS.RECEIVED_SECURITY_INFO);
let onComplete = testcase.isBroken ?
waitForSecurityBrokenNetworkEvent() :
waitForNetworkEvents(monitor, 1);
@@ -54,41 +54,41 @@ add_task(function* () {
info("Waiting for new network event.");
yield onNewItem;
info("Selecting the request.");
EventUtils.sendMouseEvent({ type: "mousedown" },
document.querySelectorAll(".request-list-item")[0]);
- is(getSelectedRequest(gStore.getState()).securityState, undefined,
+ is(getSelectedRequest(store.getState()).securityState, undefined,
"Security state has not yet arrived.");
is(!!document.querySelector("#security-tab"), testcase.visibleOnNewEvent,
"Security tab is " + (testcase.visibleOnNewEvent ? "visible" : "hidden") +
" after new request was added to the menu.");
info("Waiting for security information to arrive.");
yield onSecurityInfo;
- yield waitUntil(() => !!getSelectedRequest(gStore.getState()).securityState);
- ok(getSelectedRequest(gStore.getState()).securityState,
+ yield waitUntil(() => !!getSelectedRequest(store.getState()).securityState);
+ ok(getSelectedRequest(store.getState()).securityState,
"Security state arrived.");
is(!!document.querySelector("#security-tab"), testcase.visibleOnSecurityInfo,
"Security tab is " + (testcase.visibleOnSecurityInfo ? "visible" : "hidden") +
" after security information arrived.");
info("Waiting for request to complete.");
yield onComplete;
is(!!document.querySelector("#security-tab"), testcase.visibleOnceComplete,
"Security tab is " + (testcase.visibleOnceComplete ? "visible" : "hidden") +
" after request has been completed.");
info("Clearing requests.");
- gStore.dispatch(Actions.clearRequests());
+ store.dispatch(Actions.clearRequests());
}
return teardown(monitor);
/**
* Returns a promise that's resolved once a request with security issues is
* completed.
*/
--- a/devtools/client/netmonitor/test/browser_net_security-warnings.js
+++ b/devtools/client/netmonitor/test/browser_net_security-warnings.js
@@ -12,20 +12,20 @@ const TEST_CASES = [
desc: "no warnings",
uri: "https://example.com" + CORS_SJS_PATH,
warnCipher: null,
},
];
add_task(function* () {
let { tab, monitor } = yield initNetMonitor(CUSTOM_GET_URL);
- let { document, gStore, windowRequire } = monitor.panelWin;
+ let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
- gStore.dispatch(Actions.batchEnable(false));
+ store.dispatch(Actions.batchEnable(false));
for (let test of TEST_CASES) {
info("Testing site with " + test.desc);
info("Performing request to " + test.uri);
let wait = waitForNetworkEvents(monitor, 1);
yield ContentTask.spawn(tab.linkedBrowser, test.uri, function* (url) {
content.wrappedJSObject.performRequests(1, url);
@@ -45,13 +45,13 @@ add_task(function* () {
document.querySelector("#security-tab"));
yield wait;
}
is(document.querySelector("#security-warning-cipher"),
test.warnCipher,
"Cipher suite warning is hidden.");
- gStore.dispatch(Actions.clearRequests());
+ store.dispatch(Actions.clearRequests());
}
return teardown(monitor);
});
--- a/devtools/client/netmonitor/test/browser_net_send-beacon-other-tab.js
+++ b/devtools/client/netmonitor/test/browser_net_send-beacon-other-tab.js
@@ -4,36 +4,36 @@
"use strict";
/**
* Tests if beacons from other tabs are properly ignored.
*/
add_task(function* () {
let { tab, monitor } = yield initNetMonitor(SIMPLE_URL);
- let { gStore, windowRequire } = monitor.panelWin;
+ let { store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let {
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
- gStore.dispatch(Actions.batchEnable(false));
+ store.dispatch(Actions.batchEnable(false));
let beaconTab = yield addTab(SEND_BEACON_URL);
info("Beacon tab added successfully.");
- is(gStore.getState().requests.requests.size, 0, "The requests menu should be empty.");
+ is(store.getState().requests.requests.size, 0, "The requests menu should be empty.");
let wait = waitForNetworkEvents(monitor, 1);
yield ContentTask.spawn(beaconTab.linkedBrowser, {}, function* () {
content.wrappedJSObject.performRequest();
});
tab.linkedBrowser.reload();
yield wait;
- is(gStore.getState().requests.requests.size, 1, "Only the reload should be recorded.");
- let request = getSortedRequests(gStore.getState()).get(0);
+ is(store.getState().requests.requests.size, 1, "Only the reload should be recorded.");
+ let request = getSortedRequests(store.getState()).get(0);
is(request.method, "GET", "The method is correct.");
is(request.status, "200", "The status is correct.");
yield removeTab(beaconTab);
return teardown(monitor);
});
--- a/devtools/client/netmonitor/test/browser_net_send-beacon.js
+++ b/devtools/client/netmonitor/test/browser_net_send-beacon.js
@@ -4,31 +4,31 @@
"use strict";
/**
* Tests if beacons are handled correctly.
*/
add_task(function* () {
let { tab, monitor } = yield initNetMonitor(SEND_BEACON_URL);
- let { gStore, windowRequire } = monitor.panelWin;
+ let { store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let { getSortedRequests } =
windowRequire("devtools/client/netmonitor/src/selectors/index");
- gStore.dispatch(Actions.batchEnable(false));
+ store.dispatch(Actions.batchEnable(false));
- is(gStore.getState().requests.requests.size, 0, "The requests menu should be empty.");
+ is(store.getState().requests.requests.size, 0, "The requests menu should be empty.");
let wait = waitForNetworkEvents(monitor, 1);
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
content.wrappedJSObject.performRequest();
});
yield wait;
- is(gStore.getState().requests.requests.size, 1, "The beacon should be recorded.");
- let request = getSortedRequests(gStore.getState()).get(0);
+ is(store.getState().requests.requests.size, 1, "The beacon should be recorded.");
+ let request = getSortedRequests(store.getState()).get(0);
is(request.method, "POST", "The method is correct.");
ok(request.url.endsWith("beacon_request"), "The URL is correct.");
is(request.status, "404", "The status is correct.");
return teardown(monitor);
});
--- a/devtools/client/netmonitor/test/browser_net_service-worker-status.js
+++ b/devtools/client/netmonitor/test/browser_net_service-worker-status.js
@@ -11,24 +11,24 @@
const URL = EXAMPLE_URL.replace("http:", "https:");
const TEST_URL = URL + "service-workers/status-codes.html";
add_task(function* () {
let { tab, monitor } = yield initNetMonitor(TEST_URL, true);
info("Starting test... ");
- let { document, gStore, windowRequire } = monitor.panelWin;
+ let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let {
getDisplayedRequests,
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
- gStore.dispatch(Actions.batchEnable(false));
+ store.dispatch(Actions.batchEnable(false));
const REQUEST_DATA = [
{
method: "GET",
uri: URL + "service-workers/test/200",
details: {
status: 200,
statusText: "OK (service worker)",
@@ -49,22 +49,22 @@ add_task(function* () {
let wait = waitForNetworkEvents(monitor, REQUEST_DATA.length);
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
content.wrappedJSObject.performRequests();
});
yield wait;
let index = 0;
for (let request of REQUEST_DATA) {
- let item = getSortedRequests(gStore.getState()).get(index);
+ let item = getSortedRequests(store.getState()).get(index);
info(`Verifying request #${index}`);
yield verifyRequestItemTarget(
document,
- getDisplayedRequests(gStore.getState()),
+ getDisplayedRequests(store.getState()),
item,
request.method,
request.uri,
request.details
);
let { stacktrace } = item.cause;
let stackLen = stacktrace ? stacktrace.length : 0;
deleted file mode 100644
--- a/devtools/client/netmonitor/test/browser_net_simple-init.js
+++ /dev/null
@@ -1,93 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-/**
- * Simple check if the network monitor starts up and shuts down properly.
- */
-
-function test() {
- // These test suite functions are removed from the global scope inside a
- // cleanup function. However, we still need them.
- let gInfo = info;
- let gOk = ok;
-
- initNetMonitor(SIMPLE_URL).then(({ tab, monitor }) => {
- info("Starting test... ");
-
- let { windowRequire } = monitor.panelWin;
- let { NetMonitorController } =
- windowRequire("devtools/client/netmonitor/src/netmonitor-controller");
-
- 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(NetMonitorController,
- `The network monitor controller object exists (${tag}).`);
- ok(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(NetMonitorController.tabClient,
- `There should be a tabClient available at this point (${tag}).`);
- ok(NetMonitorController.webConsoleClient,
- `There should be a webConsoleClient available at this point (${tag}).`);
- ok(NetMonitorController.timelineFront,
- `There should be a timelineFront available at this point (${tag}).`);
- }
-
- function checkIfDestroyed(tag) {
- gInfo("Checking if destruction is ok.");
-
- gOk(NetMonitorController,
- `The network monitor controller object still exists (${tag}).`);
- gOk(NetMonitorController._shutdown,
- `The network monitor controller object still exists and is destroyed (${tag}).`);
-
- gOk(!NetMonitorController.tabClient,
- `There shouldn't be a tabClient available after destruction (${tag}).`);
- gOk(!NetMonitorController.webConsoleClient,
- `There shouldn't be a webConsoleClient available after destruction (${tag}).`);
- gOk(!NetMonitorController.timelineFront,
- `There shouldn't be a timelineFront available after destruction (${tag}).`);
- }
-
- executeSoon(() => {
- checkIfInitialized(1);
-
- NetMonitorController.startupNetMonitor()
- .then(() => {
- info("Starting up again shouldn't do anything special.");
- checkIfInitialized(2);
- return NetMonitorController.connect();
- })
- .then(() => {
- info("Connecting again shouldn't do anything special.");
- checkIfInitialized(3);
- return teardown(monitor);
- })
- .then(finish);
- });
-
- registerCleanupFunction(() => {
- checkIfDestroyed(1);
-
- NetMonitorController.shutdownNetMonitor()
- .then(() => {
- gInfo("Shutting down again shouldn't do anything special.");
- checkIfDestroyed(2);
- return NetMonitorController.disconnect();
- })
- .then(() => {
- gInfo("Disconnecting again shouldn't do anything special.");
- checkIfDestroyed(3);
- });
- });
- });
-}
--- a/devtools/client/netmonitor/test/browser_net_simple-request-data.js
+++ b/devtools/client/netmonitor/test/browser_net_simple-request-data.js
@@ -8,40 +8,40 @@
*/
function test() {
let { L10N } = require("devtools/client/netmonitor/src/utils/l10n");
initNetMonitor(SIMPLE_SJS).then(({ tab, monitor }) => {
info("Starting test... ");
- let { document, gStore, windowRequire } = monitor.panelWin;
+ let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let { EVENTS } = windowRequire("devtools/client/netmonitor/src/constants");
let {
getDisplayedRequests,
getSelectedRequest,
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
- gStore.dispatch(Actions.batchEnable(false));
+ store.dispatch(Actions.batchEnable(false));
waitForNetworkEvents(monitor, 1)
.then(() => teardown(monitor))
.then(finish);
monitor.panelWin.once(EVENTS.NETWORK_EVENT, () => {
- is(getSelectedRequest(gStore.getState()), null,
+ is(getSelectedRequest(store.getState()), null,
"There shouldn't be any selected item in the requests menu.");
- is(gStore.getState().requests.requests.size, 1,
+ is(store.getState().requests.requests.size, 1,
"The requests menu should not be empty after the first request.");
is(!!document.querySelector(".network-details-panel"), false,
"The network details panel should still be hidden after first request.");
- let requestItem = getSortedRequests(gStore.getState()).get(0);
+ let requestItem = getSortedRequests(store.getState()).get(0);
is(typeof requestItem.id, "string",
"The attached request id is incorrect.");
isnot(requestItem.id, "",
"The attached request id should not be empty.");
is(typeof requestItem.startedMillis, "number",
"The attached startedMillis is incorrect.");
@@ -79,164 +79,164 @@ function test() {
is(requestItem.totalTime, undefined,
"The totalTime should not yet be set.");
is(requestItem.eventTimings, undefined,
"The eventTimings should not yet be set.");
verifyRequestItemTarget(
document,
- getDisplayedRequests(gStore.getState()),
+ getDisplayedRequests(store.getState()),
requestItem,
"GET",
SIMPLE_SJS
);
});
monitor.panelWin.once(EVENTS.RECEIVED_REQUEST_HEADERS, async () => {
await waitUntil(() => {
- let requestItem = getSortedRequests(gStore.getState()).get(0);
+ let requestItem = getSortedRequests(store.getState()).get(0);
return requestItem.requestHeaders;
});
- let requestItem = getSortedRequests(gStore.getState()).get(0);
+ let requestItem = getSortedRequests(store.getState()).get(0);
ok(requestItem.requestHeaders,
"There should be a requestHeaders data available.");
is(requestItem.requestHeaders.headers.length, 10,
"The requestHeaders data has an incorrect |headers| property.");
isnot(requestItem.requestHeaders.headersSize, 0,
"The requestHeaders data has an incorrect |headersSize| property.");
// Can't test for the exact request headers size because the value may
// vary across platforms ("User-Agent" header differs).
verifyRequestItemTarget(
document,
- getDisplayedRequests(gStore.getState()),
+ getDisplayedRequests(store.getState()),
requestItem,
"GET",
SIMPLE_SJS
);
});
monitor.panelWin.once(EVENTS.RECEIVED_REQUEST_COOKIES, async () => {
await waitUntil(() => {
- let requestItem = getSortedRequests(gStore.getState()).get(0);
+ let requestItem = getSortedRequests(store.getState()).get(0);
return requestItem.requestCookies;
});
- let requestItem = getSortedRequests(gStore.getState()).get(0);
+ let requestItem = getSortedRequests(store.getState()).get(0);
ok(requestItem.requestCookies,
"There should be a requestCookies data available.");
is(requestItem.requestCookies.cookies.length, 2,
"The requestCookies data has an incorrect |cookies| property.");
verifyRequestItemTarget(
document,
- getDisplayedRequests(gStore.getState()),
+ getDisplayedRequests(store.getState()),
requestItem,
"GET",
SIMPLE_SJS
);
});
monitor.panelWin.once(EVENTS.RECEIVED_REQUEST_POST_DATA, () => {
ok(false, "Trap listener: this request doesn't have any post data.");
});
monitor.panelWin.once(EVENTS.RECEIVED_RESPONSE_HEADERS, async () => {
await waitUntil(() => {
- let requestItem = getSortedRequests(gStore.getState()).get(0);
+ let requestItem = getSortedRequests(store.getState()).get(0);
return requestItem.responseHeaders;
});
- let requestItem = getSortedRequests(gStore.getState()).get(0);
+ let requestItem = getSortedRequests(store.getState()).get(0);
ok(requestItem.responseHeaders,
"There should be a responseHeaders data available.");
is(requestItem.responseHeaders.headers.length, 10,
"The responseHeaders data has an incorrect |headers| property.");
is(requestItem.responseHeaders.headersSize, 330,
"The responseHeaders data has an incorrect |headersSize| property.");
verifyRequestItemTarget(
document,
- getDisplayedRequests(gStore.getState()),
+ getDisplayedRequests(store.getState()),
requestItem,
"GET",
SIMPLE_SJS
);
});
monitor.panelWin.once(EVENTS.RECEIVED_RESPONSE_COOKIES, async () => {
await waitUntil(() => {
- let requestItem = getSortedRequests(gStore.getState()).get(0);
+ let requestItem = getSortedRequests(store.getState()).get(0);
return requestItem.responseCookies;
});
- let requestItem = getSortedRequests(gStore.getState()).get(0);
+ let requestItem = getSortedRequests(store.getState()).get(0);
ok(requestItem.responseCookies,
"There should be a responseCookies data available.");
is(requestItem.responseCookies.cookies.length, 2,
"The responseCookies data has an incorrect |cookies| property.");
verifyRequestItemTarget(
document,
- getDisplayedRequests(gStore.getState()),
+ getDisplayedRequests(store.getState()),
requestItem,
"GET",
SIMPLE_SJS
);
});
monitor.panelWin.once(EVENTS.STARTED_RECEIVING_RESPONSE, async () => {
await waitUntil(() => {
- let requestItem = getSortedRequests(gStore.getState()).get(0);
+ let requestItem = getSortedRequests(store.getState()).get(0);
return requestItem.httpVersion &&
requestItem.status &&
requestItem.statusText &&
requestItem.headersSize;
});
- let requestItem = getSortedRequests(gStore.getState()).get(0);
+ let requestItem = getSortedRequests(store.getState()).get(0);
is(requestItem.httpVersion, "HTTP/1.1",
"The httpVersion data has an incorrect value.");
is(requestItem.status, "200",
"The status data has an incorrect value.");
is(requestItem.statusText, "Och Aye",
"The statusText data has an incorrect value.");
is(requestItem.headersSize, 330,
"The headersSize data has an incorrect value.");
verifyRequestItemTarget(
document,
- getDisplayedRequests(gStore.getState()),
+ getDisplayedRequests(store.getState()),
requestItem,
"GET",
SIMPLE_SJS,
{
status: "200",
statusText: "Och Aye"
}
);
});
monitor.panelWin.once(EVENTS.RECEIVED_RESPONSE_CONTENT, async () => {
await waitUntil(() => {
- let requestItem = getSortedRequests(gStore.getState()).get(0);
+ let requestItem = getSortedRequests(store.getState()).get(0);
return requestItem.transferredSize &&
requestItem.contentSize &&
requestItem.mimeType &&
requestItem.responseContent;
});
- let requestItem = getSortedRequests(gStore.getState()).get(0);
+ let requestItem = getSortedRequests(store.getState()).get(0);
is(requestItem.transferredSize, "12",
"The transferredSize data has an incorrect value.");
is(requestItem.contentSize, "12",
"The contentSize data has an incorrect value.");
is(requestItem.mimeType, "text/plain; charset=utf-8",
"The mimeType data has an incorrect value.");
@@ -252,56 +252,56 @@ function test() {
"The responseContent data has an incorrect |content.text| property.");
// eslint-disable-next-line mozilla/no-cpows-in-tests
is(requestItem.responseContent.content.size,
12,
"The responseContent data has an incorrect |content.size| property.");
verifyRequestItemTarget(
document,
- getDisplayedRequests(gStore.getState()),
+ getDisplayedRequests(store.getState()),
requestItem,
"GET",
SIMPLE_SJS,
{
type: "plain",
fullMimeType: "text/plain; charset=utf-8",
transferred: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 12),
size: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 12),
}
);
});
monitor.panelWin.once(EVENTS.UPDATING_EVENT_TIMINGS, async () => {
await waitUntil(() => {
- let requestItem = getSortedRequests(gStore.getState()).get(0);
+ let requestItem = getSortedRequests(store.getState()).get(0);
return requestItem.eventTimings;
});
- let requestItem = getSortedRequests(gStore.getState()).get(0);
+ let requestItem = getSortedRequests(store.getState()).get(0);
is(typeof requestItem.totalTime, "number",
"The attached totalTime is incorrect.");
ok(requestItem.totalTime >= 0,
"The attached totalTime should be positive.");
verifyRequestItemTarget(
document,
- getDisplayedRequests(gStore.getState()),
+ getDisplayedRequests(store.getState()),
requestItem,
"GET",
SIMPLE_SJS,
{
time: true
}
);
});
monitor.panelWin.once(EVENTS.RECEIVED_EVENT_TIMINGS, () => {
- let requestItem = getSortedRequests(gStore.getState()).get(0);
+ let requestItem = getSortedRequests(store.getState()).get(0);
ok(requestItem.eventTimings,
"There should be a eventTimings data available.");
is(typeof requestItem.eventTimings.timings.blocked, "number",
"The eventTimings data has an incorrect |timings.blocked| property.");
is(typeof requestItem.eventTimings.timings.dns, "number",
"The eventTimings data has an incorrect |timings.dns| property.");
is(typeof requestItem.eventTimings.timings.connect, "number",
@@ -312,17 +312,17 @@ function test() {
"The eventTimings data has an incorrect |timings.wait| property.");
is(typeof requestItem.eventTimings.timings.receive, "number",
"The eventTimings data has an incorrect |timings.receive| property.");
is(typeof requestItem.eventTimings.totalTime, "number",
"The eventTimings data has an incorrect |totalTime| property.");
verifyRequestItemTarget(
document,
- getDisplayedRequests(gStore.getState()),
+ getDisplayedRequests(store.getState()),
requestItem,
"GET",
SIMPLE_SJS,
{
time: true
}
);
});
--- a/devtools/client/netmonitor/test/browser_net_simple-request-details.js
+++ b/devtools/client/netmonitor/test/browser_net_simple-request-details.js
@@ -8,44 +8,44 @@
*/
add_task(function* () {
let { L10N } = require("devtools/client/netmonitor/src/utils/l10n");
let { tab, monitor } = yield initNetMonitor(SIMPLE_SJS);
info("Starting test... ");
- let { document, gStore, windowRequire, NetMonitorView } = monitor.panelWin;
+ let { document, store, windowRequire, NetMonitorView } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let { EVENTS } = windowRequire("devtools/client/netmonitor/src/constants");
let {
getSelectedRequest,
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
let Editor = require("devtools/client/sourceeditor/editor");
- gStore.dispatch(Actions.batchEnable(false));
+ store.dispatch(Actions.batchEnable(false));
let wait = waitForNetworkEvents(monitor, 1);
tab.linkedBrowser.reload();
yield wait;
- is(getSelectedRequest(gStore.getState()), undefined,
+ is(getSelectedRequest(store.getState()), undefined,
"There shouldn't be any selected item in the requests menu.");
- is(gStore.getState().requests.requests.size, 1,
+ is(store.getState().requests.requests.size, 1,
"The requests menu should not be empty after the first request.");
is(!!document.querySelector(".network-details-panel"), false,
"The network details panel should still be hidden after first request.");
EventUtils.sendMouseEvent({ type: "click" },
document.querySelector(".network-details-panel-toggle"));
- isnot(getSelectedRequest(gStore.getState()), undefined,
+ isnot(getSelectedRequest(store.getState()), undefined,
"There should be a selected item in the requests menu.");
- is(getSelectedIndex(gStore.getState()), 0,
+ is(getSelectedIndex(store.getState()), 0,
"The first item should be selected in the requests menu.");
is(!!document.querySelector(".network-details-panel"), true,
"The network details panel should not be hidden after toggle button was pressed.");
testHeadersTab();
yield testCookiesTab();
testParamsTab();
yield testResponseTab();
--- a/devtools/client/netmonitor/test/browser_net_simple-request.js
+++ b/devtools/client/netmonitor/test/browser_net_simple-request.js
@@ -11,63 +11,63 @@
* 2) Side panel toggle button
* 3) Empty user message visibility
* 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 { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
- gStore.dispatch(Actions.batchEnable(false));
+ store.dispatch(Actions.batchEnable(false));
is(document.querySelector(".network-details-panel-toggle").hasAttribute("disabled"),
true,
"The pane toggle button should be disabled when the frontend is opened.");
ok(document.querySelector(".request-list-empty-notice"),
"An empty notice should be displayed when the frontend is opened.");
- is(gStore.getState().requests.requests.size, 0,
+ is(store.getState().requests.requests.size, 0,
"The requests menu should be empty when the frontend is opened.");
is(!!document.querySelector(".network-details-panel"), false,
"The network details panel should be hidden when the frontend is opened.");
yield reloadAndWait();
is(document.querySelector(".network-details-panel-toggle").hasAttribute("disabled"),
false,
"The pane toggle button should be enabled after the first request.");
ok(!document.querySelector(".request-list-empty-notice"),
"The empty notice should be hidden after the first request.");
- is(gStore.getState().requests.requests.size, 1,
+ is(store.getState().requests.requests.size, 1,
"The requests menu should not be empty after the first request.");
is(!!document.querySelector(".network-details-panel"), false,
"The network details panel should still be hidden after the first request.");
yield reloadAndWait();
is(document.querySelector(".network-details-panel-toggle").hasAttribute("disabled"),
false,
"The pane toggle button should be still be enabled after a reload.");
ok(!document.querySelector(".request-list-empty-notice"),
"The empty notice should be still hidden after a reload.");
- is(gStore.getState().requests.requests.size, 1,
+ is(store.getState().requests.requests.size, 1,
"The requests menu should not be empty after a reload.");
is(!!document.querySelector(".network-details-panel"), false,
"The network details panel should still be hidden after a reload.");
- gStore.dispatch(Actions.clearRequests());
+ store.dispatch(Actions.clearRequests());
is(document.querySelector(".network-details-panel-toggle").hasAttribute("disabled"),
true,
"The pane toggle button should be disabled when after clear.");
ok(document.querySelector(".request-list-empty-notice"),
"An empty notice should be displayed again after clear.");
- is(gStore.getState().requests.requests.size, 0,
+ is(store.getState().requests.requests.size, 0,
"The requests menu should be empty after clear.");
is(!!document.querySelector(".network-details-panel"), false,
"The network details panel should still be hidden after clear.");
return teardown(monitor);
function* reloadAndWait() {
let wait = waitForNetworkEvents(monitor, 1);
--- a/devtools/client/netmonitor/test/browser_net_sort-01.js
+++ b/devtools/client/netmonitor/test/browser_net_sort-01.js
@@ -12,25 +12,25 @@ add_task(function* () {
let { monitor } = yield initNetMonitor(SORTING_URL);
info("Starting test... ");
// It seems that this test may be slow on debug builds. This could be because
// of the heavy dom manipulation associated with sorting.
requestLongerTimeout(2);
- let { document, gStore, windowRequire } = monitor.panelWin;
+ let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let {
getDisplayedRequests,
getSelectedRequest,
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
- gStore.dispatch(Actions.batchEnable(false));
+ store.dispatch(Actions.batchEnable(false));
// Loading the frame script and preparing the xhr request URLs so we can
// generate some requests later.
loadCommonFrameScript();
let requests = [{
url: "sjs_sorting-test-server.sjs?index=1&" + Math.random(),
method: "GET1"
}, {
@@ -49,19 +49,19 @@ add_task(function* () {
let wait = waitForNetworkEvents(monitor, 5);
yield performRequestsInContent(requests);
yield wait;
EventUtils.sendMouseEvent({ type: "click" },
document.querySelector(".network-details-panel-toggle"));
- isnot(getSelectedRequest(gStore.getState()), undefined,
+ isnot(getSelectedRequest(store.getState()), undefined,
"There should be a selected item in the requests menu.");
- is(getSelectedIndex(gStore.getState()), 0,
+ is(getSelectedIndex(store.getState()), 0,
"The first item should be selected in the requests menu.");
is(!!document.querySelector(".network-details-panel"), true,
"The network details panel should be visible after toggle button was pressed.");
testHeaders();
testContents([0, 2, 4, 3, 1], 0);
info("Testing status sort, ascending.");
@@ -133,99 +133,99 @@ add_task(function* () {
function getSelectedIndex(state) {
if (!state.requests.selectedId) {
return -1;
}
return getSortedRequests(state).findIndex(r => r.id === state.requests.selectedId);
}
function testContents(order, selection) {
- isnot(getSelectedRequest(gStore.getState()), undefined,
+ isnot(getSelectedRequest(store.getState()), undefined,
"There should still be a selected item after sorting.");
- is(getSelectedIndex(gStore.getState()), selection,
+ is(getSelectedIndex(store.getState()), selection,
"The first item should be still selected after sorting.");
is(!!document.querySelector(".network-details-panel"), true,
"The network details panel should still be visible after sorting.");
- is(getSortedRequests(gStore.getState()).length, order.length,
+ is(getSortedRequests(store.getState()).length, order.length,
"There should be a specific number of items in the requests menu.");
- is(getDisplayedRequests(gStore.getState()).length, order.length,
+ is(getDisplayedRequests(store.getState()).length, order.length,
"There should be a specific number of visbile items in the requests menu.");
is(document.querySelectorAll(".request-list-item").length, order.length,
"The visible items in the requests menu are, in fact, visible!");
for (let i = 0, len = order.length / 5; i < len; i++) {
verifyRequestItemTarget(
document,
- getDisplayedRequests(gStore.getState()),
- getSortedRequests(gStore.getState()).get(order[i]),
+ getDisplayedRequests(store.getState()),
+ getSortedRequests(store.getState()).get(order[i]),
"GET1", SORTING_SJS + "?index=1", {
fuzzyUrl: true,
status: 101,
statusText: "Meh",
type: "1",
fullMimeType: "text/1",
transferred: L10N.getStr("networkMenu.sizeUnavailable"),
size: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 0),
time: true
});
}
for (let i = 0, len = order.length / 5; i < len; i++) {
verifyRequestItemTarget(
document,
- getDisplayedRequests(gStore.getState()),
- getSortedRequests(gStore.getState()).get(order[i + len]),
+ getDisplayedRequests(store.getState()),
+ getSortedRequests(store.getState()).get(order[i + len]),
"GET2", SORTING_SJS + "?index=2", {
fuzzyUrl: true,
status: 200,
statusText: "Meh",
type: "2",
fullMimeType: "text/2",
transferred: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 19),
size: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 19),
time: true
});
}
for (let i = 0, len = order.length / 5; i < len; i++) {
verifyRequestItemTarget(
document,
- getDisplayedRequests(gStore.getState()),
- getSortedRequests(gStore.getState()).get(order[i + len * 2]),
+ getDisplayedRequests(store.getState()),
+ getSortedRequests(store.getState()).get(order[i + len * 2]),
"GET3", SORTING_SJS + "?index=3", {
fuzzyUrl: true,
status: 300,
statusText: "Meh",
type: "3",
fullMimeType: "text/3",
transferred: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 29),
size: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 29),
time: true
});
}
for (let i = 0, len = order.length / 5; i < len; i++) {
verifyRequestItemTarget(
document,
- getDisplayedRequests(gStore.getState()),
- getSortedRequests(gStore.getState()).get(order[i + len * 3]),
+ getDisplayedRequests(store.getState()),
+ getSortedRequests(store.getState()).get(order[i + len * 3]),
"GET4", SORTING_SJS + "?index=4", {
fuzzyUrl: true,
status: 400,
statusText: "Meh",
type: "4",
fullMimeType: "text/4",
transferred: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 39),
size: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 39),
time: true
});
}
for (let i = 0, len = order.length / 5; i < len; i++) {
verifyRequestItemTarget(
document,
- getDisplayedRequests(gStore.getState()),
- getSortedRequests(gStore.getState()).get(order[i + len * 4]),
+ getDisplayedRequests(store.getState()),
+ getSortedRequests(store.getState()).get(order[i + len * 4]),
"GET5", SORTING_SJS + "?index=5", {
fuzzyUrl: true,
status: 500,
statusText: "Meh",
type: "5",
fullMimeType: "text/5",
transferred: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 49),
size: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 49),
--- a/devtools/client/netmonitor/test/browser_net_sort-02.js
+++ b/devtools/client/netmonitor/test/browser_net_sort-02.js
@@ -12,25 +12,25 @@ add_task(function* () {
let { monitor } = yield initNetMonitor(SORTING_URL);
info("Starting test... ");
// It seems that this test may be slow on debug builds. This could be because
// of the heavy dom manipulation associated with sorting.
requestLongerTimeout(2);
- let { document, gStore, windowRequire } = monitor.panelWin;
+ let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let {
getDisplayedRequests,
getSelectedRequest,
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
- gStore.dispatch(Actions.batchEnable(false));
+ store.dispatch(Actions.batchEnable(false));
// Loading the frame script and preparing the xhr request URLs so we can
// generate some requests later.
loadCommonFrameScript();
let requests = [{
url: "sjs_sorting-test-server.sjs?index=1&" + Math.random(),
method: "GET1"
}, {
@@ -49,19 +49,19 @@ add_task(function* () {
let wait = waitForNetworkEvents(monitor, 5);
yield performRequestsInContent(requests);
yield wait;
EventUtils.sendMouseEvent({ type: "click" },
document.querySelector(".network-details-panel-toggle"));
- isnot(getSelectedRequest(gStore.getState()), undefined,
+ isnot(getSelectedRequest(store.getState()), undefined,
"There should be a selected item in the requests menu.");
- is(getSelectedIndex(gStore.getState()), 0,
+ is(getSelectedIndex(store.getState()), 0,
"The first item should be selected in the requests menu.");
is(!!document.querySelector(".network-details-panel"), true,
"The network details panel should be visible after toggle button was pressed.");
testHeaders();
testContents([0, 2, 4, 3, 1]);
info("Testing status sort, ascending.");
@@ -217,90 +217,90 @@ add_task(function* () {
? L10N.getStr("networkMenu.sortedAsc")
: L10N.getStr("networkMenu.sortedDesc"),
"The " + header.id + " header has a correct 'title' attribute.");
}
}
}
function testContents([a, b, c, d, e]) {
- isnot(getSelectedRequest(gStore.getState()), undefined,
+ isnot(getSelectedRequest(store.getState()), undefined,
"There should still be a selected item after sorting.");
- is(getSelectedIndex(gStore.getState()), a,
+ is(getSelectedIndex(store.getState()), a,
"The first item should be still selected after sorting.");
is(!!document.querySelector(".network-details-panel"), true,
"The network details panel should still be visible after sorting.");
- is(getSortedRequests(gStore.getState()).length, 5,
+ is(getSortedRequests(store.getState()).length, 5,
"There should be a total of 5 items in the requests menu.");
- is(getDisplayedRequests(gStore.getState()).length, 5,
+ is(getDisplayedRequests(store.getState()).length, 5,
"There should be a total of 5 visible items in the requests menu.");
is(document.querySelectorAll(".request-list-item").length, 5,
"The visible items in the requests menu are, in fact, visible!");
verifyRequestItemTarget(
document,
- getDisplayedRequests(gStore.getState()),
- getSortedRequests(gStore.getState()).get(a),
+ getDisplayedRequests(store.getState()),
+ getSortedRequests(store.getState()).get(a),
"GET1", SORTING_SJS + "?index=1", {
fuzzyUrl: true,
status: 101,
statusText: "Meh",
type: "1",
fullMimeType: "text/1",
transferred: L10N.getStr("networkMenu.sizeUnavailable"),
size: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 0),
time: true
});
verifyRequestItemTarget(
document,
- getDisplayedRequests(gStore.getState()),
- getSortedRequests(gStore.getState()).get(b),
+ getDisplayedRequests(store.getState()),
+ getSortedRequests(store.getState()).get(b),
"GET2", SORTING_SJS + "?index=2", {
fuzzyUrl: true,
status: 200,
statusText: "Meh",
type: "2",
fullMimeType: "text/2",
transferred: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 19),
size: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 19),
time: true
});
verifyRequestItemTarget(
document,
- getDisplayedRequests(gStore.getState()),
- getSortedRequests(gStore.getState()).get(c),
+ getDisplayedRequests(store.getState()),
+ getSortedRequests(store.getState()).get(c),
"GET3", SORTING_SJS + "?index=3", {
fuzzyUrl: true,
status: 300,
statusText: "Meh",
type: "3",
fullMimeType: "text/3",
transferred: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 29),
size: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 29),
time: true
});
verifyRequestItemTarget(
document,
- getDisplayedRequests(gStore.getState()),
- getSortedRequests(gStore.getState()).get(d),
+ getDisplayedRequests(store.getState()),
+ getSortedRequests(store.getState()).get(d),
"GET4", SORTING_SJS + "?index=4", {
fuzzyUrl: true,
status: 400,
statusText: "Meh",
type: "4",
fullMimeType: "text/4",
transferred: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 39),
size: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 39),
time: true
});
verifyRequestItemTarget(
document,
- getDisplayedRequests(gStore.getState()),
- getSortedRequests(gStore.getState()).get(e),
+ getDisplayedRequests(store.getState()),
+ getSortedRequests(store.getState()).get(e),
"GET5", SORTING_SJS + "?index=5", {
fuzzyUrl: true,
status: 500,
statusText: "Meh",
type: "5",
fullMimeType: "text/5",
transferred: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 49),
size: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 49),
--- a/devtools/client/netmonitor/test/browser_net_statistics-01.js
+++ b/devtools/client/netmonitor/test/browser_net_statistics-01.js
@@ -7,24 +7,24 @@
* Tests if the statistics panel displays correctly.
*/
add_task(function* () {
let { monitor } = yield initNetMonitor(STATISTICS_URL);
info("Starting test... ");
let panel = monitor.panelWin;
- let { document, gStore, windowRequire } = panel;
+ let { document, store, windowRequire } = panel;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
ok(document.querySelector(".monitor-panel"),
"The current main panel is correct.");
info("Displaying statistics panel");
- gStore.dispatch(Actions.openStatistics(true));
+ store.dispatch(Actions.openStatistics(true));
ok(document.querySelector(".statistics-panel"),
"The current main panel is correct.");
info("Waiting for placeholder to display");
yield waitUntil(
() => document.querySelectorAll(".pie-chart-container[placeholder=true]")
--- a/devtools/client/netmonitor/test/browser_net_statistics-02.js
+++ b/devtools/client/netmonitor/test/browser_net_statistics-02.js
@@ -8,33 +8,33 @@
* the performance analysis view.
*/
add_task(function* () {
let { monitor } = yield initNetMonitor(FILTERING_URL);
info("Starting test... ");
let panel = monitor.panelWin;
- let { document, gStore, windowRequire } = panel;
+ let { document, store, windowRequire } = panel;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
EventUtils.sendMouseEvent({ type: "click" },
document.querySelector(".requests-list-filter-html-button"));
EventUtils.sendMouseEvent({ type: "click" },
document.querySelector(".requests-list-filter-css-button"));
EventUtils.sendMouseEvent({ type: "click" },
document.querySelector(".requests-list-filter-js-button"));
EventUtils.sendMouseEvent({ type: "click" },
document.querySelector(".requests-list-filter-ws-button"));
EventUtils.sendMouseEvent({ type: "click" },
document.querySelector(".requests-list-filter-other-button"));
testFilterButtonsCustom(monitor, [0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1]);
info("The correct filtering predicates are used before entering perf. analysis mode.");
- gStore.dispatch(Actions.openStatistics(true));
+ store.dispatch(Actions.openStatistics(true));
ok(document.querySelector(".statistics-panel"),
"The main panel is switched to the statistics panel.");
yield waitUntil(
() => document.querySelectorAll(".pie-chart-container:not([placeholder=true])")
.length == 2);
ok(true, "Two real pie charts appear to be rendered correctly.");
--- a/devtools/client/netmonitor/test/browser_net_status-codes.js
+++ b/devtools/client/netmonitor/test/browser_net_status-codes.js
@@ -9,24 +9,24 @@
add_task(function* () {
let { L10N } = require("devtools/client/netmonitor/src/utils/l10n");
let { tab, monitor } = yield initNetMonitor(STATUS_CODES_URL);
info("Starting test... ");
- let { document, gStore, windowRequire } = monitor.panelWin;
+ let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let {
getDisplayedRequests,
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
- gStore.dispatch(Actions.batchEnable(false));
+ store.dispatch(Actions.batchEnable(false));
let requestItems = [];
const REQUEST_DATA = [
{
// request #0
method: "GET",
uri: STATUS_CODES_SJS + "?sts=100",
@@ -109,23 +109,23 @@ add_task(function* () {
/**
* A helper that verifies all requests show the correct information and caches
* request list items to requestItems array.
*/
function* verifyRequests() {
info("Verifying requests contain correct information.");
let index = 0;
for (let request of REQUEST_DATA) {
- let item = getSortedRequests(gStore.getState()).get(index);
+ let item = getSortedRequests(store.getState()).get(index);
requestItems[index] = item;
info("Verifying request #" + index);
yield verifyRequestItemTarget(
document,
- getDisplayedRequests(gStore.getState()),
+ getDisplayedRequests(store.getState()),
item,
request.method,
request.uri,
request.details
);
index++;
}
--- a/devtools/client/netmonitor/test/browser_net_streaming-response.js
+++ b/devtools/client/netmonitor/test/browser_net_streaming-response.js
@@ -7,24 +7,24 @@
* Tests if reponses from streaming content types (MPEG-DASH, HLS) are
* displayed as XML or plain text
*/
add_task(function* () {
let { tab, monitor } = yield initNetMonitor(CUSTOM_GET_URL);
info("Starting test... ");
- let { document, gStore, windowRequire } = monitor.panelWin;
+ let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let {
getDisplayedRequests,
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
- gStore.dispatch(Actions.batchEnable(false));
+ store.dispatch(Actions.batchEnable(false));
const REQUESTS = [
[ "hls-m3u8", /^#EXTM3U/ ],
[ "mpeg-dash", /^<\?xml/ ]
];
let wait = waitForNetworkEvents(monitor, REQUESTS.length);
for (let [fmt] of REQUESTS) {
@@ -33,34 +33,34 @@ add_task(function* () {
content.wrappedJSObject.performRequests(1, args.url);
});
}
yield wait;
REQUESTS.forEach(([ fmt ], i) => {
verifyRequestItemTarget(
document,
- getDisplayedRequests(gStore.getState()),
- getSortedRequests(gStore.getState()).get(i),
+ getDisplayedRequests(store.getState()),
+ getSortedRequests(store.getState()).get(i),
"GET",
CONTENT_TYPE_SJS + "?fmt=" + fmt,
{
status: 200,
statusText: "OK"
});
});
wait = waitForDOM(document, "#response-panel");
EventUtils.sendMouseEvent({ type: "click" },
document.querySelector(".network-details-panel-toggle"));
EventUtils.sendMouseEvent({ type: "click" },
document.querySelector("#response-tab"));
yield wait;
- gStore.dispatch(Actions.selectRequest(null));
+ store.dispatch(Actions.selectRequest(null));
yield selectIndexAndWaitForSourceEditor(0);
// the hls-m3u8 part
testEditorContent(REQUESTS[0]);
yield selectIndexAndWaitForSourceEditor(1);
// the mpeg-dash part
testEditorContent(REQUESTS[1]);
--- a/devtools/client/netmonitor/test/browser_net_throttle.js
+++ b/devtools/client/netmonitor/test/browser_net_throttle.js
@@ -9,21 +9,21 @@ add_task(function* () {
yield throttleTest(true);
yield throttleTest(false);
});
function* throttleTest(actuallyThrottle) {
requestLongerTimeout(2);
let { monitor } = yield initNetMonitor(SIMPLE_URL);
- let { gStore, windowRequire } = monitor.panelWin;
+ let { store, windowRequire } = monitor.panelWin;
let { ACTIVITY_TYPE } = windowRequire("devtools/client/netmonitor/src/constants");
let { EVENTS } = windowRequire("devtools/client/netmonitor/src/constants");
- let { NetMonitorController } =
- windowRequire("devtools/client/netmonitor/src/netmonitor-controller");
+ let { setPreferences, triggerActivity } =
+ windowRequire("devtools/client/netmonitor/src/connector/index");
let {
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
info("Starting test... (actuallyThrottle = " + actuallyThrottle + ")");
// When throttling, must be smaller than the length of the content
// of SIMPLE_URL in bytes.
@@ -34,30 +34,29 @@ function* throttleTest(actuallyThrottle)
latencyMean: 0,
latencyMax: 0,
downloadBPSMean: size,
downloadBPSMax: size,
uploadBPSMean: 10000,
uploadBPSMax: 10000,
},
};
- let client = NetMonitorController.webConsoleClient;
info("sending throttle request");
yield new Promise((resolve) => {
- client.setPreferences(request, response => {
+ setPreferences(request, response => {
resolve(response);
});
});
let eventPromise = monitor.panelWin.once(EVENTS.RECEIVED_EVENT_TIMINGS);
- yield NetMonitorController.triggerActivity(ACTIVITY_TYPE.RELOAD.WITH_CACHE_DISABLED);
+ yield triggerActivity(ACTIVITY_TYPE.RELOAD.WITH_CACHE_DISABLED);
yield eventPromise;
- let requestItem = getSortedRequests(gStore.getState()).get(0);
+ let requestItem = getSortedRequests(store.getState()).get(0);
const reportedOneSecond = requestItem.eventTimings.timings.receive > 1000;
if (actuallyThrottle) {
ok(reportedOneSecond, "download reported as taking more than one second");
} else {
ok(!reportedOneSecond, "download reported as taking less than one second");
}
yield teardown(monitor);
--- a/devtools/client/netmonitor/test/browser_net_timing-division.js
+++ b/devtools/client/netmonitor/test/browser_net_timing-division.js
@@ -13,23 +13,23 @@ add_task(function* () {
Services.prefs.setCharPref(
"devtools.netmonitor.hiddenColumns",
"[\"file\",\"protocol\",\"remoteip\"]"
);
let { tab, monitor } = yield initNetMonitor(CUSTOM_GET_URL);
info("Starting test... ");
- let { document, gStore, windowRequire } = monitor.panelWin;
+ let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let {
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
- gStore.dispatch(Actions.batchEnable(false));
+ store.dispatch(Actions.batchEnable(false));
let wait = waitForNetworkEvents(monitor, 2);
// Timeout needed for having enough divisions on the time scale.
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
content.wrappedJSObject.performRequests(2, null, 3000);
});
yield wait;
@@ -43,21 +43,21 @@ add_task(function* () {
info("Number of millisecond divisions: " + milDivs.length);
info("Number of second divisions: " + secDivs.length);
info("Number of minute divisions: " + minDivs.length);
milDivs.forEach(div => info(`Millisecond division: ${div.textContent}`));
secDivs.forEach(div => info(`Second division: ${div.textContent}`));
minDivs.forEach(div => info(`Minute division: ${div.textContent}`));
- is(gStore.getState().requests.requests.size, 2,
+ is(store.getState().requests.requests.size, 2,
"There should be only two requests made.");
- let firstRequest = getSortedRequests(gStore.getState()).get(0);
- let lastRequest = getSortedRequests(gStore.getState()).get(1);
+ let firstRequest = getSortedRequests(store.getState()).get(0);
+ let lastRequest = getSortedRequests(store.getState()).get(1);
info("First request happened at: " +
firstRequest.responseHeaders.headers.find(e => e.name == "date").value);
info("Last request happened at: " +
lastRequest.responseHeaders.headers.find(e => e.name == "date").value);
ok(secDivs.length,
"There should be at least one division on the seconds time scale.");
--- a/devtools/client/netmonitor/test/browser_net_truncate.js
+++ b/devtools/client/netmonitor/test/browser_net_truncate.js
@@ -14,35 +14,35 @@ function test() {
const URL = EXAMPLE_URL + "sjs_truncate-test-server.sjs?limit=" + RESPONSE_BODY_LIMIT;
// Another slow test on Linux debug.
requestLongerTimeout(2);
initNetMonitor(URL).then(({ tab, monitor }) => {
info("Starting test... ");
- let { document, gStore, windowRequire } = monitor.panelWin;
+ let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let { EVENTS } = windowRequire("devtools/client/netmonitor/src/constants");
let {
getDisplayedRequests,
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
- gStore.dispatch(Actions.batchEnable(false));
+ store.dispatch(Actions.batchEnable(false));
waitForNetworkEvents(monitor, 1)
.then(() => teardown(monitor))
.then(finish);
monitor.panelWin.once(EVENTS.RECEIVED_RESPONSE_CONTENT, () => {
verifyRequestItemTarget(
document,
- getDisplayedRequests(gStore.getState()),
- getSortedRequests(gStore.getState()).get(0),
+ getDisplayedRequests(store.getState()),
+ getSortedRequests(store.getState()).get(0),
"GET", URL,
{
type: "plain",
fullMimeType: "text/plain; charset=utf-8",
transferred: L10N.getFormatStrWithNumbers("networkMenu.sizeMB", 2),
size: L10N.getFormatStrWithNumbers("networkMenu.sizeMB", 2),
}
);
--- a/devtools/client/netmonitor/test/head.js
+++ b/devtools/client/netmonitor/test/head.js
@@ -162,32 +162,32 @@ function waitForTimelineMarkers(monitor)
* - the request start and end times are overlapping. If a new request starts a moment
* after the previous one was finished, the wait will be ended in the "interim"
* period.
* @returns a promise that resolves when the wait is done.
*/
function waitForAllRequestsFinished(monitor) {
let window = monitor.panelWin;
let { windowRequire } = window;
- let { NetMonitorController } =
- windowRequire("devtools/client/netmonitor/src/netmonitor-controller");
+ let { getNetworkRequest } =
+ windowRequire("devtools/client/netmonitor/src/connector/index");
return new Promise(resolve => {
// Key is the request id, value is a boolean - is request finished or not?
let requests = new Map();
function onRequest(_, id) {
- let networkInfo = NetMonitorController.webConsoleClient.getNetworkRequest(id);
+ let networkInfo = getNetworkRequest(id);
let { url } = networkInfo.request;
info(`Request ${id} for ${url} not yet done, keep waiting...`);
requests.set(id, false);
}
function onTimings(_, id) {
- let networkInfo = NetMonitorController.webConsoleClient.getNetworkRequest(id);
+ let networkInfo = getNetworkRequest(id);
let { url } = networkInfo.request;
info(`Request ${id} for ${url} done`);
requests.set(id, true);
maybeResolve();
}
function maybeResolve() {
// Have all the requests in the map finished yet?
@@ -221,32 +221,34 @@ function initNetMonitor(url, enableCache
let toolbox = yield gDevTools.showToolbox(target, "netmonitor");
info("Network monitor pane shown successfully.");
let monitor = toolbox.getCurrentPanel();
if (!enableCache) {
let panel = monitor.panelWin;
- let { gStore, windowRequire } = panel;
+ let { store, windowRequire } = panel;
+ let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
+
info("Disabling cache and reloading page.");
let requestsDone = waitForAllRequestsFinished(monitor);
let markersDone = waitForTimelineMarkers(monitor);
yield toggleCache(target, true);
yield Promise.all([requestsDone, markersDone]);
info("Cache disabled when the current and all future toolboxes are open.");
// Remove any requests generated by the reload while toggling the cache to
// avoid interfering with the test.
isnot([...target.activeConsole.getNetworkEvents()].length, 0,
"Request to reconfigure the tab was recorded.");
info("Clearing requests in the console client.");
target.activeConsole.clearNetworkRequests();
info("Clearing requests in the UI.");
- let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
- gStore.dispatch(Actions.clearRequests());
+
+ store.dispatch(Actions.clearRequests());
}
return {tab, monitor};
});
}
function restartNetMonitor(monitor, newUrl) {
info("Restarting the specified network monitor.");
@@ -274,18 +276,18 @@ function teardown(monitor) {
yield onDestroyed;
});
}
function waitForNetworkEvents(monitor, getRequests, postRequests = 0) {
return new Promise((resolve) => {
let panel = monitor.panelWin;
let { windowRequire } = panel;
- let { NetMonitorController } =
- windowRequire("devtools/client/netmonitor/src/netmonitor-controller");
+ let { getNetworkRequest } =
+ windowRequire("devtools/client/netmonitor/src/connector/index");
let progress = {};
let genericEvents = 0;
let postEvents = 0;
let awaitedEventsToListeners = [
["UPDATING_REQUEST_HEADERS", onGenericEvent],
["RECEIVED_REQUEST_HEADERS", onGenericEvent],
["UPDATING_REQUEST_COOKIES", onGenericEvent],
["RECEIVED_REQUEST_COOKIES", onGenericEvent],
@@ -313,28 +315,28 @@ function waitForNetworkEvents(monitor, g
}
function updateProgressForURL(url, event) {
initProgressForURL(url);
progress[url][Object.keys(EVENTS).find(e => EVENTS[e] == event)] = 1;
}
function onGenericEvent(event, actor) {
- let networkInfo = NetMonitorController.webConsoleClient.getNetworkRequest(actor);
+ let networkInfo = getNetworkRequest(actor);
if (!networkInfo) {
// Must have been related to reloading document to disable cache.
// Ignore the event.
return;
}
genericEvents++;
maybeResolve(event, actor, networkInfo);
}
function onPostEvent(event, actor) {
- let networkInfo = NetMonitorController.webConsoleClient.getNetworkRequest(actor);
+ let networkInfo = getNetworkRequest(actor);
if (!networkInfo) {
// Must have been related to reloading document to disable cache.
// Ignore the event.
return;
}
postEvents++;
maybeResolve(event, actor, networkInfo);
}
--- a/devtools/client/styleeditor/test/browser_styleeditor_fetch-from-cache.js
+++ b/devtools/client/styleeditor/test/browser_styleeditor_fetch-from-cache.js
@@ -9,36 +9,36 @@
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 monitor = toolbox.getPanel("netmonitor");
- let { gStore, windowRequire } = monitor.panelWin;
+ let { store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let {
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
- gStore.dispatch(Actions.batchEnable(false));
+ store.dispatch(Actions.batchEnable(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 getSortedRequests(gStore.getState())) {
+ for (let item of getSortedRequests(store.getState())) {
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,
--- a/devtools/client/webconsole/test/browser_netmonitor_shows_reqs_in_webconsole.js
+++ b/devtools/client/webconsole/test/browser_netmonitor_shows_reqs_in_webconsole.js
@@ -41,37 +41,39 @@ add_task(function* () {
]
});
// Test that the request appears in the network panel.
let target = TargetFactory.forTab(tab);
let toolbox = yield gDevTools.showToolbox(target, "netmonitor");
info("Network panel is open.");
- testNetmonitor(toolbox);
+ yield testNetmonitor(toolbox);
});
function loadDocument(browser) {
let deferred = promise.defer();
browser.addEventListener("load", function () {
deferred.resolve();
}, {capture: true, once: true});
BrowserTestUtils.loadURI(gBrowser.selectedBrowser, TEST_PATH);
return deferred.promise;
}
-function testNetmonitor(toolbox) {
+function* testNetmonitor(toolbox) {
let monitor = toolbox.getCurrentPanel();
- let { gStore, windowRequire } = monitor.panelWin;
+ let { store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let { getSortedRequests } = windowRequire("devtools/client/netmonitor/src/selectors/index");
- gStore.dispatch(Actions.batchEnable(false));
+ store.dispatch(Actions.batchEnable(false));
+
+ yield waitUntil(() => store.getState().requests.requests.size > 0);
- is(gStore.getState().requests.requests.size, 1, "Network request appears in the network panel");
+ is(store.getState().requests.requests.size, 1, "Network request appears in the network panel");
- let item = getSortedRequests(gStore.getState()).get(0);
+ let item = getSortedRequests(store.getState()).get(0);
is(item.method, "GET", "The attached method is correct.");
is(item.url, TEST_PATH, "The attached url is correct.");
}
--- a/devtools/client/webconsole/test/browser_webconsole_netlogging_panel.js
+++ b/devtools/client/webconsole/test/browser_webconsole_netlogging_panel.js
@@ -18,20 +18,17 @@ add_task(function* () {
const hud = yield loadPageAndGetHud(TEST_NETWORK_REQUEST_URI);
let request = yield finishedRequest;
yield hud.ui.openNetworkPanel(request.actor);
let toolbox = gDevTools.getToolbox(hud.target);
is(toolbox.currentToolId, "netmonitor", "Network panel was opened");
let panel = toolbox.getCurrentPanel();
- let { gStore, windowRequire } = panel.panelWin;
- let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
- let { NetMonitorController } =
- windowRequire("devtools/client/netmonitor/src/netmonitor-controller");
+ let { store, windowRequire } = panel.panelWin;
let { getSelectedRequest } = windowRequire("devtools/client/netmonitor/src/selectors/index");
- let selected = getSelectedRequest(gStore.getState());
+ let selected = getSelectedRequest(store.getState());
is(selected.method, request.request.method,
"The correct request is selected");
is(selected.url, request.request.url,
"The correct request is definitely selected");
});
--- a/devtools/client/webconsole/test/browser_webconsole_netlogging_reset_filter.js
+++ b/devtools/client/webconsole/test/browser_webconsole_netlogging_reset_filter.js
@@ -33,34 +33,34 @@ add_task(function* () {
let htmlRequest = requests.find(e => e.request.url.endsWith("html"));
ok(htmlRequest, "htmlRequest was a html");
yield hud.ui.openNetworkPanel(htmlRequest.actor);
let toolbox = gDevTools.getToolbox(hud.target);
is(toolbox.currentToolId, "netmonitor", "Network panel was opened");
let panel = toolbox.getCurrentPanel();
- let { gStore, windowRequire } = panel.panelWin;
+ let { store, windowRequire } = panel.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let { getSelectedRequest } = windowRequire("devtools/client/netmonitor/src/selectors/index");
- let selected = getSelectedRequest(gStore.getState());
+ let selected = getSelectedRequest(store.getState());
is(selected.method, htmlRequest.request.method,
"The correct request is selected");
is(selected.url, htmlRequest.request.url,
"The correct request is definitely selected");
// Filter out the HTML request.
- gStore.dispatch(Actions.toggleRequestFilterType("js"));
+ store.dispatch(Actions.toggleRequestFilterType("js"));
yield toolbox.selectTool("webconsole");
is(toolbox.currentToolId, "webconsole", "Web console was selected");
yield hud.ui.openNetworkPanel(htmlRequest.actor);
- selected = getSelectedRequest(gStore.getState());
+ selected = getSelectedRequest(store.getState());
is(selected.method, htmlRequest.request.method,
"The correct request is selected");
is(selected.url, htmlRequest.request.url,
"The correct request is definitely selected");
// All tests are done. Shutdown.
HUDService.lastFinishedRequest.callback = null;
htmlRequest = browser = requests = hud = null;
--- a/devtools/client/webconsole/test/browser_webconsole_shows_reqs_in_netmonitor.js
+++ b/devtools/client/webconsole/test/browser_webconsole_shows_reqs_in_netmonitor.js
@@ -57,19 +57,19 @@ function loadDocument(browser) {
}, {capture: true, once: true});
BrowserTestUtils.loadURI(gBrowser.selectedBrowser, TEST_PATH);
return deferred.promise;
}
function* testNetmonitor(toolbox) {
let monitor = toolbox.getCurrentPanel();
- let { gStore, windowRequire } = monitor.panelWin;
+ let { store, windowRequire } = monitor.panelWin;
let { getSortedRequests } = windowRequire("devtools/client/netmonitor/src/selectors/index");
- yield waitUntil(() => gStore.getState().requests.requests.size > 0);
+ yield waitUntil(() => store.getState().requests.requests.size > 0);
- is(gStore.getState().requests.requests.size, 1, "Network request appears in the network panel");
+ is(store.getState().requests.requests.size, 1, "Network request appears in the network panel");
- let item = getSortedRequests(gStore.getState()).get(0);
+ let item = getSortedRequests(store.getState()).get(0);
is(item.method, "GET", "The request method is correct.");
is(item.url, TEST_PATH, "The request url is correct.");
}