tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

ClientNavigateOpParent.cpp (1375B)


      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/. */
      6 
      7 #include "ClientNavigateOpParent.h"
      8 
      9 namespace mozilla::dom {
     10 
     11 using mozilla::ipc::IPCResult;
     12 
     13 void ClientNavigateOpParent::ActorDestroy(ActorDestroyReason aReason) {
     14  if (mPromise) {
     15    CopyableErrorResult rv;
     16    rv.ThrowAbortError("Client aborted");
     17    mPromise->Reject(rv, __func__);
     18    mPromise = nullptr;
     19  }
     20 }
     21 
     22 IPCResult ClientNavigateOpParent::Recv__delete__(
     23    const ClientOpResult& aResult) {
     24  if (aResult.type() == ClientOpResult::TCopyableErrorResult &&
     25      aResult.get_CopyableErrorResult().Failed()) {
     26    mPromise->Reject(aResult.get_CopyableErrorResult(), __func__);
     27    mPromise = nullptr;
     28    return IPC_OK();
     29  }
     30  mPromise->Resolve(aResult, __func__);
     31  mPromise = nullptr;
     32  return IPC_OK();
     33 }
     34 
     35 ClientNavigateOpParent::ClientNavigateOpParent(
     36    const ClientNavigateOpConstructorArgs& aArgs,
     37    ClientOpPromise::Private* aPromise)
     38    : mPromise(aPromise) {
     39  MOZ_DIAGNOSTIC_ASSERT(mPromise);
     40 }
     41 
     42 ClientNavigateOpParent::~ClientNavigateOpParent() {
     43  MOZ_DIAGNOSTIC_ASSERT(!mPromise);
     44 }
     45 
     46 }  // namespace mozilla::dom