Bug 1435705 - Fix WebExtensions options_ui hidden.
If a user opens the about:addons page and then immediately switches
to the addon details, while the discovery panel is still loading,
then a ViewChanged event is received once the discovery panel has
been completely loaded and the options_ui of the extension was removed
(because the ViewChanged event is also sent when the about:addons page
navigates between its sub-views).
MozReview-Commit-ID: GBF5NHezpNB
--- a/toolkit/mozapps/extensions/content/extensions.js
+++ b/toolkit/mozapps/extensions/content/extensions.js
@@ -3190,24 +3190,34 @@ var gDetailView = {
gDetailView.scrollToPreferencesRows();
});
};
var rows = document.getElementById("detail-downloads").parentNode;
if (this._addon.optionsType == AddonManager.OPTIONS_TYPE_INLINE_BROWSER) {
whenViewLoaded(async () => {
- await this._addon.startupPromise;
+ const addon = this._addon;
+ await addon.startupPromise;
const browserContainer = await this.createOptionsBrowser(rows);
if (browserContainer) {
// Make sure the browser is unloaded as soon as we change views,
// rather than waiting for the next detail view to load.
document.addEventListener("ViewChanged", function() {
+ // Do not remove the addon options container if the view changed
+ // event is not related to a change to the current selected view
+ // or the current selected addon (e.g. it could be related to the
+ // disco pane view that has completed to load, See Bug 1435705 for
+ // a rationale).
+ if (gViewController.currentViewObj === gDetailView &&
+ gDetailView._addon === addon) {
+ return;
+ }
browserContainer.remove();
}, {once: true});
}
finish(browserContainer);
});
}