Backed out changeset a78ad976faf3 (bug 1147736)
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Wed, 06 May 2015 17:02:38 +0200
changeset 273913 ec6f7f1add4b04fb5ca07915a5a4a931bb2ed34e
parent 273912 2dc903ac0c3c1e8566525c7d413aad2ffcb03bdb
child 273914 deb124404f677b2259c4e2268d2435956fe63c30
push id863
push userraliiev@mozilla.com
push dateMon, 03 Aug 2015 13:22:43 +0000
treeherdermozilla-release@f6321b14228d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1147736
milestone40.0a1
backs outa78ad976faf317828b6cb268dced774e863b6b80
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 a78ad976faf3 (bug 1147736)
dom/telephony/Telephony.cpp
dom/telephony/TelephonyCall.cpp
dom/telephony/gonk/TelephonyService.js
--- a/dom/telephony/Telephony.cpp
+++ b/dom/telephony/Telephony.cpp
@@ -372,24 +372,20 @@ Telephony::HandleCallInfo(nsITelephonyCa
     call->UpdateSwitchable(isSwitchable);
     call->UpdateMergeable(isMergeable);
 
     nsAutoString number;
     aInfo->GetNumber(number);
     nsRefPtr<TelephonyCallId> id = call->Id();
     id->UpdateNumber(number);
 
-    nsAutoString disconnectedReason;
-    aInfo->GetDisconnectedReason(disconnectedReason);
-
     // State changed.
     if (call->CallState() != callState) {
       if (callState == nsITelephonyService::CALL_STATE_DISCONNECTED) {
-        call->UpdateDisconnectedReason(disconnectedReason);
-        call->ChangeState(nsITelephonyService::CALL_STATE_DISCONNECTED);
+        call->ChangeStateInternal(callState, true);
         return NS_OK;
       }
 
       // We don't fire the statechange event on a call in conference here.
       // Instead, the event will be fired later in
       // TelephonyCallGroup::ChangeState(). Thus the sequence of firing the
       // statechange events is guaranteed: first on TelephonyCallGroup then on
       // individual TelephonyCall objects.
--- a/dom/telephony/TelephonyCall.cpp
+++ b/dom/telephony/TelephonyCall.cpp
@@ -129,16 +129,17 @@ TelephonyCall::ChangeStateInternal(uint1
   if (aCallState == nsITelephonyService::CALL_STATE_DISCONNECTED) {
     NS_ASSERTION(mLive, "Should be live!");
     mLive = false;
     if (mGroup) {
       mGroup->RemoveCall(this);
     } else {
       mTelephony->RemoveCall(this);
     }
+    UpdateDisconnectedReason(NS_LITERAL_STRING("NormalCallClearingError"));
   } else if (!mLive) {
     mLive = true;
     if (mGroup) {
       mGroup->AddCall(this);
     } else {
       mTelephony->AddCall(this);
     }
   }
@@ -205,33 +206,26 @@ TelephonyCall::NotifyError(const nsAStri
   if (NS_FAILED(rv)) {
     NS_WARNING("Failed to dispatch error event!");
   }
 }
 
 void
 TelephonyCall::UpdateDisconnectedReason(const nsAString& aDisconnectedReason)
 {
-  NS_ASSERTION(Substring(aDisconnectedReason,
-                         aDisconnectedReason.Length() - 5).EqualsLiteral("Error"),
+  NS_ASSERTION(Substring(aDisconnectedReason, aDisconnectedReason.Length() - 5).EqualsLiteral("Error"),
                "Disconnected reason should end with 'Error'");
 
-  if (!mDisconnectedReason.IsNull()) {
-    return;
-  }
-
-  // There is no 'Error' suffix in the corresponding enum. We should skip
-  // that part for comparison.
-  CONVERT_STRING_TO_NULLABLE_ENUM(
-      Substring(aDisconnectedReason, 0, aDisconnectedReason.Length() - 5),
-      TelephonyCallDisconnectedReason,
-      mDisconnectedReason);
-
-  if (!aDisconnectedReason.EqualsLiteral("NormalCallClearingError")) {
-    NotifyError(aDisconnectedReason);
+  if (mDisconnectedReason.IsNull()) {
+    // There is no 'Error' suffix in the corresponding enum. We should skip
+    // that part for comparison.
+    CONVERT_STRING_TO_NULLABLE_ENUM(
+        Substring(aDisconnectedReason, 0, aDisconnectedReason.Length() - 5),
+        TelephonyCallDisconnectedReason,
+        mDisconnectedReason);
   }
 }
 
 void
 TelephonyCall::ChangeGroup(TelephonyCallGroup* aGroup)
 {
   mGroup = aGroup;
 
--- a/dom/telephony/gonk/TelephonyService.js
+++ b/dom/telephony/gonk/TelephonyService.js
@@ -1445,16 +1445,20 @@ TelephonyService.prototype = {
     this._cdmaCallWaitingNumber = null;
   },
 
   /**
    * Disconnect calls by updating their states. Sometimes, it may cause other
    * calls being disconnected as well.
    *
    * @return Array a list of calls we need to fire callStateChange
+   *
+   * TODO: The list currently doesn't contain calls that we fire notifyError
+   * for them. However, after Bug 1147736, notifyError is replaced by
+   * callStateChanged and those calls should be included in the list.
    */
   _disconnectCalls: function(aClientId, aCalls,
                              aFailCause = RIL.GECKO_CALL_ERROR_NORMAL_CALL_CLEARING) {
     if (DEBUG) debug("_disconnectCalls: " + JSON.stringify(aCalls));
 
     // Child cannot live without parent. Let's find all the calls that need to
     // be disconnected.
     let disconnectedCalls = aCalls.slice();
@@ -1468,26 +1472,32 @@ TelephonyService.prototype = {
 
     // Store unique value in the list.
     disconnectedCalls = [...Set(disconnectedCalls)];
 
     let callsForStateChanged = [];
 
     disconnectedCalls.forEach(call => {
       call.state = nsITelephonyService.CALL_STATE_DISCONNECTED;
-      call.disconnectedReason = aFailCause;
+      call.failCause = aFailCause;
 
       if (call.parentId) {
         let parentCall = this._currentCalls[aClientId][call.parentId];
         delete parentCall.childId;
       }
 
       this._notifyCallEnded(call);
 
-      callsForStateChanged.push(call);
+      if (call.hangUpLocal || !call.failCause ||
+          call.failCause === RIL.GECKO_CALL_ERROR_NORMAL_CALL_CLEARING) {
+        callsForStateChanged.push(call);
+      } else {
+        this._notifyAllListeners("notifyError",
+                                 [aClientId, call.callIndex, call.failCause]);
+      }
 
       delete this._currentCalls[aClientId][call.callIndex];
     });
 
     return callsForStateChanged;
   },
 
   /**