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