Bug 1388753 - unbreak bookmarks/history item clicks and tidy up code in browserPlacesViews.js, r=mikedeboer

MozReview-Commit-ID: 1vjP6IeIiPz

--HG--
extra : rebase_source : e3ef4468299adfd0b874ba2f44a034c2655ecd6f
This commit is contained in:
Gijs Kruitbosch 2017-08-10 23:04:54 +01:00
parent 43dd368771
commit ad0e178cad
2 changed files with 5 additions and 23 deletions

View File

@ -338,7 +338,6 @@ this.PanelMultiView = class {
this._panel.removeEventListener("popupshown", this);
this._panel.removeEventListener("popuphidden", this);
this.window.removeEventListener("keydown", this);
this._dispatchViewEvent(this.node, "destructed");
this.node = this._clickCapturer = this._viewContainer = this._mainViewContainer =
this._subViews = this._viewStack = this.__dwu = this._panelViewCache = null;
}
@ -676,8 +675,8 @@ this.PanelMultiView = class {
*/
_dispatchViewEvent(viewNode, eventName, anchor, detail) {
let cancel = false;
if (eventName != "PanelMultiViewHidden" && eventName != "destructed") {
// Don't need to do this for PanelMultiViewHidden or "destructed" events
if (eventName != "PanelMultiViewHidden") {
// Don't need to do this for PanelMultiViewHidden event
CustomizableUI.ensureSubviewListeners(viewNode);
}

View File

@ -2020,8 +2020,7 @@ this.PlacesPanelview = class extends PlacesViewBase {
get events() {
if (this._events)
return this._events;
return this._events = ["command", "destructed", "dragend", "dragstart",
"ViewHiding", "ViewShowing", "ViewShown"];
return this._events = ["command", "dragend", "dragstart", "ViewHiding", "ViewShown"];
}
get panel() {
@ -2037,9 +2036,6 @@ this.PlacesPanelview = class extends PlacesViewBase {
case "command":
this._onCommand(event);
break;
case "destructed":
this._onDestructed(event);
break;
case "dragend":
this._onDragEnd(event);
break;
@ -2052,9 +2048,6 @@ this.PlacesPanelview = class extends PlacesViewBase {
case "ViewHiding":
this._onPopupHidden(event);
break;
case "ViewShowing":
this._onPopupShowing(event);
break;
case "ViewShown":
this._onViewShown(event);
break;
@ -2069,13 +2062,6 @@ this.PlacesPanelview = class extends PlacesViewBase {
PlacesUIUtils.openNodeWithEvent(button._placesNode, event);
}
_onDestructed(event) {
// The panelmultiview is ephemeral, so let's keep an eye out when the root
// element is showing again.
this._removeEventListeners(event.target, this.events);
this._addEventListeners(this._viewElt, ["ViewShowing"]);
}
_onDragEnd() {
this._draggedElt = null;
}
@ -2095,7 +2081,6 @@ this.PlacesPanelview = class extends PlacesViewBase {
uninit(event) {
this._removeEventListeners(this.panelMultiView, this.events);
this._removeEventListeners(this._viewElt, ["ViewShowing"]);
this._removeEventListeners(window, ["unload"]);
super.uninit(event);
}
@ -2177,11 +2162,9 @@ this.PlacesPanelview = class extends PlacesViewBase {
}
_onPopupShowing(event) {
// If the event came from the root element, this is a sign that the panelmultiview
// was just instantiated (see `_onDestructed` above) or this is the first time
// If the event came from the root element, this is the first time
// we ever get here.
if (event.originalTarget == this._viewElt) {
this._removeEventListeners(this._viewElt, ["ViewShowing"]);
if (event.originalTarget == this._rootElt) {
// Start listening for events from all panels inside the panelmultiview.
this._addEventListeners(this.panelMultiView, this.events);
}