Add js-profiling-mode enum Document Policy with eager/lazy V8 profiler initialization [chromium/src : main]

2 views
Skip to first unread message

Michal Mocny (Gerrit)

unread,
Feb 19, 2026, 10:10:29 AMFeb 19
to Thomas BERTET, Chromium Metrics Reviews, chromium...@chromium.org, Luna Lu, asvitkine...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, core-timi...@chromium.org, iclella...@chromium.org, ipc-securi...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, speed-metrics...@chromium.org
Attention needed from Thomas BERTET

Michal Mocny added 11 comments

Patchset-level comments
File-level comment, Patchset 2 (Latest):
Michal Mocny . resolved

This is not my area of code expertise (doc policy not js profiling) but here is an initial review.

I haven't really analyzed the tests, but I think this is a solid start and we can expand the test cases a bit later, as needed.

You may be able/want to address some of my superficial comments, but don't hesitate to start to ask experts to start review for feedback / guidance on direction.

Commit Message
Line 13, Patchset 2 (Latest):This is the first enum-type Document Policy feature in Chromium.
Michal Mocny . resolved

Fancy!

File third_party/blink/common/permissions_policy/document_policy.cc
Line 40, Patchset 2 (Latest):const char* EnumValueToToken(int32_t value) {
Michal Mocny . unresolved

Style on returning char* based strings...

Line 58, Patchset 2 (Latest): const char* token = EnumValueToToken(value.IntValue());
Michal Mocny . unresolved

So *any* enum will map to this specific enum values?

This feels fine as a local prototype, but I think you need some machinery to handle mapping the right enum type to the right enum strings. As a bad alternative, find a way to break this loudly when the next enum type is introduced so the next person has to deal with it...

File third_party/blink/renderer/core/permissions_policy/document_policy_features.json5
Line 108, Patchset 2 (Latest): default_value: "0",
Michal Mocny . unresolved

The `default_value` of `0` corresponds to `JSProfilingMode::kNone`. However, there isn't a corresponding token in `TokenToEnumValue` (line 29 in `document_policy_parser.cc`) or `EnumValueToToken` (line 40 in `document_policy.cc`) to represent `kNone`.

This means that while `kNone` is the default, it cannot be explicitly set via a Document Policy header. Only `eager` and `lazy` can be specified.

Is this intentional? If so, it might be worth adding a comment to clarify that `kNone` is an implicit default and cannot be set explicitly via the policy header, to avoid confusion if someone tries to write `js-profiling-mode='none'`.

File third_party/blink/renderer/core/permissions_policy/document_policy_parser.cc
Line 29, Patchset 2 (Latest):std::optional<int32_t> TokenToEnumValue(const std::string& token) {
Michal Mocny . unresolved

Hmm, we go from enum string to enum value back to enum string later... Ideally these to_string and from_string would be defined together, indeally in `profiler_group.h`?

(Also this implementation has the same issue as the other one in that its generic for all enums but specific to this particular enum.)

---

WDYT about adding a second enum directly to `third_party/blink/public/mojom/permissions_policy/document_policy_feature.mojom`?

And then use `document_policy_features.json5`?

...that might need some build file pre-processing changes to support enum *values*, but I think this feels like the correct approach.

(I'm totally new to this area, but this is what I found with a bit of digging.)

File third_party/blink/renderer/core/timing/profiler_group.h
Line 89, Patchset 2 (Latest): void InitV8Profiler(v8::CpuProfilingLoggingMode logging_mode);
Michal Mocny . unresolved

Similarly here, can we just have one variant?

Line 76, Patchset 2 (Latest): void OnProfilingContextAddedLazy(ExecutionContext* context);
Michal Mocny . unresolved

Nit: Just add a mode arg to the method above, with a default of eager?

File third_party/blink/renderer/core/timing/profiler_group.cc
Line 80, Patchset 2 (Latest): int32_t enum_val = mode_value.IntValue();
if (enum_val == static_cast<int32_t>(JSProfilingMode::kEager) ||
enum_val == static_cast<int32_t>(JSProfilingMode::kLazy)) {
return static_cast<JSProfilingMode>(enum_val);
}
Michal Mocny . unresolved

Nit: style, but let's iterate on the design of the enum first

Line 104, Patchset 2 (Latest): return true;
Michal Mocny . unresolved

If `GetProfilingMode()` returns `kNone`, it means that `IsFeatureEnabled(kJSProfiling)` has already returned `false`. Therefore, the `IsFeatureEnabled` check on line 102 will also be `false`, making this `return true;` unreachable.

Additionally, my understanding is that `IsFeatureEnabled` do some logging/reporting and the GetProfilingMode would skip its check if the new profiling mode was supplied without the general profiling policy.

---

If kJSProfiling is still required alongside kJSProfilingMode, I think you could swap the order of feature detection and if kJSProfiling is disabled always return kNone, otherwise return provided policy or default to eager.

If kJSProfiling is optional... maybe the current implementation is fine, but perhaps add a comment here?

Line 177, Patchset 2 (Latest): context_observers_.insert(observer);
Michal Mocny . unresolved

THis will require expert review, but, it surpises me that you can init via `InitV8Profiler(v8::kLazyLogging);` but that we choose not to do so.

So you can have tri-state:

  • Un-init
  • Init w/ Lazy
  • Init w/ Eager

This document policy adds 2 modes and picks (1) and (3).

(But it also creates a `ProfilingContextObserver` eagerly, which afaik isn't needed until you start to profile? Not sure.)

Open in Gerrit

Related details

Attention is currently required from:
  • Thomas BERTET
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: If3e61ee55318b46bf2b07a16d113a5a388f7bf67
Gerrit-Change-Number: 7575656
Gerrit-PatchSet: 2
Gerrit-Owner: Thomas BERTET <thomas...@gmail.com>
Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
Gerrit-CC: Luna Lu <loon...@chromium.org>
Gerrit-CC: Michal Mocny <mmo...@chromium.org>
Gerrit-Attention: Thomas BERTET <thomas...@gmail.com>
Gerrit-Comment-Date: Thu, 19 Feb 2026 15:10:20 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Monica Chintala (Gerrit)

unread,
Feb 24, 2026, 1:21:57 PMFeb 24
to Thomas BERTET, Michal Mocny, Chromium Metrics Reviews, chromium...@chromium.org, Luna Lu, asvitkine...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, core-timi...@chromium.org, iclella...@chromium.org, ipc-securi...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, speed-metrics...@chromium.org
Attention needed from Thomas BERTET

Monica Chintala added 4 comments

File third_party/blink/common/permissions_policy/document_policy.cc
Line 40, Patchset 2 (Latest):const char* EnumValueToToken(int32_t value) {
Michal Mocny . unresolved

Style on returning char* based strings...

Monica Chintala

Chromium style prefers std::string_view (or absl::string_view) over const char* for string returns. Also, nullptr is fragile, CHECK(token) would crash. Using std::optional<std::string_view> is better

File third_party/blink/renderer/core/permissions_policy/document_policy_parser.cc
Line 29, Patchset 2 (Latest):std::optional<int32_t> TokenToEnumValue(const std::string& token) {
Michal Mocny . unresolved

Hmm, we go from enum string to enum value back to enum string later... Ideally these to_string and from_string would be defined together, indeally in `profiler_group.h`?

(Also this implementation has the same issue as the other one in that its generic for all enums but specific to this particular enum.)

---

WDYT about adding a second enum directly to `third_party/blink/public/mojom/permissions_policy/document_policy_feature.mojom`?

And then use `document_policy_features.json5`?

...that might need some build file pre-processing changes to support enum *values*, but I think this feels like the correct approach.

(I'm totally new to this area, but this is what I found with a bit of digging.)

Monica Chintala

Agree, If the enum values ever change, or another enum type is added, the parser/serializer silently break with no compiler error and enum should be in public files

File third_party/blink/renderer/core/permissions_policy/document_policy_parser_test.cc
Line 397, Patchset 2 (Latest): //
// Enum feature tests.
//
{
"ParseEnumFeatureEager",
"f-enum=eager",
/* parsed_policy */
{
/* feature_state */ {{kEnumFeature, PolicyValue::CreateEnum(1)}},
/* endpoint_map */ {},
},
/* messages */ {},
},
{
"ParseEnumFeatureLazy",
"f-enum=lazy",
/* parsed_policy */
{
/* feature_state */ {{kEnumFeature, PolicyValue::CreateEnum(2)}},
/* endpoint_map */ {},
},
/* messages */ {},
Monica Chintala . unresolved

should we also have test coverage for verifying js-profiling-mode without a value ie., kNone default to check it throws warning

Line 419, Patchset 2 (Latest): },
Monica Chintala . unresolved

Can we also have WPT tests under external/wpt/js-self-profiling/without-document-policy?

Open in Gerrit

Related details

Attention is currently required from:
  • Thomas BERTET
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: If3e61ee55318b46bf2b07a16d113a5a388f7bf67
Gerrit-Change-Number: 7575656
Gerrit-PatchSet: 2
Gerrit-Owner: Thomas BERTET <thomas...@gmail.com>
Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
Gerrit-CC: Luna Lu <loon...@chromium.org>
Gerrit-CC: Michal Mocny <mmo...@chromium.org>
Gerrit-CC: Monica Chintala <moni...@microsoft.com>
Gerrit-Attention: Thomas BERTET <thomas...@gmail.com>
Gerrit-Comment-Date: Tue, 24 Feb 2026 18:21:50 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Michal Mocny <mmo...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Monica Chintala (Gerrit)

unread,
Feb 24, 2026, 1:25:07 PMFeb 24
to Thomas BERTET, Michal Mocny, Chromium Metrics Reviews, chromium...@chromium.org, Luna Lu, asvitkine...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, core-timi...@chromium.org, iclella...@chromium.org, ipc-securi...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, speed-metrics...@chromium.org
Attention needed from Thomas BERTET

Monica Chintala added 1 comment

Patchset-level comments
Monica Chintala . resolved

FYI, I am working on enabling profiling in [Workers](https://chromium-review.googlesource.com/c/chromium/src/+/7546208). We should also make this mode should works in Workers too.

Gerrit-Comment-Date: Tue, 24 Feb 2026 18:25:01 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Thomas Bertet (Gerrit)

unread,
Feb 25, 2026, 3:04:06 AMFeb 25
to Thomas BERTET, Monica Chintala, Michal Mocny, Chromium Metrics Reviews, chromium...@chromium.org, Luna Lu, asvitkine...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, core-timi...@chromium.org, iclella...@chromium.org, ipc-securi...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, speed-metrics...@chromium.org
Attention needed from Thomas BERTET

Thomas Bertet added 1 comment

Patchset-level comments
Monica Chintala . resolved

FYI, I am working on enabling profiling in [Workers](https://chromium-review.googlesource.com/c/chromium/src/+/7546208). We should also make this mode should works in Workers too.

Thomas Bertet

Oh that's great news! Thank you for sharing and for taking a look on this patchset!

Open in Gerrit

Related details

Attention is currently required from:
  • Thomas BERTET
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: If3e61ee55318b46bf2b07a16d113a5a388f7bf67
Gerrit-Change-Number: 7575656
Gerrit-PatchSet: 2
Gerrit-Owner: Thomas BERTET <thomas...@gmail.com>
Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
Gerrit-CC: Luna Lu <loon...@chromium.org>
Gerrit-CC: Michal Mocny <mmo...@chromium.org>
Gerrit-CC: Monica Chintala <moni...@microsoft.com>
Gerrit-CC: Thomas Bertet <thomas...@datadoghq.com>
Gerrit-Attention: Thomas BERTET <thomas...@gmail.com>
Gerrit-Comment-Date: Wed, 25 Feb 2026 08:03:46 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Monica Chintala <moni...@microsoft.com>
satisfied_requirement
unsatisfied_requirement
open
diffy

Thomas Bertet (Gerrit)

unread,
Feb 26, 2026, 5:02:22 AMFeb 26
to Thomas BERTET, AyeAye, Monica Chintala, Michal Mocny, Chromium Metrics Reviews, chromium...@chromium.org, Luna Lu, blink-revie...@chromium.org, asvitkine...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, core-timi...@chromium.org, iclella...@chromium.org, ipc-securi...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, speed-metrics...@chromium.org
Attention needed from Michal Mocny, Monica Chintala and Thomas BERTET

Thomas Bertet added 12 comments

Patchset-level comments
File-level comment, Patchset 3 (Latest):
Thomas Bertet . resolved

Address review comments: API cleanup, lazy V8 init, parser tests, WPT tests..

File third_party/blink/common/permissions_policy/document_policy.cc
Line 40, Patchset 2:const char* EnumValueToToken(int32_t value) {
Michal Mocny . resolved

Style on returning char* based strings...

Monica Chintala

Chromium style prefers std::string_view (or absl::string_view) over const char* for string returns. Also, nullptr is fragile, CHECK(token) would crash. Using std::optional<std::string_view> is better

Thomas Bertet

Acknowledged

Line 58, Patchset 2: const char* token = EnumValueToToken(value.IntValue());
Michal Mocny . resolved

So *any* enum will map to this specific enum values?

This feels fine as a local prototype, but I think you need some machinery to handle mapping the right enum type to the right enum strings. As a bad alternative, find a way to break this loudly when the next enum type is introduced so the next person has to deal with it...

Thomas Bertet

Acknowledged

File third_party/blink/renderer/core/permissions_policy/document_policy_features.json5
Line 108, Patchset 2: default_value: "0",
Michal Mocny . unresolved

The `default_value` of `0` corresponds to `JSProfilingMode::kNone`. However, there isn't a corresponding token in `TokenToEnumValue` (line 29 in `document_policy_parser.cc`) or `EnumValueToToken` (line 40 in `document_policy.cc`) to represent `kNone`.

This means that while `kNone` is the default, it cannot be explicitly set via a Document Policy header. Only `eager` and `lazy` can be specified.

Is this intentional? If so, it might be worth adding a comment to clarify that `kNone` is an implicit default and cannot be set explicitly via the policy header, to avoid confusion if someone tries to write `js-profiling-mode='none'`.

Thomas Bertet

I think I would find the `none` enum value an interesting idea, even though it's not in the specification update yet. I guess we can do that in a the meantime.
In the next patchset, I've added a `none` enum value, let me know if you feel that's good!

File third_party/blink/renderer/core/permissions_policy/document_policy_parser.cc
Line 29, Patchset 2:std::optional<int32_t> TokenToEnumValue(const std::string& token) {
Michal Mocny . unresolved

Hmm, we go from enum string to enum value back to enum string later... Ideally these to_string and from_string would be defined together, indeally in `profiler_group.h`?

(Also this implementation has the same issue as the other one in that its generic for all enums but specific to this particular enum.)

---

WDYT about adding a second enum directly to `third_party/blink/public/mojom/permissions_policy/document_policy_feature.mojom`?

And then use `document_policy_features.json5`?

...that might need some build file pre-processing changes to support enum *values*, but I think this feels like the correct approach.

(I'm totally new to this area, but this is what I found with a bit of digging.)

Monica Chintala

Agree, If the enum values ever change, or another enum type is added, the parser/serializer silently break with no compiler error and enum should be in public files

Thomas Bertet

I've tentatively updated the code to follow your recommendation. Let me know what you think!

File third_party/blink/renderer/core/permissions_policy/document_policy_parser_test.cc

// Enum feature tests.
//
{
"ParseEnumFeatureEager",
"f-enum=eager",
/* parsed_policy */
{
/* feature_state */ {{kEnumFeature, PolicyValue::CreateEnum(1)}},
/* endpoint_map */ {},
},
/* messages */ {},
},
{
"ParseEnumFeatureLazy",
"f-enum=lazy",
/* parsed_policy */
{
/* feature_state */ {{kEnumFeature, PolicyValue::CreateEnum(2)}},
/* endpoint_map */ {},
},
/* messages */ {},
Monica Chintala . resolved

should we also have test coverage for verifying js-profiling-mode without a value ie., kNone default to check it throws warning

Thomas Bertet

Acknowledged

Line 419, Patchset 2: },
Monica Chintala . resolved

Can we also have WPT tests under external/wpt/js-self-profiling/without-document-policy?

Thomas Bertet

Acknowledged

File third_party/blink/renderer/core/timing/profiler_group.h
Line 89, Patchset 2: void InitV8Profiler(v8::CpuProfilingLoggingMode logging_mode);
Michal Mocny . resolved

Similarly here, can we just have one variant?

Thomas Bertet

Acknowledged

Line 76, Patchset 2: void OnProfilingContextAddedLazy(ExecutionContext* context);
Michal Mocny . resolved

Nit: Just add a mode arg to the method above, with a default of eager?

Thomas Bertet

Acknowledged

File third_party/blink/renderer/core/timing/profiler_group.cc
Line 80, Patchset 2: int32_t enum_val = mode_value.IntValue();

if (enum_val == static_cast<int32_t>(JSProfilingMode::kEager) ||
enum_val == static_cast<int32_t>(JSProfilingMode::kLazy)) {
return static_cast<JSProfilingMode>(enum_val);
}
Michal Mocny . resolved

Nit: style, but let's iterate on the design of the enum first

Thomas Bertet

Acknowledged

Michal Mocny . unresolved

If `GetProfilingMode()` returns `kNone`, it means that `IsFeatureEnabled(kJSProfiling)` has already returned `false`. Therefore, the `IsFeatureEnabled` check on line 102 will also be `false`, making this `return true;` unreachable.

Additionally, my understanding is that `IsFeatureEnabled` do some logging/reporting and the GetProfilingMode would skip its check if the new profiling mode was supplied without the general profiling policy.

---

If kJSProfiling is still required alongside kJSProfilingMode, I think you could swap the order of feature detection and if kJSProfiling is disabled always return kNone, otherwise return provided policy or default to eager.

If kJSProfiling is optional... maybe the current implementation is fine, but perhaps add a comment here?

Thomas Bertet

I've reworked the logic to avoid unreachable return. Let me know what you think!

Line 177, Patchset 2: context_observers_.insert(observer);
Michal Mocny . unresolved

THis will require expert review, but, it surpises me that you can init via `InitV8Profiler(v8::kLazyLogging);` but that we choose not to do so.

So you can have tri-state:

  • Un-init
  • Init w/ Lazy
  • Init w/ Eager

This document policy adds 2 modes and picks (1) and (3).

(But it also creates a `ProfilingContextObserver` eagerly, which afaik isn't needed until you start to profile? Not sure.)

Thomas Bertet

Right! It makes sense to me to simplify this. I've reworked this to get rid of the `OnProfilingContextAddedLazy` and initialize V8 with `kLazyLogging`

Open in Gerrit

Related details

Attention is currently required from:
  • Michal Mocny
  • Monica Chintala
  • Thomas BERTET
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: If3e61ee55318b46bf2b07a16d113a5a388f7bf67
Gerrit-Change-Number: 7575656
Gerrit-PatchSet: 3
Gerrit-Owner: Thomas BERTET <thomas...@gmail.com>
Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
Gerrit-CC: Luna Lu <loon...@chromium.org>
Gerrit-CC: Michal Mocny <mmo...@chromium.org>
Gerrit-CC: Monica Chintala <moni...@microsoft.com>
Gerrit-CC: Thomas Bertet <thomas...@datadoghq.com>
Gerrit-Attention: Michal Mocny <mmo...@chromium.org>
Gerrit-Attention: Monica Chintala <moni...@microsoft.com>
Gerrit-Attention: Thomas BERTET <thomas...@gmail.com>
Gerrit-Comment-Date: Thu, 26 Feb 2026 10:02:03 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Monica Chintala <moni...@microsoft.com>
Comment-In-Reply-To: Michal Mocny <mmo...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Monica Chintala (Gerrit)

unread,
Mar 3, 2026, 12:32:21 PMMar 3
to Thomas BERTET, AyeAye, Thomas Bertet, Michal Mocny, Chromium Metrics Reviews, chromium...@chromium.org, Luna Lu, blink-revie...@chromium.org, asvitkine...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, core-timi...@chromium.org, iclella...@chromium.org, ipc-securi...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, speed-metrics...@chromium.org
Attention needed from Michal Mocny and Thomas BERTET

Monica Chintala added 8 comments

File third_party/blink/public/common/permissions_policy/document_policy_enum_values.h
Line 30, Patchset 3 (Latest): return 0;
Monica Chintala . unresolved

Here and other places in the file, adding inline comments like // JSProfilingMode::kNone
next to each value would help readability

Line 1, Patchset 3 (Latest):// Copyright 2025 The Chromium Authors
Monica Chintala . unresolved

nit: 2026?

File third_party/blink/renderer/core/timing/profiler_group.h
Line 71, Patchset 3 (Latest): // profiler is ready during its lifetime. In kEager mode the V8 profiler is
// initialized immediately; in kLazy mode initialization is deferred until
// the first CreateProfiler() call.
Monica Chintala . unresolved

Should this be?

   // In kEager mode the V8 profiler is initialized with eager logging
// in kLazy mode it is initialized with lazy logging (JIT event
// enumeration deferred until StartProfiling).
File third_party/blink/renderer/core/timing/profiler_group.cc
Line 82, Patchset 3 (Latest): return static_cast<JSProfilingMode>(mode_value.IntValue());
Monica Chintala . unresolved

If mode_value.IntValue() is ever a value outside {0,1,2} this produces an undefined JSProfilingMode. A defensive switch or range check would be safer:

   int32_t v = mode_value.IntValue();
if (v >= 0 && v <= static_cast<int32_t>(JSProfilingMode::kLazy))
return static_cast<JSProfilingMode>(v);
return JSProfilingMode::kNone;
Line 92, Patchset 3 (Latest):bool ProfilerGroup::CanProfile(LocalDOMWindow* local_window,
Monica Chintala . unresolved

Also a WPT for policy interaction (header with js-profiling, js-profiling-mode=none) to confirm js-profiling-mode is prioritized.

Line 97, Patchset 3 (Latest): // Check the new js-profiling-mode enum policy first.
Monica Chintala . unresolved

may be brief comment on explaining why it re-fetches rather than calling GetProfilingMode() would help for later

Line 177, Patchset 3 (Latest): DCHECK(cpu_profiler_);
Monica Chintala . unresolved

nit: If mode == kNone and cpu_profiler_ is null, neither modes initializes it but this dcheck fires. The caller guards against kNone, but adding a DCHECK_NE(mode, JSProfilingMode::kNone) at function entry would make the contract explicit.

File third_party/blink/web_tests/external/wpt/js-self-profiling/js-profiling-mode/none.https.html
Line 1, Patchset 3 (Latest):<!DOCTYPE html>
Monica Chintala . unresolved

Should we also add a test for invalid enum value (js-profiling-mode=unknown) to verify profiling is blocked?

Open in Gerrit

Related details

Attention is currently required from:
  • Michal Mocny
  • Thomas BERTET
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: If3e61ee55318b46bf2b07a16d113a5a388f7bf67
Gerrit-Change-Number: 7575656
Gerrit-PatchSet: 3
Gerrit-Owner: Thomas BERTET <thomas...@gmail.com>
Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
Gerrit-CC: Luna Lu <loon...@chromium.org>
Gerrit-CC: Michal Mocny <mmo...@chromium.org>
Gerrit-CC: Monica Chintala <moni...@microsoft.com>
Gerrit-CC: Thomas Bertet <thomas...@datadoghq.com>
Gerrit-Attention: Michal Mocny <mmo...@chromium.org>
Gerrit-Attention: Thomas BERTET <thomas...@gmail.com>
Gerrit-Comment-Date: Tue, 03 Mar 2026 17:32:12 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Monica Chintala (Gerrit)

unread,
Mar 6, 2026, 7:22:39 PMMar 6
to Thomas BERTET, Liang Zhao, AyeAye, Thomas Bertet, Michal Mocny, Chromium Metrics Reviews, chromium...@chromium.org, Luna Lu, blink-revie...@chromium.org, asvitkine...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, core-timi...@chromium.org, iclella...@chromium.org, ipc-securi...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, speed-metrics...@chromium.org
Attention needed from Michal Mocny and Thomas BERTET

Monica Chintala added 1 comment

Patchset-level comments
Monica Chintala . resolved

Adding lzhao@ who will be reviewing this work while I'm on leave for next couple of months.

Open in Gerrit

Related details

Attention is currently required from:
  • Michal Mocny
  • Thomas BERTET
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: If3e61ee55318b46bf2b07a16d113a5a388f7bf67
Gerrit-Change-Number: 7575656
Gerrit-PatchSet: 3
Gerrit-Owner: Thomas BERTET <thomas...@gmail.com>
Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
Gerrit-CC: Liang Zhao <lz...@microsoft.com>
Gerrit-CC: Luna Lu <loon...@chromium.org>
Gerrit-CC: Michal Mocny <mmo...@chromium.org>
Gerrit-CC: Monica Chintala <moni...@microsoft.com>
Gerrit-CC: Thomas Bertet <thomas...@datadoghq.com>
Gerrit-Attention: Michal Mocny <mmo...@chromium.org>
Gerrit-Attention: Thomas BERTET <thomas...@gmail.com>
Gerrit-Comment-Date: Sat, 07 Mar 2026 00:22:25 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Thomas Bertet (Gerrit)

unread,
Mar 25, 2026, 9:35:00 AMMar 25
to Thomas BERTET, Liang Zhao, AyeAye, Monica Chintala, Michal Mocny, Chromium Metrics Reviews, chromium...@chromium.org, Luna Lu, blink-revie...@chromium.org, asvitkine...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, core-timi...@chromium.org, iclella...@chromium.org, ipc-securi...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, speed-metrics...@chromium.org
Attention needed from Michal Mocny, Monica Chintala and Thomas BERTET

Thomas Bertet added 9 comments

Patchset-level comments
File-level comment, Patchset 4 (Latest):
Thomas Bertet . resolved

Following the review from Monica, Patchset 4 is fixing a bug in CanProfile where js-profiling-mode=none could be overridden by a concurrent js-profiling header, causing a DCHECK crash due to the V8 profiler never being initialized. The fix checks whether the enum policy is explicitly present and, if so, skips the legacy boolean policy fallback entirely.
Also added WPT tests covering the none-overrides-legacy case and unknown/invalid token handling.

File third_party/blink/public/common/permissions_policy/document_policy_enum_values.h
Line 30, Patchset 3: return 0;
Monica Chintala . resolved

Here and other places in the file, adding inline comments like // JSProfilingMode::kNone
next to each value would help readability

Thomas Bertet

Done

Line 1, Patchset 3:// Copyright 2025 The Chromium Authors
Monica Chintala . resolved

nit: 2026?

Thomas Bertet

Done

File third_party/blink/renderer/core/timing/profiler_group.h
Line 71, Patchset 3: // profiler is ready during its lifetime. In kEager mode the V8 profiler is

// initialized immediately; in kLazy mode initialization is deferred until
// the first CreateProfiler() call.
Monica Chintala . resolved

Should this be?

   // In kEager mode the V8 profiler is initialized with eager logging
// in kLazy mode it is initialized with lazy logging (JIT event
// enumeration deferred until StartProfiling).
Thomas Bertet

Done

File third_party/blink/renderer/core/timing/profiler_group.cc
Line 82, Patchset 3: return static_cast<JSProfilingMode>(mode_value.IntValue());
Monica Chintala . resolved

If mode_value.IntValue() is ever a value outside {0,1,2} this produces an undefined JSProfilingMode. A defensive switch or range check would be safer:

   int32_t v = mode_value.IntValue();
if (v >= 0 && v <= static_cast<int32_t>(JSProfilingMode::kLazy))
return static_cast<JSProfilingMode>(v);
return JSProfilingMode::kNone;
Thomas Bertet

Done

Line 92, Patchset 3:bool ProfilerGroup::CanProfile(LocalDOMWindow* local_window,
Monica Chintala . resolved

Also a WPT for policy interaction (header with js-profiling, js-profiling-mode=none) to confirm js-profiling-mode is prioritized.

Thomas Bertet

Done

Line 97, Patchset 3: // Check the new js-profiling-mode enum policy first.
Monica Chintala . resolved

may be brief comment on explaining why it re-fetches rather than calling GetProfilingMode() would help for later

Thomas Bertet

Done

Line 177, Patchset 3: DCHECK(cpu_profiler_);
Monica Chintala . resolved

nit: If mode == kNone and cpu_profiler_ is null, neither modes initializes it but this dcheck fires. The caller guards against kNone, but adding a DCHECK_NE(mode, JSProfilingMode::kNone) at function entry would make the contract explicit.

Thomas Bertet

Done

File third_party/blink/web_tests/external/wpt/js-self-profiling/js-profiling-mode/none.https.html
Line 1, Patchset 3:<!DOCTYPE html>
Monica Chintala . resolved

Should we also add a test for invalid enum value (js-profiling-mode=unknown) to verify profiling is blocked?

Thomas Bertet

Done

Open in Gerrit

Related details

Attention is currently required from:
  • Michal Mocny
  • Monica Chintala
  • Thomas BERTET
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: If3e61ee55318b46bf2b07a16d113a5a388f7bf67
Gerrit-Change-Number: 7575656
Gerrit-PatchSet: 4
Gerrit-Owner: Thomas BERTET <thomas...@gmail.com>
Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
Gerrit-CC: Liang Zhao <lz...@microsoft.com>
Gerrit-CC: Luna Lu <loon...@chromium.org>
Gerrit-CC: Michal Mocny <mmo...@chromium.org>
Gerrit-CC: Monica Chintala <moni...@microsoft.com>
Gerrit-CC: Thomas Bertet <thomas...@datadoghq.com>
Gerrit-Attention: Monica Chintala <moni...@microsoft.com>
Gerrit-Attention: Michal Mocny <mmo...@chromium.org>
Gerrit-Attention: Thomas BERTET <thomas...@gmail.com>
Gerrit-Comment-Date: Wed, 25 Mar 2026 13:34:46 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Monica Chintala <moni...@microsoft.com>
satisfied_requirement
unsatisfied_requirement
open
diffy

Liang Zhao (Gerrit)

unread,
Apr 1, 2026, 6:53:19 PMApr 1
to Thomas BERTET, AyeAye, Thomas Bertet, Monica Chintala, Michal Mocny, Chromium Metrics Reviews, chromium...@chromium.org, Luna Lu, blink-revie...@chromium.org, asvitkine...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, core-timi...@chromium.org, iclella...@chromium.org, ipc-securi...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, speed-metrics...@chromium.org
Attention needed from Michal Mocny, Monica Chintala and Thomas BERTET

Liang Zhao added 4 comments

File third_party/blink/renderer/core/timing/profiler_group.cc
Line 76, Patchset 4 (Parent): if (execution_context->IsDedicatedWorkerGlobalScope() &&
!RuntimeEnabledFeatures::DocumentPolicyInDedicatedWorkerEnabled()) {
if (exception_state) {
exception_state->ThrowDOMException(
DOMExceptionCode::kNotSupportedError,
"Document Policy is not enabled for this context.");
}
return false;
}
Liang Zhao . unresolved

Should we still keep this block of code?

Line 102, Patchset 4 (Latest): // Re-fetch the raw policy value rather than calling GetProfilingMode() so we
// can distinguish "enum policy explicitly present" from "absent/legacy". If
// the enum policy is present we honour it exclusively (even kNone) and skip
// the legacy kJSProfiling check entirely. If it is absent we fall back to
Liang Zhao . unresolved

GetProfilingMode() also ignores legacy kJSProfiling when kJSProfilingMode exits. Don't see why we could not simply call GetProfilingMode() and allow profiling when it is not kNone, as we do in InitializeIfEnabled(). Actually, it would be good to keep CanProfile and InitializeIfEnabled in sync.

Line 133, Patchset 4 (Latest): JSProfilingMode mode = GetProfilingMode(execution_context);
Liang Zhao . unresolved

Do we need to change flow of this function? As CanProfile() has extra checks like for dedicated worker, it might be better to keep the overall code and just add GetProfilingMode() before calling OnProfilingContextAdded.

File third_party/blink/web_tests/external/wpt/js-self-profiling/js-profiling-mode/eager.https.html
Line 10, Patchset 4 (Latest): const profiler = new Profiler({
Liang Zhao . unresolved

I don't see difference between eager and lazy mode. Is there any way to show the difference?

Gerrit-Comment-Date: Wed, 01 Apr 2026 22:53:09 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Thomas Bertet (Gerrit)

unread,
Apr 8, 2026, 6:10:01 AMApr 8
to Thomas BERTET, Liang Zhao, AyeAye, Monica Chintala, Michal Mocny, Chromium Metrics Reviews, chromium...@chromium.org, Luna Lu, blink-revie...@chromium.org, asvitkine...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, core-timi...@chromium.org, iclella...@chromium.org, ipc-securi...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, speed-metrics...@chromium.org
Attention needed from Liang Zhao, Michal Mocny, Monica Chintala and Thomas BERTET

Thomas Bertet added 4 comments

File third_party/blink/renderer/core/timing/profiler_group.cc
Line 76, Patchset 4 (Parent): if (execution_context->IsDedicatedWorkerGlobalScope() &&
!RuntimeEnabledFeatures::DocumentPolicyInDedicatedWorkerEnabled()) {
if (exception_state) {
exception_state->ThrowDOMException(
DOMExceptionCode::kNotSupportedError,
"Document Policy is not enabled for this context.");
}
return false;
}
Liang Zhao . resolved

Should we still keep this block of code?

Thomas Bertet

Oh totally. Re-adding it, and making sure it's still used too in `InitializeIfEnabled`

Line 102, Patchset 4: // Re-fetch the raw policy value rather than calling GetProfilingMode() so we

// can distinguish "enum policy explicitly present" from "absent/legacy". If
// the enum policy is present we honour it exclusively (even kNone) and skip
// the legacy kJSProfiling check entirely. If it is absent we fall back to
Liang Zhao . resolved

GetProfilingMode() also ignores legacy kJSProfiling when kJSProfilingMode exits. Don't see why we could not simply call GetProfilingMode() and allow profiling when it is not kNone, as we do in InitializeIfEnabled(). Actually, it would be good to keep CanProfile and InitializeIfEnabled in sync.

Thomas Bertet

Acknowledged

Line 133, Patchset 4: JSProfilingMode mode = GetProfilingMode(execution_context);
Liang Zhao . resolved

Do we need to change flow of this function? As CanProfile() has extra checks like for dedicated worker, it might be better to keep the overall code and just add GetProfilingMode() before calling OnProfilingContextAdded.

Thomas Bertet

You are right, I re-added the DedicatedWorker check and used `CanProfile` in `InitializeIfEnabled` so that they are both using the same path. WDYT ?

File third_party/blink/web_tests/external/wpt/js-self-profiling/js-profiling-mode/eager.https.html
Line 10, Patchset 4: const profiler = new Profiler({
Liang Zhao . unresolved

I don't see difference between eager and lazy mode. Is there any way to show the difference?

Thomas Bertet

The tests are intentionally structured the same way — they verify that the mode is recognised by the browser and that the API is usable, which would fail if, e.g., initialisation were broken for that mode. The eager vs. lazy difference is covered at the unit test level in profiler_group_test.cc. Do you think we need to do something more here ?

Open in Gerrit

Related details

Attention is currently required from:
  • Liang Zhao
Gerrit-Attention: Liang Zhao <lz...@microsoft.com>
Gerrit-Attention: Monica Chintala <moni...@microsoft.com>
Gerrit-Attention: Michal Mocny <mmo...@chromium.org>
Gerrit-Attention: Thomas BERTET <thomas...@gmail.com>
Gerrit-Comment-Date: Wed, 08 Apr 2026 10:09:48 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Liang Zhao <lz...@microsoft.com>
satisfied_requirement
unsatisfied_requirement
open
diffy

Liang Zhao (Gerrit)

unread,
Apr 8, 2026, 12:39:38 PMApr 8
to Thomas BERTET, AyeAye, Thomas Bertet, Monica Chintala, Michal Mocny, Chromium Metrics Reviews, chromium...@chromium.org, Luna Lu, blink-revie...@chromium.org, asvitkine...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, core-timi...@chromium.org, iclella...@chromium.org, ipc-securi...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, speed-metrics...@chromium.org
Attention needed from Michal Mocny, Monica Chintala and Thomas BERTET

Liang Zhao added 4 comments

File third_party/blink/renderer/core/timing/profiler_group.cc
Line 114, Patchset 5 (Latest): // Profiling is disabled. If the enum policy is absent, re-check the legacy
// kJSProfiling policy with report_options so violation reports are emitted.
PolicyValue mode_value = execution_context->GetDocumentPolicyValue(
mojom::blink::DocumentPolicyFeature::kJSProfilingMode);
if (mode_value.Type() != mojom::blink::PolicyValueType::kEnum) {
execution_context->IsFeatureEnabled(
mojom::blink::DocumentPolicyFeature::kJSProfiling, report_options);
}
Liang Zhao . unresolved

Just a thought, if we add a ReportOptions report_options parameter to GetProfilingMode, we don't have to do this check here again. But it could feel strange if a Get mothod has side effects. So, unless we consider renaming it to something like CheckProfileMode, just a thought.

Line 136, Patchset 5 (Latest): if (mode == JSProfilingMode::kNone) {
return;
}
Liang Zhao . unresolved

This is after CanProfile returning true. We probably should CHECK that mode is not kNone instead of siliently returning. As OnProfilingContextAdded already has a CHECK for mode, we could simply remove these.

File third_party/blink/renderer/core/timing/profiler_group_test.cc
Line 226, Patchset 5 (Latest):// kLazyLogging) and that CreateProfiler succeeds without additional init.
Liang Zhao . unresolved

How is this verified and what's the observed differences between this test and CreateProfiler?

File third_party/blink/web_tests/external/wpt/js-self-profiling/js-profiling-mode/eager.https.html
Line 10, Patchset 4: const profiler = new Profiler({
Liang Zhao . unresolved

I don't see difference between eager and lazy mode. Is there any way to show the difference?

Thomas Bertet

The tests are intentionally structured the same way — they verify that the mode is recognised by the browser and that the API is usable, which would fail if, e.g., initialisation were broken for that mode. The eager vs. lazy difference is covered at the unit test level in profiler_group_test.cc. Do you think we need to do something more here ?

Liang Zhao

Normally, we want to verify differences for different input. If there is no observable difference, using internal browser tests or unit tests are OK. Feel free to resolve this comment if it is not possible to observe the difference.

Open in Gerrit

Related details

Attention is currently required from:
  • Michal Mocny
  • Monica Chintala
  • Thomas BERTET
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: If3e61ee55318b46bf2b07a16d113a5a388f7bf67
Gerrit-Change-Number: 7575656
Gerrit-PatchSet: 5
Gerrit-Owner: Thomas BERTET <thomas...@gmail.com>
Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
Gerrit-CC: Liang Zhao <lz...@microsoft.com>
Gerrit-CC: Luna Lu <loon...@chromium.org>
Gerrit-CC: Michal Mocny <mmo...@chromium.org>
Gerrit-CC: Monica Chintala <moni...@microsoft.com>
Gerrit-CC: Thomas Bertet <thomas...@datadoghq.com>
Gerrit-Attention: Monica Chintala <moni...@microsoft.com>
Gerrit-Attention: Michal Mocny <mmo...@chromium.org>
Gerrit-Attention: Thomas BERTET <thomas...@gmail.com>
Gerrit-Comment-Date: Wed, 08 Apr 2026 16:39:27 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Liang Zhao <lz...@microsoft.com>
Comment-In-Reply-To: Thomas Bertet <thomas...@datadoghq.com>
satisfied_requirement
unsatisfied_requirement
open
diffy

Thomas Bertet (Gerrit)

unread,
Apr 9, 2026, 4:11:52 AMApr 9
to Thomas BERTET, Liang Zhao, AyeAye, Monica Chintala, Michal Mocny, Chromium Metrics Reviews, chromium...@chromium.org, Luna Lu, blink-revie...@chromium.org, asvitkine...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, core-timi...@chromium.org, iclella...@chromium.org, ipc-securi...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, speed-metrics...@chromium.org
Attention needed from Liang Zhao, Michal Mocny, Monica Chintala and Thomas BERTET

Thomas Bertet added 4 comments

File third_party/blink/renderer/core/timing/profiler_group.cc
Line 114, Patchset 5: // Profiling is disabled. If the enum policy is absent, re-check the legacy

// kJSProfiling policy with report_options so violation reports are emitted.
PolicyValue mode_value = execution_context->GetDocumentPolicyValue(
mojom::blink::DocumentPolicyFeature::kJSProfilingMode);
if (mode_value.Type() != mojom::blink::PolicyValueType::kEnum) {
execution_context->IsFeatureEnabled(
mojom::blink::DocumentPolicyFeature::kJSProfiling, report_options);
}
Liang Zhao . resolved

Just a thought, if we add a ReportOptions report_options parameter to GetProfilingMode, we don't have to do this check here again. But it could feel strange if a Get mothod has side effects. So, unless we consider renaming it to something like CheckProfileMode, just a thought.

Thomas Bertet

Thanks for the suggestion. The reason we can't simply pass `report_options` into `GetProfilingMode()` is - as you pointed out - that it would conflate two separate concerns: `mode` selection (used by `InitializeIfEnabled` at context init time, where no violation reporting is wanted) and authorization gating (used by `CanProfile` when the JS API is called).
Adding `report_options` with a default of `kDoNotReport` would work mechanically, but it would make `GetProfilingMode` responsible for a side effect that only makes sense in one of its two call sites. I think keeping the re-fetch in `CanProfile` is cleaner.

Line 136, Patchset 5: if (mode == JSProfilingMode::kNone) {
return;
}
Liang Zhao . resolved

This is after CanProfile returning true. We probably should CHECK that mode is not kNone instead of siliently returning. As OnProfilingContextAdded already has a CHECK for mode, we could simply remove these.

Thomas Bertet

Acknowledged

File third_party/blink/renderer/core/timing/profiler_group_test.cc
Line 226, Patchset 5:// kLazyLogging) and that CreateProfiler succeeds without additional init.
Liang Zhao . resolved

How is this verified and what's the observed differences between this test and CreateProfiler?

Thomas Bertet

You're right that this test doesn't actually verify the V8 logging mode — `kLazyLogging` vs `kEagerLogging` is not observable through the public v8::CpuProfiler API, so we can't assert it directly.
The test is a smoke test verifying that `OnProfilingContextAdded(kLazy)` initialises the profiler and that `CreateProfiler` succeeds on the lazy path. I've renamed it to `LazyModeAllowsProfiling` and updated the comment to make that scope explicit. Would that work for you ? Or do you think that's not needed maybe ?

File third_party/blink/web_tests/external/wpt/js-self-profiling/js-profiling-mode/eager.https.html
Line 10, Patchset 4: const profiler = new Profiler({
Liang Zhao . unresolved

I don't see difference between eager and lazy mode. Is there any way to show the difference?

Thomas Bertet

The tests are intentionally structured the same way — they verify that the mode is recognised by the browser and that the API is usable, which would fail if, e.g., initialisation were broken for that mode. The eager vs. lazy difference is covered at the unit test level in profiler_group_test.cc. Do you think we need to do something more here ?

Liang Zhao

Normally, we want to verify differences for different input. If there is no observable difference, using internal browser tests or unit tests are OK. Feel free to resolve this comment if it is not possible to observe the difference.

Thomas Bertet

Do you mean we should remove the new `lazy` wpt test then since we can't really observe a difference ?

Open in Gerrit

Related details

Attention is currently required from:
  • Liang Zhao
Gerrit-Attention: Liang Zhao <lz...@microsoft.com>
Gerrit-Attention: Monica Chintala <moni...@microsoft.com>
Gerrit-Attention: Michal Mocny <mmo...@chromium.org>
Gerrit-Attention: Thomas BERTET <thomas...@gmail.com>
Gerrit-Comment-Date: Thu, 09 Apr 2026 08:11:38 +0000
satisfied_requirement
unsatisfied_requirement
open
diffy

Liang Zhao (Gerrit)

unread,
Apr 9, 2026, 12:44:48 PMApr 9
to Thomas BERTET, AyeAye, Thomas Bertet, Monica Chintala, Michal Mocny, Chromium Metrics Reviews, chromium...@chromium.org, Luna Lu, blink-revie...@chromium.org, asvitkine...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, core-timi...@chromium.org, iclella...@chromium.org, ipc-securi...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, speed-metrics...@chromium.org
Attention needed from Michal Mocny, Monica Chintala, Thomas BERTET and Thomas Bertet

Liang Zhao added 2 comments

File third_party/blink/renderer/core/timing/profiler_group_test.cc
Line 226, Patchset 5:// kLazyLogging) and that CreateProfiler succeeds without additional init.
Liang Zhao . resolved

How is this verified and what's the observed differences between this test and CreateProfiler?

Thomas Bertet

You're right that this test doesn't actually verify the V8 logging mode — `kLazyLogging` vs `kEagerLogging` is not observable through the public v8::CpuProfiler API, so we can't assert it directly.
The test is a smoke test verifying that `OnProfilingContextAdded(kLazy)` initialises the profiler and that `CreateProfiler` succeeds on the lazy path. I've renamed it to `LazyModeAllowsProfiling` and updated the comment to make that scope explicit. Would that work for you ? Or do you think that's not needed maybe ?

Liang Zhao

Code owner might have better suggestions. I think that we still want to have a test to verify that the handling of the lazy mode works from the observable behavior. If we really could not observe the difference between lazy and eager mode, a comment might be helpful.

File third_party/blink/web_tests/external/wpt/js-self-profiling/js-profiling-mode/eager.https.html
Line 10, Patchset 4: const profiler = new Profiler({
Liang Zhao . unresolved

I don't see difference between eager and lazy mode. Is there any way to show the difference?

Thomas Bertet

The tests are intentionally structured the same way — they verify that the mode is recognised by the browser and that the API is usable, which would fail if, e.g., initialisation were broken for that mode. The eager vs. lazy difference is covered at the unit test level in profiler_group_test.cc. Do you think we need to do something more here ?

Liang Zhao

Normally, we want to verify differences for different input. If there is no observable difference, using internal browser tests or unit tests are OK. Feel free to resolve this comment if it is not possible to observe the difference.

Thomas Bertet

Do you mean we should remove the new `lazy` wpt test then since we can't really observe a difference ?

Liang Zhao

I think that we still want the test to ensure that at least handling of the enum works.

Open in Gerrit

Related details

Attention is currently required from:
  • Michal Mocny
  • Monica Chintala
  • Thomas BERTET
  • Thomas Bertet
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: If3e61ee55318b46bf2b07a16d113a5a388f7bf67
Gerrit-Change-Number: 7575656
Gerrit-PatchSet: 6
Gerrit-Owner: Thomas BERTET <thomas...@gmail.com>
Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
Gerrit-CC: Liang Zhao <lz...@microsoft.com>
Gerrit-CC: Luna Lu <loon...@chromium.org>
Gerrit-CC: Michal Mocny <mmo...@chromium.org>
Gerrit-CC: Monica Chintala <moni...@microsoft.com>
Gerrit-CC: Thomas Bertet <thomas...@datadoghq.com>
Gerrit-Attention: Monica Chintala <moni...@microsoft.com>
Gerrit-Attention: Michal Mocny <mmo...@chromium.org>
Gerrit-Attention: Thomas Bertet <thomas...@datadoghq.com>
Gerrit-Attention: Thomas BERTET <thomas...@gmail.com>
Gerrit-Comment-Date: Thu, 09 Apr 2026 16:44:37 +0000
satisfied_requirement
unsatisfied_requirement
open
diffy

Thomas Bertet (Gerrit)

unread,
Apr 14, 2026, 10:12:13 AMApr 14
to Thomas BERTET, Andrew Comminos, Liang Zhao, android-bu...@system.gserviceaccount.com, Monica Chintala, Michal Mocny, Chromium Metrics Reviews, chromium...@chromium.org, Luna Lu, blink-revie...@chromium.org, asvitkine...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, core-timi...@chromium.org, iclella...@chromium.org, ipc-securi...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, speed-metrics...@chromium.org
Attention needed from Liang Zhao, Michal Mocny, Monica Chintala and Thomas BERTET

Thomas Bertet added 3 comments

File third_party/blink/renderer/core/timing/profiler_group.cc
Line 177, Patchset 2: context_observers_.insert(observer);
Michal Mocny . unresolved

THis will require expert review, but, it surpises me that you can init via `InitV8Profiler(v8::kLazyLogging);` but that we choose not to do so.

So you can have tri-state:

  • Un-init
  • Init w/ Lazy
  • Init w/ Eager

This document policy adds 2 modes and picks (1) and (3).

(But it also creates a `ProfilingContextObserver` eagerly, which afaik isn't needed until you start to profile? Not sure.)

Thomas Bertet

Right! It makes sense to me to simplify this. I've reworked this to get rid of the `OnProfilingContextAddedLazy` and initialize V8 with `kLazyLogging`

Thomas Bertet

@mmo...@chromium.org do the changes look good to you ?

File third_party/blink/renderer/core/timing/profiler_group_test.cc
Line 226, Patchset 5:// kLazyLogging) and that CreateProfiler succeeds without additional init.
Liang Zhao . resolved

How is this verified and what's the observed differences between this test and CreateProfiler?

Thomas Bertet

You're right that this test doesn't actually verify the V8 logging mode — `kLazyLogging` vs `kEagerLogging` is not observable through the public v8::CpuProfiler API, so we can't assert it directly.
The test is a smoke test verifying that `OnProfilingContextAdded(kLazy)` initialises the profiler and that `CreateProfiler` succeeds on the lazy path. I've renamed it to `LazyModeAllowsProfiling` and updated the comment to make that scope explicit. Would that work for you ? Or do you think that's not needed maybe ?

Liang Zhao

Code owner might have better suggestions. I think that we still want to have a test to verify that the handling of the lazy mode works from the observable behavior. If we really could not observe the difference between lazy and eager mode, a comment might be helpful.

Thomas Bertet

@acom...@meta.com do you have a suggestion here ? :) Thank you!

File third_party/blink/web_tests/external/wpt/js-self-profiling/js-profiling-mode/eager.https.html
Line 10, Patchset 4: const profiler = new Profiler({
Liang Zhao . resolved

I don't see difference between eager and lazy mode. Is there any way to show the difference?

Thomas Bertet

The tests are intentionally structured the same way — they verify that the mode is recognised by the browser and that the API is usable, which would fail if, e.g., initialisation were broken for that mode. The eager vs. lazy difference is covered at the unit test level in profiler_group_test.cc. Do you think we need to do something more here ?

Liang Zhao

Normally, we want to verify differences for different input. If there is no observable difference, using internal browser tests or unit tests are OK. Feel free to resolve this comment if it is not possible to observe the difference.

Thomas Bertet

Do you mean we should remove the new `lazy` wpt test then since we can't really observe a difference ?

Liang Zhao

I think that we still want the test to ensure that at least handling of the enum works.

Thomas Bertet

Acknowledged

Open in Gerrit

Related details

Attention is currently required from:
  • Liang Zhao
  • Michal Mocny
  • Monica Chintala
  • Thomas BERTET
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: If3e61ee55318b46bf2b07a16d113a5a388f7bf67
Gerrit-Change-Number: 7575656
Gerrit-PatchSet: 7
Gerrit-Owner: Thomas BERTET <thomas...@gmail.com>
Gerrit-CC: Andrew Comminos <acom...@meta.com>
Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
Gerrit-CC: Liang Zhao <lz...@microsoft.com>
Gerrit-CC: Luna Lu <loon...@chromium.org>
Gerrit-CC: Michal Mocny <mmo...@chromium.org>
Gerrit-CC: Monica Chintala <moni...@microsoft.com>
Gerrit-CC: Thomas Bertet <thomas...@datadoghq.com>
Gerrit-Attention: Liang Zhao <lz...@microsoft.com>
Gerrit-Attention: Monica Chintala <moni...@microsoft.com>
Gerrit-Attention: Michal Mocny <mmo...@chromium.org>
Gerrit-Attention: Thomas BERTET <thomas...@gmail.com>
Gerrit-Comment-Date: Tue, 14 Apr 2026 14:12:06 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Liang Zhao <lz...@microsoft.com>
Comment-In-Reply-To: Michal Mocny <mmo...@chromium.org>
Comment-In-Reply-To: Thomas Bertet <thomas...@datadoghq.com>
satisfied_requirement
unsatisfied_requirement
open
diffy

Thomas Bertet (Gerrit)

unread,
Apr 29, 2026, 4:25:44 AMApr 29
to Thomas BERTET, Andrew Comminos, Liang Zhao, android-bu...@system.gserviceaccount.com, Monica Chintala, Michal Mocny, Chromium Metrics Reviews, chromium...@chromium.org, Luna Lu, blink-revie...@chromium.org, asvitkine...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, core-timi...@chromium.org, iclella...@chromium.org, ipc-securi...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, speed-metrics...@chromium.org
Attention needed from Liang Zhao, Michal Mocny, Monica Chintala and Thomas BERTET

Thomas Bertet added 1 comment

Patchset-level comments
File-level comment, Patchset 7 (Latest):
Thomas Bertet . resolved

Hi there, I believe the CL looks reasonable now, if you could take a look as code owners, it would be great! Thank you !

Gerrit-Comment-Date: Wed, 29 Apr 2026 08:25:28 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

gwsq (Gerrit)

unread,
Apr 29, 2026, 5:01:31 AMApr 29
to Thomas BERTET, Chromium IPC Reviews, Ari Chivukula, Sandor «Alex» Major, Daniel Vogelheim, Kent Tamura, Rick Byers, Nico Weber, Daniel Cheng, Michal Mocny, Ian Clelland, Kentaro Hara, Dave Tapuska, Philip Jägenstedt, Jeremy Roman, Kenneth Russell, Rob Buis, Stefan Zager, Nicolás Peña, Scott Haseley, Nate Chapin, Annie Sullivan, Alex Russell, Michael Lippautz, Andrew Comminos, Liang Zhao, android-bu...@system.gserviceaccount.com, Thomas Bertet, Monica Chintala, Chromium Metrics Reviews, chromium...@chromium.org, Luna Lu, blink-revie...@chromium.org, asvitkine...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, core-timi...@chromium.org, iclella...@chromium.org, ipc-securi...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, speed-metrics...@chromium.org
Attention needed from Alex Russell, Annie Sullivan, Ari Chivukula, Daniel Cheng, Daniel Vogelheim, Dave Tapuska, Ian Clelland, Jeremy Roman, Kenneth Russell, Kent Tamura, Kentaro Hara, Liang Zhao, Michael Lippautz, Michal Mocny, Monica Chintala, Nate Chapin, Nico Weber, Nicolás Peña, Philip Jägenstedt, Rick Byers, Rob Buis, Sandor «Alex» Major, Scott Haseley, Stefan Zager and Thomas BERTET

Message from gwsq

From googleclient/chrome/chromium_gwsq/ipc/config.gwsq:
Shadow: ari...@chromium.org; IPC: dch...@chromium.org

📎 It looks like you’re making a possibly security-sensitive change! 📎 IPC security review isn’t a rubberstamp, so your friendly security reviewer will need a fair amount of context to review your CL effectively. Please review your CL description and code comments to make sure they provide context for someone unfamiliar with your project/area. Pay special attention to where data comes from and which processes it flows between (and their privilege levels). Feel free to point your security reviewer at design docs, bugs, or other links if you can’t reasonably make a self-contained CL description. (Also see https://cbea.ms/git-commit/).

Shadow IPC reviewer(s): ari...@chromium.org. Please conduct an IPC review and CR+1 when satisfied. Remember to add the main reviewers to the attention set if needed.

Main IPC reviewer(s): dch...@chromium.org. Please wait for the shadowed IPC reviewer to CR+1 before reviewing.

Note: IPC gwsq added no new reviewers; existing reviewers satisfied requirements!

Reviewer source(s):
dch...@chromium.org is from context(googleclient/chrome/chromium_gwsq/ipc/config.gwsq)

Open in Gerrit

Related details

Attention is currently required from:
  • Alex Russell
  • Annie Sullivan
  • Ari Chivukula
  • Daniel Cheng
  • Daniel Vogelheim
  • Dave Tapuska
  • Ian Clelland
  • Jeremy Roman
  • Kenneth Russell
  • Kent Tamura
  • Kentaro Hara
  • Liang Zhao
  • Michael Lippautz
  • Michal Mocny
  • Monica Chintala
  • Nate Chapin
  • Nico Weber
  • Nicolás Peña
  • Philip Jägenstedt
  • Rick Byers
  • Rob Buis
  • Sandor «Alex» Major
  • Scott Haseley
  • Stefan Zager
  • Thomas BERTET
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: If3e61ee55318b46bf2b07a16d113a5a388f7bf67
Gerrit-Change-Number: 7575656
Gerrit-PatchSet: 7
Gerrit-Owner: Thomas BERTET <thomas...@gmail.com>
Gerrit-Reviewer: Alex Russell <sligh...@chromium.org>
Gerrit-Reviewer: Annie Sullivan <sull...@chromium.org>
Gerrit-Reviewer: Ari Chivukula <ari...@chromium.org>
Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
Gerrit-Reviewer: Daniel Vogelheim <voge...@chromium.org>
Gerrit-Reviewer: Dave Tapuska <dtap...@chromium.org>
Gerrit-Reviewer: Ian Clelland <icle...@chromium.org>
Gerrit-Reviewer: Jeremy Roman <jbr...@chromium.org>
Gerrit-Reviewer: Kenneth Russell <k...@chromium.org>
Gerrit-Reviewer: Kent Tamura <tk...@chromium.org>
Gerrit-Reviewer: Kentaro Hara <har...@chromium.org>
Gerrit-Reviewer: Michael Lippautz <mlip...@chromium.org>
Gerrit-Reviewer: Michal Mocny <mmo...@chromium.org>
Gerrit-Reviewer: Nate Chapin <jap...@chromium.org>
Gerrit-Reviewer: Nico Weber <tha...@chromium.org>
Gerrit-Reviewer: Nicolás Peña <n...@chromium.org>
Gerrit-Reviewer: Philip Jägenstedt <foo...@chromium.org>
Gerrit-Reviewer: Rick Byers <rby...@chromium.org>
Gerrit-Reviewer: Rob Buis <rb...@igalia.com>
Gerrit-Reviewer: Sandor «Alex» Major <sando...@chromium.org>
Gerrit-Reviewer: Scott Haseley <shas...@chromium.org>
Gerrit-Reviewer: Stefan Zager <sza...@chromium.org>
Gerrit-CC: Andrew Comminos <acom...@meta.com>
Gerrit-CC: Chromium IPC Reviews <chrome-ip...@google.com>
Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
Gerrit-CC: Liang Zhao <lz...@microsoft.com>
Gerrit-CC: Luna Lu <loon...@chromium.org>
Gerrit-CC: gwsq
Gerrit-Attention: Nate Chapin <jap...@chromium.org>
Gerrit-Attention: Monica Chintala <moni...@microsoft.com>
Gerrit-Attention: Kenneth Russell <k...@chromium.org>
Gerrit-Attention: Nico Weber <tha...@chromium.org>
Gerrit-Attention: Sandor «Alex» Major <sando...@chromium.org>
Gerrit-Attention: Kentaro Hara <har...@chromium.org>
Gerrit-Attention: Kent Tamura <tk...@chromium.org>
Gerrit-Attention: Daniel Cheng <dch...@chromium.org>
Gerrit-Attention: Scott Haseley <shas...@chromium.org>
Gerrit-Attention: Stefan Zager <sza...@chromium.org>
Gerrit-Attention: Michael Lippautz <mlip...@chromium.org>
Gerrit-Attention: Ari Chivukula <ari...@chromium.org>
Gerrit-Attention: Ian Clelland <icle...@chromium.org>
Gerrit-Attention: Jeremy Roman <jbr...@chromium.org>
Gerrit-Attention: Alex Russell <sligh...@chromium.org>
Gerrit-Attention: Michal Mocny <mmo...@chromium.org>
Gerrit-Attention: Dave Tapuska <dtap...@chromium.org>
Gerrit-Attention: Thomas BERTET <thomas...@gmail.com>
Gerrit-Attention: Philip Jägenstedt <foo...@chromium.org>
Gerrit-Attention: Rob Buis <rb...@igalia.com>
Gerrit-Attention: Annie Sullivan <sull...@chromium.org>
Gerrit-Attention: Liang Zhao <lz...@microsoft.com>
Gerrit-Attention: Daniel Vogelheim <voge...@chromium.org>
Gerrit-Attention: Nicolás Peña <n...@chromium.org>
Gerrit-Attention: Rick Byers <rby...@chromium.org>
Gerrit-Comment-Date: Wed, 29 Apr 2026 09:01:21 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Nico Weber (Gerrit)

unread,
Apr 29, 2026, 8:12:12 AMApr 29
to Thomas BERTET, Benedikt Meurer, Chromium IPC Reviews, Michal Mocny, Andrew Comminos, Liang Zhao, android-bu...@system.gserviceaccount.com, Thomas Bertet, Monica Chintala, Chromium Metrics Reviews, chromium...@chromium.org, Luna Lu, blink-revie...@chromium.org, asvitkine...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, core-timi...@chromium.org, iclella...@chromium.org, ipc-securi...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, speed-metrics...@chromium.org, Nico Weber
Attention needed from Benedikt Meurer, Liang Zhao, Michal Mocny, Monica Chintala and Thomas BERTET

Nico Weber added 1 comment

Patchset-level comments
Nico Weber . resolved

Please don't add lots of people as reviewers. Normally you'd pick one owner. Removing all the folks you added again.

I don't know how much "should we do this" was discussed. The bug mentions "v8 profiler", so I'm bmeurer from v8/src/profiler/OWNERS. If doing this is fine in principle, pick one blink owner to do the owners review.

Open in Gerrit

Related details

Attention is currently required from:
  • Benedikt Meurer
  • Liang Zhao
  • Michal Mocny
  • Monica Chintala
  • Thomas BERTET
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: If3e61ee55318b46bf2b07a16d113a5a388f7bf67
Gerrit-Change-Number: 7575656
Gerrit-PatchSet: 7
Gerrit-Owner: Thomas BERTET <thomas...@gmail.com>
Gerrit-Reviewer: Benedikt Meurer <bme...@chromium.org>
Gerrit-Reviewer: Michal Mocny <mmo...@chromium.org>
Gerrit-CC: Andrew Comminos <acom...@meta.com>
Gerrit-CC: Chromium IPC Reviews <chrome-ip...@google.com>
Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
Gerrit-CC: Liang Zhao <lz...@microsoft.com>
Gerrit-CC: Luna Lu <loon...@chromium.org>
Gerrit-CC: Monica Chintala <moni...@microsoft.com>
Gerrit-CC: Thomas Bertet <thomas...@datadoghq.com>
Gerrit-CC: gwsq
Gerrit-Attention: Benedikt Meurer <bme...@chromium.org>
Gerrit-Attention: Liang Zhao <lz...@microsoft.com>
Gerrit-Attention: Monica Chintala <moni...@microsoft.com>
Gerrit-Attention: Michal Mocny <mmo...@chromium.org>
Gerrit-Attention: Thomas BERTET <thomas...@gmail.com>
Gerrit-Comment-Date: Wed, 29 Apr 2026 12:12:01 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Ari Chivukula (Gerrit)

unread,
Apr 29, 2026, 8:32:16 AMApr 29
to Thomas BERTET, Annie Sullivan, Nico Weber, Benedikt Meurer, Chromium IPC Reviews, Michal Mocny, Andrew Comminos, Liang Zhao, android-bu...@system.gserviceaccount.com, Thomas Bertet, Monica Chintala, Chromium Metrics Reviews, chromium...@chromium.org, Luna Lu, blink-revie...@chromium.org, asvitkine...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, core-timi...@chromium.org, iclella...@chromium.org, ipc-securi...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, speed-metrics...@chromium.org
Attention needed from Benedikt Meurer, Liang Zhao, Michal Mocny, Monica Chintala and Thomas BERTET

Ari Chivukula added 12 comments

Patchset-level comments
Ari Chivukula . unresolved

(IPC shadow review) I don't have familiarity with whatever risks the profiler setting itself has, but the IPC here generally seems low risk, if a bit hard to follow due to the conversions between string <-> int <-> enum.

I almost wonder if we should require kEnum support on the PolicyFeature require mojom based enums so it can handle verification/conversion internally without the need for so much new code with each enum. If you do want to do that, it should probably be its own CL to reduce the complexity of this one

File third_party/blink/public/common/permissions_policy/document_policy_enum_values.h
Line 57, Patchset 7 (Latest): case 0: // JSProfilingMode::kNone
Ari Chivukula . unresolved

same nit here, except that the enum value should be used in the switch cases

Line 30, Patchset 7 (Latest): return 0; // JSProfilingMode::kNone
Ari Chivukula . unresolved

Why not have this enum be available for use here and return the std::to_underlying of the enum itself? That seems less error prone if this expands in future

File third_party/blink/renderer/core/execution_context/security_context.cc
Line 268, Patchset 7 (Latest): DCHECK(document_policy_);
Ari Chivukula . unresolved

I see we use DCHECK elsewhere in this file, but why not CHECK here?

File third_party/blink/renderer/core/permissions_policy/document_policy_features.json5
Line 108, Patchset 2: default_value: "0",
Michal Mocny . unresolved

The `default_value` of `0` corresponds to `JSProfilingMode::kNone`. However, there isn't a corresponding token in `TokenToEnumValue` (line 29 in `document_policy_parser.cc`) or `EnumValueToToken` (line 40 in `document_policy.cc`) to represent `kNone`.

This means that while `kNone` is the default, it cannot be explicitly set via a Document Policy header. Only `eager` and `lazy` can be specified.

Is this intentional? If so, it might be worth adding a comment to clarify that `kNone` is an implicit default and cannot be set explicitly via the policy header, to avoid confusion if someone tries to write `js-profiling-mode='none'`.

Thomas Bertet

I think I would find the `none` enum value an interesting idea, even though it's not in the specification update yet. I guess we can do that in a the meantime.
In the next patchset, I've added a `none` enum value, let me know if you feel that's good!

Ari Chivukula

I think you're trending new ground here with supporting enums, so should we have the default_value be the string representation instead of the numerical one? The string representation is what's expected in the header right?

File third_party/blink/renderer/core/permissions_policy/document_policy_parser.cc
Line 56, Patchset 7 (Latest): // mojom::blink::DocumentPolicyFeature is a type alias for
Ari Chivukula . unresolved

the comments here and elsewhere about not casting seem unnecessary

File third_party/blink/renderer/core/permissions_policy/document_policy_parser_test.cc
Line 20, Patchset 7 (Latest):// kEnumFeature is aliased to kJSProfilingMode so that serialization round-trips
Ari Chivukula . unresolved

Why not just use kJSProfilingMode directly? It seems worse for future expansion that we're making this the generic enum feature.

File third_party/blink/renderer/core/timing/profiler_group.h
Line 87, Patchset 7 (Latest): v8::CpuProfilingLoggingMode logging_mode = v8::kEagerLogging);
Ari Chivukula . unresolved

same note here

Line 74, Patchset 7 (Latest): JSProfilingMode mode = JSProfilingMode::kEager);
Ari Chivukula . unresolved

if kNone is the default should it be used here as well? Or maybe don't have a default argument, that seems risky as it means future callers might forget it.

File third_party/blink/renderer/core/timing/profiler_group.cc
Line 83, Patchset 7 (Latest): return static_cast<JSProfilingMode>(mode_value.IntValue());
Ari Chivukula . unresolved

It feels risky to defer all bounds checking upstream, we might want a kMax value in JSProfilingMode so we can check it's between 0 and it

Line 136, Patchset 7 (Latest): DCHECK_NE(mode, JSProfilingMode::kNone);
Ari Chivukula . unresolved

CHECK_NE?

Line 172, Patchset 7 (Latest): DCHECK_NE(mode, JSProfilingMode::kNone);
Ari Chivukula . unresolved

CHECK_NE

Gerrit-CC: Annie Sullivan <sull...@chromium.org>
Gerrit-CC: Ari Chivukula <ari...@chromium.org>
Gerrit-CC: Chromium IPC Reviews <chrome-ip...@google.com>
Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
Gerrit-CC: Liang Zhao <lz...@microsoft.com>
Gerrit-CC: Luna Lu <loon...@chromium.org>
Gerrit-CC: Monica Chintala <moni...@microsoft.com>
Gerrit-CC: Nico Weber <tha...@chromium.org>
Gerrit-CC: Thomas Bertet <thomas...@datadoghq.com>
Gerrit-CC: gwsq
Gerrit-Attention: Benedikt Meurer <bme...@chromium.org>
Gerrit-Attention: Liang Zhao <lz...@microsoft.com>
Gerrit-Attention: Monica Chintala <moni...@microsoft.com>
Gerrit-Attention: Michal Mocny <mmo...@chromium.org>
Gerrit-Attention: Thomas BERTET <thomas...@gmail.com>
Gerrit-Comment-Date: Wed, 29 Apr 2026 12:32:09 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Thomas Bertet (Gerrit)

unread,
May 7, 2026, 6:39:13 AMMay 7
to Thomas BERTET, Ari Chivukula, Annie Sullivan, Nico Weber, Chromium IPC Reviews, Michal Mocny, Andrew Comminos, Liang Zhao, android-bu...@system.gserviceaccount.com, Monica Chintala, Chromium Metrics Reviews, chromium...@chromium.org, Luna Lu, blink-revie...@chromium.org, asvitkine...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, core-timi...@chromium.org, iclella...@chromium.org, ipc-securi...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, speed-metrics...@chromium.org
Attention needed from Ari Chivukula, Liang Zhao, Michal Mocny, Monica Chintala and Thomas BERTET

Thomas Bertet added 14 comments

Patchset-level comments
Ari Chivukula . unresolved

(IPC shadow review) I don't have familiarity with whatever risks the profiler setting itself has, but the IPC here generally seems low risk, if a bit hard to follow due to the conversions between string <-> int <-> enum.

I almost wonder if we should require kEnum support on the PolicyFeature require mojom based enums so it can handle verification/conversion internally without the need for so much new code with each enum. If you do want to do that, it should probably be its own CL to reduce the complexity of this one

Thomas Bertet

I'd be in favour of doing this improvement later, to avoid scope creep and more delays if that's ok with you ? 😊

File third_party/blink/public/common/permissions_policy/document_policy_enum_values.h
Line 57, Patchset 7: case 0: // JSProfilingMode::kNone
Ari Chivukula . resolved

same nit here, except that the enum value should be used in the switch cases

Thomas Bertet

Acknowledged

Line 30, Patchset 7: return 0; // JSProfilingMode::kNone
Ari Chivukula . unresolved

Why not have this enum be available for use here and return the std::to_underlying of the enum itself? That seems less error prone if this expands in future

Thomas Bertet

Did it, and in the process I moved the JSProfilingMode to its own header file to avoid relying on /renderer file. I hope that's what you were thinking of. Happy to change if it was not!

File third_party/blink/renderer/core/execution_context/security_context.cc
Line 268, Patchset 7: DCHECK(document_policy_);
Ari Chivukula . resolved

I see we use DCHECK elsewhere in this file, but why not CHECK here?

Thomas Bertet

Done

File third_party/blink/renderer/core/permissions_policy/document_policy_features.json5
Line 108, Patchset 2: default_value: "0",
Michal Mocny . unresolved

The `default_value` of `0` corresponds to `JSProfilingMode::kNone`. However, there isn't a corresponding token in `TokenToEnumValue` (line 29 in `document_policy_parser.cc`) or `EnumValueToToken` (line 40 in `document_policy.cc`) to represent `kNone`.

This means that while `kNone` is the default, it cannot be explicitly set via a Document Policy header. Only `eager` and `lazy` can be specified.

Is this intentional? If so, it might be worth adding a comment to clarify that `kNone` is an implicit default and cannot be set explicitly via the policy header, to avoid confusion if someone tries to write `js-profiling-mode='none'`.

Thomas Bertet

I think I would find the `none` enum value an interesting idea, even though it's not in the specification update yet. I guess we can do that in a the meantime.
In the next patchset, I've added a `none` enum value, let me know if you feel that's good!

Ari Chivukula

I think you're trending new ground here with supporting enums, so should we have the default_value be the string representation instead of the numerical one? The string representation is what's expected in the header right?

Thomas Bertet

Yes it's the string that is expected, as per the spec update: https://github.com/WICG/js-self-profiling/pull/87. However, it seems this file is processed by https://chromium.googlesource.com/experimental/chromium/src/+/refs/tags/88.0.4281.0/third_party/blink/renderer/build/scripts/make_document_policy_features_util.py and only bool or Double are supported. Also looking at `PolicyValueType` https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/public/mojom/permissions_policy/policy_value.mojom I can see `kEnum` is supported but that's the integer representation ?

File third_party/blink/renderer/core/permissions_policy/document_policy_parser.cc
Line 56, Patchset 7: // mojom::blink::DocumentPolicyFeature is a type alias for
Ari Chivukula . resolved

the comments here and elsewhere about not casting seem unnecessary

Thomas Bertet

Done

File third_party/blink/renderer/core/permissions_policy/document_policy_parser_test.cc
Line 20, Patchset 7:// kEnumFeature is aliased to kJSProfilingMode so that serialization round-trips
Ari Chivukula . resolved

Why not just use kJSProfilingMode directly? It seems worse for future expansion that we're making this the generic enum feature.

Thomas Bertet

Acknowledged

File third_party/blink/renderer/core/timing/profiler_group.h
Line 87, Patchset 7: v8::CpuProfilingLoggingMode logging_mode = v8::kEagerLogging);
Ari Chivukula . resolved

same note here

Thomas Bertet

Done

Line 74, Patchset 7: JSProfilingMode mode = JSProfilingMode::kEager);
Ari Chivukula . resolved

if kNone is the default should it be used here as well? Or maybe don't have a default argument, that seems risky as it means future callers might forget it.

Thomas Bertet

Removed the default as per your suggestion.

File third_party/blink/renderer/core/timing/profiler_group.cc
Line 83, Patchset 7: return static_cast<JSProfilingMode>(mode_value.IntValue());
Ari Chivukula . resolved

It feels risky to defer all bounds checking upstream, we might want a kMax value in JSProfilingMode so we can check it's between 0 and it

Thomas Bertet

Done

Michal Mocny . resolved

If `GetProfilingMode()` returns `kNone`, it means that `IsFeatureEnabled(kJSProfiling)` has already returned `false`. Therefore, the `IsFeatureEnabled` check on line 102 will also be `false`, making this `return true;` unreachable.

Additionally, my understanding is that `IsFeatureEnabled` do some logging/reporting and the GetProfilingMode would skip its check if the new profiling mode was supplied without the general profiling policy.

---

If kJSProfiling is still required alongside kJSProfilingMode, I think you could swap the order of feature detection and if kJSProfiling is disabled always return kNone, otherwise return provided policy or default to eager.

If kJSProfiling is optional... maybe the current implementation is fine, but perhaps add a comment here?

Thomas Bertet

I've reworked the logic to avoid unreachable return. Let me know what you think!

Thomas Bertet

Done

Line 136, Patchset 7: DCHECK_NE(mode, JSProfilingMode::kNone);
Ari Chivukula . resolved

CHECK_NE?

Thomas Bertet

Done

Line 172, Patchset 7: DCHECK_NE(mode, JSProfilingMode::kNone);
Ari Chivukula . resolved

CHECK_NE

Thomas Bertet

Done

Line 177, Patchset 2: context_observers_.insert(observer);
Michal Mocny . resolved

THis will require expert review, but, it surpises me that you can init via `InitV8Profiler(v8::kLazyLogging);` but that we choose not to do so.

So you can have tri-state:

  • Un-init
  • Init w/ Lazy
  • Init w/ Eager

This document policy adds 2 modes and picks (1) and (3).

(But it also creates a `ProfilingContextObserver` eagerly, which afaik isn't needed until you start to profile? Not sure.)

Thomas Bertet

Right! It makes sense to me to simplify this. I've reworked this to get rid of the `OnProfilingContextAddedLazy` and initialize V8 with `kLazyLogging`

Thomas Bertet

@mmo...@chromium.org do the changes look good to you ?

Thomas Bertet

Acknowledged

Open in Gerrit

Related details

Attention is currently required from:
  • Ari Chivukula
  • Liang Zhao
  • Michal Mocny
  • Monica Chintala
  • Thomas BERTET
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: If3e61ee55318b46bf2b07a16d113a5a388f7bf67
Gerrit-Change-Number: 7575656
Gerrit-PatchSet: 8
Gerrit-Owner: Thomas BERTET <thomas...@gmail.com>
Gerrit-Reviewer: Michal Mocny <mmo...@chromium.org>
Gerrit-CC: Andrew Comminos <acom...@meta.com>
Gerrit-CC: Annie Sullivan <sull...@chromium.org>
Gerrit-CC: Ari Chivukula <ari...@chromium.org>
Gerrit-CC: Chromium IPC Reviews <chrome-ip...@google.com>
Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
Gerrit-CC: Liang Zhao <lz...@microsoft.com>
Gerrit-CC: Luna Lu <loon...@chromium.org>
Gerrit-CC: Monica Chintala <moni...@microsoft.com>
Gerrit-CC: Nico Weber <tha...@chromium.org>
Gerrit-CC: Thomas Bertet <thomas...@datadoghq.com>
Gerrit-CC: gwsq
Gerrit-Attention: Ari Chivukula <ari...@chromium.org>
Gerrit-Attention: Liang Zhao <lz...@microsoft.com>
Gerrit-Attention: Monica Chintala <moni...@microsoft.com>
Gerrit-Attention: Michal Mocny <mmo...@chromium.org>
Gerrit-Attention: Thomas BERTET <thomas...@gmail.com>
Gerrit-Comment-Date: Thu, 07 May 2026 10:38:53 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Ari Chivukula <ari...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Ari Chivukula (Gerrit)

unread,
May 7, 2026, 7:12:21 AMMay 7
to Thomas BERTET, Annie Sullivan, Nico Weber, Chromium IPC Reviews, Michal Mocny, Andrew Comminos, Liang Zhao, android-bu...@system.gserviceaccount.com, Thomas Bertet, Monica Chintala, Chromium Metrics Reviews, chromium...@chromium.org, Luna Lu, blink-revie...@chromium.org, asvitkine...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, core-timi...@chromium.org, iclella...@chromium.org, ipc-securi...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, speed-metrics...@chromium.org
Attention needed from Liang Zhao, Michal Mocny, Monica Chintala and Thomas BERTET

Ari Chivukula voted and added 1 comment

Votes added by Ari Chivukula

Code-Review+1

1 comment

Patchset-level comments
File-level comment, Patchset 8 (Latest):
Ari Chivukula . resolved

(IPC shadow) I'm a little worried about how extendable the new enum policy code is (or isn't) to additional enums, but that's not really a security concern

Open in Gerrit

Related details

Attention is currently required from:
  • Liang Zhao
  • Michal Mocny
  • Monica Chintala
  • Thomas BERTET
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: If3e61ee55318b46bf2b07a16d113a5a388f7bf67
Gerrit-Change-Number: 7575656
Gerrit-PatchSet: 8
Gerrit-Owner: Thomas BERTET <thomas...@gmail.com>
Gerrit-Reviewer: Ari Chivukula <ari...@chromium.org>
Gerrit-Reviewer: Michal Mocny <mmo...@chromium.org>
Gerrit-CC: Andrew Comminos <acom...@meta.com>
Gerrit-CC: Annie Sullivan <sull...@chromium.org>
Gerrit-CC: Chromium IPC Reviews <chrome-ip...@google.com>
Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
Gerrit-CC: Liang Zhao <lz...@microsoft.com>
Gerrit-CC: Luna Lu <loon...@chromium.org>
Gerrit-CC: Monica Chintala <moni...@microsoft.com>
Gerrit-CC: Nico Weber <tha...@chromium.org>
Gerrit-CC: Thomas Bertet <thomas...@datadoghq.com>
Gerrit-CC: gwsq
Gerrit-Attention: Liang Zhao <lz...@microsoft.com>
Gerrit-Attention: Monica Chintala <moni...@microsoft.com>
Gerrit-Attention: Michal Mocny <mmo...@chromium.org>
Gerrit-Attention: Thomas BERTET <thomas...@gmail.com>
Gerrit-Comment-Date: Thu, 07 May 2026 11:12:07 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Thomas Bertet (Gerrit)

unread,
May 7, 2026, 7:53:21 AMMay 7
to Thomas BERTET, Simon Zünd, Ari Chivukula, Annie Sullivan, Nico Weber, Chromium IPC Reviews, Michal Mocny, Andrew Comminos, Liang Zhao, android-bu...@system.gserviceaccount.com, Monica Chintala, Chromium Metrics Reviews, chromium...@chromium.org, Luna Lu, blink-revie...@chromium.org, asvitkine...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, core-timi...@chromium.org, iclella...@chromium.org, ipc-securi...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, speed-metrics...@chromium.org
Attention needed from Liang Zhao, Michal Mocny, Monica Chintala, Nico Weber and Thomas BERTET

Thomas Bertet added 1 comment

Patchset-level comments
Nico Weber . resolved

Please don't add lots of people as reviewers. Normally you'd pick one owner. Removing all the folks you added again.

I don't know how much "should we do this" was discussed. The bug mentions "v8 profiler", so I'm bmeurer from v8/src/profiler/OWNERS. If doing this is fine in principle, pick one blink owner to do the owners review.

Thomas Bertet

Hi @tha...@chromium.org, thank you for fixing up the reviewers and sorry for the mess! I must have missed where this guideline was written 😊 . About "should we do this", it has been discussed during a WebPerf WG Call and then in GH. Everyone involved seemed to be onboard with the idea and the Spec was validated and updated. Please feel free to look at the GH issue for more info. Also happy to jump on a call if need be! Also it seems @bme...@chromium.org suggested @szu...@chromium.org who in turn removed himself as reviewer 😞
Anyone else I can borrow time from to review the blink's part ? :) Thank you!

Open in Gerrit

Related details

Attention is currently required from:
  • Liang Zhao
  • Michal Mocny
  • Monica Chintala
  • Nico Weber
  • Thomas BERTET
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: If3e61ee55318b46bf2b07a16d113a5a388f7bf67
Gerrit-Change-Number: 7575656
Gerrit-PatchSet: 8
Gerrit-Owner: Thomas BERTET <thomas...@gmail.com>
Gerrit-Reviewer: Ari Chivukula <ari...@chromium.org>
Gerrit-Reviewer: Michal Mocny <mmo...@chromium.org>
Gerrit-CC: Andrew Comminos <acom...@meta.com>
Gerrit-CC: Annie Sullivan <sull...@chromium.org>
Gerrit-CC: Benedikt Meurer <bme...@chromium.org>
Gerrit-CC: Chromium IPC Reviews <chrome-ip...@google.com>
Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
Gerrit-CC: Liang Zhao <lz...@microsoft.com>
Gerrit-CC: Luna Lu <loon...@chromium.org>
Gerrit-CC: Monica Chintala <moni...@microsoft.com>
Gerrit-CC: Nico Weber <tha...@chromium.org>
Gerrit-CC: Simon Zünd <szu...@chromium.org>
Gerrit-Attention: Nico Weber <tha...@chromium.org>
Gerrit-Attention: Liang Zhao <lz...@microsoft.com>
Gerrit-Attention: Monica Chintala <moni...@microsoft.com>
Gerrit-Attention: Michal Mocny <mmo...@chromium.org>
Gerrit-Attention: Thomas BERTET <thomas...@gmail.com>
Gerrit-Comment-Date: Thu, 07 May 2026 11:52:56 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Nico Weber <tha...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Michal Mocny (Gerrit)

unread,
May 7, 2026, 3:36:34 PMMay 7
to Thomas BERTET, Simon Zünd, Ari Chivukula, Annie Sullivan, Nico Weber, Chromium IPC Reviews, Andrew Comminos, Liang Zhao, android-bu...@system.gserviceaccount.com, Thomas Bertet, Monica Chintala, Chromium Metrics Reviews, chromium...@chromium.org, Luna Lu, blink-revie...@chromium.org, asvitkine...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, core-timi...@chromium.org, iclella...@chromium.org, ipc-securi...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, speed-metrics...@chromium.org
Attention needed from Liang Zhao, Monica Chintala, Nico Weber, Thomas BERTET and Thomas Bertet

Michal Mocny voted and added 5 comments

Votes added by Michal Mocny

Code-Review+1

5 comments

Patchset-level comments
File-level comment, Patchset 8 (Latest):
Michal Mocny . resolved

It appears like the vast majority of this patch is the new document policy integration and plumbing. At the end of the day, there is a single line of change for the JS self profiling-- passing a `mode` to `v8::CpuProfiler::New`.

LGTM (with some unresolved comments) deferring to the local owners (esp for document policy) to confirm that looks good.

File third_party/blink/common/permissions_policy/document_policy.cc
Line 49, Patchset 8 (Latest): case mojom::PolicyValueType::kEnum: {
Michal Mocny . unresolved

`DocumentPolicyEnumValueToToken` expects only `feature` that implement enum mappings to be called, otherwise we trigger NOTREACHED.

Is it possible for a developer to accidentally return a `kEnum` policy value type that isn't for the `kJSProfilingMode` feature, or do we guard against that earlier before the call to `PolicyValueToItem`?

---

And if it is possible could you add tests to verify that someone setting the wrong Policy headers for an unexpected feature type trying to use an enum value, would not crash renderer? (It may literally be impossible to get an enum type for a non-enum supporting feature, I dont know).

File third_party/blink/renderer/core/permissions_policy/document_policy_parser.cc
Line 29, Patchset 2:std::optional<int32_t> TokenToEnumValue(const std::string& token) {
Michal Mocny . resolved

Hmm, we go from enum string to enum value back to enum string later... Ideally these to_string and from_string would be defined together, indeally in `profiler_group.h`?

(Also this implementation has the same issue as the other one in that its generic for all enums but specific to this particular enum.)

---

WDYT about adding a second enum directly to `third_party/blink/public/mojom/permissions_policy/document_policy_feature.mojom`?

And then use `document_policy_features.json5`?

...that might need some build file pre-processing changes to support enum *values*, but I think this feels like the correct approach.

(I'm totally new to this area, but this is what I found with a bit of digging.)

Monica Chintala

Agree, If the enum values ever change, or another enum type is added, the parser/serializer silently break with no compiler error and enum should be in public files

Thomas Bertet

I've tentatively updated the code to follow your recommendation. Let me know what you think!

Michal Mocny

Acknowledged

File third_party/blink/renderer/core/permissions_policy/document_policy_parser_test.cc
Line 43, Patchset 8 (Latest): {"f-enum", mojom::blink::DocumentPolicyFeature::kJSProfilingMode},
Michal Mocny . unresolved

Nit: could this define a `kEnumFeature` for testing (above) instead of using this specific one? Or would you need more plumbing to define a new enum type?

File third_party/blink/renderer/core/timing/profiler_group.cc
Line 118, Patchset 8 (Latest): // Profiling is disabled. If the enum policy is absent, re-check the legacy

// kJSProfiling policy with report_options so violation reports are emitted.
Michal Mocny . unresolved

Nit: Would this be cleaner if `GetProfilingMode` just accepted `report_options` perhaps?

Open in Gerrit

Related details

Attention is currently required from:
  • Liang Zhao
  • Monica Chintala
  • Nico Weber
  • Thomas BERTET
  • Thomas Bertet
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement satisfiedReview-Enforcement
    Gerrit-Attention: Thomas Bertet <thomas...@datadoghq.com>
    Gerrit-Attention: Thomas BERTET <thomas...@gmail.com>
    Gerrit-Comment-Date: Thu, 07 May 2026 19:36:26 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    Comment-In-Reply-To: Monica Chintala <moni...@microsoft.com>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Thomas Bertet (Gerrit)

    unread,
    May 12, 2026, 12:06:58 PM (14 days ago) May 12
    to Thomas BERTET, Michal Mocny, Simon Zünd, Ari Chivukula, Annie Sullivan, Nico Weber, Chromium IPC Reviews, Andrew Comminos, Liang Zhao, android-bu...@system.gserviceaccount.com, Monica Chintala, Chromium Metrics Reviews, chromium...@chromium.org, Luna Lu, blink-revie...@chromium.org, asvitkine...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, core-timi...@chromium.org, iclella...@chromium.org, ipc-securi...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, speed-metrics...@chromium.org
    Attention needed from Ari Chivukula, Liang Zhao, Michal Mocny, Monica Chintala, Nico Weber and Thomas BERTET

    Thomas Bertet added 5 comments

    Patchset-level comments
    File-level comment, Patchset 7:
    Ari Chivukula . resolved

    (IPC shadow review) I don't have familiarity with whatever risks the profiler setting itself has, but the IPC here generally seems low risk, if a bit hard to follow due to the conversions between string <-> int <-> enum.

    I almost wonder if we should require kEnum support on the PolicyFeature require mojom based enums so it can handle verification/conversion internally without the need for so much new code with each enum. If you do want to do that, it should probably be its own CL to reduce the complexity of this one

    Thomas Bertet

    I'd be in favour of doing this improvement later, to avoid scope creep and more delays if that's ok with you ? 😊

    Thomas Bertet

    Acknowledged

    File third_party/blink/common/permissions_policy/document_policy.cc
    Line 49, Patchset 8: case mojom::PolicyValueType::kEnum: {
    Michal Mocny . unresolved

    `DocumentPolicyEnumValueToToken` expects only `feature` that implement enum mappings to be called, otherwise we trigger NOTREACHED.

    Is it possible for a developer to accidentally return a `kEnum` policy value type that isn't for the `kJSProfilingMode` feature, or do we guard against that earlier before the call to `PolicyValueToItem`?

    ---

    And if it is possible could you add tests to verify that someone setting the wrong Policy headers for an unexpected feature type trying to use an enum value, would not crash renderer? (It may literally be impossible to get an enum type for a non-enum supporting feature, I dont know).

    Thomas Bertet

    1 - We don't prevent developers to return a `kEnum` type for something else than the `kJSProfilingMode`, as long as the feature is registered in the feature map as `Enum`. If it's not, then it's dismissed earlier by the `ParseFeature` method.
    2 - When a wrong value of the enum is set, the `DocumentPolicyEnumValueToToken` will clean it up without crashing.
    3 - When developer set a new feature as type `Enum`, without specifying list of values nor updating `DocumentPolicyEnumValueToToken`, then the `NOTREACHED()` will be called. I'm adding a test case to catch that, making sure devs won't forget to add their enum values into `DocumentPolicyEnumValueToToken`

    File third_party/blink/public/common/permissions_policy/document_policy_enum_values.h
    Line 30, Patchset 7: return 0; // JSProfilingMode::kNone
    Ari Chivukula . resolved

    Why not have this enum be available for use here and return the std::to_underlying of the enum itself? That seems less error prone if this expands in future

    Thomas Bertet

    Did it, and in the process I moved the JSProfilingMode to its own header file to avoid relying on /renderer file. I hope that's what you were thinking of. Happy to change if it was not!

    Thomas Bertet

    Acknowledged

    File third_party/blink/renderer/core/permissions_policy/document_policy_parser_test.cc
    Line 43, Patchset 8: {"f-enum", mojom::blink::DocumentPolicyFeature::kJSProfilingMode},
    Michal Mocny . resolved

    Nit: could this define a `kEnumFeature` for testing (above) instead of using this specific one? Or would you need more plumbing to define a new enum type?

    Thomas Bertet

    Done

    File third_party/blink/renderer/core/timing/profiler_group.cc
    Line 118, Patchset 8: // Profiling is disabled. If the enum policy is absent, re-check the legacy

    // kJSProfiling policy with report_options so violation reports are emitted.
    Michal Mocny . resolved

    Nit: Would this be cleaner if `GetProfilingMode` just accepted `report_options` perhaps?

    Thomas Bertet

    Done

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Ari Chivukula
    • Liang Zhao
    • Michal Mocny
    • Monica Chintala
    • Nico Weber
    • Thomas BERTET
      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: If3e61ee55318b46bf2b07a16d113a5a388f7bf67
        Gerrit-Change-Number: 7575656
        Gerrit-PatchSet: 9
        Gerrit-Owner: Thomas BERTET <thomas...@gmail.com>
        Gerrit-Reviewer: Ari Chivukula <ari...@chromium.org>
        Gerrit-Reviewer: Michal Mocny <mmo...@chromium.org>
        Gerrit-CC: Andrew Comminos <acom...@meta.com>
        Gerrit-CC: Annie Sullivan <sull...@chromium.org>
        Gerrit-CC: Benedikt Meurer <bme...@chromium.org>
        Gerrit-CC: Chromium IPC Reviews <chrome-ip...@google.com>
        Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
        Gerrit-CC: Liang Zhao <lz...@microsoft.com>
        Gerrit-CC: Luna Lu <loon...@chromium.org>
        Gerrit-CC: Monica Chintala <moni...@microsoft.com>
        Gerrit-CC: Nico Weber <tha...@chromium.org>
        Gerrit-CC: Simon Zünd <szu...@chromium.org>
        Gerrit-CC: Thomas Bertet <thomas...@datadoghq.com>
        Gerrit-CC: gwsq
        Gerrit-Attention: Nico Weber <tha...@chromium.org>
        Gerrit-Attention: Ari Chivukula <ari...@chromium.org>
        Gerrit-Attention: Liang Zhao <lz...@microsoft.com>
        Gerrit-Attention: Monica Chintala <moni...@microsoft.com>
        Gerrit-Attention: Michal Mocny <mmo...@chromium.org>
        Gerrit-Attention: Thomas BERTET <thomas...@gmail.com>
        Gerrit-Comment-Date: Tue, 12 May 2026 16:06:38 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        Comment-In-Reply-To: Ari Chivukula <ari...@chromium.org>
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Ari Chivukula (Gerrit)

        unread,
        May 12, 2026, 12:08:27 PM (14 days ago) May 12
        to Thomas BERTET, Michal Mocny, Simon Zünd, Annie Sullivan, Nico Weber, Chromium IPC Reviews, Andrew Comminos, Liang Zhao, android-bu...@system.gserviceaccount.com, Thomas Bertet, Monica Chintala, Chromium Metrics Reviews, chromium...@chromium.org, Luna Lu, blink-revie...@chromium.org, asvitkine...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, core-timi...@chromium.org, iclella...@chromium.org, ipc-securi...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, speed-metrics...@chromium.org
        Attention needed from Liang Zhao, Michal Mocny, Monica Chintala, Nico Weber and Thomas BERTET

        Ari Chivukula voted and added 1 comment

        Votes added by Ari Chivukula

        Code-Review+1

        1 comment

        Patchset-level comments
        File-level comment, Patchset 9 (Latest):
        Ari Chivukula . resolved

        (shadow) IPC LGTM

        Open in Gerrit

        Related details

        Attention is currently required from:
        Gerrit-Attention: Liang Zhao <lz...@microsoft.com>
        Gerrit-Attention: Monica Chintala <moni...@microsoft.com>
        Gerrit-Attention: Michal Mocny <mmo...@chromium.org>
        Gerrit-Attention: Thomas BERTET <thomas...@gmail.com>
        Gerrit-Comment-Date: Tue, 12 May 2026 16:08:15 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: Yes
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Michal Mocny (Gerrit)

        unread,
        May 20, 2026, 9:09:40 AM (6 days ago) May 20
        to Thomas BERTET, Ari Chivukula, Simon Zünd, Annie Sullivan, Nico Weber, Chromium IPC Reviews, Andrew Comminos, Liang Zhao, android-bu...@system.gserviceaccount.com, Thomas Bertet, Monica Chintala, Chromium Metrics Reviews, chromium...@chromium.org, Luna Lu, blink-revie...@chromium.org, asvitkine...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, core-timi...@chromium.org, iclella...@chromium.org, ipc-securi...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, speed-metrics...@chromium.org
        Attention needed from Liang Zhao, Monica Chintala, Nico Weber, Thomas BERTET and Thomas Bertet

        Michal Mocny voted and added 2 comments

        Votes added by Michal Mocny

        Code-Review+1

        2 comments

        Patchset-level comments
        Michal Mocny . resolved

        Still LGTM, thanks for the extra test and various improvements!

        File third_party/blink/common/permissions_policy/document_policy.cc
        Line 49, Patchset 8: case mojom::PolicyValueType::kEnum: {
        Michal Mocny . resolved

        `DocumentPolicyEnumValueToToken` expects only `feature` that implement enum mappings to be called, otherwise we trigger NOTREACHED.

        Is it possible for a developer to accidentally return a `kEnum` policy value type that isn't for the `kJSProfilingMode` feature, or do we guard against that earlier before the call to `PolicyValueToItem`?

        ---

        And if it is possible could you add tests to verify that someone setting the wrong Policy headers for an unexpected feature type trying to use an enum value, would not crash renderer? (It may literally be impossible to get an enum type for a non-enum supporting feature, I dont know).

        Thomas Bertet

        1 - We don't prevent developers to return a `kEnum` type for something else than the `kJSProfilingMode`, as long as the feature is registered in the feature map as `Enum`. If it's not, then it's dismissed earlier by the `ParseFeature` method.
        2 - When a wrong value of the enum is set, the `DocumentPolicyEnumValueToToken` will clean it up without crashing.
        3 - When developer set a new feature as type `Enum`, without specifying list of values nor updating `DocumentPolicyEnumValueToToken`, then the `NOTREACHED()` will be called. I'm adding a test case to catch that, making sure devs won't forget to add their enum values into `DocumentPolicyEnumValueToToken`

        Michal Mocny

        Acknowledged

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Liang Zhao
        • Monica Chintala
        • Nico Weber
        • Thomas BERTET
        • Thomas Bertet
        Submit Requirements:
          • requirement satisfiedCode-Coverage
          • requirement is not satisfiedCode-Owners
          • requirement satisfiedCode-Review
          • requirement is not satisfiedNo-Unresolved-Comments
          • requirement satisfiedReview-Enforcement
          Gerrit-Attention: Thomas Bertet <thomas...@datadoghq.com>
          Gerrit-Attention: Thomas BERTET <thomas...@gmail.com>
          Gerrit-Comment-Date: Wed, 20 May 2026 13:09:34 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: Yes
          satisfied_requirement
          unsatisfied_requirement
          open
          diffy

          Nico Weber (Gerrit)

          unread,
          May 20, 2026, 9:19:08 AM (6 days ago) May 20
          to Thomas BERTET, Nico Weber, Michal Mocny, Ari Chivukula, Simon Zünd, Annie Sullivan, Chromium IPC Reviews, Andrew Comminos, Liang Zhao, android-bu...@system.gserviceaccount.com, Thomas Bertet, Monica Chintala, Chromium Metrics Reviews, chromium...@chromium.org, Luna Lu, blink-revie...@chromium.org, asvitkine...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, core-timi...@chromium.org, iclella...@chromium.org, ipc-securi...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, speed-metrics...@chromium.org
          Attention needed from Liang Zhao, Monica Chintala, Thomas BERTET and Thomas Bertet

          Nico Weber voted and added 1 comment

          Votes added by Nico Weber

          Code-Review+1

          1 comment

          Patchset-level comments
          Nico Weber . resolved

          Remaining blink files lg, given mmocny's review.

          You probably still need a security reviewer for that one .mojom file.

          Open in Gerrit

          Related details

          Attention is currently required from:
          • Liang Zhao
          • Monica Chintala
          • Thomas BERTET
          • Thomas Bertet
          Submit Requirements:
          • requirement satisfiedCode-Coverage
          • requirement is not satisfiedCode-Owners
          • requirement satisfiedCode-Review
          • requirement is not satisfiedNo-Unresolved-Comments
          • requirement 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: If3e61ee55318b46bf2b07a16d113a5a388f7bf67
          Gerrit-Change-Number: 7575656
          Gerrit-PatchSet: 9
          Gerrit-Owner: Thomas BERTET <thomas...@gmail.com>
          Gerrit-Reviewer: Ari Chivukula <ari...@chromium.org>
          Gerrit-Reviewer: Michal Mocny <mmo...@chromium.org>
          Gerrit-Reviewer: Nico Weber <tha...@chromium.org>
          Gerrit-CC: Andrew Comminos <acom...@meta.com>
          Gerrit-CC: Annie Sullivan <sull...@chromium.org>
          Gerrit-CC: Benedikt Meurer <bme...@chromium.org>
          Gerrit-CC: Chromium IPC Reviews <chrome-ip...@google.com>
          Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
          Gerrit-CC: Liang Zhao <lz...@microsoft.com>
          Gerrit-CC: Luna Lu <loon...@chromium.org>
          Gerrit-CC: Monica Chintala <moni...@microsoft.com>
          Gerrit-CC: Simon Zünd <szu...@chromium.org>
          Gerrit-CC: Thomas Bertet <thomas...@datadoghq.com>
          Gerrit-CC: gwsq
          Gerrit-Attention: Liang Zhao <lz...@microsoft.com>
          Gerrit-Attention: Monica Chintala <moni...@microsoft.com>
          Gerrit-Attention: Thomas Bertet <thomas...@datadoghq.com>
          Gerrit-Attention: Thomas BERTET <thomas...@gmail.com>
          Gerrit-Comment-Date: Wed, 20 May 2026 13:19:00 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: Yes
          satisfied_requirement
          unsatisfied_requirement
          open
          diffy

          Thomas Bertet (Gerrit)

          unread,
          May 20, 2026, 9:26:54 AM (6 days ago) May 20
          to Thomas BERTET, Chromium IPC Reviews, Nico Weber, Michal Mocny, Ari Chivukula, Simon Zünd, Annie Sullivan, Andrew Comminos, Liang Zhao, android-bu...@system.gserviceaccount.com, Monica Chintala, Chromium Metrics Reviews, chromium...@chromium.org, Luna Lu, blink-revie...@chromium.org, asvitkine...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, core-timi...@chromium.org, iclella...@chromium.org, ipc-securi...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, speed-metrics...@chromium.org
          Attention needed from Chromium IPC Reviews, Liang Zhao, Monica Chintala and Thomas BERTET

          Thomas Bertet added 1 comment

          Patchset-level comments
          Thomas Bertet . resolved

          Would anyone from the Chromium IPC team be able to take a look at the one remaining file? Really appreciate it!

          Open in Gerrit

          Related details

          Attention is currently required from:
          • Chromium IPC Reviews
          • Liang Zhao
          • Monica Chintala
          • Thomas BERTET
          Submit Requirements:
          • requirement satisfiedCode-Coverage
          • requirement is not satisfiedCode-Owners
          • requirement satisfiedCode-Review
          • requirement is not satisfiedNo-Unresolved-Comments
          • requirement 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: If3e61ee55318b46bf2b07a16d113a5a388f7bf67
          Gerrit-Change-Number: 7575656
          Gerrit-PatchSet: 9
          Gerrit-Owner: Thomas BERTET <thomas...@gmail.com>
          Gerrit-Reviewer: Ari Chivukula <ari...@chromium.org>
          Gerrit-Reviewer: Chromium IPC Reviews <chrome-ip...@google.com>
          Gerrit-Reviewer: Michal Mocny <mmo...@chromium.org>
          Gerrit-Reviewer: Nico Weber <tha...@chromium.org>
          Gerrit-CC: Andrew Comminos <acom...@meta.com>
          Gerrit-CC: Annie Sullivan <sull...@chromium.org>
          Gerrit-CC: Benedikt Meurer <bme...@chromium.org>
          Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
          Gerrit-CC: Liang Zhao <lz...@microsoft.com>
          Gerrit-CC: Luna Lu <loon...@chromium.org>
          Gerrit-CC: Monica Chintala <moni...@microsoft.com>
          Gerrit-CC: Simon Zünd <szu...@chromium.org>
          Gerrit-CC: Thomas Bertet <thomas...@datadoghq.com>
          Gerrit-CC: gwsq
          Gerrit-Attention: Liang Zhao <lz...@microsoft.com>
          Gerrit-Attention: Chromium IPC Reviews <chrome-ip...@google.com>
          Gerrit-Attention: Monica Chintala <moni...@microsoft.com>
          Gerrit-Attention: Thomas BERTET <thomas...@gmail.com>
          Gerrit-Comment-Date: Wed, 20 May 2026 13:26:38 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: No
          satisfied_requirement
          unsatisfied_requirement
          open
          diffy

          gwsq (Gerrit)

          unread,
          May 20, 2026, 9:31:11 AM (6 days ago) May 20
          to Thomas BERTET, Chromium IPC Reviews, Ken Buchanan, Nico Weber, Michal Mocny, Ari Chivukula, Simon Zünd, Annie Sullivan, Andrew Comminos, Liang Zhao, android-bu...@system.gserviceaccount.com, Thomas Bertet, Monica Chintala, Chromium Metrics Reviews, chromium...@chromium.org, Luna Lu, blink-revie...@chromium.org, asvitkine...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, core-timi...@chromium.org, iclella...@chromium.org, ipc-securi...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, speed-metrics...@chromium.org
          Attention needed from Ken Buchanan, Liang Zhao, Monica Chintala and Thomas BERTET

          Message from gwsq

          From googleclient/chrome/chromium_gwsq/ipc/config.gwsq:
          Shadow: ari...@chromium.org; IPC: ke...@chromium.org

          📎 It looks like you’re making a possibly security-sensitive change! 📎 IPC security review isn’t a rubberstamp, so your friendly security reviewer will need a fair amount of context to review your CL effectively. Please review your CL description and code comments to make sure they provide context for someone unfamiliar with your project/area. Pay special attention to where data comes from and which processes it flows between (and their privilege levels). Feel free to point your security reviewer at design docs, bugs, or other links if you can’t reasonably make a self-contained CL description. (Also see https://cbea.ms/git-commit/).

          Shadow IPC reviewer(s): ari...@chromium.org. Please conduct an IPC review and CR+1 when satisfied. Remember to add the main reviewers to the attention set if needed.

          Main IPC reviewer(s): ke...@chromium.org. Please wait for the shadowed IPC reviewer to CR+1 before reviewing.

          Shadowed: ari...@chromium.org

          Reviewer source(s):
          ari...@chromium.org, ke...@chromium.org is from context(googleclient/chrome/chromium_gwsq/ipc/config.gwsq)

          Open in Gerrit

          Related details

          Attention is currently required from:
          • Ken Buchanan
          • Liang Zhao
          • Monica Chintala
          • Thomas BERTET
          Submit Requirements:
          • requirement satisfiedCode-Coverage
          • requirement is not satisfiedCode-Owners
          • requirement satisfiedCode-Review
          • requirement is not satisfiedNo-Unresolved-Comments
          • requirement 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: If3e61ee55318b46bf2b07a16d113a5a388f7bf67
          Gerrit-Change-Number: 7575656
          Gerrit-PatchSet: 9
          Gerrit-Owner: Thomas BERTET <thomas...@gmail.com>
          Gerrit-Reviewer: Ari Chivukula <ari...@chromium.org>
          Gerrit-Reviewer: Ken Buchanan <ke...@chromium.org>
          Gerrit-Reviewer: Michal Mocny <mmo...@chromium.org>
          Gerrit-Reviewer: Nico Weber <tha...@chromium.org>
          Gerrit-CC: Andrew Comminos <acom...@meta.com>
          Gerrit-CC: Annie Sullivan <sull...@chromium.org>
          Gerrit-CC: Benedikt Meurer <bme...@chromium.org>
          Gerrit-CC: Chromium IPC Reviews <chrome-ip...@google.com>
          Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
          Gerrit-CC: Liang Zhao <lz...@microsoft.com>
          Gerrit-CC: Luna Lu <loon...@chromium.org>
          Gerrit-CC: Monica Chintala <moni...@microsoft.com>
          Gerrit-CC: Simon Zünd <szu...@chromium.org>
          Gerrit-CC: Thomas Bertet <thomas...@datadoghq.com>
          Gerrit-CC: gwsq
          Gerrit-Attention: Ken Buchanan <ke...@chromium.org>
          Gerrit-Attention: Liang Zhao <lz...@microsoft.com>
          Gerrit-Attention: Monica Chintala <moni...@microsoft.com>
          Gerrit-Attention: Thomas BERTET <thomas...@gmail.com>
          Gerrit-Comment-Date: Wed, 20 May 2026 13:30:57 +0000
          Gerrit-HasComments: No
          Gerrit-Has-Labels: No
          satisfied_requirement
          unsatisfied_requirement
          open
          diffy

          Ken Buchanan (Gerrit)

          unread,
          May 20, 2026, 9:48:08 AM (6 days ago) May 20
          to Thomas BERTET, Chromium IPC Reviews, Nico Weber, Michal Mocny, Ari Chivukula, Simon Zünd, Annie Sullivan, Andrew Comminos, Liang Zhao, android-bu...@system.gserviceaccount.com, Thomas Bertet, Monica Chintala, Chromium Metrics Reviews, chromium...@chromium.org, Luna Lu, blink-revie...@chromium.org, asvitkine...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, core-timi...@chromium.org, iclella...@chromium.org, ipc-securi...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, speed-metrics...@chromium.org
          Attention needed from Liang Zhao, Monica Chintala and Thomas BERTET

          Ken Buchanan voted and added 1 comment

          Votes added by Ken Buchanan

          Code-Review+1

          1 comment

          Patchset-level comments
          Ken Buchanan . resolved

          mojom lgtm

          Open in Gerrit

          Related details

          Attention is currently required from:
          • Liang Zhao
          • Monica Chintala
          • Thomas BERTET
          Submit Requirements:
          • requirement satisfiedCode-Coverage
          • requirement satisfiedCode-Owners
          Gerrit-Attention: Liang Zhao <lz...@microsoft.com>
          Gerrit-Attention: Monica Chintala <moni...@microsoft.com>
          Gerrit-Attention: Thomas BERTET <thomas...@gmail.com>
          Gerrit-Comment-Date: Wed, 20 May 2026 13:47:56 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: Yes
          satisfied_requirement
          unsatisfied_requirement
          open
          diffy

          Thomas Bertet (Gerrit)

          unread,
          May 21, 2026, 7:20:09 AM (5 days ago) May 21
          to Thomas BERTET, Chromium LUCI CQ, Nico Weber, Ken Buchanan, Chromium IPC Reviews, Michal Mocny, Ari Chivukula, Simon Zünd, Annie Sullivan, Andrew Comminos, Liang Zhao, android-bu...@system.gserviceaccount.com, Monica Chintala, Chromium Metrics Reviews, chromium...@chromium.org, Luna Lu, blink-revie...@chromium.org, asvitkine...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, core-timi...@chromium.org, iclella...@chromium.org, ipc-securi...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, speed-metrics...@chromium.org
          Attention needed from Liang Zhao, Monica Chintala, Nico Weber and Thomas BERTET

          Thomas Bertet added 1 comment

          Patchset-level comments
          Thomas Bertet . resolved

          The legacy `js-profiling` header tests are failing. With all the changes we did along the way, we lost the backward compatibility 😭. (I should have ran the WPT tests before, my bad)

          The DocumentPolicy framework initialises every registered feature with a default value, regardless of whether the response header mentions it.
          For boolean features this is mostly harmless — "not set" and "disabled by default" are the same thing.
          For `js-profiling-mode`, they are not: "not set" should fall back to the legacy `js-profiling` boolean policy, while `js-profiling-mode=none` should explicitly block profiling even when `js-profiling` is also set.
          Because the framework merges header values over defaults into a flat map (and defaults is `kNone`), `GetDocumentPolicyValue` cannot tell them apart.

          Potential solutions:

          We could use a sentinel value (3, outside the valid token range) as a workaround: the parser can only produce 0/1/2 for known tokens, so value 3 can only come from the default, allowing `GetProfilingMode` to treat it as "not explicitly set" and fall through to the legacy path. It may not be very elegant though.
          A more idiomatic fix would be to either extend the framework to track which features were explicitly present in the header, or drop the `none` token entirely since it's the only reason the distinction matters.
          I'm leaning towards removing the `none` token since it was not really part of the initial spec update anyway, and is the reason we have this "default vs. not-set" confusion. I'll update the CL do remove `kNone` but in the meantime, if you disagree, please let me know!

          Open in Gerrit

          Related details

          Attention is currently required from:
          • Liang Zhao
          • Monica Chintala
          • Nico Weber
          • Thomas BERTET
          Submit Requirements:
          • requirement satisfiedCode-Coverage
          • requirement satisfiedCode-Owners
          • requirement satisfiedCode-Review
          • requirement is not satisfiedNo-Unresolved-Comments
          • requirement 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: If3e61ee55318b46bf2b07a16d113a5a388f7bf67
          Gerrit-Change-Number: 7575656
          Gerrit-PatchSet: 9
          Gerrit-Owner: Thomas BERTET <thomas...@gmail.com>
          Gerrit-Reviewer: Ari Chivukula <ari...@chromium.org>
          Gerrit-Reviewer: Ken Buchanan <ke...@chromium.org>
          Gerrit-Reviewer: Michal Mocny <mmo...@chromium.org>
          Gerrit-Reviewer: Nico Weber <tha...@chromium.org>
          Gerrit-CC: Andrew Comminos <acom...@meta.com>
          Gerrit-CC: Annie Sullivan <sull...@chromium.org>
          Gerrit-CC: Benedikt Meurer <bme...@chromium.org>
          Gerrit-CC: Chromium IPC Reviews <chrome-ip...@google.com>
          Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
          Gerrit-CC: Liang Zhao <lz...@microsoft.com>
          Gerrit-CC: Luna Lu <loon...@chromium.org>
          Gerrit-CC: Monica Chintala <moni...@microsoft.com>
          Gerrit-CC: Simon Zünd <szu...@chromium.org>
          Gerrit-CC: Thomas Bertet <thomas...@datadoghq.com>
          Gerrit-CC: gwsq
          Gerrit-Attention: Nico Weber <tha...@chromium.org>
          Gerrit-Attention: Liang Zhao <lz...@microsoft.com>
          Gerrit-Attention: Monica Chintala <moni...@microsoft.com>
          Gerrit-Attention: Thomas BERTET <thomas...@gmail.com>
          Gerrit-Comment-Date: Thu, 21 May 2026 11:19:45 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: No
          satisfied_requirement
          unsatisfied_requirement
          open
          diffy

          Thomas Bertet (Gerrit)

          unread,
          May 21, 2026, 8:04:20 AM (5 days ago) May 21
          to Thomas BERTET, Chromium LUCI CQ, Nico Weber, Ken Buchanan, Chromium IPC Reviews, Michal Mocny, Ari Chivukula, Simon Zünd, Annie Sullivan, Andrew Comminos, Liang Zhao, android-bu...@system.gserviceaccount.com, Monica Chintala, Chromium Metrics Reviews, chromium...@chromium.org, Luna Lu, blink-revie...@chromium.org, asvitkine...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, core-timi...@chromium.org, iclella...@chromium.org, ipc-securi...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, speed-metrics...@chromium.org
          Attention needed from Ari Chivukula, Ken Buchanan, Liang Zhao, Michal Mocny, Monica Chintala, Nico Weber and Thomas BERTET

          Thomas Bertet added 1 comment

          File third_party/blink/renderer/core/permissions_policy/document_policy_features.json5
          Line 108, Patchset 2: default_value: "0",
          Michal Mocny . unresolved

          The `default_value` of `0` corresponds to `JSProfilingMode::kNone`. However, there isn't a corresponding token in `TokenToEnumValue` (line 29 in `document_policy_parser.cc`) or `EnumValueToToken` (line 40 in `document_policy.cc`) to represent `kNone`.

          This means that while `kNone` is the default, it cannot be explicitly set via a Document Policy header. Only `eager` and `lazy` can be specified.

          Is this intentional? If so, it might be worth adding a comment to clarify that `kNone` is an implicit default and cannot be set explicitly via the policy header, to avoid confusion if someone tries to write `js-profiling-mode='none'`.

          Thomas Bertet

          I think I would find the `none` enum value an interesting idea, even though it's not in the specification update yet. I guess we can do that in a the meantime.
          In the next patchset, I've added a `none` enum value, let me know if you feel that's good!

          Ari Chivukula

          I think you're trending new ground here with supporting enums, so should we have the default_value be the string representation instead of the numerical one? The string representation is what's expected in the header right?

          Thomas Bertet

          Yes it's the string that is expected, as per the spec update: https://github.com/WICG/js-self-profiling/pull/87. However, it seems this file is processed by https://chromium.googlesource.com/experimental/chromium/src/+/refs/tags/88.0.4281.0/third_party/blink/renderer/build/scripts/make_document_policy_features_util.py and only bool or Double are supported. Also looking at `PolicyValueType` https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/public/mojom/permissions_policy/policy_value.mojom I can see `kEnum` is supported but that's the integer representation ?

          Thomas Bertet

          Patchset 10 is now removing the `kNone` token, so that, as you suggested Michal, there is a comment explaining 0 is the default, but do not translate to any value enum value and is representing "not set"

          Open in Gerrit

          Related details

          Attention is currently required from:
          • Ari Chivukula
          • Ken Buchanan
          • Liang Zhao
          • Michal Mocny
          • Monica Chintala
          • Nico Weber
          • Thomas BERTET
            Submit Requirements:
              • requirement satisfiedCode-Coverage
              • requirement 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: If3e61ee55318b46bf2b07a16d113a5a388f7bf67
              Gerrit-Change-Number: 7575656
              Gerrit-PatchSet: 10
              Gerrit-Owner: Thomas BERTET <thomas...@gmail.com>
              Gerrit-Reviewer: Ari Chivukula <ari...@chromium.org>
              Gerrit-Reviewer: Ken Buchanan <ke...@chromium.org>
              Gerrit-Reviewer: Michal Mocny <mmo...@chromium.org>
              Gerrit-Reviewer: Nico Weber <tha...@chromium.org>
              Gerrit-CC: Andrew Comminos <acom...@meta.com>
              Gerrit-CC: Annie Sullivan <sull...@chromium.org>
              Gerrit-CC: Benedikt Meurer <bme...@chromium.org>
              Gerrit-CC: Chromium IPC Reviews <chrome-ip...@google.com>
              Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
              Gerrit-CC: Liang Zhao <lz...@microsoft.com>
              Gerrit-CC: Luna Lu <loon...@chromium.org>
              Gerrit-CC: Monica Chintala <moni...@microsoft.com>
              Gerrit-CC: Simon Zünd <szu...@chromium.org>
              Gerrit-CC: Thomas Bertet <thomas...@datadoghq.com>
              Gerrit-CC: gwsq
              Gerrit-Attention: Nico Weber <tha...@chromium.org>
              Gerrit-Attention: Ken Buchanan <ke...@chromium.org>
              Gerrit-Attention: Ari Chivukula <ari...@chromium.org>
              Gerrit-Attention: Liang Zhao <lz...@microsoft.com>
              Gerrit-Attention: Monica Chintala <moni...@microsoft.com>
              Gerrit-Attention: Michal Mocny <mmo...@chromium.org>
              Gerrit-Attention: Thomas BERTET <thomas...@gmail.com>
              Gerrit-Comment-Date: Thu, 21 May 2026 12:04:05 +0000
              Gerrit-HasComments: Yes
              Gerrit-Has-Labels: No
              Comment-In-Reply-To: Ari Chivukula <ari...@chromium.org>
              satisfied_requirement
              unsatisfied_requirement
              open
              diffy

              Ken Buchanan (Gerrit)

              unread,
              May 25, 2026, 9:42:21 AM (17 hours ago) May 25
              to Thomas BERTET, Chromium LUCI CQ, Nico Weber, Chromium IPC Reviews, Michal Mocny, Ari Chivukula, Simon Zünd, Annie Sullivan, Andrew Comminos, Liang Zhao, android-bu...@system.gserviceaccount.com, Thomas Bertet, Monica Chintala, Chromium Metrics Reviews, chromium...@chromium.org, Luna Lu, blink-revie...@chromium.org, asvitkine...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, core-timi...@chromium.org, iclella...@chromium.org, ipc-securi...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, speed-metrics...@chromium.org
              Attention needed from Ari Chivukula, Liang Zhao, Michal Mocny, Monica Chintala, Nico Weber and Thomas BERTET

              Ken Buchanan voted Code-Review+1

              Code-Review+1
              Open in Gerrit

              Related details

              Attention is currently required from:
              • Ari Chivukula
              Gerrit-Attention: Ari Chivukula <ari...@chromium.org>
              Gerrit-Attention: Liang Zhao <lz...@microsoft.com>
              Gerrit-Attention: Monica Chintala <moni...@microsoft.com>
              Gerrit-Attention: Michal Mocny <mmo...@chromium.org>
              Gerrit-Attention: Thomas BERTET <thomas...@gmail.com>
              Gerrit-Comment-Date: Mon, 25 May 2026 13:42:09 +0000
              Gerrit-HasComments: No
              Gerrit-Has-Labels: Yes
              satisfied_requirement
              unsatisfied_requirement
              open
              diffy

              Ari Chivukula (Gerrit)

              unread,
              May 25, 2026, 9:42:04 PM (5 hours ago) May 25
              to Thomas BERTET, Ken Buchanan, Chromium LUCI CQ, Nico Weber, Chromium IPC Reviews, Michal Mocny, Simon Zünd, Annie Sullivan, Andrew Comminos, Liang Zhao, android-bu...@system.gserviceaccount.com, Thomas Bertet, Monica Chintala, Chromium Metrics Reviews, chromium...@chromium.org, Luna Lu, blink-revie...@chromium.org, asvitkine...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, core-timi...@chromium.org, iclella...@chromium.org, ipc-securi...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, speed-metrics...@chromium.org
              Attention needed from Liang Zhao, Michal Mocny, Monica Chintala, Nico Weber and Thomas BERTET

              Ari Chivukula voted and added 3 comments

              Votes added by Ari Chivukula

              Code-Review+1

              3 comments

              Patchset-level comments
              File-level comment, Patchset 10 (Latest):
              Ari Chivukula . resolved

              still LGTM

              File third_party/blink/public/common/permissions_policy/document_policy_enum_values.h
              Line 26, Patchset 10 (Latest):inline std::optional<int32_t> DocumentPolicyEnumTokenToValue(
              Ari Chivukula . unresolved

              mind outlining in a README (maybe in this folder) the spots that need to be updated to support new enum values?

              File third_party/blink/renderer/core/permissions_policy/document_policy_features.json5
              Line 15, Patchset 10 (Latest): // valid c++ expression strings, e.g. true/false, 1.0, -1.
              Ari Chivukula . unresolved

              maybe a note here that enum values are underlying type not named constants

              Open in Gerrit

              Related details

              Attention is currently required from:
              • Liang Zhao
              • Michal Mocny
              • Monica Chintala
              • Nico Weber
              • Thomas BERTET
              Submit Requirements:
                • requirement satisfiedCode-Coverage
                • requirement satisfiedCode-Owners
                • requirement satisfiedCode-Review
                • requirement is not satisfiedNo-Unresolved-Comments
                • requirement satisfiedReview-Enforcement
                Gerrit-Attention: Liang Zhao <lz...@microsoft.com>
                Gerrit-Attention: Monica Chintala <moni...@microsoft.com>
                Gerrit-Attention: Michal Mocny <mmo...@chromium.org>
                Gerrit-Attention: Thomas BERTET <thomas...@gmail.com>
                Gerrit-Comment-Date: Tue, 26 May 2026 01:41:55 +0000
                Gerrit-HasComments: Yes
                Gerrit-Has-Labels: Yes
                satisfied_requirement
                unsatisfied_requirement
                open
                diffy
                Reply all
                Reply to author
                Forward
                0 new messages