Bug 1441284 - Part 2 - Remove the "_currentSubView" property. r=Gijs
MozReview-Commit-ID: Aua3V8hOT39
--- a/browser/components/customizableui/PanelMultiView.jsm
+++ b/browser/components/customizableui/PanelMultiView.jsm
@@ -375,22 +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 _currentSubView() {
- // Peek the top of the stack, but fall back to the main view if the list of
- // opened views is currently empty.
- let panelView = this.openViews[this.openViews.length - 1];
- return (panelView && panelView.node) || this._mainView;
- }
get showingSubView() {
return this.openViews.length > 1;
}
constructor(node) {
super(node);
this._openPopupPromise = Promise.resolve(false);
this._openPopupCancelCallback = () => {};
@@ -1103,18 +1097,21 @@ var PanelMultiView = class extends this.
handleEvent(aEvent) {
if (aEvent.type.startsWith("popup") && aEvent.target != this._panel) {
// Shouldn't act on e.g. context menus being shown from within the panel.
return;
}
switch (aEvent.type) {
case "keydown":
if (!this._transitioning) {
- PanelView.forNode(this._currentSubView)
- .keyNavigation(aEvent, this._dir);
+ // Since we start listening for the "keydown" event when the popup is
+ // already showing and stop listening when the panel is hidden, we
+ // always have at least one view open.
+ let currentView = this.openViews[this.openViews.length - 1];
+ currentView.keyNavigation(aEvent, this._dir);
}
break;
case "mousemove":
this.openViews.forEach(panelView => panelView.clearNavigation());
break;
case "popupshowing": {
this._viewContainer.setAttribute("panelopen", "true");
if (!this.node.hasAttribute("disablekeynav")) {