diff --git a/dom/security/nsCSPService.cpp b/dom/security/nsCSPService.cpp index af50331e2ddd..6b6f074784fb 100644 --- a/dom/security/nsCSPService.cpp +++ b/dom/security/nsCSPService.cpp @@ -20,6 +20,7 @@ #include "nsContentPolicyUtils.h" #include "nsNetUtil.h" #include "mozilla/net/DocumentLoadListener.h" +#include "mozilla/net/DocumentChannel.h" using namespace mozilla; @@ -251,6 +252,16 @@ CSPService::AsyncOnChannelRedirect(nsIChannel* oldChannel, } } + // Don't do these checks if we're switching from DocumentChannel + // to a real channel. In that case, we should already have done + // the checks in the parent process. AsyncOnChannelRedirect + // isn't called in the content process if we switch process, + // so checking here would just hide bugs in the process switch + // cases. + if (RefPtr docChannel = do_QueryObject(oldChannel)) { + return NS_OK; + } + nsCOMPtr newUri; nsresult rv = newChannel->GetURI(getter_AddRefs(newUri)); NS_ENSURE_SUCCESS(rv, rv); diff --git a/dom/security/nsMixedContentBlocker.cpp b/dom/security/nsMixedContentBlocker.cpp index 477c1543ab20..d2cf7a5575cf 100644 --- a/dom/security/nsMixedContentBlocker.cpp +++ b/dom/security/nsMixedContentBlocker.cpp @@ -46,6 +46,7 @@ #include "mozilla/ipc/URIUtils.h" #include "mozilla/net/DNS.h" #include "mozilla/net/DocumentLoadListener.h" +#include "mozilla/net/DocumentChannel.h" using namespace mozilla; using namespace mozilla::dom; @@ -143,6 +144,16 @@ nsMixedContentBlocker::AsyncOnChannelRedirect( return NS_OK; } + // Don't do these checks if we're switching from DocumentChannel + // to a real channel. In that case, we should already have done + // the checks in the parent process. AsyncOnChannelRedirect + // isn't called in the content process if we switch process, + // so checking here would just hide bugs in the process switch + // cases. + if (RefPtr docChannel = do_QueryObject(aOldChannel)) { + return NS_OK; + } + nsresult rv; nsCOMPtr oldUri; rv = aOldChannel->GetURI(getter_AddRefs(oldUri)); diff --git a/netwerk/base/LoadInfo.cpp b/netwerk/base/LoadInfo.cpp index 17468a7d3d0b..3935f063753f 100644 --- a/netwerk/base/LoadInfo.cpp +++ b/netwerk/base/LoadInfo.cpp @@ -570,10 +570,7 @@ LoadInfo::LoadInfo(dom::CanonicalBrowsingContext* aBrowsingContext, mFrameOuterWindowID(aFrameOuterWindowID), mBrowsingContextID(0), mFrameBrowsingContextID(0), - // annyG: we are mimicking the old LoadInfo since it has gone through - // security checks in the content and we wouldn't reach this point - // if the load got blocked earlier. - mInitialSecurityCheckDone(true), + mInitialSecurityCheckDone(false), mIsThirdPartyContext(false), mIsThirdPartyContextToTopWindow(true), mIsFormSubmission(false), diff --git a/netwerk/ipc/DocumentChannelChild.cpp b/netwerk/ipc/DocumentChannelChild.cpp index be0751c336dc..953ed547fb6e 100644 --- a/netwerk/ipc/DocumentChannelChild.cpp +++ b/netwerk/ipc/DocumentChannelChild.cpp @@ -46,8 +46,6 @@ DocumentChannelChild::AsyncOpen(nsIStreamListener* aListener) { nsresult rv = NS_OK; nsCOMPtr listener = aListener; - rv = nsContentSecurityManager::doContentSecurityCheck(this, listener); - NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_TRUE(gNeckoChild, NS_ERROR_FAILURE); NS_ENSURE_ARG_POINTER(listener);