Backout 6c1ded13556d (bug 720643), 5cf0a12c1cf0, ac771e54d7ca & 3bb24b12b0d6 (bug 720632) for Android build failures
authorEd Morley <bmo@edmorley.co.uk>
Thu, 16 Feb 2012 23:18:45 +0000
changeset 87051 d2e1b248f40d4743d374f299eaa944232ac547b0
parent 87050 e441f32d7eba0ea35353d52f03d721140db0ccd6
child 87052 d16c61316cf43fa622d13344c0d50d41525403c6
push id6179
push userbmo@edmorley.co.uk
push dateThu, 16 Feb 2012 23:18:54 +0000
treeherdermozilla-inbound@d2e1b248f40d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs720643, 720632
milestone13.0a1
backs out6c1ded13556d9e6e7063c9345caf8a384f954ab7
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 6c1ded13556d (bug 720643), 5cf0a12c1cf0, ac771e54d7ca & 3bb24b12b0d6 (bug 720632) for Android build failures
dom/sms/interfaces/Makefile.in
dom/sms/interfaces/nsISmsRequestManager.idl
dom/sms/src/SmsCursor.cpp
dom/sms/src/SmsManager.cpp
dom/sms/src/SmsRequest.cpp
dom/sms/src/SmsRequest.h
dom/sms/src/SmsRequestManager.cpp
dom/sms/src/SmsRequestManager.h
dom/sms/src/ipc/SmsChild.cpp
dom/sms/src/ril/SmsService.cpp
dom/system/b2g/RadioInterfaceLayer.js
dom/system/b2g/nsIRadioInterfaceLayer.idl
dom/system/b2g/ril_worker.js
embedding/android/GeckoSmsManager.java
layout/build/nsLayoutModule.cpp
layout/build/nsLayoutStatics.cpp
--- a/dom/sms/interfaces/Makefile.in
+++ b/dom/sms/interfaces/Makefile.in
@@ -43,19 +43,18 @@ include $(DEPTH)/config/autoconf.mk
 
 XPIDL_MODULE = dom_sms
 
 include $(topsrcdir)/dom/dom-config.mk
 
 XPIDLSRCS = \
   nsIDOMNavigatorSms.idl \
   nsIDOMSmsManager.idl \
+  nsISmsService.idl \
   nsIDOMSmsMessage.idl \
   nsIDOMSmsEvent.idl \
+  nsISmsDatabaseService.idl \
   nsIDOMSmsRequest.idl \
   nsIDOMSmsFilter.idl \
   nsIDOMSmsCursor.idl \
-  nsISmsDatabaseService.idl \
-  nsISmsRequestManager.idl \
-  nsISmsService.idl \
   $(NULL)
 
 include $(topsrcdir)/config/rules.mk
deleted file mode 100644
--- a/dom/sms/interfaces/nsISmsRequestManager.idl
+++ /dev/null
@@ -1,80 +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"
-
-interface nsIDOMMozSmsMessage;
-interface nsIDOMMozSmsRequest;
-interface nsPIDOMWindow;
-interface nsIScriptContext;
-
-%{C++
-#define SMS_REQUEST_MANAGER_CID \
-{ 0xa97a3129, 0x1e0b, 0x45da,    \
-{ 0xa3, 0x85, 0xcf, 0xe5, 0xb0, 0xb1, 0xc4, 0x8f } }
-#define SMS_REQUEST_MANAGER_CONTRACTID "@mozilla.org/sms/smsrequestmanager;1"
-%}
-
-[scriptable, uuid(1638b963-3a45-4937-b6a9-280c1bfb166c)]
-interface nsISmsRequestManager : 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 NO_ERROR        = 0;
-  const unsigned short NO_SIGNAL_ERROR = 1;
-  const unsigned short NOT_FOUND_ERROR = 2;
-  const unsigned short UNKNOWN_ERROR   = 3;
-  const unsigned short INTERNAL_ERROR  = 4;
-
-  /**
-   * Create a new request object.
-   *
-   * @return the request ID.
-   */
-  long createRequest(in nsPIDOMWindow aWindow,
-                     in nsIScriptContext aScriptContext,
-                     out nsIDOMMozSmsRequest aRequest);
-
-  /**
-   * Track an already existing request object.
-   *
-   * @return the request ID.
-   */
-  long addRequest(in nsIDOMMozSmsRequest aRequest);
-
-  void notifySmsSent(in long aRequestId,
-                     in nsIDOMMozSmsMessage aMessage);
-
-  void notifySmsSendFailed(in long aRequestId,
-                           in long aError);
-
-  void notifyGotSms(in long aRequestId,
-                    in nsIDOMMozSmsMessage aMessage);
-
-  void notifyGetSmsFailed(in long aRequestId,
-                          in long aError);
-
-  void notifySmsDeleted(in long aRequestId,
-                        in bool aDeleted);
-
-  void notifySmsDeleteFailed(in long aRequestId,
-                             in long aError);
-
-  void notifyNoMessageInList(in long aRequestId);
-
-  void notifyCreateMessageList(in long aRequestId,
-                               in long aListId,
-                               in nsIDOMMozSmsMessage aMessage);
-
-  void notifyGotNextMessage(in long aRequestId,
-                            in nsIDOMMozSmsMessage aMessage);
-
-  void notifyReadMessageListFailed(in long aRequestId,
-                                   in long aError);
-
-};
--- a/dom/sms/src/SmsCursor.cpp
+++ b/dom/sms/src/SmsCursor.cpp
@@ -110,21 +110,17 @@ SmsCursor::Continue()
   // No message means we are waiting for a message or we got the last one.
   if (!mMessage) {
     return NS_ERROR_DOM_INVALID_STATE_ERR;
   }
 
   mMessage = nsnull;
   static_cast<SmsRequest*>(mRequest.get())->Reset();
 
-  nsCOMPtr<nsISmsRequestManager> requestManager = do_GetService(SMS_REQUEST_MANAGER_CONTRACTID);
-
-  PRInt32 requestId;
-  nsresult rv = requestManager->AddRequest(mRequest, &requestId);
-  NS_ENSURE_SUCCESS(rv, rv);
+  PRInt32 requestId = SmsRequestManager::GetInstance()->AddRequest(mRequest);
 
   nsCOMPtr<nsISmsDatabaseService> smsDBService =
     do_GetService(SMS_DATABASE_SERVICE_CONTRACTID);
   NS_ENSURE_TRUE(smsDBService, NS_ERROR_FAILURE);
 
   smsDBService->GetNextMessageInList(mListId, requestId, 0);
 
   return NS_OK;
--- a/dom/sms/src/SmsManager.cpp
+++ b/dom/sms/src/SmsManager.cpp
@@ -141,33 +141,27 @@ SmsManager::Send(JSContext* aCx, JSObjec
   nsCOMPtr<nsISmsService> smsService = do_GetService(SMS_SERVICE_CONTRACTID);
   if (!smsService) {
     NS_ERROR("No SMS Service!");
     return NS_ERROR_FAILURE;
   }
 
   nsCOMPtr<nsIDOMMozSmsRequest> request;
 
-  nsCOMPtr<nsISmsRequestManager> requestManager = do_GetService(SMS_REQUEST_MANAGER_CONTRACTID);
-
-  PRInt32 requestId;
-  nsresult rv = requestManager->CreateRequest(mOwner, mScriptContext,
-                                              getter_AddRefs(request),
-                                              &requestId);
-  if (NS_FAILED(rv)) {
-    NS_ERROR("Failed to create the request!");
-    return rv;
-  }
+  int requestId =
+    SmsRequestManager::GetInstance()->CreateRequest(mOwner, mScriptContext,
+                                                    getter_AddRefs(request));
+  NS_ASSERTION(request, "The request object must have been created!");
 
   nsDependentJSString number;
   number.init(aCx, aNumber);
 
   smsService->Send(number, aMessage, requestId, 0);
 
-  rv = nsContentUtils::WrapNative(aCx, aGlobal, request, aRequest);
+  nsresult rv = nsContentUtils::WrapNative(aCx, aGlobal, request, aRequest);
   if (NS_FAILED(rv)) {
     NS_ERROR("Failed to create the js value!");
     return rv;
   }
 
   return NS_OK;
 }
 
@@ -218,47 +212,35 @@ SmsManager::Send(const jsval& aNumber, c
   NS_ENSURE_TRUE(aReturn->isObject(), NS_ERROR_FAILURE);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 SmsManager::GetMessageMoz(PRInt32 aId, nsIDOMMozSmsRequest** aRequest)
 {
-  nsCOMPtr<nsISmsRequestManager> requestManager = do_GetService(SMS_REQUEST_MANAGER_CONTRACTID);
-
-  PRInt32 requestId;
-  nsresult rv = requestManager->CreateRequest(mOwner, mScriptContext, aRequest,
-                                              &requestId);
-  if (NS_FAILED(rv)) {
-    NS_ERROR("Failed to create the request!");
-    return rv;
-  }
+  int requestId =
+    SmsRequestManager::GetInstance()->CreateRequest(mOwner, mScriptContext, aRequest);
+  NS_ASSERTION(*aRequest, "The request object must have been created!");
 
   nsCOMPtr<nsISmsDatabaseService> smsDBService =
     do_GetService(SMS_DATABASE_SERVICE_CONTRACTID);
   NS_ENSURE_TRUE(smsDBService, NS_ERROR_FAILURE);
 
   smsDBService->GetMessageMoz(aId, requestId, 0);
 
   return NS_OK;
 }
 
 nsresult
 SmsManager::Delete(PRInt32 aId, nsIDOMMozSmsRequest** aRequest)
 {
-  nsCOMPtr<nsISmsRequestManager> requestManager = do_GetService(SMS_REQUEST_MANAGER_CONTRACTID);
-
-  PRInt32 requestId;
-  nsresult rv = requestManager->CreateRequest(mOwner, mScriptContext, aRequest,
-                                              &requestId);
-  if (NS_FAILED(rv)) {
-    NS_ERROR("Failed to create the request!");
-    return rv;
-  }
+  int requestId =
+    SmsRequestManager::GetInstance()->CreateRequest(mOwner, mScriptContext, aRequest);
+  NS_ASSERTION(*aRequest, "The request object must have been created!");
 
   nsCOMPtr<nsISmsDatabaseService> smsDBService =
     do_GetService(SMS_DATABASE_SERVICE_CONTRACTID);
   NS_ENSURE_TRUE(smsDBService, NS_ERROR_FAILURE);
 
   smsDBService->DeleteMessage(aId, requestId, 0);
 
   return NS_OK;
@@ -291,25 +273,19 @@ SmsManager::GetMessages(nsIDOMMozSmsFilt
                         nsIDOMMozSmsRequest** aRequest)
 {
   nsCOMPtr<nsIDOMMozSmsFilter> filter = aFilter;
 
   if (!filter) {
     filter = new SmsFilter();
   }
 
-  nsCOMPtr<nsISmsRequestManager> requestManager = do_GetService(SMS_REQUEST_MANAGER_CONTRACTID);
-
-  PRInt32 requestId;
-  nsresult rv = requestManager->CreateRequest(mOwner, mScriptContext, aRequest,
-                                              &requestId);
-  if (NS_FAILED(rv)) {
-    NS_ERROR("Failed to create the request!");
-    return rv;
-  }
+  int requestId =
+    SmsRequestManager::GetInstance()->CreateRequest(mOwner, mScriptContext, aRequest);
+  NS_ASSERTION(*aRequest, "The request object must have been created!");
 
   nsCOMPtr<nsISmsDatabaseService> smsDBService =
     do_GetService(SMS_DATABASE_SERVICE_CONTRACTID);
   NS_ENSURE_TRUE(smsDBService, NS_ERROR_FAILURE);
 
   smsDBService->CreateMessageList(filter, aReverse, requestId, 0);
 
   return NS_OK;
--- a/dom/sms/src/SmsRequest.cpp
+++ b/dom/sms/src/SmsRequest.cpp
@@ -36,17 +36,16 @@
  * ***** END LICENSE BLOCK ***** */
 
 #include "SmsRequest.h"
 #include "nsIDOMClassInfo.h"
 #include "nsDOMString.h"
 #include "nsContentUtils.h"
 #include "nsIDOMSmsMessage.h"
 #include "nsIDOMSmsCursor.h"
-#include "nsISmsRequestManager.h"
 
 DOMCI_DATA(MozSmsRequest, mozilla::dom::sms::SmsRequest)
 
 namespace mozilla {
 namespace dom {
 namespace sms {
 
 NS_IMPL_CYCLE_COLLECTION_CLASS(SmsRequest)
@@ -88,17 +87,17 @@ NS_IMPL_ADDREF_INHERITED(SmsRequest, nsD
 NS_IMPL_RELEASE_INHERITED(SmsRequest, nsDOMEventTargetHelper)
 
 NS_IMPL_EVENT_HANDLER(SmsRequest, success)
 NS_IMPL_EVENT_HANDLER(SmsRequest, error)
 
 SmsRequest::SmsRequest(nsPIDOMWindow* aWindow, nsIScriptContext* aScriptContext)
   : mResult(JSVAL_VOID)
   , mResultRooted(false)
-  , mError(nsISmsRequestManager::NO_ERROR)
+  , mError(eNoError)
   , mDone(false)
 {
   // Those vars come from nsDOMEventTargetHelper.
   mOwner = aWindow;
   mScriptContext = aScriptContext;
 }
 
 SmsRequest::~SmsRequest()
@@ -108,18 +107,17 @@ SmsRequest::~SmsRequest()
   }
 }
 
 void
 SmsRequest::Reset()
 {
   NS_ASSERTION(mDone, "mDone should be true if we try to reset!");
   NS_ASSERTION(mResult != JSVAL_VOID, "mResult should be set if we try to reset!");
-  NS_ASSERTION(mError == nsISmsRequestManager::NO_ERROR,
-               "There should be no error if we try to reset!");
+  NS_ASSERTION(mError == eNoError, "There should be no error if we try to reset!");
 
   if (mResultRooted) {
     UnrootResult();
   }
 
   mResult = JSVAL_VOID;
   mDone = false;
 }
@@ -145,18 +143,17 @@ SmsRequest::SetSuccess(nsIDOMMozSmsMessa
 {
   SetSuccessInternal(aMessage);
 }
 
 void
 SmsRequest::SetSuccess(bool aResult)
 {
   NS_PRECONDITION(!mDone, "mDone shouldn't have been set to true already!");
-  NS_PRECONDITION(mError == nsISmsRequestManager::NO_ERROR,
-                  "mError shouldn't have been set!");
+  NS_PRECONDITION(mError == eNoError, "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)
@@ -172,52 +169,50 @@ SmsRequest::SetSuccess(nsIDOMMozSmsCurso
     mCursor = aCursor;
   }
 }
 
 bool
 SmsRequest::SetSuccessInternal(nsISupports* aObject)
 {
   NS_PRECONDITION(!mDone, "mDone shouldn't have been set to true already!");
-  NS_PRECONDITION(mError == nsISmsRequestManager::NO_ERROR,
-                  "mError shouldn't have been set!");
+  NS_PRECONDITION(mError == eNoError, "mError shouldn't have been set!");
   NS_PRECONDITION(mResult == JSVAL_VOID, "mResult shouldn't have been set!");
 
   JSContext* cx = mScriptContext->GetNativeContext();
   NS_ASSERTION(cx, "Failed to get a context!");
 
   JSObject* global = mScriptContext->GetNativeGlobal();
   NS_ASSERTION(global, "Failed to get global object!");
 
   JSAutoRequest ar(cx);
   JSAutoEnterCompartment ac;
   if (!ac.enter(cx, global)) {
-    SetError(nsISmsRequestManager::INTERNAL_ERROR);
+    SetError(eInternalError);
     return false;
   }
 
   RootResult();
 
   if (NS_FAILED(nsContentUtils::WrapNative(cx, global, aObject, &mResult))) {
     UnrootResult();
     mResult = JSVAL_VOID;
-    SetError(nsISmsRequestManager::INTERNAL_ERROR);
+    SetError(eInternalError);
     return false;
   }
 
   mDone = true;
   return true;
 }
 
 void
-SmsRequest::SetError(PRInt32 aError)
+SmsRequest::SetError(ErrorType aError)
 {
   NS_PRECONDITION(!mDone, "mDone shouldn't have been set to true already!");
-  NS_PRECONDITION(mError == nsISmsRequestManager::NO_ERROR,
-                  "mError shouldn't have been set!");
+  NS_PRECONDITION(mError == eNoError, "mError shouldn't have been set!");
   NS_PRECONDITION(mResult == JSVAL_VOID, "mResult shouldn't have been set!");
 
   mDone = true;
   mError = aError;
   mCursor = nsnull;
 }
 
 NS_IMETHODIMP
@@ -231,45 +226,42 @@ SmsRequest::GetReadyState(nsAString& aRe
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 SmsRequest::GetError(nsAString& aError)
 {
   if (!mDone) {
-    NS_ASSERTION(mError == nsISmsRequestManager::NO_ERROR,
+    NS_ASSERTION(mError == eNoError,
                  "There should be no error if the request is still processing!");
 
     SetDOMStringToNull(aError);
     return NS_OK;
   }
 
-  NS_ASSERTION(mError == nsISmsRequestManager::NO_ERROR ||
-               mResult == JSVAL_VOID,
+  NS_ASSERTION(mError == eNoError || mResult == JSVAL_VOID,
                "mResult should be void when there is an error!");
 
   switch (mError) {
-    case nsISmsRequestManager::NO_ERROR:
+    case eNoError:
       SetDOMStringToNull(aError);
       break;
-    case nsISmsRequestManager::NO_SIGNAL_ERROR:
+    case eNoSignalError:
       aError.AssignLiteral("NoSignalError");
       break;
-    case nsISmsRequestManager::NOT_FOUND_ERROR:
+    case eNotFoundError:
       aError.AssignLiteral("NotFoundError");
       break;
-    case nsISmsRequestManager::UNKNOWN_ERROR:
+    case eUnknownError:
       aError.AssignLiteral("UnknownError");
       break;
-    case nsISmsRequestManager::INTERNAL_ERROR:
+    case eInternalError:
       aError.AssignLiteral("InternalError");
       break;
-    default:
-      MOZ_ASSERT(false, "Unknown error value.");
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 SmsRequest::GetResult(jsval* aResult)
 {
--- a/dom/sms/src/SmsRequest.h
+++ b/dom/sms/src/SmsRequest.h
@@ -49,16 +49,29 @@ namespace dom {
 namespace sms {
 
 class SmsRequest : public nsIDOMMozSmsRequest
                  , public nsDOMEventTargetHelper
 {
 public:
   friend class SmsRequestManager;
 
+  /**
+   * 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
+   */
+  enum ErrorType {
+    eNoError = 0,
+    eNoSignalError,
+    eNotFoundError,
+    eUnknownError,
+    eInternalError,
+  };
+
   NS_DECL_ISUPPORTS
   NS_DECL_NSIDOMMOZSMSREQUEST
 
   NS_FORWARD_NSIDOMEVENTTARGET(nsDOMEventTargetHelper::)
 
   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(SmsRequest,
                                                          nsDOMEventTargetHelper)
 
@@ -93,17 +106,17 @@ private:
   /**
    * Set the object in a success state with the result being a SmsCursor.
    */
   void SetSuccess(nsIDOMMozSmsCursor* aCursor);
 
   /**
    * Set the object in an error state with the error type being aError.
    */
-  void SetError(PRInt32 aError);
+  void SetError(ErrorType 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
    */
   bool SetSuccessInternal(nsISupports* aObject);
 
@@ -111,17 +124,17 @@ private:
    * Return the internal cursor that is saved when
    * SetSuccess(nsIDOMMozSmsCursor*) is used.
    * Returns null if this request isn't associated to an cursor.
    */
   nsIDOMMozSmsCursor* GetCursor();
 
   jsval     mResult;
   bool      mResultRooted;
-  PRInt32   mError;
+  ErrorType mError;
   bool      mDone;
   nsCOMPtr<nsIDOMMozSmsCursor> mCursor;
 
   NS_DECL_EVENT_HANDLER(success)
   NS_DECL_EVENT_HANDLER(error)
 };
 
 inline nsIDOMMozSmsCursor*
--- a/dom/sms/src/SmsRequestManager.cpp
+++ b/dom/sms/src/SmsRequestManager.cpp
@@ -46,69 +46,85 @@
  */
 #define SUCCESS_EVENT_NAME NS_LITERAL_STRING("success")
 #define ERROR_EVENT_NAME   NS_LITERAL_STRING("error")
 
 namespace mozilla {
 namespace dom {
 namespace sms {
 
-NS_IMPL_ISUPPORTS1(SmsRequestManager, nsISmsRequestManager)
+SmsRequestManager* SmsRequestManager::sInstance = nsnull;
+
+void
+SmsRequestManager::Init()
+{
+  NS_PRECONDITION(!sInstance,
+                  "sInstance shouldn't be set. Did you call Init() twice?");
+  sInstance = new SmsRequestManager();
+}
 
-NS_IMETHODIMP
-SmsRequestManager::AddRequest(nsIDOMMozSmsRequest* aRequest,
-                              PRInt32* aRequestId)
+void
+SmsRequestManager::Shutdown()
+{
+  NS_PRECONDITION(sInstance, "sInstance should be set. Did you call Init()?");
+
+  delete sInstance;
+  sInstance = nsnull;
+}
+
+/* static */ SmsRequestManager*
+SmsRequestManager::GetInstance()
+{
+  return sInstance;
+}
+
+PRInt32
+SmsRequestManager::AddRequest(nsIDOMMozSmsRequest* aRequest)
 {
   // TODO: merge with CreateRequest
   PRInt32 size = mRequests.Count();
 
   // Look for empty slots.
   for (PRInt32 i=0; i<size; ++i) {
     if (mRequests[i]) {
       continue;
     }
 
     mRequests.ReplaceObjectAt(aRequest, i);
-    *aRequestId = i;
-    return NS_OK;
+    return i;
   }
 
   mRequests.AppendObject(aRequest);
-  *aRequestId = size;
-  return NS_OK;
+  return size;
 }
 
-
-NS_IMETHODIMP
+PRInt32
 SmsRequestManager::CreateRequest(nsPIDOMWindow* aWindow,
                                  nsIScriptContext* aScriptContext,
-                                 nsIDOMMozSmsRequest** aRequest,
-                                 PRInt32* aRequestId)
+                                 nsIDOMMozSmsRequest** aRequest)
 {
   nsCOMPtr<nsIDOMMozSmsRequest> request =
     new SmsRequest(aWindow, aScriptContext);
 
   PRInt32 size = mRequests.Count();
 
   // Look for empty slots.
   for (PRInt32 i=0; i<size; ++i) {
     if (mRequests[i]) {
       continue;
     }
 
     mRequests.ReplaceObjectAt(request, i);
     NS_ADDREF(*aRequest = request);
-    *aRequestId = i;
-    return NS_OK;
+    return i;
   }
 
   mRequests.AppendObject(request);
   NS_ADDREF(*aRequest = request);
-  *aRequestId = size;
-  return NS_OK;
+  return size;
 }
 
 nsresult
 SmsRequestManager::DispatchTrustedEventToRequest(const nsAString& aEventName,
                                                  nsIDOMMozSmsRequest* aRequest)
 {
   nsRefPtr<nsDOMEvent> event = new nsDOMEvent(nsnull, nsnull);
   nsresult rv = event->InitEvent(aEventName, false, false);
@@ -128,123 +144,123 @@ SmsRequestManager::GetRequest(PRInt32 aR
                "Got an invalid request id or it has been already deleted!");
 
   // It's safe to use the static_cast here given that we did call
   // |new SmsRequest()|.
   return static_cast<SmsRequest*>(mRequests[aRequestId]);
 }
 
 template <class T>
-nsresult
+void
 SmsRequestManager::NotifySuccess(PRInt32 aRequestId, T aParam)
 {
   SmsRequest* request = GetRequest(aRequestId);
   request->SetSuccess(aParam);
 
-  nsresult rv = DispatchTrustedEventToRequest(SUCCESS_EVENT_NAME, request);
+  DispatchTrustedEventToRequest(SUCCESS_EVENT_NAME, request);
 
   mRequests.ReplaceObjectAt(nsnull, aRequestId);
-  return rv;
 }
 
-nsresult
-SmsRequestManager::NotifyError(PRInt32 aRequestId, PRInt32 aError)
+void
+SmsRequestManager::NotifyError(PRInt32 aRequestId, SmsRequest::ErrorType aError)
 {
   SmsRequest* request = GetRequest(aRequestId);
   request->SetError(aError);
 
-  nsresult rv = DispatchTrustedEventToRequest(ERROR_EVENT_NAME, request);
+  DispatchTrustedEventToRequest(ERROR_EVENT_NAME, request);
 
   mRequests.ReplaceObjectAt(nsnull, aRequestId);
-  return rv;
 }
 
-NS_IMETHODIMP
+void
 SmsRequestManager::NotifySmsSent(PRInt32 aRequestId, nsIDOMMozSmsMessage* aMessage)
 {
-  return NotifySuccess<nsIDOMMozSmsMessage*>(aRequestId, aMessage);
+  NotifySuccess<nsIDOMMozSmsMessage*>(aRequestId, aMessage);
 }
 
-NS_IMETHODIMP
-SmsRequestManager::NotifySmsSendFailed(PRInt32 aRequestId, PRInt32 aError)
+void
+SmsRequestManager::NotifySmsSendFailed(PRInt32 aRequestId, SmsRequest::ErrorType aError)
 {
-  return NotifyError(aRequestId, aError);
+  NotifyError(aRequestId, aError);
 }
 
-NS_IMETHODIMP
+void
 SmsRequestManager::NotifyGotSms(PRInt32 aRequestId, nsIDOMMozSmsMessage* aMessage)
 {
-  return NotifySuccess<nsIDOMMozSmsMessage*>(aRequestId, aMessage);
+  NotifySuccess<nsIDOMMozSmsMessage*>(aRequestId, aMessage);
 }
 
-NS_IMETHODIMP
-SmsRequestManager::NotifyGetSmsFailed(PRInt32 aRequestId, PRInt32 aError)
+void
+SmsRequestManager::NotifyGetSmsFailed(PRInt32 aRequestId,
+                                      SmsRequest::ErrorType aError)
 {
-  return NotifyError(aRequestId, aError);
+  NotifyError(aRequestId, aError);
 }
 
-NS_IMETHODIMP
+void
 SmsRequestManager::NotifySmsDeleted(PRInt32 aRequestId, bool aDeleted)
 {
-  return NotifySuccess<bool>(aRequestId, aDeleted);
+  NotifySuccess<bool>(aRequestId, aDeleted);
 }
 
-NS_IMETHODIMP
-SmsRequestManager::NotifySmsDeleteFailed(PRInt32 aRequestId, PRInt32 aError)
+void
+SmsRequestManager::NotifySmsDeleteFailed(PRInt32 aRequestId, SmsRequest::ErrorType aError)
 {
-  return NotifyError(aRequestId, aError);
+  NotifyError(aRequestId, aError);
 }
 
-NS_IMETHODIMP
+void
 SmsRequestManager::NotifyNoMessageInList(PRInt32 aRequestId)
 {
   SmsRequest* request = GetRequest(aRequestId);
 
   nsCOMPtr<nsIDOMMozSmsCursor> cursor = request->GetCursor();
   if (!cursor) {
     cursor = new SmsCursor();
   } else {
     static_cast<SmsCursor*>(cursor.get())->Disconnect();
   }
 
-  return NotifySuccess<nsIDOMMozSmsCursor*>(aRequestId, cursor);
+  NotifySuccess<nsIDOMMozSmsCursor*>(aRequestId, cursor);
 }
 
-NS_IMETHODIMP
+void
 SmsRequestManager::NotifyCreateMessageList(PRInt32 aRequestId, PRInt32 aListId,
                                            nsIDOMMozSmsMessage* aMessage)
 {
   SmsRequest* request = GetRequest(aRequestId);
 
   nsCOMPtr<SmsCursor> cursor = new SmsCursor(aListId, request);
   cursor->SetMessage(aMessage);
 
-  return NotifySuccess<nsIDOMMozSmsCursor*>(aRequestId, cursor);
+  NotifySuccess<nsIDOMMozSmsCursor*>(aRequestId, cursor);
 }
 
-NS_IMETHODIMP
+void
 SmsRequestManager::NotifyGotNextMessage(PRInt32 aRequestId, nsIDOMMozSmsMessage* aMessage)
 {
   SmsRequest* request = GetRequest(aRequestId);
 
   nsCOMPtr<SmsCursor> cursor = static_cast<SmsCursor*>(request->GetCursor());
   NS_ASSERTION(cursor, "Request should have an cursor in that case!");
   cursor->SetMessage(aMessage);
 
-  return NotifySuccess<nsIDOMMozSmsCursor*>(aRequestId, cursor);
+  NotifySuccess<nsIDOMMozSmsCursor*>(aRequestId, cursor);
 }
 
-NS_IMETHODIMP
-SmsRequestManager::NotifyReadMessageListFailed(PRInt32 aRequestId, PRInt32 aError)
+void
+SmsRequestManager::NotifyReadMessageListFailed(PRInt32 aRequestId,
+                                               SmsRequest::ErrorType aError)
 {
   SmsRequest* request = GetRequest(aRequestId);
 
   nsCOMPtr<nsIDOMMozSmsCursor> cursor = request->GetCursor();
   if (cursor) {
     static_cast<SmsCursor*>(cursor.get())->Disconnect();
   }
 
-  return NotifyError(aRequestId, aError);
+  NotifyError(aRequestId, aError);
 }
 
 } // namespace sms
 } // namespace dom
 } // namespace mozilla
--- a/dom/sms/src/SmsRequestManager.h
+++ b/dom/sms/src/SmsRequestManager.h
@@ -36,36 +36,60 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef mozilla_dom_sms_SmsRequestManager_h
 #define mozilla_dom_sms_SmsRequestManager_h
 
 #include "nsCOMArray.h"
 #include "SmsRequest.h"
-#include "nsISmsRequestManager.h"
+
+class nsIDOMMozSmsRequest;
+class nsPIDOMWindow;
+class nsIScriptContext;
+class nsIDOMMozSmsMessage;
 
 namespace mozilla {
 namespace dom {
 namespace sms {
 
-class SmsRequestManager : nsISmsRequestManager
+class SmsRequestManager
 {
 public:
-  NS_DECL_ISUPPORTS
-  NS_DECL_NSISMSREQUESTMANAGER
+  static void Init();
+  static void Shutdown();
+  static SmsRequestManager* GetInstance();
+
+  PRInt32 CreateRequest(nsPIDOMWindow* aWindow,
+                        nsIScriptContext* aScriptContext,
+                        nsIDOMMozSmsRequest** aRequest);
+
+  PRInt32 AddRequest(nsIDOMMozSmsRequest* aRequest);
+
+  void NotifySmsSent(PRInt32 aRequestId, nsIDOMMozSmsMessage* aMessage);
+  void NotifySmsSendFailed(PRInt32 aRequestId, SmsRequest::ErrorType aError);
+  void NotifyGotSms(PRInt32 aRequestId, nsIDOMMozSmsMessage* aMessage);
+  void NotifyGetSmsFailed(PRInt32 aRequestId, SmsRequest::ErrorType aError);
+  void NotifySmsDeleted(PRInt32 aRequestId, bool aDeleted);
+  void NotifySmsDeleteFailed(PRInt32 aRequestId, SmsRequest::ErrorType aError);
+  void NotifyNoMessageInList(PRInt32 aRequestId);
+  void NotifyCreateMessageList(PRInt32 aRequestId, PRInt32 aListId, nsIDOMMozSmsMessage* aMessage);
+  void NotifyGotNextMessage(PRInt32 aRequestId, nsIDOMMozSmsMessage* aMessage);
+  void NotifyReadMessageListFailed(PRInt32 aRequestId, SmsRequest::ErrorType aError);
 
 private:
+  static SmsRequestManager* sInstance;
+
   nsresult DispatchTrustedEventToRequest(const nsAString& aEventName,
                                          nsIDOMMozSmsRequest* aRequest);
   SmsRequest* GetRequest(PRInt32 aRequestId);
 
   template <class T>
-  nsresult NotifySuccess(PRInt32 aRequestId, T aParam);
-  nsresult NotifyError(PRInt32 aRequestId, PRInt32 aError);
+  void NotifySuccess(PRInt32 aRequestId, T aParam);
+  void NotifyError(PRInt32 aRequestId, SmsRequest::ErrorType aError);
 
   nsCOMArray<nsIDOMMozSmsRequest> mRequests;
 };
 
 } // namespace sms
 } // namespace dom
 } // namespace mozilla
 
--- a/dom/sms/src/ipc/SmsChild.cpp
+++ b/dom/sms/src/ipc/SmsChild.cpp
@@ -95,151 +95,145 @@ SmsChild::RecvNotifyRequestSmsSent(const
                                    const PRInt32& aRequestId,
                                    const PRUint64& aProcessId)
 {
   if (ContentChild::GetSingleton()->GetID() != aProcessId) {
     return true;
   }
 
   nsCOMPtr<nsIDOMMozSmsMessage> message = new SmsMessage(aMessage);
-  nsCOMPtr<nsISmsRequestManager> requestManager = do_GetService(SMS_REQUEST_MANAGER_CONTRACTID);
-  requestManager->NotifySmsSent(aRequestId, message);
+  SmsRequestManager::GetInstance()->NotifySmsSent(aRequestId, message);
 
   return true;
 }
 
 bool
 SmsChild::RecvNotifyRequestSmsSendFailed(const PRInt32& aError,
                                          const PRInt32& aRequestId,
                                          const PRUint64& aProcessId)
 {
   if (ContentChild::GetSingleton()->GetID() != aProcessId) {
     return true;
   }
 
-  nsCOMPtr<nsISmsRequestManager> requestManager = do_GetService(SMS_REQUEST_MANAGER_CONTRACTID);
-  requestManager->NotifySmsSendFailed(aRequestId, aError);
+  SmsRequestManager::GetInstance()->NotifySmsSendFailed(aRequestId,
+                                                        SmsRequest::ErrorType(aError));
 
   return true;
 }
 
 bool
 SmsChild::RecvNotifyRequestGotSms(const SmsMessageData& aMessage,
                                   const PRInt32& aRequestId,
                                   const PRUint64& aProcessId)
 {
   if (ContentChild::GetSingleton()->GetID() != aProcessId) {
     return true;
   }
 
   nsCOMPtr<nsIDOMMozSmsMessage> message = new SmsMessage(aMessage);
-  nsCOMPtr<nsISmsRequestManager> requestManager = do_GetService(SMS_REQUEST_MANAGER_CONTRACTID);
-  requestManager->NotifyGotSms(aRequestId, message);
+  SmsRequestManager::GetInstance()->NotifyGotSms(aRequestId, message);
 
   return true;
 }
 
 bool
 SmsChild::RecvNotifyRequestGetSmsFailed(const PRInt32& aError,
                                         const PRInt32& aRequestId,
                                         const PRUint64& aProcessId)
 {
   if (ContentChild::GetSingleton()->GetID() != aProcessId) {
     return true;
   }
 
-  nsCOMPtr<nsISmsRequestManager> requestManager = do_GetService(SMS_REQUEST_MANAGER_CONTRACTID);
-  requestManager->NotifyGetSmsFailed(aRequestId, aError);
+  SmsRequestManager::GetInstance()->NotifyGetSmsFailed(aRequestId,
+                                                       SmsRequest::ErrorType(aError));
 
   return true;
 }
 
 bool
 SmsChild::RecvNotifyRequestSmsDeleted(const bool& aDeleted,
                                       const PRInt32& aRequestId,
                                       const PRUint64& aProcessId)
 {
   if (ContentChild::GetSingleton()->GetID() != aProcessId) {
     return true;
   }
 
-  nsCOMPtr<nsISmsRequestManager> requestManager = do_GetService(SMS_REQUEST_MANAGER_CONTRACTID);
-  requestManager->NotifySmsDeleted(aRequestId, aDeleted);
+  SmsRequestManager::GetInstance()->NotifySmsDeleted(aRequestId, aDeleted);
 
   return true;
 }
 
 bool
 SmsChild::RecvNotifyRequestSmsDeleteFailed(const PRInt32& aError,
                                            const PRInt32& aRequestId,
                                            const PRUint64& aProcessId)
 {
   if (ContentChild::GetSingleton()->GetID() != aProcessId) {
     return true;
   }
 
-  nsCOMPtr<nsISmsRequestManager> requestManager = do_GetService(SMS_REQUEST_MANAGER_CONTRACTID);
-  requestManager->NotifySmsDeleteFailed(aRequestId, aError);
+  SmsRequestManager::GetInstance()->NotifySmsDeleteFailed(aRequestId,
+                                                          SmsRequest::ErrorType(aError));
 
   return true;
 }
 
 bool
 SmsChild::RecvNotifyRequestNoMessageInList(const PRInt32& aRequestId,
                                            const PRUint64& aProcessId)
 {
   if (ContentChild::GetSingleton()->GetID() != aProcessId) {
     return true;
   }
 
-  nsCOMPtr<nsISmsRequestManager> requestManager = do_GetService(SMS_REQUEST_MANAGER_CONTRACTID);
-  requestManager->NotifyNoMessageInList(aRequestId);
+  SmsRequestManager::GetInstance()->NotifyNoMessageInList(aRequestId);
   return true;
 }
 
 bool
 SmsChild::RecvNotifyRequestCreateMessageList(const PRInt32& aListId,
                                              const SmsMessageData& aMessageData,
                                              const PRInt32& aRequestId,
                                              const PRUint64& aProcessId)
 {
   if (ContentChild::GetSingleton()->GetID() != aProcessId) {
     return true;
   }
 
   nsCOMPtr<nsIDOMMozSmsMessage> message = new SmsMessage(aMessageData);
-  nsCOMPtr<nsISmsRequestManager> requestManager = do_GetService(SMS_REQUEST_MANAGER_CONTRACTID);
-  requestManager->NotifyCreateMessageList(aRequestId, aListId, message);
+  SmsRequestManager::GetInstance()->NotifyCreateMessageList(aRequestId, aListId, message);
   return true;
 }
 
 bool
 SmsChild::RecvNotifyRequestGotNextMessage(const SmsMessageData& aMessageData,
                                           const PRInt32& aRequestId,
                                           const PRUint64& aProcessId)
 {
   if (ContentChild::GetSingleton()->GetID() != aProcessId) {
     return true;
   }
 
   nsCOMPtr<nsIDOMMozSmsMessage> message = new SmsMessage(aMessageData);
-  nsCOMPtr<nsISmsRequestManager> requestManager = do_GetService(SMS_REQUEST_MANAGER_CONTRACTID);
-  requestManager->NotifyGotNextMessage(aRequestId, message);
+  SmsRequestManager::GetInstance()->NotifyGotNextMessage(aRequestId, message);
   return true;
 }
 
 bool
 SmsChild::RecvNotifyRequestReadListFailed(const PRInt32& aError,
                                           const PRInt32& aRequestId,
                                           const PRUint64& aProcessId)
 {
   if (ContentChild::GetSingleton()->GetID() != aProcessId) {
     return true;
   }
 
-  nsCOMPtr<nsISmsRequestManager> requestManager = do_GetService(SMS_REQUEST_MANAGER_CONTRACTID);
-  requestManager->NotifyReadMessageListFailed(aRequestId, aError);
+  SmsRequestManager::GetInstance()->NotifyReadMessageListFailed(aRequestId,
+                                                                SmsRequest::ErrorType(aError));
   return true;
 }
 
 } // namespace sms
 } // namespace dom
 } // namespace mozilla
--- a/dom/sms/src/ril/SmsService.cpp
+++ b/dom/sms/src/ril/SmsService.cpp
@@ -84,17 +84,17 @@ SmsService::Send(const nsAString& aNumbe
                  const nsAString& aMessage,
                  PRInt32 aRequestId,
                  PRUint64 aProcessId)
 {
   if (!mRIL) {
     return NS_OK;
   }
 
-  mRIL->SendSMS(aNumber, aMessage, aRequestId, aProcessId);
+  mRIL->SendSMS(aNumber, aMessage);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 SmsService::CreateSmsMessage(PRInt32 aId,
                              const nsAString& aDelivery,
                              const nsAString& aSender,
                              const nsAString& aReceiver,
--- a/dom/system/b2g/RadioInterfaceLayer.js
+++ b/dom/system/b2g/RadioInterfaceLayer.js
@@ -54,26 +54,21 @@ const RADIOINTERFACELAYER_CID =
 const DATACALLINFO_CID =
   Components.ID("{ef474cd9-94f7-4c05-a31b-29b9de8a10d2}");
 
 const nsIAudioManager = Ci.nsIAudioManager;
 const nsIRadioInterfaceLayer = Ci.nsIRadioInterfaceLayer;
 
 const kSmsReceivedObserverTopic          = "sms-received";
 const DOM_SMS_DELIVERY_RECEIVED          = "received";
-const DOM_SMS_DELIVERY_SENT              = "sent";
 
 XPCOMUtils.defineLazyServiceGetter(this, "gSmsService",
                                    "@mozilla.org/sms/smsservice;1",
                                    "nsISmsService");
 
-XPCOMUtils.defineLazyServiceGetter(this, "gSmsRequestManager",
-                                   "@mozilla.org/sms/smsrequestmanager;1",
-                                   "nsISmsRequestManager");
-
 function convertRILCallState(state) {
   switch (state) {
     case RIL.CALL_STATE_ACTIVE:
       return nsIRadioInterfaceLayer.CALL_STATE_CONNECTED;
     case RIL.CALL_STATE_HOLDING:
       return nsIRadioInterfaceLayer.CALL_STATE_HELD;
     case RIL.CALL_STATE_DIALING:
       return nsIRadioInterfaceLayer.CALL_STATE_DIALING;
@@ -201,19 +196,16 @@ RadioInterfaceLayer.prototype = {
         this.currentState.radioState = message.radioState;
         break;
       case "cardstatechange":
         this.currentState.cardState = message.cardState;
         break;
       case "sms-received":
         this.handleSmsReceived(message);
         return;
-      case "sms-sent":
-        this.handleSmsSent(message);
-        return;
       case "datacallstatechange":
         this.handleDataCallState(message.datacall);
         break;
       case "datacalllist":
         this.handleDataCallList(message);
         break;
       default:
         throw new Error("Don't know about this message type: " + message.type);
@@ -313,28 +305,16 @@ RadioInterfaceLayer.prototype = {
                                            DOM_SMS_DELIVERY_RECEIVED,
                                            message.sender || null,
                                            message.receiver || null,
                                            message.body || null,
                                            message.timestamp);
     Services.obs.notifyObservers(sms, kSmsReceivedObserverTopic, null);
   },
 
-  handleSmsSent: function handleSmsSent(message) {
-    let message = gSmsService.createSmsMessage(-1,
-                                               DOM_SMS_DELIVERY_SENT,
-                                               message.SMSC,
-                                               message.number,
-                                               message.body,
-                                               Date.now());
-    //TODO At this point we should save the sms into the DB (bug 712809)
-    //TODO handle errors (bug 727319)
-    gSmsRequestManager.notifySmsSent(message.requestId, message);
-  },
-
   /**
    * Handle data call state changes.
    */
   handleDataCallState: function handleDataCallState(datacall) {
     this._deliverDataCallCallback("dataCallStateChanged",
                                   [datacall.cid, datacall.ifname, datacall.state]);
   },
 
@@ -417,22 +397,20 @@ RadioInterfaceLayer.prototype = {
 
   getNumberOfMessagesForText: function getNumberOfMessagesForText(text) {
     //TODO: this assumes 7bit encoding, which is incorrect. Need to look
     // for characters not supported by 7bit alphabets and then calculate
     // length in UCS2 encoding.
     return Math.ceil(text.length / 160);
   },
 
-  sendSMS: function sendSMS(number, message, requestId, processId) {
+  sendSMS: function sendSMS(number, message) {
     this.worker.postMessage({type: "sendSMS",
                              number: number,
-                             body: message,
-                             requestId: requestId,
-                             processId: processId});
+                             body: message});
   },
 
   _callbacks: null,
   _enumerationCallbacks: null,
 
   registerCallback: function registerCallback(callback) {
     if (this._callbacks) {
       if (this._callbacks.indexOf(callback) != -1) {
--- a/dom/system/b2g/nsIRadioInterfaceLayer.idl
+++ b/dom/system/b2g/nsIRadioInterfaceLayer.idl
@@ -111,17 +111,17 @@ interface nsIRILDataCallback : nsISuppor
    *        Array of nsIRILDataCallInfo objects.
    * @param length
    *        Lenght of the aforementioned array.
    */
   void receiveDataCallList([array,size_is(length)] in nsIRILDataCallInfo dataCalls,
                            in unsigned long length);
 };
 
-[scriptable, uuid(aeb7ffe7-7d3a-4b7d-9b59-b6d3ae1c72ed)]
+[scriptable, uuid(9b7e3a01-9c45-4af3-81bb-1bf08a842226)]
 interface nsIRadioInterfaceLayer : nsISupports
 {
   const unsigned short CALL_STATE_UNKNOWN = 0;
   const unsigned short CALL_STATE_DIALING = 1;
   const unsigned short CALL_STATE_RINGING = 2;
   const unsigned short CALL_STATE_BUSY = 3;
   const unsigned short CALL_STATE_CONNECTING = 4;
   const unsigned short CALL_STATE_CONNECTED = 5;
@@ -172,21 +172,18 @@ interface nsIRadioInterfaceLayer : nsISu
                      in DOMString apn,
                      in DOMString user,
                      in DOMString passwd,
                      in long chappap,
                      in DOMString pdptype);
   void deactivateDataCall(in DOMString cid,
                           in DOMString reason);
   void getDataCallList();
-
+  
   void registerDataCallCallback(in nsIRILDataCallback callback);
   void unregisterDataCallCallback(in nsIRILDataCallback callback);
 
   /**
    * SMS-related functionality.
    */
   unsigned short getNumberOfMessagesForText(in DOMString text);
-  void sendSMS(in DOMString number,
-               in DOMString message,
-               in long requestId,
-               in unsigned long long processId);
+  void sendSMS(in DOMString number, in DOMString message);
 };
--- a/dom/system/b2g/ril_worker.js
+++ b/dom/system/b2g/ril_worker.js
@@ -433,24 +433,22 @@ let Buf = {
 
   /**
    * Process one parcel.
    */
   processParcel: function processParcel() {
     let response_type = this.readUint32();
     let length = this.readIncoming - UINT32_SIZE;
 
-    let request_type, options;
+    let request_type;
     if (response_type == RESPONSE_TYPE_SOLICITED) {
       let token = this.readUint32();
       let error = this.readUint32();
       length -= 2 * UINT32_SIZE;
-
-      options = this.tokenRequestMap[token];
-      request_type = options.rilRequestType;
+      request_type = this.tokenRequestMap[token];
       if (error) {
         //TODO
         if (DEBUG) {
           debug("Received error " + error + " for solicited parcel type " +
                 request_type);
         }
         return;
       }
@@ -464,41 +462,33 @@ let Buf = {
       request_type = this.readUint32();
       length -= UINT32_SIZE;
       if (DEBUG) debug("Unsolicited response for request type " + request_type);
     } else {
       if (DEBUG) debug("Unknown response type: " + response_type);
       return;
     }
 
-    RIL.handleParcel(request_type, length, options);
+    RIL.handleParcel(request_type, length);
   },
 
   /**
    * Start a new outgoing parcel.
    *
    * @param type
    *        Integer specifying the request type.
-   * @param options [optional]
-   *        Object containing information about the request, e.g. the
-   *        original main thread message object that led to the RIL request. 
    */
-  newParcel: function newParcel(type, options) {
+  newParcel: function newParcel(type) {
     if (DEBUG) debug("New outgoing parcel of type " + type);
     // We're going to leave room for the parcel size at the beginning.
     this.outgoingIndex = PARCEL_SIZE_SIZE;
     this.writeUint32(type);
     let token = this.token;
     this.writeUint32(token);
-
-    if (!options) {
-      options = {};
-    }
-    options.rilRequestType = type;
-    this.tokenRequestMap[token] = options;
+    this.tokenRequestMap[token] = type;
     this.token++;
     return token;
   },
 
   /**
    * Communicate with the RIL IPC thread.
    */
   sendParcel: function sendParcel() {
@@ -758,42 +748,37 @@ let RIL = {
    */
   rejectCall: function rejectCall() {
     Buf.simpleRequest(REQUEST_UDUB);
   },
 
   /**
    * Send an SMS.
    *
-   * The `options` parameter object should contain the following attributes:
-   *
-   * @param SMSC
+   * @param smscPDU
    *        String containing the SMSC PDU in hex format.
-   * @param number
+   * @param address
    *        String containing the recipients address.
    * @param body
    *        String containing the message body.
    * @param dcs
    *        Data coding scheme. One of the PDU_DCS_MSG_CODING_*BITS_ALPHABET
    *        constants.
    * @param bodyLengthInOctets
    *        Byte length of the message body when encoded with the given DCS.
    */
-  sendSMS: function sendSMS(options) {
-    let token = Buf.newParcel(REQUEST_SEND_SMS, options);
+  sendSMS: function sendSMS(smscPDU, address, body, dcs, bodyLengthInOctets) {
+    let token = Buf.newParcel(REQUEST_SEND_SMS);
     //TODO we want to map token to the input values so that on the
     // response from the RIL device we know which SMS request was successful
     // or not. Maybe we should build that functionality into newParcel() and
     // handle it within tokenRequestMap[].
     Buf.writeUint32(2);
-    Buf.writeString(options.SMSC);
-    GsmPDUHelper.writeMessage(options.number,
-                              options.body,
-                              options.dcs,
-                              options.bodyLengthInOctets);
+    Buf.writeString(smscPDU);
+    GsmPDUHelper.writeMessage(address, body, dcs, bodyLengthInOctets);
     Buf.sendParcel();
   },
 
   /**
    * Acknowledge the receipt and handling of an SMS.
    *
    * @param success
    *        Boolean indicating whether the message was successfuly handled.
@@ -917,21 +902,21 @@ let RIL = {
   },
 
   /**
    * Handle incoming requests from the RIL. We find the method that
    * corresponds to the request type. Incidentally, the request type
    * _is_ the method name, so that's easy.
    */
 
-  handleParcel: function handleParcel(request_type, length, options) {
+  handleParcel: function handleParcel(request_type, length) {
     let method = this[request_type];
     if (typeof method == "function") {
       if (DEBUG) debug("Handling parcel as " + method.name);
-      method.call(this, length, options);
+      method.call(this, length);
     }
   }
 };
 
 RIL[REQUEST_GET_SIM_STATUS] = function REQUEST_GET_SIM_STATUS() {
   let iccStatus = {
     cardState:                   Buf.readUint32(), // CARD_STATE_*
     universalPINState:           Buf.readUint32(), // PINSTATE_*
@@ -1074,21 +1059,21 @@ RIL[REQUEST_GPRS_REGISTRATION_STATE] = f
 RIL[REQUEST_OPERATOR] = function REQUEST_OPERATOR(length) {
   let operator = Buf.readStringList();
   Phone.onOperator(operator);
 };
 RIL[REQUEST_RADIO_POWER] = null;
 RIL[REQUEST_DTMF] = function REQUEST_DTMF() {
   Phone.onSendTone();
 };
-RIL[REQUEST_SEND_SMS] = function REQUEST_SEND_SMS(length, options) {
-  options.messageRef = Buf.readUint32();
-  options.ackPDU = Buf.readString();
-  options.errorCode = Buf.readUint32();
-  Phone.onSendSMS(options);
+RIL[REQUEST_SEND_SMS] = function REQUEST_SEND_SMS() {
+  let messageRef = Buf.readUint32();
+  let ackPDU = Buf.readString();
+  let errorCode = Buf.readUint32();
+  Phone.onSendSMS(messageRef, ackPDU, errorCode);
 };
 RIL[REQUEST_SEND_SMS_EXPECT_MORE] = null;
 RIL[REQUEST_SETUP_DATA_CALL] = function REQUEST_SETUP_DATA_CALL() {
   let [cid, ifname, ipaddr, dns, gw] = Buf.readStringList();
   Phone.onSetupDataCall(Buf.lastSolicitedToken, cid, ifname, ipaddr, dns, gw);
 };
 RIL[REQUEST_SIM_IO] = null;
 RIL[REQUEST_SEND_USSD] = null;
@@ -1763,19 +1748,18 @@ let Phone = {
 
   onGetSMSCAddress: function onGetSMSCAddress(smsc) {
     this.SMSC = smsc;
   },
 
   onSetSMSCAddress: function onSetSMSCAddress() {
   },
 
-  onSendSMS: function onSendSMS(options) {
-    options.type = "sms-sent";
-    this.sendDOMMessage(options);
+  onSendSMS: function onSendSMS(messageRef, ackPDU, errorCode) {
+    //TODO
   },
 
   onNewSMS: function onNewSMS(payloadLength) {
     if (!payloadLength) {
       if (DEBUG) debug("Received empty SMS!");
       //TODO: should we acknowledge the SMS here? maybe only after multiple
       //failures.
       return;
@@ -2024,43 +2008,34 @@ let Phone = {
 
   /**
    * Send an SMS.
    *
    * @param number
    *        String containing the recipient number.
    * @param body
    *        String containing the message text.
-   * @param requestId
-   *        String identifying the sms request used by the SmsRequestManager.
-   * @param processId
-   *        String containing the processId for the SmsRequestManager.
    */
   sendSMS: function sendSMS(options) {
     // Get the SMS Center address
     if (!this.SMSC) {
       //TODO: we shouldn't get here, but if we do, we might want to hold on
       // to the message and retry once we know the SMSC... or just notify an
       // error to the mainthread and let them deal with retrying?
       if (DEBUG) {
         debug("Cannot send the SMS. Need to get the SMSC address first.");
       }
       return;
     }
-    // We explicitly save this information on the options object so that we
-    // can refer to it later, in particular on the main thread (where this
-    // object may get sent eventually.)
-    options.SMSC = this.SMSC;
-
     //TODO: verify values on 'options'
     //TODO: the data encoding and length in octets should eventually be
     // computed on the mainthread and passed down to us.
-    options.dcs = PDU_DCS_MSG_CODING_7BITS_ALPHABET;
-    options.bodyLengthInOctets = Math.ceil(options.body.length * 7 / 8);
-    RIL.sendSMS(options);
+    RIL.sendSMS(this.SMSC, options.number, options.body,
+                PDU_DCS_MSG_CODING_7BITS_ALPHABET, //TODO: hard-coded for now,
+                Math.ceil(options.body.length * 7 / 8)); //TODO: ditto
   },
 
   /**
    * Setup a data call (PDP).
    */
   setupDataCall: function setupDataCall(options) {
     if (DEBUG) debug("setupDataCall: " + JSON.stringify(options));
 
--- a/embedding/android/GeckoSmsManager.java
+++ b/embedding/android/GeckoSmsManager.java
@@ -322,19 +322,19 @@ public class GeckoSmsManager
   extends BroadcastReceiver
   implements ISmsManager
 {
   public final static String ACTION_SMS_RECEIVED  = "android.provider.Telephony.SMS_RECEIVED";
   public final static String ACTION_SMS_SENT      = "org.mozilla.gecko.SMS_SENT";
   public final static String ACTION_SMS_DELIVERED = "org.mozilla.gecko.SMS_DELIVERED";
 
   /*
-   * Make sure that the following error codes are in sync with the ones
-   * defined in dom/sms/interfaces/nsISmsRequestManager.idl. They are owned
-   * owned by the interface.
+   * Make sure that the following error codes are in sync with |ErrorType| in:
+   * dom/sms/src/Types.h
+   * The error code are owned by the DOM.
    */
   public final static int kNoError       = 0;
   public final static int kNoSignalError = 1;
   public final static int kNotFoundError = 2;
   public final static int kUnknownError  = 3;
   public final static int kInternalError = 4;
 
   private final static int kMaxMessageSize    = 160;
--- a/layout/build/nsLayoutModule.cpp
+++ b/layout/build/nsLayoutModule.cpp
@@ -247,17 +247,16 @@ static void Shutdown();
     defined(machintosh) || \
     defined(android)
 #include "nsDeviceMotionSystem.h"
 #endif
 #endif
 #include "nsCSPService.h"
 #include "nsISmsService.h"
 #include "nsISmsDatabaseService.h"
-#include "mozilla/dom/sms/SmsRequestManager.h"
 #include "mozilla/dom/sms/SmsServicesFactory.h"
 #include "nsIPowerManagerService.h"
 
 using namespace mozilla::dom::sms;
 
 #include "mozilla/dom/power/PowerManagerService.h"
 
 using mozilla::dom::power::PowerManagerService;
@@ -305,17 +304,16 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsDeviceM
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsHapticFeedback)
 #endif
 #endif
 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(ThirdPartyUtil, Init)
 NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsISmsService, SmsServicesFactory::CreateSmsService)
 NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsISmsDatabaseService, SmsServicesFactory::CreateSmsDatabaseService)
 NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIPowerManagerService,
                                          PowerManagerService::GetInstance)
-NS_GENERIC_FACTORY_CONSTRUCTOR(SmsRequestManager)
 
 //-----------------------------------------------------------------------------
 
 // Per bug 209804, it is necessary to observe the "xpcom-shutdown" event and
 // perform shutdown of the layout modules at that time instead of waiting for
 // our module destructor to run.  If we do not do this, then we risk holding
 // references to objects in other component libraries that have already been
 // shutdown (and possibly unloaded if 60709 is ever fixed).
@@ -797,17 +795,16 @@ NS_DEFINE_NAMED_CID(NS_STRUCTUREDCLONECO
 NS_DEFINE_NAMED_CID(NS_DEVICE_MOTION_CID);
 #endif
 #if defined(ANDROID) || defined(MOZ_PLATFORM_MAEMO)
 NS_DEFINE_NAMED_CID(NS_HAPTICFEEDBACK_CID);
 #endif
 #endif
 NS_DEFINE_NAMED_CID(SMS_SERVICE_CID);
 NS_DEFINE_NAMED_CID(SMS_DATABASE_SERVICE_CID);
-NS_DEFINE_NAMED_CID(SMS_REQUEST_MANAGER_CID);
 NS_DEFINE_NAMED_CID(NS_POWERMANAGERSERVICE_CID);
 
 static nsresult
 CreateWindowCommandTableConstructor(nsISupports *aOuter,
                                     REFNSIID aIID, void **aResult)
 {
   nsresult rv;
   nsCOMPtr<nsIControllerCommandTable> commandTable =
@@ -1069,17 +1066,16 @@ static const mozilla::Module::CIDEntry k
 #if defined(ANDROID) || defined(MOZ_PLATFORM_MAEMO)
   { &kNS_HAPTICFEEDBACK_CID, false, NULL, nsHapticFeedbackConstructor },
 #endif
 #endif
   { &kTHIRDPARTYUTIL_CID, false, NULL, ThirdPartyUtilConstructor },
   { &kNS_STRUCTUREDCLONECONTAINER_CID, false, NULL, nsStructuredCloneContainerConstructor },
   { &kSMS_SERVICE_CID, false, NULL, nsISmsServiceConstructor },
   { &kSMS_DATABASE_SERVICE_CID, false, NULL, nsISmsDatabaseServiceConstructor },
-  { &kSMS_REQUEST_MANAGER_CID, false, NULL, SmsRequestManagerConstructor },
   { &kNS_POWERMANAGERSERVICE_CID, false, NULL, nsIPowerManagerServiceConstructor },
   { NULL }
 };
 
 static const mozilla::Module::ContractIDEntry kLayoutContracts[] = {
   XPCONNECT_CONTRACTS
   { "@mozilla.org/layout/xul-boxobject;1", &kNS_BOXOBJECT_CID },
 #ifdef MOZ_XUL
@@ -1206,17 +1202,16 @@ static const mozilla::Module::ContractID
 #if defined(ANDROID) || defined(MOZ_PLATFORM_MAEMO)
   { "@mozilla.org/widget/hapticfeedback;1", &kNS_HAPTICFEEDBACK_CID },
 #endif
 #endif
   { THIRDPARTYUTIL_CONTRACTID, &kTHIRDPARTYUTIL_CID },
   { NS_STRUCTUREDCLONECONTAINER_CONTRACTID, &kNS_STRUCTUREDCLONECONTAINER_CID },
   { SMS_SERVICE_CONTRACTID, &kSMS_SERVICE_CID },
   { SMS_DATABASE_SERVICE_CONTRACTID, &kSMS_DATABASE_SERVICE_CID },
-  { SMS_REQUEST_MANAGER_CONTRACTID, &kSMS_REQUEST_MANAGER_CID },
   { POWERMANAGERSERVICE_CONTRACTID, &kNS_POWERMANAGERSERVICE_CID },
   { NULL }
 };
 
 static const mozilla::Module::CategoryEntry kLayoutCategories[] = {
   XPCONNECT_CATEGORIES
   { JAVASCRIPT_GLOBAL_CONSTRUCTOR_CATEGORY, "Image", NS_HTMLIMGELEMENT_CONTRACTID },
   { JAVASCRIPT_GLOBAL_CONSTRUCTOR_PROTO_ALIAS_CATEGORY, "Image", "HTMLImageElement" },
--- a/layout/build/nsLayoutStatics.cpp
+++ b/layout/build/nsLayoutStatics.cpp
@@ -120,16 +120,17 @@
 #include "nsJSEnvironment.h"
 #include "nsContentSink.h"
 #include "nsFrameMessageManager.h"
 #include "nsRefreshDriver.h"
 
 #include "nsHyphenationManager.h"
 #include "nsEditorSpellCheck.h"
 #include "nsDOMMemoryReporter.h"
+#include "mozilla/dom/sms/SmsRequestManager.h"
 
 extern void NS_ShutdownChainItemPool();
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 nsrefcnt nsLayoutStatics::sLayoutStaticRefcnt = 0;
 
@@ -266,22 +267,26 @@ nsLayoutStatics::Initialize()
   nsCORSListenerProxy::Startup();
 
   nsFrameList::Init();
 
   NS_SealStaticAtomTable();
 
   nsDOMMemoryMultiReporter::Init();
 
+  sms::SmsRequestManager::Init();
+
   return NS_OK;
 }
 
 void
 nsLayoutStatics::Shutdown()
 {
+  sms::SmsRequestManager::Shutdown();
+
   // Don't need to shutdown nsDOMMemoryReporter, that will be done by the memory
   // reporter manager.
 
   nsFrameScriptExecutor::Shutdown();
   nsFocusManager::Shutdown();
 #ifdef MOZ_XUL
   nsXULPopupManager::Shutdown();
 #endif