Bug 1441284 - Part 3 - Remove the "showingSubView" property. r=Gijs
The value "single" for the "closemenu" attribute on panel buttons is unused, so the only consumer of the "showingSubView" property can be removed.
MozReview-Commit-ID: 2jf5YE4Uyd
--- a/browser/components/customizableui/CustomizableUI.jsm
+++ b/browser/components/customizableui/CustomizableUI.jsm
@@ -1803,39 +1803,23 @@ var CustomizableUIInternal = {
}
// We can't use event.target because we might have passed a panelview
// anonymous content boundary as well, and so target points to the
// panelmultiview in that case. Unfortunately, this means we get
// anonymous child nodes instead of the real ones, so looking for the
// 'stoooop, don't close me' attributes is more involved.
let target = aEvent.originalTarget;
- let closemenu = "auto";
- let widgetType = "button";
while (target.parentNode && target.localName != "panel") {
- closemenu = target.getAttribute("closemenu");
- widgetType = target.getAttribute("widget-type");
- if (closemenu == "none" || closemenu == "single" ||
- widgetType == "view") {
- break;
+ if (target.getAttribute("closemenu") == "none" ||
+ target.getAttribute("widget-type") == "view") {
+ return;
}
target = target.parentNode;
}
- if (closemenu == "none" || widgetType == "view") {
- return;
- }
-
- if (closemenu == "single") {
- let panel = this._getPanelForNode(target);
- let multiview = panel.querySelector("panelmultiview");
- if (multiview.showingSubView) {
- multiview.goBack();
- return;
- }
- }
// If we get here, we can actually hide the popup:
this.hidePanelForNode(aEvent.target);
},
getUnusedWidgets(aWindowPalette) {
let window = aWindowPalette.ownerGlobal;
let isWindowPrivate = PrivateBrowsingUtils.isWindowPrivate(window);
--- a/browser/components/customizableui/PanelMultiView.jsm
+++ b/browser/components/customizableui/PanelMultiView.jsm
@@ -375,20 +375,16 @@ var PanelMultiView = class extends this.
get _screenManager() {
if (this.__screenManager)
return this.__screenManager;
return this.__screenManager = Cc["@mozilla.org/gfx/screenmanager;1"]
.getService(Ci.nsIScreenManager);
}
- get showingSubView() {
- return this.openViews.length > 1;
- }
-
constructor(node) {
super(node);
this._openPopupPromise = Promise.resolve(false);
this._openPopupCancelCallback = () => {};
}
connect() {
this.connected = true;
@@ -434,22 +430,16 @@ var PanelMultiView = class extends this.
// Proxy these public properties and methods, as used elsewhere by various
// parts of the browser, to this instance.
["goBack", "showSubView"].forEach(method => {
Object.defineProperty(this.node, method, {
enumerable: true,
value: (...args) => this[method](...args)
});
});
- ["showingSubView"].forEach(property => {
- Object.defineProperty(this.node, property, {
- enumerable: true,
- get: () => this[property]
- });
- });
}
disconnect() {
// Guard against re-entrancy.
if (!this.node || !this.connected)
return;
this._cleanupTransitionPhase();