Bug 1195273 - Suppress assertion check in ~ErrorResult() if no exception to be thrown. r=echen
authorBevis Tseng <btseng@mozilla.com>
Wed, 19 Aug 2015 18:24:58 +0800
changeset 291270 bddfb9cc0a7894a7a15883dad1abe702eb7f29bb
parent 291269 1c1b9bf94e4e87310e02dd8b79e2d7d20593e4dd
child 291271 3a599950203e8ae6a7328f7c841ee82ad39c674c
push id5245
push userraliiev@mozilla.com
push dateThu, 29 Oct 2015 11:30:51 +0000
treeherdermozilla-beta@dac831dc1bd0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersechen
bugs1195273
milestone43.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 1195273 - Suppress assertion check in ~ErrorResult() if no exception to be thrown. r=echen
dom/icc/IccCallback.cpp
dom/icc/IccContact.cpp
--- a/dom/icc/IccCallback.cpp
+++ b/dom/icc/IccCallback.cpp
@@ -71,24 +71,26 @@ IccContactToMozContact(JSContext* aCx, G
       emailSeq.AppendElement(email, fallible);
     }
     NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY(count, rawStringArray);
   }
 
   ErrorResult er;
   nsRefPtr<mozContact> contact
     = mozContact::Constructor(aGlobal, aCx, properties, er);
-  NS_ENSURE_FALSE(er.Failed(), er.StealNSResult());
+  rv = er.StealNSResult();
+  NS_ENSURE_SUCCESS(rv, rv);
 
   nsAutoString contactId;
   rv = aIccContact->GetId(contactId);
   NS_ENSURE_SUCCESS(rv, rv);
 
   contact->SetId(contactId, er);
-  NS_ENSURE_FALSE(er.Failed(), er.StealNSResult());
+  rv = er.StealNSResult();
+  NS_ENSURE_SUCCESS(rv, rv);
 
   contact.forget(aMozContact);
 
   return NS_OK;
 }
 
 static NS_IMETHODIMP
 IccContactListToMozContactList(JSContext* aCx, GlobalObject& aGlobal,
--- a/dom/icc/IccContact.cpp
+++ b/dom/icc/IccContact.cpp
@@ -16,45 +16,49 @@ NS_IMPL_ISUPPORTS(IccContact, nsIIccCont
 IccContact::Create(mozContact& aMozContact, nsIIccContact** aIccContact)
 {
   *aIccContact = nullptr;
   ErrorResult er;
 
   // Id
   nsAutoString id;
   aMozContact.GetId(id, er);
-  NS_ENSURE_SUCCESS(er.StealNSResult(), NS_ERROR_FAILURE);
+  nsresult rv = er.StealNSResult();
+  NS_ENSURE_SUCCESS(rv, rv);
 
   // Names
   Nullable<nsTArray<nsString>> names;
   aMozContact.GetName(names, er);
-  NS_ENSURE_SUCCESS(er.StealNSResult(), NS_ERROR_FAILURE);
+  rv = er.StealNSResult();
+  NS_ENSURE_SUCCESS(rv, rv);
   if (names.IsNull()) {
     // Set as Empty nsTarray<nsString> for IccContact constructor.
     names.SetValue();
   }
 
   // Numbers
   Nullable<nsTArray<ContactTelField>> nullableNumberList;
   aMozContact.GetTel(nullableNumberList, er);
-  NS_ENSURE_SUCCESS(er.StealNSResult(), NS_ERROR_FAILURE);
+  rv = er.StealNSResult();
+  NS_ENSURE_SUCCESS(rv, rv);
   nsTArray<nsString> numbers;
   if (!nullableNumberList.IsNull()) {
     const nsTArray<ContactTelField>& numberList = nullableNumberList.Value();
     for (uint32_t i = 0; i < numberList.Length(); i++) {
       if (numberList[i].mValue.WasPassed()) {
         numbers.AppendElement(numberList[i].mValue.Value());
       }
     }
   }
 
   // Emails
   Nullable<nsTArray<ContactField>> nullableEmailList;
   aMozContact.GetEmail(nullableEmailList, er);
-  NS_ENSURE_SUCCESS(er.StealNSResult(), NS_ERROR_FAILURE);
+  rv = er.StealNSResult();
+  NS_ENSURE_SUCCESS(rv, rv);
   nsTArray<nsString> emails;
   if (!nullableEmailList.IsNull()) {
     const nsTArray<ContactField>& emailList = nullableEmailList.Value();
     for (uint32_t i = 0; i < emailList.Length(); i++) {
       if (emailList[i].mValue.WasPassed()) {
         emails.AppendElement(emailList[i].mValue.Value());
       }
     }