Bug 1266952, remove cpow usage from browser_contextmenu_childprocess.js, r=felipe

This commit is contained in:
Neil Deakin 2016-09-14 09:30:15 -04:00
parent 463cd06d8d
commit ad2cbd9286

View File

@ -4,26 +4,23 @@
const gBaseURL = "https://example.com/browser/browser/base/content/test/general/";
add_task(function *() {
let tab = gBrowser.addTab();
let browser = gBrowser.getBrowserForTab(tab);
let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, gBaseURL + "subtst_contextmenu.html");
gBrowser.selectedTab = tab;
yield promiseTabLoadEvent(tab, gBaseURL + "subtst_contextmenu.html");
let popupShownPromise = promiseWaitForEvent(window, "popupshown", true);
let contextMenu = document.getElementById("contentAreaContextMenu");
// Get the point of the element with the page menu (test-pagemenu) and
// synthesize a right mouse click there.
let eventDetails = { type : "contextmenu", button : 2 };
let rect = browser.contentWindow.document.getElementById("test-pagemenu").getBoundingClientRect();
EventUtils.synthesizeMouse(browser, rect.x + rect.width / 2, rect.y + rect.height / 2, eventDetails, window);
let popupShownPromise = BrowserTestUtils.waitForEvent(contextMenu, "popupshown");
yield BrowserTestUtils.synthesizeMouse("#test-pagemenu", 5, 5, { type : "contextmenu", button : 2 }, tab.linkedBrowser);
let event = yield popupShownPromise;
let contextMenu = document.getElementById("contentAreaContextMenu");
checkMenu(contextMenu);
let popupHiddenPromise = BrowserTestUtils.waitForEvent(contextMenu, "popuphidden");
contextMenu.hidePopup();
gBrowser.removeCurrentTab();
yield popupHiddenPromise;
yield BrowserTestUtils.removeTab(tab);
});
function checkItems(menuitem, arr)