--- a/.eslintignore
+++ b/.eslintignore
@@ -82,18 +82,16 @@ devtools/client/commandline/**
devtools/client/debugger/**
devtools/client/framework/**
!devtools/client/framework/selection.js
!devtools/client/framework/target*
!devtools/client/framework/toolbox*
devtools/client/inspector/markup/test/doc_markup_events_*.html
devtools/client/inspector/rules/test/doc_media_queries.html
devtools/client/memory/test/chrome/*.html
-devtools/client/netmonitor/test/**
-devtools/client/netmonitor/har/test/**
devtools/client/performance/components/test/test_jit_optimizations_01.html
devtools/client/projecteditor/**
devtools/client/responsive.html/test/browser/touch.html
devtools/client/responsivedesign/**
devtools/client/scratchpad/**
devtools/client/shadereditor/**
devtools/client/shared/*.jsm
devtools/client/shared/components/reps/reps.js
--- a/devtools/client/netmonitor/har/test/browser_net_har_copy_all_as_har.js
+++ b/devtools/client/netmonitor/har/test/browser_net_har_copy_all_as_har.js
@@ -6,17 +6,17 @@
/**
* Basic tests for exporting Network panel content into HAR format.
*/
add_task(function* () {
let { tab, monitor } = yield initNetMonitor(SIMPLE_URL);
info("Starting test... ");
- let { document, gStore, windowRequire } = monitor.panelWin;
+ let { gStore, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/actions/index");
let RequestListContextMenu = windowRequire(
"devtools/client/netmonitor/request-list-context-menu");
gStore.dispatch(Actions.batchEnable(false));
let wait = waitForNetworkEvents(monitor, 1);
tab.linkedBrowser.reload();
--- a/devtools/client/netmonitor/har/test/browser_net_har_post_data.js
+++ b/devtools/client/netmonitor/har/test/browser_net_har_post_data.js
@@ -7,17 +7,17 @@
* 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 { document, gStore, windowRequire } = monitor.panelWin;
+ let { gStore, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/actions/index");
let RequestListContextMenu = windowRequire(
"devtools/client/netmonitor/request-list-context-menu");
gStore.dispatch(Actions.batchEnable(false));
// Execute one POST request on the page and wait till its done.
let wait = waitForNetworkEvents(monitor, 0, 1);
--- a/devtools/client/netmonitor/har/test/browser_net_har_throttle_upload.js
+++ b/devtools/client/netmonitor/har/test/browser_net_har_throttle_upload.js
@@ -11,17 +11,17 @@ 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 { document, gStore, windowRequire, NetMonitorController } = monitor.panelWin;
+ let { gStore, windowRequire, NetMonitorController } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/actions/index");
let RequestListContextMenu = windowRequire(
"devtools/client/netmonitor/request-list-context-menu");
gStore.dispatch(Actions.batchEnable(false));
const size = 4096;
const uploadSize = actuallyThrottle ? size / 3 : 0;
--- a/devtools/client/netmonitor/har/test/html_har_post-data-test-page.html
+++ b/devtools/client/netmonitor/har/test/html_har_post-data-test-page.html
@@ -11,30 +11,33 @@
<meta http-equiv="Expires" content="0" />
<title>Network Monitor Test Page</title>
</head>
<body>
<p>HAR POST data test</p>
<script type="text/javascript">
- function post(aAddress, aData) {
- var xhr = new XMLHttpRequest();
- xhr.open("POST", aAddress, true);
+ /* exported executeTest, executeTest2 */
+ "use strict";
+
+ function post(address, data) {
+ let xhr = new XMLHttpRequest();
+ xhr.open("POST", address, true);
xhr.setRequestHeader("Content-Type", "application/json");
- xhr.send(aData);
+ xhr.send(data);
}
function executeTest() {
- var url = "html_har_post-data-test-page.html";
- var data = "{'first': 'John', 'last': 'Doe'}";
+ const url = "html_har_post-data-test-page.html";
+ const data = "{'first': 'John', 'last': 'Doe'}";
post(url, data);
}
function executeTest2(size) {
- var url = "html_har_post-data-test-page.html";
- var data = "x".repeat(size);
+ const url = "html_har_post-data-test-page.html";
+ const data = "x".repeat(size);
post(url, data);
}
</script>
</body>
</html>
--- a/devtools/client/netmonitor/test/browser_net_autoscroll.js
+++ b/devtools/client/netmonitor/test/browser_net_autoscroll.js
@@ -61,17 +61,17 @@ add_task(function* () {
}
function* waitForRequestsToOverflowContainer() {
info("Waiting for enough requests to overflow the container");
while (true) {
info("Waiting for one network request");
yield waitForNetworkEvents(monitor, 1);
console.log(requestsContainer.scrollHeight);
- console.log(requestsContainer.clientHeight)
+ console.log(requestsContainer.clientHeight);
if (requestsContainer.scrollHeight > requestsContainer.clientHeight) {
info("The list is long enough, returning");
return;
}
}
}
function scrolledToBottom(element) {
--- a/devtools/client/netmonitor/test/browser_net_cause.js
+++ b/devtools/client/netmonitor/test/browser_net_cause.js
@@ -33,52 +33,52 @@ const EXPECTED_REQUESTS = [
causeUri: CAUSE_URL,
stack: false
},
{
method: "GET",
url: EXAMPLE_URL + "xhr_request",
causeType: "xhr",
causeUri: CAUSE_URL,
- stack: [{ fn: "performXhrRequest", file: CAUSE_FILE_NAME, line: 22 }]
+ stack: [{ fn: "performXhrRequest", file: CAUSE_FILE_NAME, line: 24 }]
},
{
method: "GET",
url: EXAMPLE_URL + "fetch_request",
causeType: "fetch",
causeUri: CAUSE_URL,
- stack: [{ fn: "performFetchRequest", file: CAUSE_FILE_NAME, line: 26 }]
+ stack: [{ fn: "performFetchRequest", file: CAUSE_FILE_NAME, line: 28 }]
},
{
method: "GET",
url: EXAMPLE_URL + "promise_fetch_request",
causeType: "fetch",
causeUri: CAUSE_URL,
stack: [
- { fn: "performPromiseFetchRequest", file: CAUSE_FILE_NAME, line: 38 },
- { fn: null, file: CAUSE_FILE_NAME, line: 37, asyncCause: "promise callback" },
+ { fn: "performPromiseFetchRequest", file: CAUSE_FILE_NAME, line: 40 },
+ { fn: null, file: CAUSE_FILE_NAME, line: 39, asyncCause: "promise callback" },
]
},
{
method: "GET",
url: EXAMPLE_URL + "timeout_fetch_request",
causeType: "fetch",
causeUri: CAUSE_URL,
stack: [
- { fn: "performTimeoutFetchRequest", file: CAUSE_FILE_NAME, line: 40 },
- { fn: "performPromiseFetchRequest", file: CAUSE_FILE_NAME, line: 39,
+ { fn: "performTimeoutFetchRequest", file: CAUSE_FILE_NAME, line: 42 },
+ { fn: "performPromiseFetchRequest", file: CAUSE_FILE_NAME, line: 41,
asyncCause: "setTimeout handler" },
]
},
{
method: "POST",
url: EXAMPLE_URL + "beacon_request",
causeType: "beacon",
causeUri: CAUSE_URL,
- stack: [{ fn: "performBeaconRequest", file: CAUSE_FILE_NAME, line: 30 }]
+ stack: [{ fn: "performBeaconRequest", file: CAUSE_FILE_NAME, line: 32 }]
},
];
add_task(function* () {
// Async stacks aren't on by default in all builds
yield SpecialPowers.pushPrefEnv({ set: [["javascript.options.asyncstack", true]] });
// the initNetMonitor function clears the network request list after the
--- a/devtools/client/netmonitor/test/browser_net_charts-03.js
+++ b/devtools/client/netmonitor/test/browser_net_charts-03.js
@@ -62,17 +62,16 @@ add_task(function* () {
"The first column of the header exists.");
is(rows[0].querySelectorAll("span")[1].getAttribute("name"), "label2",
"The second column of the header exists.");
is(rows[0].querySelectorAll("span")[0].textContent, "label1header",
"The first column of the header displays the correct text.");
is(rows[0].querySelectorAll("span")[1].textContent, "label2header",
"The second column of the header displays the correct text.");
-
ok(rows[1].querySelector(".table-chart-row-box.chart-colored-blob"),
"A colored blob exists for the firt row.");
is(rows[1].querySelectorAll("span")[0].getAttribute("name"), "label1",
"The first column of the first row exists.");
is(rows[1].querySelectorAll("span")[1].getAttribute("name"), "label2",
"The second column of the first row exists.");
is(rows[1].querySelectorAll("span")[0].textContent, "1",
"The first column of the first row displays the correct text.");
--- a/devtools/client/netmonitor/test/browser_net_clear.js
+++ b/devtools/client/netmonitor/test/browser_net_clear.js
@@ -9,17 +9,16 @@
add_task(function* () {
let { tab, monitor } = yield initNetMonitor(SIMPLE_URL);
info("Starting test... ");
let { document, gStore, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/actions/index");
let { EVENTS } = windowRequire("devtools/client/netmonitor/constants");
- let detailsPane = document.querySelector("#details-pane");
let detailsPanelToggleButton = document.querySelector(".network-details-panel-toggle");
let clearButton = document.querySelector(".requests-list-clear-button");
gStore.dispatch(Actions.batchEnable(false));
// Make sure we start in a sane state
assertNoRequestState();
--- a/devtools/client/netmonitor/test/browser_net_content-type.js
+++ b/devtools/client/netmonitor/test/browser_net_content-type.js
@@ -36,100 +36,110 @@ add_task(function* () {
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(
+ }
+ );
+ verifyRequestItemTarget(
document,
getDisplayedRequests(gStore.getState()),
getSortedRequests(gStore.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(
+ }
+ );
+ verifyRequestItemTarget(
document,
getDisplayedRequests(gStore.getState()),
getSortedRequests(gStore.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(
+ }
+ );
+ verifyRequestItemTarget(
document,
getDisplayedRequests(gStore.getState()),
getSortedRequests(gStore.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(
+ }
+ );
+ verifyRequestItemTarget(
document,
getDisplayedRequests(gStore.getState()),
getSortedRequests(gStore.getState()).get(4),
"GET",
- CONTENT_TYPE_SJS + "?fmt=bogus", {
+ 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(
+ }
+ );
+ verifyRequestItemTarget(
document,
getDisplayedRequests(gStore.getState()),
getSortedRequests(gStore.getState()).get(5),
"GET",
- TEST_IMAGE, {
+ TEST_IMAGE,
+ {
fuzzyUrl: true,
status: 200,
statusText: "OK",
type: "png",
fullMimeType: "image/png",
size: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 580),
time: true
- });
- verifyRequestItemTarget(
+ }
+ );
+ verifyRequestItemTarget(
document,
getDisplayedRequests(gStore.getState()),
getSortedRequests(gStore.getState()).get(6),
"GET",
- CONTENT_TYPE_SJS + "?fmt=gzip", {
+ CONTENT_TYPE_SJS + "?fmt=gzip",
+ {
status: 200,
statusText: "OK",
type: "plain",
fullMimeType: "text/plain",
transferred: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 73),
size: L10N.getFormatStrWithNumbers("networkMenu.sizeKB", 10.73),
time: true
- });
+ }
+ );
yield selectIndexAndWaitForEditor(0);
yield testResponseTab("xml");
yield selectIndexAndWaitForEditor(1);
yield testResponseTab("css");
yield selectIndexAndWaitForEditor(2);
--- a/devtools/client/netmonitor/test/browser_net_copy_as_curl.js
+++ b/devtools/client/netmonitor/test/browser_net_copy_as_curl.js
@@ -36,18 +36,17 @@ add_task(function* () {
header("X-Custom-Header-2: 8.8.8.8"),
header("X-Custom-Header-3: Mon, 3 Mar 2014 11:11:11 GMT"),
header("Referer: " + CURL_URL),
header("Connection: keep-alive"),
header("Pragma: no-cache"),
header("Cache-Control: no-cache")
];
- let { document, gStore, windowRequire } = monitor.panelWin;
- let Actions = windowRequire("devtools/client/netmonitor/actions/index");
+ let { document } = monitor.panelWin;
let wait = waitForNetworkEvents(monitor, 1);
yield ContentTask.spawn(tab.linkedBrowser, SIMPLE_SJS, function* (url) {
content.wrappedJSObject.performRequest(url);
});
yield wait;
EventUtils.sendMouseEvent({ type: "mousedown" },
--- a/devtools/client/netmonitor/test/browser_net_copy_image_as_data_uri.js
+++ b/devtools/client/netmonitor/test/browser_net_copy_image_as_data_uri.js
@@ -6,17 +6,17 @@
/**
* Tests if copying an image as data uri works.
*/
add_task(function* () {
let { tab, monitor } = yield initNetMonitor(CONTENT_TYPE_WITHOUT_CACHE_URL);
info("Starting test... ");
- let { document, gStore, windowRequire } = monitor.panelWin;
+ let { document } = monitor.panelWin;
let wait = waitForNetworkEvents(monitor, CONTENT_TYPE_WITHOUT_CACHE_REQUESTS);
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
content.wrappedJSObject.performRequests();
});
yield wait;
EventUtils.sendMouseEvent({ type: "mousedown" },
@@ -24,14 +24,14 @@ add_task(function* () {
EventUtils.sendMouseEvent({ type: "contextmenu" },
document.querySelectorAll(".request-list-item")[5]);
yield waitForClipboardPromise(function setup() {
// Context menu is appending in XUL document, we must select it from
// toolbox.doc
monitor.toolbox.doc
.querySelector("#request-list-context-copy-image-as-data-uri").click();
- }, TEST_IMAGE_DATA_URI);
+ }, TEST_IMAGE_DATA_URI);
ok(true, "Clipboard contains the currently selected image as data uri.");
yield teardown(monitor);
});
--- a/devtools/client/netmonitor/test/browser_net_curl-utils.js
+++ b/devtools/client/netmonitor/test/browser_net_curl-utils.js
@@ -8,17 +8,17 @@
*/
const { CurlUtils } = require("devtools/client/shared/curl");
add_task(function* () {
let { tab, monitor } = yield initNetMonitor(CURL_UTILS_URL);
info("Starting test... ");
- let { document, gStore, windowRequire, gNetwork } = monitor.panelWin;
+ let { gStore, windowRequire, gNetwork } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/actions/index");
let { getSortedRequests } = windowRequire("devtools/client/netmonitor/selectors/index");
gStore.dispatch(Actions.batchEnable(false));
let wait = waitForNetworkEvents(monitor, 1, 3);
yield ContentTask.spawn(tab.linkedBrowser, SIMPLE_SJS, function* (url) {
content.wrappedJSObject.performRequests(url);
--- a/devtools/client/netmonitor/test/browser_net_cyrillic-02.js
+++ b/devtools/client/netmonitor/test/browser_net_cyrillic-02.js
@@ -8,17 +8,16 @@
* 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 Actions = windowRequire("devtools/client/netmonitor/actions/index");
let {
getDisplayedRequests,
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/selectors/index");
let wait = waitForNetworkEvents(monitor, 1);
tab.linkedBrowser.reload();
yield wait;
--- a/devtools/client/netmonitor/test/browser_net_filter-04.js
+++ b/devtools/client/netmonitor/test/browser_net_filter-04.js
@@ -25,17 +25,18 @@ const REQUESTS_WITH_MEDIA_AND_FLASH = RE
]);
const REQUESTS_WITH_MEDIA_AND_FLASH_AND_WS = REQUESTS_WITH_MEDIA_AND_FLASH.concat([
/* "Upgrade" is a reserved header and can not be set on XMLHttpRequest */
{ url: "sjs_content-type-test-server.sjs?fmt=ws" },
]);
add_task(function* () {
- Services.prefs.setCharPref("devtools.netmonitor.filters", '["bogus", "js", "alsobogus"]');
+ Services.prefs.setCharPref("devtools.netmonitor.filters",
+ '["bogus", "js", "alsobogus"]');
let { monitor } = yield initNetMonitor(FILTERING_URL);
info("Starting test... ");
let { gStore, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/actions/index");
let { Prefs } = windowRequire("devtools/client/netmonitor/utils/prefs");
--- a/devtools/client/netmonitor/test/browser_net_footer-summary.js
+++ b/devtools/client/netmonitor/test/browser_net_footer-summary.js
@@ -44,18 +44,19 @@ add_task(function* () {
EventUtils.sendMouseEvent({ type: "click" }, buttonEl);
testStatus();
}
}
yield teardown(monitor);
function testStatus() {
- let value = document.querySelector(".requests-list-network-summary-button").textContent;
- info("Current summary: " + value);
+ let value = document.querySelector(".requests-list-network-summary-button")
+ .textContent;
+ info("Current summary: " + value);
let state = gStore.getState();
let totalRequestsCount = state.requests.requests.size;
let requestsSummary = getDisplayedRequestsSummary(state);
info(`Current requests: ${requestsSummary.count} of ${totalRequestsCount}.`);
if (!totalRequestsCount || !requestsSummary.count) {
is(value, L10N.getStr("networkMenu.empty"),
--- a/devtools/client/netmonitor/test/browser_net_frame.js
+++ b/devtools/client/netmonitor/test/browser_net_frame.js
@@ -34,52 +34,52 @@ const EXPECTED_REQUESTS_TOP = [
causeUri: TOP_URL,
stack: false
},
{
method: "GET",
url: EXAMPLE_URL + "xhr_request",
causeType: "xhr",
causeUri: TOP_URL,
- stack: [{ fn: "performXhrRequest", file: TOP_FILE_NAME, line: 23 }]
+ stack: [{ fn: "performXhrRequest", file: TOP_FILE_NAME, line: 25 }]
},
{
method: "GET",
url: EXAMPLE_URL + "fetch_request",
causeType: "fetch",
causeUri: TOP_URL,
- stack: [{ fn: "performFetchRequest", file: TOP_FILE_NAME, line: 27 }]
+ stack: [{ fn: "performFetchRequest", file: TOP_FILE_NAME, line: 29 }]
},
{
method: "GET",
url: EXAMPLE_URL + "promise_fetch_request",
causeType: "fetch",
causeUri: TOP_URL,
stack: [
- { fn: "performPromiseFetchRequest", file: TOP_FILE_NAME, line: 39 },
- { fn: null, file: TOP_FILE_NAME, line: 38, asyncCause: "promise callback" },
+ { fn: "performPromiseFetchRequest", file: TOP_FILE_NAME, line: 41 },
+ { fn: null, file: TOP_FILE_NAME, line: 40, asyncCause: "promise callback" },
]
},
{
method: "GET",
url: EXAMPLE_URL + "timeout_fetch_request",
causeType: "fetch",
causeUri: TOP_URL,
stack: [
- { fn: "performTimeoutFetchRequest", file: TOP_FILE_NAME, line: 41 },
- { fn: "performPromiseFetchRequest", file: TOP_FILE_NAME, line: 40,
+ { fn: "performTimeoutFetchRequest", file: TOP_FILE_NAME, line: 43 },
+ { fn: "performPromiseFetchRequest", file: TOP_FILE_NAME, line: 42,
asyncCause: "setTimeout handler" },
]
},
{
method: "POST",
url: EXAMPLE_URL + "beacon_request",
causeType: "beacon",
causeUri: TOP_URL,
- stack: [{ fn: "performBeaconRequest", file: TOP_FILE_NAME, line: 31 }]
+ stack: [{ fn: "performBeaconRequest", file: TOP_FILE_NAME, line: 33 }]
},
];
const EXPECTED_REQUESTS_SUB = [
{
method: "GET",
url: SUB_URL,
causeType: "subdocument",
@@ -100,52 +100,52 @@ const EXPECTED_REQUESTS_SUB = [
causeUri: SUB_URL,
stack: false
},
{
method: "GET",
url: EXAMPLE_URL + "xhr_request",
causeType: "xhr",
causeUri: SUB_URL,
- stack: [{ fn: "performXhrRequest", file: SUB_FILE_NAME, line: 22 }]
+ stack: [{ fn: "performXhrRequest", file: SUB_FILE_NAME, line: 24 }]
},
{
method: "GET",
url: EXAMPLE_URL + "fetch_request",
causeType: "fetch",
causeUri: SUB_URL,
- stack: [{ fn: "performFetchRequest", file: SUB_FILE_NAME, line: 26 }]
+ stack: [{ fn: "performFetchRequest", file: SUB_FILE_NAME, line: 28 }]
},
{
method: "GET",
url: EXAMPLE_URL + "promise_fetch_request",
causeType: "fetch",
causeUri: SUB_URL,
stack: [
- { fn: "performPromiseFetchRequest", file: SUB_FILE_NAME, line: 38 },
- { fn: null, file: SUB_FILE_NAME, line: 37, asyncCause: "promise callback" },
+ { fn: "performPromiseFetchRequest", file: SUB_FILE_NAME, line: 40 },
+ { fn: null, file: SUB_FILE_NAME, line: 39, asyncCause: "promise callback" },
]
},
{
method: "GET",
url: EXAMPLE_URL + "timeout_fetch_request",
causeType: "fetch",
causeUri: SUB_URL,
stack: [
- { fn: "performTimeoutFetchRequest", file: SUB_FILE_NAME, line: 40 },
- { fn: "performPromiseFetchRequest", file: SUB_FILE_NAME, line: 39,
+ { fn: "performTimeoutFetchRequest", file: SUB_FILE_NAME, line: 42 },
+ { fn: "performPromiseFetchRequest", file: SUB_FILE_NAME, line: 41,
asyncCause: "setTimeout handler" },
]
},
{
method: "POST",
url: EXAMPLE_URL + "beacon_request",
causeType: "beacon",
causeUri: SUB_URL,
- stack: [{ fn: "performBeaconRequest", file: SUB_FILE_NAME, line: 30 }]
+ stack: [{ fn: "performBeaconRequest", file: SUB_FILE_NAME, line: 32 }]
},
];
const REQUEST_COUNT = EXPECTED_REQUESTS_TOP.length + EXPECTED_REQUESTS_SUB.length;
add_task(function* () {
// Async stacks aren't on by default in all builds
yield SpecialPowers.pushPrefEnv({ set: [["javascript.options.asyncstack", true]] });
--- a/devtools/client/netmonitor/test/browser_net_header-docs.js
+++ b/devtools/client/netmonitor/test/browser_net_header-docs.js
@@ -11,17 +11,16 @@ const { getHeadersURL } = require("devto
*/
add_task(function* () {
let { tab, monitor } = yield initNetMonitor(POST_DATA_URL);
info("Starting test... ");
let { document, gStore, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/actions/index");
let {
- getDisplayedRequests,
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/selectors/index");
gStore.dispatch(Actions.batchEnable(false));
let wait = waitForNetworkEvents(monitor, 0, 2);
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
content.wrappedJSObject.performRequests();
@@ -35,23 +34,25 @@ add_task(function* () {
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) {
- document.querySelectorAll(".properties-view .treeRow.stringRow").forEach((rowEl, index) => {
- let headerName = rowEl.querySelectorAll(".treeLabelCell .treeLabel")[0].textContent;
+ let selector = ".properties-view .treeRow.stringRow";
+ document.querySelectorAll(selector).forEach((rowEl, index) => {
+ let headerName = rowEl.querySelectorAll(".treeLabelCell .treeLabel")[0]
+ .textContent;
let headerDocURL = getHeadersURL(headerName);
let learnMoreEl = rowEl.querySelectorAll(".treeValueCell .learn-more-link");
if (headerDocURL === null) {
ok(learnMoreEl.length === 0,
- "undocumented header does not include a \"Learn More\" button");
+ "undocumented header does not include a \"Learn More\" button");
} else {
ok(learnMoreEl[0].getAttribute("title") === headerDocURL,
- "documented header includes a \"Learn More\" button with a link to MDN");
+ "documented header includes a \"Learn More\" button with a link to MDN");
}
});
}
});
--- a/devtools/client/netmonitor/test/browser_net_icon-preview.js
+++ b/devtools/client/netmonitor/test/browser_net_icon-preview.js
@@ -59,14 +59,15 @@ add_task(function* () {
function* reloadAndPerformRequests() {
yield NetMonitorController.triggerActivity(ACTIVITY_TYPE.RELOAD.WITH_CACHE_ENABLED);
yield performRequests();
}
function checkImageThumbnail() {
is(document.querySelectorAll(".requests-list-icon[data-type=thumbnail]").length, 1,
"There should be only one image request with a thumbnail displayed.");
- is(document.querySelector(".requests-list-icon[data-type=thumbnail]").src, TEST_IMAGE_DATA_URI,
+ is(document.querySelector(".requests-list-icon[data-type=thumbnail]").src,
+ TEST_IMAGE_DATA_URI,
"The image requests-list-icon thumbnail is displayed correctly.");
is(document.querySelector(".requests-list-icon[data-type=thumbnail]").hidden, false,
"The image requests-list-icon thumbnail should not be hidden.");
}
});
--- a/devtools/client/netmonitor/test/browser_net_image-tooltip.js
+++ b/devtools/client/netmonitor/test/browser_net_image-tooltip.js
@@ -11,95 +11,90 @@ const IMAGE_TOOLTIP_REQUESTS = 1;
*/
add_task(function* test() {
let { tab, monitor } = yield initNetMonitor(IMAGE_TOOLTIP_URL);
info("Starting test... ");
let { document, gStore, windowRequire, NetMonitorController } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/actions/index");
let { ACTIVITY_TYPE, EVENTS } = windowRequire("devtools/client/netmonitor/constants");
- let {
- getDisplayedRequests,
- getSortedRequests,
- } = windowRequire("devtools/client/netmonitor/selectors/index");
let toolboxDoc = monitor.toolbox.doc;
gStore.dispatch(Actions.batchEnable(false));
let onEvents = waitForNetworkEvents(monitor, IMAGE_TOOLTIP_REQUESTS);
let onThumbnail = monitor.panelWin.once(EVENTS.RESPONSE_IMAGE_THUMBNAIL_DISPLAYED);
yield performRequests();
yield onEvents;
yield onThumbnail;
info("Checking the image thumbnail after a few requests were made...");
- yield showTooltipAndVerify(toolboxDoc,
- document.querySelectorAll(".request-list-item")[0]);
+ yield showTooltipAndVerify(document.querySelectorAll(".request-list-item")[0]);
// Hide tooltip before next test, to avoid the situation that tooltip covers
// the icon for the request of the next test.
info("Checking the image thumbnail gets hidden...");
- yield hideTooltipAndVerify(monitor.toolbox.doc,
- document.querySelectorAll(".request-list-item")[0]);
+ yield hideTooltipAndVerify(document.querySelectorAll(".request-list-item")[0]);
// +1 extra document reload
onEvents = waitForNetworkEvents(monitor, IMAGE_TOOLTIP_REQUESTS + 1);
onThumbnail = monitor.panelWin.once(EVENTS.RESPONSE_IMAGE_THUMBNAIL_DISPLAYED);
info("Reloading the debuggee and performing all requests again...");
yield NetMonitorController.triggerActivity(ACTIVITY_TYPE.RELOAD.WITH_CACHE_ENABLED);
yield performRequests();
yield onEvents;
yield onThumbnail;
info("Checking the image thumbnail after a reload.");
- yield showTooltipAndVerify(toolboxDoc,
- document.querySelectorAll(".request-list-item")[1]);
+ yield showTooltipAndVerify(document.querySelectorAll(".request-list-item")[1]);
info("Checking if the image thumbnail is hidden when mouse leaves the menu widget");
let requestsListContents = document.querySelector(".requests-list-contents");
- EventUtils.synthesizeMouse(requestsListContents, 0, 0, { type: "mouseout" }, monitor.panelWin);
+ EventUtils.synthesizeMouse(requestsListContents, 0, 0, { type: "mouseout" },
+ monitor.panelWin);
yield waitUntil(() => !toolboxDoc.querySelector(".tooltip-container.tooltip-visible"));
yield teardown(monitor);
function performRequests() {
return ContentTask.spawn(tab.linkedBrowser, {}, function* () {
content.wrappedJSObject.performRequests();
});
}
/**
* Show a tooltip on the {target} and verify that it was displayed
* with the expected content.
*/
- function* showTooltipAndVerify(toolboxDoc, target) {
+ function* showTooltipAndVerify(target) {
let anchor = target.querySelector(".requests-list-file");
- yield showTooltipOn(toolboxDoc, anchor);
+ yield showTooltipOn(anchor);
info("Tooltip was successfully opened for the image request.");
is(toolboxDoc.querySelector(".tooltip-panel img").src, TEST_IMAGE_DATA_URI,
"The tooltip's image content is displayed correctly.");
}
/**
* Trigger a tooltip over an element by sending mousemove event.
* @return a promise that resolves when the tooltip is shown
*/
- function* showTooltipOn(toolboxDoc, element) {
+ function* showTooltipOn(element) {
let win = element.ownerDocument.defaultView;
EventUtils.synthesizeMouseAtCenter(element, { type: "mousemove" }, win);
yield waitUntil(() => toolboxDoc.querySelector(".tooltip-panel img"));
}
/**
* Hide a tooltip on the {target} and verify that it was closed.
*/
- function* hideTooltipAndVerify(toolboxDoc, target) {
+ function* hideTooltipAndVerify(target) {
// Hovering over the "method" column hides the tooltip.
let anchor = target.querySelector(".requests-list-method");
let win = anchor.ownerDocument.defaultView;
EventUtils.synthesizeMouseAtCenter(anchor, { type: "mousemove" }, win);
- yield waitUntil(() => !toolboxDoc.querySelector(".tooltip-container.tooltip-visible"));
+ yield waitUntil(
+ () => !toolboxDoc.querySelector(".tooltip-container.tooltip-visible"));
info("Tooltip was successfully closed.");
}
});
--- a/devtools/client/netmonitor/test/browser_net_json-null.js
+++ b/devtools/client/netmonitor/test/browser_net_json-null.js
@@ -10,20 +10,16 @@ const { L10N } = require("devtools/clien
*/
add_task(function* () {
let { tab, monitor } = yield initNetMonitor(JSON_BASIC_URL + "?name=null");
info("Starting test... ");
let { document, gStore, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/actions/index");
- let {
- getDisplayedRequests,
- getSortedRequests,
- } = windowRequire("devtools/client/netmonitor/selectors/index");
gStore.dispatch(Actions.batchEnable(false));
let wait = waitForNetworkEvents(monitor, 1);
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
content.wrappedJSObject.performRequests();
});
yield wait;
--- a/devtools/client/netmonitor/test/browser_net_open_request_in_tab.js
+++ b/devtools/client/netmonitor/test/browser_net_open_request_in_tab.js
@@ -8,20 +8,16 @@
*/
add_task(function* () {
let { tab, monitor } = yield initNetMonitor(CUSTOM_GET_URL);
info("Starting test...");
let { document, gStore, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/actions/index");
- let {
- getDisplayedRequests,
- getSortedRequests,
- } = windowRequire("devtools/client/netmonitor/selectors/index");
gStore.dispatch(Actions.batchEnable(false));
let wait = waitForNetworkEvents(monitor, 1);
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
content.wrappedJSObject.performRequests(1);
});
yield wait;
--- a/devtools/client/netmonitor/test/browser_net_persistent_logs.js
+++ b/devtools/client/netmonitor/test/browser_net_persistent_logs.js
@@ -7,17 +7,17 @@
* Tests if the network monitor leaks on initialization and sudden destruction.
* You can also use this initialization format as a template for other tests.
*/
add_task(function* () {
let { tab, monitor } = yield initNetMonitor(SINGLE_GET_URL);
info("Starting test... ");
- let { document, windowRequire } = monitor.panelWin;
+ let { document } = monitor.panelWin;
Services.prefs.setBoolPref("devtools.webconsole.persistlog", false);
yield reloadAndWait();
is(document.querySelectorAll(".request-list-item").length, 2,
"The request list should have two items at this point.");
--- a/devtools/client/netmonitor/test/browser_net_post-data-01.js
+++ b/devtools/client/netmonitor/test/browser_net_post-data-01.js
@@ -39,31 +39,33 @@ add_task(function* () {
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(
+ }
+ );
+ verifyRequestItemTarget(
document,
getDisplayedRequests(gStore.getState()),
getSortedRequests(gStore.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),
time: true
- });
+ }
+ );
// Wait for all tree sections updated by react
wait = waitForDOM(document, "#params-panel .tree-section", 2);
EventUtils.sendMouseEvent({ type: "mousedown" },
document.querySelectorAll(".request-list-item")[0]);
EventUtils.sendMouseEvent({ type: "click" },
document.querySelector("#params-tab"));
yield wait;
@@ -102,39 +104,43 @@ add_task(function* () {
is(treeSections[0].querySelector(".treeLabel").textContent,
L10N.getStr("paramsQueryString"),
"The query section doesn't have the correct title.");
is(treeSections[1].querySelector(".treeLabel").textContent,
L10N.getStr(type == "urlencoded" ? "paramsFormData" : "paramsPostPayload"),
"The post section doesn't have the correct title.");
- let labels = tabpanel.querySelectorAll("tr:not(.tree-section) .treeLabelCell .treeLabel");
- let values = tabpanel.querySelectorAll("tr:not(.tree-section) .treeValueCell .objectBox");
+ let labels = tabpanel
+ .querySelectorAll("tr:not(.tree-section) .treeLabelCell .treeLabel");
+ let values = tabpanel
+ .querySelectorAll("tr:not(.tree-section) .treeValueCell .objectBox");
is(labels[0].textContent, "foo", "The first query param name was incorrect.");
is(values[0].textContent, "\"bar\"", "The first query param value was incorrect.");
is(labels[1].textContent, "baz", "The second query param name was incorrect.");
is(values[1].textContent, "\"42\"", "The second query param value was incorrect.");
is(labels[2].textContent, "type", "The third query param name was incorrect.");
- is(values[2].textContent, "\"" + type + "\"", "The third query param value was incorrect.");
+ is(values[2].textContent, "\"" + type + "\"",
+ "The third query param value was incorrect.");
if (type == "urlencoded") {
checkVisibility("params");
is(labels.length, 5, "There should be 5 param values displayed in this tabpanel.");
is(labels[3].textContent, "foo", "The first post param name was incorrect.");
is(values[3].textContent, "\"bar\"", "The first post param value was incorrect.");
is(labels[4].textContent, "baz", "The second post param name was incorrect.");
is(values[4].textContent, "\"123\"", "The second post param value was incorrect.");
} else {
checkVisibility("params editor");
is(labels.length, 3, "There should be 3 param values displayed in this tabpanel.");
- let text = editorFrames[0].contentDocument.querySelector(".CodeMirror-code").textContent;
+ let text = editorFrames[0].contentDocument.querySelector(".CodeMirror-code")
+ .textContent;
ok(text.includes("Content-Disposition: form-data; name=\"text\""),
"The text shown in the source editor is incorrect (1.1).");
ok(text.includes("Content-Disposition: form-data; name=\"email\""),
"The text shown in the source editor is incorrect (2.1).");
ok(text.includes("Content-Disposition: form-data; name=\"range\""),
"The text shown in the source editor is incorrect (3.1).");
ok(text.includes("Content-Disposition: form-data; name=\"Custom field\""),
--- a/devtools/client/netmonitor/test/browser_net_post-data-02.js
+++ b/devtools/client/netmonitor/test/browser_net_post-data-02.js
@@ -11,20 +11,16 @@
add_task(function* () {
let { L10N } = require("devtools/client/netmonitor/utils/l10n");
let { tab, monitor } = yield initNetMonitor(POST_RAW_URL);
info("Starting test... ");
let { document, gStore, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/actions/index");
- let {
- getDisplayedRequests,
- getSortedRequests,
- } = windowRequire("devtools/client/netmonitor/selectors/index");
gStore.dispatch(Actions.batchEnable(false));
let wait = waitForNetworkEvents(monitor, 0, 1);
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
content.wrappedJSObject.performRequests();
});
yield wait;
--- a/devtools/client/netmonitor/test/browser_net_prefs-reload.js
+++ b/devtools/client/netmonitor/test/browser_net_prefs-reload.js
@@ -6,28 +6,30 @@
/**
* Tests if the prefs that should survive across tool reloads work.
*/
add_task(function* () {
let { monitor } = yield initNetMonitor(SIMPLE_URL);
let { getRequestFilterTypes } = monitor.panelWin
.windowRequire("devtools/client/netmonitor/selectors/index");
- let Actions = monitor.panelWin.windowRequire("devtools/client/netmonitor/actions/index");
+ let Actions = monitor.panelWin
+ .windowRequire("devtools/client/netmonitor/actions/index");
info("Starting test... ");
// This test reopens the network monitor a bunch of times, for different
// hosts (bottom, side, window). This seems to be slow on debug builds.
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/utils/prefs").Prefs;
+ let getPrefs = () => monitor.panelWin
+ .windowRequire("devtools/client/netmonitor/utils/prefs").Prefs;
let getStore = () => monitor.panelWin.gStore;
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
@@ -39,25 +41,29 @@ add_task(function* () {
// before trying to validate the changes.
modifyFrontend: (value) => value.forEach(e =>
getStore().dispatch(Actions.toggleRequestFilterType(e)))
},
networkDetailsWidth: {
newValue: ~~(Math.random() * 200 + 100),
validateValue: () =>
getDoc().querySelector(".monitor-panel .split-box .controlled").clientWidth,
- modifyFrontend: (value) =>
- getDoc().querySelector(".monitor-panel .split-box .controlled").style.width = `${value}px`,
+ modifyFrontend: function (value) {
+ getDoc().querySelector(".monitor-panel .split-box .controlled")
+ .style.width = `${value}px`;
+ }
},
networkDetailsHeight: {
newValue: ~~(Math.random() * 300 + 100),
validateValue: () =>
getDoc().querySelector(".monitor-panel .split-box .controlled").clientHeight,
- modifyFrontend: (value) =>
- getDoc().querySelector(".monitor-panel .split-box .controlled").style.height = `${value}px`
+ modifyFrontend: function (value) {
+ getDoc().querySelector(".monitor-panel .split-box .controlled")
+ .style.height = `${value}px`;
+ }
}
/* add more prefs here... */
};
yield testBottom();
yield testSide();
yield testWindow();
@@ -75,17 +81,17 @@ add_task(function* () {
}
function validateFirstPrefValues(isVerticalSplitter) {
info("Validating current pref values to the UI elements.");
for (let name in prefsToCheck) {
if ((isVerticalSplitter && name === "networkDetailsHeight") ||
(!isVerticalSplitter && name === "networkDetailsWidth")) {
- continue
+ continue;
}
let currentValue = getPrefs()[name];
let firstValue = prefsToCheck[name].firstValue;
let validateValue = prefsToCheck[name].validateValue;
is(firstValue.toSource(), currentValue.toSource(),
"Pref " + name + " should be equal to first value: " + currentValue);
@@ -95,17 +101,17 @@ add_task(function* () {
}
function modifyFrontend(isVerticalSplitter) {
info("Modifying UI elements to the specified new values.");
for (let name in prefsToCheck) {
if ((isVerticalSplitter && name === "networkDetailsHeight") ||
(!isVerticalSplitter && name === "networkDetailsWidth")) {
- continue
+ continue;
}
let currentValue = getPrefs()[name];
let firstValue = prefsToCheck[name].firstValue;
let newValue = prefsToCheck[name].newValue;
let validateValue = prefsToCheck[name].validateValue;
let modFrontend = prefsToCheck[name].modifyFrontend;
@@ -122,17 +128,17 @@ add_task(function* () {
}
function validateNewPrefValues(isVerticalSplitter) {
info("Invalidating old pref values to the modified UI elements.");
for (let name in prefsToCheck) {
if ((isVerticalSplitter && name === "networkDetailsHeight") ||
(!isVerticalSplitter && name === "networkDetailsWidth")) {
- continue
+ continue;
}
let currentValue = getPrefs()[name];
let firstValue = prefsToCheck[name].firstValue;
let newValue = prefsToCheck[name].newValue;
let validateValue = prefsToCheck[name].validateValue;
isnot(firstValue.toSource(), currentValue.toSource(),
@@ -145,17 +151,17 @@ add_task(function* () {
}
function resetFrontend(isVerticalSplitter) {
info("Resetting UI elements to the cached initial pref values.");
for (let name in prefsToCheck) {
if ((isVerticalSplitter && name === "networkDetailsHeight") ||
(!isVerticalSplitter && name === "networkDetailsWidth")) {
- continue
+ continue;
}
let currentValue = getPrefs()[name];
let firstValue = prefsToCheck[name].firstValue;
let newValue = prefsToCheck[name].newValue;
let validateValue = prefsToCheck[name].validateValue;
let modFrontend = prefsToCheck[name].modifyFrontend;
--- a/devtools/client/netmonitor/test/browser_net_reload-markers.js
+++ b/devtools/client/netmonitor/test/browser_net_reload-markers.js
@@ -6,17 +6,17 @@
/**
* Tests if the empty-requests reload button works.
*/
add_task(function* () {
let { monitor } = yield initNetMonitor(SIMPLE_URL);
info("Starting test... ");
- let { document, windowRequire } = monitor.panelWin;
+ let { document } = monitor.panelWin;
let button = document.querySelector(".requests-list-reload-notice-button");
button.click();
let markers = [];
monitor.panelWin.on(EVENTS.TIMELINE_EVENT, (_, marker) => {
markers.push(marker);
});
--- a/devtools/client/netmonitor/test/browser_net_resend.js
+++ b/devtools/client/netmonitor/test/browser_net_resend.js
@@ -69,17 +69,17 @@ add_task(function* () {
let expectedUrl = orig.url + "&" + ADD_QUERY;
is(url, expectedUrl, "menu item is updated to reflect url entered in form");
}
/*
* Test that the New Request form was populated correctly
*/
- function testCustomForm(data) {
+ function* testCustomForm(data) {
yield waitUntil(() => document.querySelector(".custom-request-panel"));
is(document.getElementById("custom-method-value").value, data.method,
"new request form showing correct method");
is(document.getElementById("custom-url-value").value, data.url,
"new request form showing correct url");
let query = document.getElementById("custom-query-value");
--- a/devtools/client/netmonitor/test/browser_net_resend_cors.js
+++ b/devtools/client/netmonitor/test/browser_net_resend_cors.js
@@ -7,20 +7,19 @@
* 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 { document, gStore, windowRequire } = monitor.panelWin;
+ let { gStore, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/actions/index");
let {
- getDisplayedRequests,
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/selectors/index");
gStore.dispatch(Actions.batchEnable(false));
let requestUrl = "http://test1.example.com" + CORS_SJS_PATH;
info("Waiting for OPTIONS, then POST");
@@ -39,17 +38,17 @@ add_task(function* () {
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))
+ gStore.dispatch(Actions.selectRequest(item.id));
info("Cloning the selected request into a custom clone");
gStore.dispatch(Actions.cloneSelectedRequest());
info("Sending the cloned request (without change)");
gStore.dispatch(Actions.sendCustomRequest());
});
--- a/devtools/client/netmonitor/test/browser_net_resend_headers.js
+++ b/devtools/client/netmonitor/test/browser_net_resend_headers.js
@@ -6,20 +6,19 @@
/**
* 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 { document, gStore, windowRequire, NetMonitorController } = monitor.panelWin;
+ let { gStore, windowRequire, NetMonitorController } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/actions/index");
let {
- getDisplayedRequests,
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/selectors/index");
gStore.dispatch(Actions.batchEnable(false));
let requestUrl = SIMPLE_SJS;
let requestHeaders = [
{ name: "Host", value: "fakehost.example.com" },
--- a/devtools/client/netmonitor/test/browser_net_security-details.js
+++ b/devtools/client/netmonitor/test/browser_net_security-details.js
@@ -41,27 +41,28 @@ add_task(function* () {
// The cipher suite used by the test server example.com might change at any
// moment but all of them should start with "TLS_".
// http://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml
let suite = textboxes[1].value;
ok(suite.startsWith("TLS_"), "The suite " + suite + " seems valid.");
// Host
is(tabpanel.querySelectorAll(".treeLabel.objectLabel")[1].textContent,
- "Host example.com:",
- "Label has the expected value.");
+ "Host example.com:",
+ "Label has the expected value.");
is(textboxes[2].value, "Disabled", "Label has the expected value.");
is(textboxes[3].value, "Disabled", "Label has the expected value.");
// Cert
is(textboxes[4].value, "example.com", "Label has the expected value.");
is(textboxes[5].value, "<Not Available>", "Label has the expected value.");
is(textboxes[6].value, "<Not Available>", "Label has the expected value.");
- is(textboxes[7].value, "Temporary Certificate Authority", "Label has the expected value.");
+ is(textboxes[7].value, "Temporary Certificate Authority",
+ "Label has the expected value.");
is(textboxes[8].value, "Mozilla Testing", "Label has the expected value.");
is(textboxes[9].value, "Profile Guided Optimization", "Label has the expected value.");
// Locale sensitive and varies between timezones. Cant't compare equality or
// the test fails depending on which part of the world the test is executed.
// cert validity begins
isnot(textboxes[10].value, "", "Label was not empty.");
--- a/devtools/client/netmonitor/test/browser_net_security-icon-click.js
+++ b/devtools/client/netmonitor/test/browser_net_security-icon-click.js
@@ -6,20 +6,16 @@
/**
* 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 Actions = windowRequire("devtools/client/netmonitor/actions/index");
- let {
- getDisplayedRequests,
- getSortedRequests,
- } = windowRequire("devtools/client/netmonitor/selectors/index");
gStore.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.");
@@ -49,11 +45,12 @@ add_task(function* () {
}
function* clickAndTestSecurityIcon() {
let icon = document.querySelector(".requests-security-state-icon");
info("Clicking security icon of the first request and waiting for panel update.");
EventUtils.synthesizeMouseAtCenter(icon, {}, monitor.panelWin);
- ok(document.querySelector("#security-tab[aria-selected=true]"), "Security tab is selected.");
+ ok(document.querySelector("#security-tab[aria-selected=true]"),
+ "Security tab is selected.");
}
});
--- a/devtools/client/netmonitor/test/browser_net_security-redirect.js
+++ b/devtools/client/netmonitor/test/browser_net_security-redirect.js
@@ -7,36 +7,32 @@
* 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 Actions = windowRequire("devtools/client/netmonitor/actions/index");
- let {
- getDisplayedRequests,
- getSortedRequests,
- } = windowRequire("devtools/client/netmonitor/selectors/index");
gStore.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, "There were two requests due to redirect.");
+ is(gStore.getState().requests.requests.size, 2,
+ "There were two requests due to redirect.");
- let initial = getSortedRequests(gStore.getState()).get(0);
- let redirect = getSortedRequests(gStore.getState()).get(1);
-
- let initialSecurityIcon = document.querySelectorAll(".requests-security-state-icon")[0];
- let redirectSecurityIcon = document.querySelectorAll(".requests-security-state-icon")[1];
+ let [
+ initialSecurityIcon,
+ redirectSecurityIcon,
+ ] = document.querySelectorAll(".requests-security-state-icon");
ok(initialSecurityIcon.classList.contains("security-state-insecure"),
"Initial request was marked insecure.");
ok(redirectSecurityIcon.classList.contains("security-state-secure"),
"Redirected request was marked secure.");
yield teardown(monitor);
--- a/devtools/client/netmonitor/test/browser_net_security-state.js
+++ b/devtools/client/netmonitor/test/browser_net_security-state.js
@@ -14,20 +14,16 @@ add_task(function* () {
"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 Actions = windowRequire("devtools/client/netmonitor/actions/index");
- let {
- getDisplayedRequests,
- getSortedRequests,
- } = windowRequire("devtools/client/netmonitor/selectors/index");
gStore.dispatch(Actions.batchEnable(false));
yield performRequests();
for (let subitemNode of Array.from(document.querySelectorAll(
"requests-list-subitem.requests-list-security-and-domain"))) {
let domain = subitemNode.querySelector(".requests-list-domain").textContent;
--- a/devtools/client/netmonitor/test/browser_net_security-tab-visibility.js
+++ b/devtools/client/netmonitor/test/browser_net_security-tab-visibility.js
@@ -29,17 +29,19 @@ add_task(function* () {
visibleOnSecurityInfo: true,
visibleOnceComplete: true,
}
];
let { tab, monitor } = yield initNetMonitor(CUSTOM_GET_URL);
let { document, gStore, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/actions/index");
- let { getSelectedRequest } = windowRequire("devtools/client/netmonitor/selectors/index");
+ let {
+ getSelectedRequest,
+ } = windowRequire("devtools/client/netmonitor/selectors/index");
gStore.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 ?
--- a/devtools/client/netmonitor/test/browser_net_send-beacon.js
+++ b/devtools/client/netmonitor/test/browser_net_send-beacon.js
@@ -4,17 +4,17 @@
"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 { gStore, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/actions/index");
let { getSortedRequests } = windowRequire("devtools/client/netmonitor/selectors/index");
gStore.dispatch(Actions.batchEnable(false));
is(gStore.getState().requests.requests.size, 0, "The requests menu should be empty.");
let wait = waitForNetworkEvents(monitor, 1);
--- a/devtools/client/netmonitor/test/browser_net_simple-request-data.js
+++ b/devtools/client/netmonitor/test/browser_net_simple-request-data.js
@@ -218,22 +218,25 @@ function test() {
);
});
monitor.panelWin.once(EVENTS.RECEIVED_RESPONSE_CONTENT, () => {
let requestItem = getSortedRequests(gStore.getState()).get(0);
ok(requestItem.responseContent,
"There should be a responseContent data available.");
+ // eslint-disable-next-line mozilla/no-cpows-in-tests
is(requestItem.responseContent.content.mimeType,
"text/plain; charset=utf-8",
"The responseContent data has an incorrect |content.mimeType| property.");
+ // eslint-disable-next-line mozilla/no-cpows-in-tests
is(requestItem.responseContent.content.text,
"Hello world!",
"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()),
requestItem,
--- a/devtools/client/netmonitor/test/browser_net_simple-request-details.js
+++ b/devtools/client/netmonitor/test/browser_net_simple-request-details.js
@@ -8,23 +8,24 @@
*/
add_task(function* () {
let { L10N } = require("devtools/client/netmonitor/utils/l10n");
let { tab, monitor } = yield initNetMonitor(SIMPLE_SJS);
info("Starting test... ");
- let { document, gStore, windowRequire } = monitor.panelWin;
+ let { document, gStore, windowRequire, NetMonitorView } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/actions/index");
let { EVENTS } = windowRequire("devtools/client/netmonitor/constants");
let {
- getDisplayedRequests,
+ getSelectedRequest,
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/selectors/index");
+ let Editor = require("devtools/client/sourceeditor/editor");
gStore.dispatch(Actions.batchEnable(false));
let wait = waitForNetworkEvents(monitor, 1);
tab.linkedBrowser.reload();
yield wait;
is(getSelectedRequest(gStore.getState()), undefined,
--- a/devtools/client/netmonitor/test/browser_net_simple-request.js
+++ b/devtools/client/netmonitor/test/browser_net_simple-request.js
@@ -13,21 +13,16 @@
* 4) Number of requests displayed
*/
add_task(function* () {
let { tab, monitor } = yield initNetMonitor(SIMPLE_URL);
info("Starting test... ");
let { document, gStore, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/actions/index");
- let { EVENTS } = windowRequire("devtools/client/netmonitor/constants");
- let {
- getDisplayedRequests,
- getSortedRequests,
- } = windowRequire("devtools/client/netmonitor/selectors/index");
gStore.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.");
--- a/devtools/client/netmonitor/test/browser_net_statistics-01.js
+++ b/devtools/client/netmonitor/test/browser_net_statistics-01.js
@@ -22,27 +22,31 @@ add_task(function* () {
gStore.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]").length == 2);
+ () => document.querySelectorAll(".pie-chart-container[placeholder=true]")
+ .length == 2);
ok(true, "Two placeholder pie charts appear to be rendered correctly.");
yield waitUntil(
- () => document.querySelectorAll(".table-chart-container[placeholder=true]").length == 2);
+ () => document.querySelectorAll(".table-chart-container[placeholder=true]")
+ .length == 2);
ok(true, "Two placeholde table charts appear to be rendered correctly.");
info("Waiting for chart to display");
yield waitUntil(
- () => document.querySelectorAll(".pie-chart-container:not([placeholder=true])").length == 2);
+ () => document.querySelectorAll(".pie-chart-container:not([placeholder=true])")
+ .length == 2);
ok(true, "Two real pie charts appear to be rendered correctly.");
yield waitUntil(
- () => document.querySelectorAll(".table-chart-container:not([placeholder=true])").length == 2);
+ () => document.querySelectorAll(".table-chart-container:not([placeholder=true])")
+ .length == 2);
ok(true, "Two real table charts appear to be rendered correctly.");
yield teardown(monitor);
});
--- a/devtools/client/netmonitor/test/browser_net_statistics-02.js
+++ b/devtools/client/netmonitor/test/browser_net_statistics-02.js
@@ -30,17 +30,18 @@ add_task(function* () {
info("The correct filtering predicates are used before entering perf. analysis mode.");
gStore.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);
+ () => document.querySelectorAll(".pie-chart-container:not([placeholder=true])")
+ .length == 2);
ok(true, "Two real pie charts appear to be rendered correctly.");
EventUtils.sendMouseEvent({ type: "click" },
document.querySelector(".pie-chart-slice"));
ok(document.querySelector(".monitor-panel"),
"The main panel is switched back to the monitor panel.");
--- a/devtools/client/netmonitor/test/browser_net_throttle.js
+++ b/devtools/client/netmonitor/test/browser_net_throttle.js
@@ -9,18 +9,17 @@ add_task(function* () {
yield throttleTest(true);
yield throttleTest(false);
});
function* throttleTest(actuallyThrottle) {
requestLongerTimeout(2);
let { monitor } = yield initNetMonitor(SIMPLE_URL);
- let { document, gStore, windowRequire, NetMonitorController } = monitor.panelWin;
- let Actions = windowRequire("devtools/client/netmonitor/actions/index");
+ let { gStore, windowRequire, NetMonitorController } = monitor.panelWin;
let { ACTIVITY_TYPE } = windowRequire("devtools/client/netmonitor/constants");
let { EVENTS } = windowRequire("devtools/client/netmonitor/constants");
let {
getSortedRequests,
} = windowRequire("devtools/client/netmonitor/selectors/index");
info("Starting test... (actuallyThrottle = " + actuallyThrottle + ")");
--- a/devtools/client/netmonitor/test/browser_net_timing-division.js
+++ b/devtools/client/netmonitor/test/browser_net_timing-division.js
@@ -34,25 +34,26 @@ 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, "There should be only two requests made.");
+ is(gStore.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);
info("First request happened at: " +
- firstRequest.responseHeaders.headers.find(e => e.name == "Date").value);
+ firstRequest.responseHeaders.headers.find(e => e.name == "Date").value);
info("Last request happened at: " +
- lastRequest.responseHeaders.headers.find(e => e.name == "Date").value);
+ lastRequest.responseHeaders.headers.find(e => e.name == "Date").value);
ok(secDivs.length,
- "There should be at least one division on the seconds time scale.");
+ "There should be at least one division on the seconds time scale.");
ok(secDivs[0].textContent.match(/\d+\.\d{2}\s\w+/),
- "The division on the seconds time scale looks legit.");
+ "The division on the seconds time scale looks legit.");
return teardown(monitor);
});
--- a/devtools/client/netmonitor/test/head.js
+++ b/devtools/client/netmonitor/test/head.js
@@ -1,29 +1,33 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/* import-globals-from ../../framework/test/shared-head.js */
+/* exported Toolbox, restartNetMonitor, teardown, waitForExplicitFinish,
+ verifyRequestItemTarget, waitFor, testFilterButtons, loadCommonFrameScript,
+ performRequestsInContent, waitForNetworkEvents */
"use strict";
// shared-head.js handles imports, constants, and utility functions
Services.scriptloader.loadSubScript(
"chrome://mochitests/content/browser/devtools/client/framework/test/shared-head.js",
this);
const { EVENTS } = require("devtools/client/netmonitor/constants");
-var { Toolbox } = require("devtools/client/framework/toolbox");
+let { Toolbox } = require("devtools/client/framework/toolbox");
const {
decodeUnicodeUrl,
getUrlBaseName,
getUrlQuery,
getUrlHost,
} = require("devtools/client/netmonitor/utils/request-utils");
+/* eslint-disable no-unused-vars, max-len */
const EXAMPLE_URL = "http://example.com/browser/devtools/client/netmonitor/test/";
const HTTPS_EXAMPLE_URL = "https://example.com/browser/devtools/client/netmonitor/test/";
const API_CALLS_URL = EXAMPLE_URL + "html_api-calls-test-page.html";
const SIMPLE_URL = EXAMPLE_URL + "html_simple-test-page.html";
const NAVIGATE_URL = EXAMPLE_URL + "html_navigate-test-page.html";
const CONTENT_TYPE_URL = EXAMPLE_URL + "html_content-type-test-page.html";
const CONTENT_TYPE_WITHOUT_CACHE_URL = EXAMPLE_URL + "html_content-type-without-cache-test-page.html";
@@ -64,16 +68,17 @@ const HSTS_SJS = EXAMPLE_URL + "sjs_hsts
const HSTS_BASE_URL = EXAMPLE_URL;
const HSTS_PAGE_URL = CUSTOM_GET_URL;
const TEST_IMAGE = EXAMPLE_URL + "test-image.png";
const TEST_IMAGE_DATA_URI = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAHWSURBVHjaYvz//z8DJQAggJiQOe/fv2fv7Oz8rays/N+VkfG/iYnJfyD/1+rVq7ffu3dPFpsBAAHEAHIBCJ85c8bN2Nj4vwsDw/8zQLwKiO8CcRoQu0DxqlWrdsHUwzBAAIGJmTNnPgYa9j8UqhFElwPxf2MIDeIrKSn9FwSJoRkAEEAM0DD4DzMAyPi/G+QKY4hh5WAXGf8PDQ0FGwJ22d27CjADAAIIrLmjo+MXA9R2kAHvGBA2wwx6B8W7od6CeQcggKCmCEL8bgwxYCbUIGTDVkHDBia+CuotgACCueD3TDQN75D4xmAvCoK9ARMHBzAw0AECiBHkAlC0Mdy7x9ABNA3obAZXIAa6iKEcGlMVQHwWyjYuL2d4v2cPg8vZswx7gHyAAAK7AOif7SAbOqCmn4Ha3AHFsIDtgPq/vLz8P4MSkJ2W9h8ggBjevXvHDo4FQUQg/kdypqCg4H8lUIACnQ/SOBMYI8bAsAJFPcj1AAEEjwVQqLpAbXmH5BJjqI0gi9DTAAgDBBCcAVLkgmQ7yKCZxpCQxqUZhAECCJ4XgMl493ug21ZD+aDAXH0WLM4A9MZPXJkJIIAwTAR5pQMalaCABQUULttBGCCAGCnNzgABBgAMJ5THwGvJLAAAAABJRU5ErkJggg==";
const FRAME_SCRIPT_UTILS_URL = "chrome://devtools/content/shared/frame-script-utils.js";
+/* eslint-enable no-unused-vars, max-len */
// All tests are asynchronous.
waitForExplicitFinish();
const gEnableLogging = Services.prefs.getBoolPref("devtools.debugger.log");
// To enable logging for try runs, just set the pref to true.
Services.prefs.setBoolPref("devtools.debugger.log", false);
@@ -86,55 +91,55 @@ const gDefaultFilters = Services.prefs.g
registerCleanupFunction(() => {
info("finish() was called, cleaning up...");
Services.prefs.setBoolPref("devtools.debugger.log", gEnableLogging);
Services.prefs.setCharPref("devtools.netmonitor.filters", gDefaultFilters);
Services.prefs.clearUserPref("devtools.cache.disabled");
});
-function waitForNavigation(aTarget) {
+function waitForNavigation(target) {
let deferred = promise.defer();
- aTarget.once("will-navigate", () => {
- aTarget.once("navigate", () => {
+ target.once("will-navigate", () => {
+ target.once("navigate", () => {
deferred.resolve();
});
});
return deferred.promise;
}
-function reconfigureTab(aTarget, aOptions) {
+function reconfigureTab(target, options) {
let deferred = promise.defer();
- aTarget.activeTab.reconfigure(aOptions, deferred.resolve);
+ target.activeTab.reconfigure(options, deferred.resolve);
return deferred.promise;
}
-function toggleCache(aTarget, aDisabled) {
- let options = { cacheDisabled: aDisabled, performReload: true };
- let navigationFinished = waitForNavigation(aTarget);
+function toggleCache(target, disabled) {
+ let options = { cacheDisabled: disabled, performReload: true };
+ let navigationFinished = waitForNavigation(target);
// Disable the cache for any toolbox that it is opened from this point on.
- Services.prefs.setBoolPref("devtools.cache.disabled", aDisabled);
+ Services.prefs.setBoolPref("devtools.cache.disabled", disabled);
- return reconfigureTab(aTarget, options).then(() => navigationFinished);
+ return reconfigureTab(target, options).then(() => navigationFinished);
}
-function initNetMonitor(aUrl, aWindow, aEnableCache) {
+function initNetMonitor(url, window, enableCache) {
info("Initializing a network monitor pane.");
return Task.spawn(function* () {
- let tab = yield addTab(aUrl);
- info("Net tab added successfully: " + aUrl);
+ let tab = yield addTab(url);
+ info("Net tab added successfully: " + url);
let target = TargetFactory.forTab(tab);
yield target.makeRemote();
info("Target remoted.");
- if (!aEnableCache) {
+ if (!enableCache) {
info("Disabling cache and reloading page.");
yield toggleCache(target, true);
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.");
target.activeConsole.clearNetworkRequests();
@@ -170,19 +175,19 @@ function teardown(monitor) {
let tab = monitor.toolbox.target.tab;
let onDestroyed = monitor.once("destroyed");
yield removeTab(tab);
yield onDestroyed;
});
}
-function waitForNetworkEvents(aMonitor, aGetRequests, aPostRequests = 0) {
+function waitForNetworkEvents(monitor, getRequests, postRequests = 0) {
let deferred = promise.defer();
- let panel = aMonitor.panelWin;
+ let panel = monitor.panelWin;
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],
@@ -195,19 +200,23 @@ function waitForNetworkEvents(aMonitor,
["STARTED_RECEIVING_RESPONSE", onGenericEvent],
["UPDATING_RESPONSE_CONTENT", onGenericEvent],
["RECEIVED_RESPONSE_CONTENT", onGenericEvent],
["UPDATING_EVENT_TIMINGS", onGenericEvent],
["RECEIVED_EVENT_TIMINGS", onGenericEvent]
];
function initProgressForURL(url) {
- if (progress[url]) return;
+ if (progress[url]) {
+ return;
+ }
progress[url] = {};
- awaitedEventsToListeners.forEach(([e]) => progress[url][e] = 0);
+ awaitedEventsToListeners.forEach(function ([e]) {
+ progress[url][e] = 0;
+ });
}
function updateProgressForURL(url, event) {
initProgressForURL(url);
progress[url][Object.keys(EVENTS).find(e => EVENTS[e] == event)] = 1;
}
function onGenericEvent(event, actor) {
@@ -217,137 +226,141 @@ function waitForNetworkEvents(aMonitor,
function onPostEvent(event, actor) {
postEvents++;
maybeResolve(event, actor);
}
function maybeResolve(event, actor) {
info("> Network events progress: " +
- genericEvents + "/" + ((aGetRequests + aPostRequests) * 13) + ", " +
- postEvents + "/" + (aPostRequests * 2) + ", " +
+ genericEvents + "/" + ((getRequests + postRequests) * 13) + ", " +
+ postEvents + "/" + (postRequests * 2) + ", " +
"got " + event + " for " + actor);
let networkInfo =
panel.NetMonitorController.webConsoleClient.getNetworkRequest(actor);
let url = networkInfo.request.url;
updateProgressForURL(url, event);
// Uncomment this to get a detailed progress logging (when debugging a test)
// info("> Current state: " + JSON.stringify(progress, null, 2));
// There are 15 updates which need to be fired for a request to be
// considered finished. The "requestPostData" packet isn't fired for
// non-POST requests.
- if (genericEvents >= (aGetRequests + aPostRequests) * 13 &&
- postEvents >= aPostRequests * 2) {
-
+ if (genericEvents >= (getRequests + postRequests) * 13 &&
+ postEvents >= postRequests * 2) {
awaitedEventsToListeners.forEach(([e, l]) => panel.off(EVENTS[e], l));
executeSoon(deferred.resolve);
}
}
awaitedEventsToListeners.forEach(([e, l]) => panel.on(EVENTS[e], l));
return deferred.promise;
}
-function verifyRequestItemTarget(document, requestList, requestItem, aMethod,
- aUrl, aData = {}) {
- info("> Verifying: " + aMethod + " " + aUrl + " " + aData.toSource());
+function verifyRequestItemTarget(document, requestList, requestItem, method,
+ url, data = {}) {
+ info("> Verifying: " + method + " " + url + " " + data.toSource());
let visibleIndex = requestList.indexOf(requestItem);
info("Visible index of item: " + visibleIndex);
let { fuzzyUrl, status, statusText, cause, type, fullMimeType,
- transferred, size, time, displayedStatus } = aData;
+ transferred, size, time, displayedStatus } = data;
let target = document.querySelectorAll(".request-list-item")[visibleIndex];
- let unicodeUrl = decodeUnicodeUrl(aUrl);
- let name = getUrlBaseName(aUrl);
- let query = getUrlQuery(aUrl);
- let hostPort = getUrlHost(aUrl);
+ let unicodeUrl = decodeUnicodeUrl(url);
+ let name = getUrlBaseName(url);
+ let query = getUrlQuery(url);
+ let hostPort = getUrlHost(url);
let remoteAddress = requestItem.remoteAddress;
if (fuzzyUrl) {
- ok(requestItem.method.startsWith(aMethod), "The attached method is correct.");
- ok(requestItem.url.startsWith(aUrl), "The attached url is correct.");
+ ok(requestItem.method.startsWith(method), "The attached method is correct.");
+ ok(requestItem.url.startsWith(url), "The attached url is correct.");
} else {
- is(requestItem.method, aMethod, "The attached method is correct.");
- is(requestItem.url, aUrl, "The attached url is correct.");
+ is(requestItem.method, method, "The attached method is correct.");
+ is(requestItem.url, url, "The attached url is correct.");
}
is(target.querySelector(".requests-list-method").textContent,
- aMethod, "The displayed method is correct.");
+ method, "The displayed method is correct.");
if (fuzzyUrl) {
ok(target.querySelector(".requests-list-file").textContent.startsWith(
name + (query ? "?" + query : "")), "The displayed file is correct.");
- ok(target.querySelector(".requests-list-file").getAttribute("title").startsWith(unicodeUrl),
+ ok(target.querySelector(".requests-list-file").getAttribute("title")
+ .startsWith(unicodeUrl),
"The tooltip file is correct.");
} else {
is(target.querySelector(".requests-list-file").textContent,
name + (query ? "?" + query : ""), "The displayed file is correct.");
is(target.querySelector(".requests-list-file").getAttribute("title"),
unicodeUrl, "The tooltip file is correct.");
}
is(target.querySelector(".requests-list-domain").textContent,
hostPort, "The displayed domain is correct.");
let domainTooltip = hostPort + (remoteAddress ? " (" + remoteAddress + ")" : "");
is(target.querySelector(".requests-list-domain").getAttribute("title"),
domainTooltip, "The tooltip domain is correct.");
if (status !== undefined) {
- let value = target.querySelector(".requests-list-status-icon").getAttribute("data-code");
+ let value = target.querySelector(".requests-list-status-icon")
+ .getAttribute("data-code");
let codeValue = target.querySelector(".requests-list-status-code").textContent;
let tooltip = target.querySelector(".requests-list-status").getAttribute("title");
info("Displayed status: " + value);
info("Displayed code: " + codeValue);
info("Tooltip status: " + tooltip);
- is(value, displayedStatus ? displayedStatus : status, "The displayed status is correct.");
+ is(value, displayedStatus ? displayedStatus : status,
+ "The displayed status is correct.");
is(codeValue, status, "The displayed status code is correct.");
is(tooltip, status + " " + statusText, "The tooltip status is correct.");
}
if (cause !== undefined) {
let value = target.querySelector(".requests-list-cause > .subitem-label").textContent;
let tooltip = target.querySelector(".requests-list-cause").getAttribute("title");
info("Displayed cause: " + value);
info("Tooltip cause: " + tooltip);
is(value, cause.type, "The displayed cause is correct.");
- is(tooltip, cause.loadingDocumentUri, "The tooltip cause is correct.")
+ is(tooltip, cause.loadingDocumentUri, "The tooltip cause is correct.");
}
if (type !== undefined) {
let value = target.querySelector(".requests-list-type").textContent;
let tooltip = target.querySelector(".requests-list-type").getAttribute("title");
info("Displayed type: " + value);
info("Tooltip type: " + tooltip);
is(value, type, "The displayed type is correct.");
is(tooltip, fullMimeType, "The tooltip type is correct.");
}
if (transferred !== undefined) {
let value = target.querySelector(".requests-list-transferred").textContent;
- let tooltip = target.querySelector(".requests-list-transferred").getAttribute("title");
+ let tooltip = target.querySelector(".requests-list-transferred")
+ .getAttribute("title");
info("Displayed transferred size: " + value);
info("Tooltip transferred size: " + tooltip);
is(value, transferred, "The displayed transferred size is correct.");
is(tooltip, transferred, "The tooltip transferred size is correct.");
}
if (size !== undefined) {
let value = target.querySelector(".requests-list-size").textContent;
let tooltip = target.querySelector(".requests-list-size").getAttribute("title");
info("Displayed size: " + value);
info("Tooltip size: " + tooltip);
is(value, size, "The displayed size is correct.");
is(tooltip, size, "The tooltip size is correct.");
}
if (time !== undefined) {
let value = target.querySelector(".requests-list-timings-total").textContent;
- let tooltip = target.querySelector(".requests-list-timings-total").getAttribute("title");
+ let tooltip = target.querySelector(".requests-list-timings-total")
+ .getAttribute("title");
info("Displayed time: " + value);
info("Tooltip time: " + tooltip);
ok(~~(value.match(/[0-9]+/)) >= 0, "The displayed time is correct.");
ok(~~(tooltip.match(/[0-9]+/)) >= 0, "The tooltip time is correct.");
}
if (visibleIndex !== -1) {
if (visibleIndex % 2 === 0) {
@@ -398,22 +411,22 @@ function testFilterButtons(monitor, filt
/**
* Tests if filter buttons have 'checked' attributes set correctly.
*
* @param array aIsChecked
* An array specifying if a button at given index should have a
* 'checked' attribute. For example, if the third item of the array
* evaluates to true, the third button should be checked.
*/
-function testFilterButtonsCustom(aMonitor, aIsChecked) {
- let doc = aMonitor.panelWin.document;
+function testFilterButtonsCustom(monitor, isChecked) {
+ let doc = monitor.panelWin.document;
let buttons = doc.querySelectorAll("#requests-list-filter-buttons button");
- for (let i = 0; i < aIsChecked.length; i++) {
+ for (let i = 0; i < isChecked.length; i++) {
let button = buttons[i];
- if (aIsChecked[i]) {
+ if (isChecked[i]) {
is(button.classList.contains("checked"), true,
"The " + button.id + " button should have a 'checked' class.");
is(button.getAttribute("aria-pressed"), "true",
"The " + button.id + " button should set 'aria-pressed' = true.");
} else {
is(button.classList.contains("checked"), false,
"The " + button.id + " button should not have a 'checked' class.");
is(button.getAttribute("aria-pressed"), "false",
@@ -468,19 +481,18 @@ function performRequestsInContent(reques
* resolves otherwise
*/
function executeInContent(name, data = {}, objects = {}, expectResponse = true) {
let mm = gBrowser.selectedBrowser.messageManager;
mm.sendAsyncMessage(name, data, objects);
if (expectResponse) {
return waitForContentMessage(name);
- } else {
- return promise.resolve();
}
+ return promise.resolve();
}
/**
* Wait for a content -> chrome message on the message manager (the window
* messagemanager is used).
* @param {String} name The message name
* @return {Promise} A promise that resolves to the response data when the
* message has been received
--- a/devtools/client/netmonitor/test/html_api-calls-test-page.html
+++ b/devtools/client/netmonitor/test/html_api-calls-test-page.html
@@ -10,37 +10,42 @@
<meta http-equiv="Expires" content="0" />
<title>Network Monitor test page</title>
</head>
<body>
<p>API calls request test</p>
<script type="text/javascript">
- function get(aAddress, aCallback) {
- var xhr = new XMLHttpRequest();
- xhr.open("GET", aAddress, true);
+ /* exported performRequests */
+ "use strict";
- xhr.onreadystatechange = function() {
+ function get(address, callback) {
+ let xhr = new XMLHttpRequest();
+ xhr.open("GET", address, true);
+
+ xhr.onreadystatechange = function () {
if (this.readyState == this.DONE) {
- aCallback();
+ callback();
}
};
xhr.send();
}
function performRequests() {
- get("/api/fileName.xml", function() {
- get("/api/file%E2%98%A2.xml", function() {
- get("/api/ascii/get/", function() {
- get("/api/unicode/%E2%98%A2/", function() {
- get("/api/search/?q=search%E2%98%A2", function() {
+ /* eslint-disable max-nested-callbacks */
+ get("/api/fileName.xml", function () {
+ get("/api/file%E2%98%A2.xml", function () {
+ get("/api/ascii/get/", function () {
+ get("/api/unicode/%E2%98%A2/", function () {
+ get("/api/search/?q=search%E2%98%A2", function () {
// Done.
});
});
});
});
});
+ /* eslint-enable max-nested-callbacks */
}
</script>
</body>
</html>
--- a/devtools/client/netmonitor/test/html_brotli-test-page.html
+++ b/devtools/client/netmonitor/test/html_brotli-test-page.html
@@ -10,29 +10,32 @@
<meta http-equiv="Expires" content="0" />
<title>Network Monitor test page</title>
</head>
<body>
<p>Brotli test</p>
<script type="text/javascript">
- function get(aAddress, aCallback) {
- var xhr = new XMLHttpRequest();
- xhr.open("GET", aAddress, true);
+ /* exported performRequests */
+ "use strict";
- xhr.onreadystatechange = function() {
+ function get(address, callback) {
+ let xhr = new XMLHttpRequest();
+ xhr.open("GET", address, true);
+
+ xhr.onreadystatechange = function () {
if (this.readyState == this.DONE) {
- aCallback();
+ callback();
}
};
xhr.send(null);
}
function performRequests() {
- get("sjs_content-type-test-server.sjs?fmt=br", function() {
+ get("sjs_content-type-test-server.sjs?fmt=br", function () {
// Done.
});
}
</script>
</body>
</html>
--- a/devtools/client/netmonitor/test/html_cause-test-page.html
+++ b/devtools/client/netmonitor/test/html_cause-test-page.html
@@ -11,18 +11,20 @@
<title>Network Monitor test page</title>
<link rel="stylesheet" type="text/css" href="stylesheet_request" />
</head>
<body>
<p>Request cause test</p>
<img src="img_request" />
<script type="text/javascript">
+ "use strict";
+
function performXhrRequest() {
- var xhr = new XMLHttpRequest();
+ let xhr = new XMLHttpRequest();
xhr.open("GET", "xhr_request", true);
xhr.send();
}
function performFetchRequest() {
fetch("fetch_request");
}
--- a/devtools/client/netmonitor/test/html_content-type-test-page.html
+++ b/devtools/client/netmonitor/test/html_content-type-test-page.html
@@ -10,39 +10,44 @@
<meta http-equiv="Expires" content="0" />
<title>Network Monitor test page</title>
</head>
<body>
<p>Content type test</p>
<script type="text/javascript">
- function get(aAddress, aCallback) {
- var xhr = new XMLHttpRequest();
- xhr.open("GET", aAddress, true);
+ /* exported performRequests */
+ "use strict";
- xhr.onreadystatechange = function() {
+ function get(address, callback) {
+ let xhr = new XMLHttpRequest();
+ xhr.open("GET", address, true);
+
+ xhr.onreadystatechange = function () {
if (this.readyState == this.DONE) {
- aCallback();
+ callback();
}
};
xhr.send(null);
}
function performRequests() {
- get("sjs_content-type-test-server.sjs?fmt=xml", function() {
- get("sjs_content-type-test-server.sjs?fmt=css", function() {
- get("sjs_content-type-test-server.sjs?fmt=js", function() {
- get("sjs_content-type-test-server.sjs?fmt=json", function() {
- get("sjs_content-type-test-server.sjs?fmt=bogus", function() {
- get("test-image.png", function() {
+ /* eslint-disable max-nested-callbacks */
+ get("sjs_content-type-test-server.sjs?fmt=xml", function () {
+ get("sjs_content-type-test-server.sjs?fmt=css", function () {
+ get("sjs_content-type-test-server.sjs?fmt=js", function () {
+ get("sjs_content-type-test-server.sjs?fmt=json", function () {
+ get("sjs_content-type-test-server.sjs?fmt=bogus", function () {
+ get("test-image.png", function () {
// Done.
});
});
});
});
});
});
+ /* eslint-enable max-nested-callbacks */
}
</script>
</body>
</html>
--- a/devtools/client/netmonitor/test/html_content-type-without-cache-test-page.html
+++ b/devtools/client/netmonitor/test/html_content-type-without-cache-test-page.html
@@ -10,43 +10,48 @@
<meta http-equiv="Expires" content="0" />
<title>Network Monitor test page</title>
</head>
<body>
<p>Content type test</p>
<script type="text/javascript">
- function get(aAddress, aCallback) {
- var xhr = new XMLHttpRequest();
- xhr.open("GET", aAddress, true);
+ /* exported performRequests */
+ "use strict";
- xhr.onreadystatechange = function() {
+ function get(address, callback) {
+ let xhr = new XMLHttpRequest();
+ xhr.open("GET", address, true);
+
+ xhr.onreadystatechange = function () {
if (this.readyState == this.DONE) {
- aCallback();
+ callback();
}
};
xhr.send(null);
}
function performRequests() {
- get("sjs_content-type-test-server.sjs?fmt=xml", function() {
- get("sjs_content-type-test-server.sjs?fmt=css", function() {
- get("sjs_content-type-test-server.sjs?fmt=js", function() {
- get("sjs_content-type-test-server.sjs?fmt=json", function() {
- get("sjs_content-type-test-server.sjs?fmt=bogus", function() {
- get("test-image.png?v=" + Math.random(), function() {
- get("sjs_content-type-test-server.sjs?fmt=gzip", function() {
- get("sjs_content-type-test-server.sjs?fmt=br", function() {
+ /* eslint-disable max-nested-callbacks */
+ get("sjs_content-type-test-server.sjs?fmt=xml", function () {
+ get("sjs_content-type-test-server.sjs?fmt=css", function () {
+ get("sjs_content-type-test-server.sjs?fmt=js", function () {
+ get("sjs_content-type-test-server.sjs?fmt=json", function () {
+ get("sjs_content-type-test-server.sjs?fmt=bogus", function () {
+ get("test-image.png?v=" + Math.random(), function () {
+ get("sjs_content-type-test-server.sjs?fmt=gzip", function () {
+ get("sjs_content-type-test-server.sjs?fmt=br", function () {
// Done.
});
});
});
});
});
});
});
});
+ /* eslint-enable max-nested-callbacks */
}
</script>
</body>
</html>
--- a/devtools/client/netmonitor/test/html_copy-as-curl.html
+++ b/devtools/client/netmonitor/test/html_copy-as-curl.html
@@ -10,19 +10,22 @@
<meta http-equiv="Expires" content="0" />
<title>Network Monitor test page</title>
</head>
<body>
<p>Performing a GET request</p>
<script type="text/javascript">
- function performRequest(aUrl) {
- var xhr = new XMLHttpRequest();
- xhr.open("GET", aUrl, true);
+ /* exported performRequest */
+ "use strict";
+
+ function performRequest(url) {
+ let xhr = new XMLHttpRequest();
+ xhr.open("GET", url, true);
xhr.setRequestHeader("Accept-Language", window.navigator.language);
xhr.setRequestHeader("X-Custom-Header-1", "Custom value");
xhr.setRequestHeader("X-Custom-Header-2", "8.8.8.8");
xhr.setRequestHeader("X-Custom-Header-3", "Mon, 3 Mar 2014 11:11:11 GMT");
xhr.send(null);
}
</script>
</body>
--- a/devtools/client/netmonitor/test/html_cors-test-page.html
+++ b/devtools/client/netmonitor/test/html_cors-test-page.html
@@ -10,18 +10,21 @@
<meta http-equiv="Expires" content="0" />
<title>Network Monitor test page</title>
</head>
<body>
<p>POST with CORS test page</p>
<script type="text/javascript">
+ /* exported performRequests */
+ "use strict";
+
function post(url, contentType, postData) {
- var xhr = new XMLHttpRequest();
+ let xhr = new XMLHttpRequest();
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", contentType);
xhr.send(postData);
}
function performRequests(url, contentType, postData) {
post(url, contentType, postData);
}
--- a/devtools/client/netmonitor/test/html_curl-utils.html
+++ b/devtools/client/netmonitor/test/html_curl-utils.html
@@ -24,76 +24,78 @@
<input type="text" name="param1" value="value1"/>
<input type="text" name="param2" value="value2"/>
<input type="text" name="param3" value="value3"/>
<input type="submit"/>
</form>
<iframe name="target"></iframe>
<script type="text/javascript">
+ /* exported performRequests */
+ "use strict";
- function ajaxGet(aUrl, aCallback) {
- var xhr = new XMLHttpRequest();
- xhr.open("GET", aUrl + "?param1=value1¶m2=value2¶m3=value3", true);
+ function ajaxGet(url, callback) {
+ let xhr = new XMLHttpRequest();
+ xhr.open("GET", url + "?param1=value1¶m2=value2¶m3=value3", true);
xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
- xhr.onload = function() {
- aCallback();
+ xhr.onload = function () {
+ callback();
};
xhr.send();
}
- function ajaxPost(aUrl, aCallback) {
- var xhr = new XMLHttpRequest();
- xhr.open("POST", aUrl, true);
+ function ajaxPost(url, callback) {
+ let xhr = new XMLHttpRequest();
+ xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
- xhr.onload = function() {
- aCallback();
+ xhr.onload = function () {
+ callback();
};
- var params = "param1=value1¶m2=value2¶m3=value3";
+ const params = "param1=value1¶m2=value2¶m3=value3";
xhr.send(params);
}
- function ajaxMultipart(aUrl, aCallback) {
- var xhr = new XMLHttpRequest();
- xhr.open("POST", aUrl, true);
+ function ajaxMultipart(url, callback) {
+ let xhr = new XMLHttpRequest();
+ xhr.open("POST", url, true);
xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
- xhr.onload = function() {
- aCallback();
+ xhr.onload = function () {
+ callback();
};
getCanvasElem().toBlob((blob) => {
- var formData = new FormData();
+ let formData = new FormData();
formData.append("param1", "value1");
formData.append("file", blob, "filename.png");
xhr.send(formData);
});
}
function submitForm() {
- var form = document.querySelector("#post-form");
+ let form = document.querySelector("#post-form");
form.submit();
}
function getCanvasElem() {
return document.querySelector("canvas");
}
function initCanvas() {
- var canvas = getCanvasElem();
- var ctx = canvas.getContext("2d");
- ctx.fillRect(0,0,100,100);
- ctx.clearRect(20,20,60,60);
- ctx.strokeRect(25,25,50,50);
+ let canvas = getCanvasElem();
+ let ctx = canvas.getContext("2d");
+ ctx.fillRect(0, 0, 100, 100);
+ ctx.clearRect(20, 20, 60, 60);
+ ctx.strokeRect(25, 25, 50, 50);
}
- function performRequests(aUrl) {
- ajaxGet(aUrl, () => {
- ajaxPost(aUrl, () => {
- ajaxMultipart(aUrl, () => {
+ function performRequests(url) {
+ ajaxGet(url, () => {
+ ajaxPost(url, () => {
+ ajaxMultipart(url, () => {
submitForm();
});
});
});
}
initCanvas();
</script>
--- a/devtools/client/netmonitor/test/html_custom-get-page.html
+++ b/devtools/client/netmonitor/test/html_custom-get-page.html
@@ -10,35 +10,38 @@
<meta http-equiv="Expires" content="0" />
<title>Network Monitor test page</title>
</head>
<body>
<p>Performing a custom number of GETs</p>
<script type="text/javascript">
- function get(aAddress, aCallback) {
- var xhr = new XMLHttpRequest();
- xhr.open("GET", aAddress, true);
+ /* exported performRequests */
+ "use strict";
- xhr.onreadystatechange = function() {
+ function get(address, callback) {
+ let xhr = new XMLHttpRequest();
+ xhr.open("GET", address, true);
+
+ xhr.onreadystatechange = function () {
if (this.readyState == this.DONE) {
- aCallback();
+ callback();
}
};
xhr.send(null);
}
// Use a count parameter to defeat caching.
- var count = 0;
+ let count = 0;
- function performRequests(aTotal, aUrl, aTimeout = 0) {
- if (!aTotal) {
+ function performRequests(total, url, timeout = 0) {
+ if (!total) {
return;
}
- get(aUrl || "request_" + (count++), function() {
- setTimeout(performRequests.bind(this, --aTotal, aUrl, aTimeout), aTimeout);
+ get(url || "request_" + (count++), function () {
+ setTimeout(performRequests.bind(this, --total, url, timeout), timeout);
});
}
</script>
</body>
</html>
--- a/devtools/client/netmonitor/test/html_cyrillic-test-page.html
+++ b/devtools/client/netmonitor/test/html_cyrillic-test-page.html
@@ -11,29 +11,32 @@
<title>Network Monitor test page</title>
</head>
<body>
<p>Cyrillic type test</p>
<p>Братан, ты вообще качаешься?</p>
<script type="text/javascript">
- function get(aAddress, aCallback) {
- var xhr = new XMLHttpRequest();
- xhr.open("GET", aAddress, true);
+ /* exported performRequests */
+ "use strict";
- xhr.onreadystatechange = function() {
+ function get(address, callback) {
+ let xhr = new XMLHttpRequest();
+ xhr.open("GET", address, true);
+
+ xhr.onreadystatechange = function () {
if (this.readyState == this.DONE) {
- aCallback();
+ callback();
}
};
xhr.send(null);
}
function performRequests() {
- get("sjs_content-type-test-server.sjs?fmt=txt", function() {
+ get("sjs_content-type-test-server.sjs?fmt=txt", function () {
// Done.
});
}
</script>
</body>
</html>
--- a/devtools/client/netmonitor/test/html_filter-test-page.html
+++ b/devtools/client/netmonitor/test/html_filter-test-page.html
@@ -10,51 +10,59 @@
<meta http-equiv="Expires" content="0" />
<title>Network Monitor test page</title>
</head>
<body>
<p>Filtering test</p>
<script type="text/javascript">
- function get(aAddress, aCallback) {
- var xhr = new XMLHttpRequest();
+ /* exported performRequests */
+ "use strict";
+
+ function get(address, callback) {
+ let xhr = new XMLHttpRequest();
// Use a random parameter to defeat caching.
- xhr.open("GET", aAddress + "&" + Math.random(), true);
+ xhr.open("GET", address + "&" + Math.random(), true);
- xhr.onreadystatechange = function() {
+ xhr.onreadystatechange = function () {
if (this.readyState == this.DONE) {
- aCallback();
+ callback();
}
};
xhr.send(null);
}
- function performRequests(aOptions) {
- var options = JSON.parse(aOptions);
- get("sjs_content-type-test-server.sjs?fmt=html&res=" + options.htmlContent, function() {
- get("sjs_content-type-test-server.sjs?fmt=css", function() {
- get("sjs_content-type-test-server.sjs?fmt=js", function() {
- if (!options.getMedia) {
- return;
- }
- get("sjs_content-type-test-server.sjs?fmt=font", function() {
- get("sjs_content-type-test-server.sjs?fmt=image", function() {
- get("sjs_content-type-test-server.sjs?fmt=audio", function() {
- get("sjs_content-type-test-server.sjs?fmt=video", function() {
- if (!options.getFlash) {
- return;
- }
- get("sjs_content-type-test-server.sjs?fmt=flash", function() {
- // Done.
+ function performRequests(optionsText) {
+ const options = JSON.parse(optionsText);
+
+ /* eslint-disable max-nested-callbacks */
+ get("sjs_content-type-test-server.sjs?fmt=html&res=" + options.htmlContent,
+ function () {
+ get("sjs_content-type-test-server.sjs?fmt=css", function () {
+ get("sjs_content-type-test-server.sjs?fmt=js", function () {
+ if (!options.getMedia) {
+ return;
+ }
+ get("sjs_content-type-test-server.sjs?fmt=font", function () {
+ get("sjs_content-type-test-server.sjs?fmt=image", function () {
+ get("sjs_content-type-test-server.sjs?fmt=audio", function () {
+ get("sjs_content-type-test-server.sjs?fmt=video", function () {
+ if (!options.getFlash) {
+ return;
+ }
+ get("sjs_content-type-test-server.sjs?fmt=flash", function () {
+ // Done.
+ });
+ });
});
});
});
});
});
- });
- });
- });
+ }
+ );
+ /* eslint-enable max-nested-callbacks */
}
</script>
</body>
</html>
--- a/devtools/client/netmonitor/test/html_frame-subdocument.html
+++ b/devtools/client/netmonitor/test/html_frame-subdocument.html
@@ -11,18 +11,20 @@
<title>Network Monitor test page</title>
<link rel="stylesheet" type="text/css" href="stylesheet_request" />
</head>
<body>
<p>Request frame test</p>
<img src="img_request" />
<script type="text/javascript">
+ "use strict";
+
function performXhrRequest() {
- var xhr = new XMLHttpRequest();
+ let xhr = new XMLHttpRequest();
xhr.open("GET", "xhr_request", true);
xhr.send();
}
function performFetchRequest() {
fetch("fetch_request");
}
--- a/devtools/client/netmonitor/test/html_frame-test-page.html
+++ b/devtools/client/netmonitor/test/html_frame-test-page.html
@@ -12,18 +12,20 @@
<link rel="stylesheet" type="text/css" href="stylesheet_request" />
</head>
<body>
<p>Request frame test</p>
<img src="img_request" />
<iframe src="html_frame-subdocument.html"></iframe>
<script type="text/javascript">
+ "use strict";
+
function performXhrRequest() {
- var xhr = new XMLHttpRequest();
+ let xhr = new XMLHttpRequest();
xhr.open("GET", "xhr_request", true);
xhr.send();
}
function performFetchRequest() {
fetch("fetch_request");
}
--- a/devtools/client/netmonitor/test/html_image-tooltip-test-page.html
+++ b/devtools/client/netmonitor/test/html_image-tooltip-test-page.html
@@ -10,17 +10,20 @@
<meta http-equiv="Expires" content="0" />
<title>Network Monitor test page</title>
</head>
<body>
<p>tooltip test</p>
<script type="text/javascript">
+ /* exported performRequests */
+ "use strict";
+
function performRequests() {
- var xhr = new XMLHttpRequest();
+ let xhr = new XMLHttpRequest();
xhr.open("GET", "test-image.png?v=" + Math.random(), true);
xhr.send(null);
}
</script>
</body>
</html>
--- a/devtools/client/netmonitor/test/html_infinite-get-page.html
+++ b/devtools/client/netmonitor/test/html_infinite-get-page.html
@@ -10,32 +10,34 @@
<meta http-equiv="Expires" content="0" />
<title>Network Monitor test page</title>
</head>
<body>
<p>Infinite GETs</p>
<script type="text/javascript">
- function get(aAddress, aCallback) {
- var xhr = new XMLHttpRequest();
- xhr.open("GET", aAddress, true);
+ "use strict";
- xhr.onreadystatechange = function() {
+ function get(address, callback) {
+ let xhr = new XMLHttpRequest();
+ xhr.open("GET", address, true);
+
+ xhr.onreadystatechange = function () {
if (this.readyState == this.DONE) {
- aCallback();
+ callback();
}
};
xhr.send(null);
}
// Use a count parameter to defeat caching.
- var count = 0;
+ let count = 0;
(function performRequests() {
- get("request_" + (count++), function() {
+ get("request_" + (count++), function () {
setTimeout(performRequests, 50);
});
})();
</script>
</body>
</html>
--- a/devtools/client/netmonitor/test/html_json-b64.html
+++ b/devtools/client/netmonitor/test/html_json-b64.html
@@ -10,29 +10,32 @@
<meta http-equiv="Expires" content="0" />
<title>Network Monitor test page</title>
</head>
<body>
<p>JSON b64 test</p>
<script type="text/javascript">
- function get(aAddress, aCallback) {
- var xhr = new XMLHttpRequest();
- xhr.open("GET", aAddress, true);
+ /* exported performRequests */
+ "use strict";
- xhr.onreadystatechange = function() {
+ function get(address, callback) {
+ let xhr = new XMLHttpRequest();
+ xhr.open("GET", address, true);
+
+ xhr.onreadystatechange = function () {
if (this.readyState == this.DONE) {
- aCallback();
+ callback();
}
};
xhr.send(null);
}
function performRequests() {
- get("sjs_content-type-test-server.sjs?fmt=json-b64", function() {
+ get("sjs_content-type-test-server.sjs?fmt=json-b64", function () {
// Done.
});
}
</script>
</body>
</html>
--- a/devtools/client/netmonitor/test/html_json-basic.html
+++ b/devtools/client/netmonitor/test/html_json-basic.html
@@ -11,30 +11,33 @@
<title>Network Monitor test page</title>
</head>
<body>
<p>JSON request test page</p>
<p>Pass the JSON name (as supported by sjs_json-test-server.sjs) as a query parameter</p>
<script type="text/javascript">
- function get(aAddress, aCallback) {
- var xhr = new XMLHttpRequest();
- xhr.open("GET", aAddress, true);
+ /* exported performRequests */
+ "use strict";
- xhr.onreadystatechange = function() {
+ function get(address, callback) {
+ let xhr = new XMLHttpRequest();
+ xhr.open("GET", address, true);
+
+ xhr.onreadystatechange = function () {
if (this.readyState == this.DONE) {
- aCallback();
+ callback();
}
};
xhr.send(null);
}
function performRequests() {
// Forward the query parameter for this page to sjs_json-test-server
- get("sjs_json-test-server.sjs" + window.location.search, function() {
+ get("sjs_json-test-server.sjs" + window.location.search, function () {
// Done.
});
}
</script>
</body>
</html>
--- a/devtools/client/netmonitor/test/html_json-custom-mime-test-page.html
+++ b/devtools/client/netmonitor/test/html_json-custom-mime-test-page.html
@@ -10,29 +10,32 @@
<meta http-equiv="Expires" content="0" />
<title>Network Monitor test page</title>
</head>
<body>
<p>JSONP test</p>
<script type="text/javascript">
- function get(aAddress, aCallback) {
- var xhr = new XMLHttpRequest();
- xhr.open("GET", aAddress, true);
+ /* exported performRequests */
+ "use strict";
- xhr.onreadystatechange = function() {
+ function get(address, callback) {
+ let xhr = new XMLHttpRequest();
+ xhr.open("GET", address, true);
+
+ xhr.onreadystatechange = function () {
if (this.readyState == this.DONE) {
- aCallback();
+ callback();
}
};
xhr.send(null);
}
function performRequests() {
- get("sjs_content-type-test-server.sjs?fmt=json-custom-mime", function() {
+ get("sjs_content-type-test-server.sjs?fmt=json-custom-mime", function () {
// Done.
});
}
</script>
</body>
</html>
--- a/devtools/client/netmonitor/test/html_json-long-test-page.html
+++ b/devtools/client/netmonitor/test/html_json-long-test-page.html
@@ -10,29 +10,32 @@
<meta http-equiv="Expires" content="0" />
<title>Network Monitor test page</title>
</head>
<body>
<p>JSON long string test</p>
<script type="text/javascript">
- function get(aAddress, aCallback) {
- var xhr = new XMLHttpRequest();
- xhr.open("GET", aAddress, true);
+ /* exported performRequests */
+ "use strict";
- xhr.onreadystatechange = function() {
+ function get(address, callback) {
+ let xhr = new XMLHttpRequest();
+ xhr.open("GET", address, true);
+
+ xhr.onreadystatechange = function () {
if (this.readyState == this.DONE) {
- aCallback();
+ callback();
}
};
xhr.send(null);
}
function performRequests() {
- get("sjs_content-type-test-server.sjs?fmt=json-long", function() {
+ get("sjs_content-type-test-server.sjs?fmt=json-long", function () {
// Done.
});
}
</script>
</body>
</html>
--- a/devtools/client/netmonitor/test/html_json-malformed-test-page.html
+++ b/devtools/client/netmonitor/test/html_json-malformed-test-page.html
@@ -10,29 +10,32 @@
<meta http-equiv="Expires" content="0" />
<title>Network Monitor test page</title>
</head>
<body>
<p>JSON malformed test</p>
<script type="text/javascript">
- function get(aAddress, aCallback) {
- var xhr = new XMLHttpRequest();
- xhr.open("GET", aAddress, true);
+ /* exported performRequests */
+ "use strict";
- xhr.onreadystatechange = function() {
+ function get(address, callback) {
+ let xhr = new XMLHttpRequest();
+ xhr.open("GET", address, true);
+
+ xhr.onreadystatechange = function () {
if (this.readyState == this.DONE) {
- aCallback();
+ callback();
}
};
xhr.send(null);
}
function performRequests() {
- get("sjs_content-type-test-server.sjs?fmt=json-malformed", function() {
+ get("sjs_content-type-test-server.sjs?fmt=json-malformed", function () {
// Done.
});
}
</script>
</body>
</html>
--- a/devtools/client/netmonitor/test/html_json-text-mime-test-page.html
+++ b/devtools/client/netmonitor/test/html_json-text-mime-test-page.html
@@ -10,29 +10,32 @@
<meta http-equiv="Expires" content="0" />
<title>Network Monitor test page</title>
</head>
<body>
<p>JSON text test</p>
<script type="text/javascript">
- function get(aAddress, aCallback) {
- var xhr = new XMLHttpRequest();
- xhr.open("GET", aAddress, true);
+ /* exported performRequests */
+ "use strict";
- xhr.onreadystatechange = function() {
+ function get(address, callback) {
+ let xhr = new XMLHttpRequest();
+ xhr.open("GET", address, true);
+
+ xhr.onreadystatechange = function () {
if (this.readyState == this.DONE) {
- aCallback();
+ callback();
}
};
xhr.send(null);
}
function performRequests() {
- get("sjs_content-type-test-server.sjs?fmt=json-text-mime", function() {
+ get("sjs_content-type-test-server.sjs?fmt=json-text-mime", function () {
// Done.
});
}
</script>
</body>
</html>
--- a/devtools/client/netmonitor/test/html_jsonp-test-page.html
+++ b/devtools/client/netmonitor/test/html_jsonp-test-page.html
@@ -10,31 +10,34 @@
<meta http-equiv="Expires" content="0" />
<title>Network Monitor test page</title>
</head>
<body>
<p>JSONP test</p>
<script type="text/javascript">
- function get(aAddress, aCallback) {
- var xhr = new XMLHttpRequest();
- xhr.open("GET", aAddress, true);
+ /* exported performRequests */
+ "use strict";
- xhr.onreadystatechange = function() {
+ function get(address, callback) {
+ let xhr = new XMLHttpRequest();
+ xhr.open("GET", address, true);
+
+ xhr.onreadystatechange = function () {
if (this.readyState == this.DONE) {
- aCallback();
+ callback();
}
};
xhr.send(null);
}
function performRequests() {
- get("sjs_content-type-test-server.sjs?fmt=jsonp&jsonp=$_0123Fun", function() {
- get("sjs_content-type-test-server.sjs?fmt=jsonp2&jsonp=$_4567Sad", function() {
+ get("sjs_content-type-test-server.sjs?fmt=jsonp&jsonp=$_0123Fun", function () {
+ get("sjs_content-type-test-server.sjs?fmt=jsonp2&jsonp=$_4567Sad", function () {
// Done.
});
});
}
</script>
</body>
</html>
--- a/devtools/client/netmonitor/test/html_params-test-page.html
+++ b/devtools/client/netmonitor/test/html_params-test-page.html
@@ -10,58 +10,63 @@
<meta http-equiv="Expires" content="0" />
<title>Network Monitor test page</title>
</head>
<body>
<p>Request params type test</p>
<script type="text/javascript">
- function get(aAddress, aQuery) {
- var xhr = new XMLHttpRequest();
- xhr.open("GET", aAddress + aQuery, true);
+ /* exported performRequests */
+ "use strict";
+
+ function get(address, query) {
+ let xhr = new XMLHttpRequest();
+ xhr.open("GET", address + query, true);
xhr.send();
}
- function post(aAddress, aQuery, aContentType, aPostBody) {
- var xhr = new XMLHttpRequest();
- xhr.open("POST", aAddress + aQuery, true);
- xhr.setRequestHeader("content-type", aContentType);
- xhr.send(aPostBody);
+ function post(address, query, contentType, postBody) {
+ let xhr = new XMLHttpRequest();
+ xhr.open("POST", address + query, true);
+ xhr.setRequestHeader("content-type", contentType);
+ xhr.send(postBody);
}
function performRequests() {
- var urlencoded = "application/x-www-form-urlencoded";
+ const urlencoded = "application/x-www-form-urlencoded";
- setTimeout(function() {
+ /* eslint-disable max-nested-callbacks */
+ setTimeout(function () {
post("baz", "?a", urlencoded, '{ "foo": "bar" }');
- setTimeout(function() {
+ setTimeout(function () {
post("baz", "?a=b", urlencoded, '{ "foo": "bar" }');
- setTimeout(function() {
- post("baz", "?a=b", urlencoded, '?foo=bar');
+ setTimeout(function () {
+ post("baz", "?a=b", urlencoded, "?foo=bar");
- setTimeout(function() {
+ setTimeout(function () {
post("baz", "?a", undefined, '{ "foo": "bar" }');
- setTimeout(function() {
+ setTimeout(function () {
post("baz", "?a=b", undefined, '{ "foo": "bar" }');
- setTimeout(function() {
- post("baz", "?a=b", undefined, '?foo=bar');
+ setTimeout(function () {
+ post("baz", "?a=b", undefined, "?foo=bar");
- setTimeout(function() {
+ setTimeout(function () {
get("baz", "");
// Done.
}, 10);
}, 10);
}, 10);
}, 10);
}, 10);
}, 10);
}, 10);
+ /* eslint-enable max-nested-callbacks */
}
</script>
</body>
</html>
--- a/devtools/client/netmonitor/test/html_post-data-test-page.html
+++ b/devtools/client/netmonitor/test/html_post-data-test-page.html
@@ -22,56 +22,59 @@
<form enctype="multipart/form-data" method="post" name="form-name">
<input type="text" name="text" placeholder="text" value="Some text..."/>
<input type="email" name="email" placeholder="email"/>
<input type="range" name="range" value="42"/>
<input type="button" value="Post me!" onclick="window.form()">
</form>
<script type="text/javascript">
- function post(aAddress, aMessage, aCallback) {
- var xhr = new XMLHttpRequest();
- xhr.open("POST", aAddress, true);
+ /* exported performRequests */
+ "use strict";
+
+ function post(address, message, callback) {
+ let xhr = new XMLHttpRequest();
+ xhr.open("POST", address, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
- var data = "";
- for (var i in aMessage) {
- data += "&" + i + "=" + aMessage[i];
+ let data = "";
+ for (let i in message) {
+ data += "&" + i + "=" + message[i];
}
- xhr.onreadystatechange = function() {
+ xhr.onreadystatechange = function () {
if (this.readyState == this.DONE) {
- aCallback();
+ callback();
}
};
xhr.send(data);
}
- function form(aAddress, aForm, aCallback) {
- var formData = new FormData(document.forms.namedItem(aForm));
+ function form(address, formName, callback) {
+ let formData = new FormData(document.forms.namedItem(formName));
formData.append("Custom field", "Extra data");
- var xhr = new XMLHttpRequest();
- xhr.open("POST", aAddress, true);
+ let xhr = new XMLHttpRequest();
+ xhr.open("POST", address, true);
- xhr.onreadystatechange = function() {
+ xhr.onreadystatechange = function () {
if (this.readyState == this.DONE) {
- aCallback();
+ callback();
}
};
xhr.send(formData);
}
function performRequests() {
- var url = "sjs_simple-test-server.sjs";
- var url1 = url + "?foo=bar&baz=42&type=urlencoded";
- var url2 = url + "?foo=bar&baz=42&type=multipart";
+ const url = "sjs_simple-test-server.sjs";
+ const url1 = url + "?foo=bar&baz=42&type=urlencoded";
+ const url2 = url + "?foo=bar&baz=42&type=multipart";
- post(url1, { foo: "bar", baz: 123 }, function() {
- form(url2, "form-name", function() {
+ post(url1, { foo: "bar", baz: 123 }, function () {
+ form(url2, "form-name", function () {
// Done.
});
});
}
</script>
</body>
</html>
--- a/devtools/client/netmonitor/test/html_post-json-test-page.html
+++ b/devtools/client/netmonitor/test/html_post-json-test-page.html
@@ -10,16 +10,19 @@
<meta http-equiv="Expires" content="0" />
<title>Network Monitor test page</title>
</head>
<body>
<p>POST raw test</p>
<script type="text/javascript">
+ /* exported performRequests */
+ "use strict";
+
function post(address, message, callback) {
let xhr = new XMLHttpRequest();
xhr.open("POST", address, true);
xhr.setRequestHeader("Content-Type", "application/json");
xhr.onreadystatechange = function () {
if (this.readyState == this.DONE) {
callback();
--- a/devtools/client/netmonitor/test/html_post-raw-test-page.html
+++ b/devtools/client/netmonitor/test/html_post-raw-test-page.html
@@ -10,31 +10,34 @@
<meta http-equiv="Expires" content="0" />
<title>Network Monitor test page</title>
</head>
<body>
<p>POST raw test</p>
<script type="text/javascript">
- function post(aAddress, aMessage, aCallback) {
- var xhr = new XMLHttpRequest();
- xhr.open("POST", aAddress, true);
+ /* exported performRequests */
+ "use strict";
+
+ function post(address, message, callback) {
+ let xhr = new XMLHttpRequest();
+ xhr.open("POST", address, true);
xhr.setRequestHeader("content-type", "application/x-www-form-urlencoded");
- xhr.onreadystatechange = function() {
+ xhr.onreadystatechange = function () {
if (this.readyState == this.DONE) {
- aCallback();
+ callback();
}
};
- xhr.send(aMessage);
+ xhr.send(message);
}
function performRequests() {
- var rawData = "foo=bar&baz=123";
- post("sjs_simple-test-server.sjs", rawData, function() {
+ const rawData = "foo=bar&baz=123";
+ post("sjs_simple-test-server.sjs", rawData, function () {
// Done.
});
}
</script>
</body>
</html>
--- a/devtools/client/netmonitor/test/html_post-raw-with-headers-test-page.html
+++ b/devtools/client/netmonitor/test/html_post-raw-with-headers-test-page.html
@@ -10,36 +10,39 @@
<meta http-equiv="Expires" content="0" />
<title>Network Monitor test page</title>
</head>
<body>
<p>POST raw with headers test</p>
<script type="text/javascript">
- function post(aAddress, aMessage, aCallback) {
- var xhr = new XMLHttpRequest();
- xhr.open("POST", aAddress, true);
+ /* exported performRequests */
+ "use strict";
- xhr.onreadystatechange = function() {
+ function post(address, message, callback) {
+ let xhr = new XMLHttpRequest();
+ xhr.open("POST", address, true);
+
+ xhr.onreadystatechange = function () {
if (this.readyState == this.DONE) {
- aCallback();
+ callback();
}
};
- xhr.send(aMessage);
+ xhr.send(message);
}
function performRequests() {
- var rawData = [
+ let rawData = [
"content-type: application/x-www-form-urlencoded\r",
"custom-header: hello world!\r",
"\r",
"\r",
"foo=bar&baz=123"
];
- post("sjs_simple-test-server.sjs", rawData.join("\n"), function() {
+ post("sjs_simple-test-server.sjs", rawData.join("\n"), function () {
// Done.
});
}
</script>
</body>
</html>
--- a/devtools/client/netmonitor/test/html_send-beacon.html
+++ b/devtools/client/netmonitor/test/html_send-beacon.html
@@ -10,14 +10,17 @@
<meta http-equiv="Expires" content="0" />
<title>Network Monitor test page</title>
</head>
<body>
<p>Send beacon test</p>
<script type="text/javascript">
+ /* exported performRequest */
+ "use strict";
+
function performRequest() {
navigator.sendBeacon("beacon_request");
}
</script>
</body>
</html>
--- a/devtools/client/netmonitor/test/html_single-get-page.html
+++ b/devtools/client/netmonitor/test/html_single-get-page.html
@@ -10,27 +10,29 @@
<meta http-equiv="Expires" content="0" />
<title>Network Monitor test page</title>
</head>
<body>
<p>Performing a custom number of GETs</p>
<script type="text/javascript">
- function get(aAddress, aCallback) {
- var xhr = new XMLHttpRequest();
- xhr.open("GET", aAddress, true);
+ "use strict";
- xhr.onreadystatechange = function() {
+ function get(address, callback) {
+ let xhr = new XMLHttpRequest();
+ xhr.open("GET", address, true);
+
+ xhr.onreadystatechange = function () {
if (this.readyState == this.DONE) {
- aCallback();
+ callback();
}
};
xhr.send(null);
}
(function performRequests() {
- get("request_0", function() {});
+ get("request_0", function () {});
})();
</script>
</body>
</html>
--- a/devtools/client/netmonitor/test/html_statistics-test-page.html
+++ b/devtools/client/netmonitor/test/html_statistics-test-page.html
@@ -10,19 +10,21 @@
<meta http-equiv="Expires" content="0" />
<title>Network Monitor test page</title>
</head>
<body>
<p>Statistics test</p>
<script type="text/javascript">
- function get(aAddress) {
- var xhr = new XMLHttpRequest();
- xhr.open("GET", aAddress, true);
+ "use strict";
+
+ function get(address) {
+ let xhr = new XMLHttpRequest();
+ xhr.open("GET", address, true);
xhr.send(null);
}
get("sjs_content-type-test-server.sjs?sts=304&fmt=txt");
get("sjs_content-type-test-server.sjs?sts=304&fmt=xml");
get("sjs_content-type-test-server.sjs?sts=304&fmt=html");
get("sjs_content-type-test-server.sjs?sts=304&fmt=css");
get("sjs_content-type-test-server.sjs?sts=304&fmt=js");
--- a/devtools/client/netmonitor/test/html_status-codes-test-page.html
+++ b/devtools/client/netmonitor/test/html_status-codes-test-page.html
@@ -10,45 +10,50 @@
<meta http-equiv="Expires" content="0" />
<title>Network Monitor test page</title>
</head>
<body>
<p>Status codes test</p>
<script type="text/javascript">
- function get(aAddress, aCallback) {
- var xhr = new XMLHttpRequest();
- xhr.open("GET", aAddress, true);
+ /* exported performRequests, performCachedRequests */
+ "use strict";
- xhr.onreadystatechange = function() {
+ function get(address, callback) {
+ let xhr = new XMLHttpRequest();
+ xhr.open("GET", address, true);
+
+ xhr.onreadystatechange = function () {
if (this.readyState == this.DONE) {
- aCallback();
+ callback();
}
};
xhr.send(null);
}
function performRequests() {
- get("sjs_status-codes-test-server.sjs?sts=100", function() {
- get("sjs_status-codes-test-server.sjs?sts=200", function() {
- get("sjs_status-codes-test-server.sjs?sts=300", function() {
- get("sjs_status-codes-test-server.sjs?sts=400", function() {
- get("sjs_status-codes-test-server.sjs?sts=500", function() {
+ /* eslint-disable max-nested-callbacks */
+ get("sjs_status-codes-test-server.sjs?sts=100", function () {
+ get("sjs_status-codes-test-server.sjs?sts=200", function () {
+ get("sjs_status-codes-test-server.sjs?sts=300", function () {
+ get("sjs_status-codes-test-server.sjs?sts=400", function () {
+ get("sjs_status-codes-test-server.sjs?sts=500", function () {
// Done.
});
});
});
});
});
+ /* eslint-enable max-nested-callbacks */
}
function performCachedRequests() {
- get("sjs_status-codes-test-server.sjs?sts=ok&cached", function() {
- get("sjs_status-codes-test-server.sjs?sts=redirect&cached", function() {
+ get("sjs_status-codes-test-server.sjs?sts=ok&cached", function () {
+ get("sjs_status-codes-test-server.sjs?sts=redirect&cached", function () {
// Done.
});
});
}
</script>
</body>
--- a/devtools/client/netmonitor/test/require-helper.js
+++ b/devtools/client/netmonitor/test/require-helper.js
@@ -26,9 +26,11 @@ requireHacker.global_hook("default", pat
// Some modules depend on Chrome APIs which don't work in mocha. When such a module
// is required, replace it with a mock version.
switch (path) {
case "devtools/shared/l10n":
return `module.exports = require("devtools/client/netmonitor/test/fixtures/localization-helper")`;
case "devtools/client/shared/redux/create-store":
return `module.exports = require("devtools/client/netmonitor/test/fixtures/create-store")`;
}
+
+ return null;
});
--- a/devtools/client/netmonitor/test/service-workers/status-codes.html
+++ b/devtools/client/netmonitor/test/service-workers/status-codes.html
@@ -11,32 +11,35 @@
<meta http-equiv="Expires" content="0" />
<title>Network Monitor test page</title>
</head>
<body>
<p>Status codes test</p>
<script type="text/javascript">
+ /* exported registerServiceWorker, unregisterServiceWorker, performRequests */
+ "use strict";
+
let swRegistration;
function registerServiceWorker() {
let sw = navigator.serviceWorker;
return sw.register("status-codes-service-worker.js")
.then(registration => {
swRegistration = registration;
console.log("Registered, scope is:", registration.scope);
return sw.ready;
}).then(() => {
// wait until the page is controlled
return new Promise(resolve => {
if (sw.controller) {
resolve();
} else {
- sw.addEventListener('controllerchange', function () {
+ sw.addEventListener("controllerchange", function () {
resolve();
}, {once: true});
}
});
}).catch(err => {
console.error("Registration failed");
});
}