Allow the creation of null registry element and shadow root [chromium/src : main]

0 views
Skip to first unread message

YeongHan Kim (Gerrit)

unread,
Nov 24, 2025, 12:27:53 PM (13 days ago) Nov 24
to Jayson Chen, Mason Freed, Chromium LUCI CQ, chromium...@chromium.org, blink-re...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, jmedle...@chromium.org
Attention needed from Jayson Chen and Mason Freed

YeongHan Kim voted and added 1 comment

Votes added by YeongHan Kim

Commit-Queue+1

1 comment

Patchset-level comments
File-level comment, Patchset 2 (Latest):
YeongHan Kim . resolved

Please take a look.
This CL reflects Anne’s latest changes.

Thank you!

Open in Gerrit

Related details

Attention is currently required from:
  • Jayson Chen
  • 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: I14c2638d779b947d0486a154b062b722073c4089
Gerrit-Change-Number: 7198720
Gerrit-PatchSet: 2
Gerrit-Owner: YeongHan Kim <soosu...@gmail.com>
Gerrit-Reviewer: Jayson Chen <jayso...@microsoft.com>
Gerrit-Reviewer: Mason Freed <mas...@chromium.org>
Gerrit-Reviewer: YeongHan Kim <soosu...@gmail.com>
Gerrit-Attention: Jayson Chen <jayso...@microsoft.com>
Gerrit-Attention: Mason Freed <mas...@chromium.org>
Gerrit-Comment-Date: Mon, 24 Nov 2025 17:27:19 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Jayson Chen (Gerrit)

unread,
Nov 24, 2025, 5:06:21 PM (13 days ago) Nov 24
to YeongHan Kim, Mason Freed, Chromium LUCI CQ, chromium...@chromium.org, blink-re...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, jmedle...@chromium.org
Attention needed from Mason Freed and YeongHan Kim

Jayson Chen added 3 comments

Patchset-level comments
Jayson Chen . resolved

The implementation looks good to me, but it seems like it's causing some WPTs and unit tests failure. Would you be able to take a look at the unit test failures on CQ to see if it's something you're able to fix? Feel free to leave it to me to investigate if you're not sure about it.

Also, it may be a good idea to use virtual test suite for now.

File third_party/blink/renderer/core/dom/document.cc
Line 1435, Patchset 2 (Latest): // 3-2. If options[""customElementRegistry"] exists:
Jayson Chen . unresolved

nit: extra "

File third_party/blink/web_tests/external/wpt/custom-elements/registries/scoped-registry-initialize-expected.txt
Line 1, Patchset 2 (Latest):This is a testharness.js-based test.
Jayson Chen . unresolved

These test failures seem a bit odd. Could you help me check if these assert failures are happening on [this check](https://github.com/web-platform-tests/wpt/blob/71663448bfcaabc177533e4d6ce0dfd743aed6bd/custom-elements/registries/scoped-registry-initialize.html#L75)? May be something I need to go investigate.

Open in Gerrit

Related details

Attention is currently required from:
  • Mason Freed
  • YeongHan Kim
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: I14c2638d779b947d0486a154b062b722073c4089
    Gerrit-Change-Number: 7198720
    Gerrit-PatchSet: 2
    Gerrit-Owner: YeongHan Kim <soosu...@gmail.com>
    Gerrit-Reviewer: Jayson Chen <jayso...@microsoft.com>
    Gerrit-Reviewer: Mason Freed <mas...@chromium.org>
    Gerrit-Reviewer: YeongHan Kim <soosu...@gmail.com>
    Gerrit-Attention: Mason Freed <mas...@chromium.org>
    Gerrit-Attention: YeongHan Kim <soosu...@gmail.com>
    Gerrit-Comment-Date: Mon, 24 Nov 2025 22:06:08 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    YeongHan Kim (Gerrit)

    unread,
    Nov 24, 2025, 9:12:30 PM (13 days ago) Nov 24
    to Jayson Chen, Mason Freed, Chromium LUCI CQ, chromium...@chromium.org, blink-re...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, jmedle...@chromium.org
    Attention needed from Mason Freed

    YeongHan Kim added 1 comment

    Patchset-level comments
    YeongHan Kim . resolved

    Thanks for the review!

    I uploaded this CL mainly to confirm the overall direction first.
    I’ll take a closer look at the WPT and unit test failures on CQ and investigate what’s going wrong.

    Thanks again for the helpful inputs!

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Mason Freed
    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: I14c2638d779b947d0486a154b062b722073c4089
    Gerrit-Change-Number: 7198720
    Gerrit-PatchSet: 2
    Gerrit-Owner: YeongHan Kim <soosu...@gmail.com>
    Gerrit-Reviewer: Jayson Chen <jayso...@microsoft.com>
    Gerrit-Reviewer: Mason Freed <mas...@chromium.org>
    Gerrit-Reviewer: YeongHan Kim <soosu...@gmail.com>
    Gerrit-Attention: Mason Freed <mas...@chromium.org>
    Gerrit-Comment-Date: Tue, 25 Nov 2025 02:12:03 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    YeongHan Kim (Gerrit)

    unread,
    Nov 27, 2025, 12:30:32 AM (11 days ago) Nov 27
    to Jayson Chen, Mason Freed, Chromium LUCI CQ, chromium...@chromium.org, blink-re...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, jmedle...@chromium.org
    Attention needed from Jayson Chen and Mason Freed

    YeongHan Kim added 4 comments

    Patchset-level comments
    File-level comment, Patchset 7 (Latest):
    YeongHan Kim . resolved

    Sorry for the wait! When you get a chance, could you take another look?
    Thanks!

    File third_party/blink/renderer/core/dom/document.cc
    Line 1435, Patchset 2: // 3-2. If options[""customElementRegistry"] exists:
    Jayson Chen . resolved

    nit: extra "

    YeongHan Kim

    Done

    Line 1468, Patchset 7 (Parent): is = AtomicString(string_or_options->GetAsString());
    YeongHan Kim . resolved

    According to the specification, the element creation options parameter can accept either a string or an ElementCreationOptions dictionary, and the string must be ignored.
    This behavior is covered by the `Document-createElement-customized-builtins` test.
    However, the current implementation incorrectly assigns the is attribute when a string is provided.

    The reason the test previously passed is that when flattening the CreateElementOptions, the default value of the registry was null, which caused the `definition` step to be skipped.
    Due to the recent spec change, the default registry is now the global custom element registry, which exposed this issue.

    Therefore, this patch updates the behavior so that when a string is passed as the element creation options, it is ignored as required by the specification.

    File third_party/blink/web_tests/external/wpt/custom-elements/registries/scoped-registry-initialize-expected.txt
    Line 1, Patchset 2:This is a testharness.js-based test.
    Jayson Chen . resolved

    These test failures seem a bit odd. Could you help me check if these assert failures are happening on [this check](https://github.com/web-platform-tests/wpt/blob/71663448bfcaabc177533e4d6ce0dfd743aed6bd/custom-elements/registries/scoped-registry-initialize.html#L75)? May be something I need to go investigate.

    YeongHan Kim

    Previously, if the `registry` is coming as null, `SetCustomElementRegisty()` is skipped in `CreateUncustomizedOrUndefinedElementTemplate`[1]. However, with the spec change, if ElementCreationOptions.registry is set to null, we now need to call SetCustomElementRegistry() with null.

    Since `SetCustomElementRegistry` can be invoked in various situations, it should only set the `registry` when ElementCreationOptions.registry is explicitly null. To address this, I introduced an `is_explicit_null` flag.

    I’m not entirely sure if this is the best approach, so I’d appreciate any feedback or suggestions for a better solution.

    [1] https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/html/custom/custom_element.cc;l=173;drc=4497bff67a809a49fdb7f3fa7635329021000e2f

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Jayson Chen
    • 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: I14c2638d779b947d0486a154b062b722073c4089
      Gerrit-Change-Number: 7198720
      Gerrit-PatchSet: 7
      Gerrit-Owner: YeongHan Kim <soosu...@gmail.com>
      Gerrit-Reviewer: Jayson Chen <jayso...@microsoft.com>
      Gerrit-Reviewer: Mason Freed <mas...@chromium.org>
      Gerrit-Reviewer: YeongHan Kim <soosu...@gmail.com>
      Gerrit-Attention: Jayson Chen <jayso...@microsoft.com>
      Gerrit-Attention: Mason Freed <mas...@chromium.org>
      Gerrit-Comment-Date: Thu, 27 Nov 2025 05:29:59 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Jayson Chen <jayso...@microsoft.com>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Jayson Chen (Gerrit)

      unread,
      Dec 2, 2025, 1:04:21 AM (6 days ago) Dec 2
      to YeongHan Kim, Mason Freed, Chromium LUCI CQ, chromium...@chromium.org, blink-re...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, jmedle...@chromium.org
      Attention needed from Mason Freed and YeongHan Kim

      Jayson Chen added 3 comments

      Patchset-level comments
      Jayson Chen . resolved

      Thanks for looking into the test failures and finding this issue. Left some thoughts about how we can handle the two null cases (explicit vs implicit) in CreateElement

      File third_party/blink/renderer/core/dom/document.cc
      Line 1468, Patchset 7 (Parent): is = AtomicString(string_or_options->GetAsString());
      YeongHan Kim . resolved

      According to the specification, the element creation options parameter can accept either a string or an ElementCreationOptions dictionary, and the string must be ignored.
      This behavior is covered by the `Document-createElement-customized-builtins` test.
      However, the current implementation incorrectly assigns the is attribute when a string is provided.

      The reason the test previously passed is that when flattening the CreateElementOptions, the default value of the registry was null, which caused the `definition` step to be skipped.
      Due to the recent spec change, the default registry is now the global custom element registry, which exposed this issue.

      Therefore, this patch updates the behavior so that when a string is passed as the element creation options, it is ignored as required by the specification.

      Jayson Chen

      Sounds good, thanks for finding this issue.

      File third_party/blink/web_tests/external/wpt/custom-elements/registries/scoped-registry-initialize-expected.txt
      Line 1, Patchset 2:This is a testharness.js-based test.
      Jayson Chen . unresolved

      These test failures seem a bit odd. Could you help me check if these assert failures are happening on [this check](https://github.com/web-platform-tests/wpt/blob/71663448bfcaabc177533e4d6ce0dfd743aed6bd/custom-elements/registries/scoped-registry-initialize.html#L75)? May be something I need to go investigate.

      YeongHan Kim

      Previously, if the `registry` is coming as null, `SetCustomElementRegisty()` is skipped in `CreateUncustomizedOrUndefinedElementTemplate`[1]. However, with the spec change, if ElementCreationOptions.registry is set to null, we now need to call SetCustomElementRegistry() with null.

      Since `SetCustomElementRegistry` can be invoked in various situations, it should only set the `registry` when ElementCreationOptions.registry is explicitly null. To address this, I introduced an `is_explicit_null` flag.

      I’m not entirely sure if this is the best approach, so I’d appreciate any feedback or suggestions for a better solution.

      [1] https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/html/custom/custom_element.cc;l=173;drc=4497bff67a809a49fdb7f3fa7635329021000e2f

      Jayson Chen

      Thanks for looking into this issue! Now it seems like the main issue is that CreateElement function needs to know whether the passed in nullptr is an explicit null or implicit null (so default registry). I wonder if this will be a good chance for us to overload CreateElement function (as mentioned in the comment in code), one without registry argument so we provide the default registry in the impl and one with registry argument and we always respect the passed in value. This way we don't need to differentiate two different kinds of nullptr in CreateElement and also don't need to have extra explicit null optional argument that may be confusing down the line. This may require some changes to update CreateElement usages though.

      One related question: in flatten element creation option, do we need `is_explicit_null`? Given that we by default use the default registry if not provided by option, is it possible to have a null registry value that should actually be considered as default value? If we do get nullptr from `document->customElementRegistry()` as the default registry value, we'd want to consider that an explicit null registry, right?

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Mason Freed
      • YeongHan Kim
      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: I14c2638d779b947d0486a154b062b722073c4089
        Gerrit-Change-Number: 7198720
        Gerrit-PatchSet: 7
        Gerrit-Owner: YeongHan Kim <soosu...@gmail.com>
        Gerrit-Reviewer: Jayson Chen <jayso...@microsoft.com>
        Gerrit-Reviewer: Mason Freed <mas...@chromium.org>
        Gerrit-Reviewer: YeongHan Kim <soosu...@gmail.com>
        Gerrit-Attention: Mason Freed <mas...@chromium.org>
        Gerrit-Attention: YeongHan Kim <soosu...@gmail.com>
        Gerrit-Comment-Date: Tue, 02 Dec 2025 06:03:57 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        Comment-In-Reply-To: Jayson Chen <jayso...@microsoft.com>
        Comment-In-Reply-To: YeongHan Kim <soosu...@gmail.com>
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        YeongHan Kim (Gerrit)

        unread,
        Dec 3, 2025, 11:08:41 AM (4 days ago) Dec 3
        to Jayson Chen, Mason Freed, Chromium LUCI CQ, chromium...@chromium.org, blink-re...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, jmedle...@chromium.org
        Attention needed from Jayson Chen and Mason Freed

        YeongHan Kim added 2 comments

        Patchset-level comments
        YeongHan Kim . resolved

        Thanks for the review!

        File third_party/blink/web_tests/external/wpt/custom-elements/registries/scoped-registry-initialize-expected.txt
        Line 1, Patchset 2:This is a testharness.js-based test.
        Jayson Chen . resolved

        These test failures seem a bit odd. Could you help me check if these assert failures are happening on [this check](https://github.com/web-platform-tests/wpt/blob/71663448bfcaabc177533e4d6ce0dfd743aed6bd/custom-elements/registries/scoped-registry-initialize.html#L75)? May be something I need to go investigate.

        YeongHan Kim

        Previously, if the `registry` is coming as null, `SetCustomElementRegisty()` is skipped in `CreateUncustomizedOrUndefinedElementTemplate`[1]. However, with the spec change, if ElementCreationOptions.registry is set to null, we now need to call SetCustomElementRegistry() with null.

        Since `SetCustomElementRegistry` can be invoked in various situations, it should only set the `registry` when ElementCreationOptions.registry is explicitly null. To address this, I introduced an `is_explicit_null` flag.

        I’m not entirely sure if this is the best approach, so I’d appreciate any feedback or suggestions for a better solution.

        [1] https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/html/custom/custom_element.cc;l=173;drc=4497bff67a809a49fdb7f3fa7635329021000e2f

        Jayson Chen

        Thanks for looking into this issue! Now it seems like the main issue is that CreateElement function needs to know whether the passed in nullptr is an explicit null or implicit null (so default registry). I wonder if this will be a good chance for us to overload CreateElement function (as mentioned in the comment in code), one without registry argument so we provide the default registry in the impl and one with registry argument and we always respect the passed in value. This way we don't need to differentiate two different kinds of nullptr in CreateElement and also don't need to have extra explicit null optional argument that may be confusing down the line. This may require some changes to update CreateElement usages though.

        One related question: in flatten element creation option, do we need `is_explicit_null`? Given that we by default use the default registry if not provided by option, is it possible to have a null registry value that should actually be considered as default value? If we do get nullptr from `document->customElementRegistry()` as the default registry value, we'd want to consider that an explicit null registry, right?

        YeongHan Kim

        Thanks for the guidance. I think overloading the CreateElement without a registry parameter is a great approach. Really appreciate the idea!

        Regarding your question: I believe the spec intends for an explicit null registry only when ElementCreationOptions.registry is explicitly set to null. So the nullptr returned from `document->customElementRegistry()` as the default registry should not count as an explicit null. (And this distinction is necessary for the tests to pass.)

        Right now, `is_explicit_null` is used during flattening so that CreateElement can determine whether the null was explicitly provided. But if we move forward with overloading CreateElement to have a version without the registry argument, then I think we can remove is_explicit_null entirely from the flattening step.

        I’ll update the patch soon and ask for another review. Thanks so much for your help!

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Jayson Chen
        • 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: I14c2638d779b947d0486a154b062b722073c4089
          Gerrit-Change-Number: 7198720
          Gerrit-PatchSet: 7
          Gerrit-Owner: YeongHan Kim <soosu...@gmail.com>
          Gerrit-Reviewer: Jayson Chen <jayso...@microsoft.com>
          Gerrit-Reviewer: Mason Freed <mas...@chromium.org>
          Gerrit-Reviewer: YeongHan Kim <soosu...@gmail.com>
          Gerrit-Attention: Jayson Chen <jayso...@microsoft.com>
          Gerrit-Attention: Mason Freed <mas...@chromium.org>
          Gerrit-Comment-Date: Wed, 03 Dec 2025 16:08:16 +0000
          satisfied_requirement
          unsatisfied_requirement
          open
          diffy

          YeongHan Kim (Gerrit)

          unread,
          Dec 6, 2025, 9:30:02 AM (yesterday) Dec 6
          to AyeAye, Jayson Chen, Mason Freed, Chromium LUCI CQ, chromium...@chromium.org, mac-r...@chromium.org, dom+...@chromium.org, dominicc+...@chromium.org, hiroshig...@chromium.org, kinuko...@chromium.org, loading-rev...@chromium.org, kouhei...@chromium.org, blink-rev...@chromium.org, blink-re...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, jmedle...@chromium.org
          Attention needed from Jayson Chen and Mason Freed

          YeongHan Kim added 1 comment

          Patchset-level comments
          File-level comment, Patchset 19 (Latest):
          YeongHan Kim . resolved

          Sorry for the delay.
          Please review it when you get a chance. Thanks!

          Open in Gerrit

          Related details

          Attention is currently required from:
          • Jayson Chen
          • 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: I14c2638d779b947d0486a154b062b722073c4089
          Gerrit-Change-Number: 7198720
          Gerrit-PatchSet: 19
          Gerrit-Owner: YeongHan Kim <soosu...@gmail.com>
          Gerrit-Reviewer: Jayson Chen <jayso...@microsoft.com>
          Gerrit-Reviewer: Mason Freed <mas...@chromium.org>
          Gerrit-Reviewer: YeongHan Kim <soosu...@gmail.com>
          Gerrit-Attention: Jayson Chen <jayso...@microsoft.com>
          Gerrit-Attention: Mason Freed <mas...@chromium.org>
          Gerrit-Comment-Date: Sat, 06 Dec 2025 14:29:20 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: No
          satisfied_requirement
          unsatisfied_requirement
          open
          diffy
          Reply all
          Reply to author
          Forward
          0 new messages