--- a/netwerk/base/nsNetUtil.cpp
+++ b/netwerk/base/nsNetUtil.cpp
@@ -631,17 +631,18 @@ NS_NewStreamLoaderInternal(nsIStreamLoad
aContentPolicyType,
aLoadGroup,
aCallbacks,
aLoadFlags);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIHttpChannel> httpChannel(do_QueryInterface(channel));
if (httpChannel) {
- httpChannel->SetReferrer(aReferrer);
+ rv = httpChannel->SetReferrer(aReferrer);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
}
rv = NS_NewStreamLoader(outStream, aObserver);
NS_ENSURE_SUCCESS(rv, rv);
return channel->AsyncOpen2(*outStream);
}
nsresult /* NS_NewStreamLoaderNode */
--- a/netwerk/protocol/ftp/FTPChannelParent.cpp
+++ b/netwerk/protocol/ftp/FTPChannelParent.cpp
@@ -472,17 +472,18 @@ FTPChannelParent::OnStartRequest(nsIRequ
PRTime lastModified = 0;
nsCOMPtr<nsIFTPChannel> ftpChan = do_QueryInterface(aRequest);
if (ftpChan) {
ftpChan->GetLastModifiedTime(&lastModified);
}
nsCOMPtr<nsIHttpChannelInternal> httpChan = do_QueryInterface(aRequest);
if (httpChan) {
- httpChan->GetLastModifiedTime(&lastModified);
+ DebugOnly<nsresult> rv = httpChan->GetLastModifiedTime(&lastModified);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
}
URIParams uriparam;
nsCOMPtr<nsIURI> uri;
chan->GetURI(getter_AddRefs(uri));
SerializeURI(uri, uriparam);
if (mIPCClosed || !SendOnStartRequest(mStatus, contentLength, contentType,
--- a/netwerk/protocol/http/Http2Session.cpp
+++ b/netwerk/protocol/http/Http2Session.cpp
@@ -1080,17 +1080,18 @@ Http2Session::CleanupStream(Http2Stream
// table too.
uint32_t id = aStream->StreamID();
if (id > 0) {
mStreamIDHash.Remove(id);
if (!(id & 1)) {
mPushedStreams.RemoveElement(aStream);
Http2PushedStream *pushStream = static_cast<Http2PushedStream *>(aStream);
nsAutoCString hashKey;
- pushStream->GetHashKey(hashKey);
+ DebugOnly<bool> rv = pushStream->GetHashKey(hashKey);
+ MOZ_ASSERT(rv);
nsIRequestContext *requestContext = aStream->RequestContext();
if (requestContext) {
SpdyPushCache *cache = nullptr;
requestContext->GetSpdyPushCache(&cache);
if (cache) {
Http2PushedStream *trash = cache->RemovePushedStreamHttp2(hashKey);
LOG3(("Http2Session::CleanupStream %p aStream=%p pushStream=%p trash=%p",
this, aStream, pushStream, trash));
@@ -1224,23 +1225,23 @@ Http2Session::RecvHeaders(Http2Session *
self->mExpectedHeaderID = 0;
else
self->mExpectedHeaderID = self->mInputFrameID;
uint32_t priorityLen = 0;
if (self->mInputFrameFlags & kFlag_PRIORITY) {
priorityLen = 5;
}
- self->SetInputFrameDataStream(self->mInputFrameID);
+ nsresult rv = self->SetInputFrameDataStream(self->mInputFrameID);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
// Find out how much padding this frame has, so we can only extract the real
// header data from the frame.
uint16_t paddingLength = 0;
uint8_t paddingControlBytes = 0;
- nsresult rv;
if (!isContinuation) {
self->mDecompressBuffer.Truncate();
rv = self->ParsePadding(paddingControlBytes, paddingLength);
if (NS_FAILED(rv)) {
return rv;
}
}
@@ -1459,17 +1460,18 @@ Http2Session::RecvRstStream(Http2Session
}
self->mDownstreamRstReason = NetworkEndian::readUint32(
self->mInputFrameBuffer.get() + kFrameHeaderBytes);
LOG3(("Http2Session::RecvRstStream %p RST_STREAM Reason Code %u ID %x\n",
self, self->mDownstreamRstReason, self->mInputFrameID));
- self->SetInputFrameDataStream(self->mInputFrameID);
+ DebugOnly<nsresult> rv = self->SetInputFrameDataStream(self->mInputFrameID);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
if (!self->mInputFrameDataStream) {
// if we can't find the stream just ignore it (4.2 closed)
self->ResetDownstreamState();
return NS_OK;
}
self->mInputFrameDataStream->SetRecvdReset(true);
self->MaybeDecrementConcurrent(self->mInputFrameDataStream);
@@ -2068,17 +2070,18 @@ Http2Session::RecvContinuation(Http2Sess
MOZ_ASSERT(self->mExpectedPushPromiseID || self->mExpectedHeaderID);
MOZ_ASSERT(!(self->mExpectedPushPromiseID && self->mExpectedHeaderID));
LOG3(("Http2Session::RecvContinuation %p Flags 0x%X id 0x%X "
"promise id 0x%X header id 0x%X\n",
self, self->mInputFrameFlags, self->mInputFrameID,
self->mExpectedPushPromiseID, self->mExpectedHeaderID));
- self->SetInputFrameDataStream(self->mInputFrameID);
+ DebugOnly<nsresult> rv = self->SetInputFrameDataStream(self->mInputFrameID);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
if (!self->mInputFrameDataStream) {
LOG3(("Http2Session::RecvContination stream ID 0x%X not found.",
self->mInputFrameID));
RETURN_SESSION_ERROR(self, PROTOCOL_ERROR);
}
// continued headers
@@ -3553,17 +3556,18 @@ Http2Session::CreateTunnel(nsHttpTransac
{
LOG(("Http2Session::CreateTunnel %p %p make new tunnel\n", this, trans));
// The connect transaction will hold onto the underlying http
// transaction so that an auth created by the connect can be mappped
// to the correct security callbacks
RefPtr<SpdyConnectTransaction> connectTrans =
new SpdyConnectTransaction(ci, aCallbacks, trans->Caps(), trans, this);
- AddStream(connectTrans, nsISupportsPriority::PRIORITY_NORMAL, false, nullptr);
+ DebugOnly<bool> rv = AddStream(connectTrans, nsISupportsPriority::PRIORITY_NORMAL, false, nullptr);
+ MOZ_ASSERT(rv);
Http2Stream *tunnel = mStreamTransactionHash.Get(connectTrans);
MOZ_ASSERT(tunnel);
RegisterTunnel(tunnel);
}
void
Http2Session::DispatchOnTunnel(nsAHttpTransaction *aHttpTransaction,
nsIInterfaceRequestor *aCallbacks)
--- a/netwerk/protocol/http/HttpBaseChannel.cpp
+++ b/netwerk/protocol/http/HttpBaseChannel.cpp
@@ -129,17 +129,18 @@ public:
{
}
NS_IMETHOD VisitHeader(const nsACString& aHeader,
const nsACString& aValue) override
{
nsHttpAtom atom = nsHttp::ResolveAtom(aHeader);
if (!IsHeaderBlacklistedForRedirectCopy(atom)) {
- mChannel->SetRequestHeader(aHeader, aValue, false);
+ DebugOnly<nsresult> rv = mChannel->SetRequestHeader(aHeader, aValue, false);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
}
return NS_OK;
}
private:
~AddHeadersToChannelVisitor()
{
}
@@ -3220,91 +3221,109 @@ HttpBaseChannel::SetupReplacementChannel
}
// since preserveMethod is true, we need to ensure that the appropriate
// request method gets set on the channel, regardless of whether or not
// we set the upload stream above. This means SetRequestMethod() will
// be called twice if ExplicitSetUploadStream() gets called above.
nsAutoCString method;
mRequestHead.Method(method);
- httpChannel->SetRequestMethod(method);
+ rv = httpChannel->SetRequestMethod(method);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
}
// convey the referrer if one was used for this channel to the next one
- if (mReferrer)
- httpChannel->SetReferrerWithPolicy(mReferrer, mReferrerPolicy);
+ if (mReferrer) {
+ rv = httpChannel->SetReferrerWithPolicy(mReferrer, mReferrerPolicy);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
+ }
// convey the mAllowSTS flags
- httpChannel->SetAllowSTS(mAllowSTS);
+ rv = httpChannel->SetAllowSTS(mAllowSTS);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
// convey the new redirection limit
// make sure we don't underflow
uint32_t redirectionLimit = mRedirectionLimit
? mRedirectionLimit - 1
: 0;
- httpChannel->SetRedirectionLimit(redirectionLimit);
+ rv = httpChannel->SetRedirectionLimit(redirectionLimit);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
// convey the Accept header value
{
nsAutoCString oldAcceptValue;
nsresult hasHeader = mRequestHead.GetHeader(nsHttp::Accept, oldAcceptValue);
if (NS_SUCCEEDED(hasHeader)) {
- httpChannel->SetRequestHeader(NS_LITERAL_CSTRING("Accept"),
- oldAcceptValue,
- false);
+ rv = httpChannel->SetRequestHeader(NS_LITERAL_CSTRING("Accept"),
+ oldAcceptValue,
+ false);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
}
}
// share the request context - see bug 1236650
- httpChannel->SetRequestContextID(mRequestContextID);
+ rv = httpChannel->SetRequestContextID(mRequestContextID);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
// Preserve the loading order
nsCOMPtr<nsISupportsPriority> p = do_QueryInterface(newChannel);
if (p) {
p->SetPriority(mPriority);
}
if (httpInternal) {
// Convey third party cookie, conservative, and spdy flags.
- httpInternal->SetThirdPartyFlags(mThirdPartyFlags);
- httpInternal->SetAllowSpdy(mAllowSpdy);
- httpInternal->SetAllowAltSvc(mAllowAltSvc);
- httpInternal->SetBeConservative(mBeConservative);
+ rv = httpInternal->SetThirdPartyFlags(mThirdPartyFlags);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
+ rv = httpInternal->SetAllowSpdy(mAllowSpdy);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
+ rv = httpInternal->SetAllowAltSvc(mAllowAltSvc);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
+ rv = httpInternal->SetBeConservative(mBeConservative);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
RefPtr<nsHttpChannel> realChannel;
CallQueryInterface(newChannel, realChannel.StartAssignment());
if (realChannel) {
- realChannel->SetTopWindowURI(mTopWindowURI);
+ rv = realChannel->SetTopWindowURI(mTopWindowURI);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
}
// update the DocumentURI indicator since we are being redirected.
// if this was a top-level document channel, then the new channel
// should have its mDocumentURI point to newURI; otherwise, we
// just need to pass along our mDocumentURI to the new channel.
if (newURI && (mURI == mDocumentURI))
- httpInternal->SetDocumentURI(newURI);
+ rv = httpInternal->SetDocumentURI(newURI);
else
- httpInternal->SetDocumentURI(mDocumentURI);
+ rv = httpInternal->SetDocumentURI(mDocumentURI);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
// if there is a chain of keys for redirect-responses we transfer it to
// the new channel (see bug #561276)
if (mRedirectedCachekeys) {
LOG(("HttpBaseChannel::SetupReplacementChannel "
"[this=%p] transferring chain of redirect cache-keys", this));
- httpInternal->SetCacheKeysRedirectChain(mRedirectedCachekeys.forget());
+ rv = httpInternal->SetCacheKeysRedirectChain(mRedirectedCachekeys.forget());
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
}
// Preserve CORS mode flag.
- httpInternal->SetCorsMode(mCorsMode);
+ rv = httpInternal->SetCorsMode(mCorsMode);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
// Preserve Redirect mode flag.
- httpInternal->SetRedirectMode(mRedirectMode);
+ rv = httpInternal->SetRedirectMode(mRedirectMode);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
// Preserve Cache mode flag.
- httpInternal->SetFetchCacheMode(mFetchCacheMode);
+ rv = httpInternal->SetFetchCacheMode(mFetchCacheMode);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
// Preserve Integrity metadata.
- httpInternal->SetIntegrityMetadata(mIntegrityMetadata);
+ rv = httpInternal->SetIntegrityMetadata(mIntegrityMetadata);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
}
// transfer application cache information
nsCOMPtr<nsIApplicationCacheChannel> appCacheChannel =
do_QueryInterface(newChannel);
if (appCacheChannel) {
appCacheChannel->SetApplicationCache(mApplicationCache);
appCacheChannel->SetInheritApplicationCache(mInheritApplicationCache);
@@ -3371,17 +3390,18 @@ HttpBaseChannel::SetupReplacementChannel
cacheInfoChan->PreferAlternativeDataType(mPreferredCachedAltDataType);
}
if (redirectFlags & (nsIChannelEventSink::REDIRECT_INTERNAL |
nsIChannelEventSink::REDIRECT_STS_UPGRADE)) {
// Copy non-origin related headers to the new channel.
nsCOMPtr<nsIHttpHeaderVisitor> visitor =
new AddHeadersToChannelVisitor(httpChannel);
- mRequestHead.VisitHeaders(visitor);
+ rv = mRequestHead.VisitHeaders(visitor);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
}
// This channel has been redirected. Don't report timing info.
mTimingEnabled = false;
return NS_OK;
}
// Redirect Tracking
--- a/netwerk/protocol/http/HttpChannelChild.cpp
+++ b/netwerk/protocol/http/HttpChannelChild.cpp
@@ -1261,17 +1261,18 @@ void HttpChannelChild::FinishIntercepted
mOverrideRunnable = nullptr;
}
}
mozilla::ipc::IPCResult
HttpChannelChild::RecvReportSecurityMessage(const nsString& messageTag,
const nsString& messageCategory)
{
- AddSecurityMessage(messageTag, messageCategory);
+ DebugOnly<nsresult> rv = AddSecurityMessage(messageTag, messageCategory);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
return IPC_OK();
}
class Redirect1Event : public ChannelEvent
{
public:
Redirect1Event(HttpChannelChild* child,
const uint32_t& registrarId,
@@ -1356,28 +1357,29 @@ HttpChannelChild::SetupRedirect(nsIURI*
nsCOMPtr<nsIHttpChannelChild> httpChannelChild = do_QueryInterface(newChannel);
if (httpChannelChild) {
bool shouldUpgrade = false;
auto channelChild = static_cast<HttpChannelChild*>(httpChannelChild.get());
if (mShouldInterceptSubsequentRedirect) {
// In the case where there was a synthesized response that caused a redirection,
// we must force the new channel to intercept the request in the parent before a
// network transaction is initiated.
- httpChannelChild->ForceIntercepted(false, false);
+ rv = httpChannelChild->ForceIntercepted(false, false);
} else if (mRedirectMode == nsIHttpChannelInternal::REDIRECT_MODE_MANUAL &&
((redirectFlags & (nsIChannelEventSink::REDIRECT_TEMPORARY |
nsIChannelEventSink::REDIRECT_PERMANENT)) != 0) &&
channelChild->ShouldInterceptURI(uri, shouldUpgrade)) {
// In the case where the redirect mode is manual, we need to check whether
// the post-redirect channel needs to be intercepted. If that is the
// case, force the new channel to intercept the request in the parent
// similar to the case above, but also remember that ShouldInterceptURI()
// returned true to avoid calling it a second time.
- httpChannelChild->ForceIntercepted(true, shouldUpgrade);
+ rv = httpChannelChild->ForceIntercepted(true, shouldUpgrade);
}
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
}
mRedirectChannelChild = do_QueryInterface(newChannel);
newChannel.forget(outChannel);
return NS_OK;
}
@@ -1404,17 +1406,18 @@ HttpChannelChild::Redirect1Begin(const u
redirectFlags,
getter_AddRefs(newChannel));
if (NS_SUCCEEDED(rv)) {
if (mRedirectChannelChild) {
// Set the channelId allocated in parent to the child instance
nsCOMPtr<nsIHttpChannel> httpChannel = do_QueryInterface(mRedirectChannelChild);
if (httpChannel) {
- httpChannel->SetChannelId(channelId);
+ rv = httpChannel->SetChannelId(channelId);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
}
mRedirectChannelChild->ConnectParent(registrarId);
}
rv = gHttpHandler->AsyncOnChannelRedirect(this, newChannel, redirectFlags);
}
if (NS_FAILED(rv))
OnRedirectVerifyCallback(rv);
@@ -1451,17 +1454,18 @@ HttpChannelChild::BeginNonIPCRedirect(ns
if (NS_FAILED(rv))
OnRedirectVerifyCallback(rv);
}
void
HttpChannelChild::OverrideSecurityInfoForNonIPCRedirect(nsISupports* securityInfo)
{
mResponseCouldBeSynthesized = true;
- OverrideSecurityInfo(securityInfo);
+ DebugOnly<nsresult> rv = OverrideSecurityInfo(securityInfo);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
}
class Redirect3Event : public ChannelEvent
{
public:
explicit Redirect3Event(HttpChannelChild* child) : mChild(child) {}
void Run() { mChild->Redirect3Complete(nullptr); }
private:
@@ -1756,19 +1760,21 @@ HttpChannelChild::OnRedirectVerifyCallba
nsCOMPtr<nsILoadInfo> newLoadInfo;
rv = newHttpChannel->GetLoadInfo(getter_AddRefs(newLoadInfo));
if (NS_SUCCEEDED(rv) && newLoadInfo) {
forceHSTSPriming = newLoadInfo->GetForceHSTSPriming();
mixedContentWouldBlock = newLoadInfo->GetMixedContentWouldBlock();
}
- newHttpChannel->GetReferrerPolicy(&referrerPolicy);
+ rv = newHttpChannel->GetReferrerPolicy(&referrerPolicy);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
nsCOMPtr<nsIURI> newChannelReferrerURI;
- newHttpChannel->GetReferrer(getter_AddRefs(newChannelReferrerURI));
+ rv = newHttpChannel->GetReferrer(getter_AddRefs(newChannelReferrerURI));
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
SerializeURI(newChannelReferrerURI, referrerURI);
}
if (mRedirectingForSubsequentSynthesizedResponse) {
nsCOMPtr<nsIHttpChannelChild> httpChannelChild = do_QueryInterface(mRedirectChannelChild);
RefPtr<HttpChannelChild> redirectedChannel =
static_cast<HttpChannelChild*>(httpChannelChild.get());
@@ -1787,18 +1793,20 @@ HttpChannelChild::OnRedirectVerifyCallba
RequestHeaderTuples emptyHeaders;
RequestHeaderTuples* headerTuples = &emptyHeaders;
nsLoadFlags loadFlags = 0;
OptionalCorsPreflightArgs corsPreflightArgs = mozilla::void_t();
nsCOMPtr<nsIHttpChannelChild> newHttpChannelChild =
do_QueryInterface(mRedirectChannelChild);
if (newHttpChannelChild && NS_SUCCEEDED(result)) {
- newHttpChannelChild->AddCookiesToRequest();
- newHttpChannelChild->GetClientSetRequestHeaders(&headerTuples);
+ rv = newHttpChannelChild->AddCookiesToRequest();
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
+ rv = newHttpChannelChild->GetClientSetRequestHeaders(&headerTuples);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
newHttpChannelChild->GetClientSetCorsPreflightParameters(corsPreflightArgs);
}
/* If the redirect was canceled, bypass OMR and send an empty API
* redirect URI */
SerializeURI(nullptr, redirectURI);
if (NS_SUCCEEDED(result)) {
@@ -1978,17 +1986,18 @@ HttpChannelChild::AsyncOpen(nsIStreamLis
if (NS_FAILED(rv))
return rv;
nsAutoCString cookie;
if (NS_SUCCEEDED(mRequestHead.GetHeader(nsHttp::Cookie, cookie))) {
mUserSetCookieHeader = cookie;
}
- AddCookiesToRequest();
+ rv = AddCookiesToRequest();
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
//
// NOTE: From now on we must return NS_OK; all errors must be handled via
// OnStart/OnStopRequest
//
// We notify "http-on-opening-request" observers in the child
// process so that devtools can capture a stack trace at the
@@ -2874,17 +2883,18 @@ HttpChannelChild::OverrideWithSynthesize
mResponseHead = aResponseHead;
mSynthesizedResponse = true;
if (WillRedirect(mResponseHead)) {
mShouldInterceptSubsequentRedirect = true;
// Continue with the original cross-process request
nsresult rv = ContinueAsyncOpen();
if (NS_WARN_IF(NS_FAILED(rv))) {
- AsyncAbort(rv);
+ rv = AsyncAbort(rv);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
}
return;
}
// In our current implementation, the FetchEvent handler will copy the
// response stream completely into the pipe backing the input stream so we
// can treat the available as the length of the stream.
uint64_t available;
--- a/netwerk/protocol/http/HttpChannelParent.cpp
+++ b/netwerk/protocol/http/HttpChannelParent.cpp
@@ -388,22 +388,26 @@ HttpChannelParent::DoAsyncOpen( const U
if (doResumeAt)
mChannel->ResumeAt(startPos, entityID);
if (originalUri)
mChannel->SetOriginalURI(originalUri);
if (docUri)
mChannel->SetDocumentURI(docUri);
- if (referrerUri)
- mChannel->SetReferrerWithPolicyInternal(referrerUri, aReferrerPolicy);
+ if (referrerUri) {
+ rv = mChannel->SetReferrerWithPolicyInternal(referrerUri, aReferrerPolicy);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
+ }
if (apiRedirectToUri)
mChannel->RedirectTo(apiRedirectToUri);
- if (topWindowUri)
- mChannel->SetTopWindowURI(topWindowUri);
+ if (topWindowUri) {
+ rv = mChannel->SetTopWindowURI(topWindowUri);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
+ }
if (aLoadFlags != nsIRequest::LOAD_NORMAL)
mChannel->SetLoadFlags(aLoadFlags);
for (uint32_t i = 0; i < requestHeaders.Length(); i++) {
if (requestHeaders[i].mEmpty) {
mChannel->SetEmptyRequestHeader(requestHeaders[i].mHeader);
} else {
mChannel->SetRequestHeader(requestHeaders[i].mHeader,
@@ -486,17 +490,18 @@ HttpChannelParent::DoAsyncOpen( const U
if (aSynthesizedResponseHead.type() == OptionalHttpResponseHead::TnsHttpResponseHead) {
mParentListener->SetupInterception(aSynthesizedResponseHead.get_nsHttpResponseHead());
mWillSynthesizeResponse = true;
mChannel->SetCouldBeSynthesized();
if (!aSecurityInfoSerialization.IsEmpty()) {
nsCOMPtr<nsISupports> secInfo;
NS_DeserializeObject(aSecurityInfoSerialization, getter_AddRefs(secInfo));
- mChannel->OverrideSecurityInfo(secInfo);
+ rv = mChannel->OverrideSecurityInfo(secInfo);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
}
} else {
nsLoadFlags newLoadFlags;
mChannel->GetLoadFlags(&newLoadFlags);
newLoadFlags |= nsIChannel::LOAD_BYPASS_SERVICE_WORKER;
mChannel->SetLoadFlags(newLoadFlags);
}
@@ -725,27 +730,30 @@ HttpChannelParent::RecvRedirect2Verify(c
nsresult rv;
if (NS_SUCCEEDED(result)) {
nsCOMPtr<nsIHttpChannel> newHttpChannel =
do_QueryInterface(mRedirectChannel);
if (newHttpChannel) {
nsCOMPtr<nsIURI> apiRedirectUri = DeserializeURI(aAPIRedirectURI);
- if (apiRedirectUri)
- newHttpChannel->RedirectTo(apiRedirectUri);
+ if (apiRedirectUri) {
+ rv = newHttpChannel->RedirectTo(apiRedirectUri);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
+ }
for (uint32_t i = 0; i < changedHeaders.Length(); i++) {
if (changedHeaders[i].mEmpty) {
- newHttpChannel->SetEmptyRequestHeader(changedHeaders[i].mHeader);
+ rv = newHttpChannel->SetEmptyRequestHeader(changedHeaders[i].mHeader);
} else {
- newHttpChannel->SetRequestHeader(changedHeaders[i].mHeader,
- changedHeaders[i].mValue,
- changedHeaders[i].mMerge);
+ rv = newHttpChannel->SetRequestHeader(changedHeaders[i].mHeader,
+ changedHeaders[i].mValue,
+ changedHeaders[i].mMerge);
}
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
}
// A successfully redirected channel must have the LOAD_REPLACE flag.
MOZ_ASSERT(loadFlags & nsIChannel::LOAD_REPLACE);
if (loadFlags & nsIChannel::LOAD_REPLACE) {
newHttpChannel->SetLoadFlags(loadFlags);
}
@@ -761,17 +769,18 @@ HttpChannelParent::RecvRedirect2Verify(c
nsCOMPtr<nsILoadInfo> newLoadInfo;
rv = newHttpChannel->GetLoadInfo(getter_AddRefs(newLoadInfo));
if (NS_SUCCEEDED(rv) && newLoadInfo) {
newLoadInfo->SetHSTSPriming(aMixedContentWouldBlock);
}
}
nsCOMPtr<nsIURI> referrerUri = DeserializeURI(aReferrerURI);
- newHttpChannel->SetReferrerWithPolicy(referrerUri, referrerPolicy);
+ rv = newHttpChannel->SetReferrerWithPolicy(referrerUri, referrerPolicy);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
nsCOMPtr<nsIApplicationCacheChannel> appCacheChannel =
do_QueryInterface(newHttpChannel);
if (appCacheChannel) {
appCacheChannel->SetChooseApplicationCache(aChooseAppcache);
}
}
}
--- a/netwerk/protocol/http/HttpChannelParentListener.cpp
+++ b/netwerk/protocol/http/HttpChannelParentListener.cpp
@@ -324,18 +324,20 @@ HttpChannelParentListener::ChannelInterc
mInterceptedChannel = aChannel;
return NS_OK;
}
nsAutoCString statusText;
mSynthesizedResponseHead->StatusText(statusText);
aChannel->SynthesizeStatus(mSynthesizedResponseHead->Status(), statusText);
nsCOMPtr<nsIHttpHeaderVisitor> visitor = new HeaderVisitor(aChannel);
- mSynthesizedResponseHead->VisitHeaders(visitor,
- nsHttpHeaderArray::eFilterResponse);
+ DebugOnly<nsresult> rv =
+ mSynthesizedResponseHead->VisitHeaders(visitor,
+ nsHttpHeaderArray::eFilterResponse);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
nsCOMPtr<nsIRunnable> event = new FinishSynthesizedResponse(aChannel);
NS_DispatchToCurrentThread(event);
mSynthesizedResponseHead = nullptr;
MOZ_ASSERT(mNextListener);
RefPtr<HttpChannelParent> channel = do_QueryObject(mNextListener);
--- a/netwerk/protocol/http/NullHttpTransaction.cpp
+++ b/netwerk/protocol/http/NullHttpTransaction.cpp
@@ -59,17 +59,18 @@ public:
nsresult rv = NS_NewURI(getter_AddRefs(uri),
(mEndToEndSSL ? NS_LITERAL_CSTRING("https://")
: NS_LITERAL_CSTRING("http://") ) + mHost + port);
if (NS_FAILED(rv)) {
return NS_OK;
}
RefPtr<NullHttpChannel> channel = new NullHttpChannel();
- channel->Init(uri, 0, nullptr, 0, nullptr);
+ rv = channel->Init(uri, 0, nullptr, 0, nullptr);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
mActivityDistributor->ObserveActivity(
nsCOMPtr<nsISupports>(do_QueryObject(channel)),
mActivityType,
mActivitySubtype,
mTimestamp,
mExtraSizeData,
mExtraStringData);
@@ -239,17 +240,18 @@ NullHttpTransaction::RequestHead()
mRequestHead = new nsHttpRequestHead();
nsAutoCString hostHeader;
nsCString host(mConnectionInfo->GetOrigin());
nsresult rv = nsHttpHandler::GenerateHostPort(host,
mConnectionInfo->OriginPort(),
hostHeader);
if (NS_SUCCEEDED(rv)) {
- mRequestHead->SetHeader(nsHttp::Host, hostHeader);
+ rv = mRequestHead->SetHeader(nsHttp::Host, hostHeader);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
if (mActivityDistributor) {
// Report request headers.
nsCString reqHeaderBuf;
mRequestHead->Flatten(reqHeaderBuf, false);
NS_DispatchToMainThread(new CallObserveActivity(mActivityDistributor,
mConnectionInfo->GetOrigin(),
mConnectionInfo->OriginPort(),
mConnectionInfo->EndToEndSSL(),
--- a/netwerk/protocol/http/TunnelUtils.cpp
+++ b/netwerk/protocol/http/TunnelUtils.cpp
@@ -435,17 +435,18 @@ NS_IMETHODIMP
TLSFilterTransaction::Notify(nsITimer *timer)
{
MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
LOG(("TLSFilterTransaction %p NudgeTunnel notify\n", this));
if (timer != mTimer) {
return NS_ERROR_UNEXPECTED;
}
- StartTimerCallback();
+ DebugOnly<nsresult> rv = StartTimerCallback();
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
return NS_OK;
}
nsresult
TLSFilterTransaction::StartTimerCallback()
{
LOG(("TLSFilterTransaction %p NudgeTunnel StartTimerCallback %p\n",
this, mNudgeCallback.get()));
@@ -958,17 +959,19 @@ SpdyConnectTransaction::SpdyConnectTrans
, mOutputDataUsed(0)
, mOutputDataOffset(0)
, mForcePlainText(false)
{
LOG(("SpdyConnectTransaction ctor %p\n", this));
mTimestampSyn = TimeStamp::Now();
mRequestHead = new nsHttpRequestHead();
- nsHttpConnection::MakeConnectString(trans, mRequestHead, mConnectString);
+ DebugOnly<nsresult> rv =
+ nsHttpConnection::MakeConnectString(trans, mRequestHead, mConnectString);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
mDrivingTransaction = trans;
}
SpdyConnectTransaction::~SpdyConnectTransaction()
{
LOG(("SpdyConnectTransaction dtor %p\n", this));
if (mDrivingTransaction) {
@@ -1006,22 +1009,24 @@ SpdyConnectTransaction::MapStreamToHttpC
LOG(("SpdyConnectTransaction new httpconnection %p %s\n",
mTunneledConn.get(), aConnInfo->HashKey().get()));
nsCOMPtr<nsIInterfaceRequestor> callbacks;
GetSecurityCallbacks(getter_AddRefs(callbacks));
mTunneledConn->SetTransactionCaps(Caps());
MOZ_ASSERT(aConnInfo->UsingHttpsProxy());
TimeDuration rtt = TimeStamp::Now() - mTimestampSyn;
- mTunneledConn->Init(aConnInfo,
- gHttpHandler->ConnMgr()->MaxRequestDelay(),
- mTunnelTransport, mTunnelStreamIn, mTunnelStreamOut,
- true, callbacks,
- PR_MillisecondsToInterval(
- static_cast<uint32_t>(rtt.ToMilliseconds())));
+ DebugOnly<nsresult> rv =
+ mTunneledConn->Init(aConnInfo,
+ gHttpHandler->ConnMgr()->MaxRequestDelay(),
+ mTunnelTransport, mTunnelStreamIn, mTunnelStreamOut,
+ true, callbacks,
+ PR_MillisecondsToInterval(
+ static_cast<uint32_t>(rtt.ToMilliseconds())));
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
if (mForcePlainText) {
mTunneledConn->ForcePlainText();
} else {
mTunneledConn->SetupSecondaryTLS();
mTunneledConn->SetInSpdyTunnel(true);
}
// make the originating transaction stick to the tunneled conn
--- a/netwerk/protocol/http/nsHttpAuthCache.cpp
+++ b/netwerk/protocol/http/nsHttpAuthCache.cpp
@@ -60,18 +60,20 @@ nsHttpAuthCache::nsHttpAuthCache()
nsCOMPtr<nsIObserverService> obsSvc = services::GetObserverService();
if (obsSvc) {
obsSvc->AddObserver(mObserver, "clear-origin-attributes-data", false);
}
}
nsHttpAuthCache::~nsHttpAuthCache()
{
- if (mDB)
- ClearAll();
+ if (mDB) {
+ DebugOnly<nsresult> rv = ClearAll();
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
+ }
nsCOMPtr<nsIObserverService> obsSvc = services::GetObserverService();
if (obsSvc) {
obsSvc->RemoveObserver(mObserver, "clear-origin-attributes-data");
mObserver->mOwner = nullptr;
}
}
nsresult
--- a/netwerk/protocol/http/nsHttpChannel.cpp
+++ b/netwerk/protocol/http/nsHttpChannel.cpp
@@ -296,18 +296,20 @@ nsHttpChannel::nsHttpChannel()
mChannelCreationTime = PR_Now();
mChannelCreationTimestamp = TimeStamp::Now();
}
nsHttpChannel::~nsHttpChannel()
{
LOG(("Destroying nsHttpChannel [this=%p]\n", this));
- if (mAuthProvider)
- mAuthProvider->Disconnect(NS_ERROR_ABORT);
+ if (mAuthProvider) {
+ DebugOnly<nsresult> rv = mAuthProvider->Disconnect(NS_ERROR_ABORT);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
+ }
ReleaseMainThreadOnlyReferences();
}
void
nsHttpChannel::ReleaseMainThreadOnlyReferences()
{
if (NS_IsMainThread()) {
@@ -654,21 +656,23 @@ nsHttpChannel::HandleAsyncRedirect()
// in processing the redirect.
if (NS_SUCCEEDED(mStatus)) {
PushRedirectAsyncFunc(&nsHttpChannel::ContinueHandleAsyncRedirect);
rv = AsyncProcessRedirection(mResponseHead->Status());
if (NS_FAILED(rv)) {
PopRedirectAsyncFunc(&nsHttpChannel::ContinueHandleAsyncRedirect);
// TODO: if !DoNotRender3xxBody(), render redirect body instead.
// But first we need to cache 3xx bodies (bug 748510)
- ContinueHandleAsyncRedirect(rv);
+ rv = ContinueHandleAsyncRedirect(rv);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
}
}
else {
- ContinueHandleAsyncRedirect(mStatus);
+ rv = ContinueHandleAsyncRedirect(mStatus);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
}
}
nsresult
nsHttpChannel::ContinueHandleAsyncRedirect(nsresult rv)
{
if (NS_FAILED(rv)) {
// If AsyncProcessRedirection fails, then we have to send out the
@@ -752,17 +756,18 @@ nsHttpChannel::HandleAsyncFallback()
PushRedirectAsyncFunc(&nsHttpChannel::ContinueHandleAsyncFallback);
bool waitingForRedirectCallback;
rv = ProcessFallback(&waitingForRedirectCallback);
if (waitingForRedirectCallback)
return;
PopRedirectAsyncFunc(&nsHttpChannel::ContinueHandleAsyncFallback);
}
- ContinueHandleAsyncFallback(rv);
+ rv = ContinueHandleAsyncFallback(rv);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
}
nsresult
nsHttpChannel::ContinueHandleAsyncFallback(nsresult rv)
{
if (!mCanceled && (NS_FAILED(rv) || !mFallingBack)) {
// If ProcessFallback fails, then we have to send out the
// OnStart/OnStop notifications.
@@ -885,59 +890,66 @@ nsHttpChannel::SetupTransaction()
mRequestTime = NowInSeconds();
mRequestTimeInitialized = true;
// if doing a reload, force end-to-end
if (mLoadFlags & LOAD_BYPASS_CACHE) {
// We need to send 'Pragma:no-cache' to inhibit proxy caching even if
// no proxy is configured since we might be talking with a transparent
// proxy, i.e. one that operates at the network level. See bug #14772.
- mRequestHead.SetHeaderOnce(nsHttp::Pragma, "no-cache", true);
+ rv = mRequestHead.SetHeaderOnce(nsHttp::Pragma, "no-cache", true);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
// If we're configured to speak HTTP/1.1 then also send 'Cache-control:
// no-cache'
- if (mRequestHead.Version() >= NS_HTTP_VERSION_1_1)
- mRequestHead.SetHeaderOnce(nsHttp::Cache_Control, "no-cache", true);
+ if (mRequestHead.Version() >= NS_HTTP_VERSION_1_1) {
+ rv = mRequestHead.SetHeaderOnce(nsHttp::Cache_Control, "no-cache", true);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
+ }
}
else if ((mLoadFlags & VALIDATE_ALWAYS) && !mCacheEntryIsWriteOnly) {
// We need to send 'Cache-Control: max-age=0' to force each cache along
// the path to the origin server to revalidate its own entry, if any,
// with the next cache or server. See bug #84847.
//
// If we're configured to speak HTTP/1.0 then just send 'Pragma: no-cache'
if (mRequestHead.Version() >= NS_HTTP_VERSION_1_1)
- mRequestHead.SetHeaderOnce(nsHttp::Cache_Control, "max-age=0", true);
+ rv = mRequestHead.SetHeaderOnce(nsHttp::Cache_Control, "max-age=0", true);
else
- mRequestHead.SetHeaderOnce(nsHttp::Pragma, "no-cache", true);
+ rv = mRequestHead.SetHeaderOnce(nsHttp::Pragma, "no-cache", true);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
}
if (mResuming) {
char byteRange[32];
SprintfLiteral(byteRange, "bytes=%" PRIu64 "-", mStartPos);
- mRequestHead.SetHeader(nsHttp::Range, nsDependentCString(byteRange));
+ rv = mRequestHead.SetHeader(nsHttp::Range, nsDependentCString(byteRange));
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
if (!mEntityID.IsEmpty()) {
// Also, we want an error if this resource changed in the meantime
// Format of the entity id is: escaped_etag/size/lastmod
nsCString::const_iterator start, end, slash;
mEntityID.BeginReading(start);
mEntityID.EndReading(end);
mEntityID.BeginReading(slash);
if (FindCharInReadable('/', slash, end)) {
nsAutoCString ifMatch;
- mRequestHead.SetHeader(nsHttp::If_Match,
+ rv = mRequestHead.SetHeader(nsHttp::If_Match,
NS_UnescapeURL(Substring(start, slash), 0, ifMatch));
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
++slash; // Incrementing, so that searching for '/' won't find
// the same slash again
}
if (FindCharInReadable('/', slash, end)) {
- mRequestHead.SetHeader(nsHttp::If_Unmodified_Since,
- Substring(++slash, end));
+ rv = mRequestHead.SetHeader(nsHttp::If_Unmodified_Since,
+ Substring(++slash, end));
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
}
}
}
// create wrapper for this channel's notification callbacks
nsCOMPtr<nsIInterfaceRequestor> callbacks;
NS_NewNotificationCallbacksAggregation(mCallbacks, mLoadGroup,
getter_AddRefs(callbacks));
@@ -951,20 +963,22 @@ nsHttpChannel::SetupTransaction()
// See bug #466080. Transfer LOAD_ANONYMOUS flag to socket-layer.
if (mLoadFlags & LOAD_ANONYMOUS)
mCaps |= NS_HTTP_LOAD_ANONYMOUS;
if (mTimingEnabled)
mCaps |= NS_HTTP_TIMING_ENABLED;
if (mUpgradeProtocolCallback) {
- mRequestHead.SetHeader(nsHttp::Upgrade, mUpgradeProtocol, false);
- mRequestHead.SetHeaderOnce(nsHttp::Connection,
- nsHttp::Upgrade.get(),
- true);
+ rv = mRequestHead.SetHeader(nsHttp::Upgrade, mUpgradeProtocol, false);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
+ rv = mRequestHead.SetHeaderOnce(nsHttp::Connection,
+ nsHttp::Upgrade.get(),
+ true);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
mCaps |= NS_HTTP_STICKY_CONNECTION;
mCaps &= ~NS_HTTP_ALLOW_KEEPALIVE;
}
if (mPushedStream) {
mTransaction->SetPushedStream(mPushedStream);
mPushedStream = nullptr;
}
@@ -2623,17 +2637,18 @@ nsHttpChannel::StartRedirectChannelToURI
// Inform consumers about this fake redirect
mRedirectChannel = newChannel;
if (!(flags & nsIChannelEventSink::REDIRECT_STS_UPGRADE) &&
mInterceptCache == INTERCEPTED) {
// Mark the channel as intercepted in order to propagate the response URL.
nsCOMPtr<nsIHttpChannelInternal> httpRedirect = do_QueryInterface(mRedirectChannel);
if (httpRedirect) {
- httpRedirect->ForceIntercepted(mInterceptionID);
+ rv = httpRedirect->ForceIntercepted(mInterceptionID);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
}
}
PushRedirectAsyncFunc(
&nsHttpChannel::ContinueAsyncRedirectChannelToURI);
rv = gHttpHandler->AsyncOnChannelRedirect(this, newChannel, flags);
if (NS_SUCCEEDED(rv))
@@ -2980,28 +2995,34 @@ nsHttpChannel::SetupByteRangeRequest(int
NS_NOTREACHED("no cache validator");
mIsPartialRequest = false;
return NS_ERROR_FAILURE;
}
char buf[64];
SprintfLiteral(buf, "bytes=%" PRId64 "-", partialLen);
- mRequestHead.SetHeader(nsHttp::Range, nsDependentCString(buf));
- mRequestHead.SetHeader(nsHttp::If_Range, val);
+ DebugOnly<nsresult> rv;
+ rv = mRequestHead.SetHeader(nsHttp::Range, nsDependentCString(buf));
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
+ rv = mRequestHead.SetHeader(nsHttp::If_Range, val);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
mIsPartialRequest = true;
return NS_OK;
}
void
nsHttpChannel::UntieByteRangeRequest()
{
- mRequestHead.ClearHeader(nsHttp::Range);
- mRequestHead.ClearHeader(nsHttp::If_Range);
+ DebugOnly<nsresult> rv;
+ rv = mRequestHead.ClearHeader(nsHttp::Range);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
+ rv = mRequestHead.ClearHeader(nsHttp::If_Range);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
}
nsresult
nsHttpChannel::ProcessPartialContent()
{
// ok, we've just received a 206
//
// we need to stream whatever data is in the cache out first, and then
@@ -3667,20 +3688,24 @@ nsHttpChannel::CheckPartial(nsICacheEntr
*aContentLength = responseHead->ContentLength();
return NS_OK;
}
void
nsHttpChannel::UntieValidationRequest()
{
+ DebugOnly<nsresult> rv;
// Make the request unconditional again.
- mRequestHead.ClearHeader(nsHttp::If_Modified_Since);
- mRequestHead.ClearHeader(nsHttp::If_None_Match);
- mRequestHead.ClearHeader(nsHttp::ETag);
+ rv = mRequestHead.ClearHeader(nsHttp::If_Modified_Since);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
+ rv = mRequestHead.ClearHeader(nsHttp::If_None_Match);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
+ rv = mRequestHead.ClearHeader(nsHttp::ETag);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
}
NS_IMETHODIMP
nsHttpChannel::OnCacheEntryCheck(nsICacheEntry* entry, nsIApplicationCache* appCache,
uint32_t* aResult)
{
nsresult rv = NS_OK;
@@ -4039,17 +4064,18 @@ nsHttpChannel::OnCacheEntryCheck(nsICach
// Bug #561276: We maintain a chain of cache-keys which returns cached
// 3xx-responses (redirects) in order to detect cycles. If a cycle is
// found, ignore the cached response and hit the net. Otherwise, use
// the cached response and add the cache-key to the chain. Note that
// a limited number of redirects (cached or not) is allowed and is
// enforced independently of this mechanism
if (!doValidation && isCachedRedirect) {
nsAutoCString cacheKey;
- GenerateCacheKey(mPostID, cacheKey);
+ rv = GenerateCacheKey(mPostID, cacheKey);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
if (!mRedirectedCachekeys)
mRedirectedCachekeys = new nsTArray<nsCString>();
else if (mRedirectedCachekeys->Contains(cacheKey))
doValidation = true;
LOG(("Redirection-chain %s key %s\n",
doValidation ? "contains" : "does not contain", cacheKey.get()));
@@ -4099,23 +4125,27 @@ nsHttpChannel::OnCacheEntryCheck(nsICach
// entry after the writer is done.
wantCompleteEntry = true;
} else {
nsAutoCString val;
// Add If-Modified-Since header if a Last-Modified was given
// and we are allowed to do this (see bugs 510359 and 269303)
if (canAddImsHeader) {
Unused << mCachedResponseHead->GetHeader(nsHttp::Last_Modified, val);
- if (!val.IsEmpty())
- mRequestHead.SetHeader(nsHttp::If_Modified_Since, val);
+ if (!val.IsEmpty()) {
+ rv = mRequestHead.SetHeader(nsHttp::If_Modified_Since, val);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
+ }
}
// Add If-None-Match header if an ETag was given in the response
Unused << mCachedResponseHead->GetHeader(nsHttp::ETag, val);
- if (!val.IsEmpty())
- mRequestHead.SetHeader(nsHttp::If_None_Match, val);
+ if (!val.IsEmpty()) {
+ rv = mRequestHead.SetHeader(nsHttp::If_None_Match, val);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
+ }
mDidReval = true;
}
}
}
if (mCachedContentIsValid || mDidReval) {
rv = OpenCacheInputStream(entry, mCachedContentIsValid, !!appCache);
if (NS_FAILED(rv)) {
@@ -5926,17 +5956,18 @@ nsHttpChannel::BeginConnect()
if (!(mLoadFlags & LOAD_ANONYMOUS) && !mPrivateBrowsing) {
nsAutoCString altUsedLine(mapping->AlternateHost());
bool defaultPort = mapping->AlternatePort() ==
(isHttps ? NS_HTTPS_DEFAULT_PORT : NS_HTTP_DEFAULT_PORT);
if (!defaultPort) {
altUsedLine.AppendLiteral(":");
altUsedLine.AppendInt(mapping->AlternatePort());
}
- mRequestHead.SetHeader(nsHttp::Alternate_Service_Used, altUsedLine);
+ rv = mRequestHead.SetHeader(nsHttp::Alternate_Service_Used, altUsedLine);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
}
nsCOMPtr<nsIConsoleService> consoleService =
do_GetService(NS_CONSOLESERVICE_CONTRACTID);
if (consoleService) {
nsAutoString message(NS_LITERAL_STRING("Alternate Service Mapping found: "));
AppendASCIItoUTF16(scheme.get(), message);
message.Append(NS_LITERAL_STRING("://"));
@@ -8413,19 +8444,21 @@ nsHttpChannel::SetDoNotTrack()
* 'DoNotTrack' header should be added if 'privacy.donottrackheader.enabled'
* is true or tracking protection is enabled. See bug 1258033.
*/
nsCOMPtr<nsILoadContext> loadContext;
NS_QueryNotificationCallbacks(this, loadContext);
if ((loadContext && loadContext->UseTrackingProtection()) ||
nsContentUtils::DoNotTrackEnabled()) {
- mRequestHead.SetHeader(nsHttp::DoNotTrack,
- NS_LITERAL_CSTRING("1"),
- false);
+ DebugOnly<nsresult> rv =
+ mRequestHead.SetHeader(nsHttp::DoNotTrack,
+ NS_LITERAL_CSTRING("1"),
+ false);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
}
}
static const size_t kPositiveBucketNumbers = 34;
static const int64_t positiveBucketLevels[kPositiveBucketNumbers] =
{
0, 10, 20, 30, 40, 50, 60, 70, 80, 90,
100, 200, 300, 400, 500, 600, 700, 800, 900, 1000,
--- a/netwerk/protocol/http/nsHttpConnection.cpp
+++ b/netwerk/protocol/http/nsHttpConnection.cpp
@@ -295,17 +295,18 @@ nsHttpConnection::StartSpdy(uint8_t spdy
mProxyConnectStream = nullptr;
mCompletedProxyConnect = true;
mProxyConnectInProgress = false;
}
bool spdyProxy = mConnInfo->UsingHttpsProxy() && !mTLSFilter;
if (spdyProxy) {
RefPtr<nsHttpConnectionInfo> wildCardProxyCi;
- mConnInfo->CreateWildCard(getter_AddRefs(wildCardProxyCi));
+ rv = mConnInfo->CreateWildCard(getter_AddRefs(wildCardProxyCi));
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
gHttpHandler->ConnMgr()->MoveToWildCardConnEntry(mConnInfo,
wildCardProxyCi, this);
mConnInfo = wildCardProxyCi;
}
if (!mDid0RTTSpdy) {
rv = MoveTransactionsToSpdy(rv, list);
if (NS_FAILED(rv)) {
@@ -680,22 +681,24 @@ nsHttpConnection::SetupSSL()
mNPNComplete = true;
if (!mConnInfo->FirstHopSSL() || mForcePlainText) {
return;
}
// if we are connected to the proxy with TLS, start the TLS
// flow immediately without waiting for a CONNECT sequence.
+ DebugOnly<nsresult> rv;
if (mInSpdyTunnel) {
- InitSSLParams(false, true);
+ rv = InitSSLParams(false, true);
} else {
bool usingHttpsProxy = mConnInfo->UsingHttpsProxy();
- InitSSLParams(usingHttpsProxy, usingHttpsProxy);
+ rv = InitSSLParams(usingHttpsProxy, usingHttpsProxy);
}
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
}
// The naming of NPN is historical - this function creates the basic
// offer list for both NPN and ALPN. ALPN validation callbacks are made
// now before the handshake is complete, and NPN validation callbacks
// are made during the handshake.
nsresult
nsHttpConnection::SetupNPNList(nsISSLSocketControl *ssl, uint32_t caps)
@@ -988,18 +991,20 @@ nsHttpConnection::OnHeadersAvailable(nsA
LOG(("nsHttpConnection::OnHeadersAvailable [this=%p trans=%p response-head=%p]\n",
this, trans, responseHead));
MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
NS_ENSURE_ARG_POINTER(trans);
MOZ_ASSERT(responseHead, "No response head?");
if (mInSpdyTunnel) {
- responseHead->SetHeader(nsHttp::X_Firefox_Spdy_Proxy,
- NS_LITERAL_CSTRING("true"));
+ DebugOnly<nsresult> rv =
+ responseHead->SetHeader(nsHttp::X_Firefox_Spdy_Proxy,
+ NS_LITERAL_CSTRING("true"));
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
}
// we won't change our keep-alive policy unless the server has explicitly
// told us to do so.
// inspect the connection headers for keep-alive info provided the
// transaction completed successfully. In the case of a non-sensical close
// and keep-alive favor the close out of conservatism.
@@ -1858,41 +1863,49 @@ nsHttpConnection::MakeConnectString(nsAH
nsHttpRequestHead *request,
nsACString &result)
{
result.Truncate();
if (!trans->ConnectionInfo()) {
return NS_ERROR_NOT_INITIALIZED;
}
- nsHttpHandler::GenerateHostPort(
- nsDependentCString(trans->ConnectionInfo()->Origin()),
- trans->ConnectionInfo()->OriginPort(), result);
+ DebugOnly<nsresult> rv;
+
+ rv = nsHttpHandler::GenerateHostPort(
+ nsDependentCString(trans->ConnectionInfo()->Origin()),
+ trans->ConnectionInfo()->OriginPort(), result);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
// CONNECT host:port HTTP/1.1
request->SetMethod(NS_LITERAL_CSTRING("CONNECT"));
request->SetVersion(gHttpHandler->HttpVersion());
request->SetRequestURI(result);
- request->SetHeader(nsHttp::User_Agent, gHttpHandler->UserAgent());
+ rv = request->SetHeader(nsHttp::User_Agent, gHttpHandler->UserAgent());
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
// a CONNECT is always persistent
- request->SetHeader(nsHttp::Proxy_Connection, NS_LITERAL_CSTRING("keep-alive"));
- request->SetHeader(nsHttp::Connection, NS_LITERAL_CSTRING("keep-alive"));
+ rv = request->SetHeader(nsHttp::Proxy_Connection, NS_LITERAL_CSTRING("keep-alive"));
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
+ rv = request->SetHeader(nsHttp::Connection, NS_LITERAL_CSTRING("keep-alive"));
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
// all HTTP/1.1 requests must include a Host header (even though it
// may seem redundant in this case; see bug 82388).
- request->SetHeader(nsHttp::Host, result);
+ rv = request->SetHeader(nsHttp::Host, result);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
nsAutoCString val;
if (NS_SUCCEEDED(trans->RequestHead()->GetHeader(
nsHttp::Proxy_Authorization,
val))) {
// we don't know for sure if this authorization is intended for the
// SSL proxy, so we add it just in case.
- request->SetHeader(nsHttp::Proxy_Authorization, val);
+ rv = request->SetHeader(nsHttp::Proxy_Authorization, val);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
}
result.Truncate();
request->Flatten(result, false);
result.AppendLiteral("\r\n");
return NS_OK;
}
--- a/netwerk/protocol/http/nsHttpConnectionMgr.cpp
+++ b/netwerk/protocol/http/nsHttpConnectionMgr.cpp
@@ -2517,17 +2517,18 @@ nsHttpConnectionMgr::GetOrCreateConnecti
if (!specificCI->UsingHttpsProxy()) {
prohibitWildCard = true;
}
// step 2
if (!prohibitWildCard) {
RefPtr<nsHttpConnectionInfo> wildCardProxyCI;
- specificCI->CreateWildCard(getter_AddRefs(wildCardProxyCI));
+ DebugOnly<nsresult> rv = specificCI->CreateWildCard(getter_AddRefs(wildCardProxyCI));
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
nsConnectionEntry *wildCardEnt = mCT.Get(wildCardProxyCI->HashKey());
if (wildCardEnt && wildCardEnt->AvailableForDispatchNow()) {
return wildCardEnt;
}
}
// step 3
if (!specificEnt) {
@@ -2595,17 +2596,20 @@ nsHttpConnectionMgr::OnMsgSpeculativeCon
}
bool keepAlive = args->mTrans->Caps() & NS_HTTP_ALLOW_KEEPALIVE;
if (mNumHalfOpenConns < parallelSpeculativeConnectLimit &&
((ignoreIdle && (ent->mIdleConns.Length() < parallelSpeculativeConnectLimit)) ||
!ent->mIdleConns.Length()) &&
!(keepAlive && RestrictConnections(ent)) &&
!AtActiveConnectionLimit(ent, args->mTrans->Caps())) {
- CreateTransport(ent, args->mTrans, args->mTrans->Caps(), true, isFromPredictor, allow1918);
+ DebugOnly<nsresult> rv = CreateTransport(ent, args->mTrans,
+ args->mTrans->Caps(), true,
+ isFromPredictor, allow1918);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
} else {
LOG(("OnMsgSpeculativeConnect Transport "
"not created due to existing connection count\n"));
}
}
bool
ConnectionHandle::IsPersistent()
@@ -2952,17 +2956,18 @@ nsHttpConnectionMgr::nsHalfOpenSocket::D
NS_IMETHODIMP // method for nsITimerCallback
nsHttpConnectionMgr::nsHalfOpenSocket::Notify(nsITimer *timer)
{
MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
MOZ_ASSERT(timer == mSynTimer, "wrong timer");
MOZ_ASSERT(mTransaction && !mTransaction->IsNullTransaction(),
"null transactions dont have backup streams");
- SetupBackupStreams();
+ DebugOnly<nsresult> rv = SetupBackupStreams();
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
mSynTimer = nullptr;
return NS_OK;
}
// method for nsIAsyncOutputStreamCallback
NS_IMETHODIMP
nsHttpConnectionMgr::
--- a/netwerk/protocol/http/nsHttpDigestAuth.cpp
+++ b/netwerk/protocol/http/nsHttpDigestAuth.cpp
@@ -498,17 +498,18 @@ nsHttpDigestAuth::CalculateHA1(const nsA
nsresult rv;
rv = MD5Hash(contents.get(), contents.Length());
if (NS_FAILED(rv))
return rv;
if (algorithm & ALGO_MD5_SESS) {
char part1[EXPANDED_DIGEST_LENGTH+1];
- ExpandToHex(mHashBuf, part1);
+ rv = ExpandToHex(mHashBuf, part1);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
contents.Assign(part1, EXPANDED_DIGEST_LENGTH);
contents.Append(':');
contents.Append(nonce);
contents.Append(':');
contents.Append(cnonce);
rv = MD5Hash(contents.get(), contents.Length());
--- a/netwerk/protocol/http/nsHttpHandler.cpp
+++ b/netwerk/protocol/http/nsHttpHandler.cpp
@@ -1183,35 +1183,39 @@ nsHttpHandler::PrefsChanged(nsIPrefBranc
if (NS_SUCCEEDED(rv))
mQoSBits = (uint8_t) clamped(val, 0, 0xff);
}
if (PREF_CHANGED(HTTP_PREF("accept.default"))) {
nsXPIDLCString accept;
rv = prefs->GetCharPref(HTTP_PREF("accept.default"),
getter_Copies(accept));
- if (NS_SUCCEEDED(rv))
- SetAccept(accept);
+ if (NS_SUCCEEDED(rv)) {
+ rv = SetAccept(accept);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
+ }
}
if (PREF_CHANGED(HTTP_PREF("accept-encoding"))) {
nsXPIDLCString acceptEncodings;
rv = prefs->GetCharPref(HTTP_PREF("accept-encoding"),
getter_Copies(acceptEncodings));
if (NS_SUCCEEDED(rv)) {
- SetAcceptEncodings(acceptEncodings, false);
+ rv = SetAcceptEncodings(acceptEncodings, false);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
}
}
if (PREF_CHANGED(HTTP_PREF("accept-encoding.secure"))) {
nsXPIDLCString acceptEncodings;
rv = prefs->GetCharPref(HTTP_PREF("accept-encoding.secure"),
getter_Copies(acceptEncodings));
if (NS_SUCCEEDED(rv)) {
- SetAcceptEncodings(acceptEncodings, true);
+ rv = SetAcceptEncodings(acceptEncodings, true);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
}
}
if (PREF_CHANGED(HTTP_PREF("default-socket-type"))) {
nsXPIDLCString sval;
rv = prefs->GetCharPref(HTTP_PREF("default-socket-type"),
getter_Copies(sval));
if (NS_SUCCEEDED(rv)) {
@@ -1432,18 +1436,20 @@ nsHttpHandler::PrefsChanged(nsIPrefBranc
if (PREF_CHANGED(INTL_ACCEPT_LANGUAGES)) {
nsCOMPtr<nsIPrefLocalizedString> pls;
prefs->GetComplexValue(INTL_ACCEPT_LANGUAGES,
NS_GET_IID(nsIPrefLocalizedString),
getter_AddRefs(pls));
if (pls) {
nsXPIDLString uval;
pls->ToString(getter_Copies(uval));
- if (uval)
- SetAcceptLanguages(NS_ConvertUTF16toUTF8(uval).get());
+ if (uval) {
+ rv = SetAcceptLanguages(NS_ConvertUTF16toUTF8(uval).get());
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
+ }
}
}
//
// Tracking options
//
if (PREF_CHANGED(DONOTTRACK_HEADER_ENABLED)) {
@@ -2025,16 +2031,17 @@ nsHttpHandler::GetMisc(nsACString &value
NS_IMETHODIMP
nsHttpHandler::Observe(nsISupports *subject,
const char *topic,
const char16_t *data)
{
MOZ_ASSERT(NS_IsMainThread());
LOG(("nsHttpHandler::Observe [topic=\"%s\"]\n", topic));
+ nsresult rv;
if (!strcmp(topic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID)) {
nsCOMPtr<nsIPrefBranch> prefBranch = do_QueryInterface(subject);
if (prefBranch)
PrefsChanged(prefBranch, NS_ConvertUTF16toUTF8(data).get());
} else if (!strcmp(topic, "profile-change-net-teardown") ||
!strcmp(topic, NS_XPCOM_SHUTDOWN_OBSERVER_ID) ) {
mHandlerActive = false;
@@ -2056,17 +2063,18 @@ nsHttpHandler::Observe(nsISupports *subj
if (!mDoNotTrackEnabled) {
Telemetry::Accumulate(Telemetry::DNT_USAGE, 2);
} else {
Telemetry::Accumulate(Telemetry::DNT_USAGE, 1);
}
} else if (!strcmp(topic, "profile-change-net-restore")) {
// initialize connection manager
- InitConnectionMgr();
+ rv = InitConnectionMgr();
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
} else if (!strcmp(topic, "net:clear-active-logins")) {
Unused << mAuthCache.ClearAll();
Unused << mPrivateAuthCache.ClearAll();
} else if (!strcmp(topic, "net:prune-dead-connections")) {
if (mConnMgr) {
rv = mConnMgr->PruneDeadConnections();
if (NS_FAILED(rv)) {
LOG((" PruneDeadConnections failed (%08x)\n",
--- a/netwerk/protocol/http/nsHttpRequestHead.cpp
+++ b/netwerk/protocol/http/nsHttpRequestHead.cpp
@@ -259,17 +259,18 @@ nsHttpRequestHead::ParseHeaderSet(const
if (!eof) {
break;
}
if (NS_SUCCEEDED(nsHttpHeaderArray::ParseHeaderLine(
nsDependentCSubstring(buffer, eof - buffer),
&hdr,
&val))) {
- mHeaders.SetHeaderFromNet(hdr, val, false);
+ DebugOnly<nsresult> rv = mHeaders.SetHeaderFromNet(hdr, val, false);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
}
buffer = eof + 1;
if (*buffer == '\n') {
buffer++;
}
}
}
--- a/netwerk/protocol/http/nsHttpResponseHead.cpp
+++ b/netwerk/protocol/http/nsHttpResponseHead.cpp
@@ -223,21 +223,24 @@ nsHttpResponseHead::SetContentCharset(co
void
nsHttpResponseHead::SetContentLength(int64_t len)
{
ReentrantMonitorAutoEnter monitor(mReentrantMonitor);
mContentLength = len;
if (len < 0)
mHeaders.ClearHeader(nsHttp::Content_Length);
- else
- mHeaders.SetHeader(nsHttp::Content_Length,
- nsPrintfCString("%" PRId64, len),
- false,
- nsHttpHeaderArray::eVarietyResponse);
+ else {
+ DebugOnly<nsresult> rv =
+ mHeaders.SetHeader(nsHttp::Content_Length,
+ nsPrintfCString("%" PRId64, len),
+ false,
+ nsHttpHeaderArray::eVarietyResponse);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
+ }
}
void
nsHttpResponseHead::Flatten(nsACString &buf, bool pruneTransients)
{
ReentrantMonitorAutoEnter monitor(mReentrantMonitor);
if (mVersion == NS_HTTP_VERSION_0_9)
return;
@@ -886,17 +889,18 @@ nsHttpResponseHead::UpdateHeaders(nsHttp
// on 304 responses
header == nsHttp::Content_Length) {
LOG(("ignoring response header [%s: %s]\n", header.get(), val));
}
else {
LOG(("new response header [%s: %s]\n", header.get(), val));
// overwrite the current header value with the new value...
- SetHeader_locked(header, nsDependentCString(val));
+ DebugOnly<nsresult> rv = SetHeader_locked(header, nsDependentCString(val));
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
}
}
return NS_OK;
}
void
nsHttpResponseHead::Reset()
--- a/netwerk/protocol/http/nsHttpTransaction.cpp
+++ b/netwerk/protocol/http/nsHttpTransaction.cpp
@@ -219,17 +219,18 @@ nsHttpTransaction::Init(uint32_t caps,
nsCOMPtr<nsIHttpChannelInternal> httpChannelInternal =
do_QueryInterface(eventsink);
if (httpChannelInternal) {
rv = httpChannelInternal->GetResponseTimeoutEnabled(
&mResponseTimeoutEnabled);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
- httpChannelInternal->GetInitialRwin(&mInitialRwin);
+ rv = httpChannelInternal->GetInitialRwin(&mInitialRwin);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
}
// create transport event sink proxy. it coalesces consecutive
// events of the same status type.
rv = net_NewTransportEventSinkProxy(getter_AddRefs(mTransportSink),
eventsink, target);
if (NS_FAILED(rv)) return rv;
@@ -252,17 +253,18 @@ nsHttpTransaction::Init(uint32_t caps,
// Content-Length header field.
//
// RFC2616 section 4.4:
// For compatibility with HTTP/1.0 applications, HTTP/1.1 requests
// containing a message-body MUST include a valid Content-Length header
// field unless the server is known to be HTTP/1.1 compliant.
if ((requestHead->IsPost() || requestHead->IsPut()) &&
!requestBody && !requestHead->HasHeader(nsHttp::Transfer_Encoding)) {
- requestHead->SetHeader(nsHttp::Content_Length, NS_LITERAL_CSTRING("0"));
+ rv = requestHead->SetHeader(nsHttp::Content_Length, NS_LITERAL_CSTRING("0"));
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
}
// grab a weak reference to the request head
mRequestHead = requestHead;
// make sure we eliminate any proxy specific headers from
// the request if we are using CONNECT
bool pruneProxyHeaders = cinfo->UsingConnect();
@@ -1161,17 +1163,20 @@ nsHttpTransaction::Restart()
mReuseOnRestart = false;
if (!mConnInfo->GetRoutedHost().IsEmpty()) {
MutexAutoLock lock(*nsHttp::GetLock());
RefPtr<nsHttpConnectionInfo> ci;
mConnInfo->CloneAsDirectRoute(getter_AddRefs(ci));
mConnInfo = ci;
if (mRequestHead) {
- mRequestHead->SetHeader(nsHttp::Alternate_Service_Used, NS_LITERAL_CSTRING("0"));
+ DebugOnly<nsresult> rv =
+ mRequestHead->SetHeader(nsHttp::Alternate_Service_Used,
+ NS_LITERAL_CSTRING("0"));
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
}
}
mTransportStatus = NS_OK;
return gHttpHandler->InitiateTransaction(this, mPriority);
}
--- a/netwerk/protocol/websocket/IPCTransportProvider.cpp
+++ b/netwerk/protocol/websocket/IPCTransportProvider.cpp
@@ -61,17 +61,20 @@ TransportProviderParent::OnTransportAvai
void
TransportProviderParent::MaybeNotify()
{
if (!mListener || !mTransport) {
return;
}
- mListener->OnTransportAvailable(mTransport, mSocketIn, mSocketOut);
+ DebugOnly<nsresult> rv = mListener->OnTransportAvailable(mTransport,
+ mSocketIn,
+ mSocketOut);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
}
NS_IMPL_ISUPPORTS(TransportProviderChild,
nsITransportProvider)
TransportProviderChild::TransportProviderChild()
{
--- a/netwerk/protocol/websocket/WebSocketChannel.cpp
+++ b/netwerk/protocol/websocket/WebSocketChannel.cpp
@@ -2809,46 +2809,54 @@ WebSocketChannel::SetupRequest()
cos->AddClassFlags(nsIClassOfService::Unblocked);
}
// draft-ietf-hybi-thewebsocketprotocol-07 illustrates Upgrade: websocket
// in lower case, so go with that. It is technically case insensitive.
rv = mChannel->HTTPUpgrade(NS_LITERAL_CSTRING("websocket"), this);
NS_ENSURE_SUCCESS(rv, rv);
- mHttpChannel->SetRequestHeader(
+ rv = mHttpChannel->SetRequestHeader(
NS_LITERAL_CSTRING("Sec-WebSocket-Version"),
NS_LITERAL_CSTRING(SEC_WEBSOCKET_VERSION), false);
-
- if (!mOrigin.IsEmpty())
- mHttpChannel->SetRequestHeader(NS_LITERAL_CSTRING("Origin"), mOrigin,
- false);
-
- if (!mProtocol.IsEmpty())
- mHttpChannel->SetRequestHeader(NS_LITERAL_CSTRING("Sec-WebSocket-Protocol"),
- mProtocol, true);
-
- if (mAllowPMCE)
- mHttpChannel->SetRequestHeader(NS_LITERAL_CSTRING("Sec-WebSocket-Extensions"),
- NS_LITERAL_CSTRING("permessage-deflate"),
- false);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
+
+ if (!mOrigin.IsEmpty()) {
+ rv = mHttpChannel->SetRequestHeader(NS_LITERAL_CSTRING("Origin"), mOrigin,
+ false);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
+ }
+
+ if (!mProtocol.IsEmpty()) {
+ rv = mHttpChannel->SetRequestHeader(
+ NS_LITERAL_CSTRING("Sec-WebSocket-Protocol"), mProtocol, true);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
+ }
+
+ if (mAllowPMCE) {
+ rv = mHttpChannel->SetRequestHeader(
+ NS_LITERAL_CSTRING("Sec-WebSocket-Extensions"),
+ NS_LITERAL_CSTRING("permessage-deflate"), false);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
+ }
uint8_t *secKey;
nsAutoCString secKeyString;
rv = mRandomGenerator->GenerateRandomBytes(16, &secKey);
NS_ENSURE_SUCCESS(rv, rv);
char* b64 = PL_Base64Encode((const char *)secKey, 16, nullptr);
free(secKey);
if (!b64)
return NS_ERROR_OUT_OF_MEMORY;
secKeyString.Assign(b64);
PR_Free(b64);
- mHttpChannel->SetRequestHeader(NS_LITERAL_CSTRING("Sec-WebSocket-Key"),
- secKeyString, false);
+ rv = mHttpChannel->SetRequestHeader(NS_LITERAL_CSTRING("Sec-WebSocket-Key"),
+ secKeyString, false);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
LOG(("WebSocketChannel::SetupRequest: client key %s\n", secKeyString.get()));
// prepare the value we expect to see in
// the sec-websocket-accept response header
rv = CalculateWebSocketHashedSecret(secKeyString, mHashedSecret);
NS_ENSURE_SUCCESS(rv, rv);
LOG(("WebSocketChannel::SetupRequest: expected server key %s\n",
mHashedSecret.get()));
--- a/netwerk/streamconv/converters/nsMultiMixedConv.cpp
+++ b/netwerk/streamconv/converters/nsMultiMixedConv.cpp
@@ -1013,17 +1013,18 @@ nsMultiMixedConv::ProcessHeader()
case HEADER_CONTENT_DISPOSITION:
mContentDisposition = mResponseHeaderValue;
mContentDisposition.CompressWhitespace();
break;
case HEADER_SET_COOKIE: {
nsCOMPtr<nsIHttpChannelInternal> httpInternal = do_QueryInterface(mChannel);
mResponseHeaderValue.CompressWhitespace();
if (httpInternal) {
- httpInternal->SetCookie(mResponseHeaderValue.get());
+ DebugOnly<nsresult> rv = httpInternal->SetCookie(mResponseHeaderValue.get());
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
}
break;
}
case HEADER_RANGE:
case HEADER_CONTENT_RANGE: {
if (!p.CheckWord("bytes") ||
!p.CheckWhite()) {
return NS_ERROR_CORRUPTED_CONTENT;