diff --git a/browser/components/customizableui/content/panelUI.inc.xul b/browser/components/customizableui/content/panelUI.inc.xul
index 290139b684ed..341aa9f8bc15 100644
--- a/browser/components/customizableui/content/panelUI.inc.xul
+++ b/browser/components/customizableui/content/panelUI.inc.xul
@@ -26,9 +26,11 @@
exitLabel="&appMenuCustomizeExit.label;"
tooltiptext="&appMenuCustomize.tooltip;"
exitTooltiptext="&appMenuCustomizeExit.tooltip;"
+ closemenu="none"
oncommand="gCustomizeMode.toggle();"/>
diff --git a/browser/components/customizableui/content/panelUI.js b/browser/components/customizableui/content/panelUI.js
index df85848bf2b3..e78e22d3d210 100644
--- a/browser/components/customizableui/content/panelUI.js
+++ b/browser/components/customizableui/content/panelUI.js
@@ -61,7 +61,6 @@ const PanelUI = {
}
this.helpView.addEventListener("ViewShowing", this._onHelpViewShow, false);
- this.helpView.addEventListener("ViewHiding", this._onHelpViewHide, false);
this._eventListenersAdded = true;
},
@@ -74,7 +73,6 @@ const PanelUI = {
this.panel.removeEventListener(event, this);
}
this.helpView.removeEventListener("ViewShowing", this._onHelpViewShow);
- this.helpView.removeEventListener("ViewHiding", this._onHelpViewHide);
this.menuButton.removeEventListener("mousedown", this);
this.menuButton.removeEventListener("keypress", this);
},
@@ -167,9 +165,6 @@ const PanelUI = {
handleEvent: function(aEvent) {
switch (aEvent.type) {
- case "command":
- this.onCommandHandler(aEvent);
- break;
case "popupshowing":
// Fall through
case "popupshown":
@@ -419,12 +414,6 @@ const PanelUI = {
fragment.appendChild(button);
}
items.appendChild(fragment);
-
- this.addEventListener("command", PanelUI);
- },
-
- _onHelpViewHide: function(aEvent) {
- this.removeEventListener("command", PanelUI);
},
_updateQuitTooltip: function() {
diff --git a/browser/components/customizableui/src/CustomizableUI.jsm b/browser/components/customizableui/src/CustomizableUI.jsm
index 609fb31025c7..aa5f7d839ae3 100644
--- a/browser/components/customizableui/src/CustomizableUI.jsm
+++ b/browser/components/customizableui/src/CustomizableUI.jsm
@@ -635,33 +635,33 @@ let CustomizableUIInternal = {
return [null, null];
},
- registerMenuPanel: function(aPanel) {
+ registerMenuPanel: function(aPanelContents) {
if (gBuildAreas.has(CustomizableUI.AREA_PANEL) &&
- gBuildAreas.get(CustomizableUI.AREA_PANEL).has(aPanel)) {
+ gBuildAreas.get(CustomizableUI.AREA_PANEL).has(aPanelContents)) {
return;
}
- let document = aPanel.ownerDocument;
+ let document = aPanelContents.ownerDocument;
- aPanel.toolbox = document.getElementById("navigator-toolbox");
- aPanel.customizationTarget = aPanel;
+ aPanelContents.toolbox = document.getElementById("navigator-toolbox");
+ aPanelContents.customizationTarget = aPanelContents;
- this.addPanelCloseListeners(aPanel);
+ this.addPanelCloseListeners(this._getPanelForNode(aPanelContents));
let placements = gPlacements.get(CustomizableUI.AREA_PANEL);
- this.buildArea(CustomizableUI.AREA_PANEL, placements, aPanel);
- for (let child of aPanel.children) {
+ this.buildArea(CustomizableUI.AREA_PANEL, placements, aPanelContents);
+ for (let child of aPanelContents.children) {
if (child.localName != "toolbarbutton") {
if (child.localName == "toolbaritem") {
- this.ensureButtonContextMenu(child, aPanel);
+ this.ensureButtonContextMenu(child, aPanelContents);
}
continue;
}
- this.ensureButtonContextMenu(child, aPanel);
+ this.ensureButtonContextMenu(child, aPanelContents);
child.setAttribute("wrap", "true");
}
- this.registerBuildArea(CustomizableUI.AREA_PANEL, aPanel);
+ this.registerBuildArea(CustomizableUI.AREA_PANEL, aPanelContents);
},
onWidgetAdded: function(aWidgetId, aArea, aPosition) {
@@ -1314,11 +1314,20 @@ let CustomizableUIInternal = {
}
}
- if (aEvent.target.getAttribute("closemenu") == "none" ||
- aEvent.target.getAttribute("widget-type") == "view") {
+ if (aEvent.originalTarget.getAttribute("closemenu") == "none" ||
+ aEvent.originalTarget.getAttribute("widget-type") == "view") {
return;
}
+ if (aEvent.originalTarget.getAttribute("closemenu") == "single") {
+ let panel = this._getPanelForNode(aEvent.originalTarget);
+ let multiview = panel.querySelector("panelmultiview");
+ if (multiview.showingSubView) {
+ multiview.showMainView();
+ return;
+ }
+ }
+
// If we get here, we can actually hide the popup:
this.hidePanelForNode(aEvent.target);
},
diff --git a/browser/components/customizableui/src/CustomizableWidgets.jsm b/browser/components/customizableui/src/CustomizableWidgets.jsm
index bbd6dd55fade..01726c543e0b 100644
--- a/browser/components/customizableui/src/CustomizableWidgets.jsm
+++ b/browser/components/customizableui/src/CustomizableWidgets.jsm
@@ -291,7 +291,6 @@ const CustomizableWidgets = [{
}
items.appendChild(fragment);
- aEvent.target.addEventListener("command", win.PanelUI);
},
onViewHiding: function(aEvent) {
let doc = aEvent.target.ownerDocument;
@@ -307,7 +306,6 @@ const CustomizableWidgets = [{
}
parent.appendChild(items);
- aEvent.target.removeEventListener("command", win.PanelUI);
}
}, {
id: "add-ons-button",
diff --git a/browser/components/customizableui/src/CustomizeMode.jsm b/browser/components/customizableui/src/CustomizeMode.jsm
index cde5426a261f..56474c3c5828 100644
--- a/browser/components/customizableui/src/CustomizeMode.jsm
+++ b/browser/components/customizableui/src/CustomizeMode.jsm
@@ -174,6 +174,13 @@ CustomizeMode.prototype = {
window.PanelUI.menuButton.open = true;
window.PanelUI.beginBatchUpdate();
+ // The menu panel is lazy, and registers itself when the popup shows. We
+ // need to force the menu panel to register itself, or else customization
+ // is really not going to work. We pass "true" to ensureRegistered to
+ // indicate that we're handling calling startBatchUpdate and
+ // endBatchUpdate.
+ yield window.PanelUI.ensureReady(true);
+
// Hide the palette before starting the transition for increased perf.
this.visiblePalette.hidden = true;
@@ -200,13 +207,6 @@ CustomizeMode.prototype = {
// Let everybody in this window know that we're about to customize.
this.dispatchToolboxEvent("customizationstarting");
- // The menu panel is lazy, and registers itself when the popup shows. We
- // need to force the menu panel to register itself, or else customization
- // is really not going to work. We pass "true" to ensureRegistered to
- // indicate that we're handling calling startBatchUpdate and
- // endBatchUpdate.
- yield window.PanelUI.ensureReady(true);
-
this._mainViewContext = mainView.getAttribute("context");
if (this._mainViewContext) {
mainView.removeAttribute("context");