Bug 1395911 - Ensure Android addon options are not hidden while a webextension is still starting.
MozReview-Commit-ID: JXxI1dK39jA
--- a/mobile/android/chrome/content/aboutAddons.js
+++ b/mobile/android/chrome/content/aboutAddons.js
@@ -392,38 +392,38 @@ var Addons = {
// newly selected extension.
optionsBox.innerHTML = "";
switch (parseInt(addon.optionsType)) {
case AddonManager.OPTIONS_TYPE_INLINE_BROWSER:
// Allow the options to use all the available width space.
optionsBox.classList.remove("inner");
- this.createWebExtensionOptions(optionsBox, addon);
+ this.createWebExtensionOptions(optionsBox, addon, addonItem);
break;
case AddonManager.OPTIONS_TYPE_TAB:
// Keep the usual layout for any options related the legacy (or system) add-ons
// when the options are opened in a new tab from a single button in the addon
// details page.
optionsBox.classList.add("inner");
- this.createOptionsInTabButton(optionsBox, addon);
+ this.createOptionsInTabButton(optionsBox, addon, addonItem);
break;
case AddonManager.OPTIONS_TYPE_INLINE:
// Keep the usual layout for any options related the legacy (or system) add-ons.
optionsBox.classList.add("inner");
this.createInlineOptions(optionsBox, optionsURL, aListItem);
break;
}
showAddonOptions();
},
- createOptionsInTabButton: function(destination, addon) {
+ createOptionsInTabButton: function(destination, addon, detailItem) {
let frame = destination.querySelector("iframe#addon-options");
let button = destination.querySelector("button#open-addon-options");
if (frame) {
// Remove any existent options frame (e.g. when the addon updates
// contains the open_in_tab options for the first time).
frame.remove();
@@ -441,19 +441,23 @@ var Addons = {
// WebExtensions are loaded asynchronously and the optionsURL
// may not be available until the addon has been started.
await addon.startupPromise;
}
const {optionsURL} = addon;
openOptionsInTab(optionsURL);
};
+
+ // Ensure that the Addon Options are visible (the options box will be hidden if the optionsURL
+ // attribute is an empty string, which happens when a WebExtensions is still loading).
+ detailItem.removeAttribute("optionsURL");
},
- createWebExtensionOptions: async function(destination, addon) {
+ createWebExtensionOptions: async function(destination, addon, detailItem) {
// WebExtensions are loaded asynchronously and the optionsURL
// may not be available until the addon has been started.
await addon.startupPromise;
const {optionsURL, optionsBrowserStyle} = addon;
let frame = destination.querySelector("iframe#addon-options");
if (!frame) {
@@ -488,16 +492,20 @@ var Addons = {
destination.appendChild(frame);
originalHeight = frame.getBoundingClientRect().height;
}
// Loading the URL this way prevents the native back
// button from applying to the iframe.
frame.contentWindow.location.replace(optionsURL);
+
+ // Ensure that the Addon Options are visible (the options box will be hidden if the optionsURL
+ // attribute is an empty string, which happens when a WebExtensions is still loading).
+ detailItem.removeAttribute("optionsURL");
},
createInlineOptions(destination, optionsURL, aListItem) {
// This function removes and returns the text content of aNode without
// removing any child elements. Removing the text nodes ensures any XBL
// bindings apply properly.
function stripTextNodes(aNode) {
var text = "";