Bug 804983 - WebTelephony API: DOM does not accurately handle an outgoing call. r=bent

This commit is contained in:
Hsin-Yi Tsai 2012-10-25 18:31:37 +08:00
parent f73dfbb691
commit 79c8386d65

View File

@ -402,8 +402,10 @@ Telephony::CallStateChanged(uint32_t aCallIndex, uint16_t aCallState,
return NS_OK;
}
// Didn't know anything about this call before now, must be incoming.
NS_ASSERTION(aCallState == nsIRadioInterfaceLayer::CALL_STATE_INCOMING,
// Didn't know anything about this call before now, could be 'incoming' or
// 'dialing' that was placed by others.
NS_ASSERTION(aCallState == nsIRadioInterfaceLayer::CALL_STATE_INCOMING ||
aCallState == nsIRadioInterfaceLayer::CALL_STATE_DIALING,
"Serious logic problem here!");
nsRefPtr<TelephonyCall> call =
@ -412,13 +414,15 @@ Telephony::CallStateChanged(uint32_t aCallIndex, uint16_t aCallState,
NS_ASSERTION(mCalls.Contains(call), "Should have auto-added new call!");
// Dispatch incoming event.
nsRefPtr<CallEvent> event = CallEvent::Create(call);
NS_ASSERTION(event, "This should never fail!");
if (aCallState == nsIRadioInterfaceLayer::CALL_STATE_INCOMING) {
// Dispatch incoming event.
nsRefPtr<CallEvent> event = CallEvent::Create(call);
NS_ASSERTION(event, "This should never fail!");
nsresult rv =
event->Dispatch(ToIDOMEventTarget(), NS_LITERAL_STRING("incoming"));
NS_ENSURE_SUCCESS(rv, rv);
nsresult rv =
event->Dispatch(ToIDOMEventTarget(), NS_LITERAL_STRING("incoming"));
NS_ENSURE_SUCCESS(rv, rv);
}
return NS_OK;
}