diff --git a/ipc/glue/MessageChannel.cpp b/ipc/glue/MessageChannel.cpp index f4f6ba4be3f3..bd7fb8181230 100644 --- a/ipc/glue/MessageChannel.cpp +++ b/ipc/glue/MessageChannel.cpp @@ -717,7 +717,7 @@ MessageChannel::Clear() gUnresolvedPromises -= mPendingPromises.size(); for (auto& pair : mPendingPromises) { - pair.second.mRejectFunction(pair.second.mPromise, __func__); + pair.second.mRejectFunction(__func__); } mPendingPromises.clear(); diff --git a/ipc/glue/MessageChannel.h b/ipc/glue/MessageChannel.h index 5443727e433f..69d3225efebc 100644 --- a/ipc/glue/MessageChannel.h +++ b/ipc/glue/MessageChannel.h @@ -98,7 +98,7 @@ class MessageChannel : HasResultCodes, MessageLoop::DestructionObserver struct PromiseHolder { RefPtr mPromise; - std::function mRejectFunction; + std::function mRejectFunction; }; static Atomic gUnresolvedPromises; friend class PromiseReporter; @@ -186,10 +186,8 @@ class MessageChannel : HasResultCodes, MessageLoop::DestructionObserver } PromiseHolder holder; holder.mPromise = aPromise; - holder.mRejectFunction = [](MozPromiseRefcountable* aPromise, - const char* aRejectSite) { - static_cast(aPromise)->Reject( - PromiseRejectReason::ChannelClosed, aRejectSite); + holder.mRejectFunction = [aPromise](const char* aRejectSite) { + aPromise->Reject(PromiseRejectReason::ChannelClosed, aRejectSite); }; mPendingPromises.insert(std::make_pair(seqno, Move(holder))); gUnresolvedPromises++; diff --git a/ipc/ipdl/test/cxx/TestAsyncReturns.cpp b/ipc/ipdl/test/cxx/TestAsyncReturns.cpp index f34b46a9b269..12c6c4a7a37e 100644 --- a/ipc/ipdl/test/cxx/TestAsyncReturns.cpp +++ b/ipc/ipdl/test/cxx/TestAsyncReturns.cpp @@ -2,8 +2,6 @@ #include "IPDLUnitTests.h" // fail etc. -#include "mozilla/Unused.h" - namespace mozilla { namespace _ipdltest { @@ -81,7 +79,7 @@ mozilla::ipc::IPCResult TestAsyncReturnsChild::RecvNoReturn(RefPtr&& aPromise) { // Leak the promise intentionally - Unused << do_AddRef(aPromise); + aPromise->AddRef(); return IPC_OK(); }