[Sanitizer] Ensure content is removed when an exception is thrown. [chromium/src : main]

0 views
Skip to first unread message

Daniel Vogelheim (Gerrit)

unread,
Mar 26, 2026, 1:26:11 PM (7 days ago) Mar 26
to Daniel Vogelheim, Noam Rosenthal, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, blink-revie...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, kinuko...@chromium.org, loading-rev...@chromium.org
Attention needed from Joey Arhar

New activity on the change

Open in Gerrit

Related details

Attention is currently required from:
  • Joey Arhar
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: I3a6402afacb5d5275f546dfdefdac5d270e96d1f
Gerrit-Change-Number: 7705032
Gerrit-PatchSet: 3
Gerrit-Owner: Daniel Vogelheim <voge...@chromium.org>
Gerrit-Reviewer: Daniel Vogelheim <voge...@chromium.org>
Gerrit-Reviewer: Joey Arhar <jar...@chromium.org>
Gerrit-CC: Noam Rosenthal <nrose...@google.com>
Gerrit-Attention: Joey Arhar <jar...@chromium.org>
Gerrit-Comment-Date: Thu, 26 Mar 2026 17:25:59 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Noam Rosenthal (Gerrit)

unread,
Mar 30, 2026, 3:28:03 PM (3 days ago) Mar 30
to Daniel Vogelheim, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, blink-revie...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, kinuko...@chromium.org, loading-rev...@chromium.org
Attention needed from Daniel Vogelheim and Joey Arhar

Noam Rosenthal added 1 comment

Patchset-level comments
File-level comment, Patchset 3 (Latest):
Noam Rosenthal . resolved

Does the test cover the Document::parseHTML() change?

Open in Gerrit

Related details

Attention is currently required from:
  • Daniel Vogelheim
  • Joey Arhar
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: I3a6402afacb5d5275f546dfdefdac5d270e96d1f
Gerrit-Change-Number: 7705032
Gerrit-PatchSet: 3
Gerrit-Owner: Daniel Vogelheim <voge...@chromium.org>
Gerrit-Reviewer: Daniel Vogelheim <voge...@chromium.org>
Gerrit-Reviewer: Joey Arhar <jar...@chromium.org>
Gerrit-CC: Noam Rosenthal <nrose...@google.com>
Gerrit-Attention: Joey Arhar <jar...@chromium.org>
Gerrit-Attention: Daniel Vogelheim <voge...@chromium.org>
Gerrit-Comment-Date: Mon, 30 Mar 2026 19:27:44 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Joey Arhar (Gerrit)

unread,
Mar 31, 2026, 10:53:59 AM (2 days ago) Mar 31
to Daniel Vogelheim, Noam Rosenthal, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, blink-revie...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, kinuko...@chromium.org, loading-rev...@chromium.org
Attention needed from Daniel Vogelheim

Joey Arhar added 1 comment

Patchset-level comments
Joey Arhar . unresolved

Are any spec changes needed?

Open in Gerrit

Related details

Attention is currently required from:
  • Daniel Vogelheim
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: I3a6402afacb5d5275f546dfdefdac5d270e96d1f
    Gerrit-Change-Number: 7705032
    Gerrit-PatchSet: 3
    Gerrit-Owner: Daniel Vogelheim <voge...@chromium.org>
    Gerrit-Reviewer: Daniel Vogelheim <voge...@chromium.org>
    Gerrit-Reviewer: Joey Arhar <jar...@chromium.org>
    Gerrit-CC: Noam Rosenthal <nrose...@google.com>
    Gerrit-Attention: Daniel Vogelheim <voge...@chromium.org>
    Gerrit-Comment-Date: Tue, 31 Mar 2026 14:53:44 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Daniel Vogelheim (Gerrit)

    unread,
    Mar 31, 2026, 11:03:35 AM (2 days ago) Mar 31
    to Daniel Vogelheim, Noam Rosenthal, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, blink-revie...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, kinuko...@chromium.org, loading-rev...@chromium.org
    Attention needed from Joey Arhar and Noam Rosenthal

    Daniel Vogelheim added 2 comments

    Patchset-level comments
    Joey Arhar . resolved

    Are any spec changes needed?

    Daniel Vogelheim

    No. The spec said to throw an exception. We did. But we *also* executed the actual operation that we were supposed to be raising the exception from. The spec doesn't support that.

    SetHTML & friends work by first parsing, and then sanitizing. From a spec perspective, the exception is thrown for the entire operation. So when an exception is thrown anywhere in that process, none of those things should have happened. What actually happened here is that the parsing completes successfully; setting up the Sanitizer throws; and then we just leave the parse result in.

    Noam Rosenthal . unresolved

    Does the test cover the Document::parseHTML() change?

    Daniel Vogelheim

    Good catch, it doesn't. I'll fix that.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Joey Arhar
    • Noam Rosenthal
    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: I3a6402afacb5d5275f546dfdefdac5d270e96d1f
    Gerrit-Change-Number: 7705032
    Gerrit-PatchSet: 3
    Gerrit-Owner: Daniel Vogelheim <voge...@chromium.org>
    Gerrit-Reviewer: Daniel Vogelheim <voge...@chromium.org>
    Gerrit-Reviewer: Joey Arhar <jar...@chromium.org>
    Gerrit-CC: Noam Rosenthal <nrose...@google.com>
    Gerrit-Attention: Joey Arhar <jar...@chromium.org>
    Gerrit-Attention: Noam Rosenthal <nrose...@google.com>
    Gerrit-Comment-Date: Tue, 31 Mar 2026 15:03:20 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Joey Arhar <jar...@chromium.org>
    Comment-In-Reply-To: Noam Rosenthal <nrose...@google.com>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Joey Arhar (Gerrit)

    unread,
    Mar 31, 2026, 6:16:14 PM (2 days ago) Mar 31
    to Daniel Vogelheim, Noam Rosenthal, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, blink-revie...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, kinuko...@chromium.org, loading-rev...@chromium.org
    Attention needed from Daniel Vogelheim and Noam Rosenthal

    Joey Arhar voted Code-Review+1

    Code-Review+1
    Open in Gerrit

    Related details

    Attention is currently required from:
    • Daniel Vogelheim
    • 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: I3a6402afacb5d5275f546dfdefdac5d270e96d1f
    Gerrit-Change-Number: 7705032
    Gerrit-PatchSet: 3
    Gerrit-Owner: Daniel Vogelheim <voge...@chromium.org>
    Gerrit-Reviewer: Daniel Vogelheim <voge...@chromium.org>
    Gerrit-Reviewer: Joey Arhar <jar...@chromium.org>
    Gerrit-CC: Noam Rosenthal <nrose...@google.com>
    Gerrit-Attention: Daniel Vogelheim <voge...@chromium.org>
    Gerrit-Attention: Noam Rosenthal <nrose...@google.com>
    Gerrit-Comment-Date: Tue, 31 Mar 2026 22:16:03 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Daniel Vogelheim (Gerrit)

    unread,
    Apr 1, 2026, 8:55:06 AM (22 hours ago) Apr 1
    to Daniel Vogelheim, Noam Rosenthal, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, blink-revie...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, kinuko...@chromium.org, loading-rev...@chromium.org
    Attention needed from Joey Arhar and Noam Rosenthal

    Daniel Vogelheim added 2 comments

    Patchset-level comments
    File-level comment, Patchset 3:
    Noam Rosenthal . resolved

    Does the test cover the Document::parseHTML() change?

    Daniel Vogelheim

    Good catch, it doesn't. I'll fix that.

    Daniel Vogelheim

    Added a unittest.

    I couldn't come up with a WPT test that observes this. When I execute `doc = Document::parseHTML(...)` and `parseHTML` throws, then the assignment will never execute. `setHTML` is difference, because it operates on an object that already exists and that I can then access.

    I guess one could argue that a fix for `parseHTML`/`parseHTMLUnsafe` is thus unneccessary. I still think it's the right fix, so I added the unit test on the C++ side, which can observe the return value, regardless of exception.

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

    Ptal.

    jarhar: This needs another owners' review, because I added the unit test. :)

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Joey Arhar
    • Noam Rosenthal
    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: I3a6402afacb5d5275f546dfdefdac5d270e96d1f
    Gerrit-Change-Number: 7705032
    Gerrit-PatchSet: 4
    Gerrit-Owner: Daniel Vogelheim <voge...@chromium.org>
    Gerrit-Reviewer: Daniel Vogelheim <voge...@chromium.org>
    Gerrit-Reviewer: Joey Arhar <jar...@chromium.org>
    Gerrit-CC: Noam Rosenthal <nrose...@google.com>
    Gerrit-Attention: Joey Arhar <jar...@chromium.org>
    Gerrit-Attention: Noam Rosenthal <nrose...@google.com>
    Gerrit-Comment-Date: Wed, 01 Apr 2026 12:54:54 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Daniel Vogelheim <voge...@chromium.org>
    Comment-In-Reply-To: Noam Rosenthal <nrose...@google.com>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Joey Arhar (Gerrit)

    unread,
    Apr 1, 2026, 12:39:33 PM (18 hours ago) Apr 1
    to Daniel Vogelheim, Noam Rosenthal, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, blink-revie...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, kinuko...@chromium.org, loading-rev...@chromium.org
    Attention needed from Daniel Vogelheim and Noam Rosenthal

    Joey Arhar voted and added 1 comment

    Votes added by Joey Arhar

    Code-Review+1

    1 comment

    Patchset-level comments
    File-level comment, Patchset 3:
    Noam Rosenthal . unresolved

    Does the test cover the Document::parseHTML() change?

    Daniel Vogelheim

    Good catch, it doesn't. I'll fix that.

    Daniel Vogelheim

    Added a unittest.

    I couldn't come up with a WPT test that observes this. When I execute `doc = Document::parseHTML(...)` and `parseHTML` throws, then the assignment will never execute. `setHTML` is difference, because it operates on an object that already exists and that I can then access.

    I guess one could argue that a fix for `parseHTML`/`parseHTMLUnsafe` is thus unneccessary. I still think it's the right fix, so I added the unit test on the C++ side, which can observe the return value, regardless of exception.

    Joey Arhar

    lgtm, but if Noam has an idea about how to make this into a wpt then we should consider it

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Daniel Vogelheim
    • 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: I3a6402afacb5d5275f546dfdefdac5d270e96d1f
    Gerrit-Change-Number: 7705032
    Gerrit-PatchSet: 4
    Gerrit-Owner: Daniel Vogelheim <voge...@chromium.org>
    Gerrit-Reviewer: Daniel Vogelheim <voge...@chromium.org>
    Gerrit-Reviewer: Joey Arhar <jar...@chromium.org>
    Gerrit-CC: Noam Rosenthal <nrose...@google.com>
    Gerrit-Attention: Daniel Vogelheim <voge...@chromium.org>
    Gerrit-Attention: Noam Rosenthal <nrose...@google.com>
    Gerrit-Comment-Date: Wed, 01 Apr 2026 16:39:19 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Noam Rosenthal (Gerrit)

    unread,
    Apr 1, 2026, 12:47:37 PM (18 hours ago) Apr 1
    to Daniel Vogelheim, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, blink-revie...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, kinuko...@chromium.org, loading-rev...@chromium.org
    Attention needed from Daniel Vogelheim

    Noam Rosenthal added 1 comment

    Patchset-level comments
    Noam Rosenthal . unresolved

    Does the test cover the Document::parseHTML() change?

    Daniel Vogelheim

    Good catch, it doesn't. I'll fix that.

    Daniel Vogelheim

    Added a unittest.

    I couldn't come up with a WPT test that observes this. When I execute `doc = Document::parseHTML(...)` and `parseHTML` throws, then the assignment will never execute. `setHTML` is difference, because it operates on an object that already exists and that I can then access.

    I guess one could argue that a fix for `parseHTML`/`parseHTMLUnsafe` is thus unneccessary. I still think it's the right fix, so I added the unit test on the C++ side, which can observe the return value, regardless of exception.

    Joey Arhar

    lgtm, but if Noam has an idea about how to make this into a wpt then we should consider it

    Noam Rosenthal

    @voge...@chromium.org you mean the assignment doesn't execute because the binding layer checks for exceptions? If so, I am ok with testing this as a unit-test.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Daniel Vogelheim
    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: I3a6402afacb5d5275f546dfdefdac5d270e96d1f
    Gerrit-Change-Number: 7705032
    Gerrit-PatchSet: 4
    Gerrit-Owner: Daniel Vogelheim <voge...@chromium.org>
    Gerrit-Reviewer: Daniel Vogelheim <voge...@chromium.org>
    Gerrit-Reviewer: Joey Arhar <jar...@chromium.org>
    Gerrit-CC: Noam Rosenthal <nrose...@google.com>
    Gerrit-Attention: Daniel Vogelheim <voge...@chromium.org>
    Gerrit-Comment-Date: Wed, 01 Apr 2026 16:47:19 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Joey Arhar <jar...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Daniel Vogelheim (Gerrit)

    unread,
    Apr 1, 2026, 1:45:30 PM (17 hours ago) Apr 1
    to Daniel Vogelheim, Noam Rosenthal, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, blink-revie...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, kinuko...@chromium.org, loading-rev...@chromium.org
    Attention needed from Joey Arhar and Noam Rosenthal

    Daniel Vogelheim added 1 comment

    Patchset-level comments
    Noam Rosenthal . unresolved

    Does the test cover the Document::parseHTML() change?

    Daniel Vogelheim

    Good catch, it doesn't. I'll fix that.

    Daniel Vogelheim

    Added a unittest.

    I couldn't come up with a WPT test that observes this. When I execute `doc = Document::parseHTML(...)` and `parseHTML` throws, then the assignment will never execute. `setHTML` is difference, because it operates on an object that already exists and that I can then access.

    I guess one could argue that a fix for `parseHTML`/`parseHTMLUnsafe` is thus unneccessary. I still think it's the right fix, so I added the unit test on the C++ side, which can observe the return value, regardless of exception.

    Joey Arhar

    lgtm, but if Noam has an idea about how to make this into a wpt then we should consider it

    Noam Rosenthal

    @voge...@chromium.org you mean the assignment doesn't execute because the binding layer checks for exceptions? If so, I am ok with testing this as a unit-test.

    Daniel Vogelheim

    Right. If you do:

    ```
    let x = "old value";
    x = Document.parseHTMLUnsafe("ssdfjsldkfj", {sanitizer: {elements:["div"], removeElements:["div"]}});
    // Console reports an exception
    x // Console reports "old value"
    ```

    x is neither undefined, nor is it "ssdfjsldkfj", it retains its original value.

    It's technically JavaScript/V8 that does this, rather than the bindings, but the result is the same. I'm not seeing any way how I could get at the result of function that throws an exception, because JS will continue execution in the catch handler which doesn't see the function result.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Joey Arhar
    • 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: I3a6402afacb5d5275f546dfdefdac5d270e96d1f
    Gerrit-Change-Number: 7705032
    Gerrit-PatchSet: 4
    Gerrit-Owner: Daniel Vogelheim <voge...@chromium.org>
    Gerrit-Reviewer: Daniel Vogelheim <voge...@chromium.org>
    Gerrit-Reviewer: Joey Arhar <jar...@chromium.org>
    Gerrit-CC: Noam Rosenthal <nrose...@google.com>
    Gerrit-Attention: Joey Arhar <jar...@chromium.org>
    Gerrit-Attention: Noam Rosenthal <nrose...@google.com>
    Gerrit-Comment-Date: Wed, 01 Apr 2026 17:45:16 +0000
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy
    Reply all
    Reply to author
    Forward
    0 new messages