1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "ClientHandleOpChild.h"
9 #include "ClientHandle.h"
11 namespace mozilla::dom
{
13 void ClientHandleOpChild::ActorDestroy(ActorDestroyReason aReason
) {
14 mClientHandle
= nullptr;
15 CopyableErrorResult rv
;
16 rv
.ThrowAbortError("Client load aborted");
20 mozilla::ipc::IPCResult
ClientHandleOpChild::Recv__delete__(
21 const ClientOpResult
& aResult
) {
22 mClientHandle
= nullptr;
23 if (aResult
.type() == ClientOpResult::TCopyableErrorResult
&&
24 aResult
.get_CopyableErrorResult().Failed()) {
25 mRejectCallback(aResult
.get_CopyableErrorResult());
28 mResolveCallback(aResult
);
32 ClientHandleOpChild::ClientHandleOpChild(
33 ClientHandle
* aClientHandle
, const ClientOpConstructorArgs
& aArgs
,
34 const ClientOpCallback
&& aResolveCallback
,
35 const ClientOpCallback
&& aRejectCallback
)
36 : mClientHandle(aClientHandle
),
37 mResolveCallback(std::move(aResolveCallback
)),
38 mRejectCallback(std::move(aRejectCallback
)) {
39 MOZ_DIAGNOSTIC_ASSERT(mClientHandle
);
40 MOZ_DIAGNOSTIC_ASSERT(mResolveCallback
);
41 MOZ_DIAGNOSTIC_ASSERT(mRejectCallback
);
44 } // namespace mozilla::dom