Bug 1382579 - Part 1: Update the BrowserPageActions API for the UITour's usage, r=Gijs
- adds `showPanel` so UITour could call it to open the page action panel
- makes clicking page action button on the urlbar would toggle the panel. This is for the case, when UITour opens the page action panel to highlight a button it would set "noautohide" to let the panel persistently opened. But we still need a way to let user able to close the panel so made this change. The PanelUI is doing the same thing [1]. UITour wuold remove "noautohide" on the panelHidden event [2].
[1] https://dxr.mozilla.org/mozilla-central/rev/1b065ffd8a535a0ad4c39a912af18e948e6a42c1/browser/components/customizableui/content/panelUI.js#246
[2] https://dxr.mozilla.org/mozilla-central/rev/1b065ffd8a535a0ad4c39a912af18e948e6a42c1/browser/components/uitour/UITour.jsm#1483
MozReview-Commit-ID: FtJZZ0bfy61
--- a/browser/base/content/browser-pageActions.js
+++ b/browser/base/content/browser-pageActions.js
@@ -506,16 +506,31 @@ var BrowserPageActions = {
// If the temp panel is open and anchored to the main button, close it.
let tempPanel = document.getElementById(this._tempPanelID);
if (tempPanel && tempPanel.anchorNode.id == this.mainButtonNode.id) {
tempPanel.hidePopup();
return;
}
+ if (this.panelNode.state == "open") {
+ this.panelNode.hidePopup();
+ } else if (this.panelNode.state == "closed") {
+ this.showPanel(event);
+ }
+ },
+
+ /**
+ * Show the page action panel
+ *
+ * @param event (DOM event, optional)
+ * The event that triggers showing the panel. (such as a mouse click,
+ * if the user clicked something to open the panel)
+ */
+ showPanel(event = null) {
for (let action of PageActions.actions) {
let buttonNodeID = this._panelButtonNodeIDForActionID(action.id);
let buttonNode = document.getElementById(buttonNodeID);
action.onShowingInPanel(buttonNode);
}
this.panelNode.hidden = false;
this.panelNode.openPopup(this.mainButtonNode, {