Bug 1370986 - disable panelmultiview in the overflow panel off-nightly for 55, r?mikedeboer
This #ifdefs out the multiview for non-photon-theme, and checks for it being
present in various bits of JS that interact with it. As a result, this will
'fix' the issues in this bug and in
bug 1370967 for 55 as it moves off
Nightly.
bug 1370967 will still need fixing in the photonpanelmultiview /
webextensions.
MozReview-Commit-ID: 6x4HmyvxeRP
--- a/browser/components/customizableui/CustomizableUI.jsm
+++ b/browser/components/customizableui/CustomizableUI.jsm
@@ -1518,17 +1518,18 @@ var CustomizableUIInternal = {
} else if (aWidget.type == "view") {
let ownerWindow = aNode.ownerGlobal;
let area = this.getPlacementOfWidget(aNode.id).area;
let areaType = CustomizableUI.getAreaType(area);
let anchor = aNode;
if (areaType != CustomizableUI.TYPE_MENU_PANEL) {
let wrapper = this.wrapWidget(aWidget.id).forWindow(ownerWindow);
- if (wrapper && !wrapper.overflowed && wrapper.anchor) {
+ let hasMultiView = !!aNode.closest("photonpanelmultiview,panelmultiview");
+ if (wrapper && !hasMultiView && wrapper.anchor) {
this.hidePanelForNode(aNode);
anchor = wrapper.anchor;
}
}
ownerWindow.PanelUI.showSubView(aWidget.viewId, anchor, area);
}
},
@@ -1721,19 +1722,23 @@ var CustomizableUIInternal = {
target = target.parentNode;
}
if (closemenu == "none" || widgetType == "view") {
return;
}
if (closemenu == "single") {
let panel = this._getPanelForNode(target);
- let multiview = panel.querySelector("panelmultiview");
+ let multiview = panel.querySelector("photonpanelmultiview,panelmultiview");
if (multiview.showingSubView) {
- multiview.showMainView();
+ if (multiview.instance.panelViews) {
+ multiview.goBack();
+ } else {
+ multiview.showMainView();
+ }
return;
}
}
// If we get here, we can actually hide the popup:
this.hidePanelForNode(aEvent.target);
},
@@ -4151,19 +4156,25 @@ OverflowableToolbar.prototype = {
show() {
if (this._panel.state == "open") {
return Promise.resolve();
}
return new Promise(resolve => {
let doc = this._panel.ownerDocument;
this._panel.hidden = false;
- let mainViewId = this._panel.querySelector("panelmultiview").getAttribute("mainViewId");
- let mainView = doc.getElementById(mainViewId);
- let contextMenu = doc.getElementById(mainView.getAttribute("context"));
+ let photonView = this._panel.querySelector("panelmultiview");
+ let contextMenu;
+ if (photonView) {
+ let mainViewId = photonView.getAttribute("mainViewId");
+ let mainView = doc.getElementById(mainViewId);
+ contextMenu = doc.getElementById(mainView.getAttribute("context"));
+ } else {
+ contextMenu = doc.getElementById(this._panel.getAttribute("context"));
+ }
gELS.addSystemEventListener(contextMenu, "command", this, true);
let anchor = doc.getAnonymousElementByAttribute(this._chevron, "class", "toolbarbutton-icon");
// Ensure we update the gEditUIVisible flag when opening the popup, in
// case the edit controls are in it.
this._panel.addEventListener("popupshowing", () => doc.defaultView.updateEditUIVisibility(), {once: true});
this._panel.openPopup(anchor || this._chevron);
this._chevron.open = true;
--- a/browser/components/customizableui/content/panelUI.inc.xul
+++ b/browser/components/customizableui/content/panelUI.inc.xul
@@ -335,28 +335,35 @@
</panelmultiview>
</panel>
<panel id="widget-overflow"
role="group"
type="arrow"
noautofocus="true"
position="bottomcenter topright"
+#ifndef MOZ_PHOTON_THEME
+ context="toolbar-context-menu"
+#endif
hidden="true">
+#ifdef MOZ_PHOTON_THEME
<panelmultiview mainViewId="widget-overflow-mainView">
<panelview id="widget-overflow-mainView"
context="toolbar-context-menu">
+#endif
<vbox id="widget-overflow-scroller">
<vbox id="widget-overflow-list" class="widget-overflow-list"
overflowfortoolbar="nav-bar"/>
<toolbarseparator id="widget-overflow-fixed-separator" hidden="true"/>
<vbox id="widget-overflow-fixed-list" class="widget-overflow-list" hidden="true"/>
</vbox>
+#ifdef MOZ_PHOTON_THEME
</panelview>
</panelmultiview>
+#endif
</panel>
<panel id="customization-tipPanel"
type="arrow"
flip="none"
side="left"
position="leftcenter topright"
noautohide="true"
--- a/browser/components/customizableui/test/browser_overflow_use_subviews.js
+++ b/browser/components/customizableui/test/browser_overflow_use_subviews.js
@@ -36,18 +36,20 @@ add_task(async function check_developer_
chevron.click();
await shownPanelPromise;
let developerView = document.getElementById("PanelUI-developer");
let button = document.getElementById("developer-button");
let subviewShownPromise = subviewShown(developerView);
button.click();
await subviewShownPromise;
- is(developerView.closest("panel"), kOverflowPanel, "Should be inside the panel");
- kOverflowPanel.hidePopup();
+ let hasSubviews = !!kOverflowPanel.querySelector("photonpanelmultiview,panelmultiview");
+ let expectedPanel = hasSubviews ? kOverflowPanel : document.getElementById("customizationui-widget-panel");
+ is(developerView.closest("panel"), expectedPanel, "Should be inside the panel");
+ expectedPanel.hidePopup();
await Promise.resolve(); // wait for popup to hide fully.
});
/**
* This checks that non-subview-compatible items still work correctly.
* Ideally we should make the downloads panel and bookmarks/library item
* proper subview items, then this test can go away, and potentially we can
* simplify some of the subview anchoring code.