Bug 878533 - 1/3: move MozSmsFilter to webidl dictionary. r=smaug
authorVicamo Yang <vyang@mozilla.com>
Thu, 28 Aug 2014 11:00:03 +0800
changeset 223684 74bfb70bcefd7762c1c1dd459fb698623edf9f5a
parent 223683 64cc562fe7aac8106e08aeecaeeaa857b6a9cfab
child 223685 843e68ec798dfbacde6455ea5d06399c29b39045
push id3979
push userraliiev@mozilla.com
push dateMon, 13 Oct 2014 16:35:44 +0000
treeherdermozilla-beta@30f2cc610691 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs878533
milestone34.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 878533 - 1/3: move MozSmsFilter to webidl dictionary. r=smaug
dom/base/nsDOMClassInfo.cpp
dom/base/nsDOMClassInfoClasses.h
dom/bindings/Bindings.conf
dom/mobilemessage/interfaces/moz.build
dom/mobilemessage/interfaces/nsIDOMSmsFilter.idl
dom/mobilemessage/interfaces/nsIMobileMessageDatabaseService.idl
dom/mobilemessage/src/MobileMessageManager.cpp
dom/mobilemessage/src/MobileMessageManager.h
dom/mobilemessage/src/SmsFilter.cpp
dom/mobilemessage/src/SmsFilter.h
dom/mobilemessage/src/Types.h
dom/mobilemessage/src/android/MobileMessageDatabaseService.cpp
dom/mobilemessage/src/gonk/MobileMessageDB.jsm
dom/mobilemessage/src/gonk/MobileMessageDatabaseService.js
dom/mobilemessage/src/ipc/SmsIPCService.cpp
dom/mobilemessage/src/ipc/SmsParent.cpp
dom/mobilemessage/src/ipc/SmsTypes.ipdlh
dom/mobilemessage/src/moz.build
dom/webidl/MozMobileMessageManager.webidl
--- a/dom/base/nsDOMClassInfo.cpp
+++ b/dom/base/nsDOMClassInfo.cpp
@@ -1,17 +1,15 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=2 sw=2 et tw=78: */
 /* 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 "mozilla/ArrayUtils.h"
-// On top because they include basictypes.h:
-#include "mozilla/dom/SmsFilter.h"
 
 #ifdef XP_WIN
 #undef GetClassName
 #endif
 
 // JavaScript includes
 #include "jsapi.h"
 #include "jsfriendapi.h"
@@ -120,17 +118,16 @@
 
 #include "mozilla/dom/TouchEvent.h"
 
 #include "nsWrapperCacheInlines.h"
 #include "mozilla/dom/HTMLCollectionBinding.h"
 
 #include "nsIDOMMozSmsMessage.h"
 #include "nsIDOMMozMmsMessage.h"
-#include "nsIDOMSmsFilter.h"
 #include "nsIDOMMozMobileMessageThread.h"
 
 #ifdef MOZ_B2G_FM
 #include "FMRadio.h"
 #endif
 
 #include "nsIDOMGlobalObjectConstructor.h"
 #include "nsDebug.h"
@@ -343,19 +340,16 @@ static nsDOMClassInfoData sClassInfoData
                            WINDOW_SCRIPTABLE_FLAGS)
 
   NS_DEFINE_CLASSINFO_DATA(MozSmsMessage, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
 
   NS_DEFINE_CLASSINFO_DATA(MozMmsMessage, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
 
-  NS_DEFINE_CLASSINFO_DATA(MozSmsFilter, nsDOMGenericSH,
-                           DOM_DEFAULT_SCRIPTABLE_FLAGS)
-
   NS_DEFINE_CLASSINFO_DATA(MozMobileMessageThread, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
 
   NS_DEFINE_CLASSINFO_DATA(CSSFontFaceRule, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
 
   NS_DEFINE_CHROME_ONLY_CLASSINFO_DATA(ContentFrameMessageManager, nsEventTargetSH,
                                        DOM_DEFAULT_SCRIPTABLE_FLAGS |
@@ -417,17 +411,16 @@ struct nsConstructorFuncMapData
 
 #define NS_DEFINE_CONSTRUCTOR_FUNC_DATA(_class, _func)                        \
   { eDOMClassInfo_##_class##_id, _func },
 
 static const nsConstructorFuncMapData kConstructorFuncMap[] =
 {
   NS_DEFINE_CONSTRUCTOR_FUNC_DATA(Blob, DOMMultipartFileImpl::NewBlob)
   NS_DEFINE_CONSTRUCTOR_FUNC_DATA(File, DOMMultipartFileImpl::NewFile)
-  NS_DEFINE_CONSTRUCTOR_FUNC_DATA(MozSmsFilter, SmsFilter::NewSmsFilter)
   NS_DEFINE_CONSTRUCTOR_FUNC_DATA(XSLTProcessor, XSLTProcessorCtor)
 };
 #undef NS_DEFINE_CONSTRUCTOR_FUNC_DATA
 
 nsIXPConnect *nsDOMClassInfo::sXPConnect = nullptr;
 bool nsDOMClassInfo::sIsInitialized = false;
 
 
@@ -908,20 +901,16 @@ nsDOMClassInfo::Init()
   DOM_CLASSINFO_MAP_BEGIN(MozSmsMessage, nsIDOMMozSmsMessage)
      DOM_CLASSINFO_MAP_ENTRY(nsIDOMMozSmsMessage)
   DOM_CLASSINFO_MAP_END
 
   DOM_CLASSINFO_MAP_BEGIN(MozMmsMessage, nsIDOMMozMmsMessage)
      DOM_CLASSINFO_MAP_ENTRY(nsIDOMMozMmsMessage)
   DOM_CLASSINFO_MAP_END
 
-  DOM_CLASSINFO_MAP_BEGIN(MozSmsFilter, nsIDOMMozSmsFilter)
-     DOM_CLASSINFO_MAP_ENTRY(nsIDOMMozSmsFilter)
-  DOM_CLASSINFO_MAP_END
-
   DOM_CLASSINFO_MAP_BEGIN(MozMobileMessageThread, nsIDOMMozMobileMessageThread)
      DOM_CLASSINFO_MAP_ENTRY(nsIDOMMozMobileMessageThread)
   DOM_CLASSINFO_MAP_END
 
   DOM_CLASSINFO_MAP_BEGIN(CSSFontFaceRule, nsIDOMCSSFontFaceRule)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMCSSFontFaceRule)
   DOM_CLASSINFO_MAP_END
 
--- a/dom/base/nsDOMClassInfoClasses.h
+++ b/dom/base/nsDOMClassInfoClasses.h
@@ -50,17 +50,16 @@ DOMCI_CLASS(XPathNSResolver)
 DOMCI_CLASS(Blob)
 DOMCI_CLASS(File)
 
 // DOM modal content window class, almost identical to Window
 DOMCI_CLASS(ModalContentWindow)
 
 DOMCI_CLASS(MozSmsMessage)
 DOMCI_CLASS(MozMmsMessage)
-DOMCI_CLASS(MozSmsFilter)
 DOMCI_CLASS(MozMobileMessageThread)
 
 // @font-face in CSS
 DOMCI_CLASS(CSSFontFaceRule)
 
 DOMCI_CLASS(ContentFrameMessageManager)
 DOMCI_CLASS(ChromeMessageBroadcaster)
 DOMCI_CLASS(ChromeMessageSender)
--- a/dom/bindings/Bindings.conf
+++ b/dom/bindings/Bindings.conf
@@ -1985,17 +1985,16 @@ addExternalIface('MozFrameLoader', nativ
 addExternalIface('MozFrameRequestCallback', nativeType='nsIFrameRequestCallback',
                  notflattened=True)
 addExternalIface('MozIccInfo', headerFile='nsIDOMIccInfo.h')
 addExternalIface('MozMmsMessage')
 addExternalIface('MozObserver', nativeType='nsIObserver', notflattened=True)
 addExternalIface('MozRDFCompositeDataSource', nativeType='nsIRDFCompositeDataSource',
                  notflattened=True)
 addExternalIface('MozRDFResource', nativeType='nsIRDFResource', notflattened=True)
-addExternalIface('MozSmsFilter', headerFile='nsIDOMSmsFilter.h')
 addExternalIface('MozSmsMessage')
 addExternalIface('MozTreeBoxObject', nativeType='nsITreeBoxObject',
                  notflattened=True)
 addExternalIface('MozTreeColumn', nativeType='nsITreeColumn',
                  headerFile='nsITreeColumns.h')
 addExternalIface('MozWakeLockListener', headerFile='nsIDOMWakeLockListener.h')
 addExternalIface('MozXULTemplateBuilder', nativeType='nsIXULTemplateBuilder')
 addExternalIface('nsIBrowserDOMWindow', nativeType='nsIBrowserDOMWindow',
--- a/dom/mobilemessage/interfaces/moz.build
+++ b/dom/mobilemessage/interfaces/moz.build
@@ -4,17 +4,16 @@
 # 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/.
 
 XPIDL_SOURCES += [
     'nsIDeletedMessageInfo.idl',
     'nsIDOMMozMmsMessage.idl',
     'nsIDOMMozMobileMessageThread.idl',
     'nsIDOMMozSmsMessage.idl',
-    'nsIDOMSmsFilter.idl',
     'nsIMmsService.idl',
     'nsIMobileMessageCallback.idl',
     'nsIMobileMessageCursorCallback.idl',
     'nsIMobileMessageDatabaseService.idl',
     'nsIMobileMessageService.idl',
     'nsISmsService.idl',
     'nsIWapPushApplication.idl',
 ]
deleted file mode 100644
--- a/dom/mobilemessage/interfaces/nsIDOMSmsFilter.idl
+++ /dev/null
@@ -1,33 +0,0 @@
-/* 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 "nsISupports.idl"
-
-[scriptable, builtinclass, uuid(17890b60-0367-45c6-9729-62e5bf349b2b)]
-interface nsIDOMMozSmsFilter : nsISupports
-{
-  // A date that can return null.
-  [implicit_jscontext]
-  attribute jsval startDate;
-
-  // A date that can return null.
-  [implicit_jscontext]
-  attribute jsval endDate;
-
-  // An array of DOMString that can return null.
-  [implicit_jscontext]
-  attribute jsval numbers;
-
-  // A DOMString that can return and be set to "sent", "received" or null.
-  [Null(Empty)]
-  attribute DOMString delivery;
-
-  // A read flag that can return and be set to a boolean or null.
-  [implicit_jscontext]
-  attribute jsval read;
-
-  // A thread id that can return and be set to a numeric value or null.
-  [implicit_jscontext]
-  attribute jsval threadId;
-};
--- a/dom/mobilemessage/interfaces/nsIMobileMessageDatabaseService.idl
+++ b/dom/mobilemessage/interfaces/nsIMobileMessageDatabaseService.idl
@@ -7,32 +7,40 @@
 %{C++
 #define MOBILE_MESSAGE_DATABASE_SERVICE_CID \
 { 0x0d84b9c2, 0x8f76, 0x4ba4,    \
 { 0xa5, 0xcd, 0xdb, 0xfb, 0x01, 0xdf, 0xda, 0x99 } }
 #define MOBILE_MESSAGE_DATABASE_SERVICE_CONTRACTID "@mozilla.org/mobilemessage/mobilemessagedatabaseservice;1"
 %}
 
 interface nsICursorContinueCallback;
-interface nsIDOMMozSmsFilter;
 interface nsIMobileMessageCallback;
 interface nsIMobileMessageCursorCallback;
 
-[scriptable, uuid(8439916f-abc1-4c67-aa45-8a276a0a7855)]
+[scriptable, uuid(ead626bc-f5b4-47e1-921c-0b956c9298e0)]
 interface nsIMobileMessageDatabaseService : nsISupports
 {
   [binaryname(GetMessageMoz)]
   void getMessage(in long messageId,
                   in nsIMobileMessageCallback request);
 
   void deleteMessage([array, size_is(count)] in long messageIds,
                      in uint32_t count,
                      in nsIMobileMessageCallback request);
 
-  nsICursorContinueCallback createMessageCursor(in nsIDOMMozSmsFilter filter,
+  nsICursorContinueCallback createMessageCursor(in boolean hasStartDate,
+                                                in unsigned long long startDate,
+                                                in boolean hasEndDate,
+                                                in unsigned long long endDate,
+                                                [array, size_is(numbersCount)] in wstring numbers,
+                                                in uint32_t numbersCount,
+                                                [Null(Null), Undefined(Null)] in DOMString delivery,
+                                                in boolean hasRead,
+                                                in boolean read,
+                                                in unsigned long long threadId,
                                                 in boolean reverse,
                                                 in nsIMobileMessageCursorCallback callback);
 
   void markMessageRead(in long messageId,
                        in boolean value,
                        in boolean sendReadReport,
                        in nsIMobileMessageCallback request);
 
--- a/dom/mobilemessage/src/MobileMessageManager.cpp
+++ b/dom/mobilemessage/src/MobileMessageManager.cpp
@@ -21,17 +21,16 @@
 #include "nsIDOMMozMmsMessage.h"
 #include "nsIDOMMozSmsMessage.h"
 #include "nsIMmsService.h"
 #include "nsIMobileMessageCallback.h"
 #include "nsIMobileMessageDatabaseService.h"
 #include "nsIObserverService.h"
 #include "nsISmsService.h"
 #include "nsServiceManagerUtils.h" // For do_GetService()
-#include "SmsFilter.h"
 
 #define RECEIVED_EVENT_NAME         NS_LITERAL_STRING("received")
 #define RETRIEVING_EVENT_NAME       NS_LITERAL_STRING("retrieving")
 #define SENDING_EVENT_NAME          NS_LITERAL_STRING("sending")
 #define SENT_EVENT_NAME             NS_LITERAL_STRING("sent")
 #define FAILED_EVENT_NAME           NS_LITERAL_STRING("failed")
 #define DELIVERY_SUCCESS_EVENT_NAME NS_LITERAL_STRING("deliverysuccess")
 #define DELIVERY_ERROR_EVENT_NAME   NS_LITERAL_STRING("deliveryerror")
@@ -362,37 +361,83 @@ MobileMessageManager::Delete(const Seque
       MOZ_ASSERT(NS_SUCCEEDED(rv));
     }
   }
 
   return Delete(idArray.Elements(), size, aRv);
 }
 
 already_AddRefed<DOMCursor>
-MobileMessageManager::GetMessages(nsIDOMMozSmsFilter* aFilter,
+MobileMessageManager::GetMessages(const MobileMessageFilter& aFilter,
                                   bool aReverse,
                                   ErrorResult& aRv)
 {
   nsCOMPtr<nsIMobileMessageDatabaseService> dbService =
     do_GetService(MOBILE_MESSAGE_DATABASE_SERVICE_CONTRACTID);
   if (!dbService) {
     aRv.Throw(NS_ERROR_FAILURE);
     return nullptr;
   }
 
-  nsCOMPtr<nsIDOMMozSmsFilter> filter = aFilter;
-  if (!filter) {
-    filter = new SmsFilter();
+  bool hasStartDate = !aFilter.mStartDate.IsNull();
+  uint64_t startDate = 0;
+  if (hasStartDate) {
+    startDate = aFilter.mStartDate.Value();
+  }
+
+  bool hasEndDate = !aFilter.mEndDate.IsNull();
+  uint64_t endDate = 0;
+  if (hasEndDate) {
+    endDate = aFilter.mEndDate.Value();
+  }
+
+  nsAutoArrayPtr<const char16_t*> ptrNumbers;
+  uint32_t numbersCount = 0;
+  if (!aFilter.mNumbers.IsNull() &&
+      aFilter.mNumbers.Value().Length()) {
+    const FallibleTArray<nsString>& numbers = aFilter.mNumbers.Value();
+    uint32_t index;
+
+    numbersCount = numbers.Length();
+    ptrNumbers = new const char16_t* [numbersCount];
+    for (index = 0; index < numbersCount; index++) {
+      ptrNumbers[index] = numbers[index].get();
+    }
+  }
+
+  nsString delivery;
+  delivery.SetIsVoid(true);
+  if (!aFilter.mDelivery.IsNull()) {
+    const uint32_t index = static_cast<uint32_t>(aFilter.mDelivery.Value());
+    const EnumEntry& entry =
+      MobileMessageFilterDeliveryValues::strings[index];
+    delivery.AssignASCII(entry.value, entry.length);
+  }
+
+  bool hasRead = !aFilter.mRead.IsNull();
+  bool read = false;
+  if (hasRead) {
+    read = aFilter.mRead.Value();
+  }
+
+  uint64_t threadId = 0;
+  if (!aFilter.mThreadId.IsNull()) {
+    threadId = aFilter.mThreadId.Value();
   }
 
   nsRefPtr<MobileMessageCursorCallback> cursorCallback =
     new MobileMessageCursorCallback();
-
   nsCOMPtr<nsICursorContinueCallback> continueCallback;
-  nsresult rv = dbService->CreateMessageCursor(filter, aReverse, cursorCallback,
+  nsresult rv = dbService->CreateMessageCursor(hasStartDate, startDate,
+                                               hasEndDate, endDate,
+                                               ptrNumbers, numbersCount,
+                                               delivery,
+                                               hasRead, read,
+                                               threadId,
+                                               aReverse, cursorCallback,
                                                getter_AddRefs(continueCallback));
   if (NS_FAILED(rv)) {
     aRv.Throw(rv);
     return nullptr;
   }
 
   cursorCallback->mDOMCursor = new DOMCursor(GetOwner(), continueCallback);
 
--- a/dom/mobilemessage/src/MobileMessageManager.h
+++ b/dom/mobilemessage/src/MobileMessageManager.h
@@ -9,25 +9,25 @@
 #include "mozilla/Attributes.h"
 #include "mozilla/dom/UnionTypes.h"
 #include "mozilla/DOMEventTargetHelper.h"
 #include "nsIObserver.h"
 
 class nsISmsService;
 class nsIDOMMozSmsMessage;
 class nsIDOMMozMmsMessage;
-class nsIDOMMozSmsFilter;
 
 namespace mozilla {
 namespace dom {
 
 class DOMRequest;
 class DOMCursor;
 struct MmsParameters;
 struct MmsSendParameters;
+struct MobileMessageFilter;
 struct SmsSendParameters;
 
 class MobileMessageManager MOZ_FINAL : public DOMEventTargetHelper
                                      , public nsIObserver
 {
 public:
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_NSIOBSERVER
@@ -85,17 +85,17 @@ public:
   Delete(nsIDOMMozMmsMessage* aMessage,
          ErrorResult& aRv);
 
   already_AddRefed<DOMRequest>
   Delete(const Sequence<OwningLongOrMozSmsMessageOrMozMmsMessage>& aParams,
          ErrorResult& aRv);
 
   already_AddRefed<DOMCursor>
-  GetMessages(nsIDOMMozSmsFilter* aFilter,
+  GetMessages(const MobileMessageFilter& aFilter,
               bool aReverse,
               ErrorResult& aRv);
 
   already_AddRefed<DOMRequest>
   MarkMessageRead(int32_t aId,
                   bool aRead,
                   bool aSendReadReport,
                   ErrorResult& aRv);
deleted file mode 100644
--- a/dom/mobilemessage/src/SmsFilter.cpp
+++ /dev/null
@@ -1,292 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; 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 "SmsFilter.h"
-#include "jsapi.h"
-#include "jsfriendapi.h" // For js_DateGetMsecSinceEpoch.
-#include "js/Utility.h"
-#include "mozilla/dom/mobilemessage/Constants.h" // For MessageType
-#include "mozilla/dom/ToJSValue.h"
-#include "nsDOMString.h"
-#include "nsError.h"
-#include "nsIDOMClassInfo.h"
-#include "nsJSUtils.h"
-
-using namespace mozilla::dom::mobilemessage;
-
-DOMCI_DATA(MozSmsFilter, mozilla::dom::SmsFilter)
-
-namespace mozilla {
-namespace dom {
-
-NS_INTERFACE_MAP_BEGIN(SmsFilter)
-  NS_INTERFACE_MAP_ENTRY(nsIDOMMozSmsFilter)
-  NS_INTERFACE_MAP_ENTRY(nsISupports)
-  NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(MozSmsFilter)
-NS_INTERFACE_MAP_END
-
-NS_IMPL_ADDREF(SmsFilter)
-NS_IMPL_RELEASE(SmsFilter)
-
-SmsFilter::SmsFilter()
-{
-  mData.startDate() = 0;
-  mData.endDate() = 0;
-  mData.delivery() = eDeliveryState_Unknown;
-  mData.read() = eReadState_Unknown;
-  mData.threadId() = 0;
-}
-
-SmsFilter::SmsFilter(const SmsFilterData& aData)
-  : mData(aData)
-{
-}
-
-/* static */ nsresult
-SmsFilter::NewSmsFilter(nsISupports** aSmsFilter)
-{
-  NS_ADDREF(*aSmsFilter = new SmsFilter());
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-SmsFilter::GetStartDate(JSContext* aCx, JS::MutableHandle<JS::Value> aStartDate)
-{
-  if (mData.startDate() == 0) {
-    aStartDate.setNull();
-    return NS_OK;
-  }
-
-  aStartDate.setObjectOrNull(JS_NewDateObjectMsec(aCx, mData.startDate()));
-  NS_ENSURE_TRUE(aStartDate.isObject(), NS_ERROR_FAILURE);
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-SmsFilter::SetStartDate(JSContext* aCx, JS::Handle<JS::Value> aStartDate)
-{
-  if (aStartDate.isNull()) {
-    mData.startDate() = 0;
-    return NS_OK;
-  }
-
-  if (!aStartDate.isObject()) {
-    return NS_ERROR_INVALID_ARG;
-  }
-
-  JS::Rooted<JSObject*> obj(aCx, &aStartDate.toObject());
-  if (!JS_ObjectIsDate(aCx, obj)) {
-    return NS_ERROR_INVALID_ARG;
-  }
-
-  mData.startDate() = js_DateGetMsecSinceEpoch(obj);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-SmsFilter::GetEndDate(JSContext* aCx, JS::MutableHandle<JS::Value> aEndDate)
-{
-  if (mData.endDate() == 0) {
-    aEndDate.setNull();
-    return NS_OK;
-  }
-
-  aEndDate.setObjectOrNull(JS_NewDateObjectMsec(aCx, mData.endDate()));
-  NS_ENSURE_TRUE(aEndDate.isObject(), NS_ERROR_FAILURE);
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-SmsFilter::SetEndDate(JSContext* aCx, JS::Handle<JS::Value> aEndDate)
-{
-  if (aEndDate.isNull()) {
-    mData.endDate() = 0;
-    return NS_OK;
-  }
-
-  if (!aEndDate.isObject()) {
-    return NS_ERROR_INVALID_ARG;
-  }
-
-  JS::Rooted<JSObject*> obj(aCx, &aEndDate.toObject());
-  if (!JS_ObjectIsDate(aCx, obj)) {
-    return NS_ERROR_INVALID_ARG;
-  }
-
-  mData.endDate() = js_DateGetMsecSinceEpoch(obj);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-SmsFilter::GetNumbers(JSContext* aCx, JS::MutableHandle<JS::Value> aNumbers)
-{
-  uint32_t length = mData.numbers().Length();
-
-  if (length == 0) {
-    aNumbers.setNull();
-    return NS_OK;
-  }
-
-  if (!ToJSValue(aCx, mData.numbers(), aNumbers)) {
-    return NS_ERROR_FAILURE;
-  }
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-SmsFilter::SetNumbers(JSContext* aCx, JS::Handle<JS::Value> aNumbers)
-{
-  if (aNumbers.isNull()) {
-    mData.numbers().Clear();
-    return NS_OK;
-  }
-
-  if (!aNumbers.isObject()) {
-    return NS_ERROR_INVALID_ARG;
-  }
-
-  JS::Rooted<JSObject*> obj(aCx, &aNumbers.toObject());
-  if (!JS_IsArrayObject(aCx, obj)) {
-    return NS_ERROR_INVALID_ARG;
-  }
-
-  uint32_t size;
-  MOZ_ALWAYS_TRUE(JS_GetArrayLength(aCx, obj, &size));
-
-  nsTArray<nsString> numbers;
-
-  for (uint32_t i=0; i<size; ++i) {
-    JS::Rooted<JS::Value> jsNumber(aCx);
-    if (!JS_GetElement(aCx, obj, i, &jsNumber)) {
-      return NS_ERROR_INVALID_ARG;
-    }
-
-    if (!jsNumber.isString()) {
-      return NS_ERROR_INVALID_ARG;
-    }
-
-    nsAutoJSString number;
-    if (!number.init(aCx, jsNumber.toString())) {
-      return NS_ERROR_FAILURE;
-    }
-
-    numbers.AppendElement(number);
-  }
-
-  mData.numbers().Clear();
-  mData.numbers().AppendElements(numbers);
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-SmsFilter::GetDelivery(nsAString& aDelivery)
-{
-  switch (mData.delivery()) {
-    case eDeliveryState_Received:
-      aDelivery = DELIVERY_RECEIVED;
-      break;
-    case eDeliveryState_Sent:
-      aDelivery = DELIVERY_SENT;
-      break;
-    case eDeliveryState_Unknown:
-      SetDOMStringToNull(aDelivery);
-      break;
-    default:
-      NS_ASSERTION(false, "We shouldn't get another delivery state!");
-      return NS_ERROR_UNEXPECTED;
-  }
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-SmsFilter::SetDelivery(const nsAString& aDelivery)
-{
-  if (aDelivery.IsEmpty()) {
-    mData.delivery() = eDeliveryState_Unknown;
-    return NS_OK;
-  }
-
-  if (aDelivery.Equals(DELIVERY_RECEIVED)) {
-    mData.delivery() = eDeliveryState_Received;
-    return NS_OK;
-  }
-
-  if (aDelivery.Equals(DELIVERY_SENT)) {
-    mData.delivery() = eDeliveryState_Sent;
-    return NS_OK;
-  }
-
-  return NS_ERROR_INVALID_ARG;
-}
-
-NS_IMETHODIMP
-SmsFilter::GetRead(JSContext* aCx, JS::MutableHandle<JS::Value> aRead)
-{
-  if (mData.read() == eReadState_Unknown) {
-    aRead.setNull();
-    return NS_OK;
-  }
-
-  aRead.setBoolean(mData.read());
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-SmsFilter::SetRead(JSContext* aCx, JS::Handle<JS::Value> aRead)
-{
-  if (aRead.isNull()) {
-    mData.read() = eReadState_Unknown;
-    return NS_OK;
-  }
-
-  if (!aRead.isBoolean()) {
-    return NS_ERROR_INVALID_ARG;
-  }
-
-  mData.read() = aRead.toBoolean() ? eReadState_Read : eReadState_Unread;
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-SmsFilter::GetThreadId(JSContext* aCx, JS::MutableHandle<JS::Value> aThreadId)
-{
-  if (!mData.threadId()) {
-    aThreadId.setNull();
-    return NS_OK;
-  }
-
-  aThreadId.setNumber(static_cast<double>(mData.threadId()));
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-SmsFilter::SetThreadId(JSContext* aCx, JS::Handle<JS::Value> aThreadId)
-{
-  if (aThreadId.isNull()) {
-    mData.threadId() = 0;
-    return NS_OK;
-  }
-
-  if (!aThreadId.isNumber()) {
-    return NS_ERROR_INVALID_ARG;
-  }
-
-  double number = aThreadId.toNumber();
-  uint64_t integer = static_cast<uint64_t>(number);
-  if (integer == 0 || integer != number) {
-    return NS_ERROR_INVALID_ARG;
-  }
-  mData.threadId() = integer;
-
-  return NS_OK;
-}
-
-} // namespace dom
-} // namespace mozilla
deleted file mode 100644
--- a/dom/mobilemessage/src/SmsFilter.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; 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/. */
-
-#ifndef mozilla_dom_mobilemessage_SmsFilter_h
-#define mozilla_dom_mobilemessage_SmsFilter_h
-
-#include "mozilla/dom/mobilemessage/SmsTypes.h"
-#include "nsIDOMSmsFilter.h"
-#include "mozilla/Attributes.h"
-
-namespace mozilla {
-namespace dom {
-
-class SmsFilter MOZ_FINAL : public nsIDOMMozSmsFilter
-{
-public:
-  NS_DECL_ISUPPORTS
-  NS_DECL_NSIDOMMOZSMSFILTER
-
-  SmsFilter();
-  SmsFilter(const mobilemessage::SmsFilterData& aData);
-
-  const mobilemessage::SmsFilterData& GetData() const;
-
-  static nsresult NewSmsFilter(nsISupports** aSmsFilter);
-
-private:
-  ~SmsFilter() {}
-
-  mobilemessage::SmsFilterData mData;
-};
-
-inline const mobilemessage::SmsFilterData&
-SmsFilter::GetData() const {
-  return mData;
-}
-
-} // namespace dom
-} // namespace mozilla
-
-#endif // mozilla_dom_mobilemessage_SmsFilter_h
--- a/dom/mobilemessage/src/Types.h
+++ b/dom/mobilemessage/src/Types.h
@@ -43,26 +43,17 @@ enum ReadStatus {
   eReadStatus_NotApplicable = 0,
   eReadStatus_Success,
   eReadStatus_Pending,
   eReadStatus_Error,
   // This state should stay at the end.
   eReadStatus_EndGuard
 };
 
-// For {Mms,Sms}FilterData.read.
-enum ReadState {
-  eReadState_Unknown = -1,
-  eReadState_Unread,
-  eReadState_Read,
-  // This state should stay at the end.
-  eReadState_EndGuard
-};
-
-// For {Mms,Sms}FilterData.messageClass.
+// For {Mms,Sms}MessageData.messageClass.
 enum MessageClass {
   eMessageClass_Normal = 0,
   eMessageClass_Class0,
   eMessageClass_Class1,
   eMessageClass_Class2,
   eMessageClass_Class3,
   // This state should stay at the end.
   eMessageClass_EndGuard
@@ -111,27 +102,16 @@ template <>
 struct ParamTraits<mozilla::dom::mobilemessage::ReadStatus>
   : public ContiguousEnumSerializer<
              mozilla::dom::mobilemessage::ReadStatus,
              mozilla::dom::mobilemessage::eReadStatus_NotApplicable,
              mozilla::dom::mobilemessage::eReadStatus_EndGuard>
 {};
 
 /**
- * Read state serializer.
- */
-template <>
-struct ParamTraits<mozilla::dom::mobilemessage::ReadState>
-  : public ContiguousEnumSerializer<
-             mozilla::dom::mobilemessage::ReadState,
-             mozilla::dom::mobilemessage::eReadState_Unknown,
-             mozilla::dom::mobilemessage::eReadState_EndGuard>
-{};
-
-/**
  * Message class serializer.
  */
 template <>
 struct ParamTraits<mozilla::dom::mobilemessage::MessageClass>
   : public ContiguousEnumSerializer<
              mozilla::dom::mobilemessage::MessageClass,
              mozilla::dom::mobilemessage::eMessageClass_Normal,
              mozilla::dom::mobilemessage::eMessageClass_EndGuard>
--- a/dom/mobilemessage/src/android/MobileMessageDatabaseService.cpp
+++ b/dom/mobilemessage/src/android/MobileMessageDatabaseService.cpp
@@ -1,14 +1,13 @@
 /* -*- Mode: C++; tab-width: 2; 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 "SmsFilter.h"
 #include "MobileMessageDatabaseService.h"
 #include "AndroidBridge.h"
 
 namespace mozilla {
 namespace dom {
 namespace mobilemessage {
 
 NS_IMPL_ISUPPORTS(MobileMessageDatabaseService, nsIMobileMessageDatabaseService)
@@ -42,17 +41,26 @@ MobileMessageDatabaseService::DeleteMess
     return NS_ERROR_FAILURE;
   }
 
   AndroidBridge::Bridge()->DeleteMessage(aMessageIds[0], aRequest);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-MobileMessageDatabaseService::CreateMessageCursor(nsIDOMMozSmsFilter* aFilter,
+MobileMessageDatabaseService::CreateMessageCursor(bool aHasStartDate,
+                                                  uint64_t aStartDate,
+                                                  bool aHasEndDate,
+                                                  uint64_t aEndDate,
+                                                  const char16_t** aNumbers,
+                                                  uint32_t aNumbersCount,
+                                                  const nsAString& aDelivery,
+                                                  bool aHasRead,
+                                                  bool aRead,
+                                                  uint64_t aThreadId,
                                                   bool aReverse,
                                                   nsIMobileMessageCursorCallback* aCallback,
                                                   nsICursorContinueCallback** aResult)
 {
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
--- a/dom/mobilemessage/src/gonk/MobileMessageDB.jsm
+++ b/dom/mobilemessage/src/gonk/MobileMessageDB.jsm
@@ -3100,35 +3100,57 @@ MobileMessageDB.prototype = {
               updateThreadInfo();
             }
           }
         }.bind(null, i);
       }
     }, [MESSAGE_STORE_NAME, THREAD_STORE_NAME]);
   },
 
-  createMessageCursor: function(filter, reverse, callback) {
+  createMessageCursor: function(aHasStartDate, aStartDate, aHasEndDate,
+                                aEndDate, aNumbers, aNumbersCount, aDelivery,
+                                aHasRead, aRead, aThreadId, aReverse, aCallback) {
     if (DEBUG) {
       debug("Creating a message cursor. Filters:" +
-            " startDate: " + filter.startDate +
-            " endDate: " + filter.endDate +
-            " delivery: " + filter.delivery +
-            " numbers: " + filter.numbers +
-            " read: " + filter.read +
-            " threadId: " + filter.threadId +
-            " reverse: " + reverse);
+            " startDate: " + (aHasStartDate ? aStartDate : "(null)") +
+            " endDate: " + (aHasEndDate ? aEndDate : "(null)") +
+            " delivery: " + aDelivery +
+            " numbers: " + (aNumbersCount ? aNumbers : "(null)") +
+            " read: " + (aHasRead ? aRead : "(null)") +
+            " threadId: " + aThreadId +
+            " reverse: " + aReverse);
+    }
+
+    let filter = {};
+    if (aHasStartDate) {
+      filter.startDate = aStartDate;
     }
-
-    let cursor = new GetMessagesCursor(this, callback);
+    if (aHasEndDate) {
+      filter.endDate = aEndDate;
+    }
+    if (aNumbersCount) {
+      filter.numbers = aNumbers.slice();
+    }
+    if (aDelivery !== null) {
+      filter.delivery = aDelivery;
+    }
+    if (aHasRead) {
+      filter.read = aRead;
+    }
+    if (aThreadId) {
+      filter.threadId = aThreadId;
+    }
+
+    let cursor = new GetMessagesCursor(this, aCallback);
 
     let self = this;
     self.newTxn(READ_ONLY, function(error, txn, stores) {
       let collector = cursor.collector;
       let collect = collector.collect.bind(collector);
-      FilterSearcherHelper.transact(self, txn, error, filter, reverse, collect);
+      FilterSearcherHelper.transact(self, txn, error, filter, aReverse, collect);
     }, [MESSAGE_STORE_NAME, PARTICIPANT_STORE_NAME]);
 
     return cursor;
   },
 
   markMessageRead: function(messageId, value, aSendReadReport, aRequest) {
     if (DEBUG) debug("Setting message " + messageId + " read to " + value);
     let self = this;
@@ -3306,36 +3328,36 @@ let FilterSearcherHelper = {
    *        Ongoing IDBTransaction context object.
    * @param collect
    *        Result colletor function. It takes three parameters -- txn, message
    *        id, and message timestamp.
    */
   filterTimestamp: function(startDate, endDate, direction, txn, collect) {
     let range = null;
     if (startDate != null && endDate != null) {
-      range = IDBKeyRange.bound(startDate.getTime(), endDate.getTime());
+      range = IDBKeyRange.bound(startDate, endDate);
     } else if (startDate != null) {
-      range = IDBKeyRange.lowerBound(startDate.getTime());
+      range = IDBKeyRange.lowerBound(startDate);
     } else if (endDate != null) {
-      range = IDBKeyRange.upperBound(endDate.getTime());
+      range = IDBKeyRange.upperBound(endDate);
     }
     this.filterIndex("timestamp", range, direction, txn, collect);
   },
 
   /**
    * Instanciate a filtering transaction.
    *
    * @param mmdb
    *        A MobileMessageDB.
    * @param txn
    *        Ongoing IDBTransaction context object.
    * @param error
    *        Previous error while creating the transaction.
    * @param filter
-   *        A SmsFilter object.
+   *        A MobileMessageFilter dictionary.
    * @param reverse
    *        A boolean value indicating whether we should filter message in
    *        reversed order.
    * @param collect
    *        Result colletor function. It takes three parameters -- txn, message
    *        id, and message timestamp.
    */
   transact: function(mmdb, txn, error, filter, reverse, collect) {
@@ -3363,20 +3385,20 @@ let FilterSearcherHelper = {
                            collect);
       return;
     }
 
     // Numeric 0 is smaller than any time stamp, and empty string is larger
     // than all numeric values.
     let startDate = 0, endDate = "";
     if (filter.startDate != null) {
-      startDate = filter.startDate.getTime();
+      startDate = filter.startDate;
     }
     if (filter.endDate != null) {
-      endDate = filter.endDate.getTime();
+      endDate = filter.endDate;
     }
 
     let single, intersectionCollector;
     {
       let num = 0;
       if (filter.delivery) num++;
       if (filter.numbers) num++;
       if (filter.read != undefined) num++;
--- a/dom/mobilemessage/src/gonk/MobileMessageDatabaseService.js
+++ b/dom/mobilemessage/src/gonk/MobileMessageDatabaseService.js
@@ -103,18 +103,23 @@ MobileMessageDatabaseService.prototype =
   getMessage: function(aMessageId, aRequest) {
     this.mmdb.getMessage(aMessageId, aRequest);
   },
 
   deleteMessage: function(aMessageIds, aLength, aRequest) {
     this.mmdb.deleteMessage(aMessageIds, aLength, aRequest);
   },
 
-  createMessageCursor: function(aFilter, aReverse, aCallback) {
-    return this.mmdb.createMessageCursor(aFilter, aReverse, aCallback);
+  createMessageCursor: function(aHasStartDate, aStartDate, aHasEndDate,
+                                aEndDate, aNumbers, aNumbersCount, aDelivery,
+                                aHasRead, aRead, aThreadId, aReverse, aCallback) {
+    return this.mmdb.createMessageCursor(aHasStartDate, aStartDate, aHasEndDate,
+                                         aEndDate, aNumbers, aNumbersCount,
+                                         aDelivery, aHasRead, aRead, aThreadId,
+                                         aReverse, aCallback);
   },
 
   markMessageRead: function(aMessageId, aValue, aSendReadReport, aRequest) {
     this.mmdb.markMessageRead(aMessageId, aValue, aSendReadReport, aRequest);
   },
 
   createThreadCursor: function(aCallback) {
     return this.mmdb.createThreadCursor(aCallback);
--- a/dom/mobilemessage/src/ipc/SmsIPCService.cpp
+++ b/dom/mobilemessage/src/ipc/SmsIPCService.cpp
@@ -3,17 +3,16 @@
  * 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 "mozilla/dom/ContentChild.h"
 #include "SmsIPCService.h"
 #include "nsXULAppAPI.h"
 #include "mozilla/dom/mobilemessage/SmsChild.h"
 #include "SmsMessage.h"
-#include "SmsFilter.h"
 #include "nsJSUtils.h"
 #include "mozilla/dom/MozMobileMessageManagerBinding.h"
 #include "mozilla/dom/BindingUtils.h"
 #include "mozilla/Preferences.h"
 #include "nsString.h"
 
 using namespace mozilla::dom;
 using namespace mozilla::dom::mobilemessage;
@@ -215,23 +214,50 @@ SmsIPCService::DeleteMessage(int32_t *aM
                              nsIMobileMessageCallback* aRequest)
 {
   DeleteMessageRequest data;
   data.messageIds().AppendElements(aMessageIds, aSize);
   return SendRequest(data, aRequest);
 }
 
 NS_IMETHODIMP
-SmsIPCService::CreateMessageCursor(nsIDOMMozSmsFilter* aFilter,
+SmsIPCService::CreateMessageCursor(bool aHasStartDate,
+                                   uint64_t aStartDate,
+                                   bool aHasEndDate,
+                                   uint64_t aEndDate,
+                                   const char16_t** aNumbers,
+                                   uint32_t aNumbersCount,
+                                   const nsAString& aDelivery,
+                                   bool aHasRead,
+                                   bool aRead,
+                                   uint64_t aThreadId,
                                    bool aReverse,
                                    nsIMobileMessageCursorCallback* aCursorCallback,
                                    nsICursorContinueCallback** aResult)
 {
-  const SmsFilterData& data =
-    SmsFilterData(static_cast<SmsFilter*>(aFilter)->GetData());
+  SmsFilterData data;
+
+  data.hasStartDate() = aHasStartDate;
+  data.startDate() = aStartDate;
+  data.hasEndDate() = aHasEndDate;
+  data.startDate() = aEndDate;
+
+  if (aNumbersCount && aNumbers) {
+    nsTArray<nsString>& numbers = data.numbers();
+    uint32_t index;
+
+    for (index = 0; index < aNumbersCount; index++) {
+      numbers.AppendElement(aNumbers[index]);
+    }
+  }
+
+  data.delivery() = aDelivery;
+  data.hasRead() = aHasRead;
+  data.read() = aRead;
+  data.threadId() = aThreadId;
 
   return SendCursorRequest(CreateMessageCursorRequest(data, aReverse),
                            aCursorCallback, aResult);
 }
 
 NS_IMETHODIMP
 SmsIPCService::MarkMessageRead(int32_t aMessageId,
                                bool aValue,
--- a/dom/mobilemessage/src/ipc/SmsParent.cpp
+++ b/dom/mobilemessage/src/ipc/SmsParent.cpp
@@ -9,17 +9,16 @@
 #include "nsIObserverService.h"
 #include "mozilla/Services.h"
 #include "nsIDOMMozSmsMessage.h"
 #include "nsIDOMMozMmsMessage.h"
 #include "mozilla/unused.h"
 #include "SmsMessage.h"
 #include "MmsMessage.h"
 #include "nsIMobileMessageDatabaseService.h"
-#include "SmsFilter.h"
 #include "MobileMessageThread.h"
 #include "nsIDOMFile.h"
 #include "mozilla/dom/ipc/Blob.h"
 #include "mozilla/dom/ContentParent.h"
 #include "mozilla/dom/mobilemessage/Constants.h" // For MessageType
 #include "nsContentUtils.h"
 #include "nsTArrayHelpers.h"
 #include "xpcpublic.h"
@@ -769,20 +768,41 @@ MobileMessageCursorParent::RecvContinue(
 bool
 MobileMessageCursorParent::DoRequest(const CreateMessageCursorRequest& aRequest)
 {
   nsresult rv = NS_ERROR_FAILURE;
 
   nsCOMPtr<nsIMobileMessageDatabaseService> dbService =
     do_GetService(MOBILE_MESSAGE_DATABASE_SERVICE_CONTRACTID);
   if (dbService) {
-    nsCOMPtr<nsIDOMMozSmsFilter> filter = new SmsFilter(aRequest.filter());
-    bool reverse = aRequest.reverse();
+    const SmsFilterData& filter = aRequest.filter();
+
+    const nsTArray<nsString>& numbers = filter.numbers();
+    nsAutoArrayPtr<const char16_t*> ptrNumbers;
+    uint32_t numbersCount = numbers.Length();
+    if (numbersCount) {
+      uint32_t index;
 
-    rv = dbService->CreateMessageCursor(filter, reverse, this,
+      ptrNumbers = new const char16_t* [numbersCount];
+      for (index = 0; index < numbersCount; index++) {
+        ptrNumbers[index] = numbers[index].get();
+      }
+    }
+
+    rv = dbService->CreateMessageCursor(filter.hasStartDate(),
+                                        filter.startDate(),
+                                        filter.hasEndDate(),
+                                        filter.endDate(),
+                                        ptrNumbers, numbersCount,
+                                        filter.delivery(),
+                                        filter.hasRead(),
+                                        filter.read(),
+                                        filter.threadId(),
+                                        aRequest.reverse(),
+                                        this,
                                         getter_AddRefs(mContinueCallback));
   }
 
   if (NS_FAILED(rv)) {
     return NS_SUCCEEDED(NotifyCursorError(nsIMobileMessageCallback::INTERNAL_ERROR));
   }
 
   return true;
--- a/dom/mobilemessage/src/ipc/SmsTypes.ipdlh
+++ b/dom/mobilemessage/src/ipc/SmsTypes.ipdlh
@@ -72,21 +72,24 @@ struct MmsMessageData
 union MobileMessageData
 {
   MmsMessageData;
   SmsMessageData;
 };
 
 struct SmsFilterData
 {
+  bool          hasStartDate;
   uint64_t      startDate;
+  bool          hasEndDate;
   uint64_t      endDate;
   nsString[]    numbers;
-  DeliveryState delivery;
-  ReadState     read;
+  nsString      delivery;
+  bool          hasRead;
+  bool          read;
   uint64_t      threadId;
 };
 
 struct ThreadData
 {
   uint64_t    id;
   nsString[]  participants;
   uint64_t    timestamp;
--- a/dom/mobilemessage/src/moz.build
+++ b/dom/mobilemessage/src/moz.build
@@ -35,34 +35,32 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'go
     SOURCES += [
         'gonk/SmsService.cpp',
     ]
 
 EXPORTS.mozilla.dom += [
     'DOMMobileMessageError.h',
     'MmsMessage.h',
     'MobileMessageManager.h',
-    'SmsFilter.h',
     'SmsMessage.h',
 ]
 
 UNIFIED_SOURCES += [
     'Constants.cpp',
     'DeletedMessageInfo.cpp',
     'DOMMobileMessageError.cpp',
     'ipc/SmsChild.cpp',
     'ipc/SmsIPCService.cpp',
     'ipc/SmsParent.cpp',
     'MmsMessage.cpp',
     'MobileMessageCallback.cpp',
     'MobileMessageCursorCallback.cpp',
     'MobileMessageManager.cpp',
     'MobileMessageService.cpp',
     'MobileMessageThread.cpp',
-    'SmsFilter.cpp',
     'SmsMessage.cpp',
     'SmsServicesFactory.cpp',
 ]
 
 IPDL_SOURCES += [
     'ipc/PMobileMessageCursor.ipdl',
     'ipc/PSms.ipdl',
     'ipc/PSmsRequest.ipdl',
--- a/dom/webidl/MozMobileMessageManager.webidl
+++ b/dom/webidl/MozMobileMessageManager.webidl
@@ -1,16 +1,15 @@
 /* -*- Mode: IDL; tab-width: 2; 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/.
  */
 
 interface MozMmsMessage;
-interface MozSmsFilter;
 interface MozSmsMessage;
 
 dictionary SmsSegmentInfo {
   /**
    * The number of total segments for the input string. The value is always
    * larger-equal than 1.
    */
   long segments = 0;
@@ -46,16 +45,41 @@ dictionary SmsSendParameters {
                            // specified under the multi-sim scenario.
 };
 
 dictionary MmsSendParameters {
   unsigned long serviceId; // The ID of the RIL service which needs to be
                            // specified under the multi-sim scenario.
 };
 
+enum MobileMessageFilterDelivery { "sent", "received" };
+
+dictionary MobileMessageFilter
+{
+  // Close lower bound range for filtering by the message timestamp.
+  // Time in milliseconds since Epoch.
+  [EnforceRange] DOMTimeStamp? startDate = null;
+
+  // Close upper bound range for filtering by the message timestamp.
+  // Time in milliseconds since Epoch.
+  [EnforceRange] DOMTimeStamp? endDate = null;
+
+  // An array of string message participant addresses that any of which
+  // appears or matches a message's sendor or recipients addresses.
+  sequence<DOMString>? numbers = null;
+
+  MobileMessageFilterDelivery? delivery = null;
+
+  // Filtering by whether a message has been read or not.
+  boolean? read = null;
+
+  // Filtering by a message's threadId attribute.
+  [EnforceRange] unsigned long long? threadId = 0;
+};
+
 [Pref="dom.sms.enabled"]
 interface MozMobileMessageManager : EventTarget
 {
   [Throws]
   DOMRequest getSegmentInfoForText(DOMString text);
 
   /**
    * Send SMS.
@@ -106,17 +130,17 @@ interface MozMobileMessageManager : Even
   DOMRequest delete(MozSmsMessage message);
   [Throws]
   DOMRequest delete(MozMmsMessage message);
   [Throws]
   DOMRequest delete(sequence<(long or MozSmsMessage or MozMmsMessage)> params);
 
   // Iterates through Moz{Mms,Sms}Message.
   [Throws]
-  DOMCursor getMessages(optional MozSmsFilter? filter = null,
+  DOMCursor getMessages(optional MobileMessageFilter filter,
                         optional boolean reverse = false);
 
   [Throws]
   DOMRequest markMessageRead(long id,
                              boolean read,
                              optional boolean sendReadReport = false);
 
   // Iterates through nsIDOMMozMobileMessageThread.