Bug 1401876 - Part 1: Close datetime picker on popuphidden. r=mconley, a=ritu
authorScott Wu <scottcwwu@gmail.com>
Thu, 21 Sep 2017 15:37:25 +0800
changeset 432318 83232ecf718c
parent 432317 c4235f5a700c
child 432319 65d71d7a20bd
push id7930
push userryanvm@gmail.com
push date2017-10-09 19:21 +0000
treeherdermozilla-beta@b92b69f3503e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmconley, ritu
bugs1401876
milestone57.0
Bug 1401876 - Part 1: Close datetime picker on popuphidden. r=mconley, a=ritu MozReview-Commit-ID: FUqbtAftQxh
toolkit/content/tests/browser/head.js
toolkit/content/widgets/datetimepopup.xml
toolkit/modules/DateTimePickerHelper.jsm
--- a/toolkit/content/tests/browser/head.js
+++ b/toolkit/content/tests/browser/head.js
@@ -185,16 +185,17 @@ class DateTimeTestHelper {
   /**
    * Close the panel and the tab
    */
   async tearDown() {
     if (!this.panel.hidden) {
       let pickerClosePromise = new Promise(resolve => {
         this.panel.addEventListener("popuphidden", resolve, {once: true});
       });
+      this.panel.hidePopup();
       this.panel.closePicker();
       await pickerClosePromise;
     }
     await BrowserTestUtils.removeTab(this.tab);
     this.tab = null;
   }
 
   /**
--- a/toolkit/content/widgets/datetimepopup.xml
+++ b/toolkit/content/widgets/datetimepopup.xml
@@ -70,17 +70,16 @@
       <method name="closePicker">
         <body><![CDATA[
           this.setInputBoxValue(true);
           this.pickerState = {};
           this.type = undefined;
           this.dateTimePopupFrame.removeEventListener("load", this, true);
           this.dateTimePopupFrame.contentDocument.removeEventListener("message", this);
           this.dateTimePopupFrame.setAttribute("src", "");
-          this.hidePopup();
           this.hidden = true;
         ]]></body>
       </method>
       <method name="setPopupValue">
         <parameter name="data"/>
         <body><![CDATA[
           switch (this.type) {
             case "time": {
@@ -315,16 +314,17 @@
 
           switch (aEvent.data.name) {
             case "PickerPopupChanged": {
               this.pickerState = aEvent.data.detail;
               this.setInputBoxValue();
               break;
             }
             case "ClosePopup": {
+              this.hidePopup();
               this.closePicker();
               break;
             }
           }
         ]]></body>
       </method>
       <method name="postMessageToPicker">
         <parameter name="data"/>
--- a/toolkit/modules/DateTimePickerHelper.jsm
+++ b/toolkit/modules/DateTimePickerHelper.jsm
@@ -85,16 +85,17 @@ this.DateTimePickerHelper = {
         this.updateInputBoxValue(aEvent);
         break;
       }
       case "popuphidden": {
         let browser = this.weakBrowser ? this.weakBrowser.get() : null;
         if (browser) {
           browser.messageManager.sendAsyncMessage("FormDateTime:PickerClosed");
         }
+        this.picker.closePicker();
         this.close();
         break;
       }
       default:
         break;
     }
   },