Bug 1532231 - Properly check if a DNSRequest is in array r=dragana
authorKershaw Chang <kershaw@mozilla.com>
Wed, 06 Mar 2019 22:15:41 +0000
changeset 520598 c2cef5dac5954b0a5d65e9d7fc7277e666f7094f
parent 520597 257a060b7d65d506689fe558dd716ee1bd2e7e82
child 520599 78ac916246b196776b9bcb9aac40d26b8793fad4
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdragana
bugs1532231
milestone67.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 1532231 - Properly check if a DNSRequest is in array r=dragana Differential Revision: https://phabricator.services.mozilla.com/D21902
netwerk/dns/ChildDNSService.cpp
--- a/netwerk/dns/ChildDNSService.cpp
+++ b/netwerk/dns/ChildDNSService.cpp
@@ -309,18 +309,18 @@ void ChildDNSService::NotifyRequestDone(
   nsCString key;
   GetDNSRecordHashKey(aDnsRequest->mHost, aDnsRequest->mType,
                       aDnsRequest->mOriginAttributes, originalFlags,
                       originalListener, key);
 
   nsTArray<RefPtr<DNSRequestChild>> *hashEntry;
 
   if (mPendingRequests.Get(key, &hashEntry)) {
-    int idx;
-    if ((idx = hashEntry->IndexOf(aDnsRequest))) {
+    auto idx = hashEntry->IndexOf(aDnsRequest);
+    if (idx != nsTArray<RefPtr<DNSRequestChild>>::NoIndex) {
       hashEntry->RemoveElementAt(idx);
       if (hashEntry->IsEmpty()) {
         mPendingRequests.Remove(key);
       }
     }
   }
 }