Add the chrome.publicSuffix extensions API [chromium/src : main]

0 views
Skip to first unread message

Dave Vandyke (Gerrit)

unread,
Aug 6, 2026, 9:15:28 AM (10 days ago) Aug 6
to Dave Vandyke, Devlin Cronin, Chromium LUCI CQ, Chromium Metrics Reviews, chromium...@chromium.org, asvitkine...@chromium.org, chromium-a...@chromium.org, extension...@chromium.org, ipc-securi...@chromium.org
Attention needed from Devlin Cronin

Dave Vandyke added 2 comments

Patchset-level comments
File-level comment, Patchset 11 (Latest):
Dave Vandyke . resolved

Hey Devlin, any chance you could take a first pass on these changes to see if the overall approach looks OK? From there I figure I could loop in some more folks. It's working well in my testing (luckily the spec proposal is detailed and has a lot of useful examples), but I've not added a sync API before.

Also, I want to call out that I generated the changes with AI to start with, and then iterated on the changes from there. I kind of regret doing that, because I didn't get the learning experience and understanding from hashing it out myself - I think next time I'll just use it to review what I already came up with.

File extensions/common/api/public_suffix/public_suffix_util_unittest.cc
Line 206, Patchset 10: // TODO: Consider if handling these cases more strictly than
// net::CanonicalizeHost() is worthwhile.
// 1. %2e is normalized to ".".
// ExpectInvalidHostname("subdomain%2edomain.com");
// 2. Domains with underscores are accepted.
// ExpectInvalidHostname("foo_bar.example");
// 3. "。" and similar are normalized to "."
// ExpectInvalidHostname("co。uk");
Dave Vandyke . unresolved

WDYT? I figure these cases probably aren't a big deal, but if you like we could add extra logic to reject them.

Open in Gerrit

Related details

Attention is currently required from:
  • Devlin Cronin
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I3c8205ac02dbb5cba01b1dd1a85f849e26202994
Gerrit-Change-Number: 7871095
Gerrit-PatchSet: 11
Gerrit-Owner: Dave Vandyke <kz...@chromium.org>
Gerrit-Reviewer: Dave Vandyke <kz...@chromium.org>
Gerrit-Reviewer: Devlin Cronin <rdevlin...@chromium.org>
Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
Gerrit-Attention: Devlin Cronin <rdevlin...@chromium.org>
Gerrit-Comment-Date: Thu, 06 Aug 2026 13:15:12 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Devlin Cronin (Gerrit)

unread,
Aug 10, 2026, 4:42:26 PM (6 days ago) Aug 10
to Dave Vandyke, Devlin Cronin, Chromium LUCI CQ, Chromium Metrics Reviews, chromium...@chromium.org, asvitkine...@chromium.org, chromium-a...@chromium.org, extension...@chromium.org, ipc-securi...@chromium.org
Attention needed from Dave Vandyke

Devlin Cronin added 13 comments

Patchset-level comments
Devlin Cronin . resolved

Thanks, Dave! This largely looks good; nothing too major.

I'd definitely recommend we pull in someone more familiar with the registry-controlled domains code at some point; my knowledge there is pretty cursory.

File chrome/test/data/extensions/api_test/public_suffix/basics/background.js
Line 6, Patchset 11 (Latest): function availability() {
Devlin Cronin . unresolved

IMO, this isn't really necessary. Everything else will catastrophically fail without these, and we have pretty extensive testing for our general bindings system

Line 64, Patchset 11 (Latest): },
Devlin Cronin . unresolved

can we add a test for private registries?

File chrome/test/data/extensions/api_test/public_suffix/no_permission/background.js
Line 6, Patchset 11 (Latest): function unavailableWithoutPermission() {
Devlin Cronin . unresolved

ditto here, arguably unnecessary (but you can keep this one if you like)

File extensions/common/api/public_suffix.webidl
Line 23, Patchset 11 (Latest): // Whether known public suffixes may be returned as domains. Defaults to false.
Devlin Cronin . unresolved

nit: wrap at 80 char

File extensions/common/api/public_suffix/public_suffix_util.h
Line 14, Patchset 11 (Latest):namespace extensions::api::public_suffix {
Devlin Cronin . unresolved

this file is only needed in the renderer, right? If so, let's put it there.

File extensions/common/api/public_suffix/public_suffix_util.cc
Line 37, Patchset 11 (Latest): if (encoding != DomainEncoding::kDisplay) {
Devlin Cronin . unresolved

nit: prefer using a switch statement so that if we add more encoding types, we update this appropriately.

Line 46, Patchset 11 (Latest): const size_t registry_length = GetCanonicalHostRegistryLength(
Devlin Cronin . unresolved
Line 70, Patchset 11 (Latest): std::string canonical_host = net::CanonicalizeHost(hostname, &host_info);
Line 117, Patchset 11 (Latest): std::string_view normalized_host = TrimLeadingDot(hostname.value);
Devlin Cronin . unresolved

doesn't the CanonicalHostname already trim the leading dot?

File extensions/common/api/public_suffix/public_suffix_util_unittest.cc
Line 78, Patchset 11 (Latest): ExpectIsKnownSuffix("jp", true);
Devlin Cronin . unresolved

these lead to unhelpful error messages when they go awry, because it just says that the expectation in the helper method failed.

This is mitigated by the SCOPED_TRACE you include in each of these methods, but that's still a little clunky. Would it make sense to instead have these return values? e.g., return a string from GetKnownSuffix() and a bool from IsKnownSuffix() and then use EXPECT_EQ / EXPECT_TRUE / EXPECT_FALSE at these callsites?

Line 206, Patchset 10: // TODO: Consider if handling these cases more strictly than
// net::CanonicalizeHost() is worthwhile.
// 1. %2e is normalized to ".".
// ExpectInvalidHostname("subdomain%2edomain.com");
// 2. Domains with underscores are accepted.
// ExpectInvalidHostname("foo_bar.example");
// 3. "。" and similar are normalized to "."
// ExpectInvalidHostname("co。uk");
Dave Vandyke . unresolved

WDYT? I figure these cases probably aren't a big deal, but if you like we could add extra logic to reject them.

Devlin Cronin

I have no strong feelings, as long as the behavior is a) reasonable and b) safe : )

File extensions/renderer/api/public_suffix_hooks_delegate_unittest.cc
Line 86, Patchset 11 (Latest):TEST_F(PublicSuffixHooksDelegateTest, UnknownMethodIsNotHandled) {
Devlin Cronin . unresolved

arguably, this whole file is unnecessary with the api test (providing end-to-end "real" coverage) + unittests for the utility methods. Unless there's a reason to keep this, I'd be inclined to remove it.

Open in Gerrit

Related details

Attention is currently required from:
  • Dave Vandyke
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I3c8205ac02dbb5cba01b1dd1a85f849e26202994
Gerrit-Change-Number: 7871095
Gerrit-PatchSet: 11
Gerrit-Owner: Dave Vandyke <kz...@chromium.org>
Gerrit-Reviewer: Dave Vandyke <kz...@chromium.org>
Gerrit-Reviewer: Devlin Cronin <rdevlin...@chromium.org>
Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
Gerrit-Attention: Dave Vandyke <kz...@chromium.org>
Gerrit-Comment-Date: Mon, 10 Aug 2026 20:42:13 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Dave Vandyke <kz...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Dave Vandyke (Gerrit)

unread,
Aug 13, 2026, 3:30:25 PM (3 days ago) Aug 13
to Dave Vandyke, Devlin Cronin, Chromium LUCI CQ, Chromium Metrics Reviews, chromium...@chromium.org, asvitkine...@chromium.org, chromium-a...@chromium.org, extension...@chromium.org, ipc-securi...@chromium.org
Attention needed from Devlin Cronin

Dave Vandyke added 13 comments

Patchset-level comments
File-level comment, Patchset 15 (Latest):
Dave Vandyke . resolved

Thanks Devlin!

File chrome/test/data/extensions/api_test/public_suffix/basics/background.js
Line 6, Patchset 11: function availability() {
Devlin Cronin . resolved

IMO, this isn't really necessary. Everything else will catastrophically fail without these, and we have pretty extensive testing for our general bindings system

Dave Vandyke

Done.

Devlin Cronin . unresolved

can we add a test for private registries?

Dave Vandyke

I haven't done that so far since I think these browser tests are using the real PSL, unlike the unit tests that are using the dummy PSL. Therefore, I worried that if we are too specific about the domains (e.g. by adding tests for `github.io` or similar) here, the tests could start failing one day. WDYT?

File chrome/test/data/extensions/api_test/public_suffix/no_permission/background.js
Line 6, Patchset 11: function unavailableWithoutPermission() {
Devlin Cronin . resolved

ditto here, arguably unnecessary (but you can keep this one if you like)

Dave Vandyke

Done

File extensions/common/api/public_suffix.webidl
Line 23, Patchset 11: // Whether known public suffixes may be returned as domains. Defaults to false.
Devlin Cronin . resolved

nit: wrap at 80 char

Dave Vandyke

Done

File extensions/common/api/public_suffix/public_suffix_util.h
Line 14, Patchset 11:namespace extensions::api::public_suffix {
Devlin Cronin . resolved

this file is only needed in the renderer, right? If so, let's put it there.

Dave Vandyke

Done

File extensions/common/api/public_suffix/public_suffix_util.cc
Line 37, Patchset 11: if (encoding != DomainEncoding::kDisplay) {
Devlin Cronin . resolved

nit: prefer using a switch statement so that if we add more encoding types, we update this appropriately.

Dave Vandyke

Done

Line 46, Patchset 11: const size_t registry_length = GetCanonicalHostRegistryLength(
Devlin Cronin . unresolved

it's generally preferred to use [GetRegistryLength](https://source.chromium.org/chromium/chromium/src/+/main:net/base/registry_controlled_domains/registry_controlled_domain.h;l=248;drc=916279bfbd81b1585ebbeb9ac1c83d4283f50680); is there a reason to use this particular method here?

Dave Vandyke

I figure it makes sense since we already ran the hostname through canoncialisation, and this way we don't need to convert it back to a GURL. But open to suggestions, sounds like I might be missing some nuance here?

Line 70, Patchset 11: std::string canonical_host = net::CanonicalizeHost(hostname, &host_info);
Line 117, Patchset 11: std::string_view normalized_host = TrimLeadingDot(hostname.value);
Devlin Cronin . unresolved

doesn't the CanonicalHostname already trim the leading dot?

Dave Vandyke

I have reworked this, since the name `CanonicalHostname` was kind of confusing, and like you say we can trim the leading dot when we parse/validate the hostname. WDYT?

File extensions/common/api/public_suffix/public_suffix_util_unittest.cc
Line 78, Patchset 11: ExpectIsKnownSuffix("jp", true);
Devlin Cronin . resolved

these lead to unhelpful error messages when they go awry, because it just says that the expectation in the helper method failed.

This is mitigated by the SCOPED_TRACE you include in each of these methods, but that's still a little clunky. Would it make sense to instead have these return values? e.g., return a string from GetKnownSuffix() and a bool from IsKnownSuffix() and then use EXPECT_EQ / EXPECT_TRUE / EXPECT_FALSE at these callsites?

Dave Vandyke

Done

Line 206, Patchset 10: // TODO: Consider if handling these cases more strictly than
// net::CanonicalizeHost() is worthwhile.
// 1. %2e is normalized to ".".
// ExpectInvalidHostname("subdomain%2edomain.com");
// 2. Domains with underscores are accepted.
// ExpectInvalidHostname("foo_bar.example");
// 3. "。" and similar are normalized to "."
// ExpectInvalidHostname("co。uk");
Dave Vandyke . unresolved

WDYT? I figure these cases probably aren't a big deal, but if you like we could add extra logic to reject them.

Devlin Cronin

I have no strong feelings, as long as the behavior is a) reasonable and b) safe : )

Dave Vandyke

Same here, I'm leaning towards not worrying about these cases at all, if that makes the code simpler. I will leave this open for now, in case other folks feel strongly.

File extensions/renderer/api/public_suffix_hooks_delegate_unittest.cc
Line 86, Patchset 11:TEST_F(PublicSuffixHooksDelegateTest, UnknownMethodIsNotHandled) {
Devlin Cronin . resolved

arguably, this whole file is unnecessary with the api test (providing end-to-end "real" coverage) + unittests for the utility methods. Unless there's a reason to keep this, I'd be inclined to remove it.

Dave Vandyke

SGTM, Done. (I figured it was needed for code coverage stats, but if that's not the case then I don't see what it added either.)

Open in Gerrit

Related details

Attention is currently required from:
  • Devlin Cronin
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I3c8205ac02dbb5cba01b1dd1a85f849e26202994
Gerrit-Change-Number: 7871095
Gerrit-PatchSet: 15
Gerrit-Owner: Dave Vandyke <kz...@chromium.org>
Gerrit-Reviewer: Dave Vandyke <kz...@chromium.org>
Gerrit-Reviewer: Devlin Cronin <rdevlin...@chromium.org>
Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
Gerrit-Attention: Devlin Cronin <rdevlin...@chromium.org>
Gerrit-Comment-Date: Thu, 13 Aug 2026 19:30:03 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Devlin Cronin <rdevlin...@chromium.org>
Comment-In-Reply-To: Dave Vandyke <kz...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Devlin Cronin (Gerrit)

unread,
Aug 14, 2026, 2:11:54 PM (2 days ago) Aug 14
to Dave Vandyke, Chris Fredrickson, Devlin Cronin, Chromium LUCI CQ, Chromium Metrics Reviews, chromium...@chromium.org, asvitkine...@chromium.org, chromium-a...@chromium.org, extension...@chromium.org, ipc-securi...@chromium.org
Attention needed from Chris Fredrickson and Dave Vandyke

Devlin Cronin added 7 comments

Patchset-level comments
Devlin Cronin . resolved

Thanks, Dave!

I'm also adding cfredric here as the owner of registry_controlled_domains code -- Chris, can you take a look at the implementation in public_suffix_util.* and see if that looks reasonable?

File chrome/test/data/extensions/api_test/public_suffix/basics/background.js
Devlin Cronin . unresolved

can we add a test for private registries?

Dave Vandyke

I haven't done that so far since I think these browser tests are using the real PSL, unlike the unit tests that are using the dummy PSL. Therefore, I worried that if we are too specific about the domains (e.g. by adding tests for `github.io` or similar) here, the tests could start failing one day. WDYT?

Devlin Cronin

I think that's probably okay.

The PSL is bundled with the browser, so if it starts failing, it will do so deterministically, and we can just use a new private registry. There's existing precedence for this in other places. And my guess is that github is going to stay around awhile, so hopefully this isn't a common occurrence ; ) (appspot is another common choice)

File extensions/common/api/public_suffix/public_suffix_util.cc
Line 46, Patchset 11: const size_t registry_length = GetCanonicalHostRegistryLength(
Devlin Cronin . resolved

it's generally preferred to use [GetRegistryLength](https://source.chromium.org/chromium/chromium/src/+/main:net/base/registry_controlled_domains/registry_controlled_domain.h;l=248;drc=916279bfbd81b1585ebbeb9ac1c83d4283f50680); is there a reason to use this particular method here?

Dave Vandyke

I figure it makes sense since we already ran the hostname through canoncialisation, and this way we don't need to convert it back to a GURL. But open to suggestions, sounds like I might be missing some nuance here?

Devlin Cronin

I was just mentioning it because of the guidance on the function, but I think you're right that it _shouldn't_ matter in this case (since we've canonicalized it).

Line 70, Patchset 11: std::string canonical_host = net::CanonicalizeHost(hostname, &host_info);
Devlin Cronin . resolved
Devlin Cronin

:facepalm:. Thanks; my mistake : )

Line 117, Patchset 11: std::string_view normalized_host = TrimLeadingDot(hostname.value);
Devlin Cronin . resolved

doesn't the CanonicalHostname already trim the leading dot?

Dave Vandyke

I have reworked this, since the name `CanonicalHostname` was kind of confusing, and like you say we can trim the leading dot when we parse/validate the hostname. WDYT?

Devlin Cronin

Works for me, but I'll lead the detailed review to someone more familiar with the net code

File extensions/renderer/api/public_suffix_hooks_delegate.cc
Line 172, Patchset 15 (Latest): RequestResult result(RequestResult::INVALID_INVOCATION);
Devlin Cronin . unresolved

test coverage bots indicate this branch isn't exercised, but seems like it could (legitimately) occur. Can we update the apitest to have a flow that reaches here?

(It's slightly superfluous since getDomain goes through the same path, but it seems cheap enough : ))

File extensions/renderer/api/public_suffix_util.cc
Line 87, Patchset 15 (Latest): return std::string(
Devlin Cronin . unresolved

nit: is this wrapping necessary? (The return type of substr is a string already)

Open in Gerrit

Related details

Attention is currently required from:
  • Chris Fredrickson
  • Dave Vandyke
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I3c8205ac02dbb5cba01b1dd1a85f849e26202994
Gerrit-Change-Number: 7871095
Gerrit-PatchSet: 15
Gerrit-Owner: Dave Vandyke <kz...@chromium.org>
Gerrit-Reviewer: Chris Fredrickson <cfre...@chromium.org>
Gerrit-Reviewer: Dave Vandyke <kz...@chromium.org>
Gerrit-Reviewer: Devlin Cronin <rdevlin...@chromium.org>
Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
Gerrit-Attention: Dave Vandyke <kz...@chromium.org>
Gerrit-Attention: Chris Fredrickson <cfre...@chromium.org>
Gerrit-Comment-Date: Fri, 14 Aug 2026 18:11:40 +0000
satisfied_requirement
unsatisfied_requirement
open
diffy

Dave Vandyke (Gerrit)

unread,
Aug 14, 2026, 4:09:01 PM (2 days ago) Aug 14
to Dave Vandyke, Chris Fredrickson, Devlin Cronin, Chromium LUCI CQ, Chromium Metrics Reviews, chromium...@chromium.org, asvitkine...@chromium.org, chromium-a...@chromium.org, extension...@chromium.org, ipc-securi...@chromium.org
Attention needed from Chris Fredrickson

Dave Vandyke added 3 comments

File chrome/test/data/extensions/api_test/public_suffix/basics/background.js
Devlin Cronin . resolved

can we add a test for private registries?

Dave Vandyke

I haven't done that so far since I think these browser tests are using the real PSL, unlike the unit tests that are using the dummy PSL. Therefore, I worried that if we are too specific about the domains (e.g. by adding tests for `github.io` or similar) here, the tests could start failing one day. WDYT?

Devlin Cronin

I think that's probably okay.

The PSL is bundled with the browser, so if it starts failing, it will do so deterministically, and we can just use a new private registry. There's existing precedence for this in other places. And my guess is that github is going to stay around awhile, so hopefully this isn't a common occurrence ; ) (appspot is another common choice)

Dave Vandyke

Phew OK, in that case I've added some more test cases. Done

File extensions/renderer/api/public_suffix_hooks_delegate.cc
Line 172, Patchset 15: RequestResult result(RequestResult::INVALID_INVOCATION);
Devlin Cronin . resolved

test coverage bots indicate this branch isn't exercised, but seems like it could (legitimately) occur. Can we update the apitest to have a flow that reaches here?

(It's slightly superfluous since getDomain goes through the same path, but it seems cheap enough : ))

Dave Vandyke

Done

File extensions/renderer/api/public_suffix_util.cc
Line 87, Patchset 15: return std::string(
Devlin Cronin . resolved

nit: is this wrapping necessary? (The return type of substr is a string already)

Dave Vandyke

Done

Open in Gerrit

Related details

Attention is currently required from:
  • Chris Fredrickson
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I3c8205ac02dbb5cba01b1dd1a85f849e26202994
Gerrit-Change-Number: 7871095
Gerrit-PatchSet: 16
Gerrit-Owner: Dave Vandyke <kz...@chromium.org>
Gerrit-Reviewer: Chris Fredrickson <cfre...@chromium.org>
Gerrit-Reviewer: Dave Vandyke <kz...@chromium.org>
Gerrit-Reviewer: Devlin Cronin <rdevlin...@chromium.org>
Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
Gerrit-Attention: Chris Fredrickson <cfre...@chromium.org>
Gerrit-Comment-Date: Fri, 14 Aug 2026 20:08:40 +0000
satisfied_requirement
unsatisfied_requirement
open
diffy

Chris Fredrickson (Gerrit)

unread,
Aug 14, 2026, 4:17:18 PM (2 days ago) Aug 14
to Dave Vandyke, Devlin Cronin, Chromium LUCI CQ, Chromium Metrics Reviews, chromium...@chromium.org, asvitkine...@chromium.org, chromium-a...@chromium.org, extension...@chromium.org, ipc-securi...@chromium.org
Attention needed from Devlin Cronin

Chris Fredrickson added 5 comments

Patchset-level comments
Devlin Cronin . resolved

Thanks, Dave!

I'm also adding cfredric here as the owner of registry_controlled_domains code -- Chris, can you take a look at the implementation in public_suffix_util.* and see if that looks reasonable?

Chris Fredrickson

That implementation looks reasonable to me!

File extensions/renderer/api/public_suffix_util.cc
Line 111, Patchset 16 (Latest): if (*known_suffix == hostname.value) {
Chris Fredrickson . unresolved

Consider using `operator==(const std::optional<std::string>&, const std::string&)` here, since the entire body of the `if (known_suffix.has_value())` block is the other if statement and its block.

Line 116, Patchset 15: return ApplyEncoding(std::string(hostname.value), options.encoding);
Chris Fredrickson . unresolved
This is already a std::string, and will get copied automatically by the function call.
```suggestion
return ApplyEncoding(hostname.value, options.encoding);
```
Line 126, Patchset 15: domain = std::string(hostname.value);
Chris Fredrickson . unresolved
```suggestion
domain = hostname.value;
```

(Although you could avoid a string-copy by just returning directly from here, instead of falling down to the return on line 129.)

File extensions/renderer/api/public_suffix_util_unittest.cc
Line 33, Patchset 15:std::optional<bool> IsKnownSuffix(const std::string& hostname) {
Chris Fredrickson . unresolved

Why not bool (since that's what the underlying API returns)?
```suggestion
bool IsKnownSuffix(const std::string& hostname) {
```

Open in Gerrit

Related details

Attention is currently required from:
  • Devlin Cronin
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I3c8205ac02dbb5cba01b1dd1a85f849e26202994
Gerrit-Change-Number: 7871095
Gerrit-PatchSet: 16
Gerrit-Owner: Dave Vandyke <kz...@chromium.org>
Gerrit-Reviewer: Chris Fredrickson <cfre...@chromium.org>
Gerrit-Reviewer: Dave Vandyke <kz...@chromium.org>
Gerrit-Reviewer: Devlin Cronin <rdevlin...@chromium.org>
Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
Gerrit-Attention: Devlin Cronin <rdevlin...@chromium.org>
Gerrit-Comment-Date: Fri, 14 Aug 2026 20:17:09 +0000
satisfied_requirement
unsatisfied_requirement
open
diffy

Dave Vandyke (Gerrit)

unread,
Aug 14, 2026, 5:31:45 PM (2 days ago) Aug 14
to Dave Vandyke, Chris Fredrickson, Devlin Cronin, Chromium LUCI CQ, Chromium Metrics Reviews, chromium...@chromium.org, asvitkine...@chromium.org, chromium-a...@chromium.org, extension...@chromium.org, ipc-securi...@chromium.org
Attention needed from Chris Fredrickson and Devlin Cronin

Dave Vandyke added 4 comments

File extensions/renderer/api/public_suffix_util.cc
Line 111, Patchset 16: if (*known_suffix == hostname.value) {
Chris Fredrickson . unresolved

Consider using `operator==(const std::optional<std::string>&, const std::string&)` here, since the entire body of the `if (known_suffix.has_value())` block is the other if statement and its block.

Dave Vandyke

I gave this a try, but I think that the separate `known_suffix.has_value()` check is still useful due to the else block. We only want to enforce `allow_unknown_suffix` if there wasn't a value. WDYT?

Line 116, Patchset 15: return ApplyEncoding(std::string(hostname.value), options.encoding);
Chris Fredrickson . resolved
This is already a std::string, and will get copied automatically by the function call.
```suggestion
return ApplyEncoding(hostname.value, options.encoding);
```
Dave Vandyke

Done

Line 126, Patchset 15: domain = std::string(hostname.value);
Chris Fredrickson . resolved
```suggestion
domain = hostname.value;
```

(Although you could avoid a string-copy by just returning directly from here, instead of falling down to the return on line 129.)

Dave Vandyke

Done

File extensions/renderer/api/public_suffix_util_unittest.cc
Line 33, Patchset 15:std::optional<bool> IsKnownSuffix(const std::string& hostname) {
Chris Fredrickson . resolved

Why not bool (since that's what the underlying API returns)?
```suggestion
bool IsKnownSuffix(const std::string& hostname) {
```

Dave Vandyke

Done

Open in Gerrit

Related details

Attention is currently required from:
  • Chris Fredrickson
  • Devlin Cronin
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I3c8205ac02dbb5cba01b1dd1a85f849e26202994
Gerrit-Change-Number: 7871095
Gerrit-PatchSet: 17
Gerrit-Owner: Dave Vandyke <kz...@chromium.org>
Gerrit-Reviewer: Chris Fredrickson <cfre...@chromium.org>
Gerrit-Reviewer: Dave Vandyke <kz...@chromium.org>
Gerrit-Reviewer: Devlin Cronin <rdevlin...@chromium.org>
Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
Gerrit-Attention: Devlin Cronin <rdevlin...@chromium.org>
Gerrit-Attention: Chris Fredrickson <cfre...@chromium.org>
Gerrit-Comment-Date: Fri, 14 Aug 2026 21:31:27 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Chris Fredrickson <cfre...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Dave Vandyke (Gerrit)

unread,
Aug 15, 2026, 1:15:46 AM (yesterday) Aug 15
to Dave Vandyke, Chris Fredrickson, Devlin Cronin, Chromium LUCI CQ, Chromium Metrics Reviews, chromium...@chromium.org, asvitkine...@chromium.org, chromium-a...@chromium.org, extension...@chromium.org, ipc-securi...@chromium.org
Attention needed from Chris Fredrickson and Devlin Cronin

Dave Vandyke added 1 comment

File extensions/common/api/public_suffix/public_suffix_util_unittest.cc
Line 206, Patchset 10: // TODO: Consider if handling these cases more strictly than
// net::CanonicalizeHost() is worthwhile.
// 1. %2e is normalized to ".".
// ExpectInvalidHostname("subdomain%2edomain.com");
// 2. Domains with underscores are accepted.
// ExpectInvalidHostname("foo_bar.example");
// 3. "。" and similar are normalized to "."
// ExpectInvalidHostname("co。uk");
Dave Vandyke . unresolved

WDYT? I figure these cases probably aren't a big deal, but if you like we could add extra logic to reject them.

Devlin Cronin

I have no strong feelings, as long as the behavior is a) reasonable and b) safe : )

Dave Vandyke

Same here, I'm leaning towards not worrying about these cases at all, if that makes the code simpler. I will leave this open for now, in case other folks feel strongly.

Dave Vandyke

Oh, and I forgot about this one. WDYT Chris?

Gerrit-Comment-Date: Sat, 15 Aug 2026 05:15:24 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy
Reply all
Reply to author
Forward
0 new messages