Backed out 2 changesets (bug 1900622) for causing Bug 1908553 and ktlint failure...
[gecko.git] / netwerk / base / SimpleChannelParent.cpp
blob3a58e14843f4aa06eaf5b133618050110bc9d008
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=4 sw=2 sts=2 et 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 "SimpleChannelParent.h"
8 #include "mozilla/Assertions.h"
9 #include "nsNetUtil.h"
10 #include "nsIChannel.h"
12 #ifdef FUZZING_SNAPSHOT
13 # define MOZ_ALWAYS_SUCCEEDS_FUZZING(...) (void)__VA_ARGS__
14 #else
15 # define MOZ_ALWAYS_SUCCEEDS_FUZZING(...) MOZ_ALWAYS_SUCCEEDS(__VA_ARGS__)
16 #endif
18 namespace mozilla {
19 namespace net {
21 NS_IMPL_ISUPPORTS(SimpleChannelParent, nsIParentChannel, nsIStreamListener)
23 bool SimpleChannelParent::Init(const uint64_t& aChannelId) {
24 nsCOMPtr<nsIChannel> channel;
26 MOZ_ALWAYS_SUCCEEDS_FUZZING(
27 NS_LinkRedirectChannels(aChannelId, this, getter_AddRefs(channel)));
29 return true;
32 NS_IMETHODIMP
33 SimpleChannelParent::SetParentListener(ParentChannelListener* aListener) {
34 // Nothing to do.
35 return NS_OK;
38 NS_IMETHODIMP
39 SimpleChannelParent::NotifyClassificationFlags(uint32_t aClassificationFlags,
40 bool aIsThirdParty) {
41 // Nothing to do.
42 return NS_OK;
45 NS_IMETHODIMP
46 SimpleChannelParent::SetClassifierMatchedInfo(const nsACString& aList,
47 const nsACString& aProvider,
48 const nsACString& aPrefix) {
49 // nothing to do
50 return NS_OK;
53 NS_IMETHODIMP
54 SimpleChannelParent::SetClassifierMatchedTrackingInfo(
55 const nsACString& aLists, const nsACString& aFullHashes) {
56 // nothing to do
57 return NS_OK;
60 NS_IMETHODIMP
61 SimpleChannelParent::Delete() {
62 // Nothing to do.
63 return NS_OK;
66 NS_IMETHODIMP
67 SimpleChannelParent::GetRemoteType(nsACString& aRemoteType) {
68 return NS_ERROR_NOT_IMPLEMENTED;
71 void SimpleChannelParent::ActorDestroy(ActorDestroyReason aWhy) {}
73 NS_IMETHODIMP
74 SimpleChannelParent::OnStartRequest(nsIRequest* aRequest) {
75 // We don't have a way to prevent nsBaseChannel from calling AsyncOpen on
76 // the created nsSimpleChannel. We don't have anywhere to send the data in the
77 // parent, so abort the binding.
78 return NS_BINDING_ABORTED;
81 NS_IMETHODIMP
82 SimpleChannelParent::OnStopRequest(nsIRequest* aRequest, nsresult aStatusCode) {
83 // See above.
84 MOZ_ASSERT(NS_FAILED(aStatusCode));
85 return NS_OK;
88 NS_IMETHODIMP
89 SimpleChannelParent::OnDataAvailable(nsIRequest* aRequest,
90 nsIInputStream* aInputStream,
91 uint64_t aOffset, uint32_t aCount) {
92 // See above.
93 MOZ_CRASH("Should never be called");
96 } // namespace net
97 } // namespace mozilla