Bug 1841591 Comment 3 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

A complete list of usage is here:

```
nsTArray<T*> - fine as is.
483	cookieList.Sort(CompareCookiesForSending()); // found in mozilla::net::CookieService::GetCookieStringFromDocument
1106	aCookieList.Sort(CompareCookiesForSending()); // found in mozilla::net::CookieService::GetCookiesForURI
1600	gwNeighbors.Sort(NeighborComparator()); // found in mozilla::net::NetlinkService::CalculateIDForFamily

nsTArray<RefPtr<T>> -> StandardSortRefPtrArray
3437	mRecs.Sort(FrecencyComparator()); // found in mozilla::net::CacheIndex::FrecencyArray::SortIfNeeded
2422	aResult.Sort(CompareCookiesCreationTime()); // found in mozilla::net::CookieService::GetCookiesSince
306	cookiesList->Sort(CompareCookiesForSending()); // found in mozilla::net::CookieServiceChild::GetCookieStringFromDocument
343	accessPoints.Sort([](const RefPtr<nsIWifiAccessPoint>& ia, // found in nsWifiMonitor::DoScan

Other probably trivially copy assignable - fine as is
556	removedIterList.Sort(CompareCookiesByIndex()); // found in mozilla::net::CookieStorage::AddCookie
762	purgeList.Sort(CompareCookiesByAge()); // found in mozilla::net::CookieStorage::PurgeCookiesWithCallbacks
778	purgeList.Sort(CompareCookiesByIndex()); // found in mozilla::net::CookieStorage::PurgeCookiesWithCallbacks
81	aBlocklist.Sort(BlocklistEntryComparator()); // found in mozilla::net::InitializeBlocklist

Other TBD - probably not fine
224	alpnList.Sort(AlpnComparator()); // found in mozilla::net::SVCB::GetAllAlpn
1641	linkNamesToHash.Sort(LinknameComparator()); // found in mozilla::net::NetlinkService::CalculateIDForFamily

Other surely huge elements, we might better want to consider sorting pointers anyways
501	mExpirationArray.Sort(ExpirationComparator()); // found in mozilla::net::SSLTokensCache::EvictIfNecessary
1419	mExpirationArray.Sort(ExpirationComparator()); // found in mozilla::net::CacheStorageService::MemoryPool::PurgeExpired
1457	mFrecencyArray.Sort(FrecencyComparator()); // found in mozilla::net::CacheStorageService::MemoryPool::PurgeByFrecency

```

The `nsTArray<RefPtr<T>>` ones will be handled by bug 1842130. The rest needs a closer look.
A complete list of usage is here:

```
nsTArray<T*> - fine as is.
483	cookieList.Sort(CompareCookiesForSending()); // found in mozilla::net::CookieService::GetCookieStringFromDocument
1106	aCookieList.Sort(CompareCookiesForSending()); // found in mozilla::net::CookieService::GetCookiesForURI
1600	gwNeighbors.Sort(NeighborComparator()); // found in mozilla::net::NetlinkService::CalculateIDForFamily

nsTArray<RefPtr<T>> -> StandardSortRefPtrArray
3437	mRecs.Sort(FrecencyComparator()); // found in mozilla::net::CacheIndex::FrecencyArray::SortIfNeeded
2422	aResult.Sort(CompareCookiesCreationTime()); // found in mozilla::net::CookieService::GetCookiesSince
306	cookiesList->Sort(CompareCookiesForSending()); // found in mozilla::net::CookieServiceChild::GetCookieStringFromDocument
343	accessPoints.Sort([](const RefPtr<nsIWifiAccessPoint>& ia, // found in nsWifiMonitor::DoScan
501	mExpirationArray.Sort(ExpirationComparator()); // found in mozilla::net::SSLTokensCache::EvictIfNecessary
1419	mExpirationArray.Sort(ExpirationComparator()); // found in mozilla::net::CacheStorageService::MemoryPool::PurgeExpired
1457	mFrecencyArray.Sort(FrecencyComparator()); // found in mozilla::net::CacheStorageService::MemoryPool::PurgeByFrecency

Other probably trivially copy assignable - fine as is
556	removedIterList.Sort(CompareCookiesByIndex()); // found in mozilla::net::CookieStorage::AddCookie
762	purgeList.Sort(CompareCookiesByAge()); // found in mozilla::net::CookieStorage::PurgeCookiesWithCallbacks
778	purgeList.Sort(CompareCookiesByIndex()); // found in mozilla::net::CookieStorage::PurgeCookiesWithCallbacks
81	aBlocklist.Sort(BlocklistEntryComparator()); // found in mozilla::net::InitializeBlocklist

Other TBD - probably not fine
224	alpnList.Sort(AlpnComparator()); // found in mozilla::net::SVCB::GetAllAlpn
1641	linkNamesToHash.Sort(LinknameComparator()); // found in mozilla::net::NetlinkService::CalculateIDForFamily

```

The `nsTArray<RefPtr<T>>` ones will be handled by bug 1842130. The rest needs a closer look.
A complete list of usage is here:

```
nsTArray<T*> - fine as is.
483	cookieList.Sort(CompareCookiesForSending()); // found in mozilla::net::CookieService::GetCookieStringFromDocument
1106	aCookieList.Sort(CompareCookiesForSending()); // found in mozilla::net::CookieService::GetCookiesForURI
1600	gwNeighbors.Sort(NeighborComparator()); // found in mozilla::net::NetlinkService::CalculateIDForFamily

nsTArray<RefPtr<T>> -> StandardSortRefPtrArray
3437	mRecs.Sort(FrecencyComparator()); // found in mozilla::net::CacheIndex::FrecencyArray::SortIfNeeded
2422	aResult.Sort(CompareCookiesCreationTime()); // found in mozilla::net::CookieService::GetCookiesSince
306	cookiesList->Sort(CompareCookiesForSending()); // found in mozilla::net::CookieServiceChild::GetCookieStringFromDocument
343	accessPoints.Sort([](const RefPtr<nsIWifiAccessPoint>& ia, // found in nsWifiMonitor::DoScan
501	mExpirationArray.Sort(ExpirationComparator()); // found in mozilla::net::SSLTokensCache::EvictIfNecessary
1419	mExpirationArray.Sort(ExpirationComparator()); // found in mozilla::net::CacheStorageService::MemoryPool::PurgeExpired
1457	mFrecencyArray.Sort(FrecencyComparator()); // found in mozilla::net::CacheStorageService::MemoryPool::PurgeByFrecency

Other probably trivially copy assignable - fine as is
556	removedIterList.Sort(CompareCookiesByIndex()); // found in mozilla::net::CookieStorage::AddCookie
762	purgeList.Sort(CompareCookiesByAge()); // found in mozilla::net::CookieStorage::PurgeCookiesWithCallbacks
778	purgeList.Sort(CompareCookiesByIndex()); // found in mozilla::net::CookieStorage::PurgeCookiesWithCallbacks
81	aBlocklist.Sort(BlocklistEntryComparator()); // found in mozilla::net::InitializeBlocklist

Other TBD - probably not fine
224	alpnList.Sort(AlpnComparator()); // found in mozilla::net::SVCB::GetAllAlpn
1641	linkNamesToHash.Sort(LinknameComparator()); // found in mozilla::net::NetlinkService::CalculateIDForFamily

```

~~The `nsTArray<RefPtr<T>>` ones will be handled by bug 1842130. The rest needs a closer look.~~

Back to Bug 1841591 Comment 3