Autogenerated with:
cp dom/.clang-format netwerk/ && mach format netwerk/**.{cpp,h,mm}
Manual fixes:
* mozurl/cbindgen.toml (including headers earlier)
* NetlinkService.h (forward-declaring a necessary struct)
* nsIWebSocketChannel.idl (forward-declaring OriginAttributes).
* nsAsyncRedirectVerifyHelper.h (forward-declaring nsIEventTarget)
* CapsuleEncoder.h gets a missing Capsule forward-decl.
* WebSocketConnectionBase.h gets some missing includes.
* HappyEyeballsConnectionAttempt gets some missing includes.
* nsUDPSocket missed nsSocketTransportService2.h for OnSocketThread().
* HttpInfo missed a forward declaration.
* MockHttpAuth missed an nsCOMPtr include.
* nsHttpAuthManager missed a forward declaration for nsIHttpAuthCache.
* WebTransportSessionProxy was using mozilla::Mutex in a member without
including it.
* win32 fixes to keep include order because windows headers suck.
* nsInputStreamPump needs an Atomics.h include.
Differential Revision: https://phabricator.services.mozilla.com/D311696
105 lines
3.3 KiB
C++
105 lines
3.3 KiB
C++
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
#include "ParentChannelWrapper.h"
|
|
|
|
#include "mozilla/dom/RemoteType.h"
|
|
#include "mozilla/net/ChannelClassifierUtils.h"
|
|
#include "mozilla/net/HttpBaseChannel.h"
|
|
#include "mozilla/net/RedirectChannelRegistrar.h"
|
|
#include "nsIViewSourceChannel.h"
|
|
#include "nsNetUtil.h"
|
|
#include "nsQueryObject.h"
|
|
|
|
namespace mozilla {
|
|
namespace net {
|
|
|
|
NS_IMPL_ISUPPORTS(ParentChannelWrapper, nsIParentChannel, nsIStreamListener,
|
|
nsIRequestObserver);
|
|
|
|
void ParentChannelWrapper::Register(uint64_t aRegistrarId,
|
|
uint64_t aContentParentId) {
|
|
nsCOMPtr<nsIRedirectChannelRegistrar> registrar =
|
|
RedirectChannelRegistrar::GetOrCreate();
|
|
if (!registrar) {
|
|
// Shutdown is in progress.
|
|
return;
|
|
}
|
|
nsCOMPtr<nsIChannel> dummy;
|
|
MOZ_ALWAYS_SUCCEEDS(NS_LinkRedirectChannels(aRegistrarId, aContentParentId,
|
|
this, getter_AddRefs(dummy)));
|
|
|
|
#ifdef DEBUG
|
|
// The channel registered with the RedirectChannelRegistrar will be the inner
|
|
// channel when dealing with view-source loads.
|
|
if (nsCOMPtr<nsIViewSourceChannel> viewSource = do_QueryInterface(mChannel)) {
|
|
MOZ_ASSERT(dummy == viewSource->GetInnerChannel());
|
|
} else {
|
|
MOZ_ASSERT(dummy == mChannel);
|
|
}
|
|
#endif
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
// nsIParentChannel
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
NS_IMETHODIMP
|
|
ParentChannelWrapper::SetParentListener(
|
|
mozilla::net::ParentChannelListener* listener) {
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
ParentChannelWrapper::SetClassifierMatchedInfo(const nsACString& aList,
|
|
const nsACString& aProvider,
|
|
const nsACString& aFullHash) {
|
|
nsCOMPtr<nsIClassifiedChannel> classifiedChannel =
|
|
do_QueryInterface(mChannel);
|
|
if (classifiedChannel) {
|
|
classifiedChannel->SetMatchedInfo(aList, aProvider, aFullHash);
|
|
}
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
ParentChannelWrapper::SetClassifierMatchedTrackingInfo(
|
|
const nsACString& aLists, const nsACString& aFullHash) {
|
|
nsCOMPtr<nsIClassifiedChannel> classifiedChannel =
|
|
do_QueryInterface(mChannel);
|
|
if (classifiedChannel) {
|
|
nsTArray<nsCString> lists, fullhashes;
|
|
for (const nsACString& token : aLists.Split(',')) {
|
|
lists.AppendElement(token);
|
|
}
|
|
for (const nsACString& token : aFullHash.Split(',')) {
|
|
fullhashes.AppendElement(token);
|
|
}
|
|
classifiedChannel->SetMatchedTrackingInfo(lists, fullhashes);
|
|
}
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
ParentChannelWrapper::NotifyClassificationFlags(uint32_t aClassificationFlags,
|
|
bool aIsThirdParty) {
|
|
ChannelClassifierUtils::SetClassificationFlagsHelper(
|
|
mChannel, aClassificationFlags, aIsThirdParty);
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
ParentChannelWrapper::Delete() { return NS_OK; }
|
|
|
|
NS_IMETHODIMP
|
|
ParentChannelWrapper::GetRemoteType(nsACString& aRemoteType) {
|
|
aRemoteType = NOT_REMOTE_TYPE;
|
|
return NS_OK;
|
|
}
|
|
|
|
} // namespace net
|
|
} // namespace mozilla
|
|
|
|
#undef LOG
|