Bug 1472491: Part 5α - Add DateTimePickerChild actor. r=mconley draft
authorKris Maglione <maglione.k@gmail.com>
Sun, 29 Jul 2018 23:39:17 -0700
changeset 828462 e4eddd659ca25ade7dcfe68f0392911c7822752a
parent 828461 7d641bfec99ec680485869e2af185aaa33c02b8b
child 828463 7ece0606d4197e0b1fc1acb94bf476d583008908
push id118680
push usermaglione.k@gmail.com
push dateFri, 10 Aug 2018 23:04:22 +0000
reviewersmconley
bugs1472491
milestone63.0a1
Bug 1472491: Part 5α - Add DateTimePickerChild actor. r=mconley MozReview-Commit-ID: EWTCdNCmE9S
toolkit/actors/DateTimePickerChild.jsm
toolkit/actors/moz.build
toolkit/content/browser-content.js
toolkit/modules/ActorManagerParent.jsm
toolkit/modules/DateTimePickerContent.jsm
toolkit/modules/moz.build
rename from toolkit/modules/DateTimePickerContent.jsm
rename to toolkit/actors/DateTimePickerChild.jsm
--- a/toolkit/modules/DateTimePickerContent.jsm
+++ b/toolkit/actors/DateTimePickerChild.jsm
@@ -1,28 +1,31 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 ChromeUtils.defineModuleGetter(this, "BrowserUtils",
   "resource://gre/modules/BrowserUtils.jsm");
 
-var EXPORTED_SYMBOLS = ["DateTimePickerContent"];
+var EXPORTED_SYMBOLS = ["DateTimePickerChild"];
+
+ChromeUtils.import("resource://gre/modules/ActorChild.jsm");
 
 /**
- * DateTimePickerContent is the communication channel between the input box
+ * DateTimePickerChild is the communication channel between the input box
  * (content) for date/time input types and its picker (chrome).
  */
-class DateTimePickerContent {
+class DateTimePickerChild extends ActorChild {
   /**
    * On init, just listen for the event to open the picker, once the picker is
    * opened, we'll listen for update and close events.
    */
   constructor(global) {
+    super(global);
     this._inputElement = null;
     this._global = global;
   }
 
   /**
    * Cleanup function called when picker is closed.
    */
   close() {
--- a/toolkit/actors/moz.build
+++ b/toolkit/actors/moz.build
@@ -1,16 +1,17 @@
 # -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 FINAL_TARGET_FILES.actors += [
     'AudioPlaybackChild.jsm',
+    'DateTimePickerChild.jsm',
     'ExtFindChild.jsm',
     'FindBarChild.jsm',
     'PopupBlockingChild.jsm',
     'PrintingChild.jsm',
     'SelectChild.jsm',
     'SelectionSourceChild.jsm',
     'ThumbnailsChild.jsm',
     'WebChannelChild.jsm',
--- a/toolkit/content/browser-content.js
+++ b/toolkit/content/browser-content.js
@@ -31,22 +31,16 @@ XPCOMUtils.defineLazyProxy(this, "Shield
 });
 
 XPCOMUtils.defineLazyProxy(this, "UITourListener", () => {
   let tmp = {};
   ChromeUtils.import("resource:///modules/ContentUITour.jsm", tmp);
   return new tmp.UITourListener(global);
 });
 
-XPCOMUtils.defineLazyProxy(this, "DateTimePickerContent", () => {
-  let tmp = {};
-  ChromeUtils.import("resource://gre/modules/DateTimePickerContent.jsm", tmp);
-  return new tmp.DateTimePickerContent(this);
-});
-
 // Lazily load the finder code
 addMessageListener("Finder:Initialize", function() {
   let {RemoteFinderListener} = ChromeUtils.import("resource://gre/modules/RemoteFinder.jsm", {});
   new RemoteFinderListener(global);
 });
 
 var AutoScrollListener = {
   handleEvent(event) {
@@ -57,18 +51,16 @@ var AutoScrollListener = {
         this._controller = new AutoScrollController(global);
       }
       this._controller.handleEvent(event);
     }
   }
 };
 Services.els.addSystemEventListener(global, "mousedown", AutoScrollListener, true);
 
-addEventListener("MozOpenDateTimePicker", DateTimePickerContent);
-
 var UnselectedTabHoverObserver = {
   init() {
     addMessageListener("Browser:UnselectedTabHover", this);
     addEventListener("UnselectedTabHover:Enable", this);
     addEventListener("UnselectedTabHover:Disable", this);
     this.init = null;
   },
   receiveMessage(message) {
--- a/toolkit/modules/ActorManagerParent.jsm
+++ b/toolkit/modules/ActorManagerParent.jsm
@@ -106,16 +106,25 @@ let ACTORS = {
         "AudioPlayback",
       ],
       observers: [
         "audio-playback",
       ],
     },
   },
 
+  DateTimePicker: {
+    child: {
+      module: "resource://gre/actors/DateTimePickerChild.jsm",
+      events: {
+        "MozOpenDateTimePicker": {},
+      },
+    },
+  },
+
   ExtFind: {
     child: {
       module: "resource://gre/actors/ExtFindChild.jsm",
       messages: [
         "ext-Finder:CollectResults",
         "ext-Finder:HighlightResults",
         "ext-Finder:clearHighlighting",
       ]
--- a/toolkit/modules/moz.build
+++ b/toolkit/modules/moz.build
@@ -191,17 +191,16 @@ EXTRA_JS_MODULES += [
     'CanonicalJSON.jsm',
     'CertUtils.jsm',
     'CharsetMenu.jsm',
     'ClientID.jsm',
     'Color.jsm',
     'Console.jsm',
     'CreditCard.jsm',
     'css-selector.js',
-    'DateTimePickerContent.jsm',
     'DateTimePickerParent.jsm',
     'DeferredTask.jsm',
     'Deprecated.jsm',
     'E10SUtils.jsm',
     'EventEmitter.jsm',
     'FileUtils.jsm',
     'FindBarContent.jsm',
     'Finder.jsm',