Bug 1188394 - Fix warning: NS_ENSURE_TRUE(aTypes.Length()) failed, r=joliu

This commit is contained in:
Ben Tian 2015-07-29 16:39:02 +08:00
Родитель e7bc57e3ed
Коммит e6c5b6e3a5
4 изменённых файлов: 16 добавлений и 2 удалений

Просмотреть файл

@ -1008,6 +1008,11 @@ BluetoothAdapter::HandlePropertyChanged(const BluetoothValue& aValue)
} }
} }
if (types.IsEmpty()) {
// No adapter attribute changed
return;
}
DispatchAttributeEvent(types); DispatchAttributeEvent(types);
} }
@ -1134,7 +1139,7 @@ BluetoothAdapter::HandleDeviceUnpaired(const BluetoothValue& aValue)
void void
BluetoothAdapter::DispatchAttributeEvent(const Sequence<nsString>& aTypes) BluetoothAdapter::DispatchAttributeEvent(const Sequence<nsString>& aTypes)
{ {
NS_ENSURE_TRUE_VOID(aTypes.Length()); MOZ_ASSERT(!aTypes.IsEmpty());
BluetoothAttributeEventInit init; BluetoothAttributeEventInit init;
init.mAttrs = aTypes; init.mAttrs = aTypes;

Просмотреть файл

@ -285,6 +285,8 @@ private:
/** /**
* Fire BluetoothAttributeEvent to trigger onattributechanged event handler. * Fire BluetoothAttributeEvent to trigger onattributechanged event handler.
*
* @param aTypes [in] Array of changed attributes. Must be non-empty.
*/ */
void DispatchAttributeEvent(const Sequence<nsString>& aTypes); void DispatchAttributeEvent(const Sequence<nsString>& aTypes);

Просмотреть файл

@ -293,13 +293,18 @@ BluetoothDevice::HandlePropertyChanged(const BluetoothValue& aValue)
} }
} }
if (types.IsEmpty()) {
// No device attribute changed
return;
}
DispatchAttributeEvent(types); DispatchAttributeEvent(types);
} }
void void
BluetoothDevice::DispatchAttributeEvent(const Sequence<nsString>& aTypes) BluetoothDevice::DispatchAttributeEvent(const Sequence<nsString>& aTypes)
{ {
NS_ENSURE_TRUE_VOID(aTypes.Length()); MOZ_ASSERT(!aTypes.IsEmpty());
BluetoothAttributeEventInit init; BluetoothAttributeEventInit init;
init.mAttrs = aTypes; init.mAttrs = aTypes;

Просмотреть файл

@ -117,6 +117,8 @@ private:
/** /**
* Fire BluetoothAttributeEvent to trigger onattributechanged event handler. * Fire BluetoothAttributeEvent to trigger onattributechanged event handler.
*
* @param aTypes [in] Array of changed attributes. Must be non-empty.
*/ */
void DispatchAttributeEvent(const Sequence<nsString>& aTypes); void DispatchAttributeEvent(const Sequence<nsString>& aTypes);