NS_IMETHODIMP nsUrlClassifierLookupCallback::Completion(const nsACString& completeHash, const nsACString& tableName, PRUint32 chunkId, bool verified) { LOG(("nsUrlClassifierLookupCallback::Completion [%p, %s, %d, %d]", this, PromiseFlatCString(tableName).get(), chunkId, verified)); mozilla::safebrowsing::Completion hash; hash.Assign(completeHash); // Send this completion to the store for caching. if (!mCacheResults) { mCacheResults = new CacheResultArray(); if (!mCacheResults) return NS_ERROR_OUT_OF_MEMORY; } if (verified) { CacheResult result; result.entry.addChunk = chunkId; result.entry.hash.complete = hash; result.table = tableName; // OK if this fails, we just won't cache the item. mCacheResults->AppendElement(result); } // Check if this matched any of our results. for (PRUint32 i = 0; i < mResults->Length(); i++) { LookupResult& result = mResults->ElementAt(i); // Now, see if it verifies a lookup if (result.CompleteHash() == hash && result.mTableName.Equals(tableName)) { result.mProtocolConfirmed = true; } } return NS_OK; }