diff --git a/netwerk/protocol/websocket/WebSocketChannel.cpp b/netwerk/protocol/websocket/WebSocketChannel.cpp
--- a/netwerk/protocol/websocket/WebSocketChannel.cpp
+++ b/netwerk/protocol/websocket/WebSocketChannel.cpp
@@ -208,16 +208,20 @@ public:
     // We also remove expired entries during search: iterate from end to make
     // indexing simpler
     for (int32_t i = mEntries.Length() - 1; i >= 0; --i) {
       FailDelay *fail = mEntries[i];
       if (fail->mAddress.Equals(address) && fail->mPort == port) {
         if (outIndex)
           *outIndex = i;
         result = fail;
+        // break here: removing more entries would mess up *outIndex.
+        // Any remaining expired entries will be be deleted next time Lookup
+        // finds nothing, which is the most common case anyway.
+        break;
       } else if (fail->IsExpired(rightNow)) {
         mEntries.RemoveElementAt(i);
         delete fail;
       }
     }
     return result;
   }
 