0
Files
src/net/extras
Chris Fredrickson c9dad5877d Extract UniqueCookieKey type
This introduces a new class, UniqueCookieKey, to replace 4 distinct
tuple aliases: StrictlyUniqueCookieKey, UniqueCookieKey,
UniqueDomainCookieKey, and LegacyUniqueCookieKey. Turning these into
dedicated types (rather than just aliases of tuples) has a few notable
consequences:

* Member accesses are more readable and maintainable, e.g. `signature.domain()` instead of `std::get<2>(signature)`.
* CookieMonster's duplicate filtering logic no longer needs to be aware of host cookies vs domain cookies; it can just call UniqueKey() which will do the right thing instead of requiring the caller to know how to branch correctly.
* We can now merge CookieBase::UniqueKey() and CookieBase::UniqueDomainKey() into a single function that is aware of what kind of key it should create.
* We can now guarantee that these keys can only be created via the accessors in CookieBase.
* The type system can no longer guarantee the usage of a Legacy key instead of a Strict key, or vice versa, since they're the same type. (This doesn't seem like a likely source of bugs to me, so I think this is fine. But we can also make Strict and Legacy keys their own types.)

Fixed: 390345080
Change-Id: Iaebf4d34e854adbbfc4483ad4d2fc58794659199
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6175944
Reviewed-by: Steven Bingler <bingler@chromium.org>
Auto-Submit: Chris Fredrickson <cfredric@chromium.org>
Reviewed-by: David Song <wintermelons@google.com>
Reviewed-by: Maks Orlovich <morlovich@chromium.org>
Commit-Queue: Chris Fredrickson <cfredric@chromium.org>
Reviewed-by: Jood Hajeer <jood@google.com>
Cr-Commit-Position: refs/heads/main@{#1407461}
2025-01-16 11:12:45 -08:00
..
2025-01-16 11:12:45 -08:00