blob: ca78613a615e8854f9b948f9cb15a08fc8e3b99e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
/**
* Testcase for bug 1719203
* <https://bugzilla.mozilla.org/show_bug.cgi?id=1719203>
*
* Load firebird.png, redirect it to doggy.png, and verify that "Copy Image
* Link" copies firebird.png.
*/
add_task(async function() {
// This URL will redirect to doggy.png.
const URL_FIREBIRD =
"http://mochi.test:8888/browser/browser/base/content/test/contextMenu/firebird.png";
await BrowserTestUtils.withNewTab(URL_FIREBIRD, async function(browser) {
// Click image to show context menu.
let popupShownPromise = BrowserTestUtils.waitForEvent(
document,
"popupshown"
);
await BrowserTestUtils.synthesizeMouseAtCenter(
"img",
{ type: "contextmenu", button: 2 },
browser
);
await popupShownPromise;
await SimpleTest.promiseClipboardChange(URL_FIREBIRD, () => {
document.getElementById("context-copyimage").doCommand();
});
// Close context menu.
let contextMenu = document.getElementById("contentAreaContextMenu");
let popupHiddenPromise = BrowserTestUtils.waitForEvent(
contextMenu,
"popuphidden"
);
contextMenu.hidePopup();
await popupHiddenPromise;
});
});
|