Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/netwerk/base/ChannelDiverterParent.cpp
Line
Count
Source (jump to first uncovered line)
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 "mozilla/net/ChannelDiverterParent.h"
8
#include "mozilla/net/NeckoChannelParams.h"
9
#include "mozilla/net/HttpChannelParent.h"
10
#include "mozilla/net/FTPChannelParent.h"
11
#include "mozilla/net/PHttpChannelParent.h"
12
#include "mozilla/net/PFTPChannelParent.h"
13
#include "ADivertableParentChannel.h"
14
15
namespace mozilla {
16
namespace net {
17
18
bool
19
ChannelDiverterParent::Init(const ChannelDiverterArgs& aArgs)
20
0
{
21
0
  switch (aArgs.type()) {
22
0
  case ChannelDiverterArgs::THttpChannelDiverterArgs:
23
0
  {
24
0
    auto httpParent = static_cast<HttpChannelParent*>(
25
0
      aArgs.get_HttpChannelDiverterArgs().mChannelParent());
26
0
    httpParent->SetApplyConversion(aArgs.get_HttpChannelDiverterArgs().mApplyConversion());
27
0
28
0
    mDivertableChannelParent =
29
0
      static_cast<ADivertableParentChannel*>(httpParent);
30
0
    break;
31
0
  }
32
0
  case ChannelDiverterArgs::TPFTPChannelParent:
33
0
  {
34
0
    mDivertableChannelParent = static_cast<ADivertableParentChannel*>(
35
0
      static_cast<FTPChannelParent*>(aArgs.get_PFTPChannelParent()));
36
0
    break;
37
0
  }
38
0
  default:
39
0
    MOZ_ASSERT_UNREACHABLE("unknown ChannelDiverterArgs type");
40
0
    return false;
41
0
  }
42
0
  MOZ_ASSERT(mDivertableChannelParent);
43
0
44
0
  nsresult rv = mDivertableChannelParent->SuspendForDiversion();
45
0
  if (NS_WARN_IF(NS_FAILED(rv))) {
46
0
    return false;
47
0
  }
48
0
  return true;
49
0
}
50
51
void
52
ChannelDiverterParent::DivertTo(nsIStreamListener* newListener)
53
0
{
54
0
  MOZ_ASSERT(newListener);
55
0
  MOZ_ASSERT(mDivertableChannelParent);
56
0
57
0
  mDivertableChannelParent->DivertTo(newListener);
58
0
}
59
60
void
61
ChannelDiverterParent::ActorDestroy(ActorDestroyReason aWhy)
62
0
{
63
0
  // Implement me! Bug 1005179
64
0
}
65
66
} // namespace net
67
} // namespace mozilla