author | Michal Novotny <michal.novotny@gmail.com> |
Wed, 17 Jun 2015 13:16:33 +0200 | |
changeset 249333 | 2e5641d6cd6f93934451d19b960401dbaac3a28e |
parent 249332 | af31a2ef9929c36ed0abe92dbca89ed69083ef56 |
child 249334 | 6961dc3eba19885d44e16d28d908cdbf8ca98c44 |
push id | 28923 |
push user | ryanvm@gmail.com |
push date | Wed, 17 Jun 2015 18:57:11 +0000 |
treeherder | mozilla-central@099d6cd6725e [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | ehsan |
bugs | 1173378 |
milestone | 41.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/dom/fetch/ChannelInfo.cpp +++ b/dom/fetch/ChannelInfo.cpp @@ -116,17 +116,20 @@ ChannelInfo::ResurrectInfoOnChannel(nsIC nsresult rv = NS_NewURI(getter_AddRefs(redirectedURI), mRedirectedURISpec); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; } if (httpChannel) { net::HttpBaseChannel* httpBaseChannel = static_cast<net::HttpBaseChannel*>(httpChannel.get()); - httpBaseChannel->OverrideURI(redirectedURI); + rv = httpBaseChannel->OverrideURI(redirectedURI); + if (NS_WARN_IF(NS_FAILED(rv))) { + return rv; + } } else { if (NS_WARN_IF(!jarChannel)) { return NS_ERROR_FAILURE; } static_cast<nsJARChannel*>(jarChannel.get())->OverrideURI(redirectedURI); } }
--- a/netwerk/protocol/http/HttpBaseChannel.cpp +++ b/netwerk/protocol/http/HttpBaseChannel.cpp @@ -1414,34 +1414,57 @@ HttpBaseChannel::SetRedirectionLimit(uin mRedirectionLimit = std::min<uint32_t>(value, 0xff); return NS_OK; } nsresult HttpBaseChannel::OverrideSecurityInfo(nsISupports* aSecurityInfo) { - MOZ_RELEASE_ASSERT(!mSecurityInfo, - "This can only be called when we don't have a security info object already"); + MOZ_ASSERT(!mSecurityInfo, + "This can only be called when we don't have a security info object already"); MOZ_RELEASE_ASSERT(aSecurityInfo, "This can only be called with a valid security info object"); - MOZ_RELEASE_ASSERT(ShouldIntercept(), - "This can only be called on channels that can be intercepted"); + MOZ_ASSERT(ShouldIntercept(), + "This can only be called on channels that can be intercepted"); + if (mSecurityInfo) { + LOG(("HttpBaseChannel::OverrideSecurityInfo mSecurityInfo is null! " + "[this=%p]\n", this)); + return NS_ERROR_UNEXPECTED; + } + if (!ShouldIntercept()) { + LOG(("HttpBaseChannel::OverrideSecurityInfo channel cannot be intercepted! " + "[this=%p]\n", this)); + return NS_ERROR_UNEXPECTED; + } + mSecurityInfo = aSecurityInfo; return NS_OK; } -void +nsresult HttpBaseChannel::OverrideURI(nsIURI* aRedirectedURI) { - MOZ_RELEASE_ASSERT(mLoadFlags & LOAD_REPLACE, - "This can only happen if the LOAD_REPLACE flag is set"); - MOZ_RELEASE_ASSERT(ShouldIntercept(), - "This can only be called on channels that can be intercepted"); + MOZ_ASSERT(mLoadFlags & LOAD_REPLACE, + "This can only happen if the LOAD_REPLACE flag is set"); + MOZ_ASSERT(ShouldIntercept(), + "This can only be called on channels that can be intercepted"); + if (!(mLoadFlags & LOAD_REPLACE)) { + LOG(("HttpBaseChannel::OverrideURI LOAD_REPLACE flag not set! [this=%p]\n", + this)); + return NS_ERROR_UNEXPECTED; + } + if (!ShouldIntercept()) { + LOG(("HttpBaseChannel::OverrideURI channel cannot be intercepted! " + "[this=%p]\n", this)); + return NS_ERROR_UNEXPECTED; + } + mURI = aRedirectedURI; + return NS_OK; } NS_IMETHODIMP HttpBaseChannel::IsNoStoreResponse(bool *value) { if (!mResponseHead) return NS_ERROR_NOT_AVAILABLE; *value = mResponseHead->NoStore();
--- a/netwerk/protocol/http/HttpBaseChannel.h +++ b/netwerk/protocol/http/HttpBaseChannel.h @@ -244,17 +244,17 @@ public: nsHttpResponseHead * GetResponseHead() const { return mResponseHead; } nsHttpRequestHead * GetRequestHead() { return &mRequestHead; } const NetAddr& GetSelfAddr() { return mSelfAddr; } const NetAddr& GetPeerAddr() { return mPeerAddr; } nsresult OverrideSecurityInfo(nsISupports* aSecurityInfo); - void OverrideURI(nsIURI* aRedirectedURI); + nsresult OverrideURI(nsIURI* aRedirectedURI); public: /* Necko internal use only... */ bool IsNavigation(); // Return whether upon a redirect code of httpStatus for method, the // request method should be rewritten to GET. static bool ShouldRewriteRedirectToGET(uint32_t httpStatus, nsHttpRequestHead::ParsedMethodType method);