Bug 1582750 - Manually invoke descriptionHeightWorkaround() on protections panel the first time we show category items. r=johannh

Differential Revision: https://phabricator.services.mozilla.com/D47651

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nihanth Subramanya 2019-09-30 18:28:53 +00:00
parent 5563c51920
commit a519e31479

View File

@ -1596,15 +1596,6 @@ var gProtectionsHandler = {
anyBlocking = anyBlocking || blocker.activated;
}
this._categoryItemOrderInvalidated = true;
if (["showing", "open"].includes(this._protectionsPopup.state)) {
this.reorderCategoryItems();
}
if (anyDetected) {
this.noTrackersDetectedDescription.hidden = true;
}
// Check whether the user has added an exception for this site.
let hasException = ContentBlockingAllowList.includes(
gBrowser.selectedBrowser
@ -1629,6 +1620,30 @@ var gProtectionsHandler = {
this._protectionsPopup.toggleAttribute("blocking", anyBlocking);
this._protectionsPopup.toggleAttribute("hasException", hasException);
this._categoryItemOrderInvalidated = true;
if (anyDetected) {
this.noTrackersDetectedDescription.hidden = true;
if (["showing", "open"].includes(this._protectionsPopup.state)) {
this.reorderCategoryItems();
if (!this._descriptionHeightWorkaroundCalled) {
// The first time the panel is opened, the category items are still
// invisible when descriptionHeightWorkaround gets called, i.e. they
// are omitted from the workaround and the content overflows the panel.
// We can fix this by calling the function manually the first time we
// call reorderCategoryItems(). Since we have set all the relevant
// attributes and hidden the "No Trackers Found" description at this
// point, the items are guaranteed to be visible when we call it below.
PanelMultiView.forNode(
this._protectionsPopupMainView
).descriptionHeightWorkaround();
this._descriptionHeightWorkaroundCalled = true;
}
}
}
this.iconBox.toggleAttribute("active", anyBlocking);
this.iconBox.toggleAttribute("hasException", hasException);