Files
palemoon27/toolkit/devtools/netmonitor/test/browser_net_copy_response.js
roytam1 fe1aaac26a import changes from `dev' branch of rmottola/Arctic-Fox:
- Bug 1121879 - Refactor ViewHelpers.L10N.numberWithDecimals to use toLocaleString. r=pbrosset (cfaf8ee3f)
- Bug 982319 - Unzipping response boddies in network monitor when needed. r=ochameau (3319f801d)
- Define gDevTools in network-monitor.js for the rare case where it's not already present in the environment (bug 1167655). r=vporof (88c89fa0c)
- Bug 1160837 - The network panel should only record beacons from the monitored page. r=ochameau (20b5b347d)
2021-09-07 15:26:12 +08:00

41 lines
1.1 KiB
JavaScript

/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Tests if copying a request's response works.
*/
function test() {
initNetMonitor(CONTENT_TYPE_WITHOUT_CACHE_URL).then(([aTab, aDebuggee, aMonitor]) => {
info("Starting test... ");
const EXPECTED_RESULT = '{ "greeting": "Hello JSON!" }';
let { NetMonitorView } = aMonitor.panelWin;
let { RequestsMenu } = NetMonitorView;
RequestsMenu.lazyUpdate = false;
waitForNetworkEvents(aMonitor, 7).then(() => {
let requestItem = RequestsMenu.getItemAtIndex(3);
RequestsMenu.selectedItem = requestItem;
waitForClipboard(EXPECTED_RESULT, function setup() {
RequestsMenu.copyResponse();
}, function onSuccess() {
ok(true, "Clipboard contains the currently selected item's response.");
cleanUp();
}, function onFailure() {
ok(false, "Copying the currently selected item's response was unsuccessful.");
cleanUp();
});
});
aDebuggee.performRequests();
function cleanUp(){
teardown(aMonitor).then(finish);
}
});
}