Bug 1325158: Part 2 - Correctly handle extra OnRedirectVerifyCallback calls.
MozReview-Commit-ID: Hl1C6ZEdZKF
--- a/netwerk/base/nsAsyncRedirectVerifyHelper.cpp
+++ b/netwerk/base/nsAsyncRedirectVerifyHelper.cpp
@@ -101,16 +101,21 @@ nsAsyncRedirectVerifyHelper::Init(nsICha
NS_IMETHODIMP
nsAsyncRedirectVerifyHelper::OnRedirectVerifyCallback(nsresult result)
{
LOG(("nsAsyncRedirectVerifyHelper::OnRedirectVerifyCallback() "
"result=%x expectedCBs=%u mResult=%x",
result, mExpectedCallbacks, mResult));
+ if (mExpectedCallbacks <= 0) {
+ NS_ERROR("OnRedirectVerifyCallback called more times than expected");
+ return NS_ERROR_UNEXPECTED;
+ }
+
--mExpectedCallbacks;
// If response indicates failure we may call back immediately
if (NS_FAILED(result)) {
// We chose to store the first failure-value (as opposed to the last)
if (NS_SUCCEEDED(mResult))
mResult = result;