aboutsummaryrefslogblamecommitdiff
path: root/www/waterfox/files/patch-bug1406859
blob: 6f925ac600cfe2fd8ae87a0cc7f93f6018bd3a87 (plain) (tree)

















































                                                                                                                          
commit ab3fe8821636
Author: Jessica Jong <jjong@mozilla.com>
Date:   Thu Oct 19 09:14:56 2017 +0800

    Bug 1406859 - [DateTimePicker] Let the first picker close gracefully before opening a second picker. r=mconley, a=ritu
    
    If we're trying to open a picker while one is already open, we should let the
    first one close gracefully, that is, we should consume the popuphidden event,
    otherwise the event will be fired when we re-add the listeners.
    
    MozReview-Commit-ID: CGy86le1F4g
    
    --HG--
    extra : source : 629afbb52163b54ec832d8f83f90bb3bcbe929a2
---
 toolkit/content/browser-content.js       | 8 ++++++++
 toolkit/modules/DateTimePickerHelper.jsm | 1 +
 2 files changed, 9 insertions(+)

diff --git toolkit/content/browser-content.js toolkit/content/browser-content.js
index ea830c8e8cdb..e5d01bb720f9 100644
--- toolkit/content/browser-content.js
+++ toolkit/content/browser-content.js
@@ -1790,6 +1790,14 @@ let DateTimePickerListener = {
             (aEvent.originalTarget.type == "time" && !this.getTimePickerPref())) {
           return;
         }
+
+        if (this._inputElement) {
+          // This happens when we're trying to open a picker when another picker
+          // is still open. We ignore this request to let the first picker
+          // close gracefully.
+          return;
+        }
+
         this._inputElement = aEvent.originalTarget;
         this._inputElement.setDateTimePickerState(true);
         this.addListeners();
diff --git toolkit/modules/DateTimePickerHelper.jsm toolkit/modules/DateTimePickerHelper.jsm
index 38e89bd0d160..ad187dab9fed 100644
--- toolkit/modules/DateTimePickerHelper.jsm
+++ toolkit/modules/DateTimePickerHelper.jsm
@@ -63,6 +63,7 @@ this.DateTimePickerHelper = {
           return;
         }
         this.picker.closePicker();
+        this.close();
         break;
       }
       case "FormDateTime:UpdatePicker": {