Backed out changeset 15a281081b97 (bug 958782) for bustage on a CLOSED TREE
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Mon, 23 Jun 2014 15:38:17 +0200
changeset 190200 dfd721d38a74835e72fe50d8e1256ebf5a78e7b6
parent 190199 ed17e0fa048734d4cd2bf7c11cdfa92b56da2fae
child 190201 8979b19469c1ccc677507d42745f9c7944415e85
push id27003
push userkwierso@gmail.com
push dateTue, 24 Jun 2014 01:56:11 +0000
treeherdermozilla-central@e86b84998b18 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs958782
milestone33.0a1
backs out15a281081b971ecd72584f70dc58f56c89018b36
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
Backed out changeset 15a281081b97 (bug 958782) for bustage on a CLOSED TREE
dom/mobilemessage/src/MobileMessageManager.cpp
dom/mobilemessage/src/MobileMessageManager.h
--- a/dom/mobilemessage/src/MobileMessageManager.cpp
+++ b/dom/mobilemessage/src/MobileMessageManager.cpp
@@ -122,51 +122,52 @@ MobileMessageManager::GetSegmentInfoForT
   nsresult rv = smsService->GetSegmentInfoForText(aText, msgCallback);
   NS_ENSURE_SUCCESS(rv, rv);
 
   request.forget(aRequest);
   return NS_OK;
 }
 
 nsresult
-MobileMessageManager::Send(JSContext* aCx,
-                           JS::Handle<JSObject*> aGlobal,
-                           nsISmsService* aSmsService,
+MobileMessageManager::Send(JSContext* aCx, JS::Handle<JSObject*> aGlobal,
                            uint32_t aServiceId,
                            JS::Handle<JSString*> aNumber,
-                           const nsAString& aText,
+                           const nsAString& aMessage,
                            JS::MutableHandle<JS::Value> aRequest)
 {
+  nsCOMPtr<nsISmsService> smsService = do_GetService(SMS_SERVICE_CONTRACTID);
+  NS_ENSURE_TRUE(smsService, NS_ERROR_FAILURE);
+
   nsDependentJSString number;
   number.init(aCx, aNumber);
 
   nsRefPtr<DOMRequest> request = new DOMRequest(GetOwner());
   nsCOMPtr<nsIMobileMessageCallback> msgCallback =
     new MobileMessageCallback(request);
 
   // By default, we don't send silent messages via MobileMessageManager.
-  nsresult rv = aSmsService->Send(aServiceId, number, aText,
-                                  false, msgCallback);
+  nsresult rv = smsService->Send(aServiceId, number, aMessage,
+                                 false, msgCallback);
   NS_ENSURE_SUCCESS(rv, rv);
 
   js::AssertSameCompartment(aCx, aGlobal);
   rv = nsContentUtils::WrapNative(aCx,
                                   static_cast<nsIDOMDOMRequest*>(request.get()),
                                   aRequest);
   if (NS_FAILED(rv)) {
     NS_ERROR("Failed to create the js value!");
     return rv;
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 MobileMessageManager::Send(JS::Handle<JS::Value> aNumber,
-                           const nsAString& aText,
+                           const nsAString& aMessage,
                            JS::Handle<JS::Value> aSendParams,
                            JSContext* aCx,
                            uint8_t aArgc,
                            JS::MutableHandle<JS::Value> aReturn)
 {
   if (!aNumber.isString() && !JS_IsArrayObject(aCx, aNumber)) {
     return NS_ERROR_INVALID_ARG;
   }
@@ -184,35 +185,33 @@ MobileMessageManager::Send(JS::Handle<JS
     ac.construct(aCx, global);
   }
 
   nsCOMPtr<nsISmsService> smsService = do_GetService(SMS_SERVICE_CONTRACTID);
   NS_ENSURE_TRUE(smsService, NS_ERROR_FAILURE);
 
   // Use the default one unless |aSendParams.serviceId| is available.
   uint32_t serviceId;
-  RootedDictionary<SmsSendParameters> sendParams(aCx);
+  rv = smsService->GetSmsDefaultServiceId(&serviceId);
+  NS_ENSURE_SUCCESS(rv, rv);
 
-  if (aArgc >= 1) {
+  if (aArgc == 1) {
     JS::Rooted<JS::Value> param(aCx, aSendParams);
+    RootedDictionary<SmsSendParameters> sendParams(aCx);
     if (!sendParams.Init(aCx, param)) {
       return NS_ERROR_TYPE_ERR;
     }
-  }
-
-  if (sendParams.mServiceId.WasPassed()) {
-    serviceId = sendParams.mServiceId.Value();
-  } else {
-    rv = smsService->GetSmsDefaultServiceId(&serviceId);
-    NS_ENSURE_SUCCESS(rv, rv);
+    if (sendParams.mServiceId.WasPassed()) {
+      serviceId = sendParams.mServiceId.Value();
+    }
   }
 
   if (aNumber.isString()) {
     JS::Rooted<JSString*> str(aCx, aNumber.toString());
-    return Send(aCx, global, smsService, serviceId, str, aText, aReturn);
+    return Send(aCx, global, serviceId, str, aMessage, aReturn);
   }
 
   // Must be an array then.
   JS::Rooted<JSObject*> numbers(aCx, &aNumber.toObject());
 
   uint32_t size;
   if (!JS_GetArrayLength(aCx, numbers, &size)) {
     return NS_ERROR_FAILURE;
@@ -230,17 +229,17 @@ MobileMessageManager::Send(JS::Handle<JS
       return NS_ERROR_INVALID_ARG;
     }
 
     str = JS::ToString(aCx, number);
     if (!str) {
       return NS_ERROR_FAILURE;
     }
 
-    nsresult rv = Send(aCx, global, smsService, serviceId, str, aText, requests[i]);
+    nsresult rv = Send(aCx, global, serviceId, str, aMessage, requests[i]);
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   JS::Rooted<JSObject*> obj(aCx);
   obj = JS_NewArrayObject(aCx, requests);
   if (!obj) {
     return NS_ERROR_FAILURE;
   }
@@ -256,53 +255,49 @@ MobileMessageManager::SendMMS(JS::Handle
                               uint8_t aArgc,
                               nsIDOMDOMRequest** aRequest)
 {
   nsCOMPtr<nsIMmsService> mmsService = do_GetService(MMS_SERVICE_CONTRACTID);
   NS_ENSURE_TRUE(mmsService, NS_ERROR_FAILURE);
 
   // Use the default one unless |aSendParams.serviceId| is available.
   uint32_t serviceId;
-  RootedDictionary<MmsSendParameters> sendParams(aCx);
-  nsresult rv;
+  nsresult rv = mmsService->GetMmsDefaultServiceId(&serviceId);
+  NS_ENSURE_SUCCESS(rv, rv);
 
-  if (aArgc >= 1) {
+  if (aArgc == 1) {
     JS::Rooted<JS::Value> param(aCx, aSendParams);
+    RootedDictionary<MmsSendParameters> sendParams(aCx);
     if (!sendParams.Init(aCx, param)) {
       return NS_ERROR_TYPE_ERR;
     }
-  }
-
-  if (sendParams.mServiceId.WasPassed()) {
-    serviceId = sendParams.mServiceId.Value();
-  } else {
-    rv = mmsService->GetMmsDefaultServiceId(&serviceId);
-    NS_ENSURE_SUCCESS(rv, rv);
+    if (sendParams.mServiceId.WasPassed()) {
+      serviceId = sendParams.mServiceId.Value();
+    }
   }
 
   nsRefPtr<DOMRequest> request = new DOMRequest(GetOwner());
   nsCOMPtr<nsIMobileMessageCallback> msgCallback = new MobileMessageCallback(request);
   rv = mmsService->Send(serviceId, aParams, msgCallback);
   NS_ENSURE_SUCCESS(rv, rv);
 
   request.forget(aRequest);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-MobileMessageManager::GetMessageMoz(int32_t aId,
-                                    nsIDOMDOMRequest** aRequest)
+MobileMessageManager::GetMessageMoz(int32_t aId, nsIDOMDOMRequest** aRequest)
 {
-  nsCOMPtr<nsIMobileMessageDatabaseService> dbService =
+  nsCOMPtr<nsIMobileMessageDatabaseService> mobileMessageDBService =
     do_GetService(MOBILE_MESSAGE_DATABASE_SERVICE_CONTRACTID);
-  NS_ENSURE_TRUE(dbService, NS_ERROR_FAILURE);
+  NS_ENSURE_TRUE(mobileMessageDBService, NS_ERROR_FAILURE);
 
   nsRefPtr<DOMRequest> request = new DOMRequest(GetOwner());
   nsCOMPtr<nsIMobileMessageCallback> msgCallback = new MobileMessageCallback(request);
-  nsresult rv = dbService->GetMessageMoz(aId, msgCallback);
+  nsresult rv = mobileMessageDBService->GetMessageMoz(aId, msgCallback);
   NS_ENSURE_SUCCESS(rv, rv);
 
   request.forget(aRequest);
   return NS_OK;
 }
 
 nsresult
 MobileMessageManager::GetMessageId(JSContext* aCx,
@@ -319,18 +314,17 @@ MobileMessageManager::GetMessageId(JSCon
   if (mmsMessage) {
     return mmsMessage->GetId(aId);
   }
 
   return NS_ERROR_INVALID_ARG;
 }
 
 NS_IMETHODIMP
-MobileMessageManager::Delete(JS::Handle<JS::Value> aParam,
-                             JSContext* aCx,
+MobileMessageManager::Delete(JS::Handle<JS::Value> aParam, JSContext* aCx,
                              nsIDOMDOMRequest** aRequest)
 {
   // We expect Int32, SmsMessage, MmsMessage, Int32[], SmsMessage[], MmsMessage[]
   if (!aParam.isObject() && !aParam.isInt32()) {
     return NS_ERROR_INVALID_ARG;
   }
 
   nsresult rv = NS_OK;
@@ -415,29 +409,29 @@ MobileMessageManager::GetMessages(nsIDOM
 
   cursorCallback->mDOMCursor = new DOMCursor(GetOwner(), continueCallback);
   NS_ADDREF(*aCursor = cursorCallback->mDOMCursor);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-MobileMessageManager::MarkMessageRead(int32_t aId,
-                                      bool aValue,
+MobileMessageManager::MarkMessageRead(int32_t aId, bool aValue,
                                       bool aSendReadReport,
                                       nsIDOMDOMRequest** aRequest)
 {
-  nsCOMPtr<nsIMobileMessageDatabaseService> dbService =
+  nsCOMPtr<nsIMobileMessageDatabaseService> mobileMessageDBService =
     do_GetService(MOBILE_MESSAGE_DATABASE_SERVICE_CONTRACTID);
-  NS_ENSURE_TRUE(dbService, NS_ERROR_FAILURE);
+  NS_ENSURE_TRUE(mobileMessageDBService, NS_ERROR_FAILURE);
 
   nsRefPtr<DOMRequest> request = new DOMRequest(GetOwner());
   nsCOMPtr<nsIMobileMessageCallback> msgCallback = new MobileMessageCallback(request);
-  nsresult rv = dbService->MarkMessageRead(aId, aValue, aSendReadReport,
-                                           msgCallback);
+  nsresult rv = mobileMessageDBService->MarkMessageRead(aId, aValue,
+                                                        aSendReadReport,
+                                                        msgCallback);
   NS_ENSURE_SUCCESS(rv, rv);
 
   request.forget(aRequest);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 MobileMessageManager::GetThreads(nsIDOMDOMCursor** aCursor)
@@ -456,30 +450,30 @@ MobileMessageManager::GetThreads(nsIDOMD
 
   cursorCallback->mDOMCursor = new DOMCursor(GetOwner(), continueCallback);
   NS_ADDREF(*aCursor = cursorCallback->mDOMCursor);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-MobileMessageManager::RetrieveMMS(int32_t aId,
+MobileMessageManager::RetrieveMMS(int32_t id,
                                   nsIDOMDOMRequest** aRequest)
 {
-  nsCOMPtr<nsIMmsService> mmsService = do_GetService(MMS_SERVICE_CONTRACTID);
-  NS_ENSURE_TRUE(mmsService, NS_ERROR_FAILURE);
+    nsCOMPtr<nsIMmsService> mmsService = do_GetService(MMS_SERVICE_CONTRACTID);
+    NS_ENSURE_TRUE(mmsService, NS_ERROR_FAILURE);
 
-  nsRefPtr<DOMRequest> request = new DOMRequest(GetOwner());
-  nsCOMPtr<nsIMobileMessageCallback> msgCallback = new MobileMessageCallback(request);
+    nsRefPtr<DOMRequest> request = new DOMRequest(GetOwner());
+    nsCOMPtr<nsIMobileMessageCallback> msgCallback = new MobileMessageCallback(request);
 
-  nsresult rv = mmsService->Retrieve(aId, msgCallback);
-  NS_ENSURE_SUCCESS(rv, rv);
+    nsresult rv = mmsService->Retrieve(id, msgCallback);
+    NS_ENSURE_SUCCESS(rv, rv);
 
-  request.forget(aRequest);
-  return NS_OK;
+    request.forget(aRequest);
+    return NS_OK;
 }
 
 nsresult
 MobileMessageManager::DispatchTrustedSmsEventToSelf(const char* aTopic,
                                                     const nsAString& aEventName,
                                                     nsISupports* aMsg)
 {
   nsCOMPtr<nsIDOMMozSmsMessage> sms = do_QueryInterface(aMsg);
@@ -553,25 +547,24 @@ MobileMessageManager::Observe(nsISupport
   if (!strcmp(aTopic, kSmsReadErrorObserverTopic)) {
     return DispatchTrustedSmsEventToSelf(aTopic, READ_ERROR_EVENT_NAME, aSubject);
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-MobileMessageManager::GetSmscAddress(uint32_t aServiceId,
-                                     uint8_t aArgc,
+MobileMessageManager::GetSmscAddress(uint32_t aServiceId, uint8_t aArgc,
                                      nsIDOMDOMRequest** aRequest)
 {
   nsCOMPtr<nsISmsService> smsService = do_GetService(SMS_SERVICE_CONTRACTID);
   NS_ENSURE_TRUE(smsService, NS_ERROR_FAILURE);
 
   nsresult rv;
-  if (aArgc == 0) {
+  if (aArgc != 1) {
     rv = smsService->GetSmsDefaultServiceId(&aServiceId);
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   nsRefPtr<DOMRequest> request = new DOMRequest(GetOwner());
   nsCOMPtr<nsIMobileMessageCallback> msgCallback = new MobileMessageCallback(request);
   rv = smsService->GetSmscAddress(aServiceId, msgCallback);
   NS_ENSURE_SUCCESS(rv, rv);
--- a/dom/mobilemessage/src/MobileMessageManager.h
+++ b/dom/mobilemessage/src/MobileMessageManager.h
@@ -5,17 +5,16 @@
 
 #ifndef mozilla_dom_mobilemessage_MobileMessageManager_h
 #define mozilla_dom_mobilemessage_MobileMessageManager_h
 
 #include "mozilla/DOMEventTargetHelper.h"
 #include "nsIDOMMobileMessageManager.h"
 #include "nsIObserver.h"
 
-class nsISmsService;
 class nsIDOMMozSmsMessage;
 class nsIDOMMozMmsMessage;
 
 namespace mozilla {
 namespace dom {
 
 class MobileMessageManager : public DOMEventTargetHelper
                            , public nsIDOMMozMobileMessageManager
@@ -30,35 +29,29 @@ public:
 
   void Init(nsPIDOMWindow *aWindow);
   void Shutdown();
 
 private:
   /**
    * Internal Send() method used to send one message.
    */
-  nsresult
-  Send(JSContext* aCx,
-       JS::Handle<JSObject*> aGlobal,
-       nsISmsService* aSmsService,
-       uint32_t aServiceId,
-       JS::Handle<JSString*> aNumber,
-       const nsAString& aText,
-       JS::MutableHandle<JS::Value> aRequest);
+  nsresult Send(JSContext* aCx, JS::Handle<JSObject*> aGlobal,
+                uint32_t aServiceId,
+                JS::Handle<JSString*> aNumber,
+                const nsAString& aMessage,
+                JS::MutableHandle<JS::Value> aRequest);
 
-  nsresult
-  DispatchTrustedSmsEventToSelf(const char* aTopic,
-                                const nsAString& aEventName,
-                                nsISupports* aMsg);
+  nsresult DispatchTrustedSmsEventToSelf(const char* aTopic,
+                                         const nsAString& aEventName,
+                                         nsISupports* aMsg);
 
   /**
    * Helper to get message ID from SMS/MMS Message object
    */
-  nsresult
-  GetMessageId(JSContext* aCx,
-               const JS::Value& aMessage,
-               int32_t* aId);
+  nsresult GetMessageId(JSContext* aCx, const JS::Value& aMessage,
+                        int32_t* aId);
 };
 
 } // namespace dom
 } // namespace mozilla
 
 #endif // mozilla_dom_mobilemessage_MobileMessageManager_h