Bug 983215 - Handle optional argument correctly in send()/sendMMS(). r=gene
authorEdgar Chen <echen@mozilla.com>
Fri, 14 Mar 2014 15:28:32 +0800
changeset 191982 f965cc60b60496f88ca8e7ab1df189c56cfe6c0f
parent 191981 dd7692876de6da9b53f4fd3fc0ff6890b7f8da90
child 191983 ffa3c24401086bfd3bd4c0865d21936d8171a593
push id474
push userasasaki@mozilla.com
push dateMon, 02 Jun 2014 21:01:02 +0000
treeherdermozilla-release@967f4cf1b31c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgene
bugs983215
milestone30.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 983215 - Handle optional argument correctly in send()/sendMMS(). r=gene
dom/mobilemessage/src/MobileMessageManager.cpp
--- a/dom/mobilemessage/src/MobileMessageManager.cpp
+++ b/dom/mobilemessage/src/MobileMessageManager.cpp
@@ -190,17 +190,17 @@ MobileMessageManager::Send(JS::Handle<JS
   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;
   rv = smsService->GetSmsDefaultServiceId(&serviceId);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  if (aArgc == 3) {
+  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();
     }
@@ -260,17 +260,17 @@ MobileMessageManager::SendMMS(JS::Handle
   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;
   nsresult rv = mmsService->GetMmsDefaultServiceId(&serviceId);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  if (aArgc == 2) {
+  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();
     }