diff --git a/dom/base/nsDocument.cpp b/dom/base/nsDocument.cpp index 323e2dc3a205..c09186f8a075 100644 --- a/dom/base/nsDocument.cpp +++ b/dom/base/nsDocument.cpp @@ -2603,13 +2603,8 @@ WarnIfSandboxIneffective(nsIDocShell* aDocShell, bool nsIDocument::IsSynthesized() { - nsCOMPtr internalChan = do_QueryInterface(mChannel); - bool synthesized = false; - if (internalChan) { - DebugOnly rv = internalChan->GetResponseSynthesized(&synthesized); - MOZ_ASSERT(NS_SUCCEEDED(rv), "GetResponseSynthesized shouldn't fail."); - } - return synthesized; + nsCOMPtr loadInfo = mChannel ? mChannel->GetLoadInfo() : nullptr; + return loadInfo && loadInfo->GetServiceWorkerTaintingSynthesized(); } bool diff --git a/netwerk/protocol/http/HttpBaseChannel.cpp b/netwerk/protocol/http/HttpBaseChannel.cpp index e46ea4ec8536..0d3b8426a12f 100644 --- a/netwerk/protocol/http/HttpBaseChannel.cpp +++ b/netwerk/protocol/http/HttpBaseChannel.cpp @@ -472,21 +472,6 @@ HttpBaseChannel::GetLoadFlags(nsLoadFlags *aLoadFlags) NS_IMETHODIMP HttpBaseChannel::SetLoadFlags(nsLoadFlags aLoadFlags) { - bool synthesized = false; - nsresult rv = GetResponseSynthesized(&synthesized); - NS_ENSURE_SUCCESS(rv, rv); - - // If this channel is marked as awaiting a synthesized response, - // modifying certain load flags can interfere with the implementation - // of the network interception logic. This takes care of a couple - // known cases that attempt to mark channels as anonymous due - // to cross-origin redirects; since the response is entirely synthesized - // this is an unnecessary precaution. - // This should be removed when bug 1201683 is fixed. - if (synthesized && aLoadFlags != mLoadFlags) { - aLoadFlags &= ~LOAD_ANONYMOUS; - } - mLoadFlags = aLoadFlags; return NS_OK; } diff --git a/netwerk/protocol/http/HttpChannelChild.cpp b/netwerk/protocol/http/HttpChannelChild.cpp index beb893300206..dcb8e3eaf6d5 100644 --- a/netwerk/protocol/http/HttpChannelChild.cpp +++ b/netwerk/protocol/http/HttpChannelChild.cpp @@ -3638,14 +3638,6 @@ HttpChannelChild::ResetInterception() } } -NS_IMETHODIMP -HttpChannelChild::GetResponseSynthesized(bool* aSynthesized) -{ - NS_ENSURE_ARG_POINTER(aSynthesized); - *aSynthesized = mSynthesizedResponse; - return NS_OK; -} - void HttpChannelChild::TrySendDeletingChannel() { diff --git a/netwerk/protocol/http/HttpChannelChild.h b/netwerk/protocol/http/HttpChannelChild.h index 528c7d6c6a0a..3d585af56481 100644 --- a/netwerk/protocol/http/HttpChannelChild.h +++ b/netwerk/protocol/http/HttpChannelChild.h @@ -182,8 +182,6 @@ protected: virtual void DoAsyncAbort(nsresult aStatus) override; - NS_IMETHOD GetResponseSynthesized(bool* aSynthesized) override; - nsresult AsyncCall(void (HttpChannelChild::*funcPtr)(), nsRunnableMethod **retval = nullptr) override; diff --git a/netwerk/protocol/http/InterceptedHttpChannel.cpp b/netwerk/protocol/http/InterceptedHttpChannel.cpp index 1babfefc622f..c3548a615227 100644 --- a/netwerk/protocol/http/InterceptedHttpChannel.cpp +++ b/netwerk/protocol/http/InterceptedHttpChannel.cpp @@ -607,13 +607,6 @@ InterceptedHttpChannel::SetupFallbackChannel(const char* aFallbackKey) return NS_ERROR_NOT_IMPLEMENTED; } -NS_IMETHODIMP -InterceptedHttpChannel::GetResponseSynthesized(bool* aResponseSynthesized) -{ - *aResponseSynthesized = mResponseHead || mBodyReader; - return NS_OK; -} - NS_IMETHODIMP InterceptedHttpChannel::SetPriority(int32_t aPriority) { diff --git a/netwerk/protocol/http/InterceptedHttpChannel.h b/netwerk/protocol/http/InterceptedHttpChannel.h index 1a14a365799e..cf8e380d77e4 100644 --- a/netwerk/protocol/http/InterceptedHttpChannel.h +++ b/netwerk/protocol/http/InterceptedHttpChannel.h @@ -173,9 +173,6 @@ public: NS_IMETHOD SetupFallbackChannel(const char * aFallbackKey) override; - NS_IMETHOD - GetResponseSynthesized(bool *aResponseSynthesized) override; - NS_IMETHOD SetPriority(int32_t aPriority) override; diff --git a/netwerk/protocol/http/nsCORSListenerProxy.cpp b/netwerk/protocol/http/nsCORSListenerProxy.cpp index 2df0a7493ca2..53340cea9154 100644 --- a/netwerk/protocol/http/nsCORSListenerProxy.cpp +++ b/netwerk/protocol/http/nsCORSListenerProxy.cpp @@ -566,11 +566,8 @@ nsCORSListenerProxy::CheckRequestApproved(nsIRequest* aRequest) return NS_ERROR_DOM_BAD_URI; } - nsCOMPtr internal = do_QueryInterface(aRequest); - NS_ENSURE_STATE(internal); - bool responseSynthesized = false; - if (NS_SUCCEEDED(internal->GetResponseSynthesized(&responseSynthesized)) && - responseSynthesized) { + nsCOMPtr loadInfo = http->GetLoadInfo(); + if (loadInfo && loadInfo->GetServiceWorkerTaintingSynthesized()) { // For synthesized responses, we don't need to perform any checks. // Note: This would be unsafe if we ever changed our behavior to allow // service workers to intercept CORS preflights. @@ -1270,15 +1267,9 @@ nsCORSPreflightListener::OnStartRequest(nsIRequest *aRequest, { #ifdef DEBUG { - nsCOMPtr internal = do_QueryInterface(aRequest); - bool responseSynthesized = false; - if (internal && - NS_SUCCEEDED(internal->GetResponseSynthesized(&responseSynthesized))) { - // For synthesized responses, we don't need to perform any checks. - // This would be unsafe if we ever changed our behavior to allow - // service workers to intercept CORS preflights. - MOZ_ASSERT(!responseSynthesized); - } + nsCOMPtr channel = do_QueryInterface(aRequest); + nsCOMPtr loadInfo = channel ? channel->GetLoadInfo() : nullptr; + MOZ_ASSERT(!loadInfo || !loadInfo->GetServiceWorkerTaintingSynthesized()); } #endif diff --git a/netwerk/protocol/http/nsHttpChannel.cpp b/netwerk/protocol/http/nsHttpChannel.cpp index cef4c92097c6..60c4adcc3d32 100644 --- a/netwerk/protocol/http/nsHttpChannel.cpp +++ b/netwerk/protocol/http/nsHttpChannel.cpp @@ -8469,14 +8469,6 @@ nsHttpChannel::SetNotificationCallbacks(nsIInterfaceRequestor *aCallbacks) return rv; } -NS_IMETHODIMP -nsHttpChannel::GetResponseSynthesized(bool* aSynthesized) -{ - NS_ENSURE_ARG_POINTER(aSynthesized); - *aSynthesized = false; - return NS_OK; -} - bool nsHttpChannel::AwaitingCacheCallbacks() { diff --git a/netwerk/protocol/http/nsHttpChannel.h b/netwerk/protocol/http/nsHttpChannel.h index 24bd14f5fbc9..44a563e4c235 100644 --- a/netwerk/protocol/http/nsHttpChannel.h +++ b/netwerk/protocol/http/nsHttpChannel.h @@ -257,7 +257,6 @@ public: /* internal necko use only */ uint32_t mKeep : 2; }; - NS_IMETHOD GetResponseSynthesized(bool* aSynthesized) override; bool AwaitingCacheCallbacks(); void SetCouldBeSynthesized(); diff --git a/netwerk/protocol/http/nsIHttpChannelInternal.idl b/netwerk/protocol/http/nsIHttpChannelInternal.idl index 1b4d290e9fc6..686062fe0f91 100644 --- a/netwerk/protocol/http/nsIHttpChannelInternal.idl +++ b/netwerk/protocol/http/nsIHttpChannelInternal.idl @@ -231,8 +231,6 @@ interface nsIHttpChannelInternal : nsISupports [must_use] readonly attribute PRTime lastModifiedTime; - [must_use] readonly attribute boolean responseSynthesized; - /** * Set by nsCORSListenerProxy if credentials should be included in * cross-origin requests. false indicates "same-origin", users should still