diff --git a/dom/html/HTMLInputElement.cpp b/dom/html/HTMLInputElement.cpp
index 9e544bd3b..f1aeef003 100644
--- a/dom/html/HTMLInputElement.cpp
+++ b/dom/html/HTMLInputElement.cpp
@@ -112,6 +112,7 @@
#include
#include "nsIColorPicker.h"
+#include "nsIDatePicker.h" // TenFourFox issue 405
#include "nsIStringEnumerator.h"
#include "HTMLSplitOnSpacesTokenizer.h"
#include "nsIController.h"
@@ -565,6 +566,22 @@ HTMLInputElement::IsPopupBlocked() const
return permission == nsIPopupWindowManager::DENY_POPUP;
}
+/* Time and date picker implementations from TenFourFox issue 405. */
+
+nsresult
+HTMLInputElement::InitTimePicker()
+{
+ NS_WARNING("InitTimePicker NYI");
+ return NS_ERROR_FAILURE;
+}
+
+nsresult
+HTMLInputElement::InitDatePicker()
+{
+ NS_WARNING("InitDatePicker NYI");
+ return NS_ERROR_FAILURE;
+}
+
nsresult
HTMLInputElement::InitColorPicker()
{
@@ -3608,6 +3625,12 @@ HTMLInputElement::MaybeInitPickers(EventChainPostVisitor& aVisitor)
if (mType == NS_FORM_INPUT_COLOR) {
return InitColorPicker();
}
+ if (mType == NS_FORM_INPUT_DATE) {
+ return InitDatePicker();
+ }
+ if (mType == NS_FORM_INPUT_TIME) {
+ return InitTimePicker();
+ }
return NS_OK;
}
@@ -3831,6 +3854,8 @@ HTMLInputElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
case NS_FORM_INPUT_SUBMIT:
case NS_FORM_INPUT_IMAGE: // Bug 34418
case NS_FORM_INPUT_COLOR:
+ case NS_FORM_INPUT_DATE: // TenFourFox issue 405
+ case NS_FORM_INPUT_TIME: // ditto
{
WidgetMouseEvent event(aVisitor.mEvent->mFlags.mIsTrusted,
eMouseClick, nullptr,
@@ -4732,6 +4757,10 @@ HTMLInputElement::ParseAttribute(int32_t aNamespaceID,
newType = aResult.GetEnumValue();
if ((IsExperimentalMobileType(newType) &&
!Preferences::GetBool("dom.experimental_forms", false)) ||
+ (newType == NS_FORM_INPUT_DATE &&
+ !Preferences::GetBool("tenfourfox.dom.forms.date", false)) ||
+ (newType == NS_FORM_INPUT_TIME &&
+ !Preferences::GetBool("tenfourfox.dom.forms.time", false)) ||
(newType == NS_FORM_INPUT_NUMBER &&
!Preferences::GetBool("dom.forms.number", false)) ||
(newType == NS_FORM_INPUT_COLOR &&
diff --git a/dom/html/HTMLInputElement.h b/dom/html/HTMLInputElement.h
index 6fdea0195..9a2a425ee 100644
--- a/dom/html/HTMLInputElement.h
+++ b/dom/html/HTMLInputElement.h
@@ -1256,6 +1256,10 @@ protected:
nsresult InitFilePicker(FilePickerType aType);
nsresult InitColorPicker();
+ // TenFourFox issue 405
+ nsresult InitDatePicker();
+ nsresult InitTimePicker();
+
/**
* Use this function before trying to open a picker.
* It checks if the page is allowed to open a new pop-up.
diff --git a/dom/ipc/DatePickerParent.cpp b/dom/ipc/DatePickerParent.cpp
new file mode 100644
index 000000000..99952cee3
--- /dev/null
+++ b/dom/ipc/DatePickerParent.cpp
@@ -0,0 +1,93 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* 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/. */
+
+#include "DatePickerParent.h"
+#include "nsComponentManagerUtils.h"
+#include "nsIDocument.h"
+#include "nsIDOMWindow.h"
+#include "mozilla/unused.h"
+#include "mozilla/dom/Element.h"
+#include "mozilla/dom/TabParent.h"
+
+using mozilla::Unused;
+using namespace mozilla::dom;
+
+NS_IMPL_ISUPPORTS(DatePickerParent::DatePickerShownCallback,
+ nsIDatePickerShownCallback);
+
+NS_IMETHODIMP
+DatePickerParent::DatePickerShownCallback::Update(const nsAString& aDate)
+{
+ if (mDatePickerParent) {
+ Unused << mDatePickerParent->SendUpdate(nsString(aDate));
+ }
+ return NS_OK;
+}
+
+NS_IMETHODIMP
+DatePickerParent::DatePickerShownCallback::Done(int16_t aResult)
+{
+ if (mDatePickerParent) {
+ mDatePickerParent->Done(aResult);
+ }
+ return NS_OK;
+}
+
+void
+DatePickerParent::DatePickerShownCallback::Destroy()
+{
+ mDatePickerParent = nullptr;
+}
+
+bool
+DatePickerParent::CreateDatePicker()
+{
+ mPicker = do_CreateInstance("@mozilla.org/datepicker;1");
+ if (!mPicker) {
+ return false;
+ }
+
+ Element* ownerElement = TabParent::GetFrom(Manager())->GetOwnerElement();
+ if (!ownerElement) {
+ return false;
+ }
+
+ nsCOMPtr window = do_QueryInterface(ownerElement->OwnerDoc()->GetWindow());
+ if (!window) {
+ return false;
+ }
+
+ return NS_SUCCEEDED(mPicker->Init(window, mTitle));
+}
+
+void
+DatePickerParent::Done(int16_t aResult)
+{
+ Unused << Send__delete__(this, nsString());
+ MOZ_CRASH("DatePickerParent::Done NYI");
+}
+
+bool
+DatePickerParent::RecvOpen()
+{
+ if (!CreateDatePicker()) {
+ Unused << Send__delete__(this, nsString());
+ return true;
+ }
+
+ mCallback = new DatePickerShownCallback(this);
+
+ mPicker->Open(mCallback);
+ return true;
+};
+
+void
+DatePickerParent::ActorDestroy(ActorDestroyReason aWhy)
+{
+ if (mCallback) {
+ mCallback->Destroy();
+ }
+}
diff --git a/dom/ipc/DatePickerParent.h b/dom/ipc/DatePickerParent.h
new file mode 100644
index 000000000..d88d4d931
--- /dev/null
+++ b/dom/ipc/DatePickerParent.h
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* 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/. */
+
+#ifndef mozilla_dom_DatePickerParent_h
+#define mozilla_dom_DatePickerParent_h
+
+#include "mozilla/dom/PDatePickerParent.h"
+#include "nsIDatePicker.h"
+
+namespace mozilla {
+namespace dom {
+
+class DatePickerParent : public PDatePickerParent
+{
+ public:
+ DatePickerParent(const nsString& aTitle)
+ : mTitle(aTitle)
+ {}
+
+ virtual bool RecvOpen() override;
+ virtual void ActorDestroy(ActorDestroyReason aWhy) override;
+
+ void Done(int16_t aResult);
+
+ class DatePickerShownCallback final
+ : public nsIDatePickerShownCallback
+ {
+ public:
+ explicit DatePickerShownCallback(DatePickerParent* aDatePickerParent)
+ : mDatePickerParent(aDatePickerParent)
+ {}
+
+ NS_DECL_ISUPPORTS
+ NS_DECL_NSIDATEPICKERSHOWNCALLBACK
+
+ NS_IMETHODIMP Update(const nsAString& aDate);
+
+ void Destroy();
+
+ private:
+ ~DatePickerShownCallback() {}
+
+ DatePickerParent* mDatePickerParent;
+ };
+
+ private:
+ virtual ~DatePickerParent() {}
+
+ bool CreateDatePicker();
+
+ RefPtr mCallback;
+ nsCOMPtr mPicker;
+
+ nsString mTitle;
+};
+
+} // namespace dom
+} // namespace mozilla
+
+#endif // mozilla_dom_DatePickerParent_h
diff --git a/dom/ipc/PBrowser.ipdl b/dom/ipc/PBrowser.ipdl
index 6ae6b925c..2d00c0a73 100644
--- a/dom/ipc/PBrowser.ipdl
+++ b/dom/ipc/PBrowser.ipdl
@@ -11,6 +11,7 @@ include protocol PContent;
include protocol PContentBridge;
include protocol PDocAccessible;
include protocol PDocumentRenderer;
+include protocol PDatePicker;
include protocol PFilePicker;
include protocol PIndexedDBPermissionRequest;
include protocol PRenderFrame;
@@ -104,6 +105,7 @@ prio(normal upto urgent) sync protocol PBrowser
manages PDocAccessible;
manages PDocumentRenderer;
manages PFilePicker;
+ manages PDatePicker;
manages PIndexedDBPermissionRequest;
manages PRenderFrame;
manages PPluginWidget;
@@ -377,6 +379,8 @@ parent:
PFilePicker(nsString aTitle, int16_t aMode);
+ PDatePicker(nsString aTitle);
+
/**
* Initiates an asynchronous request for one of the special indexedDB
* permissions for the provided principal.
diff --git a/dom/ipc/PDatePicker.ipdl b/dom/ipc/PDatePicker.ipdl
new file mode 100644
index 000000000..dfb07ec52
--- /dev/null
+++ b/dom/ipc/PDatePicker.ipdl
@@ -0,0 +1,27 @@
+/* -*- Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 8 -*- */
+/* vim: set sw=4 ts=8 et tw=80 ft=cpp : */
+
+/* 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/. */
+
+include protocol PBrowser;
+
+namespace mozilla {
+namespace dom {
+
+protocol PDatePicker
+{
+ manager PBrowser;
+
+parent:
+ Open();
+
+child:
+ Update(nsString date);
+
+ __delete__(nsString date);
+};
+
+} // namespace dom
+} // namespace mozilla
diff --git a/dom/ipc/TabChild.cpp b/dom/ipc/TabChild.cpp
index a44d2b1f7..587db4df2 100644
--- a/dom/ipc/TabChild.cpp
+++ b/dom/ipc/TabChild.cpp
@@ -53,6 +53,7 @@
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#endif
+#include "nsDatePickerProxy.h"
#include "nsFilePickerProxy.h"
#include "mozilla/dom/Element.h"
#include "nsIBaseWindow.h"
@@ -2136,6 +2137,21 @@ TabChild::DeallocPFilePickerChild(PFilePickerChild* actor)
return true;
}
+PDatePickerChild*
+TabChild::AllocPDatePickerChild(const nsString&)
+{
+ NS_RUNTIMEABORT("unused");
+ return nullptr;
+}
+
+bool
+TabChild::DeallocPDatePickerChild(PDatePickerChild* actor)
+{
+ nsDatePickerProxy* datePicker = static_cast(actor);
+ NS_RELEASE(datePicker);
+ return true;
+}
+
auto
TabChild::AllocPIndexedDBPermissionRequestChild(const Principal& aPrincipal)
-> PIndexedDBPermissionRequestChild*
diff --git a/dom/ipc/TabChild.h b/dom/ipc/TabChild.h
index b4ed838ea..7a01e901d 100644
--- a/dom/ipc/TabChild.h
+++ b/dom/ipc/TabChild.h
@@ -420,6 +420,11 @@ public:
virtual bool
DeallocPFilePickerChild(PFilePickerChild* actor) override;
+ virtual PDatePickerChild*
+ AllocPDatePickerChild(const nsString& aTitle) override;
+ virtual bool
+ DeallocPDatePickerChild(PDatePickerChild* actor) override;
+
virtual PIndexedDBPermissionRequestChild*
AllocPIndexedDBPermissionRequestChild(const Principal& aPrincipal)
override;
diff --git a/dom/ipc/TabParent.cpp b/dom/ipc/TabParent.cpp
index a239b848d..b855b0f81 100644
--- a/dom/ipc/TabParent.cpp
+++ b/dom/ipc/TabParent.cpp
@@ -78,6 +78,7 @@
#include "PermissionMessageUtils.h"
#include "StructuredCloneData.h"
#include "ColorPickerParent.h"
+#include "DatePickerParent.h"
#include "FilePickerParent.h"
#include "TabChild.h"
#include "LoadContext.h"
@@ -1214,6 +1215,19 @@ TabParent::DeallocPFilePickerParent(PFilePickerParent* actor)
return true;
}
+PDatePickerParent*
+TabParent::AllocPDatePickerParent(const nsString& aTitle)
+{
+ return new DatePickerParent(aTitle);
+}
+
+bool
+TabParent::DeallocPDatePickerParent(PDatePickerParent* actor)
+{
+ delete actor;
+ return true;
+}
+
auto
TabParent::AllocPIndexedDBPermissionRequestParent(const Principal& aPrincipal)
-> PIndexedDBPermissionRequestParent*
diff --git a/dom/ipc/TabParent.h b/dom/ipc/TabParent.h
index 923504b42..0e78c97bf 100644
--- a/dom/ipc/TabParent.h
+++ b/dom/ipc/TabParent.h
@@ -364,6 +364,10 @@ public:
const int16_t& aMode) override;
virtual bool DeallocPFilePickerParent(PFilePickerParent* actor) override;
+ virtual PDatePickerParent*
+ AllocPDatePickerParent(const nsString& aTitle) override;
+ virtual bool DeallocPDatePickerParent(PDatePickerParent* actor) override;
+
virtual PIndexedDBPermissionRequestParent*
AllocPIndexedDBPermissionRequestParent(const Principal& aPrincipal)
override;
diff --git a/dom/ipc/moz.build b/dom/ipc/moz.build
index a53ef761a..a091b2cf5 100644
--- a/dom/ipc/moz.build
+++ b/dom/ipc/moz.build
@@ -61,6 +61,7 @@ UNIFIED_SOURCES += [
'ContentProcess.cpp',
'ContentProcessManager.cpp',
'CrashReporterParent.cpp',
+ 'DatePickerParent.cpp',
'FilePickerParent.cpp',
'nsIContentChild.cpp',
'nsIContentParent.cpp',
@@ -102,6 +103,7 @@ IPDL_SOURCES += [
'PContentPermissionRequest.ipdl',
'PCrashReporter.ipdl',
'PCycleCollectWithLogs.ipdl',
+ 'PDatePicker.ipdl',
'PDocumentRenderer.ipdl',
'PFilePicker.ipdl',
'PMemoryReportRequest.ipdl',
diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js
index 1925bb54a..03dec0111 100644
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -5139,3 +5139,5 @@ pref("toolkit.pageThumbs.minHeight", 0);
pref("tenfourfox.adblock.enabled", false);
pref("tenfourfox.adblock.logging.enabled", false);
+pref("tenfourfox.dom.forms.date", false);
+pref("tenfourfox.dom.forms.time", false);
diff --git a/widget/cocoa/nsWidgetFactory.mm b/widget/cocoa/nsWidgetFactory.mm
index c5d369561..dbca7a54d 100644
--- a/widget/cocoa/nsWidgetFactory.mm
+++ b/widget/cocoa/nsWidgetFactory.mm
@@ -15,6 +15,7 @@
#include "nsCocoaWindow.h"
#include "nsAppShell.h"
#include "nsAppShellSingleton.h"
+#include "nsDatePicker.h"
#include "nsFilePicker.h"
#include "nsColorPicker.h"
@@ -44,6 +45,7 @@ using namespace mozilla::widget;
NS_GENERIC_FACTORY_CONSTRUCTOR(nsCocoaWindow)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsChildView)
+NS_GENERIC_FACTORY_CONSTRUCTOR(nsDatePicker)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsFilePicker)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsColorPicker)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsSound)
@@ -92,6 +94,7 @@ NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(GfxInfo, Init)
NS_DEFINE_NAMED_CID(NS_WINDOW_CID);
NS_DEFINE_NAMED_CID(NS_POPUP_CID);
NS_DEFINE_NAMED_CID(NS_CHILD_CID);
+NS_DEFINE_NAMED_CID(NS_DATEPICKER_CID);
NS_DEFINE_NAMED_CID(NS_FILEPICKER_CID);
NS_DEFINE_NAMED_CID(NS_COLORPICKER_CID);
NS_DEFINE_NAMED_CID(NS_APPSHELL_CID);
@@ -121,6 +124,8 @@ static const mozilla::Module::CIDEntry kWidgetCIDs[] = {
{ &kNS_WINDOW_CID, false, NULL, nsCocoaWindowConstructor },
{ &kNS_POPUP_CID, false, NULL, nsCocoaWindowConstructor },
{ &kNS_CHILD_CID, false, NULL, nsChildViewConstructor },
+ { &kNS_DATEPICKER_CID, false, NULL, nsDatePickerConstructor,
+ mozilla::Module::MAIN_PROCESS_ONLY },
{ &kNS_FILEPICKER_CID, false, NULL, nsFilePickerConstructor,
mozilla::Module::MAIN_PROCESS_ONLY },
{ &kNS_COLORPICKER_CID, false, NULL, nsColorPickerConstructor,
@@ -159,6 +164,8 @@ static const mozilla::Module::ContractIDEntry kWidgetContracts[] = {
{ "@mozilla.org/widgets/window/mac;1", &kNS_WINDOW_CID },
{ "@mozilla.org/widgets/popup/mac;1", &kNS_POPUP_CID },
{ "@mozilla.org/widgets/childwindow/mac;1", &kNS_CHILD_CID },
+ { "@mozilla.org/datepicker;1", &kNS_DATEPICKER_CID,
+ mozilla::Module::MAIN_PROCESS_ONLY },
{ "@mozilla.org/filepicker;1", &kNS_FILEPICKER_CID,
mozilla::Module::MAIN_PROCESS_ONLY },
{ "@mozilla.org/colorpicker;1", &kNS_COLORPICKER_CID,
diff --git a/widget/moz.build b/widget/moz.build
index b1abc8948..446be9204 100644
--- a/widget/moz.build
+++ b/widget/moz.build
@@ -198,9 +198,12 @@ if CONFIG['MOZ_X11']:
'GfxInfoX11.cpp'
]
+# Do not put nsDatePickerProxy.cpp into the unified sources, or we get weird
+# build problems due to an inexplicable dependency in nsPrimitiveHelpers.cpp.
if toolkit == 'cocoa':
SOURCES += [
'nsBaseDatePicker.cpp',
+ 'nsDatePickerProxy.cpp',
]
if toolkit in ('cocoa', 'windows'):
diff --git a/widget/nsContentProcessWidgetFactory.cpp b/widget/nsContentProcessWidgetFactory.cpp
index 5703b2607..e51c0ddbd 100644
--- a/widget/nsContentProcessWidgetFactory.cpp
+++ b/widget/nsContentProcessWidgetFactory.cpp
@@ -9,6 +9,7 @@
#include "nsWidgetsCID.h"
#include "nsClipboardProxy.h"
#include "nsColorPickerProxy.h"
+#include "nsDatePickerProxy.h"
#include "nsDragServiceProxy.h"
#include "nsFilePickerProxy.h"
#include "nsScreenManagerProxy.h"
@@ -21,6 +22,7 @@ using namespace mozilla::widget;
NS_GENERIC_FACTORY_CONSTRUCTOR(nsClipboardProxy)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsColorPickerProxy)
+NS_GENERIC_FACTORY_CONSTRUCTOR(nsDatePickerProxy)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDragServiceProxy)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsFilePickerProxy)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsScreenManagerProxy)
@@ -28,6 +30,7 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(PuppetBidiKeyboard)
NS_DEFINE_NAMED_CID(NS_CLIPBOARD_CID);
NS_DEFINE_NAMED_CID(NS_COLORPICKER_CID);
+NS_DEFINE_NAMED_CID(NS_DATEPICKER_CID);
NS_DEFINE_NAMED_CID(NS_DRAGSERVICE_CID);
NS_DEFINE_NAMED_CID(NS_FILEPICKER_CID);
NS_DEFINE_NAMED_CID(PUPPETBIDIKEYBOARD_CID);
@@ -36,6 +39,8 @@ NS_DEFINE_NAMED_CID(NS_SCREENMANAGER_CID);
static const mozilla::Module::CIDEntry kWidgetCIDs[] = {
{ &kNS_CLIPBOARD_CID, false, nullptr, nsClipboardProxyConstructor,
Module::CONTENT_PROCESS_ONLY },
+ { &kNS_DATEPICKER_CID, false, nullptr, nsDatePickerProxyConstructor,
+ Module::CONTENT_PROCESS_ONLY },
{ &kNS_COLORPICKER_CID, false, nullptr, nsColorPickerProxyConstructor,
Module::CONTENT_PROCESS_ONLY },
{ &kNS_DRAGSERVICE_CID, false, nullptr, nsDragServiceProxyConstructor,
@@ -52,6 +57,7 @@ static const mozilla::Module::CIDEntry kWidgetCIDs[] = {
static const mozilla::Module::ContractIDEntry kWidgetContracts[] = {
{ "@mozilla.org/widget/clipboard;1", &kNS_CLIPBOARD_CID, Module::CONTENT_PROCESS_ONLY },
{ "@mozilla.org/colorpicker;1", &kNS_COLORPICKER_CID, Module::CONTENT_PROCESS_ONLY },
+ { "@mozilla.org/datepicker;1", &kNS_DATEPICKER_CID, Module::CONTENT_PROCESS_ONLY },
{ "@mozilla.org/filepicker;1", &kNS_FILEPICKER_CID, Module::CONTENT_PROCESS_ONLY },
{ "@mozilla.org/gfx/screenmanager;1", &kNS_SCREENMANAGER_CID, Module::CONTENT_PROCESS_ONLY },
{ "@mozilla.org/widget/dragservice;1", &kNS_DRAGSERVICE_CID, Module::CONTENT_PROCESS_ONLY },
diff --git a/widget/nsDatePickerProxy.cpp b/widget/nsDatePickerProxy.cpp
new file mode 100644
index 000000000..72432218c
--- /dev/null
+++ b/widget/nsDatePickerProxy.cpp
@@ -0,0 +1,87 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+ *
+ * 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/. */
+
+#include "nsDatePickerProxy.h"
+#include "nsComponentManagerUtils.h"
+#include "mozilla/dom/TabChild.h"
+
+using namespace mozilla::dom;
+
+NS_IMPL_ISUPPORTS(nsDatePickerProxy, nsIDatePicker)
+
+nsDatePickerProxy::nsDatePickerProxy()
+{
+}
+
+nsDatePickerProxy::~nsDatePickerProxy()
+{
+}
+
+NS_IMETHODIMP
+nsDatePickerProxy::Init(nsIDOMWindow* aParent, const nsAString& aTitle)
+{
+ TabChild* tabChild = TabChild::GetFrom(aParent);
+ if (!tabChild) {
+ return NS_ERROR_FAILURE;
+ }
+
+ MOZ_CRASH("Date picker not implemented for e10s");
+
+ mParent = do_QueryInterface(aParent);
+ if (!mParent->IsInnerWindow()) {
+ mParent = mParent->GetCurrentInnerWindow();
+ }
+
+ NS_ADDREF_THIS();
+ tabChild->SendPDatePickerConstructor(nsString(aTitle));
+ return NS_OK;
+}
+
+void
+nsDatePickerProxy::InitNative(nsIWidget* aParent, const nsAString& aTitle)
+{
+}
+
+NS_IMETHODIMP
+nsDatePickerProxy::Open(nsIDatePickerShownCallback* aCallback)
+{
+ mCallback = aCallback;
+
+ return NS_ERROR_FAILURE;
+}
+
+NS_IMETHODIMP
+nsDatePickerProxy::Show(int16_t* aReturn)
+{
+ MOZ_ASSERT(false, "Show is unimplemented; use Open");
+ return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP nsDatePickerProxy::GetDefaultDate(nsAString &aDefaultDate) {return NS_ERROR_NOT_IMPLEMENTED;}
+NS_IMETHODIMP nsDatePickerProxy::SetDefaultDate(const nsAString &aDefaultDate) {return NS_ERROR_NOT_IMPLEMENTED;}
+NS_IMETHODIMP nsDatePickerProxy::GetMinDate(nsAString &aMinDate) {return NS_ERROR_NOT_IMPLEMENTED;}
+NS_IMETHODIMP nsDatePickerProxy::SetMinDate(const nsAString &aMinDate) {return NS_ERROR_NOT_IMPLEMENTED;}
+NS_IMETHODIMP nsDatePickerProxy::GetMaxDate(nsAString &aMaxDate) {return NS_ERROR_NOT_IMPLEMENTED;};
+NS_IMETHODIMP nsDatePickerProxy::SetMaxDate(const nsAString &aMaxDate) {return NS_ERROR_NOT_IMPLEMENTED;}
+NS_IMETHODIMP nsDatePickerProxy::GetSelectedDate(nsAString &aSelectedDate) {return NS_ERROR_NOT_IMPLEMENTED;}
+
+bool
+nsDatePickerProxy::Recv__delete__(const nsString& date, const int16_t& aResult)
+{
+ if (mCallback) {
+ mCallback->Done(aResult);
+ mCallback = nullptr;
+ }
+
+ return true;
+}
+
+bool
+nsDatePickerProxy::RecvUpdate(const nsString& date)
+{
+ MOZ_CRASH("unimplemented");
+ return false;
+}
diff --git a/widget/nsDatePickerProxy.h b/widget/nsDatePickerProxy.h
new file mode 100644
index 000000000..9353b08aa
--- /dev/null
+++ b/widget/nsDatePickerProxy.h
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * 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/. */
+#ifndef NSDATEPICKERPROXY_H
+#define NSDATEPICKERPROXY_H
+
+#include "nsBaseDatePicker.h"
+#include "nsString.h"
+#include "nsIURI.h"
+#include "nsTArray.h"
+#include "nsCOMArray.h"
+
+#include "mozilla/dom/PDatePickerChild.h"
+
+class nsIWidget;
+class nsIFile;
+class nsPIDOMWindow;
+
+namespace mozilla {
+namespace dom {
+class File;
+} // namespace dom
+} // namespace mozilla
+
+/*
+
+ This class creates a proxy date picker to be used in content processes.
+ The date picker just collects the initialization data and when Show() is
+ called, remotes everything to the chrome process which in turn can show a
+ platform specific date picker.
+
+ I'm not sure why I'm implementing this for TenFourFox given that we'll never
+ run in e10s, but anyway.
+
+*/
+class nsDatePickerProxy : public nsBaseDatePicker,
+ public mozilla::dom::PDatePickerChild
+{
+public:
+ nsDatePickerProxy();
+
+ NS_DECL_ISUPPORTS
+
+ // nsIDatePicker
+ NS_IMETHODIMP Init(nsIDOMWindow* aParent, const nsAString& aTitle) override;
+ NS_IMETHODIMP Open(nsIDatePickerShownCallback* aCallback) override;
+ NS_IMETHODIMP Show(int16_t *_retval) override;
+ NS_IMETHODIMP GetDefaultDate(nsAString &aDefaultDate) override;
+ NS_IMETHODIMP SetDefaultDate(const nsAString &aDefaultDate) override;
+ NS_IMETHODIMP GetMinDate(nsAString &aMinDate) override;
+ NS_IMETHODIMP SetMinDate(const nsAString &aMinDate) override;
+ NS_IMETHODIMP GetMaxDate(nsAString &aMaxDate) override;
+ NS_IMETHODIMP SetMaxDate(const nsAString &aMaxDate) override;
+ NS_IMETHODIMP GetSelectedDate(nsAString &aSelectedDate);
+
+ // PDatePickerChild
+ virtual bool Recv__delete__(const nsString& date, const int16_t& aResult);
+ virtual bool RecvUpdate(const nsString& date);
+
+private:
+ ~nsDatePickerProxy();
+ void InitNative(nsIWidget*, const nsAString&) override;
+
+ nsCOMPtr mCallback;
+};
+
+#endif // NSDATEPICKERPROXY_H
diff --git a/widget/nsWidgetsCID.h b/widget/nsWidgetsCID.h
index a428cdee2..cd0cd0b3f 100644
--- a/widget/nsWidgetsCID.h
+++ b/widget/nsWidgetsCID.h
@@ -24,6 +24,11 @@
{ 0xbd57cee8, 0x1dd1, 0x11b2, \
{0x9f, 0xe7, 0x95, 0xcf, 0x47, 0x09, 0xae, 0xa3} }
+/* bd57cee8-1dd1-11b2-9fe7-95cf4709aea4 */
+#define NS_DATEPICKER_CID \
+{ 0xbd57cee8, 0x1dd1, 0x11b2, \
+ {0x9f, 0xe7, 0x95, 0xcf, 0x47, 0x09, 0xae, 0xa4} }
+
/* e221df9b-3d66-4045-9a66-5720949f8d10 */
#define NS_APPLICATIONCHOOSER_CID \
{ 0xe221df9b, 0x3d66, 0x4045, \