Backout f2c60518351d Bug 809661
authorGregor Wagner <anygregor@gmail.com>
Tue, 13 Nov 2012 14:44:18 -0800
changeset 113143 5db578a8dffa334a914bb175d4cca5c28380e3aa
parent 113142 43e4b01c0150a831f6635e7433b459052f3f1370
child 113144 9360711fad95dd3a73efd1bcc451602da2491ea3
push id23859
push useremorley@mozilla.com
push dateWed, 14 Nov 2012 14:36:31 +0000
treeherdermozilla-central@87928cd21b40 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs809661
milestone19.0a1
backs outf2c60518351dd556a1675e8fb8b2e80257af2fc2
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
Backout f2c60518351d Bug 809661
dom/sms/Makefile.in
dom/sms/interfaces/nsIDOMSmsManager.idl
dom/sms/interfaces/nsISmsDatabaseService.idl
dom/sms/interfaces/nsISmsRequest.idl
dom/sms/src/SmsManager.cpp
dom/sms/src/SmsRequest.cpp
dom/sms/src/SmsRequest.h
dom/sms/src/android/SmsDatabaseService.cpp
dom/sms/src/fallback/SmsDatabaseService.cpp
dom/sms/src/ipc/PSms.ipdl
dom/sms/src/ipc/PSmsRequest.ipdl
dom/sms/src/ipc/SmsChild.cpp
dom/sms/src/ipc/SmsIPCService.cpp
dom/sms/src/ipc/SmsParent.cpp
dom/sms/src/ipc/SmsParent.h
dom/sms/src/ril/SmsDatabaseService.js
js/xpconnect/src/dictionary_helper_gen.conf
--- a/dom/sms/Makefile.in
+++ b/dom/sms/Makefile.in
@@ -6,16 +6,16 @@ DEPTH            = @DEPTH@
 topsrcdir        = @top_srcdir@
 srcdir           = @srcdir@
 VPATH            = @srcdir@
 
 relativesrcdir   = @relativesrcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
-DIRS = interfaces src
+PARALLEL_DIRS = interfaces src
 
 TEST_DIRS += tests
 ifdef ENABLE_TESTS
 XPCSHELL_TESTS = tests
 endif
 
 include $(topsrcdir)/config/rules.mk
--- a/dom/sms/interfaces/nsIDOMSmsManager.idl
+++ b/dom/sms/interfaces/nsIDOMSmsManager.idl
@@ -3,17 +3,17 @@
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsIDOMEventTarget.idl"
 
 interface nsIDOMEventListener;
 interface nsIDOMMozSmsRequest;
 interface nsIDOMMozSmsFilter;
 
-[scriptable, builtinclass, uuid(caaf5c38-a730-4dbb-a0f0-12384bfac8e3)]
+[scriptable, builtinclass, uuid(1bee1224-56a2-4935-af7b-0011746306cb)]
 interface nsIDOMMozSmsManager : nsIDOMEventTarget
 {
   unsigned short getNumberOfMessagesForText(in DOMString text);
 
   // The first parameter can be either a DOMString (only one number) or an array
   // of DOMStrings.
   // The method returns a SmsRequest object if one number has been passed.
   // An array of SmsRequest objects otherwise.
@@ -24,15 +24,13 @@ interface nsIDOMMozSmsManager : nsIDOMEv
 
   // The parameter can be either a message id or a SmsMessage.
   nsIDOMMozSmsRequest delete(in jsval param);
 
   nsIDOMMozSmsRequest getMessages(in nsIDOMMozSmsFilter filter, in boolean reverse);
 
   nsIDOMMozSmsRequest markMessageRead(in long id, in boolean aValue);
 
-  nsIDOMMozSmsRequest getThreadList();
-
   [implicit_jscontext] attribute jsval onreceived;
   [implicit_jscontext] attribute jsval onsent;
   [implicit_jscontext] attribute jsval ondeliverysuccess;
   [implicit_jscontext] attribute jsval ondeliveryerror;
 };
--- a/dom/sms/interfaces/nsISmsDatabaseService.idl
+++ b/dom/sms/interfaces/nsISmsDatabaseService.idl
@@ -9,27 +9,25 @@
 { 0x2454c2a1, 0xefdd, 0x4d96,    \
 { 0x83, 0xbd, 0x51, 0xa2, 0x9a, 0x21, 0xf5, 0xab } }
 #define SMS_DATABASE_SERVICE_CONTRACTID "@mozilla.org/sms/smsdatabaseservice;1"
 %}
 
 interface nsIDOMMozSmsFilter;
 interface nsISmsRequest;
 
-[scriptable, uuid(c2cb2af7-6b96-4915-bcc8-54ad705d6110)]
+[scriptable, uuid(6ad55465-6937-4491-93ca-29dad9775d46)]
 interface nsISmsDatabaseService : nsISupports
 {
   // Takes some information required to save the message and returns its id.
   long saveReceivedMessage(in DOMString aSender, in DOMString aBody, in DOMString aMessageClass, in unsigned long long aDate);
   // Takes some information required to save the message and returns its id.
   long saveSentMessage(in DOMString aReceiver, in DOMString aBody, in unsigned long long aDate);
   void setMessageDeliveryStatus(in long aMessageId, in DOMString aDeliveryStatus);
 
   [binaryname(GetMessageMoz)]
   void getMessage(in long messageId, in nsISmsRequest request);
   void deleteMessage(in long messageId, in nsISmsRequest request);
   void createMessageList(in nsIDOMMozSmsFilter filter, in boolean reverse, in nsISmsRequest request);
   void getNextMessageInList(in long listId, in nsISmsRequest request);
   void clearMessageList(in long listId);
   void markMessageRead(in long messageId, in boolean value, in nsISmsRequest request);
-
-  void getThreadList(in nsISmsRequest request);
 };
--- a/dom/sms/interfaces/nsISmsRequest.idl
+++ b/dom/sms/interfaces/nsISmsRequest.idl
@@ -1,25 +1,17 @@
 /* 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"
 
 interface nsIDOMMozSmsMessage;
 
-dictionary SmsThreadListItem
-{
-  DOMString senderOrReceiver;
-  unsigned long long timestamp;
-  DOMString body;
-  unsigned long long unreadCount;
-};
-
-[scriptable, builtinclass, uuid(82a6d16d-cf33-4745-8662-8b5d441f512f)]
+[scriptable, builtinclass, uuid(97067327-64b9-4e26-848b-59e443c55db9)]
 interface nsISmsRequest : nsISupports
 {
   /**
    * All SMS related errors that could apply to SmsRequest objects.
    * Make sure to keep this list in sync with the list in:
    * embedding/android/GeckoSmsManager.java
    */
   const unsigned short SUCCESS_NO_ERROR = 0;
@@ -40,13 +32,9 @@ interface nsISmsRequest : nsISupports
   void notifyMessageListCreated(in long listId,
                                 in nsIDOMMozSmsMessage message);
   void notifyReadMessageListFailed(in long error);
   void notifyNextMessageInListGot(in nsIDOMMozSmsMessage message);
   void notifyNoMessageInList();
 
   void notifyMessageMarkedRead(in boolean read);
   void notifyMarkMessageReadFailed(in long error);
-
-  [implicit_jscontext]
-  void notifyThreadList(in jsval threadList);
-  void notifyThreadListFailed(in long error);
 };
--- a/dom/sms/src/SmsManager.cpp
+++ b/dom/sms/src/SmsManager.cpp
@@ -298,30 +298,16 @@ SmsManager::MarkMessageRead(int32_t aId,
   NS_ENSURE_TRUE(smsDBService, NS_ERROR_FAILURE);
   nsCOMPtr<nsISmsRequest> forwarder =
     new SmsRequestForwarder(static_cast<SmsRequest*>(req.get()));
   smsDBService->MarkMessageRead(aId, aValue, forwarder);
   req.forget(aRequest);
   return NS_OK;
 }
 
-NS_IMETHODIMP
-SmsManager::GetThreadList(nsIDOMMozSmsRequest** aRequest)
-{
-  nsCOMPtr<nsIDOMMozSmsRequest> req = SmsRequest::Create(this);
-  nsCOMPtr<nsISmsDatabaseService> smsDBService =
-    do_GetService(SMS_DATABASE_SERVICE_CONTRACTID);
-  NS_ENSURE_TRUE(smsDBService, NS_ERROR_FAILURE);
-  nsCOMPtr<nsISmsRequest> forwarder =
-    new SmsRequestForwarder(static_cast<SmsRequest*>(req.get()));
-  smsDBService->GetThreadList(forwarder);
-  req.forget(aRequest);
-  return NS_OK;
-}
-
 nsresult
 SmsManager::DispatchTrustedSmsEventToSelf(const nsAString& aEventName, nsIDOMMozSmsMessage* aMessage)
 {
   nsRefPtr<nsDOMEvent> event = new SmsEvent(nullptr, nullptr);
   nsresult rv = static_cast<SmsEvent*>(event.get())->Init(aEventName, false,
                                                           false, aMessage);
   NS_ENSURE_SUCCESS(rv, rv);
 
--- a/dom/sms/src/SmsRequest.cpp
+++ b/dom/sms/src/SmsRequest.cpp
@@ -4,26 +4,21 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "SmsRequest.h"
 #include "nsIDOMClassInfo.h"
 #include "nsDOMEvent.h"
 #include "nsDOMString.h"
 #include "nsContentUtils.h"
 #include "nsIDOMSmsMessage.h"
-#include "nsIScriptGlobalObject.h"
-#include "nsPIDOMWindow.h"
 #include "SmsCursor.h"
 #include "SmsMessage.h"
 #include "SmsManager.h"
 #include "mozilla/dom/DOMError.h"
 #include "SmsParent.h"
-#include "jsapi.h"
-#include "DictionaryHelpers.h"
-#include "xpcpublic.h"
 
 #define SUCCESS_EVENT_NAME NS_LITERAL_STRING("success")
 #define ERROR_EVENT_NAME   NS_LITERAL_STRING("error")
 
 DOMCI_DATA(MozSmsRequest, mozilla::dom::sms::SmsRequest)
 
 namespace mozilla {
 namespace dom {
@@ -145,17 +140,22 @@ void
 SmsRequest::SetSuccess(nsIDOMMozSmsMessage* aMessage)
 {
   SetSuccessInternal(aMessage);
 }
 
 void
 SmsRequest::SetSuccess(bool aResult)
 {
-  SetSuccess(aResult ? JSVAL_TRUE : JSVAL_FALSE);
+  NS_PRECONDITION(!mDone, "mDone shouldn't have been set to true already!");
+  NS_PRECONDITION(!mError, "mError shouldn't have been set!");
+  NS_PRECONDITION(mResult == JSVAL_NULL, "mResult shouldn't have been set!");
+
+  mResult.setBoolean(aResult);
+  mDone = true;
 }
 
 void
 SmsRequest::SetSuccess(nsIDOMMozSmsCursor* aCursor)
 {
   if (!SetSuccessInternal(aCursor)) {
     return;
   }
@@ -163,27 +163,16 @@ SmsRequest::SetSuccess(nsIDOMMozSmsCurso
   NS_ASSERTION(!mCursor || mCursor == aCursor,
                "SmsRequest can't change it's cursor!");
 
   if (!mCursor) {
     mCursor = aCursor;
   }
 }
 
-void
-SmsRequest::SetSuccess(const jsval& aResult)
-{
-  NS_PRECONDITION(!mDone, "mDone shouldn't have been set to true already!");
-  NS_PRECONDITION(!mError, "mError shouldn't have been set!");
-  NS_PRECONDITION(JSVAL_IS_VOID(mResult), "mResult shouldn't have been set!");
-
-  mResult = aResult;
-  mDone = true;
-}
-
 bool
 SmsRequest::SetSuccessInternal(nsISupports* aObject)
 {
   NS_PRECONDITION(!mDone, "mDone shouldn't have been set to true already!");
   NS_PRECONDITION(!mError, "mError shouldn't have been set!");
   NS_PRECONDITION(mResult == JSVAL_VOID, "mResult shouldn't have been set!");
 
   nsresult rv;
@@ -451,139 +440,11 @@ NS_IMETHODIMP
 SmsRequest::NotifyMarkMessageReadFailed(int32_t aError)
 {
   if (mParent) {
     return SendMessageReply(MessageReply(ReplyMarkeMessageReadFail(aError)));
   }
   return NotifyError(aError);
 }
 
-NS_IMETHODIMP
-SmsRequest::NotifyThreadList(const jsval& aThreadList, JSContext* aCx)
-{
-  MOZ_ASSERT(aThreadList.isObject());
-
-  if (mParent) {
-    JSObject* array = const_cast<JSObject*>(&aThreadList.toObject());
-
-    uint32_t length;
-    bool ok = JS_GetArrayLength(aCx, array, &length);
-    NS_ENSURE_TRUE(ok, NS_ERROR_FAILURE);
-
-    ReplyThreadList reply;
-    InfallibleTArray<ThreadListItem>& ipcItems = reply.items();
-
-    if (length) {
-      ipcItems.SetCapacity(length);
-
-      for (uint32_t i = 0; i < length; i++) {
-        jsval arrayEntry;
-        ok = JS_GetElement(aCx, array, i, &arrayEntry);
-        NS_ENSURE_TRUE(ok, NS_ERROR_FAILURE);
-
-        MOZ_ASSERT(arrayEntry.isObject());
-
-        SmsThreadListItem item;
-        nsresult rv = item.Init(aCx, &arrayEntry);
-        NS_ENSURE_SUCCESS(rv, rv);
-
-        ThreadListItem* ipcItem = ipcItems.AppendElement();
-        ipcItem->senderOrReceiver() = item.senderOrReceiver;
-        ipcItem->timestamp() = item.timestamp;
-        ipcItem->body() = item.body;
-        ipcItem->unreadCount() = item.unreadCount;
-      }
-    }
-
-    return SendMessageReply(reply);
-  }
-
-  return NotifySuccess(aThreadList);
-}
-
-NS_IMETHODIMP
-SmsRequest::NotifyThreadListFailed(int32_t aError)
-{
-  if (mParent) {
-    return SendMessageReply(MessageReply(ReplyThreadListFail(aError)));
-  }
-  return NotifyError(aError);
-}
-
-void
-SmsRequest::NotifyThreadList(const InfallibleTArray<ThreadListItem>& aItems)
-{
-  MOZ_ASSERT(!mParent);
-  MOZ_ASSERT(GetOwner());
-
-  nsresult rv;
-  nsIScriptContext* sc = GetContextForEventHandlers(&rv);
-  NS_ENSURE_SUCCESS_VOID(rv);
-  NS_ENSURE_TRUE_VOID(sc);
-
-  JSContext* cx = sc->GetNativeContext();
-  MOZ_ASSERT(cx);
-
-  nsCOMPtr<nsIScriptGlobalObject> sgo = do_QueryInterface(GetOwner());
-
-  JSObject* ownerObj = sgo->GetGlobalJSObject();
-  NS_ENSURE_TRUE_VOID(ownerObj);
-
-  nsCxPusher pusher;
-  NS_ENSURE_TRUE_VOID(pusher.Push(cx, false));
-
-  JSAutoRequest ar(cx);
-  JSAutoCompartment ac(cx, ownerObj);
-
-  JSObject* array = JS_NewArrayObject(cx, aItems.Length(), nullptr);
-  NS_ENSURE_TRUE_VOID(array);
-
-  bool ok;
-
-  for (uint32_t i = 0; i < aItems.Length(); i++) {
-    const ThreadListItem& source = aItems[i];
-
-    nsString temp = source.senderOrReceiver();
-
-    jsval senderOrReceiver;
-    ok = xpc::StringToJsval(cx, temp, &senderOrReceiver);
-    NS_ENSURE_TRUE_VOID(ok);
-
-    JSObject* timestampObj = JS_NewDateObjectMsec(cx, source.timestamp());
-    NS_ENSURE_TRUE_VOID(timestampObj);
-
-    jsval timestamp = OBJECT_TO_JSVAL(timestampObj);
-
-    temp = source.body();
-
-    jsval body;
-    ok = xpc::StringToJsval(cx, temp, &body);
-    NS_ENSURE_TRUE_VOID(ok);
-
-    jsval unreadCount = JS_NumberValue(double(source.unreadCount()));
-
-    JSObject* elementObj = JS_NewObject(cx, nullptr, nullptr, nullptr);
-    NS_ENSURE_TRUE_VOID(elementObj);
-
-    ok = JS_SetProperty(cx, elementObj, "senderOrReceiver", &senderOrReceiver);
-    NS_ENSURE_TRUE_VOID(ok);
-
-    ok = JS_SetProperty(cx, elementObj, "timestamp", &timestamp);
-    NS_ENSURE_TRUE_VOID(ok);
-
-    ok = JS_SetProperty(cx, elementObj, "body", &body);
-    NS_ENSURE_TRUE_VOID(ok);
-
-    ok = JS_SetProperty(cx, elementObj, "unreadCount", &unreadCount);
-    NS_ENSURE_TRUE_VOID(ok);
-
-    jsval element = OBJECT_TO_JSVAL(elementObj);
-
-    ok = JS_SetElement(cx, array, i, &element);
-    NS_ENSURE_TRUE_VOID(ok);
-  }
-
-  NotifyThreadList(OBJECT_TO_JSVAL(array), cx);
-}
-
 } // namespace sms
 } // namespace dom
 } // namespace mozilla
--- a/dom/sms/src/SmsRequest.h
+++ b/dom/sms/src/SmsRequest.h
@@ -12,43 +12,34 @@
 
 class nsIDOMMozSmsMessage;
 class nsIDOMMozSmsCursor;
 
 namespace mozilla {
 namespace dom {
 namespace sms {
 
-class SmsRequestChild;
 class SmsRequestParent;
 class MessageReply;
-class ThreadListItem;
 
 // We need this forwarder to avoid a QI to nsIClassInfo.
 // See: https://bugzilla.mozilla.org/show_bug.cgi?id=775997#c51 
 class SmsRequestForwarder : public nsISmsRequest
 {
-  friend class SmsRequestChild;
+  NS_FORWARD_NSISMSREQUEST(mRealRequest->)
 
-public:
   NS_DECL_ISUPPORTS
-  NS_FORWARD_NSISMSREQUEST(mRealRequest->)
 
   SmsRequestForwarder(nsISmsRequest* aRealRequest) {
     mRealRequest = aRealRequest;
   }
-
-private:
   virtual
   ~SmsRequestForwarder() {}
 
-  nsISmsRequest* GetRealRequest() {
-    return mRealRequest;
-  }
-
+private:
   nsCOMPtr<nsISmsRequest> mRealRequest;
 };
 
 class SmsManager;
 
 class SmsRequest : public nsDOMEventTargetHelper
                  , public nsIDOMMozSmsRequest
                  , public nsISmsRequest
@@ -70,19 +61,16 @@ public:
 
   static already_AddRefed<SmsRequest> Create(SmsRequestParent* requestParent);
   void Reset();
 
   void SetActorDied() {
     mParentAlive = false;
   }
 
-  void
-  NotifyThreadList(const InfallibleTArray<ThreadListItem>& aItems);
-
 private:
   SmsRequest() MOZ_DELETE;
 
   SmsRequest(SmsManager* aManager);
   SmsRequest(SmsRequestParent* aParent);
   ~SmsRequest();
 
   nsresult SendMessageReply(const MessageReply& aReply);
@@ -108,21 +96,16 @@ private:
   void SetSuccess(bool aResult);
 
   /**
    * Set the object in a success state with the result being a SmsCursor.
    */
   void SetSuccess(nsIDOMMozSmsCursor* aCursor);
 
   /**
-   * Set the object in a success state with the result being the given jsval.
-   */
-  void SetSuccess(const jsval& aVal);
-
-  /**
    * Set the object in an error state with the error type being aError.
    */
   void SetError(int32_t aError);
 
   /**
    * Set the object in a success state with the result being the nsISupports
    * object in parameter.
    * @return whether setting the object was a success
--- a/dom/sms/src/android/SmsDatabaseService.cpp
+++ b/dom/sms/src/android/SmsDatabaseService.cpp
@@ -107,18 +107,11 @@ SmsDatabaseService::ClearMessageList(int
 NS_IMETHODIMP
 SmsDatabaseService::MarkMessageRead(int32_t aMessageId, bool aValue,
                                     nsISmsRequest* aRequest)
 {
   // TODO: This would need to be implemented as part of Bug 748391
   return NS_OK;
 }
 
-NS_IMETHODIMP
-SmsDatabaseService::GetThreadList(nsISmsRequest* aRequest)
-{
-  NS_NOTYETIMPLEMENTED("Implement me!");
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
 } // namespace sms
 } // namespace dom
 } // namespace mozilla
--- a/dom/sms/src/fallback/SmsDatabaseService.cpp
+++ b/dom/sms/src/fallback/SmsDatabaseService.cpp
@@ -85,18 +85,11 @@ NS_IMETHODIMP
 SmsDatabaseService::MarkMessageRead(int32_t aMessageId,
                                     bool aValue,
                                     nsISmsRequest* aRequest)
 {
   NS_ERROR("We should not be here!");
   return NS_OK;
 }
 
-NS_IMETHODIMP
-SmsDatabaseService::GetThreadList(nsISmsRequest* aRequest)
-{
-  NS_ERROR("We should not be here!");
-  return NS_OK;
-}
-
 } // namespace sms
 } // namespace dom
 } // namespace mozilla
--- a/dom/sms/src/ipc/PSms.ipdl
+++ b/dom/sms/src/ipc/PSms.ipdl
@@ -48,29 +48,24 @@ struct GetNextMessageInListRequest
 };
 
 struct MarkMessageReadRequest
 {
   int32_t messageId;
   bool value;
 };
 
-struct GetThreadListRequest
-{
-};
-
 union IPCSmsRequest
 {
   SendMessageRequest;
   GetMessageRequest;
   DeleteMessageRequest;
   CreateMessageListRequest;
   GetNextMessageInListRequest;
   MarkMessageReadRequest;
-  GetThreadListRequest;
 };
 
 sync protocol PSms {
     manager PContent;
     manages PSmsRequest;
 
 child:
   NotifyReceivedMessage(SmsMessageData aMessageData);
--- a/dom/sms/src/ipc/PSmsRequest.ipdl
+++ b/dom/sms/src/ipc/PSmsRequest.ipdl
@@ -80,47 +80,27 @@ struct ReplyMarkeMessageReadFail
 {
   int32_t error;
 };
 
 struct ReplyNoMessageInList
 {
 };
 
-struct ThreadListItem
-{
-  nsString senderOrReceiver;
-  uint64_t timestamp;
-  nsString body;
-  uint64_t unreadCount;
-};
-
-struct ReplyThreadList
-{
-  ThreadListItem[] items;
-};
-
-struct ReplyThreadListFail
-{
-  int32_t error;
-};
-
 union MessageReply
 {
   ReplyMessageSend;
   ReplyMessageSendFail;
   ReplyGetMessage;
   ReplyGetMessageFail;
   ReplyMessageDelete;
   ReplyMessageDeleteFail;
   ReplyNoMessageInList;
   ReplyCreateMessageList;
   ReplyCreateMessageListFail;
   ReplyGetNextMessage;
   ReplyMarkeMessageRead;
   ReplyMarkeMessageReadFail;
-  ReplyThreadList;
-  ReplyThreadListFail;
 };
 
 } // namespace sms
 } // namespace dom
 } // namespace mozilla
--- a/dom/sms/src/ipc/SmsChild.cpp
+++ b/dom/sms/src/ipc/SmsChild.cpp
@@ -156,24 +156,16 @@ SmsRequestChild::Recv__delete__(const Me
       mReplyRequest->NotifyNextMessageInListGot(message);
       break;
     case MessageReply::TReplyMarkeMessageRead:
       mReplyRequest->NotifyMessageMarkedRead(aReply.get_ReplyMarkeMessageRead().read());
       break;
     case MessageReply::TReplyMarkeMessageReadFail:
       mReplyRequest->NotifyMarkMessageReadFailed(aReply.get_ReplyMarkeMessageReadFail().error());
       break;
-    case MessageReply::TReplyThreadList: {
-      SmsRequestForwarder* forwarder = static_cast<SmsRequestForwarder*>(mReplyRequest.get());
-      SmsRequest* request = static_cast<SmsRequest*>(forwarder->GetRealRequest());
-      request->NotifyThreadList(aReply.get_ReplyThreadList().items());
-    } break;
-    case MessageReply::TReplyThreadListFail:
-      mReplyRequest->NotifyThreadListFailed(aReply.get_ReplyThreadListFail().error());
-      break;
     default:
       MOZ_NOT_REACHED("Received invalid response parameters!");
       return false;
   }
 
   return true;
 }
 
--- a/dom/sms/src/ipc/SmsIPCService.cpp
+++ b/dom/sms/src/ipc/SmsIPCService.cpp
@@ -174,18 +174,11 @@ NS_IMETHODIMP
 SmsIPCService::MarkMessageRead(int32_t aMessageId,
                                bool aValue,
                                nsISmsRequest* aRequest)
 {
   SendRequest(MarkMessageReadRequest(aMessageId, aValue), aRequest);
   return NS_OK;
 }
 
-NS_IMETHODIMP
-SmsIPCService::GetThreadList(nsISmsRequest* aRequest)
-{
-  SendRequest(GetThreadListRequest(), aRequest);
-  return NS_OK;
-}
-
 } // namespace sms
 } // namespace dom
 } // namespace mozilla
--- a/dom/sms/src/ipc/SmsParent.cpp
+++ b/dom/sms/src/ipc/SmsParent.cpp
@@ -198,18 +198,16 @@ SmsParent::RecvPSmsRequestConstructor(PS
     case IPCSmsRequest::TGetMessageRequest:
       return actor->DoRequest(aRequest.get_GetMessageRequest());
     case IPCSmsRequest::TDeleteMessageRequest:
       return actor->DoRequest(aRequest.get_DeleteMessageRequest());
     case IPCSmsRequest::TGetNextMessageInListRequest:
       return actor->DoRequest(aRequest.get_GetNextMessageInListRequest());
     case IPCSmsRequest::TMarkMessageReadRequest:
       return actor->DoRequest(aRequest.get_MarkMessageReadRequest());
-    case IPCSmsRequest::TGetThreadListRequest:
-      return actor->DoRequest(aRequest.get_GetThreadListRequest());
     default:
       MOZ_NOT_REACHED("Unknown type!");
       return false;
   }
 
   MOZ_NOT_REACHED("Should never get here!");
   return false;
 }
@@ -344,26 +342,11 @@ SmsRequestParent::DoRequest(const MarkMe
   mSmsRequest = SmsRequest::Create(this);
   nsCOMPtr<nsISmsRequest> forwarder = new SmsRequestForwarder(mSmsRequest);
   nsresult rv = smsDBService->MarkMessageRead(aRequest.messageId(), aRequest.value(), forwarder);
   NS_ENSURE_SUCCESS(rv, false);
 
   return true;
 }
 
-bool
-SmsRequestParent::DoRequest(const GetThreadListRequest& aRequest)
-{
-  nsCOMPtr<nsISmsDatabaseService> smsDBService =
-    do_GetService(SMS_DATABASE_SERVICE_CONTRACTID);
-
-  NS_ENSURE_TRUE(smsDBService, true);
-  mSmsRequest = SmsRequest::Create(this);
-  nsCOMPtr<nsISmsRequest> forwarder = new SmsRequestForwarder(mSmsRequest);
-  nsresult rv = smsDBService->GetThreadList(forwarder);
-  NS_ENSURE_SUCCESS(rv, false);
-
-  return true;
-}
-
 } // namespace sms
 } // namespace dom
 } // namespace mozilla
--- a/dom/sms/src/ipc/SmsParent.h
+++ b/dom/sms/src/ipc/SmsParent.h
@@ -98,18 +98,15 @@ protected:
   bool
   DoRequest(const CreateMessageListRequest& aRequest);
 
   bool
   DoRequest(const GetNextMessageInListRequest& aRequest);
 
   bool
   DoRequest(const MarkMessageReadRequest& aRequest);
-
-  bool
-  DoRequest(const GetThreadListRequest& aRequest);
 };
 
 } // namespace sms
 } // namespace dom
 } // namespace mozilla
 
 #endif // mozilla_dom_sms_SmsParent_h
--- a/dom/sms/src/ril/SmsDatabaseService.js
+++ b/dom/sms/src/ril/SmsDatabaseService.js
@@ -9,19 +9,18 @@ const {classes: Cc, interfaces: Ci, util
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://gre/modules/Services.jsm");
 
 const RIL_SMSDATABASESERVICE_CONTRACTID = "@mozilla.org/sms/rilsmsdatabaseservice;1";
 const RIL_SMSDATABASESERVICE_CID = Components.ID("{a1fa610c-eb6c-4ac2-878f-b005d5e89249}");
 
 const DEBUG = false;
 const DB_NAME = "sms";
-const DB_VERSION = 4;
+const DB_VERSION = 3;
 const STORE_NAME = "sms";
-const MOST_RECENT_STORE_NAME = "most-recent";
 
 const DELIVERY_SENT = "sent";
 const DELIVERY_RECEIVED = "received";
 
 const DELIVERY_STATUS_NOT_APPLICABLE = "not-applicable";
 const DELIVERY_STATUS_SUCCESS = "success";
 const DELIVERY_STATUS_PENDING = "pending";
 const DELIVERY_STATUS_ERROR = "error";
@@ -48,20 +47,16 @@ XPCOMUtils.defineLazyServiceGetter(this,
                                    "nsISmsService");
 
 XPCOMUtils.defineLazyServiceGetter(this, "gIDBManager",
                                    "@mozilla.org/dom/indexeddb/manager;1",
                                    "nsIIndexedDatabaseManager");
 
 const GLOBAL_SCOPE = this;
 
-function numberFromMessage(message) {
-  return message.delivery == DELIVERY_SENT ? message.receiver : message.sender;
-}
-
 /**
  * SmsDatabaseService
  */
 function SmsDatabaseService() {
   // Prime the directory service's cache to ensure that the ProfD entry exists
   // by the time IndexedDB queries for it off the main thread. (See bug 743635.)
   Services.dirsvc.get("ProfD", Ci.nsIFile);
 
@@ -176,28 +171,24 @@ SmsDatabaseService.prototype = {
             let objectStore = event.target.transaction.objectStore(STORE_NAME);
             self.upgradeSchema(objectStore);
             break;
           case 2:
             if (DEBUG) debug("Upgrade to version 3. Fix existing entries.")
             objectStore = event.target.transaction.objectStore(STORE_NAME);
             self.upgradeSchema2(objectStore);
             break;
-          case 3:
-            if (DEBUG) debug("Upgrade to version 4. Add quick threads view.")
-            self.upgradeSchema3(event.target.transaction);
-            break;
           default:
             event.target.transaction.abort();
             callback("Old database version: " + event.oldVersion, null);
             break;
         }
         currentVersion++;
       }
-    }
+    };
     request.onerror = function (event) {
       //TODO look at event.target.Code and change error constant accordingly
       callback("Error opening database!", null);
     };
     request.onblocked = function (event) {
       callback("Opening database request is blocked.", null);
     };
   },
@@ -205,78 +196,63 @@ SmsDatabaseService.prototype = {
   /**
    * Start a new transaction.
    *
    * @param txn_type
    *        Type of transaction (e.g. READ_WRITE)
    * @param callback
    *        Function to call when the transaction is available. It will
    *        be invoked with the transaction and the 'sms' object store.
-   * @param objectStores
-   *        Function to call when the transaction is available. It will
-   *        be invoked with the transaction and the 'sms' object store.
    */
-  newTxn: function newTxn(txn_type, callback, objectStores) {
-    if (!objectStores) {
-      objectStores = [STORE_NAME];
-    }
-    if (DEBUG) debug("Opening transaction for objectStores: " + objectStores);
+  newTxn: function newTxn(txn_type, callback) {
     this.ensureDB(function (error, db) {
       if (error) {
         if (DEBUG) debug("Could not open database: " + error);
         callback(error);
         return;
       }
-      let txn = db.transaction(objectStores, txn_type);
+      let txn = db.transaction([STORE_NAME], txn_type);
       if (DEBUG) debug("Started transaction " + txn + " of type " + txn_type);
       if (DEBUG) {
         txn.oncomplete = function oncomplete(event) {
           debug("Transaction " + txn + " completed.");
         };
         txn.onerror = function onerror(event) {
           //TODO check event.target.errorCode and show an appropiate error
           //     message according to it.
           debug("Error occurred during transaction: " + event.target.errorCode);
         };
       }
-      let stores;
-      if (objectStores.length == 1) {
-        if (DEBUG) debug("Retrieving object store " + objectStores[0]);
-        stores = txn.objectStore(objectStores[0]);
-      } else {
-        stores = [];
-        for each (let storeName in objectStores) {
-          if (DEBUG) debug("Retrieving object store " + storeName);
-          stores.push(txn.objectStore(storeName));
-        }
-      }
-      callback(null, txn, stores);
+      if (DEBUG) debug("Retrieving object store", STORE_NAME);
+      let store = txn.objectStore(STORE_NAME);
+      callback(null, txn, store);
     });
   },
 
   /**
    * Create the initial database schema.
    *
    * TODO need to worry about number normalization somewhere...
    * TODO full text search on body???
    */
   createSchema: function createSchema(db) {
-    // This objectStore holds the main SMS data.
     let objectStore = db.createObjectStore(STORE_NAME, { keyPath: "id" });
+    objectStore.createIndex("id", "id", { unique: true });
     objectStore.createIndex("delivery", "delivery", { unique: false });
     objectStore.createIndex("sender", "sender", { unique: false });
     objectStore.createIndex("receiver", "receiver", { unique: false });
     objectStore.createIndex("timestamp", "timestamp", { unique: false });
     if (DEBUG) debug("Created object stores and indexes");
   },
 
   /**
    * Upgrade to the corresponding database schema version.
    */
   upgradeSchema: function upgradeSchema(objectStore) {
+    // For now, the only possible upgrade is to version 2.
     objectStore.createIndex("read", "read", { unique: false });  
   },
 
   upgradeSchema2: function upgradeSchema2(objectStore) {
     objectStore.openCursor().onsuccess = function(event) {
       let cursor = event.target.result;
       if (!cursor) {
         return;
@@ -285,39 +261,16 @@ SmsDatabaseService.prototype = {
       let message = cursor.value;
       message.messageClass = MESSAGE_CLASS_NORMAL;
       message.deliveryStatus = DELIVERY_STATUS_NOT_APPLICABLE;
       cursor.update(message);
       cursor.continue();
     }
   },
 
-  upgradeSchema3: function upgradeSchema2(transaction) {
-    // Delete redundant "id" index.
-    let objectStore = transaction.objectStore(STORE_NAME);
-    if (objectStore.indexNames.contains("id")) {
-      objectStore.deleteIndex("id");
-    }
-
-    /**
-     * This objectStore can be used to quickly construct a thread view of the
-     * SMS database. Each entry looks like this:
-     *
-     * { senderOrReceiver: <String> (primary key),
-     *   id: <Number>,
-     *   timestamp: <Date>,
-     *   body: <String>,
-     *   unreadCount: <Number> }
-     *
-     */
-    objectStore = db.createObjectStore(MOST_RECENT_STORE_NAME,
-                                       { keyPath: "senderOrReceiver" });
-    objectStore.createIndex("timestamp", "timestamp");
-  },
-
   /**
    * Helper function to make the intersection of the partial result arrays
    * obtained within createMessageList.
    *
    * @param keys
    *        Object containing the partial result arrays.
    * @param fiter
    *        Object containing the filter search criteria used to retrieved the
@@ -397,53 +350,22 @@ SmsDatabaseService.prototype = {
       };
     });
   },
 
   saveMessage: function saveMessage(message) {
     this.lastKey += 1;
     message.id = this.lastKey;
     if (DEBUG) debug("Going to store " + JSON.stringify(message));
-    this.newTxn(READ_WRITE, function(error, txn, stores) {
+    this.newTxn(READ_WRITE, function(error, txn, store) {
       if (error) {
         return;
       }
-      // First add to main objectStore.
-      stores[0].put(message);
-
-      let number = numberFromMessage(message);
-
-      // Next update the other objectStore.
-      stores[1].get(number).onsuccess = function(event) {
-        let mostRecentEntry = event.target.result;
-        if (mostRecentEntry) {
-          let needsUpdate = false;
-
-          if (mostRecentEntry.timestamp <= message.timestamp) {
-            mostRecentEntry.timestamp = message.timestamp;
-            mostRecentEntry.body = message.body;
-            needsUpdate = true;
-          }
-
-          if (!message.read) {
-            mostRecentEntry.unreadCount++;
-            needsUpdate = true;
-          }
-
-          if (needsUpdate) {
-            event.target.source.put(mostRecentEntry);
-          }
-        } else {
-          event.target.source.add({ senderOrReceiver: number,
-                                    timestamp: message.timestamp,
-                                    body: message.body,
-                                    unreadCount: message.read ? 0 : 1 });
-        }
-      }
-    }, [STORE_NAME, MOST_RECENT_STORE_NAME]);
+      let request = store.put(message);
+    });
     // We return the key that we expect to store in the db
     return message.id;
   },
 
 
   /**
    * nsISmsDatabaseService API
    */
@@ -573,113 +495,43 @@ SmsDatabaseService.prototype = {
         aRequest.notifyGetMessageFailed(Ci.nsISmsRequest.INTERNAL_ERROR);
       };
     });
   },
 
   deleteMessage: function deleteMessage(messageId, aRequest) {
     let deleted = false;
     let self = this;
-    this.newTxn(READ_WRITE, function (error, txn, stores) {
+    this.newTxn(READ_WRITE, function (error, txn, store) {
       if (error) {
         aRequest.notifyDeleteMessageFailed(Ci.nsISmsRequest.INTERNAL_ERROR);
         return;
       }
-      txn.onerror = function onerror(event) {
-        if (DEBUG) debug("Caught error on transaction", event.target.errorCode);
-        //TODO look at event.target.errorCode, pick appropriate error constant
-        aRequest.notifyDeleteMessageFailed(Ci.nsISmsRequest.INTERNAL_ERROR);
+      let request = store.count(messageId);
+
+      request.onsuccess = function onsuccess(event) {        
+        let count = event.target.result;
+        if (DEBUG) debug("Count for messageId " + messageId + ": " + count);
+        deleted = (count == 1);
+        if (deleted) {
+          store.delete(messageId);
+        }
       };
 
-      const smsStore = stores[0];
-      const mruStore = stores[1];
-
-      let deleted = false;
-
       txn.oncomplete = function oncomplete(event) {
         if (DEBUG) debug("Transaction " + txn + " completed.");
         aRequest.notifyMessageDeleted(deleted);
       };
 
-      smsStore.get(messageId).onsuccess = function(event) {
-        let message = event.target.result;
-        if (message) {
-          if (DEBUG) debug("Deleting message id " + messageId);
-
-          // First actually delete the message.
-          event.target.source.delete(messageId).onsuccess = function(event) {
-            deleted = true;
-
-            // Then update unread count and most recent message.
-            let number = numberFromMessage(message);
-
-            mruStore.get(number).onsuccess = function(event) {
-              // This must exist.
-              let mostRecentEntry = event.target.result;
-
-              if (!message.read) {
-                mostRecentEntry.unreadCount--;
-              }
-
-              if (mostRecentEntry.id == messageId) {
-                // This sucks, we have to find a new most-recent message.
-                message = null;
-
-                // Check most recent sender.
-                smsStore.index("sender").openCursor(number, "prev").onsuccess = function(event) {
-                  let cursor = event.target.result;
-                  if (cursor) {
-                    message = cursor.value;
-                  }
-                };
-
-                // Check most recent receiver.
-                smsStore.index("receiver").openCursor(number, "prev").onsuccess = function(event) {
-                  let cursor = event.target.result;
-                  if (cursor) {
-                    if (!message || cursor.value.timeStamp > message.timestamp) {
-                      message = cursor.value;
-                    }
-                  }
-
-                  // If we found a new message then we need to update the data
-                  // in the most-recent store. Otherwise we can delete it.
-                  if (message) {
-                    mostRecentEntry.id = message.id;
-                    mostRecentEntry.timestamp = message.timestamp;
-                    mostRecentEntry.body = message.body;
-                    if (DEBUG) {
-                      debug("Updating mru entry: " +
-                            JSON.stringify(mostRecentEntry));
-                    }
-                    mruStore.put(mostRecentEntry);
-                  }
-                  else {
-                    if (DEBUG) {
-                      debug("Deleting mru entry for number '" + number + "'");
-                    }
-                    mruStore.delete(number);
-                  }
-                };
-              } else if (!message.read) {
-                // Shortcut, just update the unread count.
-                if (DEBUG) {
-                  debug("Updating unread count for number '" + number + "': " +
-                        (mostRecentEntry.unreadCount + 1) + " -> " +
-                        mostRecentEntry.unreadCount);
-                }
-                mruStore.put(mostRecentEntry);
-              }
-            };
-          };
-        } else if (DEBUG) {
-          debug("Message id " + messageId + " does not exist");
-        }
+      txn.onerror = function onerror(event) {
+        if (DEBUG) debug("Caught error on transaction", event.target.errorCode);
+        //TODO look at event.target.errorCode, pick appropriate error constant
+        aRequest.notifyDeleteMessageFailed(Ci.nsISmsRequest.INTERNAL_ERROR);
       };
-    }, [STORE_NAME, MOST_RECENT_STORE_NAME]);
+    });
   },
 
   createMessageList: function createMessageList(filter, reverse, aRequest) {
     if (DEBUG) {
       debug("Creating a message list. Filters:" +
             " startDate: " + filter.startDate +
             " endDate: " + filter.endDate +
             " delivery: " + filter.delivery +
@@ -700,17 +552,17 @@ SmsDatabaseService.prototype = {
     // Callback function to iterate through request results via IDBCursor.
     let successCb = function onsuccess(result, filter) {
       // Once the cursor has retrieved all keys that matches its key range,
       // the filter search is done.
       if (!result) {
         if (DEBUG) {
           debug("These messages match the " + filter + " filter: " +
                 filteredKeys[filter]);
-        }
+      }
         return;
       }
       // The cursor primaryKey is stored in its corresponding partial array
       // according to the filter parameter.
       let primaryKey = result.primaryKey;
       filteredKeys[filter].push(primaryKey);
       result.continue();
     };
@@ -870,30 +722,28 @@ SmsDatabaseService.prototype = {
 
   clearMessageList: function clearMessageList(listId) {
     if (DEBUG) debug("Clearing message list: " + listId);
     delete this.messageLists[listId];
   },
 
   markMessageRead: function markMessageRead(messageId, value, aRequest) {
     if (DEBUG) debug("Setting message " + messageId + " read to " + value);
-    this.newTxn(READ_WRITE, function (error, txn, stores) {
+    this.newTxn(READ_WRITE, function (error, txn, store) {
       if (error) {
         if (DEBUG) debug(error);
         aRequest.notifyMarkMessageReadFailed(Ci.nsISmsRequest.INTERNAL_ERROR);
         return;
       }
-      txn.onerror = function onerror(event) {
-        if (DEBUG) debug("Caught error on transaction ", event.target.errorCode);
-        aRequest.notifyMarkMessageReadFailed(Ci.nsISmsRequest.INTERNAL_ERROR);
-      };
-      stores[0].get(messageId).onsuccess = function onsuccess(event) {
+      let getRequest = store.get(messageId);
+
+      getRequest.onsuccess = function onsuccess(event) {
         let message = event.target.result;
+        if (DEBUG) debug("Message ID " + messageId + " not found");
         if (!message) {
-          if (DEBUG) debug("Message ID " + messageId + " not found");
           aRequest.notifyMarkMessageReadFailed(Ci.nsISmsRequest.NOT_FOUND_ERROR);
           return;
         }
         if (message.id != messageId) {
           if (DEBUG) {
             debug("Retrieve message ID (" + messageId + ") is " +
                   "different from the one we got");
           }
@@ -904,60 +754,36 @@ SmsDatabaseService.prototype = {
         // value, we just notify successfully.
         if (message.read == value) {
           if (DEBUG) debug("The value of message.read is already " + value);
           aRequest.notifyMessageMarkedRead(message.read);
           return;
         }
         message.read = value ? FILTER_READ_READ : FILTER_READ_UNREAD;
         if (DEBUG) debug("Message.read set to: " + value);
-        event.target.source.put(message).onsuccess = function onsuccess(event) {
+        let putRequest = store.put(message);
+        putRequest.onsuccess = function onsuccess(event) {
           if (DEBUG) {
             debug("Update successfully completed. Message: " +
                   JSON.stringify(event.target.result));
           }
-
-          // Now update the unread count.
-          let number = numberFromMessage(message);
+          let checkRequest = store.get(message.id);
+          checkRequest.onsuccess = function onsuccess(event) {
+            aRequest.notifyMessageMarkedRead(event.target.result.read);
+          };
+        }
+      };
 
-          stores[1].get(number).onsuccess = function(event) {
-            let mostRecentEntry = event.target.result;
-            mostRecentEntry.unreadCount += value ? -1 : 1;
-            if (DEBUG) {
-              debug("Updating unreadCount for '" + number + "': " +
-                    (value ?
-                     mostRecentEntry.unreadCount + 1 :
-                     mostRecentEntry.unreadCount - 1) +
-                    " -> " + mostRecentEntry.unreadCount);
-            }
-            event.target.source.put(mostRecentEntry).onsuccess = function(event) {
-              aRequest.notifyMessageMarkedRead(message.read);
-            };
-          };
-        };
-      };
-    }, [STORE_NAME, MOST_RECENT_STORE_NAME]);
-  },
-  getThreadList: function getThreadList(aRequest) {
-    if (DEBUG) debug("Getting thread list");
-    this.newTxn(READ_ONLY, function (error, txn, store) {
-      if (error) {
-        if (DEBUG) debug(error);
-        aRequest.notifyThreadListFailed(Ci.nsISmsRequest.INTERNAL_ERROR);
-        return;
-      }
       txn.onerror = function onerror(event) {
         if (DEBUG) debug("Caught error on transaction ", event.target.errorCode);
-        aRequest.notifyThreadListFailed(Ci.nsISmsRequest.INTERNAL_ERROR);
+        aRequest.notifyMarkMessageReadFailed(Ci.nsISmsRequest.INTERNAL_ERROR);
       };
-      store.index("timestamp").mozGetAll().onsuccess = function(event) {
-        aRequest.notifyThreadList(event.target.result);
-      };
-    }, [MOST_RECENT_STORE_NAME]);
+    });
   }
+
 };
 
 XPCOMUtils.defineLazyGetter(SmsDatabaseService.prototype, "mRIL", function () {
     return Cc["@mozilla.org/telephony/system-worker-manager;1"]
               .getService(Ci.nsIInterfaceRequestor)
               .getInterface(Ci.nsIRadioInterfaceLayer);
 });
 
--- a/js/xpconnect/src/dictionary_helper_gen.conf
+++ b/js/xpconnect/src/dictionary_helper_gen.conf
@@ -16,18 +16,17 @@ dictionaries = [
      [ 'XMLHttpRequestParameters', 'nsIXMLHttpRequest.idl' ],
      [ 'DeviceStorageEnumerationParameters', 'nsIDOMDeviceStorage.idl' ],
      [ 'CameraSize', 'nsIDOMCameraManager.idl' ],
      [ 'CameraRegion', 'nsIDOMCameraManager.idl' ],
      [ 'CameraPosition', 'nsIDOMCameraManager.idl' ],
      [ 'CameraSelector', 'nsIDOMCameraManager.idl' ],
      [ 'CameraPictureOptions', 'nsIDOMCameraManager.idl' ],
      [ 'CameraRecordingOptions', 'nsIDOMCameraManager.idl' ],
-     [ 'ArchiveReaderOptions', 'nsIDOMArchiveReader.idl' ],
-     [ 'SmsThreadListItem', 'nsISmsRequest.idl' ]
+     [ 'ArchiveReaderOptions', 'nsIDOMArchiveReader.idl' ]
    ]
 
 # include file names
 special_includes = [
     'nsContentUtils.h',
     'XPCQuickStubs.h',
     'nsIDOMApplicationRegistry.h'
   ]