diff options
-rw-r--r-- | application/palemoon/base/content/autocomplete.xml | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/application/palemoon/base/content/autocomplete.xml b/application/palemoon/base/content/autocomplete.xml index 9291b205b..bd0928436 100644 --- a/application/palemoon/base/content/autocomplete.xml +++ b/application/palemoon/base/content/autocomplete.xml @@ -404,7 +404,10 @@ <method name="toggleHistoryPopup"> <body><![CDATA[ - if (!this.popup.popupOpen) + // If this method is called on the same event tick as the popup gets + // hidden, do nothing to avoid re-opening the popup when the drop + // marker is clicked while the popup is still open. + if (!this.popup.isPopupHidingTick && !this.popup.popupOpen) this.showHistoryPopup(); else this.closePopup(); @@ -871,6 +874,7 @@ extends="chrome://global/content/bindings/popup.xml#popup"> <implementation implements="nsIAutoCompletePopup"> <field name="mInput">null</field> <field name="mPopupOpen">false</field> + <field name="mIsPopupHidingTick">false</field> <!-- =================== nsIAutoCompletePopup =================== --> @@ -883,6 +887,9 @@ extends="chrome://global/content/bindings/popup.xml#popup"> <property name="popupOpen" readonly="true" onget="return this.mPopupOpen;"/> + <property name="isPopupHidingTick" readonly="true" + onget="return this.mIsPopupHidingTick;"/> + <method name="closePopup"> <body> <![CDATA[ @@ -989,6 +996,14 @@ extends="chrome://global/content/bindings/popup.xml#popup"> this.removeAttribute("autocompleteinput"); this.mPopupOpen = false; + // Prevent opening popup from historydropmarker mousedown handler + // on the same event tick the popup is hidden by the same mousedown + // event. + this.mIsPopupHidingTick = true; + setTimeout(() => { + this.mIsPopupHidingTick = false; + }, 0); + // Reset the maxRows property to the cached "normal" value, and reset // _normalMaxRows so that we can detect whether it was set by the input // when the popupshowing handler runs. @@ -2103,18 +2118,9 @@ extends="chrome://global/content/bindings/popup.xml#popup"> </binding> <binding id="private-history-dropmarker" extends="chrome://global/content/bindings/general.xml#dropmarker"> - <implementation> - <method name="showPopup"> - <body><![CDATA[ - var textbox = document.getBindingParent(this); - textbox.showHistoryPopup(); - ]]></body> - </method> - </implementation> - <handlers> <handler event="mousedown" button="0"><![CDATA[ - this.showPopup(); + document.getBindingParent(this).toggleHistoryPopup(); ]]></handler> </handlers> </binding> |