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

This patch contains some changes that may alter control flows.

MozReview-Commit-ID: Kcc2DWJZ8L5

--HG--
extra : rebase_source : ddb068f7c038f6f0ad75efda941dd6b8da8b949a
This commit is contained in:
Wei-Cheng Pan 2016-12-28 14:43:47 +08:00
Родитель 03ca0df8a1
Коммит ab2969cfa1
12 изменённых файлов: 47 добавлений и 26 удалений

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

@ -1369,7 +1369,8 @@ Predictor::Prefetch(nsIURI *uri, nsIURI *referrer,
return NS_ERROR_UNEXPECTED;
}
httpChannel->SetReferrer(referrer);
rv = httpChannel->SetReferrer(referrer);
NS_ENSURE_SUCCESS(rv, rv);
// XXX - set a header here to indicate this is a prefetch?
nsCOMPtr<nsIStreamListener> listener = new PrefetchListener(verifier, uri,

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

@ -271,8 +271,8 @@ nsAsyncRedirectVerifyHelper::IsOldChannelCanceled()
nsCOMPtr<nsIHttpChannelInternal> oldChannelInternal =
do_QueryInterface(mOldChan);
if (oldChannelInternal) {
oldChannelInternal->GetCanceled(&canceled);
if (canceled) {
nsresult rv = oldChannelInternal->GetCanceled(&canceled);
if (NS_SUCCEEDED(rv) && canceled) {
return true;
}
} else if (mOldChan) {

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

@ -416,7 +416,11 @@ Http2Stream::ParseHttpRequestHeaders(const char *buf,
nsAutoCString authorityHeader;
nsAutoCString hashkey;
head->GetHeader(nsHttp::Host, authorityHeader);
nsresult rv = head->GetHeader(nsHttp::Host, authorityHeader);
if (NS_FAILED(rv)) {
MOZ_ASSERT(false);
return rv;
}
nsAutoCString requestURI;
head->RequestURI(requestURI);
@ -516,7 +520,11 @@ Http2Stream::GenerateOpen()
nsCString compressedData;
nsAutoCString authorityHeader;
head->GetHeader(nsHttp::Host, authorityHeader);
nsresult rv = head->GetHeader(nsHttp::Host, authorityHeader);
if (NS_FAILED(rv)) {
MOZ_ASSERT(false);
return rv;
}
nsDependentCString scheme(head->IsHTTPS() ? "https" : "http");
if (head->IsConnect()) {
@ -540,13 +548,14 @@ Http2Stream::GenerateOpen()
nsAutoCString path;
head->Method(method);
head->Path(path);
mSession->Compressor()->EncodeHeaderBlock(mFlatHttpRequestHeaders,
method,
path,
authorityHeader,
scheme,
head->IsConnect(),
compressedData);
rv = mSession->Compressor()->EncodeHeaderBlock(mFlatHttpRequestHeaders,
method,
path,
authorityHeader,
scheme,
head->IsConnect(),
compressedData);
NS_ENSURE_SUCCESS(rv, rv);
int64_t clVal = mSession->Compressor()->GetParsedContentLength();
if (clVal != -1) {

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

@ -2596,7 +2596,8 @@ HttpBaseChannel::GetLastModifiedTime(PRTime* lastModifiedTime)
if (!mResponseHead)
return NS_ERROR_NOT_AVAILABLE;
uint32_t lastMod;
mResponseHead->GetLastModifiedValue(&lastMod);
nsresult rv = mResponseHead->GetLastModifiedValue(&lastMod);
NS_ENSURE_SUCCESS(rv, rv);
*lastModifiedTime = lastMod;
return NS_OK;
}

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

@ -1921,7 +1921,8 @@ HttpChannelChild::Resume()
SendResume();
}
if (mCallOnResume) {
AsyncCall(mCallOnResume);
rv = AsyncCall(mCallOnResume);
NS_ENSURE_SUCCESS(rv, rv);
mCallOnResume = nullptr;
}
}

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

@ -66,13 +66,14 @@ public:
RefPtr<NullHttpChannel> channel = new NullHttpChannel();
rv = channel->Init(uri, 0, nullptr, 0, nullptr);
MOZ_ASSERT(NS_SUCCEEDED(rv));
mActivityDistributor->ObserveActivity(
rv = mActivityDistributor->ObserveActivity(
nsCOMPtr<nsISupports>(do_QueryObject(channel)),
mActivityType,
mActivitySubtype,
mTimestamp,
mExtraSizeData,
mExtraStringData);
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
}

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

@ -589,7 +589,8 @@ nsHttpAuthNode::SetAuthEntry(const char *path,
}
else {
// update the entry...
entry->Set(path, realm, creds, challenge, ident, metadata);
nsresult rv = entry->Set(path, realm, creds, challenge, ident, metadata);
NS_ENSURE_SUCCESS(rv, rv);
}
return NS_OK;

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

@ -111,7 +111,7 @@ nsHttpChannelAuthProvider::Init(nsIHttpAuthenticableChannel *channel)
nsresult rv = mAuthChannel->GetURI(getter_AddRefs(mURI));
if (NS_FAILED(rv)) return rv;
mAuthChannel->GetIsSSL(&mUsingSSL);
rv = mAuthChannel->GetIsSSL(&mUsingSSL);
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIProxiedChannel> proxied(do_QueryInterface(channel));

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

@ -649,7 +649,8 @@ nsHttpConnection::Activate(nsAHttpTransaction *trans, uint32_t caps, int32_t pri
}
if (mTLSFilter) {
mTLSFilter->SetProxiedTransaction(trans);
rv = mTLSFilter->SetProxiedTransaction(trans);
NS_ENSURE_SUCCESS(rv, rv);
mTransaction = mTLSFilter;
}

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

@ -1252,7 +1252,8 @@ nsHttpConnectionMgr::TryDispatchTransaction(nsConnectionEntry *ent,
if ((caps & NS_HTTP_ALLOW_KEEPALIVE) || !conn->IsExperienced()) {
LOG((" dispatch to spdy: [conn=%p]\n", conn.get()));
trans->RemoveDispatchedAsBlocking(); /* just in case */
DispatchTransaction(ent, trans, conn);
nsresult rv = DispatchTransaction(ent, trans, conn);
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
}
unusedSpdyPersistentConnection = conn;
@ -1341,7 +1342,8 @@ nsHttpConnectionMgr::TryDispatchTransaction(nsConnectionEntry *ent,
// This will update the class of the connection to be the class of
// the transaction dispatched on it.
AddActiveConn(conn, ent);
DispatchTransaction(ent, trans, conn);
nsresult rv = DispatchTransaction(ent, trans, conn);
NS_ENSURE_SUCCESS(rv, rv);
LOG((" dispatched step 2 (idle) trans=%p\n", trans));
return NS_OK;
}

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

@ -1476,7 +1476,9 @@ nsHttpTransaction::HandleContentStart()
// notify the connection, give it a chance to cause a reset.
bool reset = false;
mConnection->OnHeadersAvailable(this, mRequestHead, mResponseHead, &reset);
nsresult rv = mConnection->OnHeadersAvailable(this, mRequestHead,
mResponseHead, &reset);
NS_ENSURE_SUCCESS(rv, rv);
// looks like we should ignore this response, resetting...
if (reset) {
@ -1732,7 +1734,8 @@ nsHttpTransaction::ProcessData(char *buf, uint32_t count, uint32_t *countRead)
// the excess bytes back to the connection
if (mResponseIsComplete && countRemaining) {
MOZ_ASSERT(mConnection);
mConnection->PushBack(buf + *countRead, countRemaining);
rv = mConnection->PushBack(buf + *countRead, countRemaining);
NS_ENSURE_SUCCESS(rv, rv);
}
if (!mContentDecodingCheck && mResponseHead) {
@ -1859,8 +1862,8 @@ nsHttpTransaction::CheckForStickyAuthSchemeAt(nsHttpAtom const& header)
nsCOMPtr<nsIHttpAuthenticator> authenticator(do_CreateInstance(contractid.get()));
if (authenticator) {
uint32_t flags;
authenticator->GetAuthFlags(&flags);
if (flags & nsIHttpAuthenticator::CONNECTION_BASED) {
nsresult rv = authenticator->GetAuthFlags(&flags);
if (NS_SUCCEEDED(rv) && (flags & nsIHttpAuthenticator::CONNECTION_BASED)) {
LOG((" connection made sticky, found %s auth shema", schema.get()));
// This is enough to make this transaction keep it's current connection,
// prevents the connection from being released back to the pool.

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

@ -935,8 +935,9 @@ nsViewSourceChannel::VisitResponseHeaders(nsIHttpHeaderVisitor *aVisitor)
nsAutoCString contentType;
nsresult rv =
mHttpChannel->GetResponseHeader(contentTypeStr, contentType);
if (NS_SUCCEEDED(rv))
aVisitor->VisitHeader(contentTypeStr, contentType);
if (NS_SUCCEEDED(rv)) {
return aVisitor->VisitHeader(contentTypeStr, contentType);
}
return NS_OK;
}