Bug 1310127 - Part 3: Use MOZ_MUST_USE in netwerk/protocol/http r=mcmanus

Add assertions.

MozReview-Commit-ID: DPvgKzVr3ip

--HG--
extra : rebase_source : a96d658c8b76180fe5a904106de9a68de16e0383
This commit is contained in:
Wei-Cheng Pan 2017-01-12 17:48:45 +08:00
Родитель 7aa068fbb7
Коммит 03ca0df8a1
21 изменённых файлов: 290 добавлений и 152 удалений

Просмотреть файл

@ -848,7 +848,8 @@ NS_NewStreamLoaderInternal(nsIStreamLoader **outStream,
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);

Просмотреть файл

@ -477,7 +477,8 @@ FTPChannelParent::OnStartRequest(nsIRequest* aRequest, nsISupports* aContext)
}
nsCOMPtr<nsIHttpChannelInternal> httpChan = do_QueryInterface(aRequest);
if (httpChan) {
httpChan->GetLastModifiedTime(&lastModified);
DebugOnly<nsresult> rv = httpChan->GetLastModifiedTime(&lastModified);
MOZ_ASSERT(NS_SUCCEEDED(rv));
}
URIParams uriparam;

Просмотреть файл

@ -1085,7 +1085,8 @@ Http2Session::CleanupStream(Http2Stream *aStream, nsresult aResult,
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;
@ -1229,13 +1230,13 @@ Http2Session::RecvHeaders(Http2Session *self)
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();
@ -1464,7 +1465,8 @@ Http2Session::RecvRstStream(Http2Session *self)
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();
@ -2073,7 +2075,8 @@ Http2Session::RecvContinuation(Http2Session *self)
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.",
@ -3558,7 +3561,8 @@ Http2Session::CreateTunnel(nsHttpTransaction *trans,
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);

Просмотреть файл

@ -134,7 +134,8 @@ public:
{
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;
}
@ -3225,33 +3226,40 @@ HttpBaseChannel::SetupReplacementChannel(nsIURI *newURI,
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"),
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);
@ -3261,15 +3269,20 @@ HttpBaseChannel::SetupReplacementChannel(nsIURI *newURI,
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.
@ -3277,29 +3290,35 @@ HttpBaseChannel::SetupReplacementChannel(nsIURI *newURI,
// 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
@ -3376,7 +3395,8 @@ HttpBaseChannel::SetupReplacementChannel(nsIURI *newURI,
// 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.

Просмотреть файл

@ -1266,7 +1266,8 @@ 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();
}
@ -1361,7 +1362,7 @@ HttpChannelChild::SetupRedirect(nsIURI* uri,
// 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) &&
@ -1371,8 +1372,9 @@ HttpChannelChild::SetupRedirect(nsIURI* uri,
// 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);
@ -1409,7 +1411,8 @@ HttpChannelChild::Redirect1Begin(const uint32_t& registrarId,
// 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);
}
@ -1456,7 +1459,8 @@ void
HttpChannelChild::OverrideSecurityInfoForNonIPCRedirect(nsISupports* securityInfo)
{
mResponseCouldBeSynthesized = true;
OverrideSecurityInfo(securityInfo);
DebugOnly<nsresult> rv = OverrideSecurityInfo(securityInfo);
MOZ_ASSERT(NS_SUCCEEDED(rv));
}
class Redirect3Event : public ChannelEvent
@ -1761,9 +1765,11 @@ HttpChannelChild::OnRedirectVerifyCallback(nsresult result)
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);
}
@ -1792,8 +1798,10 @@ HttpChannelChild::OnRedirectVerifyCallback(nsresult result)
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);
}
@ -1983,7 +1991,8 @@ HttpChannelChild::AsyncOpen(nsIStreamListener *listener, nsISupports *aContext)
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
@ -2879,7 +2888,8 @@ HttpChannelChild::OverrideWithSynthesizedResponse(nsAutoPtr<nsHttpResponseHead>&
// 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;
}

Просмотреть файл

@ -393,12 +393,16 @@ HttpChannelParent::DoAsyncOpen( const URIParams& aURI,
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);
@ -491,7 +495,8 @@ HttpChannelParent::DoAsyncOpen( const URIParams& aURI,
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;
@ -730,17 +735,20 @@ HttpChannelParent::RecvRedirect2Verify(const nsresult& result,
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,
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.
@ -766,7 +774,8 @@ HttpChannelParent::RecvRedirect2Verify(const nsresult& result,
}
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);

Просмотреть файл

@ -329,8 +329,10 @@ HttpChannelParentListener::ChannelIntercepted(nsIInterceptedChannel* aChannel)
mSynthesizedResponseHead->StatusText(statusText);
aChannel->SynthesizeStatus(mSynthesizedResponseHead->Status(), statusText);
nsCOMPtr<nsIHttpHeaderVisitor> visitor = new HeaderVisitor(aChannel);
DebugOnly<nsresult> rv =
mSynthesizedResponseHead->VisitHeaders(visitor,
nsHttpHeaderArray::eFilterResponse);
MOZ_ASSERT(NS_SUCCEEDED(rv));
nsCOMPtr<nsIRunnable> event = new FinishSynthesizedResponse(aChannel);
NS_DispatchToCurrentThread(event);

Просмотреть файл

@ -64,7 +64,8 @@ public:
}
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,
@ -244,7 +245,8 @@ NullHttpTransaction::RequestHead()
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;

Просмотреть файл

@ -440,7 +440,8 @@ TLSFilterTransaction::Notify(nsITimer *timer)
if (timer != mTimer) {
return NS_ERROR_UNEXPECTED;
}
StartTimerCallback();
DebugOnly<nsresult> rv = StartTimerCallback();
MOZ_ASSERT(NS_SUCCEEDED(rv));
return NS_OK;
}
@ -963,7 +964,9 @@ SpdyConnectTransaction::SpdyConnectTransaction(nsHttpConnectionInfo *ci,
mTimestampSyn = TimeStamp::Now();
mRequestHead = new nsHttpRequestHead();
DebugOnly<nsresult> rv =
nsHttpConnection::MakeConnectString(trans, mRequestHead, mConnectString);
MOZ_ASSERT(NS_SUCCEEDED(rv));
mDrivingTransaction = trans;
}
@ -1011,12 +1014,14 @@ SpdyConnectTransaction::MapStreamToHttpConnection(nsISocketTransport *aTransport
mTunneledConn->SetTransactionCaps(Caps());
MOZ_ASSERT(aConnInfo->UsingHttpsProxy());
TimeDuration rtt = TimeStamp::Now() - mTimestampSyn;
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 {

Просмотреть файл

@ -65,8 +65,10 @@ nsHttpAuthCache::nsHttpAuthCache()
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");

Просмотреть файл

@ -301,8 +301,10 @@ 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();
}
@ -659,11 +661,13 @@ nsHttpChannel::HandleAsyncRedirect()
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));
}
}
@ -757,7 +761,8 @@ nsHttpChannel::HandleAsyncFallback()
PopRedirectAsyncFunc(&nsHttpChannel::ContinueHandleAsyncFallback);
}
ContinueHandleAsyncFallback(rv);
rv = ContinueHandleAsyncFallback(rv);
MOZ_ASSERT(NS_SUCCEEDED(rv));
}
nsresult
@ -890,11 +895,14 @@ nsHttpChannel::SetupTransaction()
// 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
@ -903,15 +911,17 @@ nsHttpChannel::SetupTransaction()
//
// 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
@ -923,16 +933,18 @@ nsHttpChannel::SetupTransaction()
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,
rv = mRequestHead.SetHeader(nsHttp::If_Unmodified_Since,
Substring(++slash, end));
MOZ_ASSERT(NS_SUCCEEDED(rv));
}
}
}
@ -956,10 +968,12 @@ nsHttpChannel::SetupTransaction()
mCaps |= NS_HTTP_TIMING_ENABLED;
if (mUpgradeProtocolCallback) {
mRequestHead.SetHeader(nsHttp::Upgrade, mUpgradeProtocol, false);
mRequestHead.SetHeaderOnce(nsHttp::Connection,
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;
}
@ -2623,7 +2637,8 @@ nsHttpChannel::StartRedirectChannelToURI(nsIURI *upgradedURI, uint32_t flags)
// 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));
}
}
@ -2980,8 +2995,11 @@ nsHttpChannel::SetupByteRangeRequest(int64_t partialLen)
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;
@ -2990,8 +3008,11 @@ nsHttpChannel::SetupByteRangeRequest(int64_t partialLen)
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
@ -3667,10 +3688,14 @@ nsHttpChannel::CheckPartial(nsICacheEntry* aEntry, int64_t *aSize, int64_t *aCon
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
@ -4039,7 +4064,8 @@ nsHttpChannel::OnCacheEntryCheck(nsICacheEntry* entry, nsIApplicationCache* appC
// 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>();
@ -4099,13 +4125,17 @@ nsHttpChannel::OnCacheEntryCheck(nsICacheEntry* entry, nsIApplicationCache* appC
// 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;
}
}
@ -5926,7 +5956,8 @@ nsHttpChannel::BeginConnect()
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 =
@ -8414,9 +8445,11 @@ nsHttpChannel::SetDoNotTrack()
if ((loadContext && loadContext->UseTrackingProtection()) ||
nsContentUtils::DoNotTrackEnabled()) {
DebugOnly<nsresult> rv =
mRequestHead.SetHeader(nsHttp::DoNotTrack,
NS_LITERAL_CSTRING("1"),
false);
MOZ_ASSERT(NS_SUCCEEDED(rv));
}
}

Просмотреть файл

@ -300,7 +300,8 @@ nsHttpConnection::StartSpdy(uint8_t spdyVersion)
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;
@ -685,12 +686,14 @@ nsHttpConnection::SetupSSL()
// 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
@ -993,8 +996,10 @@ nsHttpConnection::OnHeadersAvailable(nsAHttpTransaction *trans,
MOZ_ASSERT(responseHead, "No response head?");
if (mInSpdyTunnel) {
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
@ -1863,23 +1868,30 @@ nsHttpConnection::MakeConnectString(nsAHttpTransaction *trans,
return NS_ERROR_NOT_INITIALIZED;
}
nsHttpHandler::GenerateHostPort(
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(
@ -1887,7 +1899,8 @@ nsHttpConnection::MakeConnectString(nsAHttpTransaction *trans,
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();

Просмотреть файл

@ -2522,7 +2522,8 @@ nsHttpConnectionMgr::GetOrCreateConnectionEntry(nsHttpConnectionInfo *specificCI
// 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;
@ -2600,7 +2601,10 @@ nsHttpConnectionMgr::OnMsgSpeculativeConnect(int32_t, ARefBase *param)
!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"));
@ -2957,7 +2961,8 @@ nsHttpConnectionMgr::nsHalfOpenSocket::Notify(nsITimer *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;

Просмотреть файл

@ -503,7 +503,8 @@ nsHttpDigestAuth::CalculateHA1(const nsAFlatCString & username,
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(':');

Просмотреть файл

@ -1186,8 +1186,10 @@ nsHttpHandler::PrefsChanged(nsIPrefBranch *prefs, const char *pref)
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"))) {
@ -1195,7 +1197,8 @@ nsHttpHandler::PrefsChanged(nsIPrefBranch *prefs, const char *pref)
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));
}
}
@ -1204,7 +1207,8 @@ nsHttpHandler::PrefsChanged(nsIPrefBranch *prefs, const char *pref)
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));
}
}
@ -1435,8 +1439,10 @@ nsHttpHandler::PrefsChanged(nsIPrefBranch *prefs, const char *pref)
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));
}
}
}
@ -2015,6 +2021,7 @@ nsHttpHandler::Observe(nsISupports *subject,
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)
@ -2046,7 +2053,8 @@ nsHttpHandler::Observe(nsISupports *subject,
}
} 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();

Просмотреть файл

@ -264,7 +264,8 @@ nsHttpRequestHead::ParseHeaderSet(const char *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') {

Просмотреть файл

@ -228,11 +228,14 @@ nsHttpResponseHead::SetContentLength(int64_t len)
mContentLength = len;
if (len < 0)
mHeaders.ClearHeader(nsHttp::Content_Length);
else
else {
DebugOnly<nsresult> rv =
mHeaders.SetHeader(nsHttp::Content_Length,
nsPrintfCString("%" PRId64, len),
false,
nsHttpHeaderArray::eVarietyResponse);
MOZ_ASSERT(NS_SUCCEEDED(rv));
}
}
void
@ -891,7 +894,8 @@ nsHttpResponseHead::UpdateHeaders(nsHttpResponseHead *aOther)
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));
}
}

Просмотреть файл

@ -224,7 +224,8 @@ nsHttpTransaction::Init(uint32_t caps,
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
@ -257,7 +258,8 @@ nsHttpTransaction::Init(uint32_t caps,
// 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
@ -1166,7 +1168,10 @@ nsHttpTransaction::Restart()
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));
}
}

Просмотреть файл

@ -66,7 +66,10 @@ TransportProviderParent::MaybeNotify()
return;
}
mListener->OnTransportAvailable(mTransport, mSocketIn, mSocketOut);
DebugOnly<nsresult> rv = mListener->OnTransportAvailable(mTransport,
mSocketIn,
mSocketOut);
MOZ_ASSERT(NS_SUCCEEDED(rv));
}

Просмотреть файл

@ -2814,22 +2814,29 @@ WebSocketChannel::SetupRequest()
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);
MOZ_ASSERT(NS_SUCCEEDED(rv));
if (!mOrigin.IsEmpty())
mHttpChannel->SetRequestHeader(NS_LITERAL_CSTRING("Origin"), mOrigin,
if (!mOrigin.IsEmpty()) {
rv = mHttpChannel->SetRequestHeader(NS_LITERAL_CSTRING("Origin"), mOrigin,
false);
MOZ_ASSERT(NS_SUCCEEDED(rv));
}
if (!mProtocol.IsEmpty())
mHttpChannel->SetRequestHeader(NS_LITERAL_CSTRING("Sec-WebSocket-Protocol"),
mProtocol, true);
if (!mProtocol.IsEmpty()) {
rv = mHttpChannel->SetRequestHeader(
NS_LITERAL_CSTRING("Sec-WebSocket-Protocol"), mProtocol, true);
MOZ_ASSERT(NS_SUCCEEDED(rv));
}
if (mAllowPMCE)
mHttpChannel->SetRequestHeader(NS_LITERAL_CSTRING("Sec-WebSocket-Extensions"),
NS_LITERAL_CSTRING("permessage-deflate"),
false);
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;
@ -2842,8 +2849,9 @@ WebSocketChannel::SetupRequest()
return NS_ERROR_OUT_OF_MEMORY;
secKeyString.Assign(b64);
PR_Free(b64);
mHttpChannel->SetRequestHeader(NS_LITERAL_CSTRING("Sec-WebSocket-Key"),
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

Просмотреть файл

@ -1018,7 +1018,8 @@ nsMultiMixedConv::ProcessHeader()
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;
}