mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 848943 - Wait for popupshown to know when the context menu is ready. r=gavin
This commit is contained in:
parent
e1b5e8aef2
commit
085f2473e2
@ -20,7 +20,7 @@ function test() {
|
||||
//ss.currentEngine = engine;
|
||||
break;
|
||||
case "engine-current":
|
||||
ok(ss.currentEngine.name == ENGINE_NAME, "currentEngine set");
|
||||
is(ss.currentEngine.name, ENGINE_NAME, "currentEngine set");
|
||||
startTest();
|
||||
break;
|
||||
case "engine-removed":
|
||||
@ -40,16 +40,16 @@ function test() {
|
||||
ok(contextMenu, "Got context menu XUL");
|
||||
|
||||
doOnloadOnce(testContextMenu);
|
||||
var tab = gBrowser.addTab("data:text/plain,test%20search");
|
||||
var tab = gBrowser.addTab("data:text/plain;charset=utf8,test%20search");
|
||||
gBrowser.selectedTab = tab;
|
||||
}
|
||||
|
||||
function testContextMenu() {
|
||||
function rightClickOnDocument() {
|
||||
waitForBrowserContextMenu(checkContextMenu);
|
||||
var clickTarget = content.document.body;
|
||||
var eventDetails = { type: "contextmenu", button: 2 };
|
||||
EventUtils.synthesizeMouseAtCenter(clickTarget, eventDetails, content);
|
||||
SimpleTest.executeSoon(checkContextMenu);
|
||||
}
|
||||
|
||||
// check the search menu item and then perform a search
|
||||
|
@ -17,3 +17,16 @@ function isSubObjectOf(expectedObj, actualObj, name) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function waitForPopupShown(aPopupId, aCallback) {
|
||||
let popup = document.getElementById(aPopupId);
|
||||
function onPopupShown() {
|
||||
popup.removeEventListener("popupshown", onPopupShown);
|
||||
SimpleTest.executeSoon(aCallback);
|
||||
}
|
||||
popup.addEventListener("popupshown", onPopupShown);
|
||||
}
|
||||
|
||||
function waitForBrowserContextMenu(aCallback) {
|
||||
waitForPopupShown(gBrowser.selectedBrowser.contextMenu, aCallback);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user