Bug 1325158: Part 2 - Correctly handle extra OnRedirectVerifyCallback calls. r=honzab
authorKris Maglione <maglione.k@gmail.com>
Sat, 24 Dec 2016 18:25:18 -0800
changeset 377684 8241272efd6a432caa36ca9b2da4bd8c8cb7e9f8
parent 377683 c79e8bee853e454fd563fc46349224479b7ddc56
child 377685 7d4dc504eea50040e44edc20e0857cb28c2e4a96
push id1419
push userjlund@mozilla.com
push dateMon, 10 Apr 2017 20:44:07 +0000
treeherdermozilla-release@5e6801b73ef6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewershonzab
bugs1325158
milestone53.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1325158: Part 2 - Correctly handle extra OnRedirectVerifyCallback calls. r=honzab MozReview-Commit-ID: Hl1C6ZEdZKF
netwerk/base/nsAsyncRedirectVerifyHelper.cpp
--- a/netwerk/base/nsAsyncRedirectVerifyHelper.cpp
+++ b/netwerk/base/nsAsyncRedirectVerifyHelper.cpp
@@ -101,16 +101,22 @@ nsAsyncRedirectVerifyHelper::Init(nsICha
 
 NS_IMETHODIMP
 nsAsyncRedirectVerifyHelper::OnRedirectVerifyCallback(nsresult result)
 {
     LOG(("nsAsyncRedirectVerifyHelper::OnRedirectVerifyCallback() "
          "result=%x expectedCBs=%u mResult=%x",
          result, mExpectedCallbacks, mResult));
 
+    MOZ_DIAGNOSTIC_ASSERT(mExpectedCallbacks > 0,
+                          "OnRedirectVerifyCallback called more times than expected");
+    if (mExpectedCallbacks <= 0) {
+      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;