Bug 1387624 - Fix datalist popups in extension options r?mixedpuppy draft
authorMartin Giger <martin@humanoids.be>
Sat, 04 Nov 2017 13:40:47 +0100
changeset 718677 a16448e6b61bccbdc134ab866ef6fcebdab134a4
parent 718676 d97ff9ec96fc3310ff5c6043f5137bbcab7a8fe6
child 745584 5bbc7769752e6e6cefc09b0af0f4c5839ce2b537
push id95031
push userbmo:martin@humanoids.be
push dateWed, 10 Jan 2018 20:18:10 +0000
reviewersmixedpuppy
bugs1387624
milestone59.0a1
Bug 1387624 - Fix datalist popups in extension options r?mixedpuppy MozReview-Commit-ID: 9w7Hhv5Fh4n
toolkit/components/satchel/AutoCompletePopup.jsm
toolkit/mozapps/extensions/content/extensions.js
toolkit/mozapps/extensions/content/extensions.xul
toolkit/themes/shared/extensions/extensions.inc.css
--- a/toolkit/components/satchel/AutoCompletePopup.jsm
+++ b/toolkit/components/satchel/AutoCompletePopup.jsm
@@ -154,17 +154,18 @@ this.AutoCompletePopup = {
       // We shouldn't ever be showing an empty popup, and if we
       // already have a popup open, the old one needs to close before
       // we consider opening a new one.
       return;
     }
 
     let window = browser.ownerGlobal;
     // Also check window top in case this is a sidebar.
-    if (Services.focus.activeWindow !== window.top) {
+    if (Services.focus.activeWindow !== window.top &&
+        Services.focus.focusedWindow.top !== window.top) {
       // We were sent a message from a window or tab that went into the
       // background, so we'll ignore it for now.
       return;
     }
 
     let firstResultStyle = results[0].style;
     this.weakBrowser = Cu.getWeakReference(browser);
     this.openedPopup = browser.autoCompletePopup;
--- a/toolkit/mozapps/extensions/content/extensions.js
+++ b/toolkit/mozapps/extensions/content/extensions.js
@@ -3251,16 +3251,17 @@ var gDetailView = {
     let browser = document.createElement("browser");
     browser.setAttribute("type", "content");
     browser.setAttribute("disableglobalhistory", "true");
     browser.setAttribute("id", "addon-options");
     browser.setAttribute("class", "inline-options-browser");
     browser.setAttribute("transparent", "true");
     browser.setAttribute("forcemessagemanager", "true");
     browser.setAttribute("selectmenulist", "ContentSelectDropdown");
+    browser.setAttribute("autocompletepopup", "PopupAutoComplete");
 
     // The outer about:addons document listens for key presses to focus
     // the search box when / is pressed.  But if we're focused inside an
     // options page, don't let those keypresses steal focus.
     browser.addEventListener("keypress", event => {
       event.stopPropagation();
     });
 
@@ -3312,16 +3313,17 @@ var gDetailView = {
         // of addon reload), ensure that the stack is also removed and return null.
         stack.remove();
         resolve(null);
         return;
       }
 
       mm.loadFrameScript("chrome://extensions/content/ext-browser-content.js",
                          false);
+      mm.loadFrameScript("chrome://browser/content/content.js", false);
       mm.addMessageListener("Extension:BrowserContentLoaded", messageListener);
       mm.addMessageListener("Extension:BrowserResized", messageListener);
 
       let browserOptions = {
         fixedWidth: true,
         isInline: true,
       };
 
--- a/toolkit/mozapps/extensions/content/extensions.xul
+++ b/toolkit/mozapps/extensions/content/extensions.xul
@@ -74,16 +74,23 @@
                  activateontab="true" position="after_start"
                  level="parent"
 #ifdef XP_WIN
                  consumeoutsideclicks="false" ignorekeys="shortcuts"
 #endif
         />
     </menulist>
 
+    <panel type="autocomplete-richlistbox"
+           id="PopupAutoComplete"
+           noautofocus="true"
+           hidden="true"
+           norolluponanchor="true"
+           nomaxresults="true" />
+
     <tooltip id="addonitem-tooltip"/>
   </popupset>
 
   <!-- global commands - these act on all addons, or affect the addons manager
        in some other way -->
   <commandset id="globalCommandSet">
     <!-- XXXsw remove useless oncommand attribute once bug 371900 is fixed -->
     <command id="cmd_focusSearch" oncommand=";"/>
--- a/toolkit/themes/shared/extensions/extensions.inc.css
+++ b/toolkit/themes/shared/extensions/extensions.inc.css
@@ -1059,8 +1059,26 @@ button.button-link:not([disabled="true"]
 #signing-dev-info {
   font-style: italic;
 }
 
 #detail-findUpdates-btn[hidden] {
   display: -moz-box;
   visibility: hidden;
 }
+
+/*** Reset PopupAutoComplete richlistbox styles ***/
+
+#PopupAutoComplete richlistbox,
+#PopupAutoComplete listbox {
+  -moz-appearance: initial;
+  margin-inline-start: 0;
+  border: none;
+  border-radius: 0;
+}
+
+#PopupAutoComplete > richlistbox > richlistitem > .ac-type-icon,
+#PopupAutoComplete > richlistbox > richlistitem > .ac-site-icon,
+#PopupAutoComplete > richlistbox > richlistitem > .ac-tags,
+#PopupAutoComplete > richlistbox > richlistitem > .ac-separator,
+#PopupAutoComplete > richlistbox > richlistitem > .ac-url {
+  display: none;
+}