[SVG] Support `ping`, `hreflang`, `type` and `referrerPolicy` for SVGAElement [chromium/src : main]

0 views
Skip to first unread message

Divyansh Mangal (Gerrit)

unread,
Oct 9, 2025, 4:23:24 PM (10 days ago) Oct 9
to Chromium LUCI CQ, AyeAye, chromium...@chromium.org, Dirk Schulze, Fredrik Söderquist, Stephen Chenney, blink-revie...@chromium.org, blink-re...@chromium.org, android-web...@chromium.org, ashleynewson+w...@chromium.org, blink-revi...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, fmalit...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, kouhe...@chromium.org, pdr+svgw...@chromium.org
Attention needed from Divyansh Mangal

Message from Divyansh Mangal

Set Ready For Review

Open in Gerrit

Related details

Attention is currently required from:
  • Divyansh Mangal
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: I1114b1e7ec4a4fa72cfbdc55b2e68dd5f308795a
Gerrit-Change-Number: 7008071
Gerrit-PatchSet: 10
Gerrit-Owner: Divyansh Mangal <dma...@microsoft.com>
Gerrit-Reviewer: Divyansh Mangal <dma...@microsoft.com>
Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
Gerrit-CC: Fredrik Söderquist <f...@opera.com>
Gerrit-CC: Stephen Chenney <sche...@chromium.org>
Gerrit-Attention: Divyansh Mangal <dma...@microsoft.com>
Gerrit-Comment-Date: Thu, 09 Oct 2025 20:21:41 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Kurt Catti-Schmidt (Gerrit)

unread,
Oct 14, 2025, 5:15:45 PM (5 days ago) Oct 14
to Divyansh Mangal, Vinay Singh, Virali Purbey, Sejal Anand, Dileep Maurya, Gaurav Kumar, Ragvesh Sharma, Chromium LUCI CQ, AyeAye, chromium...@chromium.org, Dirk Schulze, Fredrik Söderquist, Stephen Chenney, blink-revie...@chromium.org, blink-re...@chromium.org, android-web...@chromium.org, ashleynewson+w...@chromium.org, blink-revi...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, fmalit...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, kouhe...@chromium.org, pdr+svgw...@chromium.org
Attention needed from Divyansh Mangal, Vinay Singh and Virali Purbey

Kurt Catti-Schmidt added 10 comments

Patchset-level comments
File-level comment, Patchset 13 (Latest):
Kurt Catti-Schmidt . resolved

Looks great overall, mostly just questions.

File third_party/blink/renderer/core/dom/element.cc
Line 10423, Patchset 13 (Latest): // SVGAElement also has a `type` attribute for which lookup should be
// applied.
Kurt Catti-Schmidt . unresolved

Does `name` also need to be checked here?

File third_party/blink/renderer/core/frame/web_local_frame_impl.cc
Line 2742, Patchset 13 (Latest): if (auto* html_anchor = DynamicTo<HTMLAnchorElement>(anchor)) {
AnchorElementUtils::SendPings(
destination_url, html_anchor->GetDocument(),
html_anchor->FastGetAttribute(html_names::kPingAttr));
}
Kurt Catti-Schmidt . unresolved

Does this need another case for `SVGAnchorElement`?

File third_party/blink/renderer/core/html/anchor_element_utils.cc
Line 206, Patchset 13 (Latest): // Pings should not be sent if MHTML page is loaded.
if (document.Fetcher()->Archive()) {
return;
}
Kurt Catti-Schmidt . unresolved

Are there any tests for this?

Line 223, Patchset 13 (Latest): for (unsigned i = 0; i < ping_urls.size(); i++) {
Kurt Catti-Schmidt . unresolved

Not your code, but this should be `++i` per coding guidelines and `i` should be a `wtf_size_t`. Even better, you can avoid both with an iterator:

```
for (const auto& url : ping_urls) {
PingLoader::SendLinkAuditPing(document.GetFrame(),
document.CompleteURL(url),
destination_url);
}
}
```
File third_party/blink/renderer/core/svg/svg_a_element.cc
Line 153, Patchset 13 (Latest): if (RuntimeEnabledFeatures::SvgAnchorElementAttributesEnabled()) {
Kurt Catti-Schmidt . unresolved

You can put both of these under the same check for `SvgAnchorElementAttributesEnabled` so it's not being checked twice

File third_party/blink/web_tests/http/tests/security/referrer-policy-attribute-svg-anchor-no-referrer-when-downgrade.html
Line 12, Patchset 13 (Latest): if (window.location.origin != get_host_info().HTTPS_ORIGIN) {
window.location = get_host_info().HTTPS_ORIGIN + window.location.pathname;
} else {
Kurt Catti-Schmidt . unresolved

What is this doing, and when does it get hit?

File third_party/blink/web_tests/http/tests/security/referrer-policy-attribute-svg-anchor-no-referrer.html
Line 12, Patchset 13 (Latest): var anchorElement = document.getElementById('click-me');
Kurt Catti-Schmidt . unresolved

Prefer `const` or `let` for these test variables so you get more intuitive scoping

File third_party/blink/web_tests/http/tests/security/resources/referrer-attr-svg-anchor-target.html
Line 6, Patchset 13 (Latest): if (hash.length > 0)
hash = hash.substring(1);
Kurt Catti-Schmidt . unresolved

This could use a comment. Is it trimming the `#`?

Line 10, Patchset 13 (Latest): if (hash === "origin")
expected_referrer = "http://127.0.0.1:8000/";
else if (hash === "unsafe-url")
expected_referrer = "http://127.0.0.1:8000/security/referrer-policy-attribute-svg-anchor-unsafe-url.html";
else if (hash === "no-policy")
expected_referrer = "http://127.0.0.1:8000/";
else if (hash === "origin-when-crossorigin")
expected_referrer = "http://127.0.0.1:8000/";
else if (hash === "no-referrer" ||
hash === "no-referrer-when-downgrade")
expected_referrer = "";
else
throw new Error("Unexpected hash value!");
Kurt Catti-Schmidt . unresolved

This should be a `switch`

Open in Gerrit

Related details

Attention is currently required from:
  • Divyansh Mangal
  • Vinay Singh
  • Virali Purbey
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: I1114b1e7ec4a4fa72cfbdc55b2e68dd5f308795a
    Gerrit-Change-Number: 7008071
    Gerrit-PatchSet: 13
    Gerrit-Owner: Divyansh Mangal <dma...@microsoft.com>
    Gerrit-Reviewer: Divyansh Mangal <dma...@microsoft.com>
    Gerrit-Reviewer: Kurt Catti-Schmidt <ksc...@microsoft.com>
    Gerrit-Reviewer: Vinay Singh <vinay...@microsoft.com>
    Gerrit-Reviewer: Virali Purbey <virali...@microsoft.com>
    Gerrit-CC: Dileep Maurya <dileep...@microsoft.com>
    Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
    Gerrit-CC: Fredrik Söderquist <f...@opera.com>
    Gerrit-CC: Gaurav Kumar <gaur...@microsoft.com>
    Gerrit-CC: Ragvesh Sharma <rags...@microsoft.com>
    Gerrit-CC: Sejal Anand <sejal...@microsoft.com>
    Gerrit-CC: Stephen Chenney <sche...@chromium.org>
    Gerrit-Attention: Vinay Singh <vinay...@microsoft.com>
    Gerrit-Attention: Virali Purbey <virali...@microsoft.com>
    Gerrit-Attention: Divyansh Mangal <dma...@microsoft.com>
    Gerrit-Comment-Date: Tue, 14 Oct 2025 21:15:19 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Divyansh Mangal (Gerrit)

    unread,
    Oct 16, 2025, 6:28:53 AM (3 days ago) Oct 16
    to Kurt Catti-Schmidt, Vinay Singh, Virali Purbey, Sejal Anand, Dileep Maurya, Gaurav Kumar, Ragvesh Sharma, Chromium LUCI CQ, AyeAye, chromium...@chromium.org, Dirk Schulze, Fredrik Söderquist, Stephen Chenney, blink-revie...@chromium.org, blink-re...@chromium.org, android-web...@chromium.org, ashleynewson+w...@chromium.org, blink-revi...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, fmalit...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, kouhe...@chromium.org, pdr+svgw...@chromium.org
    Attention needed from Kurt Catti-Schmidt, Vinay Singh and Virali Purbey

    Divyansh Mangal added 9 comments

    File third_party/blink/renderer/core/dom/element.cc
    Line 10423, Patchset 13: // SVGAElement also has a `type` attribute for which lookup should be
    // applied.
    Kurt Catti-Schmidt . unresolved

    Does `name` also need to be checked here?

    Divyansh Mangal

    Personally, I believe for each attribute of `SVGAElement` we should be able to get the attributes using this lookup, but I will keep this comment open and wait for owner's opinion as well.

    File third_party/blink/renderer/core/frame/web_local_frame_impl.cc
    Line 2742, Patchset 13: if (auto* html_anchor = DynamicTo<HTMLAnchorElement>(anchor)) {

    AnchorElementUtils::SendPings(
    destination_url, html_anchor->GetDocument(),
    html_anchor->FastGetAttribute(html_names::kPingAttr));
    }
    Kurt Catti-Schmidt . unresolved

    Does this need another case for `SVGAnchorElement`?

    Divyansh Mangal

    Probably yes based on `EnclosingLinkEventParentOrSelf()`, but once again will wait for owner's opinion to confirm once.

    File third_party/blink/renderer/core/html/anchor_element_utils.cc
    Line 206, Patchset 13: // Pings should not be sent if MHTML page is loaded.
    if (document.Fetcher()->Archive()) {
    return;
    }
    Kurt Catti-Schmidt . resolved

    Are there any tests for this?

    Line 223, Patchset 13: for (unsigned i = 0; i < ping_urls.size(); i++) {
    Kurt Catti-Schmidt . resolved

    Not your code, but this should be `++i` per coding guidelines and `i` should be a `wtf_size_t`. Even better, you can avoid both with an iterator:

    ```
    for (const auto& url : ping_urls) {
    PingLoader::SendLinkAuditPing(document.GetFrame(),
    document.CompleteURL(url),
    destination_url);
    }
    }
    ```
    Divyansh Mangal

    Done

    File third_party/blink/renderer/core/svg/svg_a_element.cc
    Line 153, Patchset 13: if (RuntimeEnabledFeatures::SvgAnchorElementAttributesEnabled()) {
    Kurt Catti-Schmidt . resolved

    You can put both of these under the same check for `SvgAnchorElementAttributesEnabled` so it's not being checked twice

    Divyansh Mangal

    Done

    File third_party/blink/web_tests/http/tests/security/referrer-policy-attribute-svg-anchor-no-referrer-when-downgrade.html
    Line 12, Patchset 13: if (window.location.origin != get_host_info().HTTPS_ORIGIN) {

    window.location = get_host_info().HTTPS_ORIGIN + window.location.pathname;
    } else {
    Kurt Catti-Schmidt . unresolved

    What is this doing, and when does it get hit?

    Divyansh Mangal

    Hi @ksc...@microsoft.com, I mainly followed the same pattern for html anchor element downgrade referrer policy third_party/blink/web_tests/http/tests/security/referrer-policy-attribute-anchor-no-referrer-when-downgrade.html

    That being said based on my findings this piece of code gets triggered when the test is initially loaded over HTTP (e.g., http://127.0.0.1:8000) instead of HTTPS.
    The test needs to run on HTTPS because:

    1) The test validates "no-referrer-when-downgrade" policy - which specifically tests the behavior when navigating from HTTPS → HTTP

    2) The SVG anchor targets an HTTP URL (http://127.0.0.1:8000/security/resources/referrer-attr-svg-anchor-target.html)

    3) For the referrer policy to properly test "downgrade" behavior, the initial page must be on HTTPS so that the navigation to HTTP constitutes a downgrade

    Once again, this is the same pattern for html anchor element, iframe, img etc (elements which supports referrerPolicy attribute) and I believe we should follow the same for SVGAelement as well.
    Let me know if you want to discuss this further.

    File third_party/blink/web_tests/http/tests/security/referrer-policy-attribute-svg-anchor-no-referrer.html
    Line 12, Patchset 13: var anchorElement = document.getElementById('click-me');
    Kurt Catti-Schmidt . resolved

    Prefer `const` or `let` for these test variables so you get more intuitive scoping

    Divyansh Mangal

    Done

    File third_party/blink/web_tests/http/tests/security/resources/referrer-attr-svg-anchor-target.html
    Line 6, Patchset 13: if (hash.length > 0)
    hash = hash.substring(1);
    Kurt Catti-Schmidt . resolved

    This could use a comment. Is it trimming the `#`?

    Divyansh Mangal

    Yes you are right, added the comment as you suggested.

    Just mentioning though, I mainly followed the pattern in existing tests like
    third_party/blink/web_tests/http/tests/security/resources/referrer-attr-anchor-target.html for html anchor element.

    Line 10, Patchset 13: if (hash === "origin")

    expected_referrer = "http://127.0.0.1:8000/";
    else if (hash === "unsafe-url")
    expected_referrer = "http://127.0.0.1:8000/security/referrer-policy-attribute-svg-anchor-unsafe-url.html";
    else if (hash === "no-policy")
    expected_referrer = "http://127.0.0.1:8000/";
    else if (hash === "origin-when-crossorigin")
    expected_referrer = "http://127.0.0.1:8000/";
    else if (hash === "no-referrer" ||
    hash === "no-referrer-when-downgrade")
    expected_referrer = "";
    else
    throw new Error("Unexpected hash value!");
    Kurt Catti-Schmidt . resolved

    This should be a `switch`

    Divyansh Mangal

    Done

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Kurt Catti-Schmidt
    • Vinay Singh
    • Virali Purbey
    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: I1114b1e7ec4a4fa72cfbdc55b2e68dd5f308795a
    Gerrit-Change-Number: 7008071
    Gerrit-PatchSet: 14
    Gerrit-Owner: Divyansh Mangal <dma...@microsoft.com>
    Gerrit-Reviewer: Divyansh Mangal <dma...@microsoft.com>
    Gerrit-Reviewer: Kurt Catti-Schmidt <ksc...@microsoft.com>
    Gerrit-Reviewer: Vinay Singh <vinay...@microsoft.com>
    Gerrit-Reviewer: Virali Purbey <virali...@microsoft.com>
    Gerrit-CC: Dileep Maurya <dileep...@microsoft.com>
    Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
    Gerrit-CC: Fredrik Söderquist <f...@opera.com>
    Gerrit-CC: Gaurav Kumar <gaur...@microsoft.com>
    Gerrit-CC: Ragvesh Sharma <rags...@microsoft.com>
    Gerrit-CC: Sejal Anand <sejal...@microsoft.com>
    Gerrit-CC: Stephen Chenney <sche...@chromium.org>
    Gerrit-Attention: Vinay Singh <vinay...@microsoft.com>
    Gerrit-Attention: Kurt Catti-Schmidt <ksc...@microsoft.com>
    Gerrit-Attention: Virali Purbey <virali...@microsoft.com>
    Gerrit-Comment-Date: Thu, 16 Oct 2025 10:28:21 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Kurt Catti-Schmidt <ksc...@microsoft.com>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Kurt Catti-Schmidt (Gerrit)

    unread,
    Oct 16, 2025, 11:50:27 AM (3 days ago) Oct 16
    to Divyansh Mangal, Fredrik Söderquist, Vinay Singh, Virali Purbey, Sejal Anand, Dileep Maurya, Gaurav Kumar, Ragvesh Sharma, Chromium LUCI CQ, AyeAye, chromium...@chromium.org, Dirk Schulze, Stephen Chenney, blink-revie...@chromium.org, blink-re...@chromium.org, android-web...@chromium.org, ashleynewson+w...@chromium.org, blink-revi...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, fmalit...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, kouhe...@chromium.org, pdr+svgw...@chromium.org
    Attention needed from Divyansh Mangal, Fredrik Söderquist, Vinay Singh and Virali Purbey

    Kurt Catti-Schmidt added 4 comments

    Patchset-level comments
    File-level comment, Patchset 14 (Latest):
    Kurt Catti-Schmidt . resolved

    Overall looks good but there are still a few open questions. Adding @f...@opera.com, but heads up that he's out until tomorrow.

    File third_party/blink/renderer/core/dom/element.cc
    Line 10423, Patchset 13: // SVGAElement also has a `type` attribute for which lookup should be
    // applied.
    Kurt Catti-Schmidt . unresolved

    Does `name` also need to be checked here?

    Divyansh Mangal

    Personally, I believe for each attribute of `SVGAElement` we should be able to get the attributes using this lookup, but I will keep this comment open and wait for owner's opinion as well.

    Kurt Catti-Schmidt

    Yeah that's fine, let's see what Fredrick's take on this is because I'm not familiar with fast attribute lookup. I wonder if there are more opportunities to expand this for more SVG attributes.

    File third_party/blink/web_tests/http/tests/security/referrer-policy-attribute-svg-anchor-no-referrer-when-downgrade.html
    Line 12, Patchset 13: if (window.location.origin != get_host_info().HTTPS_ORIGIN) {
    window.location = get_host_info().HTTPS_ORIGIN + window.location.pathname;
    } else {
    Kurt Catti-Schmidt . unresolved

    What is this doing, and when does it get hit?

    Divyansh Mangal

    Hi @ksc...@microsoft.com, I mainly followed the same pattern for html anchor element downgrade referrer policy third_party/blink/web_tests/http/tests/security/referrer-policy-attribute-anchor-no-referrer-when-downgrade.html

    That being said based on my findings this piece of code gets triggered when the test is initially loaded over HTTP (e.g., http://127.0.0.1:8000) instead of HTTPS.
    The test needs to run on HTTPS because:

    1) The test validates "no-referrer-when-downgrade" policy - which specifically tests the behavior when navigating from HTTPS → HTTP

    2) The SVG anchor targets an HTTP URL (http://127.0.0.1:8000/security/resources/referrer-attr-svg-anchor-target.html)

    3) For the referrer policy to properly test "downgrade" behavior, the initial page must be on HTTPS so that the navigation to HTTP constitutes a downgrade

    Once again, this is the same pattern for html anchor element, iframe, img etc (elements which supports referrerPolicy attribute) and I believe we should follow the same for SVGAelement as well.
    Let me know if you want to discuss this further.

    Kurt Catti-Schmidt

    That makes sense, I appreciate the thorough investigation. So does that trigger a navigate that will rerun the test under https and hit the `else` block? Because if not, this looks like dead code that's not testing anything, hence my original question.

    Can you add a comment so this is clear? Something like:

    ```
    // Test downgrade behavior for non-https navigations. This will initiate a navigation that will run the `else` block below.
    ```

    File third_party/blink/web_tests/http/tests/security/resources/referrer-attr-svg-anchor-target.html
    Line 6, Patchset 13: if (hash.length > 0)
    hash = hash.substring(1);
    Kurt Catti-Schmidt . resolved

    This could use a comment. Is it trimming the `#`?

    Divyansh Mangal

    Yes you are right, added the comment as you suggested.

    Just mentioning though, I mainly followed the pattern in existing tests like
    third_party/blink/web_tests/http/tests/security/resources/referrer-attr-anchor-target.html for html anchor element.

    Kurt Catti-Schmidt

    I appreciate all the cleanups. It's frustrating when existing code that you move doesn't follow conventions but changes like this are a good opportunity for improvement.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Divyansh Mangal
    • Fredrik Söderquist
    • Vinay Singh
    • Virali Purbey
    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: I1114b1e7ec4a4fa72cfbdc55b2e68dd5f308795a
    Gerrit-Change-Number: 7008071
    Gerrit-PatchSet: 14
    Gerrit-Owner: Divyansh Mangal <dma...@microsoft.com>
    Gerrit-Reviewer: Divyansh Mangal <dma...@microsoft.com>
    Gerrit-Reviewer: Fredrik Söderquist <f...@opera.com>
    Gerrit-Reviewer: Kurt Catti-Schmidt <ksc...@microsoft.com>
    Gerrit-Reviewer: Vinay Singh <vinay...@microsoft.com>
    Gerrit-Reviewer: Virali Purbey <virali...@microsoft.com>
    Gerrit-CC: Dileep Maurya <dileep...@microsoft.com>
    Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
    Gerrit-CC: Gaurav Kumar <gaur...@microsoft.com>
    Gerrit-CC: Ragvesh Sharma <rags...@microsoft.com>
    Gerrit-CC: Sejal Anand <sejal...@microsoft.com>
    Gerrit-CC: Stephen Chenney <sche...@chromium.org>
    Gerrit-Attention: Vinay Singh <vinay...@microsoft.com>
    Gerrit-Attention: Virali Purbey <virali...@microsoft.com>
    Gerrit-Attention: Fredrik Söderquist <f...@opera.com>
    Gerrit-Attention: Divyansh Mangal <dma...@microsoft.com>
    Gerrit-Comment-Date: Thu, 16 Oct 2025 15:50:14 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Kurt Catti-Schmidt <ksc...@microsoft.com>
    Comment-In-Reply-To: Divyansh Mangal <dma...@microsoft.com>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Divyansh Mangal (Gerrit)

    unread,
    Oct 16, 2025, 12:04:52 PM (3 days ago) Oct 16
    to Fredrik Söderquist, Kurt Catti-Schmidt, Vinay Singh, Virali Purbey, Sejal Anand, Dileep Maurya, Gaurav Kumar, Ragvesh Sharma, Chromium LUCI CQ, AyeAye, chromium...@chromium.org, Dirk Schulze, Stephen Chenney, blink-revie...@chromium.org, blink-re...@chromium.org, android-web...@chromium.org, ashleynewson+w...@chromium.org, blink-revi...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, fmalit...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, kouhe...@chromium.org, pdr+svgw...@chromium.org
    Attention needed from Fredrik Söderquist, Kurt Catti-Schmidt, Vinay Singh and Virali Purbey

    Divyansh Mangal added 1 comment

    File third_party/blink/web_tests/http/tests/security/referrer-policy-attribute-svg-anchor-no-referrer-when-downgrade.html
    Line 12, Patchset 13: if (window.location.origin != get_host_info().HTTPS_ORIGIN) {
    window.location = get_host_info().HTTPS_ORIGIN + window.location.pathname;
    } else {
    Kurt Catti-Schmidt . resolved

    What is this doing, and when does it get hit?

    Divyansh Mangal

    Hi @ksc...@microsoft.com, I mainly followed the same pattern for html anchor element downgrade referrer policy third_party/blink/web_tests/http/tests/security/referrer-policy-attribute-anchor-no-referrer-when-downgrade.html

    That being said based on my findings this piece of code gets triggered when the test is initially loaded over HTTP (e.g., http://127.0.0.1:8000) instead of HTTPS.
    The test needs to run on HTTPS because:

    1) The test validates "no-referrer-when-downgrade" policy - which specifically tests the behavior when navigating from HTTPS → HTTP

    2) The SVG anchor targets an HTTP URL (http://127.0.0.1:8000/security/resources/referrer-attr-svg-anchor-target.html)

    3) For the referrer policy to properly test "downgrade" behavior, the initial page must be on HTTPS so that the navigation to HTTP constitutes a downgrade

    Once again, this is the same pattern for html anchor element, iframe, img etc (elements which supports referrerPolicy attribute) and I believe we should follow the same for SVGAelement as well.
    Let me know if you want to discuss this further.

    Kurt Catti-Schmidt

    That makes sense, I appreciate the thorough investigation. So does that trigger a navigate that will rerun the test under https and hit the `else` block? Because if not, this looks like dead code that's not testing anything, hence my original question.

    Can you add a comment so this is clear? Something like:

    ```
    // Test downgrade behavior for non-https navigations. This will initiate a navigation that will run the `else` block below.
    ```

    Divyansh Mangal

    Yes your understanding is correct. The else block will run the second time.
    Incorporated the comment as per suggestion, Thanks!

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Fredrik Söderquist
    • Kurt Catti-Schmidt
    • Vinay Singh
    • Virali Purbey
    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: I1114b1e7ec4a4fa72cfbdc55b2e68dd5f308795a
    Gerrit-Change-Number: 7008071
    Gerrit-PatchSet: 15
    Gerrit-Owner: Divyansh Mangal <dma...@microsoft.com>
    Gerrit-Reviewer: Divyansh Mangal <dma...@microsoft.com>
    Gerrit-Reviewer: Fredrik Söderquist <f...@opera.com>
    Gerrit-Reviewer: Kurt Catti-Schmidt <ksc...@microsoft.com>
    Gerrit-Reviewer: Vinay Singh <vinay...@microsoft.com>
    Gerrit-Reviewer: Virali Purbey <virali...@microsoft.com>
    Gerrit-CC: Dileep Maurya <dileep...@microsoft.com>
    Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
    Gerrit-CC: Gaurav Kumar <gaur...@microsoft.com>
    Gerrit-CC: Ragvesh Sharma <rags...@microsoft.com>
    Gerrit-CC: Sejal Anand <sejal...@microsoft.com>
    Gerrit-CC: Stephen Chenney <sche...@chromium.org>
    Gerrit-Attention: Vinay Singh <vinay...@microsoft.com>
    Gerrit-Attention: Kurt Catti-Schmidt <ksc...@microsoft.com>
    Gerrit-Attention: Virali Purbey <virali...@microsoft.com>
    Gerrit-Attention: Fredrik Söderquist <f...@opera.com>
    Gerrit-Comment-Date: Thu, 16 Oct 2025 16:04:20 +0000
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Fredrik Söderquist (Gerrit)

    unread,
    Oct 17, 2025, 10:52:12 AM (2 days ago) Oct 17
    to Divyansh Mangal, Kurt Catti-Schmidt, Vinay Singh, Virali Purbey, Sejal Anand, Dileep Maurya, Gaurav Kumar, Ragvesh Sharma, Chromium LUCI CQ, AyeAye, chromium...@chromium.org, Dirk Schulze, Stephen Chenney, blink-revie...@chromium.org, blink-re...@chromium.org, android-web...@chromium.org, ashleynewson+w...@chromium.org, blink-revi...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, fmalit...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, kouhe...@chromium.org, pdr+svgw...@chromium.org
    Attention needed from Divyansh Mangal, Kurt Catti-Schmidt, Vinay Singh and Virali Purbey

    Fredrik Söderquist added 6 comments

    File third_party/blink/renderer/core/dom/element.cc
    Line 10423, Patchset 13: // SVGAElement also has a `type` attribute for which lookup should be
    // applied.
    Kurt Catti-Schmidt . unresolved

    Does `name` also need to be checked here?

    Divyansh Mangal

    Personally, I believe for each attribute of `SVGAElement` we should be able to get the attributes using this lookup, but I will keep this comment open and wait for owner's opinion as well.

    Kurt Catti-Schmidt

    Yeah that's fine, let's see what Fredrick's take on this is because I'm not familiar with fast attribute lookup. I wonder if there are more opportunities to expand this for more SVG attributes.

    Fredrik Söderquist

    This ought to be handled by overriding `IsAnimatableAttribute()` and checking that there. See `SVGScriptElement`.

    File third_party/blink/renderer/core/frame/web_local_frame_impl.cc
    Line 2742, Patchset 13: if (auto* html_anchor = DynamicTo<HTMLAnchorElement>(anchor)) {
    AnchorElementUtils::SendPings(
    destination_url, html_anchor->GetDocument(),
    html_anchor->FastGetAttribute(html_names::kPingAttr));
    }
    Kurt Catti-Schmidt . unresolved

    Does this need another case for `SVGAnchorElement`?

    Divyansh Mangal

    Probably yes based on `EnclosingLinkEventParentOrSelf()`, but once again will wait for owner's opinion to confirm once.

    Fredrik Söderquist

    Yes, I would say so.

    File third_party/blink/renderer/core/html/anchor_element_utils.h
    Line 79, Patchset 15 (Latest): unsigned link_relations,
    Fredrik Söderquist . unresolved

    `uint32_t`

    File third_party/blink/renderer/core/html/anchor_element_utils.cc
    Line 238, Patchset 15 (Latest): !HasRel(link_relations, kRelationNoReferrer)) {
    Fredrik Söderquist . unresolved

    Could move this before the parsing.

    File third_party/blink/web_tests/external/wpt/svg/linking/scripted/a.ping-functionality.html
    Line 64, Patchset 15 (Latest): }, "SVG anchor ping attribute should be settable via DOM property");
    Fredrik Söderquist . unresolved

    ...ping content attribute should be settable via ping IDL attribute

    (or some such)

    File third_party/blink/web_tests/http/tests/security/referrer-policy-attribute-svg-anchor-no-referrer.html
    File-level comment, Patchset 15 (Latest):
    Fredrik Söderquist . unresolved

    We should make these (==this and the following tests) into WPTs (maybe there are existing WPTs for `<html:a>`?

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Divyansh Mangal
    Gerrit-Attention: Divyansh Mangal <dma...@microsoft.com>
    Gerrit-Comment-Date: Fri, 17 Oct 2025 14:52:07 +0000
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Divyansh Mangal (Gerrit)

    unread,
    Oct 18, 2025, 5:39:44 PM (21 hours ago) Oct 18
    to Fredrik Söderquist, Kurt Catti-Schmidt, Vinay Singh, Virali Purbey, Sejal Anand, Dileep Maurya, Gaurav Kumar, Ragvesh Sharma, Chromium LUCI CQ, AyeAye, chromium...@chromium.org, Dirk Schulze, Stephen Chenney, blink-revie...@chromium.org, blink-re...@chromium.org, android-web...@chromium.org, ashleynewson+w...@chromium.org, blink-revi...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, fmalit...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, kouhe...@chromium.org, pdr+svgw...@chromium.org
    Attention needed from Fredrik Söderquist, Kurt Catti-Schmidt, Vinay Singh and Virali Purbey

    Divyansh Mangal added 6 comments

    File third_party/blink/renderer/core/dom/element.cc
    Line 10423, Patchset 13: // SVGAElement also has a `type` attribute for which lookup should be
    // applied.
    Kurt Catti-Schmidt . resolved

    Does `name` also need to be checked here?

    Divyansh Mangal

    Personally, I believe for each attribute of `SVGAElement` we should be able to get the attributes using this lookup, but I will keep this comment open and wait for owner's opinion as well.

    Kurt Catti-Schmidt

    Yeah that's fine, let's see what Fredrick's take on this is because I'm not familiar with fast attribute lookup. I wonder if there are more opportunities to expand this for more SVG attributes.

    Fredrik Söderquist

    This ought to be handled by overriding `IsAnimatableAttribute()` and checking that there. See `SVGScriptElement`.

    Divyansh Mangal

    Done

    File third_party/blink/renderer/core/frame/web_local_frame_impl.cc
    Line 2742, Patchset 13: if (auto* html_anchor = DynamicTo<HTMLAnchorElement>(anchor)) {
    AnchorElementUtils::SendPings(
    destination_url, html_anchor->GetDocument(),
    html_anchor->FastGetAttribute(html_names::kPingAttr));
    }
    Kurt Catti-Schmidt . resolved

    Does this need another case for `SVGAnchorElement`?

    Divyansh Mangal

    Probably yes based on `EnclosingLinkEventParentOrSelf()`, but once again will wait for owner's opinion to confirm once.

    Fredrik Söderquist

    Yes, I would say so.

    Divyansh Mangal

    Done

    File third_party/blink/renderer/core/html/anchor_element_utils.h
    Line 79, Patchset 15: unsigned link_relations,
    Fredrik Söderquist . resolved

    `uint32_t`

    Divyansh Mangal

    Done

    File third_party/blink/renderer/core/html/anchor_element_utils.cc
    Line 238, Patchset 15: !HasRel(link_relations, kRelationNoReferrer)) {
    Fredrik Söderquist . resolved

    Could move this before the parsing.

    Divyansh Mangal

    Done

    File third_party/blink/web_tests/external/wpt/svg/linking/scripted/a.ping-functionality.html
    Line 64, Patchset 15: }, "SVG anchor ping attribute should be settable via DOM property");
    Fredrik Söderquist . resolved

    ...ping content attribute should be settable via ping IDL attribute

    (or some such)

    Divyansh Mangal

    Done

    File third_party/blink/web_tests/http/tests/security/referrer-policy-attribute-svg-anchor-no-referrer.html
    Fredrik Söderquist . unresolved

    We should make these (==this and the following tests) into WPTs (maybe there are existing WPTs for `<html:a>`?

    Divyansh Mangal

    The <html:a> element for referrerpolicy primarily had web_tests, which were introduced in the patchset:
    https://codereview.chromium.org/1253413003

    That being said, I tried my best to convert them to WPTs for SVGAElement. I do have to work around for host name due to linting errors, especially with the downgrade test but I was able to convert them to working wpts.

    Let me know what you think of them, should I remove the web_tests one as they seem to be redundant now for SVGAElement?

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Fredrik Söderquist
    • Kurt Catti-Schmidt
    • Vinay Singh
    • Virali Purbey
    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: I1114b1e7ec4a4fa72cfbdc55b2e68dd5f308795a
    Gerrit-Change-Number: 7008071
    Gerrit-PatchSet: 16
    Gerrit-Owner: Divyansh Mangal <dma...@microsoft.com>
    Gerrit-Reviewer: Divyansh Mangal <dma...@microsoft.com>
    Gerrit-Reviewer: Fredrik Söderquist <f...@opera.com>
    Gerrit-Reviewer: Kurt Catti-Schmidt <ksc...@microsoft.com>
    Gerrit-Reviewer: Vinay Singh <vinay...@microsoft.com>
    Gerrit-Reviewer: Virali Purbey <virali...@microsoft.com>
    Gerrit-CC: Dileep Maurya <dileep...@microsoft.com>
    Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
    Gerrit-CC: Gaurav Kumar <gaur...@microsoft.com>
    Gerrit-CC: Ragvesh Sharma <rags...@microsoft.com>
    Gerrit-CC: Sejal Anand <sejal...@microsoft.com>
    Gerrit-CC: Stephen Chenney <sche...@chromium.org>
    Gerrit-Attention: Vinay Singh <vinay...@microsoft.com>
    Gerrit-Attention: Kurt Catti-Schmidt <ksc...@microsoft.com>
    Gerrit-Attention: Virali Purbey <virali...@microsoft.com>
    Gerrit-Attention: Fredrik Söderquist <f...@opera.com>
    Gerrit-Comment-Date: Sat, 18 Oct 2025 21:39:05 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Kurt Catti-Schmidt <ksc...@microsoft.com>
    Comment-In-Reply-To: Fredrik Söderquist <f...@opera.com>
    Comment-In-Reply-To: Divyansh Mangal <dma...@microsoft.com>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy
    Reply all
    Reply to author
    Forward
    0 new messages