зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1337772 - Part 2 - Explicitly trigger a mousedown event before opening the context menu in browser_context_menu.js. r=MattN
MozReview-Commit-ID: ADTskzMoK9t --HG-- extra : rebase_source : 6133986c9e3c470f6e2fb3c5a172a82c0f07fd8a
This commit is contained in:
Родитель
c7f84eacc4
Коммит
9cd3d14848
|
@ -245,6 +245,7 @@ async function openContextMenuInFrame(frameId) {
|
|||
async function openContextMenu(selector = "#img1") {
|
||||
let contentAreaContextMenu = document.getElementById("contentAreaContextMenu");
|
||||
let popupShownPromise = BrowserTestUtils.waitForEvent(contentAreaContextMenu, "popupshown");
|
||||
await BrowserTestUtils.synthesizeMouseAtCenter(selector, {type: "mousedown", button: 2}, gBrowser.selectedBrowser);
|
||||
await BrowserTestUtils.synthesizeMouseAtCenter(selector, {type: "contextmenu"}, gBrowser.selectedBrowser);
|
||||
await popupShownPromise;
|
||||
return contentAreaContextMenu;
|
||||
|
|
|
@ -270,10 +270,17 @@ add_task(function* test_context_menu_username_login_fill() {
|
|||
* assertCallback should return true if we should continue or else false.
|
||||
*/
|
||||
function* openPasswordContextMenu(browser, passwordInput, assertCallback = null) {
|
||||
// Synthesize a right mouse click over the password input element.
|
||||
let contextMenuShownPromise = BrowserTestUtils.waitForEvent(CONTEXT_MENU, "popupshown");
|
||||
let eventDetails = {type: "contextmenu", button: 2};
|
||||
BrowserTestUtils.synthesizeMouseAtCenter(passwordInput, eventDetails, browser);
|
||||
|
||||
// Synthesize a right mouse click over the password input element, we have to trigger
|
||||
// both events because formfill code relies on this event happening before the contextmenu
|
||||
// (which it does for real user input) in order to not show the password autocomplete.
|
||||
let eventDetails = {type: "mousedown", button: 2};
|
||||
yield BrowserTestUtils.synthesizeMouseAtCenter(passwordInput, eventDetails, browser);
|
||||
// Synthesize a contextmenu event to actually open the context menu.
|
||||
eventDetails = {type: "contextmenu", button: 2};
|
||||
yield BrowserTestUtils.synthesizeMouseAtCenter(passwordInput, eventDetails, browser);
|
||||
|
||||
yield contextMenuShownPromise;
|
||||
|
||||
if (assertCallback) {
|
||||
|
@ -284,7 +291,7 @@ function* openPasswordContextMenu(browser, passwordInput, assertCallback = null)
|
|||
}
|
||||
|
||||
// Synthesize a mouse click over the fill login menu header.
|
||||
let popupShownPromise = BrowserTestUtils.waitForEvent(POPUP_HEADER, "popupshown");
|
||||
let popupShownPromise = BrowserTestUtils.waitForCondition(() => POPUP_HEADER.open);
|
||||
EventUtils.synthesizeMouseAtCenter(POPUP_HEADER, {});
|
||||
yield popupShownPromise;
|
||||
}
|
||||
|
|
|
@ -62,12 +62,12 @@ function autocompleteUnexpectedPopupShowing(event) {
|
|||
function* openContextMenu(browser, loginInput) {
|
||||
// First synthesize a mousedown. We need this to get the focus event with the "contextmenu" event.
|
||||
let eventDetails1 = {type: "mousedown", button: 2};
|
||||
BrowserTestUtils.synthesizeMouseAtCenter(loginInput, eventDetails1, browser);
|
||||
yield BrowserTestUtils.synthesizeMouseAtCenter(loginInput, eventDetails1, browser);
|
||||
|
||||
// Then synthesize the contextmenu click over the input element.
|
||||
let contextMenuShownPromise = BrowserTestUtils.waitForEvent(window, "popupshown");
|
||||
let eventDetails = {type: "contextmenu", button: 2};
|
||||
BrowserTestUtils.synthesizeMouseAtCenter(loginInput, eventDetails, browser);
|
||||
yield BrowserTestUtils.synthesizeMouseAtCenter(loginInput, eventDetails, browser);
|
||||
yield contextMenuShownPromise;
|
||||
|
||||
// Wait to see which popups are shown.
|
||||
|
|
Загрузка…
Ссылка в новой задаче