Bug 1497280 - Make the DateTimePicker Fission-aware. r=mconley
☠☠ backed out by 37545337e03d ☠ ☠
authorFelipe Gomes <felipc@gmail.com>
Wed, 31 Oct 2018 14:53:48 +0000
changeset 443974 7005723d76c7
parent 443973 d22681de62e7
child 443975 764deec55545
push id72178
push userfgomes@mozilla.com
push dateThu, 01 Nov 2018 19:28:13 +0000
treeherderautoland@7005723d76c7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmconley
bugs1497280, 1493984
milestone65.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 1497280 - Make the DateTimePicker Fission-aware. r=mconley By using the API from bug 1493984 and setting allFrames=true we can establish a direct communication between the actor in the subframe and the DateTimePickerParent. Differential Revision: https://phabricator.services.mozilla.com/D8015
toolkit/actors/DateTimePickerChild.jsm
toolkit/modules/ActorManagerParent.jsm
toolkit/modules/DateTimePickerParent.jsm
--- a/toolkit/actors/DateTimePickerChild.jsm
+++ b/toolkit/actors/DateTimePickerChild.jsm
@@ -84,17 +84,17 @@ class DateTimePickerChild extends ActorC
    */
   receiveMessage(aMessage) {
     switch (aMessage.name) {
       case "FormDateTime:PickerClosed": {
         this.close();
         break;
       }
       case "FormDateTime:PickerValueChanged": {
-        this._inputElement.updateDateTimeInputBox(aMessage.data);
+        this._inputElement.updateDateTimeInputBox(aMessage.data.detail);
         break;
       }
       default:
         break;
     }
   }
 
   /**
@@ -117,17 +117,17 @@ class DateTimePickerChild extends ActorC
           return;
         }
 
         this._inputElement = aEvent.originalTarget;
         this._inputElement.setDateTimePickerState(true);
         this.addListeners();
 
         let value = this._inputElement.getDateTimeInputBoxValue();
-        this.mm.sendAsyncMessage("FormDateTime:OpenPicker", {
+        this.sendAsyncMessage("FormDateTime:OpenPicker", {
           rect: this.getBoundingContentRect(this._inputElement),
           dir: this.getComputedDirection(this._inputElement),
           type: this._inputElement.type,
           detail: {
             // Pass partial value if it's available, otherwise pass input
             // element's value.
             value: Object.keys(value).length > 0 ? value
                                                  : this._inputElement.value,
@@ -137,28 +137,28 @@ class DateTimePickerChild extends ActorC
             stepBase: this._inputElement.getStepBase(),
           },
         });
         break;
       }
       case "MozUpdateDateTimePicker": {
         let value = this._inputElement.getDateTimeInputBoxValue();
         value.type = this._inputElement.type;
-        this.mm.sendAsyncMessage("FormDateTime:UpdatePicker", { value });
+        this.sendAsyncMessage("FormDateTime:UpdatePicker", { value });
         break;
       }
       case "MozCloseDateTimePicker": {
-        this.mm.sendAsyncMessage("FormDateTime:ClosePicker");
+        this.sendAsyncMessage("FormDateTime:ClosePicker");
         this.close();
         break;
       }
       case "pagehide": {
         if (this._inputElement &&
             this._inputElement.ownerDocument == aEvent.target) {
-          this.mm.sendAsyncMessage("FormDateTime:ClosePicker");
+          this.sendAsyncMessage("FormDateTime:ClosePicker");
           this.close();
         }
         break;
       }
       default:
         break;
     }
   }
--- a/toolkit/modules/ActorManagerParent.jsm
+++ b/toolkit/modules/ActorManagerParent.jsm
@@ -148,16 +148,17 @@ let ACTORS = {
   },
 
   DateTimePicker: {
     child: {
       module: "resource://gre/actors/DateTimePickerChild.jsm",
       events: {
         "MozOpenDateTimePicker": {},
       },
+      allFrames: true,
     },
   },
 
   ExtFind: {
     child: {
       module: "resource://gre/actors/ExtFindChild.jsm",
       messages: [
         "ext-Finder:CollectResults",
--- a/toolkit/modules/DateTimePickerParent.jsm
+++ b/toolkit/modules/DateTimePickerParent.jsm
@@ -79,48 +79,54 @@ var DateTimePickerParent = {
     switch (aEvent.type) {
       case "DateTimePickerValueChanged": {
         this.updateInputBoxValue(aEvent);
         break;
       }
       case "popuphidden": {
         let browser = this.weakBrowser ? this.weakBrowser.get() : null;
         if (browser) {
-          browser.messageManager.sendAsyncMessage("FormDateTime:PickerClosed");
+          browser.messageManager.sendAsyncMessage("FormDateTime:PickerClosed", {
+            browsingContextId: this._browsingContextId,
+          });
         }
         this.picker.closePicker();
         this.close();
         break;
       }
       default:
         break;
     }
   },
 
   // Called when picker value has changed, notify input box about it.
   updateInputBoxValue(aEvent) {
     let browser = this.weakBrowser ? this.weakBrowser.get() : null;
     if (browser) {
       browser.messageManager.sendAsyncMessage(
-        "FormDateTime:PickerValueChanged", aEvent.detail);
+        "FormDateTime:PickerValueChanged", {
+          detail: aEvent.detail,
+          browsingContextId: this._browsingContextId,
+        });
     }
   },
 
   // Get picker from browser and show it anchored to the input box.
   async showPicker(aBrowser, aData) {
     let rect = aData.rect;
     let type = aData.type;
     let detail = aData.detail;
 
     this._anchor = aBrowser.ownerGlobal.gBrowser.popupAnchor;
     this._anchor.left = rect.left;
     this._anchor.top = rect.top;
     this._anchor.width = rect.width;
     this._anchor.height = rect.height;
     this._anchor.hidden = false;
+    this._browsingContextId = aData.browsingContextId;
 
     debug("Opening picker with details: " + JSON.stringify(detail));
 
     let window = aBrowser.ownerGlobal;
     let tabbrowser = window.gBrowser;
     if (Services.focus.activeWindow != window ||
         tabbrowser.selectedBrowser != aBrowser) {
       // We were sent a message from a window or tab that went into the