Bug 1412856 part 4. Make SourcePromise have CopyableErrorResult as its rejection type. r=dom-workers-and-storage-reviewers,sg?

Differential Revision: https://phabricator.services.mozilla.com/D61199

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Boris Zbarsky 2020-01-30 08:54:55 +00:00
Родитель 18f4a563a6
Коммит 44423c8ecf
3 изменённых файлов: 11 добавлений и 7 удалений

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

@ -79,11 +79,9 @@ void ClientHandleOpParent::Init(ClientOpConstructorArgs&& aArgs) {
})
->Track(mPromiseRequestHolder);
},
[=](nsresult failure) {
[=](const CopyableErrorResult& failure) {
mSourcePromiseRequestHolder.Complete();
CopyableErrorResult rv;
rv.Throw(NS_ERROR_DOM_ABORT_ERR);
Unused << PClientHandleOpParent::Send__delete__(this, rv);
Unused << PClientHandleOpParent::Send__delete__(this, failure);
return;
})
->Track(mSourcePromiseRequestHolder);

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

@ -31,7 +31,9 @@ void ClientHandleParent::ActorDestroy(ActorDestroyReason aReason) {
}
if (mSourcePromise) {
mSourcePromise->Reject(NS_ERROR_FAILURE, __func__);
CopyableErrorResult rv;
rv.ThrowDOMException(NS_ERROR_DOM_ABORT_ERR, "Client aborted");
mSourcePromise->Reject(rv, __func__);
}
}
@ -88,7 +90,9 @@ void ClientHandleParent::FoundSource(ClientSourceParent* aSource) {
if (!ClientMatchPrincipalInfo(aSource->Info().PrincipalInfo(),
mPrincipalInfo)) {
if (mSourcePromise) {
mSourcePromise->Reject(NS_ERROR_FAILURE, __func__);
CopyableErrorResult rv;
rv.ThrowDOMException(NS_ERROR_DOM_ABORT_ERR, "Client aborted");
mSourcePromise->Reject(rv, __func__);
}
Unused << Send__delete__(this);
return;

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

@ -7,6 +7,7 @@
#define _mozilla_dom_ClientHandleParent_h
#include "mozilla/dom/PClientHandleParent.h"
#include "mozilla/ErrorResult.h"
namespace mozilla {
namespace dom {
@ -14,7 +15,8 @@ namespace dom {
class ClientManagerService;
class ClientSourceParent;
typedef MozPromise<ClientSourceParent*, nsresult, /* IsExclusive = */ false>
typedef MozPromise<ClientSourceParent*, CopyableErrorResult,
/* IsExclusive = */ false>
SourcePromise;
class ClientHandleParent final : public PClientHandleParent {