Bug 1395911 - Ensure Android addon options are not hidden while a webextension is still starting. r=sebastian
authorLuca Greco <lgreco@mozilla.com>
Fri, 01 Sep 2017 14:31:26 +0200
changeset 428276 fc5fc58f42a3ebab01c6e83901a2dde2435b0933
parent 428275 1130f8849a635f185ab6d364338368f89e9889c4
child 428277 61598569fcdf491c5ccbf24aa59683dc5e0e958e
push id7761
push userjlund@mozilla.com
push dateFri, 15 Sep 2017 00:19:52 +0000
treeherdermozilla-beta@c38455951db4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssebastian
bugs1395911
milestone57.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1395911 - Ensure Android addon options are not hidden while a webextension is still starting. r=sebastian MozReview-Commit-ID: JXxI1dK39jA
mobile/android/chrome/content/aboutAddons.js
--- 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 = "";