gecko-dev/netwerk/base/SimpleChannelParent.cpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

106 lines
2.8 KiB
C++
Raw Normal View History

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=4 sw=2 sts=2 et tw=80: */
/* 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 "SimpleChannelParent.h"
#include "mozilla/Assertions.h"
#include "nsNetUtil.h"
#include "nsIChannel.h"
namespace mozilla {
namespace net {
NS_IMPL_ISUPPORTS(SimpleChannelParent, nsIParentChannel, nsIStreamListener)
bool SimpleChannelParent::Init(const uint32_t& channelId) {
nsCOMPtr<nsIChannel> channel;
MOZ_ALWAYS_SUCCEEDS(
NS_LinkRedirectChannels(channelId, this, getter_AddRefs(channel)));
return true;
}
NS_IMETHODIMP
SimpleChannelParent::SetParentListener(HttpChannelParentListener* aListener) {
// Nothing to do.
return NS_OK;
}
NS_IMETHODIMP
SimpleChannelParent::NotifyTrackingProtectionDisabled() {
// Nothing to do.
return NS_OK;
}
NS_IMETHODIMP
SimpleChannelParent::NotifyCookieAllowed() {
// Nothing to do.
return NS_OK;
}
NS_IMETHODIMP
SimpleChannelParent::NotifyTrackingCookieBlocked(uint32_t aRejectedReason) {
// Nothing to do.
return NS_OK;
}
NS_IMETHODIMP
Bug 1482950 - Use the correct 3rdparty check in tracking annotations. r=dimi,Ehsan,mayhemer!,ehsan! The mIsTrackingResource flag on nsIHttpChannel was split into two separate flags depending on whether or not the resource is third-party. The correct flag will be set by the channel classifier. Similarly, a new function was introduced, GetIsThirdPartyTrackingResource(), for those consumers (like TP) who only care about third-party trackers. The existing function, GetIsTracking(), will continue to look at both first-party and third-party trackers (the behavior since first party tracking was added to annotations in bug 1476324). The OverrideTrackingResource() function now allows nsHTMLDocument to override both mIsFirstPartyTrackingResource and mIsThirdPartyTrackingResource, but since this function is a little dangerous and only has a single user, I added an assert to make future callers think twice about using it to opt out of tracking annotations. Currently, only the default storage restrictions need to look at first-party trackers so every other consumer has been moved to mIsThirdPartyTrackingResource or GetIsThirdPartyTrackingResource(). This effectively reverts the third-party checks added in bug 1476715 and replaces them with the more complicated check that was added in bug 1108017. It follows the approach that Ehsan initially suggested in bug 1476715. It also reverts the changes in the expected values of the tracking annotation test since these were, in hindsight, a warning about this regression. Depends on D3722 Differential Revision: https://phabricator.services.mozilla.com/D3723 --HG-- extra : moz-landing-system : lando
2018-08-20 23:53:45 +00:00
SimpleChannelParent::NotifyTrackingResource(bool aIsThirdParty) {
// Nothing to do.
return NS_OK;
}
NS_IMETHODIMP
SimpleChannelParent::NotifyFlashPluginStateChanged(
nsIHttpChannel::FlashPluginState aState) {
// Nothing to do.
return NS_OK;
}
NS_IMETHODIMP
SimpleChannelParent::SetClassifierMatchedInfo(const nsACString& aList,
const nsACString& aProvider,
const nsACString& aPrefix) {
// nothing to do
return NS_OK;
}
NS_IMETHODIMP
SimpleChannelParent::Delete() {
// Nothing to do.
return NS_OK;
}
void SimpleChannelParent::ActorDestroy(ActorDestroyReason aWhy) {}
NS_IMETHODIMP
SimpleChannelParent::OnStartRequest(nsIRequest* aRequest,
nsISupports* aContext) {
// We don't have a way to prevent nsBaseChannel from calling AsyncOpen on
// the created nsSimpleChannel. We don't have anywhere to send the data in the
// parent, so abort the binding.
return NS_BINDING_ABORTED;
}
NS_IMETHODIMP
SimpleChannelParent::OnStopRequest(nsIRequest* aRequest, nsISupports* aContext,
nsresult aStatusCode) {
// See above.
MOZ_ASSERT(NS_FAILED(aStatusCode));
return NS_OK;
}
NS_IMETHODIMP
SimpleChannelParent::OnDataAvailable(nsIRequest* aRequest,
nsISupports* aContext,
nsIInputStream* aInputStream,
uint64_t aOffset, uint32_t aCount) {
// See above.
MOZ_CRASH("Should never be called");
}
} // namespace net
} // namespace mozilla