Implement (unsafe) streaming sanitizer [chromium/src : main]

0 views
Skip to first unread message

AI Code Reviewer (Gerrit)

unread,
Jan 14, 2026, 11:27:41 AMJan 14
to Noam Rosenthal, Chromium LUCI CQ, chromium...@chromium.org, blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, kinuko...@chromium.org, loading-rev...@chromium.org

AI Code Reviewer added 2 comments

File third_party/blink/renderer/core/sanitizer/streaming_sanitizer.h
Line 56, Patchset 1: bool safe_ = false;
AI Code Reviewer . unresolved

nit: Precede boolean values with words like “is” and “did”. Consider renaming 'safe_' to 'is_safe_'. (Blink Style Guide: Naming - Precede boolean values with words like “is” and “did”)

To keep this interaction as brief and non-intrusive as possible, please consider responding with one of following options:
**Done** | **OK But Won't Fix**: reason | **Later**: b/<bug_id> | **Invalid:** reason


_This comment was generated by [Experimental Blink C++ Code Review Agent](http://go/blink-c++-code-review-agent)._
_AI reviews can sometimes be inaccurate; We appreciate your 🙏 feedback 🙏 to help us improve._
_[File a bug](http://go/blink-c++-code-review-agent-feedback) | [Provide feedback on chat](https://chat.google.com/room/AAQA0zhQHe0?cls=4) | [Opt-out](https://ganpati2.corp.google.com/group/peep-genai-blink-agent-optout.prod)_

Line 48, Patchset 1: StreamingSanitizer(const Sanitizer* sanitizer,
AI Code Reviewer . unresolved

Blink Style Guide: Don't mix Create () factory methods and public constructors in one class. Please make this constructor private (or protected) and use `base::PassKey` to allow `MakeGarbageCollected` to access it, as this class provides `CreateSafe`/`CreateUnsafe` factory methods.

To keep this interaction as brief and non-intrusive as possible, please consider responding with one of following options:
**Done** | **OK But Won't Fix**: reason | **Later**: b/<bug_id> | **Invalid:** reason


_This comment was generated by [Experimental Blink C++ Code Review Agent](http://go/blink-c++-code-review-agent)._
_AI reviews can sometimes be inaccurate; We appreciate your 🙏 feedback 🙏 to help us improve._
_[File a bug](http://go/blink-c++-code-review-agent-feedback) | [Provide feedback on chat](https://chat.google.com/room/AAQA0zhQHe0?cls=4) | [Opt-out](https://ganpati2.corp.google.com/group/peep-genai-blink-agent-optout.prod)_

Open in Gerrit

Related details

Attention set is empty
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: Iba91dfd1bcc1195eeeaf9930ec941135e8a14b38
Gerrit-Change-Number: 7462514
Gerrit-PatchSet: 1
Gerrit-Owner: Noam Rosenthal <nrose...@google.com>
Gerrit-Reviewer: Noam Rosenthal <nrose...@google.com>
Gerrit-CC: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
Gerrit-Comment-Date: Wed, 14 Jan 2026 16:27:37 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Daniel Vogelheim (Gerrit)

unread,
Jan 19, 2026, 12:47:07 PMJan 19
to Noam Rosenthal, Philip Jägenstedt, Daniel Vogelheim, AI Code Reviewer, Chromium LUCI CQ, chromium...@chromium.org, blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, kinuko...@chromium.org, loading-rev...@chromium.org
Attention needed from Noam Rosenthal and Philip Jägenstedt

Daniel Vogelheim added 13 comments

Patchset-level comments
File-level comment, Patchset 2 (Latest):
Daniel Vogelheim . resolved

Hi! Generally LGTM, and I like this approach! I think there's one bug (about the <template> thing in sanitizer.cc); and I'd prefer to drop the friend class. Please see comments there.

There's a whole bunch of nitpicks. Please feel free to ignore those if you feel those aren't helpful.

File third_party/blink/renderer/core/html/parser/html_construction_site.h
Line 36, Patchset 2 (Latest):#include "third_party/blink/renderer/core/sanitizer/streaming_sanitizer.h"
Daniel Vogelheim . unresolved

Nitpick: I think forward-declared StreamingSanitizer would be enough.

File third_party/blink/renderer/core/html/parser/html_construction_site.cc
Line 1553, Patchset 2 (Latest): while (sanitizer_->ShouldReplaceWithChildren(next->GetNode())) {
Daniel Vogelheim . unresolved

I don't understand this loop. What's the intent?

File third_party/blink/renderer/core/html/parser/html_tree_builder.h
Line 47, Patchset 2 (Latest):class HTMLTreeBuilder final : public GarbageCollected<HTMLTreeBuilder> {
Daniel Vogelheim . unresolved

super nitpick: :) Empty line before class HTMLTreeBuilder.

File third_party/blink/renderer/core/sanitizer/sanitizer.h
Line 174, Patchset 2 (Latest): friend class StreamingSanitizer;
Daniel Vogelheim . unresolved

Hmm. I think this is for access to Action/ActionForNode/SanitizeSingleNode. I think I'd prefer to just make those methods public, rather than adding a friend class.

Line 9, Patchset 2 (Latest):#include "third_party/blink/renderer/core/dom/container_node.h"
Daniel Vogelheim . unresolved

nitpick: I don't see ContainerNode being used. Is this needed?

File third_party/blink/renderer/core/sanitizer/sanitizer.cc
Line 853, Patchset 2 (Latest): // Step 1: Assert: child implements Text, Comment, Element, DocType.
Daniel Vogelheim . unresolved

Hmm. This comment is based on the following note in the spec: https://wicg.github.io/sanitizer-api/#sanitize-core

I wonder whether streaming HTML upholds the same guarantees. I'd expect to, but...am not sure. I.e., could there be a processing instruction or somesuch?

Line 872, Patchset 2 (Latest): switch (action) {
Daniel Vogelheim . unresolved

nitpick: I think action isn't used anywhere else, so we just `switch (ActionForNode(node, root)) {

Line 914, Patchset 2 (Latest): ProcessElement(To<Element>(node), safe);
Daniel Vogelheim . unresolved

Hmm. I think this also needs SanitizeTemplate, in case a <template> is in the input stream. Maybe we can move that into ProcessElement, too.

File third_party/blink/renderer/core/sanitizer/sanitizer_api.h
Line 10, Patchset 2 (Latest):#include "third_party/blink/renderer/core/sanitizer/streaming_sanitizer.h"
Daniel Vogelheim . unresolved

nitpick: I think the forward declaration is sufficient.

File third_party/blink/renderer/core/sanitizer/streaming_sanitizer.h
Line 31, Patchset 2 (Latest): enum class Action {
Daniel Vogelheim . unresolved

nitpick: Is this used in the public API? If not, maybe move to implementation file.

File third_party/blink/renderer/core/sanitizer/streaming_sanitizer.cc
Line 1, Patchset 2 (Latest):// Copyright 2026The Chromium Authors
Daniel Vogelheim . unresolved

super nitpick: Space between year and name.

File third_party/blink/web_tests/external/wpt/html/dom/partial-updates/tentative/stream-html-sanitizer.html
File-level comment, Patchset 2 (Latest):
Daniel Vogelheim . unresolved

Sanitizer API has a few tests based on the "html5lib" format, where we test against a specific tree of nodes. Long-term, it'd be really nice if those could be run through the streaming parser, too.

  • third_party/blink/web_tests/external/wpt/sanitizer-api/sanitizer-basic-filtering.tentative.html
  • third_party/blink/web_tests/external/wpt/sanitizer-api/sethtml-safety.tentative.html
  • third_party/blink/web_tests/external/wpt/sanitizer-api/sethtml-tree-construction.tentative.html
Open in Gerrit

Related details

Attention is currently required from:
  • Noam Rosenthal
  • Philip Jägenstedt
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: Iba91dfd1bcc1195eeeaf9930ec941135e8a14b38
Gerrit-Change-Number: 7462514
Gerrit-PatchSet: 2
Gerrit-Owner: Noam Rosenthal <nrose...@google.com>
Gerrit-Reviewer: Daniel Vogelheim <voge...@chromium.org>
Gerrit-Reviewer: Noam Rosenthal <nrose...@google.com>
Gerrit-Reviewer: Philip Jägenstedt <foo...@chromium.org>
Gerrit-Attention: Philip Jägenstedt <foo...@chromium.org>
Gerrit-Attention: Noam Rosenthal <nrose...@google.com>
Gerrit-Comment-Date: Mon, 19 Jan 2026 17:47:01 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Noam Rosenthal (Gerrit)

unread,
Jan 19, 2026, 2:18:07 PMJan 19
to Philip Jägenstedt, Daniel Vogelheim, AI Code Reviewer, Chromium LUCI CQ, chromium...@chromium.org, blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, kinuko...@chromium.org, loading-rev...@chromium.org
Attention needed from Daniel Vogelheim and Philip Jägenstedt

Noam Rosenthal added 13 comments

File third_party/blink/renderer/core/html/parser/html_construction_site.cc
Line 1553, Patchset 2: while (sanitizer_->ShouldReplaceWithChildren(next->GetNode())) {
Daniel Vogelheim . unresolved

I don't understand this loop. What's the intent?

Noam Rosenthal

Added a comment. This is for "replaceWithChildren". We want to find the next item in the stack that is allowed to be added.

File third_party/blink/renderer/core/html/parser/html_tree_builder.h
Line 47, Patchset 2:class HTMLTreeBuilder final : public GarbageCollected<HTMLTreeBuilder> {
Daniel Vogelheim . resolved

super nitpick: :) Empty line before class HTMLTreeBuilder.

Noam Rosenthal

Done

File third_party/blink/renderer/core/sanitizer/sanitizer.h
Line 174, Patchset 2: friend class StreamingSanitizer;
Daniel Vogelheim . resolved

Hmm. I think this is for access to Action/ActionForNode/SanitizeSingleNode. I think I'd prefer to just make those methods public, rather than adding a friend class.

Noam Rosenthal

Done

Line 9, Patchset 2:#include "third_party/blink/renderer/core/dom/container_node.h"
Daniel Vogelheim . resolved

nitpick: I don't see ContainerNode being used. Is this needed?

Noam Rosenthal

Done

File third_party/blink/renderer/core/sanitizer/sanitizer.cc
Line 853, Patchset 2: // Step 1: Assert: child implements Text, Comment, Element, DocType.
Daniel Vogelheim . unresolved

Hmm. This comment is based on the following note in the spec: https://wicg.github.io/sanitizer-api/#sanitize-core

I wonder whether streaming HTML upholds the same guarantees. I'd expect to, but...am not sure. I.e., could there be a processing instruction or somesuch?

Noam Rosenthal

Added a TODO.

Line 872, Patchset 2: switch (action) {
Daniel Vogelheim . resolved

nitpick: I think action isn't used anywhere else, so we just `switch (ActionForNode(node, root)) {

Noam Rosenthal

Done

Line 914, Patchset 2: ProcessElement(To<Element>(node), safe);
Daniel Vogelheim . resolved

Hmm. I think this also needs SanitizeTemplate, in case a <template> is in the input stream. Maybe we can move that into ProcessElement, too.

Noam Rosenthal

Te children of the element would be sanitized as they are added to the template's content. Added a test to verify.

File third_party/blink/renderer/core/sanitizer/sanitizer_api.h
Line 10, Patchset 2:#include "third_party/blink/renderer/core/sanitizer/streaming_sanitizer.h"
Daniel Vogelheim . resolved

nitpick: I think the forward declaration is sufficient.

Noam Rosenthal

Done

File third_party/blink/renderer/core/sanitizer/streaming_sanitizer.h
Line 31, Patchset 2: enum class Action {
Daniel Vogelheim . resolved

nitpick: Is this used in the public API? If not, maybe move to implementation file.

Noam Rosenthal

Done

Line 56, Patchset 1: bool safe_ = false;
AI Code Reviewer . resolved

nit: Precede boolean values with words like “is” and “did”. Consider renaming 'safe_' to 'is_safe_'. (Blink Style Guide: Naming - Precede boolean values with words like “is” and “did”)

To keep this interaction as brief and non-intrusive as possible, please consider responding with one of following options:
**Done** | **OK But Won't Fix**: reason | **Later**: b/<bug_id> | **Invalid:** reason


_This comment was generated by [Experimental Blink C++ Code Review Agent](http://go/blink-c++-code-review-agent)._
_AI reviews can sometimes be inaccurate; We appreciate your 🙏 feedback 🙏 to help us improve._
_[File a bug](http://go/blink-c++-code-review-agent-feedback) | [Provide feedback on chat](https://chat.google.com/room/AAQA0zhQHe0?cls=4) | [Opt-out](https://ganpati2.corp.google.com/group/peep-genai-blink-agent-optout.prod)_

Noam Rosenthal

OK But Won't Fix

Line 48, Patchset 1: StreamingSanitizer(const Sanitizer* sanitizer,
AI Code Reviewer . resolved

Blink Style Guide: Don't mix Create () factory methods and public constructors in one class. Please make this constructor private (or protected) and use `base::PassKey` to allow `MakeGarbageCollected` to access it, as this class provides `CreateSafe`/`CreateUnsafe` factory methods.

To keep this interaction as brief and non-intrusive as possible, please consider responding with one of following options:
**Done** | **OK But Won't Fix**: reason | **Later**: b/<bug_id> | **Invalid:** reason


_This comment was generated by [Experimental Blink C++ Code Review Agent](http://go/blink-c++-code-review-agent)._
_AI reviews can sometimes be inaccurate; We appreciate your 🙏 feedback 🙏 to help us improve._
_[File a bug](http://go/blink-c++-code-review-agent-feedback) | [Provide feedback on chat](https://chat.google.com/room/AAQA0zhQHe0?cls=4) | [Opt-out](https://ganpati2.corp.google.com/group/peep-genai-blink-agent-optout.prod)_

Noam Rosenthal

Acknowledged

File third_party/blink/renderer/core/sanitizer/streaming_sanitizer.cc
Line 1, Patchset 2:// Copyright 2026The Chromium Authors
Daniel Vogelheim . resolved

super nitpick: Space between year and name.

Noam Rosenthal

Done

File third_party/blink/web_tests/external/wpt/html/dom/partial-updates/tentative/stream-html-sanitizer.html
File-level comment, Patchset 2:
Daniel Vogelheim . resolved

Sanitizer API has a few tests based on the "html5lib" format, where we test against a specific tree of nodes. Long-term, it'd be really nice if those could be run through the streaming parser, too.

  • third_party/blink/web_tests/external/wpt/sanitizer-api/sanitizer-basic-filtering.tentative.html
  • third_party/blink/web_tests/external/wpt/sanitizer-api/sethtml-safety.tentative.html
  • third_party/blink/web_tests/external/wpt/sanitizer-api/sethtml-tree-construction.tentative.html
Noam Rosenthal

Agreed, I wanted a small set of "happy" tests first just to get momentum. I'll keep this in mind when finishing up.

Open in Gerrit

Related details

Attention is currently required from:
  • Daniel Vogelheim
  • Philip Jägenstedt
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: Iba91dfd1bcc1195eeeaf9930ec941135e8a14b38
Gerrit-Change-Number: 7462514
Gerrit-PatchSet: 4
Gerrit-Owner: Noam Rosenthal <nrose...@google.com>
Gerrit-Reviewer: Daniel Vogelheim <voge...@chromium.org>
Gerrit-Reviewer: Noam Rosenthal <nrose...@google.com>
Gerrit-Reviewer: Philip Jägenstedt <foo...@chromium.org>
Gerrit-CC: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
Gerrit-Attention: Philip Jägenstedt <foo...@chromium.org>
Gerrit-Attention: Daniel Vogelheim <voge...@chromium.org>
Gerrit-Comment-Date: Mon, 19 Jan 2026 19:18:01 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
Comment-In-Reply-To: Daniel Vogelheim <voge...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Noam Rosenthal (Gerrit)

unread,
Jan 19, 2026, 2:18:16 PMJan 19
to Philip Jägenstedt, Daniel Vogelheim, AI Code Reviewer, Chromium LUCI CQ, chromium...@chromium.org, blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, kinuko...@chromium.org, loading-rev...@chromium.org
Attention needed from Daniel Vogelheim and Philip Jägenstedt

Noam Rosenthal added 1 comment

File third_party/blink/renderer/core/html/parser/html_construction_site.h
Line 36, Patchset 2:#include "third_party/blink/renderer/core/sanitizer/streaming_sanitizer.h"
Daniel Vogelheim . resolved

Nitpick: I think forward-declared StreamingSanitizer would be enough.

Noam Rosenthal

Done

Gerrit-Comment-Date: Mon, 19 Jan 2026 19:18:11 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Daniel Vogelheim <voge...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Daniel Vogelheim (Gerrit)

unread,
Jan 21, 2026, 8:03:57 AMJan 21
to Noam Rosenthal, Daniel Vogelheim, Philip Jägenstedt, AI Code Reviewer, Chromium LUCI CQ, chromium...@chromium.org, blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, kinuko...@chromium.org, loading-rev...@chromium.org
Attention needed from Noam Rosenthal and Philip Jägenstedt

Daniel Vogelheim voted and added 8 comments

Votes added by Daniel Vogelheim

Code-Review+1

8 comments

Patchset-level comments
File-level comment, Patchset 4:
Daniel Vogelheim . resolved

Thanks, this looks good!

Some more nitpicks on headers + forward decls.

File third_party/blink/renderer/core/html/parser/html_construction_site.h
Line 36, Patchset 5 (Latest):#include "third_party/blink/renderer/core/sanitizer/streaming_sanitizer.h"
Daniel Vogelheim . unresolved

This is included and forward-declared below. I think forward-declaring is sufficient.

File third_party/blink/renderer/core/html/parser/html_construction_site.cc
Line 1553, Patchset 2: while (sanitizer_->ShouldReplaceWithChildren(next->GetNode())) {
Daniel Vogelheim . unresolved

I don't understand this loop. What's the intent?

Noam Rosenthal

Added a comment. This is for "replaceWithChildren". We want to find the next item in the stack that is allowed to be added.

Daniel Vogelheim

Thanks, I get it now.

There is one more, admittedly rather theoretical concern: Sanitizer instances are mutable. So if one were to do a streaming write; then modify the Sanitizer used; and then do another streaming write; then this might apply the current config to elements parsed with the previous one.

That said, I'm not sure what to do... Maybe a TODO would work? Or should this be raised as an issue on the spec repo?

Line 1553, Patchset 2: while (sanitizer_->ShouldReplaceWithChildren(next->GetNode())) {
Daniel Vogelheim . resolved

I don't understand this loop. What's the intent?

Noam Rosenthal

Added a comment. This is for "replaceWithChildren". We want to find the next item in the stack that is allowed to be added.

Daniel Vogelheim

Marked as resolved.

File third_party/blink/renderer/core/sanitizer/sanitizer.h
Line 11, Patchset 4:#include "third_party/blink/renderer/core/sanitizer/streaming_sanitizer.h"
Daniel Vogelheim . resolved

I'm not seeing a usage of StreamingSanitizer in this header. Do we need this include?

File third_party/blink/renderer/core/sanitizer/sanitizer.cc
Line 853, Patchset 2: // Step 1: Assert: child implements Text, Comment, Element, DocType.
Daniel Vogelheim . resolved

Hmm. This comment is based on the following note in the spec: https://wicg.github.io/sanitizer-api/#sanitize-core

I wonder whether streaming HTML upholds the same guarantees. I'd expect to, but...am not sure. I.e., could there be a processing instruction or somesuch?

Noam Rosenthal

Added a TODO.

Daniel Vogelheim

Marked as resolved.

File third_party/blink/renderer/core/sanitizer/streaming_sanitizer.h
Line 17, Patchset 4:
Daniel Vogelheim . unresolved

That's quite a few headers here.... I'm not seeing use of:

  • callback_forward.h
  • v8_sanitizer_presets.h
  • container_node.h
  • qualified_name.h
  • sanitizer_names.h
  • script_wrappable.h
  • heap_hash_map.h

Can we use forward-declarations instead?

File third_party/blink/renderer/core/sanitizer/streaming_sanitizer.cc
Line 7, Patchset 4:#include "third_party/blink/renderer/core/dom/container_node.h"
Daniel Vogelheim . unresolved

I'm not seeing any non-trivial usage of ContainerNode. Maybe we could forward-declare that?

Open in Gerrit

Related details

Attention is currently required from:
  • Noam Rosenthal
  • Philip Jägenstedt
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: Iba91dfd1bcc1195eeeaf9930ec941135e8a14b38
    Gerrit-Change-Number: 7462514
    Gerrit-PatchSet: 4
    Gerrit-Owner: Noam Rosenthal <nrose...@google.com>
    Gerrit-Reviewer: Daniel Vogelheim <voge...@chromium.org>
    Gerrit-Reviewer: Noam Rosenthal <nrose...@google.com>
    Gerrit-Reviewer: Philip Jägenstedt <foo...@chromium.org>
    Gerrit-CC: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
    Gerrit-Attention: Philip Jägenstedt <foo...@chromium.org>
    Gerrit-Attention: Noam Rosenthal <nrose...@google.com>
    Gerrit-Comment-Date: Wed, 21 Jan 2026 13:03:39 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    Comment-In-Reply-To: Daniel Vogelheim <voge...@chromium.org>
    Comment-In-Reply-To: Noam Rosenthal <nrose...@google.com>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Daniel Vogelheim (Gerrit)

    unread,
    Jan 21, 2026, 11:03:44 AMJan 21
    to Noam Rosenthal, Daniel Vogelheim, Philip Jägenstedt, AI Code Reviewer, Chromium LUCI CQ, chromium...@chromium.org, blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, kinuko...@chromium.org, loading-rev...@chromium.org
    Attention needed from Noam Rosenthal and Philip Jägenstedt

    Daniel Vogelheim voted and added 1 comment

    Votes added by Daniel Vogelheim

    Code-Review+1

    1 comment

    Patchset-level comments
    File-level comment, Patchset 7 (Latest):
    Daniel Vogelheim . resolved

    Still lgtm.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Noam Rosenthal
    • Philip Jägenstedt
    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: Iba91dfd1bcc1195eeeaf9930ec941135e8a14b38
    Gerrit-Change-Number: 7462514
    Gerrit-PatchSet: 7
    Gerrit-Owner: Noam Rosenthal <nrose...@google.com>
    Gerrit-Reviewer: Daniel Vogelheim <voge...@chromium.org>
    Gerrit-Reviewer: Noam Rosenthal <nrose...@google.com>
    Gerrit-Reviewer: Philip Jägenstedt <foo...@chromium.org>
    Gerrit-CC: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
    Gerrit-Attention: Philip Jägenstedt <foo...@chromium.org>
    Gerrit-Attention: Noam Rosenthal <nrose...@google.com>
    Gerrit-Comment-Date: Wed, 21 Jan 2026 16:03:31 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Philip Jägenstedt (Gerrit)

    unread,
    Jan 23, 2026, 11:30:19 AMJan 23
    to Noam Rosenthal, Daniel Vogelheim, AI Code Reviewer, Chromium LUCI CQ, chromium...@chromium.org, blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, kinuko...@chromium.org, loading-rev...@chromium.org
    Attention needed from Noam Rosenthal

    Philip Jägenstedt voted and added 4 comments

    Votes added by Philip Jägenstedt

    Code-Review+1

    4 comments

    File third_party/blink/web_tests/external/wpt/html/dom/partial-updates/tentative/stream-html-sanitizer.html
    Line 159, Patchset 7 (Latest): await writer.write("<table><td>Content");
    Philip Jägenstedt . unresolved

    Can you also test the case <table><p> where the <p> would be inserted before the <table> element?

    Line 162, Patchset 7 (Latest): }, `element.${method}: sanitizer takes affect after foster parenting`);
    Philip Jägenstedt . unresolved
    ```suggestion
    }, `element.${method}: sanitizer takes effect after foster parenting`);
    ```
    Line 176, Patchset 7 (Latest): }, `element.${method}: sanitizer takes affect after adoption agency`);
    Philip Jägenstedt . unresolved
    ```suggestion
    }, `element.${method}: sanitizer takes effect after adoption agency`);
    ```
    Line 189, Patchset 7 (Latest): }, `element.${method}: mutating the sanitizer while streaming does not affect the originally given sanitizer`);
    Philip Jägenstedt . unresolved
    ```suggestion
    }, `element.${method}: mutating the sanitizer while streaming does not effect the originally given sanitizer`);
    ```
    Open in Gerrit

    Related details

    Attention is currently required from:
    • Noam Rosenthal
    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: Iba91dfd1bcc1195eeeaf9930ec941135e8a14b38
    Gerrit-Change-Number: 7462514
    Gerrit-PatchSet: 7
    Gerrit-Owner: Noam Rosenthal <nrose...@google.com>
    Gerrit-Reviewer: Daniel Vogelheim <voge...@chromium.org>
    Gerrit-Reviewer: Noam Rosenthal <nrose...@google.com>
    Gerrit-Reviewer: Philip Jägenstedt <foo...@chromium.org>
    Gerrit-CC: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
    Gerrit-Attention: Noam Rosenthal <nrose...@google.com>
    Gerrit-Comment-Date: Fri, 23 Jan 2026 16:29:58 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Noam Rosenthal (Gerrit)

    unread,
    Jan 26, 2026, 4:53:15 AMJan 26
    to Philip Jägenstedt, Daniel Vogelheim, AI Code Reviewer, Chromium LUCI CQ, chromium...@chromium.org, blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, kinuko...@chromium.org, loading-rev...@chromium.org

    Noam Rosenthal added 7 comments

    File third_party/blink/renderer/core/html/parser/html_construction_site.h
    Line 36, Patchset 5:#include "third_party/blink/renderer/core/sanitizer/streaming_sanitizer.h"
    Daniel Vogelheim . resolved

    This is included and forward-declared below. I think forward-declaring is sufficient.

    Noam Rosenthal

    Done

    File third_party/blink/renderer/core/sanitizer/streaming_sanitizer.h
    Line 17, Patchset 4:
    Daniel Vogelheim . resolved

    That's quite a few headers here.... I'm not seeing use of:

    • callback_forward.h
    • v8_sanitizer_presets.h
    • container_node.h
    • qualified_name.h
    • sanitizer_names.h
    • script_wrappable.h
    • heap_hash_map.h

    Can we use forward-declarations instead?

    Noam Rosenthal

    Done

    File third_party/blink/renderer/core/sanitizer/streaming_sanitizer.cc
    Line 7, Patchset 4:#include "third_party/blink/renderer/core/dom/container_node.h"
    Daniel Vogelheim . resolved

    I'm not seeing any non-trivial usage of ContainerNode. Maybe we could forward-declare that?

    Noam Rosenthal

    Done

    File third_party/blink/web_tests/external/wpt/html/dom/partial-updates/tentative/stream-html-sanitizer.html
    Line 159, Patchset 7: await writer.write("<table><td>Content");
    Philip Jägenstedt . resolved

    Can you also test the case <table><p> where the <p> would be inserted before the <table> element?

    Noam Rosenthal

    Done

    Line 162, Patchset 7: }, `element.${method}: sanitizer takes affect after foster parenting`);
    Philip Jägenstedt . resolved
    ```suggestion
    }, `element.${method}: sanitizer takes effect after foster parenting`);
    ```
    Noam Rosenthal

    Fix applied.

    Line 176, Patchset 7: }, `element.${method}: sanitizer takes affect after adoption agency`);
    Philip Jägenstedt . resolved
    ```suggestion
    }, `element.${method}: sanitizer takes effect after adoption agency`);
    ```
    Noam Rosenthal

    Fix applied.

    Line 189, Patchset 7: }, `element.${method}: mutating the sanitizer while streaming does not affect the originally given sanitizer`);
    Philip Jägenstedt . resolved
    ```suggestion
    }, `element.${method}: mutating the sanitizer while streaming does not effect the originally given sanitizer`);
    ```
    Noam Rosenthal

    Fix applied.

    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: Iba91dfd1bcc1195eeeaf9930ec941135e8a14b38
      Gerrit-Change-Number: 7462514
      Gerrit-PatchSet: 8
      Gerrit-Owner: Noam Rosenthal <nrose...@google.com>
      Gerrit-Reviewer: Daniel Vogelheim <voge...@chromium.org>
      Gerrit-Reviewer: Noam Rosenthal <nrose...@google.com>
      Gerrit-Reviewer: Philip Jägenstedt <foo...@chromium.org>
      Gerrit-CC: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
      Gerrit-Comment-Date: Mon, 26 Jan 2026 09:53:01 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Philip Jägenstedt <foo...@chromium.org>
      Comment-In-Reply-To: Daniel Vogelheim <voge...@chromium.org>
      satisfied_requirement
      open
      diffy

      Noam Rosenthal (Gerrit)

      unread,
      Jan 26, 2026, 4:53:21 AMJan 26
      to Philip Jägenstedt, Daniel Vogelheim, AI Code Reviewer, Chromium LUCI CQ, chromium...@chromium.org, blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, kinuko...@chromium.org, loading-rev...@chromium.org

      Noam Rosenthal voted Commit-Queue+2

      Commit-Queue+2
      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: Iba91dfd1bcc1195eeeaf9930ec941135e8a14b38
      Gerrit-Change-Number: 7462514
      Gerrit-PatchSet: 9
      Gerrit-Owner: Noam Rosenthal <nrose...@google.com>
      Gerrit-Reviewer: Daniel Vogelheim <voge...@chromium.org>
      Gerrit-Reviewer: Noam Rosenthal <nrose...@google.com>
      Gerrit-Reviewer: Philip Jägenstedt <foo...@chromium.org>
      Gerrit-CC: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
      Gerrit-Comment-Date: Mon, 26 Jan 2026 09:53:06 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      open
      diffy

      Blink W3C Test Autoroller (Gerrit)

      unread,
      Jan 26, 2026, 5:00:50 AMJan 26
      to Noam Rosenthal, Philip Jägenstedt, Daniel Vogelheim, AI Code Reviewer, Chromium LUCI CQ, chromium...@chromium.org, blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, kinuko...@chromium.org, loading-rev...@chromium.org

      Message from Blink W3C Test Autoroller

      Exportable changes to web-platform-tests were detected in this CL and a pull request in the upstream repo has been made: https://github.com/web-platform-tests/wpt/pull/57331.

      When this CL lands, the bot will automatically merge the PR on GitHub if the required GitHub checks pass; otherwise, ecosystem-infra@ team will triage the failures and may contact you.

      WPT Export docs:
      https://chromium.googlesource.com/chromium/src/+/main/docs/testing/web_platform_tests.md#Automatic-export-process

      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: Iba91dfd1bcc1195eeeaf9930ec941135e8a14b38
      Gerrit-Change-Number: 7462514
      Gerrit-PatchSet: 9
      Gerrit-Owner: Noam Rosenthal <nrose...@google.com>
      Gerrit-Reviewer: Daniel Vogelheim <voge...@chromium.org>
      Gerrit-Reviewer: Noam Rosenthal <nrose...@google.com>
      Gerrit-Reviewer: Philip Jägenstedt <foo...@chromium.org>
      Gerrit-CC: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
      Gerrit-CC: Blink W3C Test Autoroller <blink-w3c-te...@chromium.org>
      Gerrit-Comment-Date: Mon, 26 Jan 2026 10:00:40 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: No
      satisfied_requirement
      open
      diffy

      Chromium LUCI CQ (Gerrit)

      unread,
      Jan 26, 2026, 5:51:32 AMJan 26
      to Noam Rosenthal, Blink W3C Test Autoroller, Philip Jägenstedt, Daniel Vogelheim, AI Code Reviewer, chromium...@chromium.org, blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, kinuko...@chromium.org, loading-rev...@chromium.org

      Chromium LUCI CQ submitted the change with unreviewed changes

      Unreviewed changes

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

      ```
      The name of the file: third_party/blink/web_tests/external/wpt/html/dom/partial-updates/tentative/stream-html-sanitizer.html
      Insertions: 17, Deletions: 3.

      @@ -159,7 +159,21 @@

      await writer.write("<table><td>Content");
             await writer.close();
      assert_equals(placeholder.innerHTML, "<table><tbody><td>Content</td></tbody></table>");
      - }, `element.${method}: sanitizer takes affect after foster parenting`);
      + }, `element.${method}: sanitizer takes effect after foster parenting`);
      +
      + promise_test(async (t) => {
      + const placeholder = document.createElement("div");
      + const writer = placeholder
      + [method]({
      + sanitizer: {
      + replaceWithChildrenElements: ["tr"]
      + },
      + })
      + .getWriter();
      + await writer.write("<table><p><p>Content<td>");
      + await writer.close();
      + assert_equals(placeholder.innerHTML, "<p></p><p>Content</p><table><tbody><td></td></tbody></table>");
      + }, `element.${method}: sanitizer with foster parenting: <table><p><p>`);

      promise_test(async (t) => {
      const placeholder = document.createElement("div");
      @@ -173,7 +187,7 @@
      await writer.write("<p>1<b>2<i>3</b>4</i>5</p>");
      await writer.close();
      assert_equals(placeholder.innerHTML, "<p>1<b>2</b>5</p>");
      - }, `element.${method}: sanitizer takes affect after adoption agency`);
      + }, `element.${method}: sanitizer takes effect after adoption agency`);

      promise_test(async (t) => {
      const placeholder = document.createElement("div");
      @@ -186,6 +200,6 @@
      await writer.write("<p>2</p>");
      await writer.close();
      assert_equals(placeholder.textContent, "12");
      - }, `element.${method}: mutating the sanitizer while streaming does not affect the originally given sanitizer`);
      + }, `element.${method}: mutating the sanitizer while streaming does not effect the originally given sanitizer`);
      }
      </script>
      ```

      Change information

      Commit message:
      Implement (unsafe) streaming sanitizer

      This is based on the draft algorithm in
      https://github.com/WICG/sanitizer-api/issues/190#issuecomment-3633021106

      - extract single-node decisions/operations in Sanitizer to own methods
      - expose a method that sanitizes a single node,
      and another one that queries specifically for replacing element with
      children.
      - The streaming sanitizer is passed to the parser when using the
      streaming methods.
      - when a node is about to be inserted, we consult the streaming
      sanitizer about whether the node itself should be modified/dropped,
      and whether it should skip some of the stack due to
      replaceElementWithChildren.

      For now only the unsafe version is implemented, as streamHTML is not yet
      exposed.

      This needs a much wider test coverage, for now this is a prototype to
      feed the spec discussion.
      Bug: 475738087
      Change-Id: Iba91dfd1bcc1195eeeaf9930ec941135e8a14b38
      Reviewed-by: Philip Jägenstedt <foo...@chromium.org>
      Commit-Queue: Noam Rosenthal <nrose...@google.com>
      Reviewed-by: Daniel Vogelheim <voge...@chromium.org>
      Cr-Commit-Position: refs/heads/main@{#1574418}
      Files:
      • M third_party/blink/renderer/core/html/html_stream.cc
      • M third_party/blink/renderer/core/html/parser/html_construction_site.cc
      • M third_party/blink/renderer/core/html/parser/html_construction_site.h
      • M third_party/blink/renderer/core/html/parser/html_document_parser.cc
      • M third_party/blink/renderer/core/html/parser/html_document_parser.h
      • M third_party/blink/renderer/core/html/parser/html_tree_builder.cc
      • M third_party/blink/renderer/core/html/parser/html_tree_builder.h
      • M third_party/blink/renderer/core/sanitizer/build.gni
      • M third_party/blink/renderer/core/sanitizer/sanitizer.cc
      • M third_party/blink/renderer/core/sanitizer/sanitizer.h
      • M third_party/blink/renderer/core/sanitizer/sanitizer_api.cc
      • M third_party/blink/renderer/core/sanitizer/sanitizer_api.h
      • A third_party/blink/renderer/core/sanitizer/streaming_sanitizer.cc
      • A third_party/blink/renderer/core/sanitizer/streaming_sanitizer.h
      • A third_party/blink/web_tests/external/wpt/html/dom/partial-updates/tentative/stream-html-sanitizer.html
      Change size: L
      Delta: 15 files changed, 572 insertions(+), 143 deletions(-)
      Branch: refs/heads/main
      Submit Requirements:
      • requirement satisfiedCode-Review: +1 by Daniel Vogelheim, +1 by Philip Jägenstedt
      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: Iba91dfd1bcc1195eeeaf9930ec941135e8a14b38
      Gerrit-Change-Number: 7462514
      Gerrit-PatchSet: 10
      Gerrit-Owner: Noam Rosenthal <nrose...@google.com>
      Gerrit-Reviewer: Chromium LUCI CQ <chromiu...@luci-project-accounts.iam.gserviceaccount.com>
      Gerrit-Reviewer: Daniel Vogelheim <voge...@chromium.org>
      Gerrit-Reviewer: Noam Rosenthal <nrose...@google.com>
      Gerrit-Reviewer: Philip Jägenstedt <foo...@chromium.org>
      Gerrit-CC: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
      Gerrit-CC: Blink W3C Test Autoroller <blink-w3c-te...@chromium.org>
      open
      diffy
      satisfied_requirement

      Blink W3C Test Autoroller (Gerrit)

      unread,
      Jan 26, 2026, 6:21:47 AMJan 26
      to Chromium LUCI CQ, Noam Rosenthal, Philip Jägenstedt, Daniel Vogelheim, AI Code Reviewer, chromium...@chromium.org, blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, kinuko...@chromium.org, loading-rev...@chromium.org

      Message from Blink W3C Test Autoroller

      The WPT PR for this CL has been merged upstream! https://github.com/web-platform-tests/wpt/pull/57331

      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: Iba91dfd1bcc1195eeeaf9930ec941135e8a14b38
      Gerrit-Change-Number: 7462514
      Gerrit-PatchSet: 10
      Gerrit-Owner: Noam Rosenthal <nrose...@google.com>
      Gerrit-Reviewer: Chromium LUCI CQ <chromiu...@luci-project-accounts.iam.gserviceaccount.com>
      Gerrit-Reviewer: Daniel Vogelheim <voge...@chromium.org>
      Gerrit-Reviewer: Noam Rosenthal <nrose...@google.com>
      Gerrit-Reviewer: Philip Jägenstedt <foo...@chromium.org>
      Gerrit-CC: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
      Gerrit-CC: Blink W3C Test Autoroller <blink-w3c-te...@chromium.org>
      Gerrit-Comment-Date: Mon, 26 Jan 2026 11:21:40 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: No
      satisfied_requirement
      open
      diffy
      Reply all
      Reply to author
      Forward
      0 new messages