зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 3 changesets (bug 1619584) for build bustages at UniquePtr.h. CLOSED TREE
Backed out changeset 0f77b2c11966 (bug 1619584) Backed out changeset 330cffde7320 (bug 1619584) Backed out changeset 563470b21a8f (bug 1619584)
This commit is contained in:
Родитель
f6e652812d
Коммит
2e859a7b70
|
@ -33,7 +33,6 @@
|
|||
#include "nsThreadUtils.h"
|
||||
#include "mozilla/Logging.h"
|
||||
|
||||
#include "mozilla/OriginAttributes.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/StaticPrefs_network.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
|
@ -1213,7 +1212,7 @@ nsresult Predictor::Prefetch(nsIURI* uri, nsIURI* referrer,
|
|||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIReferrerInfo> referrerInfo = new dom::ReferrerInfo(referrer);
|
||||
nsCOMPtr<nsIReferrerInfo> referrerInfo = new ReferrerInfo(referrer);
|
||||
rv = httpChannel->SetReferrerInfoWithoutClone(referrerInfo);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
// XXX - set a header here to indicate this is a prefetch?
|
||||
|
@ -2183,7 +2182,7 @@ Predictor::OnPredictPrefetch(nsIURI* aURI, uint32_t httpStatus) {
|
|||
|
||||
MOZ_DIAGNOSTIC_ASSERT(aURI, "aURI must not be null");
|
||||
|
||||
for (auto* cp : dom::ContentParent::AllProcesses(dom::ContentParent::eLive)) {
|
||||
for (auto* cp : ContentParent::AllProcesses(ContentParent::eLive)) {
|
||||
PNeckoParent* neckoParent = SingleManagedOrNull(cp->ManagedPNeckoParent());
|
||||
if (!neckoParent) {
|
||||
continue;
|
||||
|
@ -2210,7 +2209,7 @@ Predictor::OnPredictPreconnect(nsIURI* aURI) {
|
|||
|
||||
MOZ_DIAGNOSTIC_ASSERT(aURI, "aURI must not be null");
|
||||
|
||||
for (auto* cp : dom::ContentParent::AllProcesses(dom::ContentParent::eLive)) {
|
||||
for (auto* cp : ContentParent::AllProcesses(ContentParent::eLive)) {
|
||||
PNeckoParent* neckoParent = SingleManagedOrNull(cp->ManagedPNeckoParent());
|
||||
if (!neckoParent) {
|
||||
continue;
|
||||
|
@ -2237,7 +2236,7 @@ Predictor::OnPredictDNS(nsIURI* aURI) {
|
|||
|
||||
MOZ_DIAGNOSTIC_ASSERT(aURI, "aURI must not be null");
|
||||
|
||||
for (auto* cp : dom::ContentParent::AllProcesses(dom::ContentParent::eLive)) {
|
||||
for (auto* cp : ContentParent::AllProcesses(ContentParent::eLive)) {
|
||||
PNeckoParent* neckoParent = SingleManagedOrNull(cp->ManagedPNeckoParent());
|
||||
if (!neckoParent) {
|
||||
continue;
|
||||
|
|
|
@ -1,589 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 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 "TRRLoadInfo.h"
|
||||
#include "nsIRedirectHistoryEntry.h"
|
||||
|
||||
using namespace mozilla::dom;
|
||||
|
||||
namespace mozilla {
|
||||
namespace net {
|
||||
|
||||
NS_IMPL_ISUPPORTS(TRRLoadInfo, nsILoadInfo)
|
||||
|
||||
TRRLoadInfo::TRRLoadInfo(nsIURI* aResultPrincipalURI,
|
||||
nsContentPolicyType aContentPolicyType)
|
||||
: mResultPrincipalURI(aResultPrincipalURI),
|
||||
mInternalContentPolicyType(aContentPolicyType) {}
|
||||
|
||||
already_AddRefed<nsILoadInfo> TRRLoadInfo::Clone() const {
|
||||
nsCOMPtr<nsILoadInfo> loadInfo =
|
||||
new TRRLoadInfo(mResultPrincipalURI, mInternalContentPolicyType);
|
||||
|
||||
return loadInfo.forget();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::GetLoadingPrincipal(nsIPrincipal** aLoadingPrincipal) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
nsIPrincipal* TRRLoadInfo::LoadingPrincipal() { return nullptr; }
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::GetTriggeringPrincipal(nsIPrincipal** aTriggeringPrincipal) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
nsIPrincipal* TRRLoadInfo::TriggeringPrincipal() { return nullptr; }
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::GetPrincipalToInherit(nsIPrincipal** aPrincipalToInherit) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::SetPrincipalToInherit(nsIPrincipal* aPrincipalToInherit) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
nsIPrincipal* TRRLoadInfo::PrincipalToInherit() { return nullptr; }
|
||||
|
||||
nsIPrincipal* TRRLoadInfo::FindPrincipalToInherit(nsIChannel* aChannel) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsIPrincipal* TRRLoadInfo::GetSandboxedLoadingPrincipal() { return nullptr; }
|
||||
|
||||
nsIPrincipal* TRRLoadInfo::GetTopLevelPrincipal() { return nullptr; }
|
||||
|
||||
nsIPrincipal* TRRLoadInfo::GetTopLevelStorageAreaPrincipal() { return nullptr; }
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::GetLoadingDocument(Document** aResult) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
nsINode* TRRLoadInfo::LoadingNode() { return nullptr; }
|
||||
|
||||
already_AddRefed<nsISupports> TRRLoadInfo::ContextForTopLevelLoad() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
already_AddRefed<nsISupports> TRRLoadInfo::GetLoadingContext() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::GetLoadingContextXPCOM(nsISupports** aResult) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::GetSecurityFlags(nsSecurityFlags* aResult) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::GetSandboxFlags(uint32_t* aResult) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::GetSecurityMode(uint32_t* aFlags) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::GetIsInThirdPartyContext(bool* aIsInThirdPartyContext) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::GetCookiePolicy(uint32_t* aResult) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::GetCookieJarSettings(nsICookieJarSettings** aCookieJarSettings) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::SetCookieJarSettings(nsICookieJarSettings* aCookieJarSettings) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::GetForceInheritPrincipal(bool* aInheritPrincipal) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::GetForceInheritPrincipalOverruleOwner(bool* aInheritPrincipal) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::GetLoadingSandboxed(bool* aLoadingSandboxed) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::GetAboutBlankInherits(bool* aResult) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::GetAllowChrome(bool* aResult) { return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::GetDisallowScript(bool* aResult) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::GetDontFollowRedirects(bool* aResult) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::GetLoadErrorPage(bool* aResult) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::GetIsFormSubmission(bool* aResult) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::SetIsFormSubmission(bool aValue) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::GetSendCSPViolationEvents(bool* aResult) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::SetSendCSPViolationEvents(bool aValue) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::GetExternalContentPolicyType(nsContentPolicyType* aResult) {
|
||||
*aResult = nsContentUtils::InternalContentPolicyTypeToExternal(
|
||||
mInternalContentPolicyType);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsContentPolicyType TRRLoadInfo::InternalContentPolicyType() {
|
||||
return mInternalContentPolicyType;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::GetBlockAllMixedContent(bool* aResult) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::GetUpgradeInsecureRequests(bool* aResult) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::GetBrowserUpgradeInsecureRequests(bool* aResult) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::GetBrowserWouldUpgradeInsecureRequests(bool* aResult) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::SetForceAllowDataURI(bool aForceAllowDataURI) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::GetForceAllowDataURI(bool* aForceAllowDataURI) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::SetAllowInsecureRedirectToDataURI(
|
||||
bool aAllowInsecureRedirectToDataURI) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::GetAllowInsecureRedirectToDataURI(
|
||||
bool* aAllowInsecureRedirectToDataURI) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::SetBypassCORSChecks(bool aBypassCORSChecks) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::GetBypassCORSChecks(bool* aBypassCORSChecks) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::SetSkipContentPolicyCheckForWebRequest(bool aSkip) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::GetSkipContentPolicyCheckForWebRequest(bool* aSkip) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::SetOriginalFrameSrcLoad(bool aOriginalFrameSrcLoad) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::GetOriginalFrameSrcLoad(bool* aOriginalFrameSrcLoad) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::GetForceInheritPrincipalDropped(bool* aResult) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::GetInnerWindowID(uint64_t* aResult) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::GetOuterWindowID(uint64_t* aResult) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::GetParentOuterWindowID(uint64_t* aResult) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::GetTopOuterWindowID(uint64_t* aResult) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::GetFrameOuterWindowID(uint64_t* aResult) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::GetBrowsingContextID(uint64_t* aResult) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::GetFrameBrowsingContextID(uint64_t* aResult) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::GetTargetBrowsingContextID(uint64_t* aResult) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::GetBrowsingContext(dom::BrowsingContext** aResult) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::GetFrameBrowsingContext(dom::BrowsingContext** aResult) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::GetTargetBrowsingContext(dom::BrowsingContext** aResult) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::GetScriptableOriginAttributes(
|
||||
JSContext* aCx, JS::MutableHandle<JS::Value> aOriginAttributes) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::ResetPrincipalToInheritToNullPrincipal() {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::SetScriptableOriginAttributes(
|
||||
JSContext* aCx, JS::Handle<JS::Value> aOriginAttributes) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
nsresult TRRLoadInfo::GetOriginAttributes(
|
||||
mozilla::OriginAttributes* aOriginAttributes) {
|
||||
NS_ENSURE_ARG(aOriginAttributes);
|
||||
*aOriginAttributes = mOriginAttributes;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult TRRLoadInfo::SetOriginAttributes(
|
||||
const mozilla::OriginAttributes& aOriginAttributes) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::SetInitialSecurityCheckDone(bool aInitialSecurityCheckDone) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::GetInitialSecurityCheckDone(bool* aResult) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::AppendRedirectHistoryEntry(nsIRedirectHistoryEntry* aEntry,
|
||||
bool aIsInternalRedirect) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::GetRedirectChainIncludingInternalRedirects(
|
||||
JSContext* aCx, JS::MutableHandle<JS::Value> aChain) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
const nsTArray<nsCOMPtr<nsIRedirectHistoryEntry>>&
|
||||
TRRLoadInfo::RedirectChainIncludingInternalRedirects() {
|
||||
return mEmptyRedirectChain;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::GetRedirectChain(JSContext* aCx,
|
||||
JS::MutableHandle<JS::Value> aChain) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
const nsTArray<nsCOMPtr<nsIRedirectHistoryEntry>>&
|
||||
TRRLoadInfo::RedirectChain() {
|
||||
return mEmptyRedirectChain;
|
||||
}
|
||||
|
||||
const nsTArray<nsCOMPtr<nsIPrincipal>>& TRRLoadInfo::AncestorPrincipals() {
|
||||
return mEmptyPrincipals;
|
||||
}
|
||||
|
||||
const nsTArray<uint64_t>& TRRLoadInfo::AncestorOuterWindowIDs() {
|
||||
return mEmptyWindowIDs;
|
||||
}
|
||||
|
||||
void TRRLoadInfo::SetCorsPreflightInfo(const nsTArray<nsCString>& aHeaders,
|
||||
bool aForcePreflight) {}
|
||||
|
||||
const nsTArray<nsCString>& TRRLoadInfo::CorsUnsafeHeaders() {
|
||||
return mCorsUnsafeHeaders;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::GetForcePreflight(bool* aForcePreflight) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::GetIsPreflight(bool* aIsPreflight) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::SetLoadTriggeredFromExternal(bool aLoadTriggeredFromExternal) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::GetLoadTriggeredFromExternal(bool* aLoadTriggeredFromExternal) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::GetServiceWorkerTaintingSynthesized(
|
||||
bool* aServiceWorkerTaintingSynthesized) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::GetTainting(uint32_t* aTaintingOut) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::MaybeIncreaseTainting(uint32_t aTainting) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
void TRRLoadInfo::SynthesizeServiceWorkerTainting(LoadTainting aTainting) {}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::GetDocumentHasUserInteracted(bool* aDocumentHasUserInteracted) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::SetDocumentHasUserInteracted(bool aDocumentHasUserInteracted) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::GetDocumentHasLoaded(bool* aDocumentHasLoaded) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::SetDocumentHasLoaded(bool aDocumentHasLoaded) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::GetAllowListFutureDocumentsCreatedFromThisRedirectChain(
|
||||
bool* aValue) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::SetAllowListFutureDocumentsCreatedFromThisRedirectChain(
|
||||
bool aValue) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::GetCspNonce(nsAString& aCspNonce) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::SetCspNonce(const nsAString& aCspNonce) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::GetSkipContentSniffing(bool* aSkipContentSniffing) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::SetSkipContentSniffing(bool aSkipContentSniffing) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::GetIsTopLevelLoad(bool* aResult) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::GetIsFromProcessingFrameAttributes(
|
||||
bool* aIsFromProcessingFrameAttributes) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::GetResultPrincipalURI(nsIURI** aURI) {
|
||||
nsCOMPtr<nsIURI> uri = mResultPrincipalURI;
|
||||
uri.forget(aURI);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::SetResultPrincipalURI(nsIURI* aURI) {
|
||||
mResultPrincipalURI = aURI;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::SetRequestBlockingReason(uint32_t aReason) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::GetRequestBlockingReason(uint32_t* aReason) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
void TRRLoadInfo::SetClientInfo(const ClientInfo& aClientInfo) {}
|
||||
|
||||
const Maybe<ClientInfo>& TRRLoadInfo::GetClientInfo() { return mClientInfo; }
|
||||
|
||||
void TRRLoadInfo::GiveReservedClientSource(
|
||||
UniquePtr<ClientSource>&& aClientSource) {}
|
||||
|
||||
UniquePtr<ClientSource> TRRLoadInfo::TakeReservedClientSource() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void TRRLoadInfo::SetReservedClientInfo(const ClientInfo& aClientInfo) {}
|
||||
|
||||
void TRRLoadInfo::OverrideReservedClientInfoInParent(
|
||||
const ClientInfo& aClientInfo) {}
|
||||
|
||||
const Maybe<ClientInfo>& TRRLoadInfo::GetReservedClientInfo() {
|
||||
return mReservedClientInfo;
|
||||
}
|
||||
|
||||
void TRRLoadInfo::SetInitialClientInfo(const ClientInfo& aClientInfo) {}
|
||||
|
||||
const Maybe<ClientInfo>& TRRLoadInfo::GetInitialClientInfo() {
|
||||
return mInitialClientInfo;
|
||||
}
|
||||
|
||||
void TRRLoadInfo::SetController(const ServiceWorkerDescriptor& aServiceWorker) {
|
||||
}
|
||||
|
||||
void TRRLoadInfo::ClearController() {}
|
||||
|
||||
const Maybe<ServiceWorkerDescriptor>& TRRLoadInfo::GetController() {
|
||||
return mController;
|
||||
}
|
||||
|
||||
void TRRLoadInfo::SetPerformanceStorage(
|
||||
PerformanceStorage* aPerformanceStorage) {}
|
||||
|
||||
PerformanceStorage* TRRLoadInfo::GetPerformanceStorage() { return nullptr; }
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::GetCspEventListener(nsICSPEventListener** aCSPEventListener) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRLoadInfo::SetCspEventListener(nsICSPEventListener* aCSPEventListener) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
already_AddRefed<nsIContentSecurityPolicy> TRRLoadInfo::GetCsp() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
already_AddRefed<nsIContentSecurityPolicy> TRRLoadInfo::GetPreloadCsp() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
already_AddRefed<nsIContentSecurityPolicy> TRRLoadInfo::GetCspToInherit() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // namespace net
|
||||
} // namespace mozilla
|
|
@ -1,52 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 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/. */
|
||||
|
||||
#ifndef mozilla_TRRLoadInfo_h
|
||||
#define mozilla_TRRLoadInfo_h
|
||||
|
||||
#include "nsILoadInfo.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsTArray.h"
|
||||
#include "mozilla/dom/ClientInfo.h"
|
||||
#include "mozilla/dom/ServiceWorkerDescriptor.h"
|
||||
#include "mozilla/OriginAttributes.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace net {
|
||||
|
||||
// TRRLoadInfo is designed to be used by TRRServiceChannel only. Most of
|
||||
// nsILoadInfo functions are not implemented since TRRLoadInfo needs to
|
||||
// support off main thread.
|
||||
class TRRLoadInfo final : public nsILoadInfo {
|
||||
public:
|
||||
NS_DECL_THREADSAFE_ISUPPORTS
|
||||
NS_DECL_NSILOADINFO
|
||||
|
||||
TRRLoadInfo(nsIURI* aResultPrincipalURI,
|
||||
nsContentPolicyType aContentPolicyType);
|
||||
|
||||
already_AddRefed<nsILoadInfo> Clone() const;
|
||||
|
||||
private:
|
||||
virtual ~TRRLoadInfo() = default;
|
||||
|
||||
nsCOMPtr<nsIURI> mResultPrincipalURI;
|
||||
nsContentPolicyType mInternalContentPolicyType;
|
||||
OriginAttributes mOriginAttributes;
|
||||
nsTArray<nsCOMPtr<nsIRedirectHistoryEntry>> mEmptyRedirectChain;
|
||||
nsTArray<nsCOMPtr<nsIPrincipal>> mEmptyPrincipals;
|
||||
nsTArray<uint64_t> mEmptyWindowIDs;
|
||||
nsTArray<nsCString> mCorsUnsafeHeaders;
|
||||
Maybe<mozilla::dom::ClientInfo> mClientInfo;
|
||||
Maybe<mozilla::dom::ClientInfo> mReservedClientInfo;
|
||||
Maybe<mozilla::dom::ClientInfo> mInitialClientInfo;
|
||||
Maybe<mozilla::dom::ServiceWorkerDescriptor> mController;
|
||||
};
|
||||
|
||||
} // namespace net
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_TRRLoadInfo_h
|
|
@ -251,7 +251,6 @@ UNIFIED_SOURCES += [
|
|||
'ThrottleQueue.cpp',
|
||||
'Tickler.cpp',
|
||||
'TLSServerSocket.cpp',
|
||||
'TRRLoadInfo.cpp',
|
||||
]
|
||||
|
||||
if CONFIG['FUZZING']:
|
||||
|
|
|
@ -13,14 +13,6 @@ webidl Document;
|
|||
typedef unsigned long PredictorPredictReason;
|
||||
typedef unsigned long PredictorLearnReason;
|
||||
|
||||
%{C++
|
||||
namespace mozilla {
|
||||
|
||||
class OriginAttributes;
|
||||
|
||||
}
|
||||
%}
|
||||
|
||||
[ref] native OriginAttributes(const mozilla::OriginAttributes);
|
||||
|
||||
/**
|
||||
|
@ -159,9 +151,6 @@ class nsILoadGroup;
|
|||
class nsINetworkPredictorVerifier;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class OriginAttributes;
|
||||
|
||||
namespace net {
|
||||
|
||||
nsresult PredictorPredict(nsIURI *targetURI,
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "DNS.h"
|
||||
#include "nsCharSeparatedTokenizer.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsHostResolver.h"
|
||||
#include "nsHttpHandler.h"
|
||||
#include "nsIHttpChannel.h"
|
||||
#include "nsIHttpChannelInternal.h"
|
||||
|
@ -16,14 +17,12 @@
|
|||
#include "nsISupportsUtils.h"
|
||||
#include "nsITimedChannel.h"
|
||||
#include "nsIUploadChannel2.h"
|
||||
#include "nsIURIMutator.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsStringStream.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsURLHelper.h"
|
||||
#include "TRR.h"
|
||||
#include "TRRService.h"
|
||||
#include "TRRLoadInfo.h"
|
||||
|
||||
#include "mozilla/Base64.h"
|
||||
#include "mozilla/DebugOnly.h"
|
||||
|
@ -219,13 +218,11 @@ nsresult TRR::CreateChannelHelper(nsIURI* aUri, nsIChannel** aResult) {
|
|||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
RefPtr<TRRLoadInfo> loadInfo =
|
||||
new TRRLoadInfo(aUri, nsIContentPolicy::TYPE_OTHER);
|
||||
return gHttpHandler->CreateTRRServiceChannel(aUri,
|
||||
nullptr, // givenProxyInfo
|
||||
0, // proxyResolveFlags
|
||||
nullptr, // proxyURI
|
||||
loadInfo, // aLoadInfo
|
||||
nullptr, // givenProxyInfo
|
||||
0, // proxyResolveFlags
|
||||
nullptr, // proxyURI
|
||||
nullptr, // aLoadInfo
|
||||
aResult);
|
||||
}
|
||||
|
||||
|
@ -286,28 +283,10 @@ nsresult TRR::SendHTTPRequest() {
|
|||
} else {
|
||||
uri = mRec->mTrrServer;
|
||||
}
|
||||
|
||||
rv = NS_NewURI(getter_AddRefs(dnsURI), uri);
|
||||
if (NS_FAILED(rv)) {
|
||||
LOG(("TRR:SendHTTPRequest: NewURI failed!\n"));
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsAutoCString query;
|
||||
rv = dnsURI->GetQuery(query);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
if (query.IsEmpty()) {
|
||||
query.Assign(NS_LITERAL_CSTRING("?dns="));
|
||||
} else {
|
||||
query.Append(NS_LITERAL_CSTRING("&dns="));
|
||||
}
|
||||
query.Append(body);
|
||||
|
||||
rv = NS_MutateURI(dnsURI).SetQuery(query).Finalize(dnsURI);
|
||||
uri.Append(NS_LITERAL_CSTRING("?dns="));
|
||||
uri.Append(body);
|
||||
LOG(("TRR::SendHTTPRequest GET dns=%s\n", body.get()));
|
||||
rv = NS_NewURI(getter_AddRefs(dnsURI), uri);
|
||||
} else {
|
||||
rv = DohEncode(body, disableECS);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -325,22 +304,21 @@ nsresult TRR::SendHTTPRequest() {
|
|||
return rv;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIChannel> channel;
|
||||
rv = CreateChannelHelper(dnsURI, getter_AddRefs(channel));
|
||||
if (NS_FAILED(rv) || !channel) {
|
||||
rv = CreateChannelHelper(dnsURI, getter_AddRefs(mChannel));
|
||||
if (NS_FAILED(rv)) {
|
||||
LOG(("TRR:SendHTTPRequest: NewChannel failed!\n"));
|
||||
return rv;
|
||||
}
|
||||
|
||||
channel->SetLoadFlags(
|
||||
mChannel->SetLoadFlags(
|
||||
nsIRequest::LOAD_ANONYMOUS | nsIRequest::INHIBIT_CACHING |
|
||||
nsIRequest::LOAD_BYPASS_CACHE | nsIChannel::LOAD_BYPASS_URL_CLASSIFIER);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = channel->SetNotificationCallbacks(this);
|
||||
rv = mChannel->SetNotificationCallbacks(this);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIHttpChannel> httpChannel = do_QueryInterface(channel);
|
||||
nsCOMPtr<nsIHttpChannel> httpChannel = do_QueryInterface(mChannel);
|
||||
if (!httpChannel) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
@ -364,7 +342,8 @@ nsresult TRR::SendHTTPRequest() {
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIHttpChannelInternal> internalChannel = do_QueryInterface(channel);
|
||||
nsCOMPtr<nsIHttpChannelInternal> internalChannel =
|
||||
do_QueryInterface(mChannel);
|
||||
if (!internalChannel) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
@ -382,6 +361,9 @@ nsresult TRR::SendHTTPRequest() {
|
|||
rv = httpChannel->SetRequestMethod(NS_LITERAL_CSTRING("GET"));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
} else {
|
||||
rv = httpChannel->SetRequestHeader(NS_LITERAL_CSTRING("Cache-Control"),
|
||||
NS_LITERAL_CSTRING("no-store"), false);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsCOMPtr<nsIUploadChannel2> uploadChannel = do_QueryInterface(httpChannel);
|
||||
if (!uploadChannel) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
|
@ -398,37 +380,6 @@ nsresult TRR::SendHTTPRequest() {
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
rv = SetupTRRServiceChannelInternal(httpChannel, useGet);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
rv = httpChannel->AsyncOpen(this);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_NewTimerWithCallback(getter_AddRefs(mTimeout), this,
|
||||
gTRRService->GetRequestTimeout(),
|
||||
nsITimer::TYPE_ONE_SHOT);
|
||||
|
||||
mChannel = channel;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// static
|
||||
nsresult TRR::SetupTRRServiceChannelInternal(nsIHttpChannel* aChannel,
|
||||
bool aUseGet) {
|
||||
nsCOMPtr<nsIHttpChannel> httpChannel = aChannel;
|
||||
MOZ_ASSERT(httpChannel);
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (!aUseGet) {
|
||||
rv = httpChannel->SetRequestHeader(NS_LITERAL_CSTRING("Cache-Control"),
|
||||
NS_LITERAL_CSTRING("no-store"), false);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
// Sanitize the request by removing the Accept-Language header so we minimize
|
||||
// the amount of fingerprintable information we send to the server.
|
||||
if (!StaticPrefs::network_trr_send_accept_language_headers()) {
|
||||
|
@ -453,15 +404,20 @@ nsresult TRR::SetupTRRServiceChannelInternal(nsIHttpChannel* aChannel,
|
|||
// set the *default* response content type
|
||||
if (NS_FAILED(httpChannel->SetContentType(
|
||||
NS_LITERAL_CSTRING("application/dns-message")))) {
|
||||
LOG(("TRR::SetupTRRServiceChannelInternal: couldn't set content-type!\n"));
|
||||
LOG(("TRR::SendHTTPRequest: couldn't set content-type!\n"));
|
||||
}
|
||||
|
||||
nsCOMPtr<nsITimedChannel> timedChan(do_QueryInterface(httpChannel));
|
||||
if (timedChan) {
|
||||
timedChan->SetTimingEnabled(true);
|
||||
}
|
||||
timedChan->SetTimingEnabled(true);
|
||||
|
||||
return NS_OK;
|
||||
if (NS_SUCCEEDED(httpChannel->AsyncOpen(this))) {
|
||||
NS_NewTimerWithCallback(getter_AddRefs(mTimeout), this,
|
||||
gTRRService->GetRequestTimeout(),
|
||||
nsITimer::TYPE_ONE_SHOT);
|
||||
return NS_OK;
|
||||
}
|
||||
mChannel = nullptr;
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#include "nsIHttpPushListener.h"
|
||||
#include "nsIInterfaceRequestor.h"
|
||||
#include "nsIStreamListener.h"
|
||||
#include "nsHostResolver.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -34,7 +33,6 @@ class DOHaddr : public LinkedListElement<DOHaddr> {
|
|||
};
|
||||
|
||||
class TRRService;
|
||||
class TRRServiceChannel;
|
||||
extern TRRService* gTRRService;
|
||||
|
||||
class DOHresp {
|
||||
|
@ -169,10 +167,6 @@ class TRR : public Runnable,
|
|||
|
||||
nsresult CreateChannelHelper(nsIURI* aUri, nsIChannel** aResult);
|
||||
|
||||
friend class TRRServiceChannel;
|
||||
static nsresult SetupTRRServiceChannelInternal(nsIHttpChannel* aChannel,
|
||||
bool aUseGet);
|
||||
|
||||
nsCOMPtr<nsIChannel> mChannel;
|
||||
enum TrrType mType;
|
||||
TimeStamp mStartTime;
|
||||
|
|
|
@ -18,9 +18,7 @@
|
|||
#include "nsIOService.h"
|
||||
#include "nsISeekableStream.h"
|
||||
#include "nsURLHelper.h"
|
||||
#include "TRRLoadInfo.h"
|
||||
#include "ReferrerInfo.h"
|
||||
#include "TRR.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace net {
|
||||
|
@ -677,11 +675,9 @@ nsresult TRRServiceChannel::OnPush(uint32_t aPushedStreamId,
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsILoadInfo> loadInfo =
|
||||
static_cast<TRRLoadInfo*>(mLoadInfo.get())->Clone();
|
||||
nsCOMPtr<nsIChannel> pushHttpChannel;
|
||||
rv = gHttpHandler->CreateTRRServiceChannel(pushResource, nullptr, 0, nullptr,
|
||||
loadInfo,
|
||||
nullptr,
|
||||
getter_AddRefs(pushHttpChannel));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -949,18 +945,6 @@ TRRServiceChannel::OnStartRequest(nsIRequest* request) {
|
|||
if ((httpStatus < 500) && (httpStatus != 421) && (httpStatus != 407)) {
|
||||
ProcessAltService();
|
||||
}
|
||||
|
||||
if (httpStatus == 300 || httpStatus == 301 || httpStatus == 302 ||
|
||||
httpStatus == 303 || httpStatus == 307 || httpStatus == 308) {
|
||||
nsresult rv = SyncProcessRedirection(httpStatus);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
mStatus = rv;
|
||||
DoNotifyListener();
|
||||
return rv;
|
||||
}
|
||||
} else {
|
||||
NS_WARNING("No response head in OnStartRequest");
|
||||
}
|
||||
|
@ -975,124 +959,6 @@ TRRServiceChannel::OnStartRequest(nsIRequest* request) {
|
|||
return CallOnStartRequest();
|
||||
}
|
||||
|
||||
nsresult TRRServiceChannel::SyncProcessRedirection(uint32_t aHttpStatus) {
|
||||
nsAutoCString location;
|
||||
|
||||
// if a location header was not given, then we can't perform the redirect,
|
||||
// so just carry on as though this were a normal response.
|
||||
if (NS_FAILED(mResponseHead->GetHeader(nsHttp::Location, location))) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// make sure non-ASCII characters in the location header are escaped.
|
||||
nsAutoCString locationBuf;
|
||||
if (NS_EscapeURL(location.get(), -1, esc_OnlyNonASCII | esc_Spaces,
|
||||
locationBuf)) {
|
||||
location = locationBuf;
|
||||
}
|
||||
|
||||
LOG(("redirecting to: %s [redirection-limit=%u]\n", location.get(),
|
||||
uint32_t(mRedirectionLimit)));
|
||||
|
||||
nsCOMPtr<nsIURI> redirectURI;
|
||||
nsresult rv = NS_NewURI(getter_AddRefs(redirectURI), location);
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
LOG(("Invalid URI for redirect: Location: %s\n", location.get()));
|
||||
return NS_ERROR_CORRUPTED_CONTENT;
|
||||
}
|
||||
|
||||
// move the reference of the old location to the new one if the new
|
||||
// one has none.
|
||||
PropagateReferenceIfNeeded(mURI, redirectURI);
|
||||
|
||||
bool rewriteToGET =
|
||||
ShouldRewriteRedirectToGET(aHttpStatus, mRequestHead.ParsedMethod());
|
||||
|
||||
// Let's not rewrite the method to GET for TRR requests.
|
||||
if (rewriteToGET) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// If the method is not safe (such as POST, PUT, DELETE, ...)
|
||||
if (!mRequestHead.IsSafeMethod()) {
|
||||
LOG(("TRRServiceChannel: unsafe redirect to:%s\n", location.get()));
|
||||
}
|
||||
|
||||
uint32_t redirectFlags;
|
||||
if (nsHttp::IsPermanentRedirect(aHttpStatus)) {
|
||||
redirectFlags = nsIChannelEventSink::REDIRECT_PERMANENT;
|
||||
} else {
|
||||
redirectFlags = nsIChannelEventSink::REDIRECT_TEMPORARY;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIChannel> newChannel;
|
||||
nsCOMPtr<nsILoadInfo> redirectLoadInfo =
|
||||
static_cast<TRRLoadInfo*>(mLoadInfo.get())->Clone();
|
||||
rv = gHttpHandler->CreateTRRServiceChannel(redirectURI, nullptr, 0, nullptr,
|
||||
redirectLoadInfo,
|
||||
getter_AddRefs(newChannel));
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
rv = SetupReplacementChannel(redirectURI, newChannel, !rewriteToGET,
|
||||
redirectFlags);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
// Make sure to do this after we received redirect veto answer,
|
||||
// i.e. after all sinks had been notified
|
||||
newChannel->SetOriginalURI(mOriginalURI);
|
||||
|
||||
rv = newChannel->AsyncOpen(mListener);
|
||||
LOG((" new channel AsyncOpen returned %" PRIX32, static_cast<uint32_t>(rv)));
|
||||
|
||||
// close down this channel
|
||||
Cancel(NS_BINDING_REDIRECTED);
|
||||
|
||||
ReleaseListeners();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult TRRServiceChannel::SetupReplacementChannel(nsIURI* aNewURI,
|
||||
nsIChannel* aNewChannel,
|
||||
bool aPreserveMethod,
|
||||
uint32_t aRedirectFlags) {
|
||||
LOG(
|
||||
("TRRServiceChannel::SetupReplacementChannel "
|
||||
"[this=%p newChannel=%p preserveMethod=%d]",
|
||||
this, aNewChannel, aPreserveMethod));
|
||||
|
||||
nsresult rv = HttpBaseChannel::SetupReplacementChannel(
|
||||
aNewURI, aNewChannel, aPreserveMethod, aRedirectFlags);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
rv = CheckRedirectLimit(aRedirectFlags);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIHttpChannel> httpChannel = do_QueryInterface(aNewChannel);
|
||||
if (!httpChannel) {
|
||||
MOZ_ASSERT(false);
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// convey the mApplyConversion flag (bug 91862)
|
||||
nsCOMPtr<nsIEncodedChannel> encodedChannel = do_QueryInterface(httpChannel);
|
||||
if (encodedChannel) {
|
||||
encodedChannel->SetApplyConversion(mApplyConversion);
|
||||
}
|
||||
|
||||
// Apply TRR specific settings.
|
||||
return TRR::SetupTRRServiceChannelInternal(
|
||||
httpChannel,
|
||||
mRequestHead.ParsedMethod() == nsHttpRequestHead::kMethod_Get);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRServiceChannel::OnDataAvailable(nsIRequest* request, nsIInputStream* input,
|
||||
uint64_t offset, uint32_t count) {
|
||||
|
@ -1440,16 +1306,5 @@ TRRServiceChannel::GetResponseEnd(TimeStamp* _retval) {
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP TRRServiceChannel::SetLoadGroup(nsILoadGroup* aLoadGroup) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TRRServiceChannel::TimingAllowCheck(nsIPrincipal* aOrigin, bool* aResult) {
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
*aResult = true;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
} // namespace net
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -101,8 +101,6 @@ class TRRServiceChannel : public HttpBaseChannel,
|
|||
NS_IMETHOD GetRequestStart(mozilla::TimeStamp* aRequestStart) override;
|
||||
NS_IMETHOD GetResponseStart(mozilla::TimeStamp* aResponseStart) override;
|
||||
NS_IMETHOD GetResponseEnd(mozilla::TimeStamp* aResponseEnd) override;
|
||||
NS_IMETHOD SetLoadGroup(nsILoadGroup* aLoadGroup) override;
|
||||
NS_IMETHOD TimingAllowCheck(nsIPrincipal* aOrigin, bool* aResult) override;
|
||||
|
||||
protected:
|
||||
TRRServiceChannel();
|
||||
|
@ -127,10 +125,6 @@ class TRRServiceChannel : public HttpBaseChannel,
|
|||
nsresult ResolveProxy();
|
||||
void AfterApplyContentConversions(nsresult aResult,
|
||||
nsIStreamListener* aListener);
|
||||
nsresult SyncProcessRedirection(uint32_t aHttpStatus);
|
||||
virtual MOZ_MUST_USE nsresult SetupReplacementChannel(
|
||||
nsIURI* aNewURI, nsIChannel* aNewChannel, bool aPreserveMethod,
|
||||
uint32_t aRedirectFlags) override;
|
||||
|
||||
// True only when we have computed the value of the top window origin.
|
||||
bool mTopWindowOriginComputed;
|
||||
|
|
|
@ -154,7 +154,6 @@ LOCAL_INCLUDES += [
|
|||
'/extensions/auth',
|
||||
'/netwerk/base',
|
||||
'/netwerk/cookie',
|
||||
'/netwerk/dns',
|
||||
'/netwerk/ipc',
|
||||
'/netwerk/socket/neqo_glue',
|
||||
'/netwerk/url-classifier',
|
||||
|
|
|
@ -1686,32 +1686,6 @@ add_task(async function test_content_encoding_gzip() {
|
|||
await new DNSListener("bar.example.com", "2.2.2.2");
|
||||
});
|
||||
|
||||
add_task(async function test_redirect_get() {
|
||||
dns.clearCache(true);
|
||||
Services.prefs.setIntPref("network.trr.mode", 3); // TRR-only
|
||||
Services.prefs.setCharPref(
|
||||
"network.trr.uri",
|
||||
`https://foo.example.com:${h2Port}/doh?redirect=4.4.4.4{&dns}`
|
||||
);
|
||||
Services.prefs.clearUserPref("network.trr.allow-rfc1918");
|
||||
Services.prefs.setBoolPref("network.trr.useGET", true);
|
||||
Services.prefs.setBoolPref("network.trr.disable-ECS", true);
|
||||
await new DNSListener("ecs.example.com", "4.4.4.4");
|
||||
});
|
||||
|
||||
// test redirect
|
||||
add_task(async function test_redirect_post() {
|
||||
dns.clearCache(true);
|
||||
Services.prefs.setIntPref("network.trr.mode", 3);
|
||||
Services.prefs.setBoolPref("network.trr.useGET", false);
|
||||
Services.prefs.setCharPref(
|
||||
"network.trr.uri",
|
||||
`https://foo.example.com:${h2Port}/doh?redirect=4.4.4.4`
|
||||
);
|
||||
|
||||
await new DNSListener("bar.example.com", "4.4.4.4");
|
||||
});
|
||||
|
||||
// confirmationNS set without confirmed NS yet
|
||||
// checks that we properly fall back to DNS is confirmation is not ready yet
|
||||
add_task(async function test_resolve_not_confirmed() {
|
||||
|
|
|
@ -580,30 +580,6 @@ function handleRequest(req, res) {
|
|||
responseIP = "5.5.5.5";
|
||||
}
|
||||
|
||||
let redirect = u.query.redirect;
|
||||
if (redirect) {
|
||||
responseIP = redirect;
|
||||
if (u.query.dns) {
|
||||
res.setHeader(
|
||||
"Location",
|
||||
"https://localhost:" +
|
||||
serverPort +
|
||||
"/doh?responseIP=" +
|
||||
responseIP +
|
||||
"&dns=" +
|
||||
u.query.dns
|
||||
);
|
||||
} else {
|
||||
res.setHeader(
|
||||
"Location",
|
||||
"https://localhost:" + serverPort + "/doh?responseIP=" + responseIP
|
||||
);
|
||||
}
|
||||
res.writeHead(307);
|
||||
res.end("");
|
||||
return;
|
||||
}
|
||||
|
||||
if (u.query.auth) {
|
||||
// There's a Set-Cookie: header in the response for "/dns" , which this
|
||||
// request subsequently would include if the http channel wasn't
|
||||
|
@ -782,10 +758,7 @@ function handleRequest(req, res) {
|
|||
payload = Buffer.concat([payload, chunk]);
|
||||
});
|
||||
req.on("end", function finishedData() {
|
||||
// parload is empty when we send redirect response.
|
||||
if (payload.length) {
|
||||
emitResponse(res, payload);
|
||||
}
|
||||
emitResponse(res, payload);
|
||||
});
|
||||
return;
|
||||
} else if (u.pathname === "/dns-cname-a") {
|
||||
|
|
Загрузка…
Ссылка в новой задаче