Bug 1678988 - Stopped passing raw ErrorResult over IPC r=dom-storage-reviewers,janv

Differential Revision: https://phabricator.services.mozilla.com/D190542
This commit is contained in:
Michael van Straten 2023-10-23 16:15:36 +00:00
parent fa8f7f9a3f
commit ddf00d0232
3 changed files with 13 additions and 13 deletions

View File

@ -6,6 +6,7 @@
#include "mozilla/dom/cache/CacheOpParent.h"
#include "mozilla/ErrorResult.h"
#include "mozilla/StaticPrefs_browser.h"
#include "mozilla/Unused.h"
#include "mozilla/dom/cache/AutoUtils.h"
@ -46,8 +47,8 @@ void CacheOpParent::Execute(const SafeRefPtr<ManagerId>& aManagerId) {
auto managerOrErr = cache::Manager::AcquireCreateIfNonExistent(aManagerId);
if (NS_WARN_IF(managerOrErr.isErr())) {
ErrorResult result(managerOrErr.unwrapErr());
Unused << Send__delete__(this, std::move(result), void_t());
(void)Send__delete__(this, CopyableErrorResult(managerOrErr.unwrapErr()),
void_t());
return;
}
@ -128,8 +129,7 @@ void CacheOpParent::OnPrincipalVerified(
mVerifier = nullptr;
if (NS_WARN_IF(NS_FAILED(aRv))) {
ErrorResult result(aRv);
Unused << Send__delete__(this, std::move(result), void_t());
(void)Send__delete__(this, CopyableErrorResult(aRv), void_t());
return;
}
@ -147,7 +147,7 @@ void CacheOpParent::OnOpComplete(ErrorResult&& aRv,
// Never send an op-specific result if we have an error. Instead, send
// void_t() to ensure that we don't leak actors on the child side.
if (NS_WARN_IF(aRv.Failed())) {
Unused << Send__delete__(this, std::move(aRv), void_t());
(void)Send__delete__(this, CopyableErrorResult(std::move(aRv)), void_t());
return;
}
@ -155,7 +155,7 @@ void CacheOpParent::OnOpComplete(ErrorResult&& aRv,
ProcessCrossOriginResourcePolicyHeader(aRv,
aStreamInfo->mSavedResponseList);
if (NS_WARN_IF(aRv.Failed())) {
Unused << Send__delete__(this, std::move(aRv), void_t());
(void)Send__delete__(this, CopyableErrorResult(std::move(aRv)), void_t());
return;
}
}
@ -190,7 +190,8 @@ void CacheOpParent::OnOpComplete(ErrorResult&& aRv,
}
}
Unused << Send__delete__(this, std::move(aRv), result.SendAsOpResult());
(void)Send__delete__(this, CopyableErrorResult(std::move(aRv)),
result.SendAsOpResult());
}
already_AddRefed<nsIInputStream> CacheOpParent::DeserializeCacheStream(

View File

@ -6,6 +6,7 @@
#include "mozilla/dom/cache/CacheStorageParent.h"
#include "mozilla/ErrorResult.h"
#include "mozilla/Unused.h"
#include "mozilla/dom/cache/ActorUtils.h"
#include "mozilla/dom/cache/CacheOpParent.h"
@ -89,10 +90,8 @@ mozilla::ipc::IPCResult CacheStorageParent::RecvPCacheOpConstructor(
}
if (NS_WARN_IF(NS_FAILED(mVerifiedStatus))) {
ErrorResult result(mVerifiedStatus);
QM_WARNONLY_TRY(OkIf(
CacheOpParent::Send__delete__(actor, std::move(result), void_t())));
QM_WARNONLY_TRY(OkIf(CacheOpParent::Send__delete__(
actor, CopyableErrorResult(mVerifiedStatus), void_t())));
return IPC_OK();
}

View File

@ -10,7 +10,7 @@ include CacheTypes;
include "ipc/ErrorIPCUtils.h";
[MoveOnly] using mozilla::ErrorResult from "mozilla/ErrorResult.h";
using mozilla::CopyableErrorResult from "mozilla/ErrorResult.h";
namespace mozilla {
namespace dom {
@ -21,7 +21,7 @@ protocol PCacheOp
manager PCache or PCacheStorage;
child:
async __delete__(ErrorResult aRv, CacheOpResult aResult);
async __delete__(CopyableErrorResult aRv, CacheOpResult aResult);
};
} // namespace cache