Review of attachment 747377:
-----------------------------------------------------------------
::: dom/bluetooth/BluetoothHfpManager.cpp
@@ +1490,5 @@
> + // For active connection request, we need to reply the DOMRequest
> + if (mScoRunnable) {
> + DispatchBluetoothReply(mScoRunnable,
> + BluetoothValue(true), NS_LITERAL_STRING(""));
> + mScoRunnable.forget();
This should be: mScoRunnable = nullptr; otherwise it'll leak.
@@ +1505,5 @@
> + if (mScoRunnable) {
> + NS_NAMED_LITERAL_STRING(replyError, "Failed to create SCO socket!");
> + DispatchBluetoothReply(mScoRunnable, BluetoothValue(), replyError);
> +
> + mScoRunnable.forget();
This also leaks.
@@ +1516,5 @@
> +BluetoothHfpManager::OnScoDisconnect()
> +{
> + if (mScoSocketStatus == SocketConnectionStatus::SOCKET_CONNECTED) {
> + ListenSco();
> + NotifyAudioManager(NS_LITERAL_STRING(""));
All of the places where you use NS_LITERAL_STRING("") should be changed to use
EmptyString().
@@ +1568,5 @@
> + BluetoothService* bs = BluetoothService::Get();
> + NS_ENSURE_TRUE(bs, false);
> + nsresult rv = bs->GetScoSocket(mDeviceAddress, true, false, mScoSocket);
> +
> + return NS_FAILED(rv) ? false : true;
Please change this to: return NS_SUCCEEDED(rv).