Bug 1380575 - Fix Android WebExtension options page rendered on other extension details.
MozReview-Commit-ID: LXRhx1DKTek
--- a/mobile/android/chrome/content/aboutAddons.js
+++ b/mobile/android/chrome/content/aboutAddons.js
@@ -341,43 +341,44 @@ var Addons = {
uninstallBtn.setAttribute("disabled", "true");
} else {
uninstallBtn.removeAttribute("disabled");
}
let addonItem = document.querySelector("#addons-details > .addon-item");
let optionsBox = addonItem.querySelector(".options-box");
let optionsURL = aListItem.getAttribute("optionsURL");
+
+ // Always clean the options content before rendering the options of the
+ // newly selected extension.
+ optionsBox.innerHTML = "";
+
switch (parseInt(addon.optionsType)) {
case AddonManager.OPTIONS_TYPE_INLINE_BROWSER:
this.createWebExtensionOptions(optionsBox, optionsURL, addon.optionsBrowserStyle);
break;
case AddonManager.OPTIONS_TYPE_INLINE:
- this.createInlineOptions(optionsBox, optionsURL);
+ this.createInlineOptions(optionsBox, optionsURL, aListItem);
break;
}
showAddonOptions();
},
createWebExtensionOptions: async function(destination, optionsURL, browserStyle) {
- destination.innerHTML = "";
-
let frame = document.createElement("iframe");
frame.setAttribute("id", "addon-options");
frame.setAttribute("mozbrowser", "true");
destination.appendChild(frame);
// Loading the URL this way prevents the native back
// button from applying to the iframe.
frame.contentWindow.location.replace(optionsURL);
},
- createInlineOptions(destination, optionsURL) {
- destination.innerHTML = "";
-
+ 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 = "";
for (var i = 0; i < aNode.childNodes.length; i++) {
if (aNode.childNodes[i].nodeType != document.ELEMENT_NODE) {
text += aNode.childNodes[i].textContent;