Bug 1472491: Part 5α - Add DateTimePickerChild actor. r=mconley
MozReview-Commit-ID: EWTCdNCmE9S
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',