mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-21 09:15:35 +00:00
Bug 1443470 - Convert Task.jsm to async/await in devtools/client/netmonitor. r=Honza
$ ./obj-firefox-artifact/dist/bin/run-mozilla.sh ./obj-firefox-artifact/dist/bin/xpcshell xpc devtools/client/netmonitor MozReview-Commit-ID: 7fUjyobgiPD --HG-- extra : rebase_source : c105a8573f4d0e06d368b595524f06f37c56c393
This commit is contained in:
parent
af65a84060
commit
df1782cf06
@ -6,12 +6,12 @@
|
||||
/**
|
||||
* Basic tests for exporting Network panel content into HAR format.
|
||||
*/
|
||||
add_task(function* () {
|
||||
add_task(async function () {
|
||||
// Disable tcp fast open, because it is setting a response header indicator
|
||||
// (bug 1352274). TCP Fast Open is not present on all platforms therefore the
|
||||
// number of response headers will vary depending on the platform.
|
||||
Services.prefs.setBoolPref("network.tcp.tcp_fastopen_enable", false);
|
||||
let { tab, monitor } = yield initNetMonitor(SIMPLE_URL);
|
||||
let { tab, monitor } = await initNetMonitor(SIMPLE_URL);
|
||||
|
||||
info("Starting test... ");
|
||||
|
||||
@ -26,11 +26,11 @@ add_task(function* () {
|
||||
|
||||
let wait = waitForNetworkEvents(monitor, 1);
|
||||
tab.linkedBrowser.reload();
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
let contextMenu = new RequestListContextMenu({ connector });
|
||||
|
||||
yield contextMenu.copyAllAsHar(getSortedRequests(store.getState()));
|
||||
await contextMenu.copyAllAsHar(getSortedRequests(store.getState()));
|
||||
|
||||
let jsonString = SpecialPowers.getClipboardData("text/unicode");
|
||||
let har = JSON.parse(jsonString);
|
||||
|
@ -6,8 +6,8 @@
|
||||
/**
|
||||
* Tests for exporting POST data into HAR format.
|
||||
*/
|
||||
add_task(function* () {
|
||||
let { tab, monitor } = yield initNetMonitor(
|
||||
add_task(async function () {
|
||||
let { tab, monitor } = await initNetMonitor(
|
||||
HAR_EXAMPLE_URL + "html_har_post-data-test-page.html");
|
||||
|
||||
info("Starting test... ");
|
||||
@ -23,14 +23,14 @@ add_task(function* () {
|
||||
|
||||
// Execute one POST request on the page and wait till its done.
|
||||
let wait = waitForNetworkEvents(monitor, 1);
|
||||
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
|
||||
await ContentTask.spawn(tab.linkedBrowser, {}, async function () {
|
||||
content.wrappedJSObject.executeTest();
|
||||
});
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
// Copy HAR into the clipboard (asynchronous).
|
||||
let contextMenu = new RequestListContextMenu({ connector });
|
||||
let jsonString = yield contextMenu.copyAllAsHar(getSortedRequests(store.getState()));
|
||||
let jsonString = await contextMenu.copyAllAsHar(getSortedRequests(store.getState()));
|
||||
let har = JSON.parse(jsonString);
|
||||
|
||||
// Check out the HAR log.
|
||||
|
@ -6,8 +6,8 @@
|
||||
/**
|
||||
* Tests for exporting POST data into HAR format.
|
||||
*/
|
||||
add_task(function* () {
|
||||
let { tab, monitor } = yield initNetMonitor(
|
||||
add_task(async function () {
|
||||
let { tab, monitor } = await initNetMonitor(
|
||||
HAR_EXAMPLE_URL + "html_har_post-data-test-page.html");
|
||||
|
||||
info("Starting test... ");
|
||||
@ -23,14 +23,14 @@ add_task(function* () {
|
||||
|
||||
// Execute one GET request on the page and wait till its done.
|
||||
let wait = waitForNetworkEvents(monitor, 1);
|
||||
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
|
||||
await ContentTask.spawn(tab.linkedBrowser, {}, async function () {
|
||||
content.wrappedJSObject.executeTest3();
|
||||
});
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
// Copy HAR into the clipboard (asynchronous).
|
||||
let contextMenu = new RequestListContextMenu({ connector });
|
||||
let jsonString = yield contextMenu.copyAllAsHar(getSortedRequests(store.getState()));
|
||||
let jsonString = await contextMenu.copyAllAsHar(getSortedRequests(store.getState()));
|
||||
let har = JSON.parse(jsonString);
|
||||
|
||||
// Check out the HAR log.
|
||||
|
@ -5,13 +5,13 @@
|
||||
|
||||
"use strict";
|
||||
|
||||
add_task(function* () {
|
||||
yield throttleUploadTest(true);
|
||||
yield throttleUploadTest(false);
|
||||
add_task(async function () {
|
||||
await throttleUploadTest(true);
|
||||
await throttleUploadTest(false);
|
||||
});
|
||||
|
||||
function* throttleUploadTest(actuallyThrottle) {
|
||||
let { tab, monitor } = yield initNetMonitor(
|
||||
async function throttleUploadTest(actuallyThrottle) {
|
||||
let { tab, monitor } = await initNetMonitor(
|
||||
HAR_EXAMPLE_URL + "html_har_post-data-test-page.html");
|
||||
|
||||
info("Starting test... (actuallyThrottle = " + actuallyThrottle + ")");
|
||||
@ -40,7 +40,7 @@ function* throttleUploadTest(actuallyThrottle) {
|
||||
};
|
||||
|
||||
info("sending throttle request");
|
||||
yield new Promise((resolve) => {
|
||||
await new Promise((resolve) => {
|
||||
connector.setPreferences(request, (response) => {
|
||||
resolve(response);
|
||||
});
|
||||
@ -49,15 +49,15 @@ function* throttleUploadTest(actuallyThrottle) {
|
||||
// Execute one POST request on the page and wait till its done.
|
||||
let onEventTimings = monitor.panelWin.once(EVENTS.RECEIVED_EVENT_TIMINGS);
|
||||
let wait = waitForNetworkEvents(monitor, 1);
|
||||
yield ContentTask.spawn(tab.linkedBrowser, { size }, function* (args) {
|
||||
await ContentTask.spawn(tab.linkedBrowser, { size }, async function (args) {
|
||||
content.wrappedJSObject.executeTest2(args.size);
|
||||
});
|
||||
yield wait;
|
||||
yield onEventTimings;
|
||||
await wait;
|
||||
await onEventTimings;
|
||||
|
||||
// Copy HAR into the clipboard (asynchronous).
|
||||
let contextMenu = new RequestListContextMenu({ connector });
|
||||
let jsonString = yield contextMenu.copyAllAsHar(getSortedRequests(store.getState()));
|
||||
let jsonString = await contextMenu.copyAllAsHar(getSortedRequests(store.getState()));
|
||||
let har = JSON.parse(jsonString);
|
||||
|
||||
// Check out the HAR log.
|
||||
@ -77,5 +77,5 @@ function* throttleUploadTest(actuallyThrottle) {
|
||||
}
|
||||
|
||||
// Clean up
|
||||
yield teardown(monitor);
|
||||
await teardown(monitor);
|
||||
}
|
||||
|
@ -7,8 +7,8 @@
|
||||
* Tests if focus modifiers work for the SideMenuWidget.
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
let { tab, monitor } = yield initNetMonitor(CUSTOM_GET_URL);
|
||||
add_task(async function () {
|
||||
let { tab, monitor } = await initNetMonitor(CUSTOM_GET_URL);
|
||||
info("Starting test... ");
|
||||
|
||||
// It seems that this test may be slow on Ubuntu builds running on ec2.
|
||||
@ -31,10 +31,10 @@ add_task(function* () {
|
||||
}
|
||||
|
||||
let wait = waitForNetworkEvents(monitor, 2);
|
||||
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
|
||||
await ContentTask.spawn(tab.linkedBrowser, {}, async function () {
|
||||
content.wrappedJSObject.performRequests(2);
|
||||
});
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
check(-1, false);
|
||||
|
||||
@ -54,10 +54,10 @@ add_task(function* () {
|
||||
check(0, true);
|
||||
|
||||
wait = waitForNetworkEvents(monitor, 18);
|
||||
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
|
||||
await ContentTask.spawn(tab.linkedBrowser, {}, async function () {
|
||||
content.wrappedJSObject.performRequests(18);
|
||||
});
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
store.dispatch(Actions.selectDelta(+Infinity));
|
||||
check(19, true);
|
||||
|
@ -7,8 +7,8 @@
|
||||
* Tests if keyboard and mouse navigation works in the network requests menu.
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
let { tab, monitor } = yield initNetMonitor(CUSTOM_GET_URL);
|
||||
add_task(async function () {
|
||||
let { tab, monitor } = await initNetMonitor(CUSTOM_GET_URL);
|
||||
info("Starting test... ");
|
||||
|
||||
// It seems that this test may be slow on Ubuntu builds running on ec2.
|
||||
@ -31,10 +31,10 @@ add_task(function* () {
|
||||
}
|
||||
|
||||
let wait = waitForNetworkEvents(monitor, 2);
|
||||
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
|
||||
await ContentTask.spawn(tab.linkedBrowser, {}, async function () {
|
||||
content.wrappedJSObject.performRequests(2);
|
||||
});
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
document.querySelector(".requests-list-contents").focus();
|
||||
|
||||
@ -56,10 +56,10 @@ add_task(function* () {
|
||||
check(0, true);
|
||||
|
||||
wait = waitForNetworkEvents(monitor, 18);
|
||||
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
|
||||
await ContentTask.spawn(tab.linkedBrowser, {}, async function () {
|
||||
content.wrappedJSObject.performRequests(18);
|
||||
});
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
EventUtils.sendKey("DOWN", window);
|
||||
check(1, true);
|
||||
@ -127,5 +127,5 @@ add_task(function* () {
|
||||
document.querySelector(".request-list-item"));
|
||||
check(0, true);
|
||||
|
||||
yield teardown(monitor);
|
||||
await teardown(monitor);
|
||||
});
|
||||
|
@ -8,8 +8,8 @@
|
||||
* (including Unicode)
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
let { tab, monitor } = yield initNetMonitor(API_CALLS_URL);
|
||||
add_task(async function () {
|
||||
let { tab, monitor } = await initNetMonitor(API_CALLS_URL);
|
||||
info("Starting test... ");
|
||||
|
||||
let { document, store, windowRequire } = monitor.panelWin;
|
||||
@ -30,10 +30,10 @@ add_task(function* () {
|
||||
];
|
||||
|
||||
let wait = waitForNetworkEvents(monitor, 5);
|
||||
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
|
||||
await ContentTask.spawn(tab.linkedBrowser, {}, async function () {
|
||||
content.wrappedJSObject.performRequests();
|
||||
});
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
REQUEST_URIS.forEach(function (uri, index) {
|
||||
verifyRequestItemTarget(
|
||||
@ -45,5 +45,5 @@ add_task(function* () {
|
||||
);
|
||||
});
|
||||
|
||||
yield teardown(monitor);
|
||||
await teardown(monitor);
|
||||
});
|
||||
|
@ -7,58 +7,58 @@
|
||||
* Bug 863102 - Automatically scroll down upon new network requests.
|
||||
* edited to account for changes made to fix Bug 1360457
|
||||
*/
|
||||
add_task(function* () {
|
||||
add_task(async function () {
|
||||
requestLongerTimeout(4);
|
||||
|
||||
let { tab, monitor } = yield initNetMonitor(INFINITE_GET_URL, true);
|
||||
let { tab, monitor } = await initNetMonitor(INFINITE_GET_URL, true);
|
||||
let { document, windowRequire, store } = monitor.panelWin;
|
||||
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
|
||||
|
||||
store.dispatch(Actions.batchEnable(false));
|
||||
|
||||
// Wait until the first request makes the empty notice disappear
|
||||
yield waitForRequestListToAppear();
|
||||
await waitForRequestListToAppear();
|
||||
|
||||
let requestsContainer = document.querySelector(".requests-list-contents");
|
||||
ok(requestsContainer, "Container element exists as expected.");
|
||||
|
||||
// (1) Check that the scroll position is maintained at the bottom
|
||||
// when the requests overflow the vertical size of the container.
|
||||
yield waitForRequestsToOverflowContainer();
|
||||
yield waitForScroll();
|
||||
await waitForRequestsToOverflowContainer();
|
||||
await waitForScroll();
|
||||
ok(true, "Scrolled to bottom on overflow.");
|
||||
|
||||
// (2) Now scroll to the top and check that additional requests
|
||||
// do not change the scroll position.
|
||||
requestsContainer.scrollTop = 0;
|
||||
yield waitSomeTime();
|
||||
await waitSomeTime();
|
||||
ok(!scrolledToBottom(requestsContainer), "Not scrolled to bottom.");
|
||||
// save for comparison later
|
||||
let scrollTop = requestsContainer.scrollTop;
|
||||
yield waitForNetworkEvents(monitor, 8);
|
||||
yield waitSomeTime();
|
||||
await waitForNetworkEvents(monitor, 8);
|
||||
await waitSomeTime();
|
||||
is(requestsContainer.scrollTop, scrollTop, "Did not scroll.");
|
||||
|
||||
// (3) Now set the scroll position back at the bottom and check that
|
||||
// additional requests *do* cause the container to scroll down.
|
||||
requestsContainer.scrollTop = requestsContainer.scrollHeight;
|
||||
ok(scrolledToBottom(requestsContainer), "Set scroll position to bottom.");
|
||||
yield waitForNetworkEvents(monitor, 8);
|
||||
yield waitForScroll();
|
||||
await waitForNetworkEvents(monitor, 8);
|
||||
await waitForScroll();
|
||||
ok(true, "Still scrolled to bottom.");
|
||||
|
||||
// (4) Now select the first item in the list
|
||||
// and check that additional requests do not change the scroll position
|
||||
// from just below the headers.
|
||||
store.dispatch(Actions.selectRequestByIndex(0));
|
||||
yield waitForNetworkEvents(monitor, 8);
|
||||
yield waitSomeTime();
|
||||
await waitForNetworkEvents(monitor, 8);
|
||||
await waitSomeTime();
|
||||
let requestsContainerHeaders = requestsContainer.firstChild;
|
||||
let headersHeight = requestsContainerHeaders.offsetHeight;
|
||||
is(requestsContainer.scrollTop, headersHeight, "Did not scroll.");
|
||||
|
||||
// Stop doing requests.
|
||||
yield ContentTask.spawn(tab.linkedBrowser, {}, function () {
|
||||
await ContentTask.spawn(tab.linkedBrowser, {}, function () {
|
||||
content.wrappedJSObject.stopRequests();
|
||||
});
|
||||
|
||||
@ -70,11 +70,11 @@ add_task(function* () {
|
||||
return waitUntil(() => !!document.querySelector(".requests-list-contents"));
|
||||
}
|
||||
|
||||
function* waitForRequestsToOverflowContainer() {
|
||||
async function waitForRequestsToOverflowContainer() {
|
||||
info("Waiting for enough requests to overflow the container");
|
||||
while (true) {
|
||||
info("Waiting for one network request");
|
||||
yield waitForNetworkEvents(monitor, 1);
|
||||
await waitForNetworkEvents(monitor, 1);
|
||||
if (requestsContainer.scrollHeight > requestsContainer.clientHeight) {
|
||||
info("The list is long enough, returning");
|
||||
return;
|
||||
|
@ -10,10 +10,10 @@ const BROTLI_REQUESTS = 1;
|
||||
* Test brotli encoded response is handled correctly on HTTPS.
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
add_task(async function () {
|
||||
let { L10N } = require("devtools/client/netmonitor/src/utils/l10n");
|
||||
|
||||
let { tab, monitor } = yield initNetMonitor(BROTLI_URL);
|
||||
let { tab, monitor } = await initNetMonitor(BROTLI_URL);
|
||||
info("Starting test... ");
|
||||
|
||||
let { document, store, windowRequire } = monitor.panelWin;
|
||||
@ -26,15 +26,15 @@ add_task(function* () {
|
||||
store.dispatch(Actions.batchEnable(false));
|
||||
|
||||
let wait = waitForNetworkEvents(monitor, BROTLI_REQUESTS);
|
||||
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
|
||||
await ContentTask.spawn(tab.linkedBrowser, {}, async function () {
|
||||
content.wrappedJSObject.performRequests();
|
||||
});
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
let requestItem = document.querySelector(".request-list-item");
|
||||
let requestsListStatus = requestItem.querySelector(".requests-list-status");
|
||||
EventUtils.sendMouseEvent({ type: "mouseover" }, requestsListStatus);
|
||||
yield waitUntil(() => requestsListStatus.title);
|
||||
await waitUntil(() => requestsListStatus.title);
|
||||
|
||||
verifyRequestItemTarget(
|
||||
document,
|
||||
@ -56,12 +56,12 @@ add_task(function* () {
|
||||
document.querySelector(".network-details-panel-toggle"));
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector("#response-tab"));
|
||||
yield wait;
|
||||
yield onResponseContent;
|
||||
yield testResponse("br");
|
||||
yield teardown(monitor);
|
||||
await wait;
|
||||
await onResponseContent;
|
||||
await testResponse("br");
|
||||
await teardown(monitor);
|
||||
|
||||
function* testResponse(type) {
|
||||
function testResponse(type) {
|
||||
switch (type) {
|
||||
case "br": {
|
||||
is(document.querySelector(".CodeMirror-line").textContent, "X".repeat(64),
|
||||
|
@ -7,11 +7,11 @@
|
||||
* Tests if cached requests have the correct status code
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
add_task(async function () {
|
||||
// Disable rcwn to make cache behavior deterministic.
|
||||
yield pushPref("network.http.rcwn.enabled", false);
|
||||
await pushPref("network.http.rcwn.enabled", false);
|
||||
|
||||
let { tab, monitor } = yield initNetMonitor(STATUS_CODES_URL, true);
|
||||
let { tab, monitor } = await initNetMonitor(STATUS_CODES_URL, true);
|
||||
info("Starting test... ");
|
||||
|
||||
let { document, store, windowRequire } = monitor.panelWin;
|
||||
@ -89,10 +89,10 @@ add_task(function* () {
|
||||
];
|
||||
|
||||
info("Performing requests #1...");
|
||||
yield performRequestsAndWait();
|
||||
await performRequestsAndWait();
|
||||
|
||||
info("Performing requests #2...");
|
||||
yield performRequestsAndWait();
|
||||
await performRequestsAndWait();
|
||||
|
||||
let index = 0;
|
||||
for (let request of REQUEST_DATA) {
|
||||
@ -100,10 +100,10 @@ add_task(function* () {
|
||||
requestItem.scrollIntoView();
|
||||
let requestsListStatus = requestItem.querySelector(".requests-list-status");
|
||||
EventUtils.sendMouseEvent({ type: "mouseover" }, requestsListStatus);
|
||||
yield waitUntil(() => requestsListStatus.title);
|
||||
await waitUntil(() => requestsListStatus.title);
|
||||
|
||||
info("Verifying request #" + index);
|
||||
yield verifyRequestItemTarget(
|
||||
await verifyRequestItemTarget(
|
||||
document,
|
||||
getDisplayedRequests(store.getState()),
|
||||
getSortedRequests(store.getState()).get(index),
|
||||
@ -115,13 +115,13 @@ add_task(function* () {
|
||||
index++;
|
||||
}
|
||||
|
||||
yield teardown(monitor);
|
||||
await teardown(monitor);
|
||||
|
||||
function* performRequestsAndWait() {
|
||||
async function performRequestsAndWait() {
|
||||
let wait = waitForNetworkEvents(monitor, 3);
|
||||
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
|
||||
await ContentTask.spawn(tab.linkedBrowser, {}, async function () {
|
||||
content.wrappedJSObject.performCachedRequests();
|
||||
});
|
||||
yield wait;
|
||||
await wait;
|
||||
}
|
||||
});
|
||||
|
@ -77,9 +77,9 @@ const EXPECTED_REQUESTS = [
|
||||
},
|
||||
];
|
||||
|
||||
add_task(function* () {
|
||||
add_task(async function () {
|
||||
// Async stacks aren't on by default in all builds
|
||||
yield SpecialPowers.pushPrefEnv({ set: [["javascript.options.asyncstack", true]] });
|
||||
await SpecialPowers.pushPrefEnv({ set: [["javascript.options.asyncstack", true]] });
|
||||
|
||||
// the initNetMonitor function clears the network request list after the
|
||||
// page is loaded. That's why we first load a bogus page from SIMPLE_URL,
|
||||
@ -87,7 +87,7 @@ add_task(function* () {
|
||||
// all the requests the page is making, not only the XHRs.
|
||||
// We can't use about:blank here, because initNetMonitor checks that the
|
||||
// page has actually made at least one request.
|
||||
let { tab, monitor } = yield initNetMonitor(SIMPLE_URL);
|
||||
let { tab, monitor } = await initNetMonitor(SIMPLE_URL);
|
||||
|
||||
let { document, store, windowRequire, connector } = monitor.panelWin;
|
||||
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
|
||||
@ -100,10 +100,10 @@ add_task(function* () {
|
||||
|
||||
let wait = waitForNetworkEvents(monitor, EXPECTED_REQUESTS.length);
|
||||
tab.linkedBrowser.loadURI(CAUSE_URL);
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
let requests = getSortedRequests(store.getState());
|
||||
yield Promise.all(requests.map(requestItem =>
|
||||
await Promise.all(requests.map(requestItem =>
|
||||
connector.requestData(requestItem.id, "stackTrace")));
|
||||
|
||||
is(store.getState().requests.requests.size, EXPECTED_REQUESTS.length,
|
||||
@ -159,5 +159,5 @@ add_task(function* () {
|
||||
is(cause, expectedCause, `The request #${i} has the expected cause after sorting`);
|
||||
});
|
||||
|
||||
yield teardown(monitor);
|
||||
await teardown(monitor);
|
||||
});
|
||||
|
@ -8,7 +8,7 @@
|
||||
* redirected without hitting the network (HSTS is one of such cases)
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
add_task(async function () {
|
||||
const EXPECTED_REQUESTS = [
|
||||
// Request to HTTP URL, redirects to HTTPS, has callstack
|
||||
{ status: 302, hasStack: true },
|
||||
@ -18,7 +18,7 @@ add_task(function* () {
|
||||
{ status: 200, hasStack: true },
|
||||
];
|
||||
|
||||
let { tab, monitor } = yield initNetMonitor(CUSTOM_GET_URL);
|
||||
let { tab, monitor } = await initNetMonitor(CUSTOM_GET_URL);
|
||||
let { store, windowRequire, connector } = monitor.panelWin;
|
||||
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
|
||||
let {
|
||||
@ -28,8 +28,8 @@ add_task(function* () {
|
||||
store.dispatch(Actions.batchEnable(false));
|
||||
|
||||
let wait = waitForNetworkEvents(monitor, EXPECTED_REQUESTS.length);
|
||||
yield performRequests(2, HSTS_SJS);
|
||||
yield wait;
|
||||
await performRequests(2, HSTS_SJS);
|
||||
await wait;
|
||||
|
||||
// Fetch stack-trace data from the backend and wait till
|
||||
// all packets are received.
|
||||
@ -37,7 +37,7 @@ add_task(function* () {
|
||||
.filter((req) => !req.stacktrace)
|
||||
.map((req) => connector.requestData(req.id, "stackTrace"));
|
||||
|
||||
yield Promise.all(requests);
|
||||
await Promise.all(requests);
|
||||
|
||||
EXPECTED_REQUESTS.forEach(({status, hasStack}, i) => {
|
||||
let item = getSortedRequests(store.getState()).get(i);
|
||||
@ -57,13 +57,13 @@ add_task(function* () {
|
||||
|
||||
// Send a request to reset the HSTS policy to state before the test
|
||||
wait = waitForNetworkEvents(monitor, 1);
|
||||
yield performRequests(1, HSTS_SJS + "?reset");
|
||||
yield wait;
|
||||
await performRequests(1, HSTS_SJS + "?reset");
|
||||
await wait;
|
||||
|
||||
yield teardown(monitor);
|
||||
await teardown(monitor);
|
||||
|
||||
function performRequests(count, url) {
|
||||
return ContentTask.spawn(tab.linkedBrowser, { count, url }, function* (args) {
|
||||
return ContentTask.spawn(tab.linkedBrowser, { count, url }, async function (args) {
|
||||
content.wrappedJSObject.performRequests(args.count, args.url);
|
||||
});
|
||||
}
|
||||
|
@ -12,14 +12,14 @@ const CAUSE_URL = EXAMPLE_URL + CAUSE_FILE_NAME;
|
||||
|
||||
const N_EXPECTED_REQUESTS = 4;
|
||||
|
||||
add_task(function* () {
|
||||
add_task(async function () {
|
||||
// the initNetMonitor function clears the network request list after the
|
||||
// page is loaded. That's why we first load a bogus page from SIMPLE_URL,
|
||||
// and only then load the real thing from CAUSE_URL - we want to catch
|
||||
// all the requests the page is making, not only the XHRs.
|
||||
// We can't use about:blank here, because initNetMonitor checks that the
|
||||
// page has actually made at least one request.
|
||||
let { tab, monitor } = yield initNetMonitor(SIMPLE_URL);
|
||||
let { tab, monitor } = await initNetMonitor(SIMPLE_URL);
|
||||
|
||||
let { document, store, windowRequire } = monitor.panelWin;
|
||||
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
|
||||
@ -27,22 +27,22 @@ add_task(function* () {
|
||||
store.dispatch(Actions.batchEnable(false));
|
||||
let waitPromise = waitForNetworkEvents(monitor, N_EXPECTED_REQUESTS);
|
||||
tab.linkedBrowser.loadURI(CAUSE_URL);
|
||||
yield waitPromise;
|
||||
await waitPromise;
|
||||
|
||||
info("Clicking item and waiting for details panel to open");
|
||||
waitPromise = waitForDOM(document, ".network-details-panel");
|
||||
let xhrRequestItem = document.querySelectorAll(".request-list-item")[3];
|
||||
EventUtils.sendMouseEvent({ type: "mousedown" }, xhrRequestItem);
|
||||
yield waitPromise;
|
||||
await waitPromise;
|
||||
|
||||
info("Clicking stack tab and waiting for stack panel to open");
|
||||
waitPromise = waitForDOM(document, "#stack-trace-panel");
|
||||
let stackTab = document.querySelector("#stack-trace-tab");
|
||||
EventUtils.sendMouseEvent({ type: "click" }, stackTab);
|
||||
yield waitPromise;
|
||||
await waitPromise;
|
||||
|
||||
info("Waiting for source maps to be applied");
|
||||
yield waitUntil(() => {
|
||||
await waitUntil(() => {
|
||||
let frames = document.querySelectorAll(".frame-link");
|
||||
return frames && frames.length >= 2 &&
|
||||
frames[0].textContent.includes("xhr_original") &&
|
||||
@ -54,5 +54,5 @@ add_task(function* () {
|
||||
is(frames[0].textContent, `reallydoxhr xhr_original.js:6`);
|
||||
is(frames[1].textContent, `doxhr xhr_original.js:10`);
|
||||
|
||||
yield teardown(monitor);
|
||||
await teardown(monitor);
|
||||
});
|
||||
|
@ -7,8 +7,8 @@
|
||||
* Makes sure Pie Charts have the right internal structure.
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
let { monitor, tab } = yield initNetMonitor(SIMPLE_URL);
|
||||
add_task(async function () {
|
||||
let { monitor, tab } = await initNetMonitor(SIMPLE_URL);
|
||||
|
||||
info("Starting test... ");
|
||||
|
||||
@ -17,7 +17,7 @@ add_task(function* () {
|
||||
|
||||
let wait = waitForNetworkEvents(monitor, 1);
|
||||
tab.linkedBrowser.loadURI(SIMPLE_URL);
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
let pie = Chart.Pie(document, {
|
||||
width: 100,
|
||||
@ -75,5 +75,5 @@ add_task(function* () {
|
||||
is(labels[2].textContent, "foo",
|
||||
"The first label's text is correct.");
|
||||
|
||||
yield teardown(monitor);
|
||||
await teardown(monitor);
|
||||
});
|
||||
|
@ -8,10 +8,10 @@
|
||||
* initialized with empty data.
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
add_task(async function () {
|
||||
let { L10N } = require("devtools/client/netmonitor/src/utils/l10n");
|
||||
|
||||
let { monitor, tab } = yield initNetMonitor(SIMPLE_URL);
|
||||
let { monitor, tab } = await initNetMonitor(SIMPLE_URL);
|
||||
info("Starting test... ");
|
||||
|
||||
let { document, windowRequire } = monitor.panelWin;
|
||||
@ -19,7 +19,7 @@ add_task(function* () {
|
||||
|
||||
let wait = waitForNetworkEvents(monitor, 1);
|
||||
tab.linkedBrowser.loadURI(SIMPLE_URL);
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
let pie = Chart.Pie(document, {
|
||||
data: null,
|
||||
@ -50,5 +50,5 @@ add_task(function* () {
|
||||
is(labels.length, 1, "There should be 1 pie chart label created.");
|
||||
is(labels[0].textContent, "Loading", "The first label's text is correct.");
|
||||
|
||||
yield teardown(monitor);
|
||||
await teardown(monitor);
|
||||
});
|
||||
|
@ -7,10 +7,10 @@
|
||||
* Makes sure Table Charts have the right internal structure.
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
add_task(async function () {
|
||||
let { L10N } = require("devtools/client/netmonitor/src/utils/l10n");
|
||||
|
||||
let { monitor, tab } = yield initNetMonitor(SIMPLE_URL);
|
||||
let { monitor, tab } = await initNetMonitor(SIMPLE_URL);
|
||||
info("Starting test... ");
|
||||
|
||||
let { document, windowRequire } = monitor.panelWin;
|
||||
@ -18,7 +18,7 @@ add_task(function* () {
|
||||
|
||||
let wait = waitForNetworkEvents(monitor, 1);
|
||||
tab.linkedBrowser.loadURI(SIMPLE_URL);
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
let table = Chart.Table(document, {
|
||||
title: "Table title",
|
||||
@ -120,5 +120,5 @@ add_task(function* () {
|
||||
"World 36.60",
|
||||
"The second sum's value is correct.");
|
||||
|
||||
yield teardown(monitor);
|
||||
await teardown(monitor);
|
||||
});
|
||||
|
@ -8,10 +8,10 @@
|
||||
* initialized with empty data.
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
add_task(async function () {
|
||||
let { L10N } = require("devtools/client/netmonitor/src/utils/l10n");
|
||||
|
||||
let { monitor, tab } = yield initNetMonitor(SIMPLE_URL);
|
||||
let { monitor, tab } = await initNetMonitor(SIMPLE_URL);
|
||||
info("Starting test... ");
|
||||
|
||||
let { document, windowRequire } = monitor.panelWin;
|
||||
@ -19,7 +19,7 @@ add_task(function* () {
|
||||
|
||||
let wait = waitForNetworkEvents(monitor, 1);
|
||||
tab.linkedBrowser.loadURI(SIMPLE_URL);
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
let table = Chart.Table(document, {
|
||||
title: "Table title",
|
||||
@ -80,5 +80,5 @@ add_task(function* () {
|
||||
"World 0",
|
||||
"The second sum's value is correct.");
|
||||
|
||||
yield teardown(monitor);
|
||||
await teardown(monitor);
|
||||
});
|
||||
|
@ -7,10 +7,10 @@
|
||||
* Makes sure Pie+Table Charts have the right internal structure.
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
add_task(async function () {
|
||||
let { L10N } = require("devtools/client/netmonitor/src/utils/l10n");
|
||||
|
||||
let { monitor, tab } = yield initNetMonitor(SIMPLE_URL);
|
||||
let { monitor, tab } = await initNetMonitor(SIMPLE_URL);
|
||||
info("Starting test... ");
|
||||
|
||||
let { document, windowRequire } = monitor.panelWin;
|
||||
@ -18,7 +18,7 @@ add_task(function* () {
|
||||
|
||||
let wait = waitForNetworkEvents(monitor, 1);
|
||||
tab.linkedBrowser.loadURI(SIMPLE_URL);
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
let chart = Chart.PieTable(document, {
|
||||
title: "Table title",
|
||||
@ -66,5 +66,5 @@ add_task(function* () {
|
||||
is(rows.length, 4, "There should be 3 table chart rows and 1 header created.");
|
||||
is(sums.length, 2, "There should be 2 total summaries and 1 header created.");
|
||||
|
||||
yield teardown(monitor);
|
||||
await teardown(monitor);
|
||||
});
|
||||
|
@ -7,10 +7,10 @@
|
||||
* Makes sure Pie Charts correctly handle empty source data.
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
add_task(async function () {
|
||||
let { L10N } = require("devtools/client/netmonitor/src/utils/l10n");
|
||||
|
||||
let { monitor, tab } = yield initNetMonitor(SIMPLE_URL);
|
||||
let { monitor, tab } = await initNetMonitor(SIMPLE_URL);
|
||||
info("Starting test... ");
|
||||
|
||||
let { document, windowRequire } = monitor.panelWin;
|
||||
@ -18,7 +18,7 @@ add_task(function* () {
|
||||
|
||||
let wait = waitForNetworkEvents(monitor, 1);
|
||||
tab.linkedBrowser.loadURI(SIMPLE_URL);
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
let pie = Chart.Pie(document, {
|
||||
data: [],
|
||||
@ -48,5 +48,5 @@ add_task(function* () {
|
||||
is(labels[0].textContent, "Empty",
|
||||
"The label's text is correct.");
|
||||
|
||||
yield teardown(monitor);
|
||||
await teardown(monitor);
|
||||
});
|
||||
|
@ -7,10 +7,10 @@
|
||||
* Makes sure Table Charts correctly handle empty source data.
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
add_task(async function () {
|
||||
let { L10N } = require("devtools/client/netmonitor/src/utils/l10n");
|
||||
|
||||
let { monitor, tab } = yield initNetMonitor(SIMPLE_URL);
|
||||
let { monitor, tab } = await initNetMonitor(SIMPLE_URL);
|
||||
info("Starting test... ");
|
||||
|
||||
let { document, windowRequire } = monitor.panelWin;
|
||||
@ -18,7 +18,7 @@ add_task(function* () {
|
||||
|
||||
let wait = waitForNetworkEvents(monitor, 1);
|
||||
tab.linkedBrowser.loadURI(SIMPLE_URL);
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
let table = Chart.Table(document, {
|
||||
data: [],
|
||||
@ -68,5 +68,5 @@ add_task(function* () {
|
||||
"World 0",
|
||||
"The second sum's value is correct.");
|
||||
|
||||
yield teardown(monitor);
|
||||
await teardown(monitor);
|
||||
});
|
||||
|
@ -7,8 +7,8 @@
|
||||
* Tests if the clear button empties the request menu.
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
let { tab, monitor } = yield initNetMonitor(SIMPLE_URL);
|
||||
add_task(async function () {
|
||||
let { tab, monitor } = await initNetMonitor(SIMPLE_URL);
|
||||
info("Starting test... ");
|
||||
|
||||
let { document, store, windowRequire } = monitor.panelWin;
|
||||
@ -24,7 +24,7 @@ add_task(function* () {
|
||||
// Load one request and assert it shows up in the list
|
||||
let onMonitorUpdated = waitForAllRequestsFinished(monitor);
|
||||
tab.linkedBrowser.reload();
|
||||
yield onMonitorUpdated;
|
||||
await onMonitorUpdated;
|
||||
|
||||
assertSingleRequestState();
|
||||
|
||||
@ -35,7 +35,7 @@ add_task(function* () {
|
||||
// Load a second request and make sure they still show up
|
||||
onMonitorUpdated = waitForAllRequestsFinished(monitor);
|
||||
tab.linkedBrowser.reload();
|
||||
yield onMonitorUpdated;
|
||||
await onMonitorUpdated;
|
||||
|
||||
assertSingleRequestState();
|
||||
|
||||
|
@ -7,8 +7,8 @@
|
||||
* Bug 1377094 - Test that all column headers have tooltips.
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
let { monitor } = yield initNetMonitor(SIMPLE_URL);
|
||||
add_task(async function () {
|
||||
let { monitor } = await initNetMonitor(SIMPLE_URL);
|
||||
info("Starting test... ");
|
||||
|
||||
let { document } = monitor.panelWin;
|
||||
@ -21,5 +21,5 @@ add_task(function* () {
|
||||
"The " + header.id + " header has the button text in its 'title' attribute.");
|
||||
}
|
||||
|
||||
yield teardown(monitor);
|
||||
await teardown(monitor);
|
||||
});
|
||||
|
@ -8,8 +8,8 @@
|
||||
* displayed correctly.
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
let { tab, monitor } = yield initNetMonitor(PARAMS_URL);
|
||||
add_task(async function () {
|
||||
let { tab, monitor } = await initNetMonitor(PARAMS_URL);
|
||||
info("Starting test... ");
|
||||
|
||||
let { document, store, windowRequire } = monitor.panelWin;
|
||||
@ -19,41 +19,41 @@ add_task(function* () {
|
||||
store.dispatch(Actions.batchEnable(false));
|
||||
|
||||
let wait = waitForNetworkEvents(monitor, 7);
|
||||
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
|
||||
await ContentTask.spawn(tab.linkedBrowser, {}, async function () {
|
||||
content.wrappedJSObject.performRequests();
|
||||
});
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
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;
|
||||
await wait;
|
||||
testParamsTab1("a", "", '{ "foo": "bar" }', "");
|
||||
|
||||
wait = waitForDOM(document, "#params-panel .tree-section", 2);
|
||||
EventUtils.sendMouseEvent({ type: "mousedown" },
|
||||
document.querySelectorAll(".request-list-item")[1]);
|
||||
yield wait;
|
||||
await wait;
|
||||
testParamsTab1("a", "b", '{ "foo": "bar" }', "");
|
||||
|
||||
wait = waitForDOM(document, "#params-panel .tree-section", 2);
|
||||
EventUtils.sendMouseEvent({ type: "mousedown" },
|
||||
document.querySelectorAll(".request-list-item")[2]);
|
||||
yield wait;
|
||||
await wait;
|
||||
testParamsTab1("a", "b", "?foo", "bar");
|
||||
|
||||
wait = waitForDOM(document, "#params-panel tr:not(.tree-section).treeRow", 2);
|
||||
EventUtils.sendMouseEvent({ type: "mousedown" },
|
||||
document.querySelectorAll(".request-list-item")[3]);
|
||||
yield wait;
|
||||
await wait;
|
||||
testParamsTab2("a", "", '{ "foo": "bar" }', "js");
|
||||
|
||||
wait = waitForDOM(document, "#params-panel tr:not(.tree-section).treeRow", 2);
|
||||
EventUtils.sendMouseEvent({ type: "mousedown" },
|
||||
document.querySelectorAll(".request-list-item")[4]);
|
||||
yield wait;
|
||||
await wait;
|
||||
testParamsTab2("a", "b", '{ "foo": "bar" }', "js");
|
||||
|
||||
// Wait for all tree sections and editor updated by react
|
||||
@ -61,14 +61,14 @@ add_task(function* () {
|
||||
let waitSourceEditor = waitForDOM(document, "#params-panel .CodeMirror-code");
|
||||
EventUtils.sendMouseEvent({ type: "mousedown" },
|
||||
document.querySelectorAll(".request-list-item")[5]);
|
||||
yield Promise.all([waitSections, waitSourceEditor]);
|
||||
await Promise.all([waitSections, waitSourceEditor]);
|
||||
testParamsTab2("a", "b", "?foo=bar", "text");
|
||||
|
||||
EventUtils.sendMouseEvent({ type: "mousedown" },
|
||||
document.querySelectorAll(".request-list-item")[6]);
|
||||
testParamsTab3();
|
||||
|
||||
yield teardown(monitor);
|
||||
await teardown(monitor);
|
||||
|
||||
function testParamsTab1(queryStringParamName, queryStringParamValue,
|
||||
formDataParamName, formDataParamValue) {
|
||||
|
@ -7,8 +7,8 @@
|
||||
* Tests if different response content types are handled correctly.
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
let { tab, monitor } = yield initNetMonitor(CONTENT_TYPE_WITHOUT_CACHE_URL);
|
||||
add_task(async function () {
|
||||
let { tab, monitor } = await initNetMonitor(CONTENT_TYPE_WITHOUT_CACHE_URL);
|
||||
info("Starting test... ");
|
||||
|
||||
let { document, store, windowRequire } = monitor.panelWin;
|
||||
@ -22,16 +22,16 @@ add_task(function* () {
|
||||
store.dispatch(Actions.batchEnable(false));
|
||||
|
||||
let wait = waitForNetworkEvents(monitor, CONTENT_TYPE_WITHOUT_CACHE_REQUESTS);
|
||||
yield ContentTask.spawn(tab.linkedBrowser, {}, function () {
|
||||
await ContentTask.spawn(tab.linkedBrowser, {}, function () {
|
||||
content.wrappedJSObject.performRequests();
|
||||
});
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
for (let requestItem of document.querySelectorAll(".request-list-item")) {
|
||||
let requestsListStatus = requestItem.querySelector(".requests-list-status");
|
||||
requestItem.scrollIntoView();
|
||||
EventUtils.sendMouseEvent({ type: "mouseover" }, requestsListStatus);
|
||||
yield waitUntil(() => requestsListStatus.title);
|
||||
await waitUntil(() => requestsListStatus.title);
|
||||
}
|
||||
|
||||
verifyRequestItemTarget(
|
||||
@ -142,30 +142,30 @@ add_task(function* () {
|
||||
}
|
||||
);
|
||||
|
||||
yield selectIndexAndWaitForSourceEditor(monitor, 0);
|
||||
yield testResponseTab("xml");
|
||||
await selectIndexAndWaitForSourceEditor(monitor, 0);
|
||||
await testResponseTab("xml");
|
||||
|
||||
yield selectIndexAndWaitForSourceEditor(monitor, 1);
|
||||
yield testResponseTab("css");
|
||||
await selectIndexAndWaitForSourceEditor(monitor, 1);
|
||||
await testResponseTab("css");
|
||||
|
||||
yield selectIndexAndWaitForSourceEditor(monitor, 2);
|
||||
yield testResponseTab("js");
|
||||
await selectIndexAndWaitForSourceEditor(monitor, 2);
|
||||
await testResponseTab("js");
|
||||
|
||||
yield selectIndexAndWaitForJSONView(3);
|
||||
yield testResponseTab("json");
|
||||
await selectIndexAndWaitForJSONView(3);
|
||||
await testResponseTab("json");
|
||||
|
||||
yield selectIndexAndWaitForSourceEditor(monitor, 4);
|
||||
yield testResponseTab("html");
|
||||
await selectIndexAndWaitForSourceEditor(monitor, 4);
|
||||
await testResponseTab("html");
|
||||
|
||||
yield selectIndexAndWaitForImageView(5);
|
||||
yield testResponseTab("png");
|
||||
await selectIndexAndWaitForImageView(5);
|
||||
await testResponseTab("png");
|
||||
|
||||
yield selectIndexAndWaitForSourceEditor(monitor, 6);
|
||||
yield testResponseTab("gzip");
|
||||
await selectIndexAndWaitForSourceEditor(monitor, 6);
|
||||
await testResponseTab("gzip");
|
||||
|
||||
yield teardown(monitor);
|
||||
await teardown(monitor);
|
||||
|
||||
function* testResponseTab(type) {
|
||||
function testResponseTab(type) {
|
||||
let tabpanel = document.querySelector("#response-panel");
|
||||
|
||||
function checkVisibility(box) {
|
||||
@ -270,26 +270,26 @@ add_task(function* () {
|
||||
}
|
||||
}
|
||||
|
||||
function* selectIndexAndWaitForJSONView(index) {
|
||||
async function selectIndexAndWaitForJSONView(index) {
|
||||
let onResponseContent = monitor.panelWin.once(EVENTS.RECEIVED_RESPONSE_CONTENT);
|
||||
let tabpanel = document.querySelector("#response-panel");
|
||||
let waitDOM = waitForDOM(tabpanel, ".treeTable");
|
||||
store.dispatch(Actions.selectRequestByIndex(index));
|
||||
yield waitDOM;
|
||||
yield onResponseContent;
|
||||
await waitDOM;
|
||||
await onResponseContent;
|
||||
|
||||
// Waiting for RECEIVED_RESPONSE_CONTENT isn't enough.
|
||||
// DOM may not be fully updated yet and checkVisibility(json) may still fail.
|
||||
yield waitForTick();
|
||||
await waitForTick();
|
||||
}
|
||||
|
||||
function* selectIndexAndWaitForImageView(index) {
|
||||
async function selectIndexAndWaitForImageView(index) {
|
||||
let onResponseContent = monitor.panelWin.once(EVENTS.RECEIVED_RESPONSE_CONTENT);
|
||||
let tabpanel = document.querySelector("#response-panel");
|
||||
let waitDOM = waitForDOM(tabpanel, ".response-image");
|
||||
store.dispatch(Actions.selectRequestByIndex(index));
|
||||
let [imageNode] = yield waitDOM;
|
||||
yield once(imageNode, "load");
|
||||
yield onResponseContent;
|
||||
let [imageNode] = await waitDOM;
|
||||
await once(imageNode, "load");
|
||||
await onResponseContent;
|
||||
}
|
||||
});
|
||||
|
@ -6,8 +6,8 @@
|
||||
/**
|
||||
* Tests if Request-Cookies and Response-Cookies are sorted in Cookies tab.
|
||||
*/
|
||||
add_task(function* () {
|
||||
let { tab, monitor } = yield initNetMonitor(SIMPLE_UNSORTED_COOKIES_SJS);
|
||||
add_task(async function () {
|
||||
let { tab, monitor } = await initNetMonitor(SIMPLE_UNSORTED_COOKIES_SJS);
|
||||
info("Starting test... ");
|
||||
|
||||
let { document, store, windowRequire } = monitor.panelWin;
|
||||
@ -18,12 +18,12 @@ add_task(function* () {
|
||||
tab.linkedBrowser.reload();
|
||||
|
||||
let wait = waitForNetworkEvents(monitor, 1);
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
wait = waitForDOM(document, ".headers-overview");
|
||||
EventUtils.sendMouseEvent({ type: "mousedown" },
|
||||
document.querySelectorAll(".request-list-item")[0]);
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
EventUtils.sendMouseEvent({ type: "mousedown" },
|
||||
document.querySelectorAll(".request-list-item")[0]);
|
||||
@ -40,5 +40,5 @@ add_task(function* () {
|
||||
"Actual label value " + val.innerText + " not equal to expected label value "
|
||||
+ expectedLabelValues[index]);
|
||||
});
|
||||
yield teardown(monitor);
|
||||
await teardown(monitor);
|
||||
});
|
||||
|
@ -7,8 +7,8 @@
|
||||
* Tests if Copy as cURL works.
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
let { tab, monitor } = yield initNetMonitor(CURL_URL);
|
||||
add_task(async function () {
|
||||
let { tab, monitor } = await initNetMonitor(CURL_URL);
|
||||
info("Starting test... ");
|
||||
|
||||
// Different quote chars are used for Windows and POSIX
|
||||
@ -44,17 +44,17 @@ add_task(function* () {
|
||||
let { document } = monitor.panelWin;
|
||||
|
||||
let wait = waitForNetworkEvents(monitor, 1);
|
||||
yield ContentTask.spawn(tab.linkedBrowser, SIMPLE_SJS, function* (url) {
|
||||
await ContentTask.spawn(tab.linkedBrowser, SIMPLE_SJS, async function (url) {
|
||||
content.wrappedJSObject.performRequest(url);
|
||||
});
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
EventUtils.sendMouseEvent({ type: "mousedown" },
|
||||
document.querySelectorAll(".request-list-item")[0]);
|
||||
EventUtils.sendMouseEvent({ type: "contextmenu" },
|
||||
document.querySelectorAll(".request-list-item")[0]);
|
||||
|
||||
yield waitForClipboardPromise(function setup() {
|
||||
await waitForClipboardPromise(function setup() {
|
||||
monitor.panelWin.parent.document
|
||||
.querySelector("#request-list-context-copy-as-curl").click();
|
||||
}, function validate(result) {
|
||||
@ -85,5 +85,5 @@ add_task(function* () {
|
||||
|
||||
info("Clipboard contains a cURL command for the currently selected item's url.");
|
||||
|
||||
yield teardown(monitor);
|
||||
await teardown(monitor);
|
||||
});
|
||||
|
@ -7,8 +7,8 @@
|
||||
* Tests if copying a request's request/response headers works.
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
let { tab, monitor } = yield initNetMonitor(SIMPLE_URL);
|
||||
add_task(async function () {
|
||||
let { tab, monitor } = await initNetMonitor(SIMPLE_URL);
|
||||
info("Starting test... ");
|
||||
|
||||
let { document, store, windowRequire } = monitor.panelWin;
|
||||
@ -19,7 +19,7 @@ add_task(function* () {
|
||||
|
||||
let wait = waitForNetworkEvents(monitor, 1);
|
||||
tab.linkedBrowser.reload();
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
EventUtils.sendMouseEvent({ type: "mousedown" },
|
||||
document.querySelectorAll(".request-list-item")[0]);
|
||||
@ -46,7 +46,7 @@ add_task(function* () {
|
||||
"Cache-Control: no-cache"
|
||||
].join("\n");
|
||||
|
||||
yield waitForClipboardPromise(function setup() {
|
||||
await waitForClipboardPromise(function setup() {
|
||||
monitor.panelWin.parent.document
|
||||
.querySelector("#request-list-context-copy-request-headers").click();
|
||||
}, function validate(result) {
|
||||
@ -69,7 +69,7 @@ add_task(function* () {
|
||||
EventUtils.sendMouseEvent({ type: "contextmenu" },
|
||||
document.querySelectorAll(".request-list-item")[0]);
|
||||
|
||||
yield waitForClipboardPromise(function setup() {
|
||||
await waitForClipboardPromise(function setup() {
|
||||
monitor.panelWin.parent.document
|
||||
.querySelector("#response-list-context-copy-response-headers").click();
|
||||
}, function validate(result) {
|
||||
@ -81,5 +81,5 @@ add_task(function* () {
|
||||
});
|
||||
info("Clipboard contains the currently selected item's response headers.");
|
||||
|
||||
yield teardown(monitor);
|
||||
await teardown(monitor);
|
||||
});
|
||||
|
@ -7,29 +7,29 @@
|
||||
* Tests if copying an image as data uri works.
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
let { tab, monitor } = yield initNetMonitor(CONTENT_TYPE_WITHOUT_CACHE_URL);
|
||||
add_task(async function () {
|
||||
let { tab, monitor } = await initNetMonitor(CONTENT_TYPE_WITHOUT_CACHE_URL);
|
||||
info("Starting test... ");
|
||||
|
||||
let { document } = monitor.panelWin;
|
||||
|
||||
let wait = waitForNetworkEvents(monitor, CONTENT_TYPE_WITHOUT_CACHE_REQUESTS);
|
||||
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
|
||||
await ContentTask.spawn(tab.linkedBrowser, {}, async function () {
|
||||
content.wrappedJSObject.performRequests();
|
||||
});
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
EventUtils.sendMouseEvent({ type: "mousedown" },
|
||||
document.querySelectorAll(".request-list-item")[5]);
|
||||
EventUtils.sendMouseEvent({ type: "contextmenu" },
|
||||
document.querySelectorAll(".request-list-item")[5]);
|
||||
|
||||
yield waitForClipboardPromise(function setup() {
|
||||
await waitForClipboardPromise(function setup() {
|
||||
monitor.panelWin.parent.document
|
||||
.querySelector("#request-list-context-copy-image-as-data-uri").click();
|
||||
}, TEST_IMAGE_DATA_URI);
|
||||
|
||||
ok(true, "Clipboard contains the currently selected image as data uri.");
|
||||
|
||||
yield teardown(monitor);
|
||||
await teardown(monitor);
|
||||
});
|
||||
|
@ -7,8 +7,8 @@
|
||||
* Tests whether copying a request item's parameters works.
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
let { tab, monitor } = yield initNetMonitor(PARAMS_URL);
|
||||
add_task(async function () {
|
||||
let { tab, monitor } = await initNetMonitor(PARAMS_URL);
|
||||
info("Starting test... ");
|
||||
|
||||
let { document, store, windowRequire } = monitor.panelWin;
|
||||
@ -17,43 +17,43 @@ add_task(function* () {
|
||||
store.dispatch(Actions.batchEnable(false));
|
||||
|
||||
let wait = waitForNetworkEvents(monitor, 7);
|
||||
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
|
||||
await ContentTask.spawn(tab.linkedBrowser, {}, async function () {
|
||||
content.wrappedJSObject.performRequests();
|
||||
});
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
yield testCopyUrlParamsHidden(0, false);
|
||||
yield testCopyUrlParams(0, "a");
|
||||
yield testCopyPostDataHidden(0, false);
|
||||
yield testCopyPostData(0, "{ \"foo\": \"bar\" }");
|
||||
await testCopyUrlParamsHidden(0, false);
|
||||
await testCopyUrlParams(0, "a");
|
||||
await testCopyPostDataHidden(0, false);
|
||||
await testCopyPostData(0, "{ \"foo\": \"bar\" }");
|
||||
|
||||
yield testCopyUrlParamsHidden(1, false);
|
||||
yield testCopyUrlParams(1, "a=b");
|
||||
yield testCopyPostDataHidden(1, false);
|
||||
yield testCopyPostData(1, "{ \"foo\": \"bar\" }");
|
||||
await testCopyUrlParamsHidden(1, false);
|
||||
await testCopyUrlParams(1, "a=b");
|
||||
await testCopyPostDataHidden(1, false);
|
||||
await testCopyPostData(1, "{ \"foo\": \"bar\" }");
|
||||
|
||||
yield testCopyUrlParamsHidden(2, false);
|
||||
yield testCopyUrlParams(2, "a=b");
|
||||
yield testCopyPostDataHidden(2, false);
|
||||
yield testCopyPostData(2, "foo=bar");
|
||||
await testCopyUrlParamsHidden(2, false);
|
||||
await testCopyUrlParams(2, "a=b");
|
||||
await testCopyPostDataHidden(2, false);
|
||||
await testCopyPostData(2, "foo=bar");
|
||||
|
||||
yield testCopyUrlParamsHidden(3, false);
|
||||
yield testCopyUrlParams(3, "a");
|
||||
yield testCopyPostDataHidden(3, false);
|
||||
yield testCopyPostData(3, "{ \"foo\": \"bar\" }");
|
||||
await testCopyUrlParamsHidden(3, false);
|
||||
await testCopyUrlParams(3, "a");
|
||||
await testCopyPostDataHidden(3, false);
|
||||
await testCopyPostData(3, "{ \"foo\": \"bar\" }");
|
||||
|
||||
yield testCopyUrlParamsHidden(4, false);
|
||||
yield testCopyUrlParams(4, "a=b");
|
||||
yield testCopyPostDataHidden(4, false);
|
||||
yield testCopyPostData(4, "{ \"foo\": \"bar\" }");
|
||||
await testCopyUrlParamsHidden(4, false);
|
||||
await testCopyUrlParams(4, "a=b");
|
||||
await testCopyPostDataHidden(4, false);
|
||||
await testCopyPostData(4, "{ \"foo\": \"bar\" }");
|
||||
|
||||
yield testCopyUrlParamsHidden(5, false);
|
||||
yield testCopyUrlParams(5, "a=b");
|
||||
yield testCopyPostDataHidden(5, false);
|
||||
yield testCopyPostData(5, "?foo=bar");
|
||||
await testCopyUrlParamsHidden(5, false);
|
||||
await testCopyUrlParams(5, "a=b");
|
||||
await testCopyPostDataHidden(5, false);
|
||||
await testCopyPostData(5, "?foo=bar");
|
||||
|
||||
yield testCopyUrlParamsHidden(6, true);
|
||||
yield testCopyPostDataHidden(6, true);
|
||||
await testCopyUrlParamsHidden(6, true);
|
||||
await testCopyPostDataHidden(6, true);
|
||||
|
||||
return teardown(monitor);
|
||||
|
||||
@ -69,12 +69,12 @@ add_task(function* () {
|
||||
"be hidden.");
|
||||
}
|
||||
|
||||
function* testCopyUrlParams(index, queryString) {
|
||||
async function testCopyUrlParams(index, queryString) {
|
||||
EventUtils.sendMouseEvent({ type: "mousedown" },
|
||||
document.querySelectorAll(".request-list-item")[index]);
|
||||
EventUtils.sendMouseEvent({ type: "contextmenu" },
|
||||
document.querySelectorAll(".request-list-item")[index]);
|
||||
yield waitForClipboardPromise(function setup() {
|
||||
await waitForClipboardPromise(function setup() {
|
||||
monitor.panelWin.parent.document
|
||||
.querySelector("#request-list-context-copy-url-params").click();
|
||||
}, queryString);
|
||||
@ -93,10 +93,10 @@ add_task(function* () {
|
||||
"be hidden.");
|
||||
}
|
||||
|
||||
function* testCopyPostData(index, postData) {
|
||||
async function testCopyPostData(index, postData) {
|
||||
// Wait for formDataSections and requestPostData state are ready in redux store
|
||||
// since copyPostData API needs to read these state.
|
||||
yield waitUntil(() => {
|
||||
await waitUntil(() => {
|
||||
let { requests } = store.getState().requests;
|
||||
let actIDs = [...requests.keys()];
|
||||
let { formDataSections, requestPostData } = requests.get(actIDs[index]);
|
||||
@ -106,7 +106,7 @@ add_task(function* () {
|
||||
document.querySelectorAll(".request-list-item")[index]);
|
||||
EventUtils.sendMouseEvent({ type: "contextmenu" },
|
||||
document.querySelectorAll(".request-list-item")[index]);
|
||||
yield waitForClipboardPromise(function setup() {
|
||||
await waitForClipboardPromise(function setup() {
|
||||
monitor.panelWin.parent.document
|
||||
.querySelector("#request-list-context-copy-post-data").click();
|
||||
}, postData);
|
||||
|
@ -7,8 +7,8 @@
|
||||
* Tests if copying a request's response works.
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
let { tab, monitor } = yield initNetMonitor(CONTENT_TYPE_WITHOUT_CACHE_URL);
|
||||
add_task(async function () {
|
||||
let { tab, monitor } = await initNetMonitor(CONTENT_TYPE_WITHOUT_CACHE_URL);
|
||||
info("Starting test... ");
|
||||
|
||||
const EXPECTED_RESULT = '{ "greeting": "Hello JSON!" }';
|
||||
@ -16,20 +16,20 @@ add_task(function* () {
|
||||
let { document } = monitor.panelWin;
|
||||
|
||||
let wait = waitForNetworkEvents(monitor, CONTENT_TYPE_WITHOUT_CACHE_REQUESTS);
|
||||
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
|
||||
await ContentTask.spawn(tab.linkedBrowser, {}, async function () {
|
||||
content.wrappedJSObject.performRequests();
|
||||
});
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
EventUtils.sendMouseEvent({ type: "mousedown" },
|
||||
document.querySelectorAll(".request-list-item")[3]);
|
||||
EventUtils.sendMouseEvent({ type: "contextmenu" },
|
||||
document.querySelectorAll(".request-list-item")[3]);
|
||||
|
||||
yield waitForClipboardPromise(function setup() {
|
||||
await waitForClipboardPromise(function setup() {
|
||||
monitor.panelWin.parent.document
|
||||
.querySelector("#request-list-context-copy-response").click();
|
||||
}, EXPECTED_RESULT);
|
||||
|
||||
yield teardown(monitor);
|
||||
await teardown(monitor);
|
||||
});
|
||||
|
@ -9,29 +9,29 @@
|
||||
|
||||
const SVG_URL = EXAMPLE_URL + "dropmarker.svg";
|
||||
|
||||
add_task(function* () {
|
||||
let { tab, monitor } = yield initNetMonitor(CURL_URL);
|
||||
add_task(async function () {
|
||||
let { tab, monitor } = await initNetMonitor(CURL_URL);
|
||||
info("Starting test... ");
|
||||
|
||||
let { document } = monitor.panelWin;
|
||||
|
||||
let wait = waitForNetworkEvents(monitor, 1);
|
||||
yield ContentTask.spawn(tab.linkedBrowser, SVG_URL, function* (url) {
|
||||
await ContentTask.spawn(tab.linkedBrowser, SVG_URL, async function (url) {
|
||||
content.wrappedJSObject.performRequest(url);
|
||||
});
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
EventUtils.sendMouseEvent({ type: "mousedown" },
|
||||
document.querySelectorAll(".request-list-item")[0]);
|
||||
EventUtils.sendMouseEvent({ type: "contextmenu" },
|
||||
document.querySelectorAll(".request-list-item")[0]);
|
||||
|
||||
yield waitForClipboardPromise(function setup() {
|
||||
await waitForClipboardPromise(function setup() {
|
||||
monitor.panelWin.parent.document
|
||||
.querySelector("#request-list-context-copy-image-as-data-uri").click();
|
||||
}, function check(text) {
|
||||
return text.startsWith("data:") && !/undefined/.test(text);
|
||||
});
|
||||
|
||||
yield teardown(monitor);
|
||||
await teardown(monitor);
|
||||
});
|
||||
|
@ -7,8 +7,8 @@
|
||||
* Tests if copying a request's url works.
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
let { tab, monitor } = yield initNetMonitor(CUSTOM_GET_URL);
|
||||
add_task(async function () {
|
||||
let { tab, monitor } = await initNetMonitor(CUSTOM_GET_URL);
|
||||
info("Starting test... ");
|
||||
|
||||
let { document, store, windowRequire } = monitor.panelWin;
|
||||
@ -17,10 +17,10 @@ add_task(function* () {
|
||||
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
|
||||
|
||||
let wait = waitForNetworkEvents(monitor, 1);
|
||||
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
|
||||
await ContentTask.spawn(tab.linkedBrowser, {}, async function () {
|
||||
content.wrappedJSObject.performRequests(1);
|
||||
});
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
EventUtils.sendMouseEvent({ type: "mousedown" },
|
||||
document.querySelectorAll(".request-list-item")[0]);
|
||||
@ -29,10 +29,10 @@ add_task(function* () {
|
||||
|
||||
let requestItem = getSortedRequests(store.getState()).get(0);
|
||||
|
||||
yield waitForClipboardPromise(function setup() {
|
||||
await waitForClipboardPromise(function setup() {
|
||||
monitor.panelWin.parent.document
|
||||
.querySelector("#request-list-context-copy-url").click();
|
||||
}, requestItem.url);
|
||||
|
||||
yield teardown(monitor);
|
||||
await teardown(monitor);
|
||||
});
|
||||
|
@ -7,8 +7,8 @@
|
||||
* Test that CORS preflight requests are displayed by network monitor
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
let { tab, monitor } = yield initNetMonitor(CORS_URL);
|
||||
add_task(async function () {
|
||||
let { tab, monitor } = await initNetMonitor(CORS_URL);
|
||||
|
||||
let { document, store, windowRequire } = monitor.panelWin;
|
||||
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
|
||||
@ -23,12 +23,12 @@ add_task(function* () {
|
||||
|
||||
info("Performing a CORS request");
|
||||
let requestUrl = "http://test1.example.com" + CORS_SJS_PATH;
|
||||
yield ContentTask.spawn(tab.linkedBrowser, requestUrl, function* (url) {
|
||||
await ContentTask.spawn(tab.linkedBrowser, requestUrl, async function (url) {
|
||||
content.wrappedJSObject.performRequests(url, "triggering/preflight", "post-data");
|
||||
});
|
||||
|
||||
info("Waiting until the requests appear in netmonitor");
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
info("Checking the preflight and flight methods");
|
||||
["OPTIONS", "POST"].forEach((method, index) => {
|
||||
@ -41,5 +41,5 @@ add_task(function* () {
|
||||
);
|
||||
});
|
||||
|
||||
yield teardown(monitor);
|
||||
await teardown(monitor);
|
||||
});
|
||||
|
@ -9,8 +9,8 @@
|
||||
|
||||
const { Curl, CurlUtils } = require("devtools/client/shared/curl");
|
||||
|
||||
add_task(function* () {
|
||||
let { tab, monitor } = yield initNetMonitor(CURL_UTILS_URL);
|
||||
add_task(async function () {
|
||||
let { tab, monitor } = await initNetMonitor(CURL_UTILS_URL);
|
||||
info("Starting test... ");
|
||||
|
||||
let { store, windowRequire, connector } = monitor.panelWin;
|
||||
@ -26,10 +26,10 @@ add_task(function* () {
|
||||
store.dispatch(Actions.batchEnable(false));
|
||||
|
||||
let wait = waitForNetworkEvents(monitor, 5);
|
||||
yield ContentTask.spawn(tab.linkedBrowser, SIMPLE_SJS, function* (url) {
|
||||
await ContentTask.spawn(tab.linkedBrowser, SIMPLE_SJS, async function (url) {
|
||||
content.wrappedJSObject.performRequests(url);
|
||||
});
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
let requests = {
|
||||
get: getSortedRequests(store.getState()).get(0),
|
||||
@ -39,26 +39,26 @@ add_task(function* () {
|
||||
multipartForm: getSortedRequests(store.getState()).get(4),
|
||||
};
|
||||
|
||||
let data = yield createCurlData(requests.get, getLongString, requestData);
|
||||
let data = await createCurlData(requests.get, getLongString, requestData);
|
||||
testFindHeader(data);
|
||||
|
||||
data = yield createCurlData(requests.post, getLongString, requestData);
|
||||
data = await createCurlData(requests.post, getLongString, requestData);
|
||||
testIsUrlEncodedRequest(data);
|
||||
testWritePostDataTextParams(data);
|
||||
testWriteEmptyPostDataTextParams(data);
|
||||
testDataArgumentOnGeneratedCommand(data);
|
||||
|
||||
data = yield createCurlData(requests.patch, getLongString, requestData);
|
||||
data = await createCurlData(requests.patch, getLongString, requestData);
|
||||
testWritePostDataTextParams(data);
|
||||
testDataArgumentOnGeneratedCommand(data);
|
||||
|
||||
data = yield createCurlData(requests.multipart, getLongString, requestData);
|
||||
data = await createCurlData(requests.multipart, getLongString, requestData);
|
||||
testIsMultipartRequest(data);
|
||||
testGetMultipartBoundary(data);
|
||||
testMultiPartHeaders(data);
|
||||
testRemoveBinaryDataFromMultipartText(data);
|
||||
|
||||
data = yield createCurlData(requests.multipartForm, getLongString, requestData);
|
||||
data = await createCurlData(requests.multipartForm, getLongString, requestData);
|
||||
testMultiPartHeaders(data);
|
||||
|
||||
testGetHeadersFromMultipartText({
|
||||
@ -71,7 +71,7 @@ add_task(function* () {
|
||||
testEscapeStringWin();
|
||||
}
|
||||
|
||||
yield teardown(monitor);
|
||||
await teardown(monitor);
|
||||
});
|
||||
|
||||
function testIsUrlEncodedRequest(data) {
|
||||
@ -239,7 +239,7 @@ function testEscapeStringWin() {
|
||||
"Newlines should be escaped.");
|
||||
}
|
||||
|
||||
function* createCurlData(selected, getLongString, requestData) {
|
||||
async function createCurlData(selected, getLongString, requestData) {
|
||||
let { id, url, method, httpVersion } = selected;
|
||||
|
||||
// Create a sanitized object for the Curl command generator.
|
||||
@ -251,18 +251,18 @@ function* createCurlData(selected, getLongString, requestData) {
|
||||
postDataText: null
|
||||
};
|
||||
|
||||
let requestHeaders = yield requestData(id, "requestHeaders");
|
||||
let requestHeaders = await requestData(id, "requestHeaders");
|
||||
// Fetch header values.
|
||||
for (let { name, value } of requestHeaders.headers) {
|
||||
let text = yield getLongString(value);
|
||||
let text = await getLongString(value);
|
||||
data.headers.push({ name: name, value: text });
|
||||
}
|
||||
|
||||
let { requestPostData } = yield requestData(id, "requestPostData");
|
||||
let { requestPostData } = await requestData(id, "requestPostData");
|
||||
// Fetch the request payload.
|
||||
if (requestPostData) {
|
||||
let postData = requestPostData.postData.text;
|
||||
data.postDataText = yield getLongString(postData);
|
||||
data.postDataText = await getLongString(postData);
|
||||
}
|
||||
|
||||
return data;
|
||||
|
@ -7,8 +7,8 @@
|
||||
* Tests if cyrillic text is rendered correctly in the source editor.
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
let { tab, monitor } = yield initNetMonitor(CYRILLIC_URL);
|
||||
add_task(async function () {
|
||||
let { tab, monitor } = await initNetMonitor(CYRILLIC_URL);
|
||||
info("Starting test... ");
|
||||
|
||||
let { document, store, windowRequire } = monitor.panelWin;
|
||||
@ -21,16 +21,16 @@ add_task(function* () {
|
||||
store.dispatch(Actions.batchEnable(false));
|
||||
|
||||
let wait = waitForNetworkEvents(monitor, 1);
|
||||
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
|
||||
await ContentTask.spawn(tab.linkedBrowser, {}, async function () {
|
||||
content.wrappedJSObject.performRequests();
|
||||
});
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
let requestItem = document.querySelectorAll(".request-list-item")[0];
|
||||
let requestsListStatus = requestItem.querySelector(".requests-list-status");
|
||||
requestItem.scrollIntoView();
|
||||
EventUtils.sendMouseEvent({ type: "mouseover" }, requestsListStatus);
|
||||
yield waitUntil(() => requestsListStatus.title);
|
||||
await waitUntil(() => requestsListStatus.title);
|
||||
|
||||
verifyRequestItemTarget(
|
||||
document,
|
||||
@ -47,11 +47,11 @@ add_task(function* () {
|
||||
wait = waitForDOM(document, "#headers-panel");
|
||||
EventUtils.sendMouseEvent({ type: "mousedown" },
|
||||
document.querySelectorAll(".request-list-item")[0]);
|
||||
yield wait;
|
||||
await wait;
|
||||
wait = waitForDOM(document, "#response-panel .CodeMirror-code");
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector("#response-tab"));
|
||||
yield wait;
|
||||
await wait;
|
||||
let text = document.querySelector(".CodeMirror-line").textContent;
|
||||
|
||||
ok(text.includes("\u0411\u0440\u0430\u0442\u0430\u043d"),
|
||||
|
@ -8,8 +8,8 @@
|
||||
* when loaded directly from an HTML page.
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
let { tab, monitor } = yield initNetMonitor(CYRILLIC_URL);
|
||||
add_task(async function () {
|
||||
let { tab, monitor } = await initNetMonitor(CYRILLIC_URL);
|
||||
info("Starting test... ");
|
||||
|
||||
let { document, store, windowRequire } = monitor.panelWin;
|
||||
@ -20,13 +20,13 @@ add_task(function* () {
|
||||
|
||||
let wait = waitForNetworkEvents(monitor, 1);
|
||||
tab.linkedBrowser.reload();
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
let requestItem = document.querySelectorAll(".request-list-item")[0];
|
||||
let requestsListStatus = requestItem.querySelector(".requests-list-status");
|
||||
requestItem.scrollIntoView();
|
||||
EventUtils.sendMouseEvent({ type: "mouseover" }, requestsListStatus);
|
||||
yield waitUntil(() => requestsListStatus.title);
|
||||
await waitUntil(() => requestsListStatus.title);
|
||||
|
||||
verifyRequestItemTarget(
|
||||
document,
|
||||
@ -42,11 +42,11 @@ add_task(function* () {
|
||||
wait = waitForDOM(document, "#headers-panel");
|
||||
EventUtils.sendMouseEvent({ type: "mousedown" },
|
||||
document.querySelectorAll(".request-list-item")[0]);
|
||||
yield wait;
|
||||
await wait;
|
||||
wait = waitForDOM(document, "#response-panel .CodeMirror-code");
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector("#response-tab"));
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
// CodeMirror will only load lines currently in view to the DOM. getValue()
|
||||
// retrieves all lines pending render after a user begins scrolling.
|
||||
|
@ -128,8 +128,8 @@ const EXPECTED_REQUESTS = [
|
||||
}
|
||||
];
|
||||
|
||||
add_task(function* () {
|
||||
let { monitor } = yield initNetMonitor(FILTERING_URL);
|
||||
add_task(async function () {
|
||||
let { monitor } = await initNetMonitor(FILTERING_URL);
|
||||
let { document, store, windowRequire } = monitor.panelWin;
|
||||
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
|
||||
let {
|
||||
@ -148,8 +148,8 @@ add_task(function* () {
|
||||
|
||||
let wait = waitForNetworkEvents(monitor, 9);
|
||||
loadCommonFrameScript();
|
||||
yield performRequestsInContent(REQUESTS_WITH_MEDIA_AND_FLASH_AND_WS);
|
||||
yield wait;
|
||||
await performRequestsInContent(REQUESTS_WITH_MEDIA_AND_FLASH_AND_WS);
|
||||
await wait;
|
||||
|
||||
EventUtils.sendMouseEvent({ type: "mousedown" },
|
||||
document.querySelectorAll(".request-list-item")[0]);
|
||||
@ -163,12 +163,12 @@ add_task(function* () {
|
||||
|
||||
// First test with single filters...
|
||||
testFilterButtons(monitor, "all");
|
||||
yield testContents([1, 1, 1, 1, 1, 1, 1, 1, 1]);
|
||||
await testContents([1, 1, 1, 1, 1, 1, 1, 1, 1]);
|
||||
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector(".requests-list-filter-html-button"));
|
||||
testFilterButtons(monitor, "html");
|
||||
yield testContents([1, 0, 0, 0, 0, 0, 0, 0, 0]);
|
||||
await testContents([1, 0, 0, 0, 0, 0, 0, 0, 0]);
|
||||
|
||||
// Reset filters
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
@ -176,79 +176,79 @@ add_task(function* () {
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector(".requests-list-filter-css-button"));
|
||||
testFilterButtons(monitor, "css");
|
||||
yield testContents([0, 1, 0, 0, 0, 0, 0, 0, 0]);
|
||||
await testContents([0, 1, 0, 0, 0, 0, 0, 0, 0]);
|
||||
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector(".requests-list-filter-all-button"));
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector(".requests-list-filter-js-button"));
|
||||
testFilterButtons(monitor, "js");
|
||||
yield testContents([0, 0, 1, 0, 0, 0, 0, 0, 0]);
|
||||
await testContents([0, 0, 1, 0, 0, 0, 0, 0, 0]);
|
||||
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector(".requests-list-filter-all-button"));
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector(".requests-list-filter-xhr-button"));
|
||||
testFilterButtons(monitor, "xhr");
|
||||
yield testContents([1, 1, 1, 1, 1, 1, 1, 1, 0]);
|
||||
await testContents([1, 1, 1, 1, 1, 1, 1, 1, 0]);
|
||||
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector(".requests-list-filter-all-button"));
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector(".requests-list-filter-fonts-button"));
|
||||
testFilterButtons(monitor, "fonts");
|
||||
yield testContents([0, 0, 0, 1, 0, 0, 0, 0, 0]);
|
||||
await testContents([0, 0, 0, 1, 0, 0, 0, 0, 0]);
|
||||
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector(".requests-list-filter-all-button"));
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector(".requests-list-filter-images-button"));
|
||||
testFilterButtons(monitor, "images");
|
||||
yield testContents([0, 0, 0, 0, 1, 0, 0, 0, 0]);
|
||||
await testContents([0, 0, 0, 0, 1, 0, 0, 0, 0]);
|
||||
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector(".requests-list-filter-all-button"));
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector(".requests-list-filter-media-button"));
|
||||
testFilterButtons(monitor, "media");
|
||||
yield testContents([0, 0, 0, 0, 0, 1, 1, 0, 0]);
|
||||
await testContents([0, 0, 0, 0, 0, 1, 1, 0, 0]);
|
||||
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector(".requests-list-filter-all-button"));
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector(".requests-list-filter-ws-button"));
|
||||
testFilterButtons(monitor, "ws");
|
||||
yield testContents([0, 0, 0, 0, 0, 0, 0, 0, 1]);
|
||||
await testContents([0, 0, 0, 0, 0, 0, 0, 0, 1]);
|
||||
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector(".requests-list-filter-all-button"));
|
||||
|
||||
testFilterButtons(monitor, "all");
|
||||
yield testContents([1, 1, 1, 1, 1, 1, 1, 1, 1]);
|
||||
await testContents([1, 1, 1, 1, 1, 1, 1, 1, 1]);
|
||||
|
||||
// Text in filter box that matches nothing should hide all.
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector(".requests-list-filter-all-button"));
|
||||
setFreetextFilter("foobar");
|
||||
yield testContents([0, 0, 0, 0, 0, 0, 0, 0, 0]);
|
||||
await testContents([0, 0, 0, 0, 0, 0, 0, 0, 0]);
|
||||
|
||||
// Text in filter box that matches should filter out everything else.
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector(".requests-list-filter-all-button"));
|
||||
setFreetextFilter("sample");
|
||||
yield testContents([1, 1, 1, 0, 0, 0, 0, 0, 0]);
|
||||
await testContents([1, 1, 1, 0, 0, 0, 0, 0, 0]);
|
||||
|
||||
// Text in filter box that matches should filter out everything else.
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector(".requests-list-filter-all-button"));
|
||||
setFreetextFilter("SAMPLE");
|
||||
yield testContents([1, 1, 1, 0, 0, 0, 0, 0, 0]);
|
||||
await testContents([1, 1, 1, 0, 0, 0, 0, 0, 0]);
|
||||
|
||||
// Test negative filtering (only show unmatched items)
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector(".requests-list-filter-all-button"));
|
||||
setFreetextFilter("-sample");
|
||||
yield testContents([0, 0, 0, 1, 1, 1, 1, 1, 1]);
|
||||
await testContents([0, 0, 0, 1, 1, 1, 1, 1, 1]);
|
||||
|
||||
// ...then combine multiple filters together.
|
||||
|
||||
@ -259,27 +259,27 @@ add_task(function* () {
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector(".requests-list-filter-css-button"));
|
||||
testFilterButtonsCustom(monitor, [0, 1, 1, 0, 0, 0, 0, 0, 0, 0]);
|
||||
yield testContents([1, 1, 0, 0, 0, 0, 0, 0, 0]);
|
||||
await testContents([1, 1, 0, 0, 0, 0, 0, 0, 0]);
|
||||
|
||||
// Html and css filter enabled and text filter should show just the html and css match.
|
||||
// Should not show both the items matching the button plus the items matching the text.
|
||||
setFreetextFilter("sample");
|
||||
yield testContents([1, 1, 0, 0, 0, 0, 0, 0, 0]);
|
||||
await testContents([1, 1, 0, 0, 0, 0, 0, 0, 0]);
|
||||
setFreetextFilter("");
|
||||
testFilterButtonsCustom(monitor, [0, 1, 1, 0, 0, 0, 0, 0, 0, 0]);
|
||||
yield testContents([1, 1, 0, 0, 0, 0, 0, 0, 0]);
|
||||
await testContents([1, 1, 0, 0, 0, 0, 0, 0, 0]);
|
||||
|
||||
// Disable some filters. Only one left active.
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector(".requests-list-filter-css-button"));
|
||||
testFilterButtons(monitor, "html");
|
||||
yield testContents([1, 0, 0, 0, 0, 0, 0, 0, 0]);
|
||||
await testContents([1, 0, 0, 0, 0, 0, 0, 0, 0]);
|
||||
|
||||
// Disable last active filter. Should toggle to all.
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector(".requests-list-filter-html-button"));
|
||||
testFilterButtons(monitor, "all");
|
||||
yield testContents([1, 1, 1, 1, 1, 1, 1, 1, 1]);
|
||||
await testContents([1, 1, 1, 1, 1, 1, 1, 1, 1]);
|
||||
|
||||
// Enable few filters and click on all. Only "all" should be checked.
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
@ -292,9 +292,9 @@ add_task(function* () {
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector(".requests-list-filter-all-button"));
|
||||
testFilterButtons(monitor, "all");
|
||||
yield testContents([1, 1, 1, 1, 1, 1, 1, 1, 1]);
|
||||
await testContents([1, 1, 1, 1, 1, 1, 1, 1, 1]);
|
||||
|
||||
yield teardown(monitor);
|
||||
await teardown(monitor);
|
||||
|
||||
function getSelectedIndex(state) {
|
||||
if (!state.requests.selectedId) {
|
||||
@ -303,13 +303,13 @@ add_task(function* () {
|
||||
return getSortedRequests(state).findIndex(r => r.id === state.requests.selectedId);
|
||||
}
|
||||
|
||||
function* testContents(visibility) {
|
||||
async function testContents(visibility) {
|
||||
let requestItems = document.querySelectorAll(".request-list-item");
|
||||
for (let requestItem of requestItems) {
|
||||
requestItem.scrollIntoView();
|
||||
let requestsListStatus = requestItem.querySelector(".requests-list-status");
|
||||
EventUtils.sendMouseEvent({ type: "mouseover" }, requestsListStatus);
|
||||
yield waitUntil(() => requestsListStatus.title);
|
||||
await waitUntil(() => requestsListStatus.title);
|
||||
}
|
||||
|
||||
let items = getSortedRequests(store.getState());
|
||||
@ -317,7 +317,7 @@ add_task(function* () {
|
||||
|
||||
// Filter results will be updated asynchronously, so we should wait until
|
||||
// displayed requests reach final state.
|
||||
yield waitUntil(() => {
|
||||
await waitUntil(() => {
|
||||
visibleItems = getDisplayedRequests(store.getState());
|
||||
return visibleItems.size === visibility.filter(e => e).length;
|
||||
});
|
||||
|
@ -129,8 +129,8 @@ const EXPECTED_REQUESTS = [
|
||||
}
|
||||
];
|
||||
|
||||
add_task(function* () {
|
||||
let { monitor } = yield initNetMonitor(FILTERING_URL);
|
||||
add_task(async function () {
|
||||
let { monitor } = await initNetMonitor(FILTERING_URL);
|
||||
info("Starting test... ");
|
||||
|
||||
// It seems that this test may be slow on Ubuntu builds running on ec2.
|
||||
@ -148,8 +148,8 @@ add_task(function* () {
|
||||
|
||||
let wait = waitForNetworkEvents(monitor, 9);
|
||||
loadCommonFrameScript();
|
||||
yield performRequestsInContent(REQUESTS_WITH_MEDIA_AND_FLASH_AND_WS);
|
||||
yield wait;
|
||||
await performRequestsInContent(REQUESTS_WITH_MEDIA_AND_FLASH_AND_WS);
|
||||
await wait;
|
||||
|
||||
EventUtils.sendMouseEvent({ type: "mousedown" },
|
||||
document.querySelectorAll(".request-list-item")[0]);
|
||||
@ -162,41 +162,41 @@ add_task(function* () {
|
||||
"The network details panel should be visible after toggle button was pressed.");
|
||||
|
||||
testFilterButtons(monitor, "all");
|
||||
yield testContents([1, 1, 1, 1, 1, 1, 1, 1, 1]);
|
||||
await testContents([1, 1, 1, 1, 1, 1, 1, 1, 1]);
|
||||
|
||||
info("Testing html filtering.");
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector(".requests-list-filter-html-button"));
|
||||
testFilterButtons(monitor, "html");
|
||||
yield testContents([1, 0, 0, 0, 0, 0, 0, 0, 0]);
|
||||
await testContents([1, 0, 0, 0, 0, 0, 0, 0, 0]);
|
||||
|
||||
info("Performing more requests.");
|
||||
wait = waitForNetworkEvents(monitor, 9);
|
||||
yield performRequestsInContent(REQUESTS_WITH_MEDIA_AND_FLASH_AND_WS);
|
||||
yield wait;
|
||||
await performRequestsInContent(REQUESTS_WITH_MEDIA_AND_FLASH_AND_WS);
|
||||
await wait;
|
||||
|
||||
info("Testing html filtering again.");
|
||||
testFilterButtons(monitor, "html");
|
||||
yield testContents([1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0]);
|
||||
await testContents([1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0]);
|
||||
|
||||
info("Performing more requests.");
|
||||
wait = waitForNetworkEvents(monitor, 9);
|
||||
yield performRequestsInContent(REQUESTS_WITH_MEDIA_AND_FLASH_AND_WS);
|
||||
yield wait;
|
||||
await performRequestsInContent(REQUESTS_WITH_MEDIA_AND_FLASH_AND_WS);
|
||||
await wait;
|
||||
|
||||
info("Testing html filtering again.");
|
||||
testFilterButtons(monitor, "html");
|
||||
yield testContents([1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,
|
||||
await testContents([1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0]);
|
||||
|
||||
info("Resetting filters.");
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector(".requests-list-filter-all-button"));
|
||||
testFilterButtons(monitor, "all");
|
||||
yield testContents([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
await testContents([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]);
|
||||
|
||||
yield teardown(monitor);
|
||||
await teardown(monitor);
|
||||
|
||||
function getSelectedIndex(state) {
|
||||
if (!state.requests.selectedId) {
|
||||
@ -205,13 +205,13 @@ add_task(function* () {
|
||||
return getSortedRequests(state).findIndex(r => r.id === state.requests.selectedId);
|
||||
}
|
||||
|
||||
function* testContents(visibility) {
|
||||
async function testContents(visibility) {
|
||||
let requestItems = document.querySelectorAll(".request-list-item");
|
||||
for (let requestItem of requestItems) {
|
||||
requestItem.scrollIntoView();
|
||||
let requestsListStatus = requestItem.querySelector(".requests-list-status");
|
||||
EventUtils.sendMouseEvent({ type: "mouseover" }, requestsListStatus);
|
||||
yield waitUntil(() => requestsListStatus.title);
|
||||
await waitUntil(() => requestsListStatus.title);
|
||||
}
|
||||
|
||||
isnot(getSelectedRequest(store.getState()), null,
|
||||
|
@ -20,8 +20,8 @@ const REQUESTS_WITH_MEDIA = BASIC_REQUESTS.concat([
|
||||
{ url: "sjs_content-type-test-server.sjs?fmt=video" },
|
||||
]);
|
||||
|
||||
add_task(function* () {
|
||||
let { monitor } = yield initNetMonitor(FILTERING_URL);
|
||||
add_task(async function () {
|
||||
let { monitor } = await initNetMonitor(FILTERING_URL);
|
||||
info("Starting test... ");
|
||||
|
||||
// It seems that this test may be slow on Ubuntu builds running on ec2.
|
||||
@ -46,8 +46,8 @@ add_task(function* () {
|
||||
loadCommonFrameScript();
|
||||
|
||||
let wait = waitForNetworkEvents(monitor, 7);
|
||||
yield performRequestsInContent(requests);
|
||||
yield wait;
|
||||
await performRequestsInContent(requests);
|
||||
await wait;
|
||||
|
||||
EventUtils.sendMouseEvent({ type: "mousedown" },
|
||||
document.querySelectorAll(".request-list-item")[0]);
|
||||
@ -77,7 +77,7 @@ add_task(function* () {
|
||||
info("Performing more requests.");
|
||||
wait = waitForNetworkEvents(monitor, 7);
|
||||
performRequestsInContent(REQUESTS_WITH_MEDIA);
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
info("Testing html filtering again.");
|
||||
resetSorting();
|
||||
@ -86,7 +86,7 @@ add_task(function* () {
|
||||
|
||||
info("Performing more requests.");
|
||||
performRequestsInContent(REQUESTS_WITH_MEDIA);
|
||||
yield waitForNetworkEvents(monitor, 7);
|
||||
await waitForNetworkEvents(monitor, 7);
|
||||
|
||||
info("Testing html filtering again.");
|
||||
resetSorting();
|
||||
@ -94,7 +94,7 @@ add_task(function* () {
|
||||
testContents([12, 13, 20, 14, 16, 18, 15, 17, 19, 0, 4, 8, 1, 5, 9, 2, 6, 10, 3, 7, 11],
|
||||
3, 20);
|
||||
|
||||
yield teardown(monitor);
|
||||
await teardown(monitor);
|
||||
|
||||
function resetSorting() {
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
|
@ -29,11 +29,11 @@ const REQUESTS_WITH_MEDIA_AND_FLASH_AND_WS = REQUESTS_WITH_MEDIA_AND_FLASH.conca
|
||||
{ url: "sjs_content-type-test-server.sjs?fmt=ws" },
|
||||
]);
|
||||
|
||||
add_task(function* () {
|
||||
add_task(async function () {
|
||||
Services.prefs.setCharPref("devtools.netmonitor.filters",
|
||||
'["bogus", "js", "alsobogus"]');
|
||||
|
||||
let { monitor } = yield initNetMonitor(FILTERING_URL);
|
||||
let { monitor } = await initNetMonitor(FILTERING_URL);
|
||||
info("Starting test... ");
|
||||
|
||||
let { document, store, windowRequire } = monitor.panelWin;
|
||||
@ -49,8 +49,8 @@ add_task(function* () {
|
||||
|
||||
let wait = waitForNetworkEvents(monitor, 9);
|
||||
loadCommonFrameScript();
|
||||
yield performRequestsInContent(REQUESTS_WITH_MEDIA_AND_FLASH_AND_WS);
|
||||
yield wait;
|
||||
await performRequestsInContent(REQUESTS_WITH_MEDIA_AND_FLASH_AND_WS);
|
||||
await wait;
|
||||
|
||||
testFilterButtons(monitor, "js");
|
||||
ok(true, "Only the correct filter type was taken into consideration.");
|
||||
@ -63,5 +63,5 @@ add_task(function* () {
|
||||
"The filters preferences were saved directly after the click and only" +
|
||||
" with the valid.");
|
||||
|
||||
yield teardown(monitor);
|
||||
await teardown(monitor);
|
||||
});
|
||||
|
@ -136,8 +136,8 @@ const EXPECTED_REQUESTS = [
|
||||
},
|
||||
];
|
||||
|
||||
add_task(function* () {
|
||||
let { monitor } = yield initNetMonitor(FILTERING_URL);
|
||||
add_task(async function () {
|
||||
let { monitor } = await initNetMonitor(FILTERING_URL);
|
||||
let { document, store, windowRequire } = monitor.panelWin;
|
||||
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
|
||||
let {
|
||||
@ -167,201 +167,201 @@ add_task(function* () {
|
||||
|
||||
let waitNetwork = waitForNetworkEvents(monitor, REQUESTS.length);
|
||||
loadCommonFrameScript();
|
||||
yield performRequestsInContent(REQUESTS);
|
||||
yield waitNetwork;
|
||||
await performRequestsInContent(REQUESTS);
|
||||
await waitNetwork;
|
||||
|
||||
// Test running flag once requests finish running
|
||||
setFreetextFilter("is:running");
|
||||
yield testContents([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
|
||||
await testContents([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
|
||||
|
||||
// Test cached flag
|
||||
setFreetextFilter("is:from-cache");
|
||||
yield testContents([0, 0, 0, 0, 0, 0, 0, 0, 0, 1]);
|
||||
await testContents([0, 0, 0, 0, 0, 0, 0, 0, 0, 1]);
|
||||
|
||||
setFreetextFilter("is:cached");
|
||||
yield testContents([0, 0, 0, 0, 0, 0, 0, 0, 0, 1]);
|
||||
await testContents([0, 0, 0, 0, 0, 0, 0, 0, 0, 1]);
|
||||
|
||||
// Test negative cached flag
|
||||
setFreetextFilter("-is:from-cache");
|
||||
yield testContents([1, 1, 1, 1, 1, 1, 1, 1, 1, 0]);
|
||||
await testContents([1, 1, 1, 1, 1, 1, 1, 1, 1, 0]);
|
||||
|
||||
setFreetextFilter("-is:cached");
|
||||
yield testContents([1, 1, 1, 1, 1, 1, 1, 1, 1, 0]);
|
||||
await testContents([1, 1, 1, 1, 1, 1, 1, 1, 1, 0]);
|
||||
|
||||
// Test status-code flag
|
||||
setFreetextFilter("status-code:200");
|
||||
yield testContents([1, 1, 1, 1, 1, 1, 1, 1, 1, 0]);
|
||||
await testContents([1, 1, 1, 1, 1, 1, 1, 1, 1, 0]);
|
||||
|
||||
// Test status-code negative flag
|
||||
setFreetextFilter("-status-code:200");
|
||||
yield testContents([0, 0, 0, 0, 0, 0, 0, 0, 0, 1]);
|
||||
await testContents([0, 0, 0, 0, 0, 0, 0, 0, 0, 1]);
|
||||
|
||||
// Test mime-type flag
|
||||
setFreetextFilter("mime-type:HtmL");
|
||||
yield testContents([1, 1, 0, 0, 0, 0, 0, 0, 0, 0]);
|
||||
await testContents([1, 1, 0, 0, 0, 0, 0, 0, 0, 0]);
|
||||
|
||||
// Test mime-type negative flag
|
||||
setFreetextFilter("-mime-type:HtmL");
|
||||
yield testContents([0, 0, 1, 1, 1, 1, 1, 1, 1, 1]);
|
||||
await testContents([0, 0, 1, 1, 1, 1, 1, 1, 1, 1]);
|
||||
|
||||
// Test method flag
|
||||
setFreetextFilter("method:get");
|
||||
yield testContents([1, 1, 1, 1, 1, 1, 1, 1, 1, 1]);
|
||||
await testContents([1, 1, 1, 1, 1, 1, 1, 1, 1, 1]);
|
||||
|
||||
// Test unmatched method flag
|
||||
setFreetextFilter("method:post");
|
||||
yield testContents([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
|
||||
await testContents([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
|
||||
|
||||
// Test scheme flag (all requests are http)
|
||||
setFreetextFilter("scheme:http");
|
||||
yield testContents([1, 1, 1, 1, 1, 1, 1, 1, 1, 1]);
|
||||
await testContents([1, 1, 1, 1, 1, 1, 1, 1, 1, 1]);
|
||||
|
||||
setFreetextFilter("scheme:https");
|
||||
yield testContents([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
|
||||
await testContents([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
|
||||
|
||||
// Test regex filter
|
||||
setFreetextFilter("regexp:content.*?Sam");
|
||||
yield testContents([1, 1, 0, 0, 0, 0, 0, 0, 0, 0]);
|
||||
await testContents([1, 1, 0, 0, 0, 0, 0, 0, 0, 0]);
|
||||
|
||||
// Test set-cookie-name flag
|
||||
setFreetextFilter("set-cookie-name:name2");
|
||||
yield testContents([0, 1, 0, 0, 0, 0, 0, 0, 0, 0]);
|
||||
await testContents([0, 1, 0, 0, 0, 0, 0, 0, 0, 0]);
|
||||
|
||||
setFreetextFilter("set-cookie-name:not-existing");
|
||||
yield testContents([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
|
||||
await testContents([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
|
||||
|
||||
// Test set-cookie-value flag
|
||||
setFreetextFilter("set-cookie-value:value2");
|
||||
yield testContents([0, 1, 0, 0, 0, 0, 0, 0, 0, 0]);
|
||||
await testContents([0, 1, 0, 0, 0, 0, 0, 0, 0, 0]);
|
||||
|
||||
setFreetextFilter("set-cookie-value:not-existing");
|
||||
yield testContents([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
|
||||
await testContents([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
|
||||
|
||||
// Test set-cookie-domain flag
|
||||
setFreetextFilter("set-cookie-domain:.example.com");
|
||||
yield testContents([0, 1, 0, 0, 0, 0, 0, 0, 0, 0]);
|
||||
await testContents([0, 1, 0, 0, 0, 0, 0, 0, 0, 0]);
|
||||
|
||||
setFreetextFilter("set-cookie-domain:.foo.example.com");
|
||||
yield testContents([0, 1, 0, 0, 0, 0, 0, 0, 0, 0]);
|
||||
await testContents([0, 1, 0, 0, 0, 0, 0, 0, 0, 0]);
|
||||
|
||||
setFreetextFilter("set-cookie-domain:.not-existing.example.com");
|
||||
yield testContents([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
|
||||
await testContents([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
|
||||
|
||||
// Test size
|
||||
setFreetextFilter("size:-1");
|
||||
yield testContents([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
|
||||
await testContents([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
|
||||
|
||||
setFreetextFilter("size:0");
|
||||
yield testContents([0, 0, 0, 0, 1, 1, 1, 1, 0, 1]);
|
||||
await testContents([0, 0, 0, 0, 1, 1, 1, 1, 0, 1]);
|
||||
|
||||
setFreetextFilter("size:34");
|
||||
yield testContents([0, 0, 1, 1, 0, 0, 0, 0, 0, 0]);
|
||||
await testContents([0, 0, 1, 1, 0, 0, 0, 0, 0, 0]);
|
||||
|
||||
// Testing the lower bound
|
||||
setFreetextFilter("size:9.659k");
|
||||
yield testContents([0, 0, 0, 0, 0, 0, 0, 0, 1, 0]);
|
||||
await testContents([0, 0, 0, 0, 0, 0, 0, 0, 1, 0]);
|
||||
|
||||
// Testing the actual value
|
||||
setFreetextFilter("size:10989");
|
||||
yield testContents([0, 0, 0, 0, 0, 0, 0, 0, 1, 0]);
|
||||
await testContents([0, 0, 0, 0, 0, 0, 0, 0, 1, 0]);
|
||||
|
||||
// Testing the upper bound
|
||||
setFreetextFilter("size:11.804k");
|
||||
yield testContents([0, 0, 0, 0, 0, 0, 0, 0, 1, 0]);
|
||||
await testContents([0, 0, 0, 0, 0, 0, 0, 0, 1, 0]);
|
||||
|
||||
// Test transferred
|
||||
setFreetextFilter("transferred:200");
|
||||
yield testContents([0, 0, 0, 0, 1, 1, 1, 1, 0, 0]);
|
||||
await testContents([0, 0, 0, 0, 1, 1, 1, 1, 0, 0]);
|
||||
|
||||
setFreetextFilter("transferred:234");
|
||||
yield testContents([1, 0, 1, 0, 0, 0, 0, 0, 0, 1]);
|
||||
await testContents([1, 0, 1, 0, 0, 0, 0, 0, 0, 1]);
|
||||
|
||||
setFreetextFilter("transferred:248");
|
||||
yield testContents([0, 0, 1, 1, 0, 0, 0, 0, 0, 1]);
|
||||
await testContents([0, 0, 1, 1, 0, 0, 0, 0, 0, 1]);
|
||||
|
||||
// Test larger-than
|
||||
setFreetextFilter("larger-than:-1");
|
||||
yield testContents([1, 1, 1, 1, 1, 1, 1, 1, 1, 1]);
|
||||
await testContents([1, 1, 1, 1, 1, 1, 1, 1, 1, 1]);
|
||||
|
||||
setFreetextFilter("larger-than:0");
|
||||
yield testContents([1, 1, 1, 1, 0, 0, 0, 0, 1, 0]);
|
||||
await testContents([1, 1, 1, 1, 0, 0, 0, 0, 1, 0]);
|
||||
|
||||
setFreetextFilter("larger-than:33");
|
||||
yield testContents([0, 0, 1, 1, 0, 0, 0, 0, 1, 0]);
|
||||
await testContents([0, 0, 1, 1, 0, 0, 0, 0, 1, 0]);
|
||||
|
||||
setFreetextFilter("larger-than:34");
|
||||
yield testContents([0, 0, 0, 0, 0, 0, 0, 0, 1, 0]);
|
||||
await testContents([0, 0, 0, 0, 0, 0, 0, 0, 1, 0]);
|
||||
|
||||
setFreetextFilter("larger-than:10.73k");
|
||||
yield testContents([0, 0, 0, 0, 0, 0, 0, 0, 1, 0]);
|
||||
await testContents([0, 0, 0, 0, 0, 0, 0, 0, 1, 0]);
|
||||
|
||||
setFreetextFilter("larger-than:10.732k");
|
||||
yield testContents([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
|
||||
await testContents([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
|
||||
|
||||
// Test transferred-larger-than
|
||||
setFreetextFilter("transferred-larger-than:-1");
|
||||
yield testContents([1, 1, 1, 1, 1, 1, 1, 1, 1, 1]);
|
||||
await testContents([1, 1, 1, 1, 1, 1, 1, 1, 1, 1]);
|
||||
|
||||
setFreetextFilter("transferred-larger-than:214");
|
||||
yield testContents([1, 1, 1, 1, 0, 0, 0, 0, 1, 1]);
|
||||
await testContents([1, 1, 1, 1, 0, 0, 0, 0, 1, 1]);
|
||||
|
||||
setFreetextFilter("transferred-larger-than:247");
|
||||
yield testContents([0, 1, 1, 1, 0, 0, 0, 0, 1, 0]);
|
||||
await testContents([0, 1, 1, 1, 0, 0, 0, 0, 1, 0]);
|
||||
|
||||
setFreetextFilter("transferred-larger-than:248");
|
||||
yield testContents([0, 1, 0, 1, 0, 0, 0, 0, 1, 0]);
|
||||
await testContents([0, 1, 0, 1, 0, 0, 0, 0, 1, 0]);
|
||||
|
||||
setFreetextFilter("transferred-larger-than:10.73k");
|
||||
yield testContents([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
|
||||
await testContents([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
|
||||
|
||||
// Test cause
|
||||
setFreetextFilter("cause:xhr");
|
||||
yield testContents([1, 1, 1, 1, 1, 1, 1, 1, 1, 1]);
|
||||
await testContents([1, 1, 1, 1, 1, 1, 1, 1, 1, 1]);
|
||||
|
||||
setFreetextFilter("cause:script");
|
||||
yield testContents([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
|
||||
await testContents([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
|
||||
|
||||
// Test has-response-header
|
||||
setFreetextFilter("has-response-header:Content-Type");
|
||||
yield testContents([1, 1, 1, 1, 1, 1, 1, 1, 1, 1]);
|
||||
await testContents([1, 1, 1, 1, 1, 1, 1, 1, 1, 1]);
|
||||
|
||||
setFreetextFilter("has-response-header:Last-Modified");
|
||||
yield testContents([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
|
||||
await testContents([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
|
||||
|
||||
// Test remote-ip
|
||||
setFreetextFilter("remote-ip:127.0.0.1");
|
||||
yield testContents([1, 1, 1, 1, 1, 1, 1, 1, 1, 1]);
|
||||
await testContents([1, 1, 1, 1, 1, 1, 1, 1, 1, 1]);
|
||||
|
||||
setFreetextFilter("remote-ip:192.168.1.2");
|
||||
yield testContents([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
|
||||
await testContents([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
|
||||
|
||||
// Test domain
|
||||
setFreetextFilter("domain:example.com");
|
||||
yield testContents([1, 1, 1, 1, 1, 1, 1, 1, 1, 1]);
|
||||
await testContents([1, 1, 1, 1, 1, 1, 1, 1, 1, 1]);
|
||||
|
||||
setFreetextFilter("domain:wrongexample.com");
|
||||
yield testContents([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
|
||||
await testContents([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
|
||||
|
||||
// Test protocol
|
||||
setFreetextFilter("protocol:http/1");
|
||||
yield testContents([1, 1, 1, 1, 1, 1, 1, 1, 1, 1]);
|
||||
await testContents([1, 1, 1, 1, 1, 1, 1, 1, 1, 1]);
|
||||
|
||||
setFreetextFilter("protocol:http/2");
|
||||
yield testContents([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
|
||||
await testContents([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
|
||||
|
||||
// Test mixing flags
|
||||
setFreetextFilter("-mime-type:HtmL status-code:200");
|
||||
yield testContents([0, 0, 1, 1, 1, 1, 1, 1, 1, 0]);
|
||||
await testContents([0, 0, 1, 1, 1, 1, 1, 1, 1, 0]);
|
||||
|
||||
yield teardown(monitor);
|
||||
await teardown(monitor);
|
||||
|
||||
function* testContents(visibility) {
|
||||
async function testContents(visibility) {
|
||||
let requestItems = document.querySelectorAll(".request-list-item");
|
||||
for (let requestItem of requestItems) {
|
||||
requestItem.scrollIntoView();
|
||||
let requestsListStatus = requestItem.querySelector(".requests-list-status");
|
||||
EventUtils.sendMouseEvent({ type: "mouseover" }, requestsListStatus);
|
||||
yield waitUntil(() => requestsListStatus.title);
|
||||
await waitUntil(() => requestsListStatus.title);
|
||||
}
|
||||
|
||||
let items = getSortedRequests(store.getState());
|
||||
@ -369,7 +369,7 @@ add_task(function* () {
|
||||
|
||||
// Filter results will be updated asynchronously, so we should wait until
|
||||
// displayed requests reach final state.
|
||||
yield waitUntil(() => {
|
||||
await waitUntil(() => {
|
||||
visibleItems = getDisplayedRequests(store.getState());
|
||||
return visibleItems.size === visibility.filter(e => e).length;
|
||||
});
|
||||
@ -386,7 +386,7 @@ add_task(function* () {
|
||||
|
||||
// Filter results will be updated asynchronously, so we should wait until
|
||||
// displayed requests reach final state.
|
||||
yield waitUntil(() => {
|
||||
await waitUntil(() => {
|
||||
visibleItems = getDisplayedRequests(store.getState());
|
||||
isThere = visibleItems.some(r => r.id == itemId);
|
||||
return isThere === shouldBeVisible;
|
||||
|
@ -7,7 +7,7 @@
|
||||
* Test if the summary text displayed in the network requests menu footer is correct.
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
add_task(async function () {
|
||||
const {
|
||||
getFormattedSize,
|
||||
getFormattedTime
|
||||
@ -15,7 +15,7 @@ add_task(function* () {
|
||||
|
||||
requestLongerTimeout(2);
|
||||
|
||||
let { tab, monitor } = yield initNetMonitor(FILTERING_URL);
|
||||
let { tab, monitor } = await initNetMonitor(FILTERING_URL);
|
||||
info("Starting test... ");
|
||||
|
||||
let { document, store, windowRequire } = monitor.panelWin;
|
||||
@ -31,10 +31,10 @@ add_task(function* () {
|
||||
for (let i = 0; i < 2; i++) {
|
||||
info(`Performing requests in batch #${i}`);
|
||||
let wait = waitForNetworkEvents(monitor, 8);
|
||||
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
|
||||
await ContentTask.spawn(tab.linkedBrowser, {}, async function () {
|
||||
content.wrappedJSObject.performRequests('{ "getMedia": true, "getFlash": true }');
|
||||
});
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
testStatus();
|
||||
|
||||
@ -46,7 +46,7 @@ add_task(function* () {
|
||||
}
|
||||
}
|
||||
|
||||
yield teardown(monitor);
|
||||
await teardown(monitor);
|
||||
|
||||
function testStatus() {
|
||||
let state = store.getState();
|
||||
|
@ -146,9 +146,9 @@ const EXPECTED_REQUESTS_SUB = [
|
||||
|
||||
const REQUEST_COUNT = EXPECTED_REQUESTS_TOP.length + EXPECTED_REQUESTS_SUB.length;
|
||||
|
||||
add_task(function* () {
|
||||
add_task(async function () {
|
||||
// Async stacks aren't on by default in all builds
|
||||
yield SpecialPowers.pushPrefEnv({ set: [["javascript.options.asyncstack", true]] });
|
||||
await SpecialPowers.pushPrefEnv({ set: [["javascript.options.asyncstack", true]] });
|
||||
|
||||
// the initNetMonitor function clears the network request list after the
|
||||
// page is loaded. That's why we first load a bogus page from SIMPLE_URL,
|
||||
@ -156,7 +156,7 @@ add_task(function* () {
|
||||
// all the requests the page is making, not only the XHRs.
|
||||
// We can't use about:blank here, because initNetMonitor checks that the
|
||||
// page has actually made at least one request.
|
||||
let { tab, monitor } = yield initNetMonitor(SIMPLE_URL);
|
||||
let { tab, monitor } = await initNetMonitor(SIMPLE_URL);
|
||||
|
||||
let { document, store, windowRequire, connector } = monitor.panelWin;
|
||||
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
|
||||
@ -169,7 +169,7 @@ add_task(function* () {
|
||||
|
||||
tab.linkedBrowser.loadURI(TOP_URL, null, null);
|
||||
|
||||
yield waitForNetworkEvents(monitor, REQUEST_COUNT);
|
||||
await waitForNetworkEvents(monitor, REQUEST_COUNT);
|
||||
|
||||
is(store.getState().requests.requests.size, REQUEST_COUNT,
|
||||
"All the page events should be recorded.");
|
||||
@ -177,7 +177,7 @@ add_task(function* () {
|
||||
// Fetch stack-trace data from the backend and wait till
|
||||
// all packets are received.
|
||||
let requests = getSortedRequests(store.getState());
|
||||
yield Promise.all(requests.map(requestItem =>
|
||||
await Promise.all(requests.map(requestItem =>
|
||||
connector.requestData(requestItem.id, "stackTrace")));
|
||||
|
||||
// While there is a defined order for requests in each document separately, the requests
|
||||
@ -233,5 +233,5 @@ add_task(function* () {
|
||||
}
|
||||
}
|
||||
|
||||
yield teardown(monitor);
|
||||
await teardown(monitor);
|
||||
});
|
||||
|
@ -7,8 +7,8 @@
|
||||
* Tests if "Learn More" links are correctly displayed
|
||||
* next to headers.
|
||||
*/
|
||||
add_task(function* () {
|
||||
let { tab, monitor } = yield initNetMonitor(POST_DATA_URL);
|
||||
add_task(async function () {
|
||||
let { tab, monitor } = await initNetMonitor(POST_DATA_URL);
|
||||
info("Starting test... ");
|
||||
|
||||
let { document, store, windowRequire } = monitor.panelWin;
|
||||
@ -21,10 +21,10 @@ add_task(function* () {
|
||||
store.dispatch(Actions.batchEnable(false));
|
||||
|
||||
let wait = waitForNetworkEvents(monitor, 2);
|
||||
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
|
||||
await ContentTask.spawn(tab.linkedBrowser, {}, async function () {
|
||||
content.wrappedJSObject.performRequests();
|
||||
});
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelectorAll(".request-list-item")[0]);
|
||||
|
@ -29,7 +29,7 @@ add_task(async function () {
|
||||
testColumnsAlignment(headers, requestsContainer);
|
||||
|
||||
// Stop doing requests.
|
||||
await ContentTask.spawn(tab.linkedBrowser, {}, function* () {
|
||||
await ContentTask.spawn(tab.linkedBrowser, {}, async function () {
|
||||
content.wrappedJSObject.stopRequests();
|
||||
});
|
||||
|
||||
|
@ -8,8 +8,8 @@
|
||||
* The test also verifies that headers with the same name and headers
|
||||
* with an empty value are also displayed.
|
||||
*/
|
||||
add_task(function* () {
|
||||
let { tab, monitor } = yield initNetMonitor(SIMPLE_SJS);
|
||||
add_task(async function () {
|
||||
let { tab, monitor } = await initNetMonitor(SIMPLE_SJS);
|
||||
info("Starting test... ");
|
||||
|
||||
let { document, store, windowRequire } = monitor.panelWin;
|
||||
@ -22,14 +22,14 @@ add_task(function* () {
|
||||
|
||||
let wait = waitForNetworkEvents(monitor, 1);
|
||||
tab.linkedBrowser.reload();
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
wait = waitForDOM(document, ".headers-overview");
|
||||
EventUtils.sendMouseEvent({ type: "mousedown" },
|
||||
document.querySelectorAll(".request-list-item")[0]);
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
yield waitUntil(() => {
|
||||
await waitUntil(() => {
|
||||
let request = getSortedRequests(store.getState()).get(0);
|
||||
return request.requestHeaders && request.responseHeaders;
|
||||
});
|
||||
@ -62,5 +62,5 @@ add_task(function* () {
|
||||
is(actualRequestHeaders.toString(), expectedRequestHeaders.toString(),
|
||||
"Request Headers are sorted");
|
||||
|
||||
yield teardown(monitor);
|
||||
await teardown(monitor);
|
||||
});
|
||||
|
@ -9,8 +9,8 @@ const IMAGE_TOOLTIP_REQUESTS = 1;
|
||||
/**
|
||||
* Tests if image responses show a popup in the requests menu when hovered.
|
||||
*/
|
||||
add_task(function* test() {
|
||||
let { tab, monitor } = yield initNetMonitor(IMAGE_TOOLTIP_URL);
|
||||
add_task(async function test() {
|
||||
let { tab, monitor } = await initNetMonitor(IMAGE_TOOLTIP_URL);
|
||||
info("Starting test... ");
|
||||
|
||||
let { document, store, windowRequire, connector } = monitor.panelWin;
|
||||
@ -22,38 +22,38 @@ add_task(function* test() {
|
||||
store.dispatch(Actions.batchEnable(false));
|
||||
|
||||
let onEvents = waitForNetworkEvents(monitor, IMAGE_TOOLTIP_REQUESTS);
|
||||
yield performRequests();
|
||||
yield onEvents;
|
||||
await performRequests();
|
||||
await onEvents;
|
||||
|
||||
info("Checking the image thumbnail after a few requests were made...");
|
||||
yield showTooltipAndVerify(document.querySelectorAll(".request-list-item")[0]);
|
||||
await 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(document.querySelectorAll(".request-list-item")[0]);
|
||||
await hideTooltipAndVerify(document.querySelectorAll(".request-list-item")[0]);
|
||||
|
||||
// +1 extra document reload
|
||||
onEvents = waitForNetworkEvents(monitor, IMAGE_TOOLTIP_REQUESTS + 1);
|
||||
|
||||
info("Reloading the debuggee and performing all requests again...");
|
||||
yield triggerActivity(ACTIVITY_TYPE.RELOAD.WITH_CACHE_ENABLED);
|
||||
yield performRequests();
|
||||
yield onEvents;
|
||||
await triggerActivity(ACTIVITY_TYPE.RELOAD.WITH_CACHE_ENABLED);
|
||||
await performRequests();
|
||||
await onEvents;
|
||||
|
||||
info("Checking the image thumbnail after a reload.");
|
||||
yield showTooltipAndVerify(document.querySelectorAll(".request-list-item")[1]);
|
||||
await 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: "mousemove" },
|
||||
monitor.panelWin);
|
||||
yield waitUntil(() => !toolboxDoc.querySelector(".tooltip-container.tooltip-visible"));
|
||||
await waitUntil(() => !toolboxDoc.querySelector(".tooltip-container.tooltip-visible"));
|
||||
|
||||
yield teardown(monitor);
|
||||
await teardown(monitor);
|
||||
|
||||
function performRequests() {
|
||||
return ContentTask.spawn(tab.linkedBrowser, {}, function* () {
|
||||
return ContentTask.spawn(tab.linkedBrowser, {}, async function () {
|
||||
content.wrappedJSObject.performRequests();
|
||||
});
|
||||
}
|
||||
@ -62,9 +62,9 @@ add_task(function* test() {
|
||||
* Show a tooltip on the {target} and verify that it was displayed
|
||||
* with the expected content.
|
||||
*/
|
||||
function* showTooltipAndVerify(target) {
|
||||
async function showTooltipAndVerify(target) {
|
||||
let anchor = target.querySelector(".requests-list-file");
|
||||
yield showTooltipOn(anchor);
|
||||
await showTooltipOn(anchor);
|
||||
|
||||
info("Tooltip was successfully opened for the image request.");
|
||||
is(toolboxDoc.querySelector(".tooltip-panel img").src, TEST_IMAGE_DATA_URI,
|
||||
@ -75,22 +75,22 @@ add_task(function* test() {
|
||||
* Trigger a tooltip over an element by sending mousemove event.
|
||||
* @return a promise that resolves when the tooltip is shown
|
||||
*/
|
||||
function* showTooltipOn(element) {
|
||||
async function showTooltipOn(element) {
|
||||
let win = element.ownerDocument.defaultView;
|
||||
EventUtils.synthesizeMouseAtCenter(element, { type: "mousemove" }, win);
|
||||
yield waitUntil(() => toolboxDoc.querySelector(".tooltip-panel img"));
|
||||
await waitUntil(() => toolboxDoc.querySelector(".tooltip-panel img"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Hide a tooltip on the {target} and verify that it was closed.
|
||||
*/
|
||||
function* hideTooltipAndVerify(target) {
|
||||
async 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(
|
||||
await waitUntil(
|
||||
() => !toolboxDoc.querySelector(".tooltip-container.tooltip-visible"));
|
||||
info("Tooltip was successfully closed.");
|
||||
}
|
||||
|
@ -7,9 +7,9 @@
|
||||
* Tests if JSON responses encoded in base64 are handled correctly.
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
add_task(async function () {
|
||||
let { L10N } = require("devtools/client/netmonitor/src/utils/l10n");
|
||||
let { tab, monitor } = yield initNetMonitor(JSON_B64_URL);
|
||||
let { tab, monitor } = await initNetMonitor(JSON_B64_URL);
|
||||
info("Starting test... ");
|
||||
|
||||
let { document, store, windowRequire } = monitor.panelWin;
|
||||
@ -18,17 +18,17 @@ add_task(function* () {
|
||||
store.dispatch(Actions.batchEnable(false));
|
||||
|
||||
let wait = waitForNetworkEvents(monitor, 1);
|
||||
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
|
||||
await ContentTask.spawn(tab.linkedBrowser, {}, async function () {
|
||||
content.wrappedJSObject.performRequests();
|
||||
});
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
wait = waitForDOM(document, "#response-panel .CodeMirror-code");
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector(".network-details-panel-toggle"));
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector("#response-tab"));
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
let tabpanel = document.querySelector("#response-panel");
|
||||
|
||||
@ -59,5 +59,5 @@ add_task(function* () {
|
||||
is(values[0].textContent, "This is a base 64 string.",
|
||||
"The first json property value was incorrect.");
|
||||
|
||||
yield teardown(monitor);
|
||||
await teardown(monitor);
|
||||
});
|
||||
|
@ -7,10 +7,10 @@
|
||||
* Tests if very long JSON responses are handled correctly.
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
add_task(async function () {
|
||||
let { L10N } = require("devtools/client/netmonitor/src/utils/l10n");
|
||||
|
||||
let { tab, monitor } = yield initNetMonitor(JSON_LONG_URL);
|
||||
let { tab, monitor } = await initNetMonitor(JSON_LONG_URL);
|
||||
info("Starting test... ");
|
||||
|
||||
// This is receiving over 80 KB of json and will populate over 6000 items
|
||||
@ -27,15 +27,15 @@ add_task(function* () {
|
||||
store.dispatch(Actions.batchEnable(false));
|
||||
|
||||
let wait = waitForNetworkEvents(monitor, 1);
|
||||
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
|
||||
await ContentTask.spawn(tab.linkedBrowser, {}, async function () {
|
||||
content.wrappedJSObject.performRequests();
|
||||
});
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
let requestItem = document.querySelector(".request-list-item");
|
||||
let requestsListStatus = requestItem.querySelector(".requests-list-status");
|
||||
EventUtils.sendMouseEvent({ type: "mouseover" }, requestsListStatus);
|
||||
yield waitUntil(() => requestsListStatus.title);
|
||||
await waitUntil(() => requestsListStatus.title);
|
||||
|
||||
verifyRequestItemTarget(
|
||||
document,
|
||||
@ -58,11 +58,11 @@ add_task(function* () {
|
||||
document.querySelector(".network-details-panel-toggle"));
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector("#response-tab"));
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
testResponseTab();
|
||||
|
||||
yield teardown(monitor);
|
||||
await teardown(monitor);
|
||||
|
||||
function testResponseTab() {
|
||||
let tabpanel = document.querySelector("#response-panel");
|
||||
|
@ -7,9 +7,9 @@
|
||||
* Tests if malformed JSON responses are handled correctly.
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
add_task(async function () {
|
||||
let { L10N } = require("devtools/client/netmonitor/src/utils/l10n");
|
||||
let { tab, monitor } = yield initNetMonitor(JSON_MALFORMED_URL);
|
||||
let { tab, monitor } = await initNetMonitor(JSON_MALFORMED_URL);
|
||||
info("Starting test... ");
|
||||
|
||||
let { document, store, windowRequire } = monitor.panelWin;
|
||||
@ -22,15 +22,15 @@ add_task(function* () {
|
||||
store.dispatch(Actions.batchEnable(false));
|
||||
|
||||
let wait = waitForNetworkEvents(monitor, 1);
|
||||
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
|
||||
await ContentTask.spawn(tab.linkedBrowser, {}, async function () {
|
||||
content.wrappedJSObject.performRequests();
|
||||
});
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
let requestItem = document.querySelector(".request-list-item");
|
||||
let requestsListStatus = requestItem.querySelector(".requests-list-status");
|
||||
EventUtils.sendMouseEvent({ type: "mouseover" }, requestsListStatus);
|
||||
yield waitUntil(() => requestsListStatus.title);
|
||||
await waitUntil(() => requestsListStatus.title);
|
||||
|
||||
verifyRequestItemTarget(
|
||||
document,
|
||||
@ -50,7 +50,7 @@ add_task(function* () {
|
||||
document.querySelector(".network-details-panel-toggle"));
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector("#response-tab"));
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
let tabpanel = document.querySelector("#response-panel");
|
||||
is(tabpanel.querySelector(".response-error-header") === null, false,
|
||||
@ -75,5 +75,5 @@ add_task(function* () {
|
||||
"{ \"greeting\": \"Hello malformed JSON!\" },",
|
||||
"The text shown in the source editor is incorrect.");
|
||||
|
||||
yield teardown(monitor);
|
||||
await teardown(monitor);
|
||||
});
|
||||
|
@ -7,8 +7,8 @@
|
||||
* Tests if JSON responses containing null values are properly displayed.
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
let { tab, monitor } = yield initNetMonitor(JSON_BASIC_URL + "?name=null");
|
||||
add_task(async function () {
|
||||
let { tab, monitor } = await initNetMonitor(JSON_BASIC_URL + "?name=null");
|
||||
info("Starting test... ");
|
||||
|
||||
let { document, store, windowRequire } = monitor.panelWin;
|
||||
@ -18,12 +18,12 @@ add_task(function* () {
|
||||
store.dispatch(Actions.batchEnable(false));
|
||||
|
||||
let wait = waitForNetworkEvents(monitor, 1);
|
||||
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
|
||||
await ContentTask.spawn(tab.linkedBrowser, {}, async function () {
|
||||
content.wrappedJSObject.performRequests();
|
||||
});
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
yield openResponsePanel();
|
||||
await openResponsePanel();
|
||||
checkResponsePanelDisplaysJSON();
|
||||
|
||||
let tabpanel = document.querySelector("#response-panel");
|
||||
@ -42,7 +42,7 @@ add_task(function* () {
|
||||
is(labels[0].textContent, "greeting", "The first json property name was incorrect.");
|
||||
is(values[0].textContent, "null", "The first json property value was incorrect.");
|
||||
|
||||
yield teardown(monitor);
|
||||
await teardown(monitor);
|
||||
|
||||
/**
|
||||
* Helper to assert that the response panel found in the provided document is currently
|
||||
|
@ -7,8 +7,8 @@
|
||||
* Tests if JSON responses with unusal/custom MIME types are handled correctly.
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
let { tab, monitor } = yield initNetMonitor(JSON_CUSTOM_MIME_URL);
|
||||
add_task(async function () {
|
||||
let { tab, monitor } = await initNetMonitor(JSON_CUSTOM_MIME_URL);
|
||||
info("Starting test... ");
|
||||
|
||||
let { document, store, windowRequire } = monitor.panelWin;
|
||||
@ -22,15 +22,15 @@ add_task(function* () {
|
||||
store.dispatch(Actions.batchEnable(false));
|
||||
|
||||
let wait = waitForNetworkEvents(monitor, 1);
|
||||
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
|
||||
await ContentTask.spawn(tab.linkedBrowser, {}, async function () {
|
||||
content.wrappedJSObject.performRequests();
|
||||
});
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
let requestItem = document.querySelector(".request-list-item");
|
||||
let requestsListStatus = requestItem.querySelector(".requests-list-status");
|
||||
EventUtils.sendMouseEvent({ type: "mouseover" }, requestsListStatus);
|
||||
yield waitUntil(() => requestsListStatus.title);
|
||||
await waitUntil(() => requestsListStatus.title);
|
||||
|
||||
verifyRequestItemTarget(
|
||||
document,
|
||||
@ -52,11 +52,11 @@ add_task(function* () {
|
||||
document.querySelector(".network-details-panel-toggle"));
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector("#response-tab"));
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
testResponseTab();
|
||||
|
||||
yield teardown(monitor);
|
||||
await teardown(monitor);
|
||||
|
||||
function testResponseTab() {
|
||||
let tabpanel = document.querySelector("#response-panel");
|
||||
|
@ -7,10 +7,10 @@
|
||||
* Tests if JSON responses with unusal/custom MIME types are handled correctly.
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
add_task(async function () {
|
||||
let { L10N } = require("devtools/client/netmonitor/src/utils/l10n");
|
||||
|
||||
let { tab, monitor } = yield initNetMonitor(JSON_TEXT_MIME_URL);
|
||||
let { tab, monitor } = await initNetMonitor(JSON_TEXT_MIME_URL);
|
||||
info("Starting test... ");
|
||||
|
||||
let { document, store, windowRequire } = monitor.panelWin;
|
||||
@ -23,15 +23,15 @@ add_task(function* () {
|
||||
store.dispatch(Actions.batchEnable(false));
|
||||
|
||||
let wait = waitForNetworkEvents(monitor, 1);
|
||||
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
|
||||
await ContentTask.spawn(tab.linkedBrowser, {}, async function () {
|
||||
content.wrappedJSObject.performRequests();
|
||||
});
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
let requestItem = document.querySelector(".request-list-item");
|
||||
let requestsListStatus = requestItem.querySelector(".requests-list-status");
|
||||
EventUtils.sendMouseEvent({ type: "mouseover" }, requestsListStatus);
|
||||
yield waitUntil(() => requestsListStatus.title);
|
||||
await waitUntil(() => requestsListStatus.title);
|
||||
|
||||
verifyRequestItemTarget(
|
||||
document,
|
||||
@ -53,11 +53,11 @@ add_task(function* () {
|
||||
document.querySelector(".network-details-panel-toggle"));
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector("#response-tab"));
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
testResponseTab();
|
||||
|
||||
yield teardown(monitor);
|
||||
await teardown(monitor);
|
||||
|
||||
function testResponseTab() {
|
||||
let tabpanel = document.querySelector("#response-panel");
|
||||
|
@ -7,10 +7,10 @@
|
||||
* Tests if JSONP responses are handled correctly.
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
add_task(async function () {
|
||||
let { L10N } = require("devtools/client/netmonitor/src/utils/l10n");
|
||||
|
||||
let { tab, monitor } = yield initNetMonitor(JSONP_URL);
|
||||
let { tab, monitor } = await initNetMonitor(JSONP_URL);
|
||||
info("Starting test... ");
|
||||
|
||||
let { document, store, windowRequire } = monitor.panelWin;
|
||||
@ -23,17 +23,17 @@ add_task(function* () {
|
||||
store.dispatch(Actions.batchEnable(false));
|
||||
|
||||
let wait = waitForNetworkEvents(monitor, 2);
|
||||
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
|
||||
await ContentTask.spawn(tab.linkedBrowser, {}, async function () {
|
||||
content.wrappedJSObject.performRequests();
|
||||
});
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
let requestItems = document.querySelectorAll(".request-list-item");
|
||||
for (let requestItem of requestItems) {
|
||||
requestItem.scrollIntoView();
|
||||
let requestsListStatus = requestItem.querySelector(".requests-list-status");
|
||||
EventUtils.sendMouseEvent({ type: "mouseover" }, requestsListStatus);
|
||||
yield waitUntil(() => requestsListStatus.title);
|
||||
await waitUntil(() => requestsListStatus.title);
|
||||
}
|
||||
|
||||
verifyRequestItemTarget(
|
||||
@ -71,7 +71,7 @@ add_task(function* () {
|
||||
document.querySelector(".network-details-panel-toggle"));
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector("#response-tab"));
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
testResponseTab("$_0123Fun", "Hello JSONP!");
|
||||
|
||||
@ -80,11 +80,11 @@ add_task(function* () {
|
||||
|
||||
EventUtils.sendMouseEvent({ type: "mousedown" },
|
||||
document.querySelectorAll(".request-list-item")[1]);
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
testResponseTab("$_4567Sad", "Hello weird JSONP!");
|
||||
|
||||
yield teardown(monitor);
|
||||
await teardown(monitor);
|
||||
|
||||
function testResponseTab(func, greeting) {
|
||||
let tabpanel = document.querySelector("#response-panel");
|
||||
|
@ -9,8 +9,8 @@
|
||||
|
||||
const HTML_LONG_URL = CONTENT_TYPE_SJS + "?fmt=html-long";
|
||||
|
||||
add_task(function* () {
|
||||
let { tab, monitor } = yield initNetMonitor(CUSTOM_GET_URL);
|
||||
add_task(async function () {
|
||||
let { tab, monitor } = await initNetMonitor(CUSTOM_GET_URL);
|
||||
info("Starting test... ");
|
||||
|
||||
// This test could potentially be slow because over 100 KB of stuff
|
||||
@ -27,16 +27,16 @@ add_task(function* () {
|
||||
store.dispatch(Actions.batchEnable(false));
|
||||
|
||||
let wait = waitForNetworkEvents(monitor, 1);
|
||||
yield ContentTask.spawn(tab.linkedBrowser, HTML_LONG_URL, function* (url) {
|
||||
await ContentTask.spawn(tab.linkedBrowser, HTML_LONG_URL, async function (url) {
|
||||
content.wrappedJSObject.performRequests(1, url);
|
||||
});
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
let requestItem = document.querySelector(".request-list-item");
|
||||
requestItem.scrollIntoView();
|
||||
let requestsListStatus = requestItem.querySelector(".requests-list-status");
|
||||
EventUtils.sendMouseEvent({ type: "mouseover" }, requestsListStatus);
|
||||
yield waitUntil(() => requestsListStatus.title);
|
||||
await waitUntil(() => requestsListStatus.title);
|
||||
|
||||
verifyRequestItemTarget(
|
||||
document,
|
||||
@ -54,13 +54,13 @@ add_task(function* () {
|
||||
document.querySelector(".network-details-panel-toggle"));
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector("#response-tab"));
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
let text = document.querySelector(".CodeMirror-line").textContent;
|
||||
|
||||
ok(text.match(/^<p>/), "The text shown in the source editor is incorrect.");
|
||||
|
||||
yield teardown(monitor);
|
||||
await teardown(monitor);
|
||||
|
||||
// This test uses a lot of memory, so force a GC to help fragmentation.
|
||||
info("Forcing GC after netmonitor test.");
|
||||
|
@ -7,11 +7,11 @@
|
||||
* Tests that netmonitor doesn't leak windows on parent-side pages (bug 1285638)
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
add_task(async function () {
|
||||
// Tell initNetMonitor to enable cache. Otherwise it will assert that there were more
|
||||
// than zero network requests during the page load. But when loading about:config,
|
||||
// there are none.
|
||||
let { monitor } = yield initNetMonitor("about:config", true);
|
||||
let { monitor } = await initNetMonitor("about:config", true);
|
||||
ok(monitor, "The network monitor was opened");
|
||||
yield teardown(monitor);
|
||||
await teardown(monitor);
|
||||
});
|
||||
|
@ -7,8 +7,8 @@
|
||||
* Test the 'Open in debugger' feature
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
let { tab, monitor, toolbox} = yield initNetMonitor(CONTENT_TYPE_WITHOUT_CACHE_URL);
|
||||
add_task(async function () {
|
||||
let { tab, monitor, toolbox} = await initNetMonitor(CONTENT_TYPE_WITHOUT_CACHE_URL);
|
||||
info("Starting test... ");
|
||||
|
||||
let { document, store, windowRequire } = monitor.panelWin;
|
||||
@ -18,23 +18,23 @@ add_task(function* () {
|
||||
store.dispatch(Actions.batchEnable(false));
|
||||
|
||||
let wait = waitForNetworkEvents(monitor, CONTENT_TYPE_WITHOUT_CACHE_REQUESTS);
|
||||
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
|
||||
await ContentTask.spawn(tab.linkedBrowser, {}, async function () {
|
||||
content.wrappedJSObject.performRequests();
|
||||
});
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
wait = waitForDOM(contextMenuDoc, "#request-list-context-open-in-debugger");
|
||||
EventUtils.sendMouseEvent({ type: "mousedown" },
|
||||
document.querySelectorAll(".request-list-item")[2]);
|
||||
EventUtils.sendMouseEvent({ type: "contextmenu" },
|
||||
document.querySelectorAll(".request-list-item")[2]);
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
let onDebuggerReady = toolbox.once("jsdebugger-ready");
|
||||
contextMenuDoc.querySelector("#request-list-context-open-in-debugger").click();
|
||||
yield onDebuggerReady;
|
||||
await onDebuggerReady;
|
||||
|
||||
ok(true, "Debugger has been open");
|
||||
|
||||
yield teardown(monitor);
|
||||
await teardown(monitor);
|
||||
});
|
||||
|
@ -7,8 +7,8 @@
|
||||
* Test the 'Open in debugger' feature
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
let { tab, monitor, toolbox} = yield initNetMonitor(CONTENT_TYPE_WITHOUT_CACHE_URL);
|
||||
add_task(async function () {
|
||||
let { tab, monitor, toolbox} = await initNetMonitor(CONTENT_TYPE_WITHOUT_CACHE_URL);
|
||||
info("Starting test... ");
|
||||
|
||||
let { document, store, windowRequire } = monitor.panelWin;
|
||||
@ -18,24 +18,24 @@ add_task(function* () {
|
||||
store.dispatch(Actions.batchEnable(false));
|
||||
|
||||
let wait = waitForNetworkEvents(monitor, CONTENT_TYPE_WITHOUT_CACHE_REQUESTS);
|
||||
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
|
||||
await ContentTask.spawn(tab.linkedBrowser, {}, async function () {
|
||||
content.wrappedJSObject.performRequests();
|
||||
});
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
wait = waitForDOM(contextMenuDoc, "#request-list-context-open-in-style-editor");
|
||||
EventUtils.sendMouseEvent({ type: "mousedown" },
|
||||
document.querySelectorAll(".request-list-item")[1]);
|
||||
EventUtils.sendMouseEvent({ type: "contextmenu" },
|
||||
document.querySelectorAll(".request-list-item")[1]);
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
let onStyleEditorReady = toolbox.once("styleeditor-ready");
|
||||
monitor.panelWin.parent.document
|
||||
.querySelector("#request-list-context-open-in-style-editor").click();
|
||||
yield onStyleEditorReady;
|
||||
await onStyleEditorReady;
|
||||
|
||||
ok(true, "Style Editor has been open");
|
||||
|
||||
yield teardown(monitor);
|
||||
await teardown(monitor);
|
||||
});
|
||||
|
@ -7,8 +7,8 @@
|
||||
* Tests if Open in new tab works.
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
let { tab, monitor } = yield initNetMonitor(CUSTOM_GET_URL);
|
||||
add_task(async function () {
|
||||
let { tab, monitor } = await initNetMonitor(CUSTOM_GET_URL);
|
||||
info("Starting test...");
|
||||
|
||||
let { document, store, windowRequire } = monitor.panelWin;
|
||||
@ -18,26 +18,26 @@ add_task(function* () {
|
||||
store.dispatch(Actions.batchEnable(false));
|
||||
|
||||
let wait = waitForNetworkEvents(monitor, 1);
|
||||
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
|
||||
await ContentTask.spawn(tab.linkedBrowser, {}, async function () {
|
||||
content.wrappedJSObject.performRequests(1);
|
||||
});
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
wait = waitForDOM(contextMenuDoc, "#request-list-context-newtab");
|
||||
EventUtils.sendMouseEvent({ type: "mousedown" },
|
||||
document.querySelectorAll(".request-list-item")[0]);
|
||||
EventUtils.sendMouseEvent({ type: "contextmenu" },
|
||||
document.querySelectorAll(".request-list-item")[0]);
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
let onTabOpen = once(gBrowser.tabContainer, "TabOpen", false);
|
||||
monitor.panelWin.parent.document
|
||||
.querySelector("#request-list-context-newtab").click();
|
||||
yield onTabOpen;
|
||||
await onTabOpen;
|
||||
|
||||
ok(true, "A new tab has been opened");
|
||||
|
||||
yield teardown(monitor);
|
||||
await teardown(monitor);
|
||||
|
||||
gBrowser.removeCurrentTab();
|
||||
});
|
||||
|
@ -7,8 +7,8 @@
|
||||
* Tests if the network monitor panes collapse properly.
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
let { tab, monitor } = yield initNetMonitor(SIMPLE_URL);
|
||||
add_task(async function () {
|
||||
let { tab, monitor } = await initNetMonitor(SIMPLE_URL);
|
||||
info("Starting test... ");
|
||||
|
||||
let { document, windowRequire } = monitor.panelWin;
|
||||
@ -17,7 +17,7 @@ add_task(function* () {
|
||||
|
||||
let wait = waitForNetworkEvents(monitor, 1);
|
||||
tab.linkedBrowser.reload();
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
ok(!document.querySelector(".network-details-panel") &&
|
||||
detailsPaneToggleButton.classList.contains("pane-collapsed"),
|
||||
@ -47,5 +47,5 @@ add_task(function* () {
|
||||
!detailsPaneToggleButton.classList.contains("pane-collapsed"),
|
||||
"The details panel should be visible again after uncollapsing.");
|
||||
|
||||
yield teardown(monitor);
|
||||
await teardown(monitor);
|
||||
});
|
||||
|
@ -7,8 +7,8 @@
|
||||
* Tests if toggling the details pane works as expected.
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
let { tab, monitor } = yield initNetMonitor(SIMPLE_URL);
|
||||
add_task(async function () {
|
||||
let { tab, monitor } = await initNetMonitor(SIMPLE_URL);
|
||||
info("Starting test... ");
|
||||
|
||||
let { document, store, windowRequire } = monitor.panelWin;
|
||||
@ -35,7 +35,7 @@ add_task(function* () {
|
||||
|
||||
let networkEvent = monitor.panelWin.once(EVENTS.NETWORK_EVENT);
|
||||
tab.linkedBrowser.reload();
|
||||
yield networkEvent;
|
||||
await networkEvent;
|
||||
|
||||
is(toggleButton.hasAttribute("disabled"), false,
|
||||
"The pane toggle button should be enabled after the first request.");
|
||||
@ -73,7 +73,7 @@ add_task(function* () {
|
||||
is(getSelectedRequest(store.getState()), null,
|
||||
"There should now be no selected item in the requests menu.");
|
||||
|
||||
yield teardown(monitor);
|
||||
await teardown(monitor);
|
||||
|
||||
function getSelectedIndex(state) {
|
||||
if (!state.requests.selectedId) {
|
||||
|
@ -7,8 +7,8 @@
|
||||
* Tests whether keys in Params panel are sorted.
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
let { tab, monitor } = yield initNetMonitor(POST_DATA_URL);
|
||||
add_task(async function () {
|
||||
let { tab, monitor } = await initNetMonitor(POST_DATA_URL);
|
||||
info("Starting test... ");
|
||||
|
||||
let { document, store, windowRequire } = monitor.panelWin;
|
||||
@ -17,15 +17,15 @@ add_task(function* () {
|
||||
store.dispatch(Actions.batchEnable(false));
|
||||
|
||||
let wait = waitForNetworkEvents(monitor, 2);
|
||||
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
|
||||
await ContentTask.spawn(tab.linkedBrowser, {}, async function () {
|
||||
content.wrappedJSObject.performRequests();
|
||||
});
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
wait = waitForDOM(document, ".headers-overview");
|
||||
EventUtils.sendMouseEvent({ type: "mousedown" },
|
||||
document.querySelectorAll(".request-list-item")[0]);
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector("#params-tab"));
|
||||
|
@ -6,8 +6,8 @@
|
||||
/**
|
||||
* Tests if the pause/resume button works.
|
||||
*/
|
||||
add_task(function* () {
|
||||
let { tab, monitor } = yield initNetMonitor(PAUSE_URL);
|
||||
add_task(async function () {
|
||||
let { tab, monitor } = await initNetMonitor(PAUSE_URL);
|
||||
info("Starting test... ");
|
||||
|
||||
let { document, store, windowRequire, connector } = monitor.panelWin;
|
||||
@ -20,7 +20,7 @@ add_task(function* () {
|
||||
assertRequestCount(store, 0);
|
||||
|
||||
// Load one request and assert it shows up in the list.
|
||||
yield performRequestAndWait(tab, monitor);
|
||||
await performRequestAndWait(tab, monitor);
|
||||
assertRequestCount(store, 1);
|
||||
|
||||
let noRequest = true;
|
||||
@ -34,21 +34,21 @@ add_task(function* () {
|
||||
|
||||
// Click pause, load second request and make sure they don't show up.
|
||||
EventUtils.sendMouseEvent({ type: "click" }, pauseButton);
|
||||
yield performPausedRequest(connector, tab, monitor);
|
||||
await performPausedRequest(connector, tab, monitor);
|
||||
ok(noRequest, "There should be no activity when paused.");
|
||||
assertRequestCount(store, 1);
|
||||
|
||||
// Click pause again to resume monitoring. Load a third request
|
||||
// and make sure they will show up.
|
||||
EventUtils.sendMouseEvent({ type: "click" }, pauseButton);
|
||||
yield performRequestAndWait(tab, monitor);
|
||||
await performRequestAndWait(tab, monitor);
|
||||
assertRequestCount(store, 2);
|
||||
|
||||
// Click pause, reload the page and check that there are
|
||||
// some requests. Page reload should auto-resume.
|
||||
EventUtils.sendMouseEvent({ type: "click" }, pauseButton);
|
||||
tab.linkedBrowser.reload();
|
||||
yield waitForNetworkEvents(monitor, 1);
|
||||
await waitForNetworkEvents(monitor, 1);
|
||||
assertRequestCount(store, 1);
|
||||
|
||||
return teardown(monitor);
|
||||
@ -65,23 +65,23 @@ function assertRequestCount(store, count) {
|
||||
/**
|
||||
* Execute simple GET request and wait till it's done.
|
||||
*/
|
||||
function* performRequestAndWait(tab, monitor) {
|
||||
async function performRequestAndWait(tab, monitor) {
|
||||
let wait = waitForNetworkEvents(monitor, 1);
|
||||
yield ContentTask.spawn(tab.linkedBrowser, SIMPLE_SJS, function* (url) {
|
||||
yield content.wrappedJSObject.performRequests(url);
|
||||
await ContentTask.spawn(tab.linkedBrowser, SIMPLE_SJS, async function (url) {
|
||||
await content.wrappedJSObject.performRequests(url);
|
||||
});
|
||||
yield wait;
|
||||
await wait;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute simple GET request
|
||||
*/
|
||||
function* performPausedRequest(connector, tab, monitor) {
|
||||
async function performPausedRequest(connector, tab, monitor) {
|
||||
let wait = waitForWebConsoleNetworkEvent(connector);
|
||||
yield ContentTask.spawn(tab.linkedBrowser, SIMPLE_SJS, function* (url) {
|
||||
yield content.wrappedJSObject.performRequests(url);
|
||||
await ContentTask.spawn(tab.linkedBrowser, SIMPLE_SJS, async function (url) {
|
||||
await content.wrappedJSObject.performRequests(url);
|
||||
});
|
||||
yield wait;
|
||||
await wait;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -8,8 +8,8 @@
|
||||
* You can also use this initialization format as a template for other tests.
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
let { tab, monitor } = yield initNetMonitor(SINGLE_GET_URL);
|
||||
add_task(async function () {
|
||||
let { tab, monitor } = await initNetMonitor(SINGLE_GET_URL);
|
||||
info("Starting test... ");
|
||||
|
||||
let { document, store, windowRequire } = monitor.panelWin;
|
||||
@ -19,19 +19,19 @@ add_task(function* () {
|
||||
|
||||
Services.prefs.setBoolPref("devtools.netmonitor.persistlog", false);
|
||||
|
||||
yield reloadAndWait();
|
||||
await reloadAndWait();
|
||||
|
||||
// Using waitUntil in the test is necessary to ensure all requests are added correctly.
|
||||
// Because reloadAndWait call may catch early uncaught requests from initNetMonitor, so
|
||||
// the actual number of requests after reloadAndWait could be wrong since all requests
|
||||
// haven't finished.
|
||||
yield waitUntil(() => document.querySelectorAll(".request-list-item").length === 2);
|
||||
await waitUntil(() => document.querySelectorAll(".request-list-item").length === 2);
|
||||
is(document.querySelectorAll(".request-list-item").length, 2,
|
||||
"The request list should have two items at this point.");
|
||||
|
||||
yield reloadAndWait();
|
||||
await reloadAndWait();
|
||||
|
||||
yield waitUntil(() => document.querySelectorAll(".request-list-item").length === 2);
|
||||
await waitUntil(() => document.querySelectorAll(".request-list-item").length === 2);
|
||||
// Since the reload clears the log, we still expect two requests in the log
|
||||
is(document.querySelectorAll(".request-list-item").length, 2,
|
||||
"The request list should still have two items at this point.");
|
||||
@ -39,9 +39,9 @@ add_task(function* () {
|
||||
// Now we toggle the persistence logs on
|
||||
Services.prefs.setBoolPref("devtools.netmonitor.persistlog", true);
|
||||
|
||||
yield reloadAndWait();
|
||||
await reloadAndWait();
|
||||
|
||||
yield waitUntil(() => document.querySelectorAll(".request-list-item").length === 4);
|
||||
await waitUntil(() => document.querySelectorAll(".request-list-item").length === 4);
|
||||
// Since we togged the persistence logs, we expect four items after the reload
|
||||
is(document.querySelectorAll(".request-list-item").length, 4,
|
||||
"The request list should now have four items at this point.");
|
||||
|
@ -7,13 +7,13 @@
|
||||
* Tests if the POST requests display the correct information in the UI.
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
add_task(async function () {
|
||||
let { L10N } = require("devtools/client/netmonitor/src/utils/l10n");
|
||||
|
||||
// Set a higher panel height in order to get full CodeMirror content
|
||||
Services.prefs.setIntPref("devtools.toolbox.footer.height", 600);
|
||||
|
||||
let { tab, monitor } = yield initNetMonitor(POST_DATA_URL);
|
||||
let { tab, monitor } = await initNetMonitor(POST_DATA_URL);
|
||||
info("Starting test... ");
|
||||
|
||||
let { document, store, windowRequire } = monitor.panelWin;
|
||||
@ -26,17 +26,17 @@ add_task(function* () {
|
||||
store.dispatch(Actions.batchEnable(false));
|
||||
|
||||
let wait = waitForNetworkEvents(monitor, 2);
|
||||
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
|
||||
await ContentTask.spawn(tab.linkedBrowser, {}, async function () {
|
||||
content.wrappedJSObject.performRequests();
|
||||
});
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
let requestItems = document.querySelectorAll(".request-list-item");
|
||||
for (let requestItem of requestItems) {
|
||||
requestItem.scrollIntoView();
|
||||
let requestsListStatus = requestItem.querySelector(".requests-list-status");
|
||||
EventUtils.sendMouseEvent({ type: "mouseover" }, requestsListStatus);
|
||||
yield waitUntil(() => requestsListStatus.title);
|
||||
await waitUntil(() => requestsListStatus.title);
|
||||
}
|
||||
|
||||
verifyRequestItemTarget(
|
||||
@ -76,20 +76,20 @@ add_task(function* () {
|
||||
document.querySelectorAll(".request-list-item")[0]);
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector("#params-tab"));
|
||||
yield wait;
|
||||
yield testParamsTab("urlencoded");
|
||||
await wait;
|
||||
await testParamsTab("urlencoded");
|
||||
|
||||
// Wait for all tree sections and editor updated by react
|
||||
let waitForSections = waitForDOM(document, "#params-panel .tree-section", 2);
|
||||
let waitForSourceEditor = waitForDOM(document, "#params-panel .CodeMirror-code");
|
||||
EventUtils.sendMouseEvent({ type: "mousedown" },
|
||||
document.querySelectorAll(".request-list-item")[1]);
|
||||
yield Promise.all([waitForSections, waitForSourceEditor]);
|
||||
yield testParamsTab("multipart");
|
||||
await Promise.all([waitForSections, waitForSourceEditor]);
|
||||
await testParamsTab("multipart");
|
||||
|
||||
return teardown(monitor);
|
||||
|
||||
function* testParamsTab(type) {
|
||||
function testParamsTab(type) {
|
||||
let tabpanel = document.querySelector("#params-panel");
|
||||
|
||||
function checkVisibility(box) {
|
||||
|
@ -8,10 +8,10 @@
|
||||
* for raw payloads with attached content-type headers.
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
add_task(async function () {
|
||||
let { L10N } = require("devtools/client/netmonitor/src/utils/l10n");
|
||||
|
||||
let { tab, monitor } = yield initNetMonitor(POST_RAW_URL);
|
||||
let { tab, monitor } = await initNetMonitor(POST_RAW_URL);
|
||||
info("Starting test... ");
|
||||
|
||||
let { document, store, windowRequire } = monitor.panelWin;
|
||||
@ -20,10 +20,10 @@ add_task(function* () {
|
||||
store.dispatch(Actions.batchEnable(false));
|
||||
|
||||
let wait = waitForNetworkEvents(monitor, 1);
|
||||
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
|
||||
await ContentTask.spawn(tab.linkedBrowser, {}, async function () {
|
||||
content.wrappedJSObject.performRequests();
|
||||
});
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
// Wait for all tree view updated by react
|
||||
wait = waitForDOM(document, "#params-panel .tree-section");
|
||||
@ -31,7 +31,7 @@ add_task(function* () {
|
||||
document.querySelectorAll(".request-list-item")[0]);
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector("#params-tab"));
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
let tabpanel = document.querySelector("#params-panel");
|
||||
|
||||
|
@ -8,10 +8,10 @@
|
||||
* for raw payloads with content-type headers attached to the upload stream.
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
add_task(async function () {
|
||||
let { L10N } = require("devtools/client/netmonitor/src/utils/l10n");
|
||||
|
||||
let { tab, monitor } = yield initNetMonitor(POST_RAW_WITH_HEADERS_URL);
|
||||
let { tab, monitor } = await initNetMonitor(POST_RAW_WITH_HEADERS_URL);
|
||||
info("Starting test... ");
|
||||
|
||||
let { document, store, windowRequire } = monitor.panelWin;
|
||||
@ -20,10 +20,10 @@ add_task(function* () {
|
||||
store.dispatch(Actions.batchEnable(false));
|
||||
|
||||
let wait = waitForNetworkEvents(monitor, 1);
|
||||
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
|
||||
await ContentTask.spawn(tab.linkedBrowser, {}, async function () {
|
||||
content.wrappedJSObject.performRequests();
|
||||
});
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
// Wait for all tree view updated by react
|
||||
wait = waitForDOM(document, "#headers-panel .tree-section .treeLabel", 3);
|
||||
@ -31,7 +31,7 @@ add_task(function* () {
|
||||
document.querySelector(".network-details-panel-toggle"));
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector("#headers-tab"));
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
let tabpanel = document.querySelector("#headers-panel");
|
||||
is(tabpanel.querySelectorAll(".tree-section .treeLabel").length, 3,
|
||||
@ -60,7 +60,7 @@ add_task(function* () {
|
||||
wait = waitForDOM(document, "#params-panel .tree-section");
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector("#params-tab"));
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
tabpanel = document.querySelector("#params-panel");
|
||||
|
||||
|
@ -8,10 +8,10 @@
|
||||
* for JSON payloads.
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
add_task(async function () {
|
||||
let { L10N } = require("devtools/client/netmonitor/src/utils/l10n");
|
||||
|
||||
let { tab, monitor } = yield initNetMonitor(POST_JSON_URL);
|
||||
let { tab, monitor } = await initNetMonitor(POST_JSON_URL);
|
||||
info("Starting test... ");
|
||||
|
||||
let { document, store, windowRequire } = monitor.panelWin;
|
||||
@ -20,10 +20,10 @@ add_task(function* () {
|
||||
store.dispatch(Actions.batchEnable(false));
|
||||
|
||||
let wait = waitForNetworkEvents(monitor, 1);
|
||||
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
|
||||
await ContentTask.spawn(tab.linkedBrowser, {}, async function () {
|
||||
content.wrappedJSObject.performRequests();
|
||||
});
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
// Wait for all tree view updated by react
|
||||
wait = waitForDOM(document, "#params-panel .tree-section");
|
||||
@ -31,7 +31,7 @@ add_task(function* () {
|
||||
document.querySelector(".network-details-panel-toggle"));
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector("#params-tab"));
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
let tabpanel = document.querySelector("#params-panel");
|
||||
|
||||
|
@ -7,10 +7,10 @@
|
||||
* Tests if the preferences and localization objects work correctly.
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
add_task(async function () {
|
||||
let { L10N } = require("devtools/client/netmonitor/src/utils/l10n");
|
||||
|
||||
let { monitor } = yield initNetMonitor(SIMPLE_URL);
|
||||
let { monitor } = await initNetMonitor(SIMPLE_URL);
|
||||
info("Starting test... ");
|
||||
|
||||
let { windowRequire } = monitor.panelWin;
|
||||
|
@ -7,8 +7,8 @@
|
||||
* Tests if the prefs that should survive across tool reloads work.
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
let { monitor } = yield initNetMonitor(SIMPLE_URL);
|
||||
add_task(async function () {
|
||||
let { monitor } = await initNetMonitor(SIMPLE_URL);
|
||||
let Actions = monitor.panelWin
|
||||
.windowRequire("devtools/client/netmonitor/src/actions/index");
|
||||
info("Starting test... ");
|
||||
@ -61,12 +61,12 @@ add_task(function* () {
|
||||
/* add more prefs here... */
|
||||
};
|
||||
|
||||
yield testBottom();
|
||||
yield testSide();
|
||||
yield testWindow();
|
||||
await testBottom();
|
||||
await testSide();
|
||||
await testWindow();
|
||||
|
||||
info("Moving toolbox back to the bottom...");
|
||||
yield monitor.toolbox.switchHost("bottom");
|
||||
await monitor.toolbox.switchHost("bottom");
|
||||
return teardown(monitor);
|
||||
|
||||
function storeFirstPrefValues() {
|
||||
@ -175,22 +175,22 @@ add_task(function* () {
|
||||
}
|
||||
}
|
||||
|
||||
function* restartNetMonitorAndSetupEnv() {
|
||||
let newMonitor = yield restartNetMonitor(monitor);
|
||||
async function restartNetMonitorAndSetupEnv() {
|
||||
let newMonitor = await restartNetMonitor(monitor);
|
||||
monitor = newMonitor.monitor;
|
||||
|
||||
let networkEvent = waitForNetworkEvents(monitor, 1);
|
||||
newMonitor.tab.linkedBrowser.reload();
|
||||
yield networkEvent;
|
||||
await networkEvent;
|
||||
|
||||
let wait = waitForDOM(getDoc(), ".network-details-panel");
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
getDoc().querySelector(".network-details-panel-toggle"));
|
||||
yield wait;
|
||||
await wait;
|
||||
}
|
||||
|
||||
function* testBottom() {
|
||||
yield restartNetMonitorAndSetupEnv();
|
||||
async function testBottom() {
|
||||
await restartNetMonitorAndSetupEnv();
|
||||
|
||||
info("Testing prefs reload for a bottom host.");
|
||||
storeFirstPrefValues();
|
||||
@ -199,24 +199,24 @@ add_task(function* () {
|
||||
validateFirstPrefValues(true);
|
||||
modifyFrontend(true);
|
||||
|
||||
yield restartNetMonitorAndSetupEnv();
|
||||
await restartNetMonitorAndSetupEnv();
|
||||
|
||||
// Revalidate and reset frontend while toolbox is on the bottom.
|
||||
validateNewPrefValues(true);
|
||||
resetFrontend(true);
|
||||
|
||||
yield restartNetMonitorAndSetupEnv();
|
||||
await restartNetMonitorAndSetupEnv();
|
||||
|
||||
// Revalidate.
|
||||
validateFirstPrefValues(true);
|
||||
}
|
||||
|
||||
function* testSide() {
|
||||
yield restartNetMonitorAndSetupEnv();
|
||||
async function testSide() {
|
||||
await restartNetMonitorAndSetupEnv();
|
||||
|
||||
info("Moving toolbox to the side...");
|
||||
|
||||
yield monitor.toolbox.switchHost("side");
|
||||
await monitor.toolbox.switchHost("side");
|
||||
info("Testing prefs reload for a side host.");
|
||||
storeFirstPrefValues();
|
||||
|
||||
@ -224,24 +224,24 @@ add_task(function* () {
|
||||
validateFirstPrefValues(false);
|
||||
modifyFrontend(false);
|
||||
|
||||
yield restartNetMonitorAndSetupEnv();
|
||||
await restartNetMonitorAndSetupEnv();
|
||||
|
||||
// Revalidate and reset frontend while toolbox is on the side.
|
||||
validateNewPrefValues(false);
|
||||
resetFrontend(false);
|
||||
|
||||
yield restartNetMonitorAndSetupEnv();
|
||||
await restartNetMonitorAndSetupEnv();
|
||||
|
||||
// Revalidate.
|
||||
validateFirstPrefValues(false);
|
||||
}
|
||||
|
||||
function* testWindow() {
|
||||
yield restartNetMonitorAndSetupEnv();
|
||||
async function testWindow() {
|
||||
await restartNetMonitorAndSetupEnv();
|
||||
|
||||
info("Moving toolbox into a window...");
|
||||
|
||||
yield monitor.toolbox.switchHost("window");
|
||||
await monitor.toolbox.switchHost("window");
|
||||
info("Testing prefs reload for a window host.");
|
||||
storeFirstPrefValues();
|
||||
|
||||
@ -249,13 +249,13 @@ add_task(function* () {
|
||||
validateFirstPrefValues(true);
|
||||
modifyFrontend(true);
|
||||
|
||||
yield restartNetMonitorAndSetupEnv();
|
||||
await restartNetMonitorAndSetupEnv();
|
||||
|
||||
// Revalidate and reset frontend while toolbox is in a window.
|
||||
validateNewPrefValues(true);
|
||||
resetFrontend(true);
|
||||
|
||||
yield restartNetMonitorAndSetupEnv();
|
||||
await restartNetMonitorAndSetupEnv();
|
||||
|
||||
// Revalidate.
|
||||
validateFirstPrefValues(true);
|
||||
|
@ -7,8 +7,8 @@
|
||||
* Tests if showing raw headers works.
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
let { tab, monitor } = yield initNetMonitor(POST_DATA_URL);
|
||||
add_task(async function () {
|
||||
let { tab, monitor } = await initNetMonitor(POST_DATA_URL);
|
||||
info("Starting test... ");
|
||||
|
||||
let { document, store, windowRequire } = monitor.panelWin;
|
||||
@ -20,19 +20,19 @@ add_task(function* () {
|
||||
store.dispatch(Actions.batchEnable(false));
|
||||
|
||||
let wait = waitForNetworkEvents(monitor, 2);
|
||||
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
|
||||
await ContentTask.spawn(tab.linkedBrowser, {}, async function () {
|
||||
content.wrappedJSObject.performRequests();
|
||||
});
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
wait = waitForDOM(document, "#headers-panel .tree-section", 2);
|
||||
EventUtils.sendMouseEvent({ type: "mousedown" },
|
||||
document.querySelectorAll(".request-list-item")[0]);
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
wait = waitForDOM(document, ".raw-headers-container textarea", 2);
|
||||
EventUtils.sendMouseEvent({ type: "click" }, getRawHeadersButton());
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
testRawHeaderButtonStyle(true);
|
||||
|
||||
|
@ -7,8 +7,8 @@
|
||||
* Tests if the empty-requests reload button works.
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
let { monitor } = yield initNetMonitor(SIMPLE_URL);
|
||||
add_task(async function () {
|
||||
let { monitor } = await initNetMonitor(SIMPLE_URL);
|
||||
info("Starting test... ");
|
||||
|
||||
let { document } = monitor.panelWin;
|
||||
@ -16,7 +16,7 @@ add_task(function* () {
|
||||
let wait = waitForNetworkEvents(monitor, 1);
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector(".requests-list-reload-notice-button"));
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
is(document.querySelectorAll(".request-list-item").length, 1,
|
||||
"The request list should have one item after reloading");
|
||||
|
@ -7,8 +7,8 @@
|
||||
* Tests if the empty-requests reload button works.
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
let { monitor } = yield initNetMonitor(SIMPLE_URL);
|
||||
add_task(async function () {
|
||||
let { monitor } = await initNetMonitor(SIMPLE_URL);
|
||||
info("Starting test... ");
|
||||
|
||||
let { document } = monitor.panelWin;
|
||||
@ -18,8 +18,8 @@ add_task(function* () {
|
||||
let button = document.querySelector(".requests-list-reload-notice-button");
|
||||
button.click();
|
||||
|
||||
yield waitForNetworkEvents(monitor, 1);
|
||||
let markers = yield markersDone;
|
||||
await waitForNetworkEvents(monitor, 1);
|
||||
let markers = await markersDone;
|
||||
|
||||
ok(true, "Reloading finished");
|
||||
|
||||
|
@ -7,10 +7,10 @@
|
||||
* Test if request and response body logging stays on after opening the console.
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
add_task(async function () {
|
||||
let { L10N } = require("devtools/client/netmonitor/src/utils/l10n");
|
||||
|
||||
let { tab, monitor } = yield initNetMonitor(JSON_LONG_URL);
|
||||
let { tab, monitor } = await initNetMonitor(JSON_LONG_URL);
|
||||
info("Starting test... ");
|
||||
|
||||
let { document, store, windowRequire } = monitor.panelWin;
|
||||
@ -24,46 +24,46 @@ add_task(function* () {
|
||||
|
||||
// Perform first batch of requests.
|
||||
let wait = waitForNetworkEvents(monitor, 1);
|
||||
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
|
||||
await ContentTask.spawn(tab.linkedBrowser, {}, async function () {
|
||||
content.wrappedJSObject.performRequests();
|
||||
});
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
yield verifyRequest(0);
|
||||
await verifyRequest(0);
|
||||
|
||||
// Switch to the webconsole.
|
||||
let onWebConsole = monitor.toolbox.once("webconsole-selected");
|
||||
monitor.toolbox.selectTool("webconsole");
|
||||
yield onWebConsole;
|
||||
await onWebConsole;
|
||||
|
||||
// Switch back to the netmonitor.
|
||||
let onNetMonitor = monitor.toolbox.once("netmonitor-selected");
|
||||
monitor.toolbox.selectTool("netmonitor");
|
||||
yield onNetMonitor;
|
||||
await onNetMonitor;
|
||||
|
||||
// Reload debugee.
|
||||
wait = waitForNetworkEvents(monitor, 1);
|
||||
tab.linkedBrowser.reload();
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
// Perform another batch of requests.
|
||||
wait = waitForNetworkEvents(monitor, 1);
|
||||
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
|
||||
await ContentTask.spawn(tab.linkedBrowser, {}, async function () {
|
||||
content.wrappedJSObject.performRequests();
|
||||
});
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
yield verifyRequest(1);
|
||||
await verifyRequest(1);
|
||||
|
||||
return teardown(monitor);
|
||||
|
||||
function* verifyRequest(index) {
|
||||
async function verifyRequest(index) {
|
||||
let requestItems = document.querySelectorAll(".request-list-item");
|
||||
for (let requestItem of requestItems) {
|
||||
requestItem.scrollIntoView();
|
||||
let requestsListStatus = requestItem.querySelector(".requests-list-status");
|
||||
EventUtils.sendMouseEvent({ type: "mouseover" }, requestsListStatus);
|
||||
yield waitUntil(() => requestsListStatus.title);
|
||||
await waitUntil(() => requestsListStatus.title);
|
||||
}
|
||||
verifyRequestItemTarget(
|
||||
document,
|
||||
|
@ -8,8 +8,8 @@
|
||||
* a preflight OPTIONS request (bug 1270096 and friends)
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
let { tab, monitor } = yield initNetMonitor(CORS_URL);
|
||||
add_task(async function () {
|
||||
let { tab, monitor } = await initNetMonitor(CORS_URL);
|
||||
info("Starting test... ");
|
||||
|
||||
let { store, windowRequire, connector } = monitor.panelWin;
|
||||
@ -25,10 +25,10 @@ add_task(function* () {
|
||||
|
||||
info("Waiting for OPTIONS, then POST");
|
||||
let wait = waitForNetworkEvents(monitor, 2);
|
||||
yield ContentTask.spawn(tab.linkedBrowser, requestUrl, function* (url) {
|
||||
await ContentTask.spawn(tab.linkedBrowser, requestUrl, async function (url) {
|
||||
content.wrappedJSObject.performRequests(url, "triggering/preflight", "post-data");
|
||||
});
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
const METHODS = ["OPTIONS", "POST"];
|
||||
const ITEMS = METHODS.map((val, i) => getSortedRequests(store.getState()).get(i));
|
||||
@ -48,7 +48,7 @@ add_task(function* () {
|
||||
|
||||
// Wait for requestHeaders and responseHeaders are required when fetching data
|
||||
// from back-end.
|
||||
yield waitUntil(() => {
|
||||
await waitUntil(() => {
|
||||
item = getRequestById(store.getState(), item.id);
|
||||
return item.requestHeaders && item.responseHeaders;
|
||||
});
|
||||
@ -61,11 +61,11 @@ add_task(function* () {
|
||||
info("Sending the cloned request (without change)");
|
||||
store.dispatch(Actions.sendCustomRequest(connector));
|
||||
|
||||
yield waitUntil(() => getSortedRequests(store.getState()).size === size + 1);
|
||||
await waitUntil(() => getSortedRequests(store.getState()).size === size + 1);
|
||||
}
|
||||
|
||||
info("Waiting for both resent requests");
|
||||
yield onRequests;
|
||||
await onRequests;
|
||||
|
||||
// Check the resent requests
|
||||
for (let i = 0; i < ITEMS.length; i++) {
|
||||
@ -79,14 +79,14 @@ add_task(function* () {
|
||||
|
||||
// Trigger responseContent update requires to wait until
|
||||
// responseContentAvailable set true
|
||||
yield waitUntil(() => {
|
||||
await waitUntil(() => {
|
||||
item = getRequestById(store.getState(), item.id);
|
||||
return item.responseContentAvailable;
|
||||
});
|
||||
yield connector.requestData(item.id, "responseContent");
|
||||
await connector.requestData(item.id, "responseContent");
|
||||
|
||||
// Wait for both requestPostData & responseContent payloads arrived.
|
||||
yield waitUntil(() => {
|
||||
await waitUntil(() => {
|
||||
item = getRequestById(store.getState(), item.id);
|
||||
return item.responseContent && item.requestPostData;
|
||||
});
|
||||
|
@ -7,8 +7,8 @@
|
||||
* Test if custom request headers are not ignored (bug 1270096 and friends)
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
let { monitor } = yield initNetMonitor(SIMPLE_SJS);
|
||||
add_task(async function () {
|
||||
let { monitor } = await initNetMonitor(SIMPLE_SJS);
|
||||
info("Starting test... ");
|
||||
|
||||
let { store, windowRequire, connector } = monitor.panelWin;
|
||||
@ -37,7 +37,7 @@ add_task(function* () {
|
||||
headers: requestHeaders,
|
||||
body: "Hello"
|
||||
});
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
let item = getSortedRequests(store.getState()).get(0);
|
||||
|
||||
@ -48,7 +48,7 @@ add_task(function* () {
|
||||
}
|
||||
|
||||
// Wait until requestHeaders packet gets updated.
|
||||
yield waitUntil(() => {
|
||||
await waitUntil(() => {
|
||||
item = getSortedRequests(store.getState()).get(0);
|
||||
return item.requestHeaders;
|
||||
});
|
||||
|
@ -7,8 +7,8 @@
|
||||
* Test that Security details tab contains the expected data.
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
let { tab, monitor } = yield initNetMonitor(CUSTOM_GET_URL);
|
||||
add_task(async function () {
|
||||
let { tab, monitor } = await initNetMonitor(CUSTOM_GET_URL);
|
||||
let { document, store, windowRequire } = monitor.panelWin;
|
||||
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
|
||||
|
||||
@ -17,16 +17,16 @@ add_task(function* () {
|
||||
info("Performing a secure request.");
|
||||
const REQUESTS_URL = "https://example.com" + CORS_SJS_PATH;
|
||||
let wait = waitForNetworkEvents(monitor, 1);
|
||||
yield ContentTask.spawn(tab.linkedBrowser, REQUESTS_URL, function* (url) {
|
||||
await ContentTask.spawn(tab.linkedBrowser, REQUESTS_URL, async function (url) {
|
||||
content.wrappedJSObject.performRequests(1, url);
|
||||
});
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector(".network-details-panel-toggle"));
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector("#security-tab"));
|
||||
yield waitUntil(() => document.querySelector(
|
||||
await waitUntil(() => document.querySelector(
|
||||
"#security-panel .security-info-value"));
|
||||
|
||||
let tabpanel = document.querySelector("#security-panel");
|
||||
@ -77,5 +77,5 @@ add_task(function* () {
|
||||
// cert sha256 fingerprint
|
||||
isnot(textboxes[15].value, "", "Label was not empty.");
|
||||
|
||||
yield teardown(monitor);
|
||||
await teardown(monitor);
|
||||
});
|
||||
|
@ -7,8 +7,8 @@
|
||||
* Test that Security details tab shows an error message with broken connections.
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
let { tab, monitor } = yield initNetMonitor(CUSTOM_GET_URL);
|
||||
add_task(async function () {
|
||||
let { tab, monitor } = await initNetMonitor(CUSTOM_GET_URL);
|
||||
let { document, store, windowRequire } = monitor.panelWin;
|
||||
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
|
||||
|
||||
@ -17,19 +17,19 @@ add_task(function* () {
|
||||
info("Requesting a resource that has a certificate problem.");
|
||||
|
||||
let requestsDone = waitForNetworkEvents(monitor, 1);
|
||||
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
|
||||
await ContentTask.spawn(tab.linkedBrowser, {}, async function () {
|
||||
content.wrappedJSObject.performRequests(1, "https://nocert.example.com");
|
||||
});
|
||||
yield requestsDone;
|
||||
await requestsDone;
|
||||
|
||||
let securityInfoLoaded = waitForDOM(document, ".security-info-value");
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector(".network-details-panel-toggle"));
|
||||
|
||||
yield waitUntil(() => document.querySelector("#security-tab"));
|
||||
await waitUntil(() => document.querySelector("#security-tab"));
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector("#security-tab"));
|
||||
yield securityInfoLoaded;
|
||||
await securityInfoLoaded;
|
||||
|
||||
let errormsg = document.querySelector(".security-info-value");
|
||||
isnot(errormsg.textContent, "", "Error message is not empty.");
|
||||
|
@ -7,20 +7,20 @@
|
||||
* Test that clicking on the security indicator opens the security details tab.
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
let { tab, monitor } = yield initNetMonitor(CUSTOM_GET_URL);
|
||||
add_task(async function () {
|
||||
let { tab, monitor } = await initNetMonitor(CUSTOM_GET_URL);
|
||||
let { document, store, windowRequire } = monitor.panelWin;
|
||||
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
|
||||
|
||||
store.dispatch(Actions.batchEnable(false));
|
||||
|
||||
info("Requesting a resource over HTTPS.");
|
||||
yield performRequestAndWait("https://example.com" + CORS_SJS_PATH + "?request_2");
|
||||
yield performRequestAndWait("https://example.com" + CORS_SJS_PATH + "?request_1");
|
||||
await performRequestAndWait("https://example.com" + CORS_SJS_PATH + "?request_2");
|
||||
await performRequestAndWait("https://example.com" + CORS_SJS_PATH + "?request_1");
|
||||
|
||||
is(store.getState().requests.requests.size, 2, "Two events event logged.");
|
||||
|
||||
yield clickAndTestSecurityIcon();
|
||||
await clickAndTestSecurityIcon();
|
||||
|
||||
info("Selecting headers panel again.");
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
@ -32,23 +32,23 @@ add_task(function* () {
|
||||
|
||||
info("Testing that security icon can be clicked after the items were sorted.");
|
||||
|
||||
yield clickAndTestSecurityIcon();
|
||||
await clickAndTestSecurityIcon();
|
||||
|
||||
return teardown(monitor);
|
||||
|
||||
function* performRequestAndWait(url) {
|
||||
async function performRequestAndWait(url) {
|
||||
let wait = waitForNetworkEvents(monitor, 1);
|
||||
yield ContentTask.spawn(tab.linkedBrowser, { url }, function* (args) {
|
||||
await ContentTask.spawn(tab.linkedBrowser, { url }, async function (args) {
|
||||
content.wrappedJSObject.performRequests(1, args.url);
|
||||
});
|
||||
return wait;
|
||||
}
|
||||
|
||||
function* clickAndTestSecurityIcon() {
|
||||
async 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);
|
||||
yield waitUntil(() => document.querySelector("#security-panel .security-info-value"));
|
||||
await waitUntil(() => document.querySelector("#security-panel .security-info-value"));
|
||||
|
||||
ok(document.querySelector("#security-tab[aria-selected=true]"),
|
||||
"Security tab is selected.");
|
||||
|
@ -8,18 +8,18 @@
|
||||
* request.
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
let { tab, monitor } = yield initNetMonitor(CUSTOM_GET_URL);
|
||||
add_task(async function () {
|
||||
let { tab, monitor } = await initNetMonitor(CUSTOM_GET_URL);
|
||||
let { document, store, windowRequire } = monitor.panelWin;
|
||||
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
|
||||
|
||||
store.dispatch(Actions.batchEnable(false));
|
||||
|
||||
let wait = waitForNetworkEvents(monitor, 2);
|
||||
yield ContentTask.spawn(tab.linkedBrowser, HTTPS_REDIRECT_SJS, function* (url) {
|
||||
await ContentTask.spawn(tab.linkedBrowser, HTTPS_REDIRECT_SJS, async function (url) {
|
||||
content.wrappedJSObject.performRequests(1, url);
|
||||
});
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
is(store.getState().requests.requests.size, 2,
|
||||
"There were two requests due to redirect.");
|
||||
@ -35,5 +35,5 @@ add_task(function* () {
|
||||
ok(redirectSecurityIcon.classList.contains("security-state-secure"),
|
||||
"Redirected request was marked secure.");
|
||||
|
||||
yield teardown(monitor);
|
||||
await teardown(monitor);
|
||||
});
|
||||
|
@ -8,7 +8,7 @@
|
||||
* state.
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
add_task(async function () {
|
||||
const EXPECTED_SECURITY_STATES = {
|
||||
"test1.example.com": "security-state-insecure",
|
||||
"example.com": "security-state-secure",
|
||||
@ -16,13 +16,13 @@ add_task(function* () {
|
||||
"localhost": "security-state-local",
|
||||
};
|
||||
|
||||
let { tab, monitor } = yield initNetMonitor(CUSTOM_GET_URL);
|
||||
let { tab, monitor } = await initNetMonitor(CUSTOM_GET_URL);
|
||||
let { document, store, windowRequire } = monitor.panelWin;
|
||||
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
|
||||
|
||||
store.dispatch(Actions.batchEnable(false));
|
||||
|
||||
yield performRequests();
|
||||
await performRequests();
|
||||
|
||||
for (let subitemNode of Array.from(document.querySelectorAll(
|
||||
"requests-list-column.requests-list-security-and-domain"))) {
|
||||
@ -49,38 +49,38 @@ add_task(function* () {
|
||||
* - http://localhost (local)
|
||||
* and waits until NetworkMonitor has handled all packets sent by the server.
|
||||
*/
|
||||
function* performRequests() {
|
||||
async function performRequests() {
|
||||
function executeRequests(count, url) {
|
||||
return ContentTask.spawn(tab.linkedBrowser, {count, url}, function* (args) {
|
||||
return ContentTask.spawn(tab.linkedBrowser, {count, url}, async function (args) {
|
||||
content.wrappedJSObject.performRequests(args.count, args.url);
|
||||
});
|
||||
}
|
||||
|
||||
let done = waitForNetworkEvents(monitor, 1);
|
||||
info("Requesting a resource that has a certificate problem.");
|
||||
yield executeRequests(1, "https://nocert.example.com");
|
||||
await executeRequests(1, "https://nocert.example.com");
|
||||
|
||||
// Wait for the request to complete before firing another request. Otherwise
|
||||
// the request with security issues interfere with waitForNetworkEvents.
|
||||
info("Waiting for request to complete.");
|
||||
yield done;
|
||||
await done;
|
||||
|
||||
// Next perform a request over HTTP. If done the other way around the latter
|
||||
// occasionally hangs waiting for event timings that don't seem to appear...
|
||||
done = waitForNetworkEvents(monitor, 1);
|
||||
info("Requesting a resource over HTTP.");
|
||||
yield executeRequests(1, "http://test1.example.com" + CORS_SJS_PATH);
|
||||
yield done;
|
||||
await executeRequests(1, "http://test1.example.com" + CORS_SJS_PATH);
|
||||
await done;
|
||||
|
||||
done = waitForNetworkEvents(monitor, 1);
|
||||
info("Requesting a resource over HTTPS.");
|
||||
yield executeRequests(1, "https://example.com" + CORS_SJS_PATH);
|
||||
yield done;
|
||||
await executeRequests(1, "https://example.com" + CORS_SJS_PATH);
|
||||
await done;
|
||||
|
||||
done = waitForNetworkEvents(monitor, 1);
|
||||
info("Requesting a resource over HTTP to localhost.");
|
||||
yield executeRequests(1, "http://localhost" + CORS_SJS_PATH);
|
||||
yield done;
|
||||
await executeRequests(1, "http://localhost" + CORS_SJS_PATH);
|
||||
await done;
|
||||
|
||||
const expectedCount = Object.keys(EXPECTED_SECURITY_STATES).length;
|
||||
is(store.getState().requests.requests.size,
|
||||
|
@ -8,8 +8,8 @@
|
||||
* is selected.
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
let { tab, monitor } = yield initNetMonitor(CUSTOM_GET_URL);
|
||||
add_task(async function () {
|
||||
let { tab, monitor } = await initNetMonitor(CUSTOM_GET_URL);
|
||||
let { document, store, windowRequire } = monitor.panelWin;
|
||||
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
|
||||
|
||||
@ -21,18 +21,18 @@ add_task(function* () {
|
||||
"https://example.com" + CORS_SJS_PATH,
|
||||
"http://example.com" + CORS_SJS_PATH,
|
||||
];
|
||||
yield ContentTask.spawn(tab.linkedBrowser, REQUEST_URLS, function* (urls) {
|
||||
await ContentTask.spawn(tab.linkedBrowser, REQUEST_URLS, async function (urls) {
|
||||
for (let url of urls) {
|
||||
content.wrappedJSObject.performRequests(1, url);
|
||||
}
|
||||
});
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
info("Selecting secure request.");
|
||||
wait = waitForDOM(document, ".tabs");
|
||||
EventUtils.sendMouseEvent({ type: "mousedown" },
|
||||
document.querySelectorAll(".request-list-item")[0]);
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
info("Selecting security tab.");
|
||||
EventUtils.sendMouseEvent({ type: "mousedown" },
|
||||
|
@ -7,7 +7,7 @@
|
||||
* Test that security details tab is visible only when it should.
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
add_task(async function () {
|
||||
const TEST_DATA = [
|
||||
{
|
||||
desc: "http request",
|
||||
@ -31,7 +31,7 @@ add_task(function* () {
|
||||
}
|
||||
];
|
||||
|
||||
let { tab, monitor } = yield initNetMonitor(CUSTOM_GET_URL);
|
||||
let { tab, monitor } = await initNetMonitor(CUSTOM_GET_URL);
|
||||
let { document, store, windowRequire } = monitor.panelWin;
|
||||
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
|
||||
let { getSelectedRequest } =
|
||||
@ -47,12 +47,12 @@ add_task(function* () {
|
||||
waitForNetworkEvents(monitor, 1);
|
||||
|
||||
info("Performing a request to " + testcase.uri);
|
||||
yield ContentTask.spawn(tab.linkedBrowser, testcase.uri, function* (url) {
|
||||
await ContentTask.spawn(tab.linkedBrowser, testcase.uri, async function (url) {
|
||||
content.wrappedJSObject.performRequests(1, url);
|
||||
});
|
||||
|
||||
info("Waiting for new network event.");
|
||||
yield onNewItem;
|
||||
await onNewItem;
|
||||
|
||||
info("Selecting the request.");
|
||||
EventUtils.sendMouseEvent({ type: "mousedown" },
|
||||
@ -66,14 +66,14 @@ add_task(function* () {
|
||||
|
||||
if (testcase.visibleOnSecurityInfo) {
|
||||
// click security panel to lazy load the securityState
|
||||
yield waitUntil(() => document.querySelector("#security-tab"));
|
||||
await waitUntil(() => document.querySelector("#security-tab"));
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector("#security-tab"));
|
||||
yield waitUntil(() => document.querySelector(
|
||||
await waitUntil(() => document.querySelector(
|
||||
"#security-panel .security-info-value"));
|
||||
info("Waiting for security information to arrive.");
|
||||
|
||||
yield waitUntil(() => !!getSelectedRequest(store.getState()).securityState);
|
||||
await waitUntil(() => !!getSelectedRequest(store.getState()).securityState);
|
||||
ok(getSelectedRequest(store.getState()).securityState,
|
||||
"Security state arrived.");
|
||||
}
|
||||
@ -83,7 +83,7 @@ add_task(function* () {
|
||||
" after security information arrived.");
|
||||
|
||||
info("Waiting for request to complete.");
|
||||
yield onComplete;
|
||||
await onComplete;
|
||||
|
||||
is(!!document.querySelector("#security-tab"), testcase.visibleOnceComplete,
|
||||
"Security tab is " + (testcase.visibleOnceComplete ? "visible" : "hidden") +
|
||||
|
@ -15,8 +15,8 @@ const TEST_CASES = [
|
||||
},
|
||||
];
|
||||
|
||||
add_task(function* () {
|
||||
let { tab, monitor } = yield initNetMonitor(CUSTOM_GET_URL);
|
||||
add_task(async function () {
|
||||
let { tab, monitor } = await initNetMonitor(CUSTOM_GET_URL);
|
||||
let { document, store, windowRequire } = monitor.panelWin;
|
||||
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
|
||||
|
||||
@ -27,23 +27,23 @@ add_task(function* () {
|
||||
|
||||
info("Performing request to " + test.uri);
|
||||
let wait = waitForNetworkEvents(monitor, 1);
|
||||
yield ContentTask.spawn(tab.linkedBrowser, test.uri, function* (url) {
|
||||
await ContentTask.spawn(tab.linkedBrowser, test.uri, async function (url) {
|
||||
content.wrappedJSObject.performRequests(1, url);
|
||||
});
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
info("Selecting the request.");
|
||||
wait = waitForDOM(document, ".tabs");
|
||||
EventUtils.sendMouseEvent({ type: "mousedown" },
|
||||
document.querySelectorAll(".request-list-item")[0]);
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
if (!document.querySelector("#security-tab[aria-selected=true]")) {
|
||||
info("Selecting security tab.");
|
||||
wait = waitForDOM(document, "#security-panel .properties-view");
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector("#security-tab"));
|
||||
yield wait;
|
||||
await wait;
|
||||
}
|
||||
|
||||
is(document.querySelector("#security-warning-cipher"),
|
||||
|
@ -7,8 +7,8 @@
|
||||
* Tests if beacons from other tabs are properly ignored.
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
let { tab, monitor } = yield initNetMonitor(SIMPLE_URL);
|
||||
add_task(async function () {
|
||||
let { tab, monitor } = await initNetMonitor(SIMPLE_URL);
|
||||
let { store, windowRequire } = monitor.panelWin;
|
||||
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
|
||||
let {
|
||||
@ -17,23 +17,23 @@ add_task(function* () {
|
||||
|
||||
store.dispatch(Actions.batchEnable(false));
|
||||
|
||||
let beaconTab = yield addTab(SEND_BEACON_URL);
|
||||
let beaconTab = await addTab(SEND_BEACON_URL);
|
||||
info("Beacon tab added successfully.");
|
||||
|
||||
is(store.getState().requests.requests.size, 0, "The requests menu should be empty.");
|
||||
|
||||
let wait = waitForNetworkEvents(monitor, 1);
|
||||
yield ContentTask.spawn(beaconTab.linkedBrowser, {}, function* () {
|
||||
await ContentTask.spawn(beaconTab.linkedBrowser, {}, async function () {
|
||||
content.wrappedJSObject.performRequest();
|
||||
});
|
||||
tab.linkedBrowser.reload();
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
is(store.getState().requests.requests.size, 1, "Only the reload should be recorded.");
|
||||
let request = getSortedRequests(store.getState()).get(0);
|
||||
is(request.method, "GET", "The method is correct.");
|
||||
is(request.status, "200", "The status is correct.");
|
||||
|
||||
yield removeTab(beaconTab);
|
||||
await removeTab(beaconTab);
|
||||
return teardown(monitor);
|
||||
});
|
||||
|
@ -7,8 +7,8 @@
|
||||
* Tests if beacons are handled correctly.
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
let { tab, monitor } = yield initNetMonitor(SEND_BEACON_URL);
|
||||
add_task(async function () {
|
||||
let { tab, monitor } = await initNetMonitor(SEND_BEACON_URL);
|
||||
let { store, windowRequire } = monitor.panelWin;
|
||||
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
|
||||
let { getSortedRequests } =
|
||||
@ -19,10 +19,10 @@ add_task(function* () {
|
||||
is(store.getState().requests.requests.size, 0, "The requests menu should be empty.");
|
||||
|
||||
let wait = waitForNetworkEvents(monitor, 1);
|
||||
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
|
||||
await ContentTask.spawn(tab.linkedBrowser, {}, async function () {
|
||||
content.wrappedJSObject.performRequest();
|
||||
});
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
is(store.getState().requests.requests.size, 1, "The beacon should be recorded.");
|
||||
let request = getSortedRequests(store.getState()).get(0);
|
||||
|
@ -12,8 +12,8 @@ const URL = EXAMPLE_URL.replace("http:", "https:");
|
||||
|
||||
const TEST_URL = URL + "service-workers/status-codes.html";
|
||||
|
||||
add_task(function* () {
|
||||
let { tab, monitor } = yield initNetMonitor(TEST_URL, true);
|
||||
add_task(async function () {
|
||||
let { tab, monitor } = await initNetMonitor(TEST_URL, true);
|
||||
info("Starting test... ");
|
||||
|
||||
let { document, store, windowRequire, connector } = monitor.panelWin;
|
||||
@ -41,21 +41,21 @@ add_task(function* () {
|
||||
];
|
||||
|
||||
info("Registering the service worker...");
|
||||
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
|
||||
yield content.wrappedJSObject.registerServiceWorker();
|
||||
await ContentTask.spawn(tab.linkedBrowser, {}, async function () {
|
||||
await content.wrappedJSObject.registerServiceWorker();
|
||||
});
|
||||
|
||||
info("Performing requests...");
|
||||
let wait = waitForNetworkEvents(monitor, REQUEST_DATA.length);
|
||||
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
|
||||
await ContentTask.spawn(tab.linkedBrowser, {}, async function () {
|
||||
content.wrappedJSObject.performRequests();
|
||||
});
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
// Fetch stack-trace data from the backend and wait till
|
||||
// all packets are received.
|
||||
let requests = getSortedRequests(store.getState());
|
||||
yield Promise.all(requests.map(requestItem =>
|
||||
await Promise.all(requests.map(requestItem =>
|
||||
connector.requestData(requestItem.id, "stackTrace")));
|
||||
|
||||
let requestItems = document.querySelectorAll(".request-list-item");
|
||||
@ -63,7 +63,7 @@ add_task(function* () {
|
||||
requestItem.scrollIntoView();
|
||||
let requestsListStatus = requestItem.querySelector(".requests-list-status");
|
||||
EventUtils.sendMouseEvent({ type: "mouseover" }, requestsListStatus);
|
||||
yield waitUntil(() => requestsListStatus.title);
|
||||
await waitUntil(() => requestsListStatus.title);
|
||||
}
|
||||
|
||||
let index = 0;
|
||||
@ -71,7 +71,7 @@ add_task(function* () {
|
||||
let item = getSortedRequests(store.getState()).get(index);
|
||||
|
||||
info(`Verifying request #${index}`);
|
||||
yield verifyRequestItemTarget(
|
||||
await verifyRequestItemTarget(
|
||||
document,
|
||||
getDisplayedRequests(store.getState()),
|
||||
item,
|
||||
@ -96,9 +96,9 @@ add_task(function* () {
|
||||
}
|
||||
|
||||
info("Unregistering the service worker...");
|
||||
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
|
||||
yield content.wrappedJSObject.unregisterServiceWorker();
|
||||
await ContentTask.spawn(tab.linkedBrowser, {}, async function () {
|
||||
await content.wrappedJSObject.unregisterServiceWorker();
|
||||
});
|
||||
|
||||
yield teardown(monitor);
|
||||
await teardown(monitor);
|
||||
});
|
||||
|
@ -7,10 +7,10 @@
|
||||
* Tests if requests render correct information in the details UI.
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
add_task(async function () {
|
||||
let { L10N } = require("devtools/client/netmonitor/src/utils/l10n");
|
||||
|
||||
let { tab, monitor } = yield initNetMonitor(SIMPLE_SJS);
|
||||
let { tab, monitor } = await initNetMonitor(SIMPLE_SJS);
|
||||
info("Starting test... ");
|
||||
|
||||
let { document, store, windowRequire, NetMonitorView } = monitor.panelWin;
|
||||
@ -26,7 +26,7 @@ add_task(function* () {
|
||||
|
||||
let wait = waitForNetworkEvents(monitor, 1);
|
||||
tab.linkedBrowser.reload();
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
is(getSelectedRequest(store.getState()), undefined,
|
||||
"There shouldn't be any selected item in the requests menu.");
|
||||
@ -46,9 +46,9 @@ add_task(function* () {
|
||||
"The network details panel should not be hidden after toggle button was pressed.");
|
||||
|
||||
testHeadersTab();
|
||||
yield testCookiesTab();
|
||||
await testCookiesTab();
|
||||
testParamsTab();
|
||||
yield testResponseTab();
|
||||
await testResponseTab();
|
||||
testTimingsTab();
|
||||
return teardown(monitor);
|
||||
|
||||
@ -161,11 +161,11 @@ add_task(function* () {
|
||||
"\"no-cache\"", "The last request header value was incorrect.");
|
||||
}
|
||||
|
||||
function* testCookiesTab() {
|
||||
async function testCookiesTab() {
|
||||
let onEvent = monitor.panelWin.once(EVENTS.TAB_UPDATED);
|
||||
EventUtils.sendMouseEvent({ type: "mousedown" },
|
||||
document.querySelectorAll("#details-pane tab")[1]);
|
||||
yield onEvent;
|
||||
await onEvent;
|
||||
|
||||
let tabEl = document.querySelectorAll("#details-pane tab")[1];
|
||||
let tabpanel = document.querySelectorAll("#details-pane tabpanel")[1];
|
||||
@ -204,11 +204,11 @@ add_task(function* () {
|
||||
"The request post data textarea box should be hidden.");
|
||||
}
|
||||
|
||||
function* testResponseTab() {
|
||||
async function testResponseTab() {
|
||||
let onEvent = monitor.panelWin.once(EVENTS.TAB_UPDATED);
|
||||
EventUtils.sendMouseEvent({ type: "mousedown" },
|
||||
document.querySelectorAll("#details-pane tab")[3]);
|
||||
yield onEvent;
|
||||
await onEvent;
|
||||
|
||||
let tabEl = document.querySelectorAll("#details-pane tab")[3];
|
||||
let tabpanel = document.querySelectorAll("#details-pane tabpanel")[3];
|
||||
@ -229,7 +229,7 @@ add_task(function* () {
|
||||
.hasAttribute("hidden"), true,
|
||||
"The response content image box should be hidden.");
|
||||
|
||||
let editor = yield NetMonitorView.editor("#response-content-textarea");
|
||||
let editor = await NetMonitorView.editor("#response-content-textarea");
|
||||
is(editor.getText(), "Hello world!",
|
||||
"The text shown in the source editor is incorrect.");
|
||||
is(editor.getMode(), Editor.modes.text,
|
||||
|
@ -12,8 +12,8 @@
|
||||
* 3) Empty user message visibility
|
||||
* 4) Number of requests displayed
|
||||
*/
|
||||
add_task(function* () {
|
||||
let { tab, monitor } = yield initNetMonitor(SIMPLE_URL);
|
||||
add_task(async function () {
|
||||
let { tab, monitor } = await initNetMonitor(SIMPLE_URL);
|
||||
info("Starting test... ");
|
||||
|
||||
let { document, store, windowRequire } = monitor.panelWin;
|
||||
@ -31,7 +31,7 @@ add_task(function* () {
|
||||
is(!!document.querySelector(".network-details-panel"), false,
|
||||
"The network details panel should be hidden when the frontend is opened.");
|
||||
|
||||
yield reloadAndWait();
|
||||
await reloadAndWait();
|
||||
|
||||
is(document.querySelector(".network-details-panel-toggle").hasAttribute("disabled"),
|
||||
false,
|
||||
@ -43,7 +43,7 @@ add_task(function* () {
|
||||
is(!!document.querySelector(".network-details-panel"), false,
|
||||
"The network details panel should still be hidden after the first request.");
|
||||
|
||||
yield reloadAndWait();
|
||||
await reloadAndWait();
|
||||
|
||||
is(document.querySelector(".network-details-panel-toggle").hasAttribute("disabled"),
|
||||
false,
|
||||
@ -69,7 +69,7 @@ add_task(function* () {
|
||||
|
||||
return teardown(monitor);
|
||||
|
||||
function* reloadAndWait() {
|
||||
function reloadAndWait() {
|
||||
let wait = waitForNetworkEvents(monitor, 1);
|
||||
tab.linkedBrowser.reload();
|
||||
return wait;
|
||||
|
@ -7,10 +7,10 @@
|
||||
* Test if sorting columns in the network table works correctly with new requests.
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
add_task(async function () {
|
||||
let { L10N } = require("devtools/client/netmonitor/src/utils/l10n");
|
||||
|
||||
let { monitor } = yield initNetMonitor(SORTING_URL);
|
||||
let { monitor } = await initNetMonitor(SORTING_URL);
|
||||
info("Starting test... ");
|
||||
|
||||
// It seems that this test may be slow on debug builds. This could be because
|
||||
@ -48,8 +48,8 @@ add_task(function* () {
|
||||
}];
|
||||
|
||||
let wait = waitForNetworkEvents(monitor, 5);
|
||||
yield performRequestsInContent(requests);
|
||||
yield wait;
|
||||
await performRequestsInContent(requests);
|
||||
await wait;
|
||||
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector(".network-details-panel-toggle"));
|
||||
@ -62,49 +62,49 @@ add_task(function* () {
|
||||
"The network details panel should be visible after toggle button was pressed.");
|
||||
|
||||
testHeaders();
|
||||
yield testContents([0, 2, 4, 3, 1], 0);
|
||||
await testContents([0, 2, 4, 3, 1], 0);
|
||||
|
||||
info("Testing status sort, ascending.");
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector("#requests-list-status-button"));
|
||||
testHeaders("status", "ascending");
|
||||
yield testContents([0, 1, 2, 3, 4], 0);
|
||||
await testContents([0, 1, 2, 3, 4], 0);
|
||||
|
||||
info("Performing more requests.");
|
||||
wait = waitForNetworkEvents(monitor, 5);
|
||||
yield performRequestsInContent(requests);
|
||||
yield wait;
|
||||
await performRequestsInContent(requests);
|
||||
await wait;
|
||||
|
||||
info("Testing status sort again, ascending.");
|
||||
testHeaders("status", "ascending");
|
||||
yield testContents([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 0);
|
||||
await testContents([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 0);
|
||||
|
||||
info("Testing status sort, descending.");
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector("#requests-list-status-button"));
|
||||
testHeaders("status", "descending");
|
||||
yield testContents([9, 8, 7, 6, 5, 4, 3, 2, 1, 0], 9);
|
||||
await testContents([9, 8, 7, 6, 5, 4, 3, 2, 1, 0], 9);
|
||||
|
||||
info("Performing more requests.");
|
||||
wait = waitForNetworkEvents(monitor, 5);
|
||||
yield performRequestsInContent(requests);
|
||||
yield wait;
|
||||
await performRequestsInContent(requests);
|
||||
await wait;
|
||||
|
||||
info("Testing status sort again, descending.");
|
||||
testHeaders("status", "descending");
|
||||
yield testContents([14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0], 14);
|
||||
await testContents([14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0], 14);
|
||||
|
||||
info("Testing status sort yet again, ascending.");
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector("#requests-list-status-button"));
|
||||
testHeaders("status", "ascending");
|
||||
yield testContents([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], 0);
|
||||
await testContents([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], 0);
|
||||
|
||||
info("Testing status sort yet again, descending.");
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector("#requests-list-status-button"));
|
||||
testHeaders("status", "descending");
|
||||
yield testContents([14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0], 14);
|
||||
await testContents([14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0], 14);
|
||||
|
||||
return teardown(monitor);
|
||||
|
||||
@ -141,7 +141,7 @@ add_task(function* () {
|
||||
return getSortedRequests(state).findIndex(r => r.id === state.requests.selectedId);
|
||||
}
|
||||
|
||||
function* testContents(order, selection) {
|
||||
async function testContents(order, selection) {
|
||||
isnot(getSelectedRequest(store.getState()), undefined,
|
||||
"There should still be a selected item after sorting.");
|
||||
is(getSelectedIndex(store.getState()), selection,
|
||||
@ -161,7 +161,7 @@ add_task(function* () {
|
||||
requestItem.scrollIntoView();
|
||||
let requestsListStatus = requestItem.querySelector(".requests-list-status");
|
||||
EventUtils.sendMouseEvent({ type: "mouseover" }, requestsListStatus);
|
||||
yield waitUntil(() => requestsListStatus.title);
|
||||
await waitUntil(() => requestsListStatus.title);
|
||||
}
|
||||
|
||||
for (let i = 0, len = order.length / 5; i < len; i++) {
|
||||
|
@ -7,10 +7,10 @@
|
||||
* Test if sorting columns in the network table works correctly.
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
add_task(async function () {
|
||||
let { L10N } = require("devtools/client/netmonitor/src/utils/l10n");
|
||||
|
||||
let { monitor } = yield initNetMonitor(SORTING_URL);
|
||||
let { monitor } = await initNetMonitor(SORTING_URL);
|
||||
info("Starting test... ");
|
||||
|
||||
// It seems that this test may be slow on debug builds. This could be because
|
||||
@ -48,8 +48,8 @@ add_task(function* () {
|
||||
}];
|
||||
|
||||
let wait = waitForNetworkEvents(monitor, 5);
|
||||
yield performRequestsInContent(requests);
|
||||
yield wait;
|
||||
await performRequestsInContent(requests);
|
||||
await wait;
|
||||
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector(".network-details-panel-toggle"));
|
||||
@ -62,133 +62,133 @@ add_task(function* () {
|
||||
"The network details panel should be visible after toggle button was pressed.");
|
||||
|
||||
testHeaders();
|
||||
yield testContents([0, 2, 4, 3, 1]);
|
||||
await testContents([0, 2, 4, 3, 1]);
|
||||
|
||||
info("Testing status sort, ascending.");
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector("#requests-list-status-button"));
|
||||
testHeaders("status", "ascending");
|
||||
yield testContents([0, 1, 2, 3, 4]);
|
||||
await testContents([0, 1, 2, 3, 4]);
|
||||
|
||||
info("Testing status sort, descending.");
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector("#requests-list-status-button"));
|
||||
testHeaders("status", "descending");
|
||||
yield testContents([4, 3, 2, 1, 0]);
|
||||
await testContents([4, 3, 2, 1, 0]);
|
||||
|
||||
info("Testing status sort, ascending. Checking sort loops correctly.");
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector("#requests-list-status-button"));
|
||||
testHeaders("status", "ascending");
|
||||
yield testContents([0, 1, 2, 3, 4]);
|
||||
await testContents([0, 1, 2, 3, 4]);
|
||||
|
||||
info("Testing method sort, ascending.");
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector("#requests-list-method-button"));
|
||||
testHeaders("method", "ascending");
|
||||
yield testContents([0, 1, 2, 3, 4]);
|
||||
await testContents([0, 1, 2, 3, 4]);
|
||||
|
||||
info("Testing method sort, descending.");
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector("#requests-list-method-button"));
|
||||
testHeaders("method", "descending");
|
||||
yield testContents([4, 3, 2, 1, 0]);
|
||||
await testContents([4, 3, 2, 1, 0]);
|
||||
|
||||
info("Testing method sort, ascending. Checking sort loops correctly.");
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector("#requests-list-method-button"));
|
||||
testHeaders("method", "ascending");
|
||||
yield testContents([0, 1, 2, 3, 4]);
|
||||
await testContents([0, 1, 2, 3, 4]);
|
||||
|
||||
info("Testing file sort, ascending.");
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector("#requests-list-file-button"));
|
||||
testHeaders("file", "ascending");
|
||||
yield testContents([0, 1, 2, 3, 4]);
|
||||
await testContents([0, 1, 2, 3, 4]);
|
||||
|
||||
info("Testing file sort, descending.");
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector("#requests-list-file-button"));
|
||||
testHeaders("file", "descending");
|
||||
yield testContents([4, 3, 2, 1, 0]);
|
||||
await testContents([4, 3, 2, 1, 0]);
|
||||
|
||||
info("Testing file sort, ascending. Checking sort loops correctly.");
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector("#requests-list-file-button"));
|
||||
testHeaders("file", "ascending");
|
||||
yield testContents([0, 1, 2, 3, 4]);
|
||||
await testContents([0, 1, 2, 3, 4]);
|
||||
|
||||
info("Testing type sort, ascending.");
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector("#requests-list-type-button"));
|
||||
testHeaders("type", "ascending");
|
||||
yield testContents([0, 1, 2, 3, 4]);
|
||||
await testContents([0, 1, 2, 3, 4]);
|
||||
|
||||
info("Testing type sort, descending.");
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector("#requests-list-type-button"));
|
||||
testHeaders("type", "descending");
|
||||
yield testContents([4, 3, 2, 1, 0]);
|
||||
await testContents([4, 3, 2, 1, 0]);
|
||||
|
||||
info("Testing type sort, ascending. Checking sort loops correctly.");
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector("#requests-list-type-button"));
|
||||
testHeaders("type", "ascending");
|
||||
yield testContents([0, 1, 2, 3, 4]);
|
||||
await testContents([0, 1, 2, 3, 4]);
|
||||
|
||||
info("Testing transferred sort, ascending.");
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector("#requests-list-transferred-button"));
|
||||
testHeaders("transferred", "ascending");
|
||||
yield testContents([0, 1, 2, 3, 4]);
|
||||
await testContents([0, 1, 2, 3, 4]);
|
||||
|
||||
info("Testing transferred sort, descending.");
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector("#requests-list-transferred-button"));
|
||||
testHeaders("transferred", "descending");
|
||||
yield testContents([4, 3, 2, 1, 0]);
|
||||
await testContents([4, 3, 2, 1, 0]);
|
||||
|
||||
info("Testing transferred sort, ascending. Checking sort loops correctly.");
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector("#requests-list-transferred-button"));
|
||||
testHeaders("transferred", "ascending");
|
||||
yield testContents([0, 1, 2, 3, 4]);
|
||||
await testContents([0, 1, 2, 3, 4]);
|
||||
|
||||
info("Testing size sort, ascending.");
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector("#requests-list-contentSize-button"));
|
||||
testHeaders("contentSize", "ascending");
|
||||
yield testContents([0, 1, 2, 3, 4]);
|
||||
await testContents([0, 1, 2, 3, 4]);
|
||||
|
||||
info("Testing size sort, descending.");
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector("#requests-list-contentSize-button"));
|
||||
testHeaders("contentSize", "descending");
|
||||
yield testContents([4, 3, 2, 1, 0]);
|
||||
await testContents([4, 3, 2, 1, 0]);
|
||||
|
||||
info("Testing size sort, ascending. Checking sort loops correctly.");
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector("#requests-list-contentSize-button"));
|
||||
testHeaders("contentSize", "ascending");
|
||||
yield testContents([0, 1, 2, 3, 4]);
|
||||
await testContents([0, 1, 2, 3, 4]);
|
||||
|
||||
info("Testing waterfall sort, ascending.");
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector("#requests-list-waterfall-button"));
|
||||
testHeaders("waterfall", "ascending");
|
||||
yield testContents([0, 2, 4, 3, 1]);
|
||||
await testContents([0, 2, 4, 3, 1]);
|
||||
|
||||
info("Testing waterfall sort, descending.");
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector("#requests-list-waterfall-button"));
|
||||
testHeaders("waterfall", "descending");
|
||||
yield testContents([4, 2, 0, 1, 3]);
|
||||
await testContents([4, 2, 0, 1, 3]);
|
||||
|
||||
info("Testing waterfall sort, ascending. Checking sort loops correctly.");
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector("#requests-list-waterfall-button"));
|
||||
testHeaders("waterfall", "ascending");
|
||||
yield testContents([0, 2, 4, 3, 1]);
|
||||
await testContents([0, 2, 4, 3, 1]);
|
||||
|
||||
return teardown(monitor);
|
||||
|
||||
@ -225,7 +225,7 @@ add_task(function* () {
|
||||
}
|
||||
}
|
||||
|
||||
function* testContents([a, b, c, d, e]) {
|
||||
async function testContents([a, b, c, d, e]) {
|
||||
isnot(getSelectedRequest(store.getState()), undefined,
|
||||
"There should still be a selected item after sorting.");
|
||||
is(getSelectedIndex(store.getState()), a,
|
||||
@ -245,7 +245,7 @@ add_task(function* () {
|
||||
requestItem.scrollIntoView();
|
||||
let requestsListStatus = requestItem.querySelector(".requests-list-status");
|
||||
EventUtils.sendMouseEvent({ type: "mouseover" }, requestsListStatus);
|
||||
yield waitUntil(() => requestsListStatus.title);
|
||||
await waitUntil(() => requestsListStatus.title);
|
||||
}
|
||||
|
||||
verifyRequestItemTarget(
|
||||
|
@ -7,8 +7,8 @@
|
||||
* Tests if the statistics panel displays correctly.
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
let { monitor } = yield initNetMonitor(STATISTICS_URL);
|
||||
add_task(async function () {
|
||||
let { monitor } = await initNetMonitor(STATISTICS_URL);
|
||||
info("Starting test... ");
|
||||
|
||||
let panel = monitor.panelWin;
|
||||
@ -26,27 +26,27 @@ add_task(function* () {
|
||||
|
||||
info("Waiting for placeholder to display");
|
||||
|
||||
yield waitUntil(
|
||||
await waitUntil(
|
||||
() => document.querySelectorAll(".pie-chart-container[placeholder=true]")
|
||||
.length == 2);
|
||||
ok(true, "Two placeholder pie charts appear to be rendered correctly.");
|
||||
|
||||
yield waitUntil(
|
||||
await waitUntil(
|
||||
() => 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(
|
||||
await waitUntil(
|
||||
() => document.querySelectorAll(".pie-chart-container:not([placeholder=true])")
|
||||
.length == 2);
|
||||
ok(true, "Two real pie charts appear to be rendered correctly.");
|
||||
|
||||
yield waitUntil(
|
||||
await waitUntil(
|
||||
() => document.querySelectorAll(".table-chart-container:not([placeholder=true])")
|
||||
.length == 2);
|
||||
ok(true, "Two real table charts appear to be rendered correctly.");
|
||||
|
||||
yield teardown(monitor);
|
||||
await teardown(monitor);
|
||||
});
|
||||
|
@ -8,8 +8,8 @@
|
||||
* the performance analysis view.
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
let { monitor } = yield initNetMonitor(FILTERING_URL);
|
||||
add_task(async function () {
|
||||
let { monitor } = await initNetMonitor(FILTERING_URL);
|
||||
info("Starting test... ");
|
||||
|
||||
let panel = monitor.panelWin;
|
||||
@ -34,7 +34,7 @@ add_task(function* () {
|
||||
ok(document.querySelector(".statistics-panel"),
|
||||
"The main panel is switched to the statistics panel.");
|
||||
|
||||
yield waitUntil(
|
||||
await waitUntil(
|
||||
() => document.querySelectorAll(".pie-chart-container:not([placeholder=true])")
|
||||
.length == 2);
|
||||
ok(true, "Two real pie charts appear to be rendered correctly.");
|
||||
@ -48,5 +48,5 @@ add_task(function* () {
|
||||
testFilterButtons(monitor, "html");
|
||||
info("The correct filtering predicate is used when exiting perf. analysis mode.");
|
||||
|
||||
yield teardown(monitor);
|
||||
await teardown(monitor);
|
||||
});
|
||||
|
@ -7,10 +7,10 @@
|
||||
* Tests if requests display the correct status code and text in the UI.
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
add_task(async function () {
|
||||
let { L10N } = require("devtools/client/netmonitor/src/utils/l10n");
|
||||
|
||||
let { tab, monitor } = yield initNetMonitor(STATUS_CODES_URL);
|
||||
let { tab, monitor } = await initNetMonitor(STATUS_CODES_URL);
|
||||
|
||||
info("Starting test... ");
|
||||
|
||||
@ -99,15 +99,15 @@ add_task(function* () {
|
||||
];
|
||||
|
||||
let wait = waitForNetworkEvents(monitor, 5);
|
||||
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
|
||||
await ContentTask.spawn(tab.linkedBrowser, {}, async function () {
|
||||
content.wrappedJSObject.performRequests();
|
||||
});
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
info("Performing tests");
|
||||
yield verifyRequests();
|
||||
yield testTab(0, testHeaders);
|
||||
yield testTab(2, testParams);
|
||||
await verifyRequests();
|
||||
await testTab(0, testHeaders);
|
||||
await testTab(2, testParams);
|
||||
|
||||
return teardown(monitor);
|
||||
|
||||
@ -115,13 +115,13 @@ add_task(function* () {
|
||||
* A helper that verifies all requests show the correct information and caches
|
||||
* request list items to requestItems array.
|
||||
*/
|
||||
function* verifyRequests() {
|
||||
async function verifyRequests() {
|
||||
let requestListItems = document.querySelectorAll(".request-list-item");
|
||||
for (let requestItem of requestListItems) {
|
||||
requestItem.scrollIntoView();
|
||||
let requestsListStatus = requestItem.querySelector(".requests-list-status");
|
||||
EventUtils.sendMouseEvent({ type: "mouseover" }, requestsListStatus);
|
||||
yield waitUntil(() => requestsListStatus.title);
|
||||
await waitUntil(() => requestsListStatus.title);
|
||||
}
|
||||
|
||||
info("Verifying requests contain correct information.");
|
||||
@ -131,7 +131,7 @@ add_task(function* () {
|
||||
requestItems[index] = item;
|
||||
|
||||
info("Verifying request #" + index);
|
||||
yield verifyRequestItemTarget(
|
||||
await verifyRequestItemTarget(
|
||||
document,
|
||||
getDisplayedRequests(store.getState()),
|
||||
item,
|
||||
@ -155,11 +155,11 @@ add_task(function* () {
|
||||
* for every item of REQUEST_DATA with that item being selected in the
|
||||
* NetworkMonitor.
|
||||
*/
|
||||
function* testTab(tabIdx, testFn) {
|
||||
async function testTab(tabIdx, testFn) {
|
||||
let counter = 0;
|
||||
for (let item of REQUEST_DATA) {
|
||||
info("Testing tab #" + tabIdx + " to update with request #" + counter);
|
||||
yield testFn(item, counter);
|
||||
await testFn(item, counter);
|
||||
|
||||
counter++;
|
||||
}
|
||||
@ -168,11 +168,11 @@ add_task(function* () {
|
||||
/**
|
||||
* A function that tests "Headers" panel contains correct information.
|
||||
*/
|
||||
function* testHeaders(data, index) {
|
||||
async function testHeaders(data, index) {
|
||||
EventUtils.sendMouseEvent({ type: "mousedown" },
|
||||
document.querySelectorAll(".request-list-item")[index]);
|
||||
|
||||
yield waitUntil(() => document.querySelector(
|
||||
await waitUntil(() => document.querySelector(
|
||||
"#headers-panel .tabpanel-summary-value.textbox-input"));
|
||||
|
||||
let panel = document.querySelector("#headers-panel");
|
||||
@ -191,7 +191,7 @@ add_task(function* () {
|
||||
/**
|
||||
* A function that tests "Params" panel contains correct information.
|
||||
*/
|
||||
function* testParams(data, index) {
|
||||
function testParams(data, index) {
|
||||
EventUtils.sendMouseEvent({ type: "mousedown" },
|
||||
document.querySelectorAll(".request-list-item")[index]);
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
|
@ -8,8 +8,8 @@
|
||||
* displayed as XML or plain text
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
let { tab, monitor } = yield initNetMonitor(CUSTOM_GET_URL);
|
||||
add_task(async function () {
|
||||
let { tab, monitor } = await initNetMonitor(CUSTOM_GET_URL);
|
||||
|
||||
info("Starting test... ");
|
||||
let { document, store, windowRequire } = monitor.panelWin;
|
||||
@ -29,18 +29,18 @@ add_task(function* () {
|
||||
let wait = waitForNetworkEvents(monitor, REQUESTS.length);
|
||||
for (let [fmt] of REQUESTS) {
|
||||
let url = CONTENT_TYPE_SJS + "?fmt=" + fmt;
|
||||
yield ContentTask.spawn(tab.linkedBrowser, { url }, function* (args) {
|
||||
await ContentTask.spawn(tab.linkedBrowser, { url }, async function (args) {
|
||||
content.wrappedJSObject.performRequests(1, args.url);
|
||||
});
|
||||
}
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
let requestItems = document.querySelectorAll(".request-list-item");
|
||||
for (let requestItem of requestItems) {
|
||||
requestItem.scrollIntoView();
|
||||
let requestsListStatus = requestItem.querySelector(".requests-list-status");
|
||||
EventUtils.sendMouseEvent({ type: "mouseover" }, requestsListStatus);
|
||||
yield waitUntil(() => requestsListStatus.title);
|
||||
await waitUntil(() => requestsListStatus.title);
|
||||
}
|
||||
|
||||
REQUESTS.forEach(([ fmt ], i) => {
|
||||
@ -61,15 +61,15 @@ add_task(function* () {
|
||||
document.querySelector(".network-details-panel-toggle"));
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector("#response-tab"));
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
store.dispatch(Actions.selectRequest(null));
|
||||
|
||||
yield selectIndexAndWaitForSourceEditor(monitor, 0);
|
||||
await selectIndexAndWaitForSourceEditor(monitor, 0);
|
||||
// the hls-m3u8 part
|
||||
testEditorContent(REQUESTS[0]);
|
||||
|
||||
yield selectIndexAndWaitForSourceEditor(monitor, 1);
|
||||
await selectIndexAndWaitForSourceEditor(monitor, 1);
|
||||
// the mpeg-dash part
|
||||
testEditorContent(REQUESTS[1]);
|
||||
|
||||
|
@ -5,15 +5,15 @@
|
||||
|
||||
"use strict";
|
||||
|
||||
add_task(function* () {
|
||||
yield throttleTest(true);
|
||||
yield throttleTest(false);
|
||||
add_task(async function () {
|
||||
await throttleTest(true);
|
||||
await throttleTest(false);
|
||||
});
|
||||
|
||||
function* throttleTest(actuallyThrottle) {
|
||||
async function throttleTest(actuallyThrottle) {
|
||||
requestLongerTimeout(2);
|
||||
|
||||
let { monitor } = yield initNetMonitor(SIMPLE_URL);
|
||||
let { monitor } = await initNetMonitor(SIMPLE_URL);
|
||||
let { store, windowRequire, connector } = monitor.panelWin;
|
||||
let { ACTIVITY_TYPE } = windowRequire("devtools/client/netmonitor/src/constants");
|
||||
let { setPreferences, triggerActivity } = connector;
|
||||
@ -39,17 +39,17 @@ function* throttleTest(actuallyThrottle) {
|
||||
};
|
||||
|
||||
info("sending throttle request");
|
||||
yield new Promise((resolve) => {
|
||||
await new Promise((resolve) => {
|
||||
setPreferences(request, response => {
|
||||
resolve(response);
|
||||
});
|
||||
});
|
||||
|
||||
let wait = waitForNetworkEvents(monitor, 1);
|
||||
yield triggerActivity(ACTIVITY_TYPE.RELOAD.WITH_CACHE_DISABLED);
|
||||
yield wait;
|
||||
await triggerActivity(ACTIVITY_TYPE.RELOAD.WITH_CACHE_DISABLED);
|
||||
await wait;
|
||||
|
||||
yield waitUntil(() => {
|
||||
await waitUntil(() => {
|
||||
let requestItem = getSortedRequests(store.getState()).get(0);
|
||||
return requestItem && requestItem.eventTimings;
|
||||
});
|
||||
@ -62,5 +62,5 @@ function* throttleTest(actuallyThrottle) {
|
||||
ok(!reportedOneSecond, "download reported as taking less than one second");
|
||||
}
|
||||
|
||||
yield teardown(monitor);
|
||||
await teardown(monitor);
|
||||
}
|
||||
|
@ -7,10 +7,10 @@
|
||||
* Tests if timeline correctly displays interval divisions.
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
add_task(async function () {
|
||||
let { L10N } = require("devtools/client/netmonitor/src/utils/l10n");
|
||||
|
||||
let { tab, monitor } = yield initNetMonitor(SIMPLE_URL);
|
||||
let { tab, monitor } = await initNetMonitor(SIMPLE_URL);
|
||||
info("Starting test... ");
|
||||
|
||||
let { $, $all, NetMonitorView, NetMonitorController } = monitor.panelWin;
|
||||
@ -34,7 +34,7 @@ add_task(function* () {
|
||||
|
||||
let wait = waitForNetworkEvents(monitor, 1);
|
||||
tab.linkedBrowser.reload();
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
// Make sure the DOMContentLoaded and load markers don't interfere with
|
||||
// this test by removing them and redrawing the waterfall (bug 1224088).
|
||||
|
@ -7,8 +7,8 @@
|
||||
* Tests if timing intervals are divided againts seconds when appropriate.
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
let { tab, monitor } = yield initNetMonitor(CUSTOM_GET_URL);
|
||||
add_task(async function () {
|
||||
let { tab, monitor } = await initNetMonitor(CUSTOM_GET_URL);
|
||||
info("Starting test... ");
|
||||
|
||||
let { document, store, windowRequire } = monitor.panelWin;
|
||||
@ -17,10 +17,10 @@ add_task(function* () {
|
||||
|
||||
let wait = waitForNetworkEvents(monitor, 2);
|
||||
// Timeout needed for having enough divisions on the time scale.
|
||||
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
|
||||
await ContentTask.spawn(tab.linkedBrowser, {}, async function () {
|
||||
content.wrappedJSObject.performRequests(2, null, 3000);
|
||||
});
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
let milDivs = document.querySelectorAll(
|
||||
".requests-list-timings-division[data-division-scale=millisecond]");
|
||||
|
@ -7,10 +7,10 @@
|
||||
* Verifies that truncated response bodies still have the correct reported size.
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
add_task(async function () {
|
||||
let { RESPONSE_BODY_LIMIT } = require("devtools/shared/webconsole/network-monitor");
|
||||
let URL = EXAMPLE_URL + "sjs_truncate-test-server.sjs?limit=" + RESPONSE_BODY_LIMIT;
|
||||
let { monitor, tab } = yield initNetMonitor(URL);
|
||||
let { monitor, tab } = await initNetMonitor(URL);
|
||||
|
||||
info("Starting test... ");
|
||||
|
||||
@ -20,13 +20,13 @@ add_task(function* () {
|
||||
|
||||
let wait = waitForNetworkEvents(monitor, 1);
|
||||
tab.linkedBrowser.reload();
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
// Response content will be updated asynchronously, we should make sure data is updated
|
||||
// on DOM before asserting.
|
||||
yield waitUntil(() => document.querySelector(".request-list-item"));
|
||||
await waitUntil(() => document.querySelector(".request-list-item"));
|
||||
let item = document.querySelectorAll(".request-list-item")[0];
|
||||
yield waitUntil(() => item.querySelector(".requests-list-type").title);
|
||||
await waitUntil(() => item.querySelector(".requests-list-type").title);
|
||||
|
||||
let type = item.querySelector(".requests-list-type").textContent;
|
||||
let fullMimeType = item.querySelector(".requests-list-type").title;
|
||||
|
@ -7,15 +7,15 @@
|
||||
* Test that clicking on the waterfall opens the timing sidebar panel.
|
||||
*/
|
||||
|
||||
add_task(function* () {
|
||||
let { tab, monitor } = yield initNetMonitor(CONTENT_TYPE_WITHOUT_CACHE_URL);
|
||||
add_task(async function () {
|
||||
let { tab, monitor } = await initNetMonitor(CONTENT_TYPE_WITHOUT_CACHE_URL);
|
||||
let { document } = monitor.panelWin;
|
||||
|
||||
let onAllEvents = waitForNetworkEvents(monitor, CONTENT_TYPE_WITHOUT_CACHE_REQUESTS);
|
||||
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
|
||||
await ContentTask.spawn(tab.linkedBrowser, {}, async function () {
|
||||
content.wrappedJSObject.performRequests();
|
||||
});
|
||||
yield onAllEvents;
|
||||
await onAllEvents;
|
||||
|
||||
info("Clicking waterfall and waiting for panel update.");
|
||||
let wait = waitForDOM(document, "#timings-panel");
|
||||
@ -23,7 +23,7 @@ add_task(function* () {
|
||||
EventUtils.sendMouseEvent({ type: "mousedown" },
|
||||
document.querySelectorAll(".requests-list-timings")[0]);
|
||||
|
||||
yield wait;
|
||||
await wait;
|
||||
|
||||
ok(document.querySelector("#timings-tab[aria-selected=true]"),
|
||||
"Timings tab is selected.");
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user