[Platform-provided behaviors] Use counters and console warning [chromium/src : main]

0 views
Skip to first unread message

Ana Sollano Kim (Gerrit)

unread,
Apr 16, 2026, 4:46:04 PM (14 days ago) Apr 16
to Dan Clark, Mason Freed, Leo Lee, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, Chromium Metrics Reviews, chromium...@chromium.org, asvitkine...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, dominicc+...@chromium.org, kinuko...@chromium.org
Attention needed from Dan Clark and Mason Freed

Ana Sollano Kim added 1 comment

Patchset-level comments
File-level comment, Patchset 3 (Latest):
Ana Sollano Kim . resolved

PTAL when you get the chance 😊

Open in Gerrit

Related details

Attention is currently required from:
  • Dan Clark
  • Mason Freed
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • 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: I26ec537ec5e4e70e675f2e9a4e1d0a37d7694cf5
Gerrit-Change-Number: 7766825
Gerrit-PatchSet: 3
Gerrit-Owner: Ana Sollano Kim <anso...@microsoft.com>
Gerrit-Reviewer: Ana Sollano Kim <anso...@microsoft.com>
Gerrit-Reviewer: Dan Clark <dan...@microsoft.com>
Gerrit-Reviewer: Mason Freed <mas...@chromium.org>
Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
Gerrit-CC: Leo Lee <leo...@microsoft.com>
Gerrit-Attention: Mason Freed <mas...@chromium.org>
Gerrit-Attention: Dan Clark <dan...@microsoft.com>
Gerrit-Comment-Date: Thu, 16 Apr 2026 20:45:54 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Dan Clark (Gerrit)

unread,
Apr 17, 2026, 2:10:17 PM (13 days ago) Apr 17
to Ana Sollano Kim, Mason Freed, Leo Lee, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, Chromium Metrics Reviews, chromium...@chromium.org, asvitkine...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, dominicc+...@chromium.org, kinuko...@chromium.org
Attention needed from Ana Sollano Kim and Mason Freed

Dan Clark voted and added 5 comments

Votes added by Dan Clark

Code-Review+1

5 comments

Patchset-level comments
Dan Clark . resolved

LGTM with a few small things.

At some point (maybe now?) we'll also want a [WebDX UseCounter](https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/public/mojom/use_counter/metrics/webdx_feature.mojom;bpv=1;bpt=0) that measures the use of HTMLSubmitButtonBehavior all-up and will be associated with its entry in https://github.com/web-platform-dx/web-features. The HTMLSubmitButtonBehavior constructor would be a good place for it.

File third_party/blink/renderer/core/html/custom/element_internals.cc
Line 415, Patchset 3 (Latest): UseCounter::Count(Target().GetDocument(),
Dan Clark . unresolved

This can be done in the `element_internals.idl` with the [`MeasureAs`](https://chromium.googlesource.com/chromium/src/+/HEAD/third_party/blink/renderer/bindings/IDLExtendedAttributes.md#measureas) extended attribute.

File third_party/blink/renderer/core/html/forms/html_submit_button_behavior.cc
Line 21, Patchset 3 (Latest): UseCounter::Count(execution_context,
Dan Clark . unresolved

Can be done with `MeasureAs` extended attribute on the `html_submit_button_behavior.idl` constructor.

File third_party/blink/web_tests/fast/forms/element-internals-behaviors-usecounter.html
Line 37, Patchset 3 (Latest): assert_true(internals.isUseCounted(document, kHTMLSubmitButtonBehaviorUsage));
Dan Clark . unresolved

nit: you could make this more fine-grained by assigning `new HTMLSubmitButtonBehavior()` to a variable, then checking that `kHTMLSubmitButtonBehaviorUsage` (and only `kHTMLSubmitButtonBehaviorUsage`) is set, and only then doing `attachInternals` and checking the other counter.

Line 46, Patchset 3 (Latest): assert_false(internals.isUseCounted(document, kElementInternalsBehaviorsAccess));
Dan Clark . unresolved

Another good test case would be to validate that this is still counted even when `behaviors` is empty.

Open in Gerrit

Related details

Attention is currently required from:
  • Ana Sollano Kim
  • Mason Freed
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: I26ec537ec5e4e70e675f2e9a4e1d0a37d7694cf5
Gerrit-Change-Number: 7766825
Gerrit-PatchSet: 3
Gerrit-Owner: Ana Sollano Kim <anso...@microsoft.com>
Gerrit-Reviewer: Ana Sollano Kim <anso...@microsoft.com>
Gerrit-Reviewer: Dan Clark <dan...@microsoft.com>
Gerrit-Reviewer: Mason Freed <mas...@chromium.org>
Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
Gerrit-CC: Leo Lee <leo...@microsoft.com>
Gerrit-Attention: Ana Sollano Kim <anso...@microsoft.com>
Gerrit-Attention: Mason Freed <mas...@chromium.org>
Gerrit-Comment-Date: Fri, 17 Apr 2026 18:10:06 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Ana Sollano Kim (Gerrit)

unread,
Apr 20, 2026, 1:33:28 PM (10 days ago) Apr 20
to Dan Clark, Mason Freed, Leo Lee, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, Chromium Metrics Reviews, chromium...@chromium.org, jmedle...@chromium.org, asvitkine...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, dominicc+...@chromium.org, kinuko...@chromium.org
Attention needed from Dan Clark and Mason Freed

Ana Sollano Kim added 4 comments

File third_party/blink/renderer/core/html/custom/element_internals.cc
Line 415, Patchset 3: UseCounter::Count(Target().GetDocument(),
Dan Clark . resolved

This can be done in the `element_internals.idl` with the [`MeasureAs`](https://chromium.googlesource.com/chromium/src/+/HEAD/third_party/blink/renderer/bindings/IDLExtendedAttributes.md#measureas) extended attribute.

Ana Sollano Kim

Done

File third_party/blink/renderer/core/html/forms/html_submit_button_behavior.cc
Line 21, Patchset 3: UseCounter::Count(execution_context,
Dan Clark . resolved

Can be done with `MeasureAs` extended attribute on the `html_submit_button_behavior.idl` constructor.

Ana Sollano Kim

Done

File third_party/blink/web_tests/fast/forms/element-internals-behaviors-usecounter.html
Line 37, Patchset 3: assert_true(internals.isUseCounted(document, kHTMLSubmitButtonBehaviorUsage));
Dan Clark . resolved

nit: you could make this more fine-grained by assigning `new HTMLSubmitButtonBehavior()` to a variable, then checking that `kHTMLSubmitButtonBehaviorUsage` (and only `kHTMLSubmitButtonBehaviorUsage`) is set, and only then doing `attachInternals` and checking the other counter.

Ana Sollano Kim

Done

Line 46, Patchset 3: assert_false(internals.isUseCounted(document, kElementInternalsBehaviorsAccess));
Dan Clark . resolved

Another good test case would be to validate that this is still counted even when `behaviors` is empty.

Ana Sollano Kim

Done

Open in Gerrit

Related details

Attention is currently required from:
  • Dan Clark
  • Mason Freed
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • 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: I26ec537ec5e4e70e675f2e9a4e1d0a37d7694cf5
Gerrit-Change-Number: 7766825
Gerrit-PatchSet: 4
Gerrit-Owner: Ana Sollano Kim <anso...@microsoft.com>
Gerrit-Reviewer: Ana Sollano Kim <anso...@microsoft.com>
Gerrit-Reviewer: Dan Clark <dan...@microsoft.com>
Gerrit-Reviewer: Mason Freed <mas...@chromium.org>
Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
Gerrit-CC: Leo Lee <leo...@microsoft.com>
Gerrit-Attention: Mason Freed <mas...@chromium.org>
Gerrit-Attention: Dan Clark <dan...@microsoft.com>
Gerrit-Comment-Date: Mon, 20 Apr 2026 17:33:19 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Dan Clark <dan...@microsoft.com>
satisfied_requirement
unsatisfied_requirement
open
diffy

Ana Sollano Kim (Gerrit)

unread,
Apr 22, 2026, 12:08:02 PM (8 days ago) Apr 22
to Dan Clark, Mason Freed, Leo Lee, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, Chromium Metrics Reviews, chromium...@chromium.org, jmedle...@chromium.org, asvitkine...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, dominicc+...@chromium.org, kinuko...@chromium.org
Attention needed from Dan Clark and Mason Freed

Ana Sollano Kim added 1 comment

Patchset-level comments
Dan Clark . resolved

LGTM with a few small things.

At some point (maybe now?) we'll also want a [WebDX UseCounter](https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/public/mojom/use_counter/metrics/webdx_feature.mojom;bpv=1;bpt=0) that measures the use of HTMLSubmitButtonBehavior all-up and will be associated with its entry in https://github.com/web-platform-dx/web-features. The HTMLSubmitButtonBehavior constructor would be a good place for it.

Gerrit-Comment-Date: Wed, 22 Apr 2026 16:07:52 +0000
satisfied_requirement
unsatisfied_requirement
open
diffy

Dan Clark (Gerrit)

unread,
Apr 22, 2026, 1:34:18 PM (8 days ago) Apr 22
to Ana Sollano Kim, Mason Freed, Leo Lee, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, Chromium Metrics Reviews, chromium...@chromium.org, jmedle...@chromium.org, asvitkine...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, dominicc+...@chromium.org, kinuko...@chromium.org
Attention needed from Ana Sollano Kim and Mason Freed

Dan Clark voted and added 1 comment

Votes added by Dan Clark

Code-Review+1

1 comment

Patchset-level comments
File-level comment, Patchset 4 (Latest):
Dan Clark . resolved

Still LGTM, thanks for the follow-ups.

Open in Gerrit

Related details

Attention is currently required from:
  • Ana Sollano Kim
  • Mason Freed
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement satisfiedCode-Owners
  • requirement satisfiedCode-Review
  • 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: I26ec537ec5e4e70e675f2e9a4e1d0a37d7694cf5
Gerrit-Change-Number: 7766825
Gerrit-PatchSet: 4
Gerrit-Owner: Ana Sollano Kim <anso...@microsoft.com>
Gerrit-Reviewer: Ana Sollano Kim <anso...@microsoft.com>
Gerrit-Reviewer: Dan Clark <dan...@microsoft.com>
Gerrit-Reviewer: Mason Freed <mas...@chromium.org>
Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
Gerrit-CC: Leo Lee <leo...@microsoft.com>
Gerrit-Attention: Ana Sollano Kim <anso...@microsoft.com>
Gerrit-Attention: Mason Freed <mas...@chromium.org>
Gerrit-Comment-Date: Wed, 22 Apr 2026 17:34:12 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
open
diffy

Mason Freed (Gerrit)

unread,
Apr 22, 2026, 4:59:36 PM (8 days ago) Apr 22
to Ana Sollano Kim, Dan Clark, Leo Lee, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, Chromium Metrics Reviews, chromium...@chromium.org, jmedle...@chromium.org, asvitkine...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, dominicc+...@chromium.org, kinuko...@chromium.org
Attention needed from Ana Sollano Kim

Mason Freed voted and added 2 comments

Votes added by Mason Freed

Code-Review+1

2 comments

Patchset-level comments
Mason Freed . resolved

LGTM, just one comment about the tests.

File third_party/blink/web_tests/fast/forms/element-internals-behaviors-usecounter.html
Line 36, Patchset 4 (Latest): assert_false(internals.isUseCounted(document, UseCounter.kElementInternalsWithBehaviors));
Mason Freed . unresolved

In all of these tests, it'd be good to assert the state of all three counters, just to make your expectations explicit.

Open in Gerrit

Related details

Attention is currently required from:
  • Ana Sollano Kim
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: I26ec537ec5e4e70e675f2e9a4e1d0a37d7694cf5
    Gerrit-Change-Number: 7766825
    Gerrit-PatchSet: 4
    Gerrit-Owner: Ana Sollano Kim <anso...@microsoft.com>
    Gerrit-Reviewer: Ana Sollano Kim <anso...@microsoft.com>
    Gerrit-Reviewer: Dan Clark <dan...@microsoft.com>
    Gerrit-Reviewer: Mason Freed <mas...@chromium.org>
    Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
    Gerrit-CC: Leo Lee <leo...@microsoft.com>
    Gerrit-Attention: Ana Sollano Kim <anso...@microsoft.com>
    Gerrit-Comment-Date: Wed, 22 Apr 2026 20:59:29 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Ana Sollano Kim (Gerrit)

    unread,
    Apr 23, 2026, 3:23:41 PM (7 days ago) Apr 23
    to Mason Freed, Dan Clark, Leo Lee, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, Chromium Metrics Reviews, chromium...@chromium.org, jmedle...@chromium.org, asvitkine...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, dominicc+...@chromium.org, kinuko...@chromium.org

    Ana Sollano Kim added 2 comments

    Ana Sollano Kim . resolved

    Thanks for the reviews!

    File third_party/blink/web_tests/fast/forms/element-internals-behaviors-usecounter.html
    Line 36, Patchset 4: assert_false(internals.isUseCounted(document, UseCounter.kElementInternalsWithBehaviors));
    Mason Freed . resolved

    In all of these tests, it'd be good to assert the state of all three counters, just to make your expectations explicit.

    Ana Sollano Kim

    Done

    Open in Gerrit

    Related details

    Attention set is empty
    Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement satisfiedCode-Owners
      • requirement satisfiedCode-Review
      • 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: I26ec537ec5e4e70e675f2e9a4e1d0a37d7694cf5
      Gerrit-Change-Number: 7766825
      Gerrit-PatchSet: 5
      Gerrit-Owner: Ana Sollano Kim <anso...@microsoft.com>
      Gerrit-Reviewer: Ana Sollano Kim <anso...@microsoft.com>
      Gerrit-Reviewer: Dan Clark <dan...@microsoft.com>
      Gerrit-Reviewer: Mason Freed <mas...@chromium.org>
      Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
      Gerrit-CC: Leo Lee <leo...@microsoft.com>
      Gerrit-Comment-Date: Thu, 23 Apr 2026 19:23:33 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Mason Freed <mas...@chromium.org>
      satisfied_requirement
      open
      diffy

      Ana Sollano Kim (Gerrit)

      unread,
      Apr 23, 2026, 3:23:45 PM (7 days ago) Apr 23
      to Mason Freed, Dan Clark, Leo Lee, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, Chromium Metrics Reviews, chromium...@chromium.org, jmedle...@chromium.org, asvitkine...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, dominicc+...@chromium.org, kinuko...@chromium.org

      Ana Sollano Kim voted Commit-Queue+2

      Commit-Queue+2
      Gerrit-Comment-Date: Thu, 23 Apr 2026 19:23:38 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      open
      diffy

      Chromium LUCI CQ (Gerrit)

      unread,
      Apr 23, 2026, 3:47:40 PM (7 days ago) Apr 23
      to Ana Sollano Kim, Mason Freed, Dan Clark, Leo Lee, android-bu...@system.gserviceaccount.com, Chromium Metrics Reviews, chromium...@chromium.org, jmedle...@chromium.org, asvitkine...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, dominicc+...@chromium.org, kinuko...@chromium.org

      Chromium LUCI CQ submitted the change with unreviewed changes

      Unreviewed changes

      4 is the latest approved patch-set.
      The change was submitted with unreviewed changes in the following files:

      ```
      The name of the file: tools/metrics/histograms/metadata/blink/enums.xml
      Insertions: 8, Deletions: 3.

      The diff is too large to show. Please review the diff.
      ```
      ```
      The name of the file: third_party/blink/web_tests/fast/forms/element-internals-behaviors-usecounter.html
      Insertions: 16, Deletions: 4.

      The diff is too large to show. Please review the diff.
      ```
      ```
      The name of the file: third_party/blink/public/mojom/use_counter/metrics/web_feature.mojom
      Insertions: 8, Deletions: 3.

      The diff is too large to show. Please review the diff.
      ```

      Change information

      Commit message:
      [Platform-provided behaviors] Use counters and console warning

      This change adds three new UseCounters to track feature adoption and
      usage patterns:

      - kElementInternalsWithBehaviors: Counted when attachInternals() is
      called with a behaviors list.
      - kElementInternalsBehaviorsAccess: Counted when the behaviors getter
      on ElementInternals is accessed.
      - kHTMLSubmitButtonBehaviorUsage: Counted when the submit button
      behavior is instantiated.

      A console warning is now issued when an HTMLSubmitButtonBehavior is
      attached to a custom element that is not form-associated to provide
      feedback to developers when the behavior is used in a context where it
      can't submit forms.

      Explainer:
      https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/main/PlatformProvidedBehaviors/explainer.md
      Design doc:
      https://docs.google.com/document/d/1LA1hhzxmi4OmZoGtIdnwvL3g7y48YjXTOoUvFtxFugE/edit?usp=sharing
      Bug: 486928684
      Change-Id: I26ec537ec5e4e70e675f2e9a4e1d0a37d7694cf5
      Reviewed-by: Mason Freed <mas...@chromium.org>
      Reviewed-by: Dan Clark <dan...@microsoft.com>
      Commit-Queue: Ana Sollano Kim <anso...@microsoft.com>
      Cr-Commit-Position: refs/heads/main@{#1619710}
      Files:
      • M third_party/blink/public/mojom/use_counter/metrics/web_feature.mojom
      • M third_party/blink/renderer/core/html/custom/element_internals.cc
      • M third_party/blink/renderer/core/html/custom/element_internals.idl
      • M third_party/blink/renderer/core/html/forms/html_submit_button_behavior.cc
      • M third_party/blink/renderer/core/html/forms/html_submit_button_behavior.h
      • M third_party/blink/renderer/core/html/forms/html_submit_button_behavior.idl
      • M third_party/blink/renderer/core/html/html_element.cc
      • A third_party/blink/web_tests/fast/forms/element-internals-behaviors-non-form-associated-warning-expected.txt
      • A third_party/blink/web_tests/fast/forms/element-internals-behaviors-non-form-associated-warning.html
      • A third_party/blink/web_tests/fast/forms/element-internals-behaviors-usecounter.html
      • M tools/metrics/histograms/metadata/blink/enums.xml
      Change size: M
      Delta: 11 files changed, 153 insertions(+), 7 deletions(-)
      Branch: refs/heads/main
      Submit Requirements:
      • requirement satisfiedCode-Review: +1 by Dan Clark, +1 by Mason Freed
      Open in Gerrit
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: merged
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: I26ec537ec5e4e70e675f2e9a4e1d0a37d7694cf5
      Gerrit-Change-Number: 7766825
      Gerrit-PatchSet: 6
      Gerrit-Owner: Ana Sollano Kim <anso...@microsoft.com>
      Gerrit-Reviewer: Ana Sollano Kim <anso...@microsoft.com>
      Gerrit-Reviewer: Chromium LUCI CQ <chromiu...@luci-project-accounts.iam.gserviceaccount.com>
      Gerrit-Reviewer: Dan Clark <dan...@microsoft.com>
      Gerrit-Reviewer: Mason Freed <mas...@chromium.org>
      open
      diffy
      satisfied_requirement
      Reply all
      Reply to author
      Forward
      0 new messages