mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-17 23:35:34 +00:00
Bug 1468209 Remove nsIHttpChannelInternal.responseSynthesized and use nsILoadInfo.serviceWorkerTaintingSynthesized instead. r=valentin
This commit is contained in:
parent
fad2f6fec0
commit
f4e69fbdb7
@ -2603,13 +2603,8 @@ WarnIfSandboxIneffective(nsIDocShell* aDocShell,
|
||||
|
||||
bool
|
||||
nsIDocument::IsSynthesized() {
|
||||
nsCOMPtr<nsIHttpChannelInternal> internalChan = do_QueryInterface(mChannel);
|
||||
bool synthesized = false;
|
||||
if (internalChan) {
|
||||
DebugOnly<nsresult> rv = internalChan->GetResponseSynthesized(&synthesized);
|
||||
MOZ_ASSERT(NS_SUCCEEDED(rv), "GetResponseSynthesized shouldn't fail.");
|
||||
}
|
||||
return synthesized;
|
||||
nsCOMPtr<nsILoadInfo> loadInfo = mChannel ? mChannel->GetLoadInfo() : nullptr;
|
||||
return loadInfo && loadInfo->GetServiceWorkerTaintingSynthesized();
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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()
|
||||
{
|
||||
|
@ -182,8 +182,6 @@ protected:
|
||||
|
||||
virtual void DoAsyncAbort(nsresult aStatus) override;
|
||||
|
||||
NS_IMETHOD GetResponseSynthesized(bool* aSynthesized) override;
|
||||
|
||||
nsresult
|
||||
AsyncCall(void (HttpChannelChild::*funcPtr)(),
|
||||
nsRunnableMethod<HttpChannelChild> **retval = nullptr) override;
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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;
|
||||
|
||||
|
@ -566,11 +566,8 @@ nsCORSListenerProxy::CheckRequestApproved(nsIRequest* aRequest)
|
||||
return NS_ERROR_DOM_BAD_URI;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIHttpChannelInternal> internal = do_QueryInterface(aRequest);
|
||||
NS_ENSURE_STATE(internal);
|
||||
bool responseSynthesized = false;
|
||||
if (NS_SUCCEEDED(internal->GetResponseSynthesized(&responseSynthesized)) &&
|
||||
responseSynthesized) {
|
||||
nsCOMPtr<nsILoadInfo> 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<nsIHttpChannelInternal> 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<nsIChannel> channel = do_QueryInterface(aRequest);
|
||||
nsCOMPtr<nsILoadInfo> loadInfo = channel ? channel->GetLoadInfo() : nullptr;
|
||||
MOZ_ASSERT(!loadInfo || !loadInfo->GetServiceWorkerTaintingSynthesized());
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -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()
|
||||
{
|
||||
|
@ -257,7 +257,6 @@ public: /* internal necko use only */
|
||||
uint32_t mKeep : 2;
|
||||
};
|
||||
|
||||
NS_IMETHOD GetResponseSynthesized(bool* aSynthesized) override;
|
||||
bool AwaitingCacheCallbacks();
|
||||
void SetCouldBeSynthesized();
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user