mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 940902 - UITour: Add ability to hide a menu. r=Unfocused
This commit is contained in:
parent
d0fc67ccd2
commit
80f6642a72
@ -118,6 +118,11 @@ this.UITour = {
|
||||
break;
|
||||
}
|
||||
|
||||
case "hideMenu": {
|
||||
this.hideMenu(window, data.name);
|
||||
break;
|
||||
}
|
||||
|
||||
case "startUrlbarCapture": {
|
||||
if (typeof data.text != "string" || !data.text ||
|
||||
typeof data.url != "string" || !data.url) {
|
||||
@ -393,6 +398,19 @@ this.UITour = {
|
||||
openMenuButton("bookmarks-menu-button");
|
||||
},
|
||||
|
||||
hideMenu: function(aWindow, aMenuName) {
|
||||
function closeMenuButton(aId) {
|
||||
let menuBtn = aWindow.document.getElementById(aId);
|
||||
if (menuBtn && menuBtn.boxObject)
|
||||
menuBtn.boxObject.QueryInterface(Ci.nsIMenuBoxObject).openMenu(false);
|
||||
}
|
||||
|
||||
if (aMenuName == "appmenu")
|
||||
aWindow.PanelUI.hide();
|
||||
else if (aMenuName == "bookmarks")
|
||||
closeMenuButton("bookmarks-menu-button");
|
||||
},
|
||||
|
||||
startUrlbarCapture: function(aWindow, aExpectedText, aUrl) {
|
||||
let urlbar = aWindow.document.getElementById("urlbar");
|
||||
this.urlbarCapture.set(aWindow, {
|
||||
|
@ -233,6 +233,18 @@ let tests = [
|
||||
gContentAPI.addPinnedTab();
|
||||
is(gBrowser.tabs[1].pinned, false, "After multiple calls of addPinnedTab, should still only have one pinned tab");
|
||||
|
||||
done();
|
||||
},
|
||||
function test_menu(done) {
|
||||
let bookmarksMenuButton = document.getElementById("bookmarks-menu-button");
|
||||
ise(bookmarksMenuButton.open, false, "Menu should initially be closed");
|
||||
|
||||
gContentAPI.showMenu("bookmarks");
|
||||
ise(bookmarksMenuButton.open, true, "Menu should be shown after showMenu()");
|
||||
|
||||
gContentAPI.hideMenu("bookmarks");
|
||||
ise(bookmarksMenuButton.open, false, "Menu should be closed after hideMenu()");
|
||||
|
||||
done();
|
||||
},
|
||||
];
|
||||
|
@ -112,4 +112,10 @@ if (typeof Mozilla == 'undefined') {
|
||||
name: name
|
||||
});
|
||||
};
|
||||
})();
|
||||
|
||||
Mozilla.UITour.hideMenu = function(name) {
|
||||
_sendEvent('hideMenu', {
|
||||
name: name
|
||||
});
|
||||
};
|
||||
})();
|
||||
|
Loading…
Reference in New Issue
Block a user