Bug 1407435 - After animating out from the toolbar, the widget no longer remains invisible. r?jaws
MozReview-Commit-ID: 5WmcIFWqBYi
--- a/browser/components/customizableui/CustomizeMode.jsm
+++ b/browser/components/customizableui/CustomizeMode.jsm
@@ -583,17 +583,17 @@ CustomizeMode.prototype = {
_promiseWidgetAnimationOut(aNode) {
if (!gCosmeticAnimationsEnabled ||
aNode.getAttribute("cui-anchorid") == "nav-bar-overflow-button" ||
(aNode.tagName != "toolbaritem" && aNode.tagName != "toolbarbutton") ||
(aNode.id == "downloads-button" && aNode.hidden)) {
return null;
}
let animationNode;
- if (aNode.parentNode.id.startsWith("wrapper-")) {
+ if (aNode.parentNode && aNode.parentNode.id.startsWith("wrapper-")) {
animationNode = aNode.parentNode;
} else {
animationNode = aNode;
}
return new Promise(resolve => {
animationNode.classList.add("animate-out");
animationNode.addEventListener("animationend", function cleanupWidgetAnimationEnd(e) {
if (e.animationName == "widget-animate-out" && e.target.id == animationNode.id) {
@@ -628,17 +628,17 @@ CustomizeMode.prototype = {
if (aNode.id == "downloads-button") {
Services.prefs.setBoolPref(kDownloadAutoHidePref, false);
if (this._customizing) {
this._showDownloadsAutoHidePanel();
}
}
if (widgetAnimationPromise) {
- if (aNode.parentNode.id.startsWith("wrapper-")) {
+ if (aNode.parentNode && aNode.parentNode.id.startsWith("wrapper-")) {
aNode.parentNode.classList.remove("animate-out");
} else {
aNode.classList.remove("animate-out")
}
}
},
async addToPanel(aNode) {
@@ -661,17 +661,17 @@ CustomizeMode.prototype = {
if (aNode.id == "downloads-button") {
Services.prefs.setBoolPref(kDownloadAutoHidePref, false);
if (this._customizing) {
this._showDownloadsAutoHidePanel();
}
}
if (widgetAnimationPromise) {
- if (aNode.parentNode.id.startsWith("wrapper-")) {
+ if (aNode.parentNode && aNode.parentNode.id.startsWith("wrapper-")) {
aNode.parentNode.classList.remove("animate-out");
} else {
aNode.classList.remove("animate-out")
}
}
if (gCosmeticAnimationsEnabled) {
let overflowButton = this.document.getElementById("nav-bar-overflow-button");
BrowserUtils.setToolbarButtonHeightProperty(overflowButton).then(() => {
@@ -707,17 +707,17 @@ CustomizeMode.prototype = {
// If the user explicitly removes this item, turn off autohide.
if (aNode.id == "downloads-button") {
Services.prefs.setBoolPref(kDownloadAutoHidePref, false);
if (this._customizing) {
this._showDownloadsAutoHidePanel();
}
}
if (widgetAnimationPromise) {
- if (aNode.parentNode.id.startsWith("wrapper-")) {
+ if (aNode.parentNode && aNode.parentNode.id.startsWith("wrapper-")) {
aNode.parentNode.classList.remove("animate-out");
} else {
aNode.classList.remove("animate-out")
}
}
},
populatePalette() {