mirror of
https://github.com/HeyPuter/firefox.git
synced 2026-11-29 02:17:45 -10:00
36 lines
1.0 KiB
JavaScript
36 lines
1.0 KiB
JavaScript
/* Any copyright is dedicated to the Public Domain.
|
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
|
|
|
"use strict";
|
|
|
|
/**
|
|
* Tests if copying a request's response works.
|
|
*/
|
|
|
|
add_task(function* () {
|
|
let { tab, monitor } = yield initNetMonitor(CONTENT_TYPE_WITHOUT_CACHE_URL);
|
|
info("Starting test... ");
|
|
|
|
const EXPECTED_RESULT = '{ "greeting": "Hello JSON!" }';
|
|
|
|
let { document } = monitor.panelWin;
|
|
|
|
let wait = waitForNetworkEvents(monitor, CONTENT_TYPE_WITHOUT_CACHE_REQUESTS);
|
|
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
|
|
content.wrappedJSObject.performRequests();
|
|
});
|
|
yield wait;
|
|
|
|
EventUtils.sendMouseEvent({ type: "mousedown" },
|
|
document.querySelectorAll(".request-list-item")[3]);
|
|
EventUtils.sendMouseEvent({ type: "contextmenu" },
|
|
document.querySelectorAll(".request-list-item")[3]);
|
|
|
|
yield waitForClipboardPromise(function setup() {
|
|
monitor.panelWin.parent.document
|
|
.querySelector("#request-list-context-copy-response").click();
|
|
}, EXPECTED_RESULT);
|
|
|
|
yield teardown(monitor);
|
|
});
|