commit 38a6c8cd9ce26478d2a63f0274a9fc33842edbb7
parent eb777af472f0ed91cac7fda0866a8ab8cea5119c
Author: longsonr <longsonr@gmail.com>
Date: Sat, 13 Dec 2025 14:29:44 +0000
Bug 2005880 - Fix ping attribute processing on SVG <a> elements r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D276344
Diffstat:
2 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/docshell/base/nsPingListener.cpp b/docshell/base/nsPingListener.cpp
@@ -120,6 +120,10 @@ static void SendPing(void* aClosure, nsIContent* aContent, nsIURI* aURI,
return;
}
+ if (nsCOMPtr<nsITimedChannel> timedChan = do_QueryInterface(chan)) {
+ timedChan->SetInitiatorType(u"ping"_ns);
+ }
+
// This is needed in order for 3rd-party cookie blocking to work.
nsCOMPtr<nsIHttpChannelInternal> httpInternal = do_QueryInterface(httpChan);
nsresult rv;
@@ -247,8 +251,9 @@ static void ForEachPing(nsIContent* aContent, ForEachPingCallback aCallback,
// implemented an interface that exposed an enumeration of nsIURIs.
// Make sure we are dealing with either an <A> or <AREA> element in the HTML
- // or XHTML namespace.
- if (!aContent->IsAnyOfHTMLElements(nsGkAtoms::a, nsGkAtoms::area)) {
+ // or XHTML namespace, or an <a> element in the SVG namespace.
+ if (!aContent->IsAnyOfHTMLElements(nsGkAtoms::a, nsGkAtoms::area) &&
+ !aContent->IsSVGElement(nsGkAtoms::a)) {
return;
}
diff --git a/testing/web-platform/meta/svg/linking/scripted/a.ping-functionality.html.ini b/testing/web-platform/meta/svg/linking/scripted/a.ping-functionality.html.ini
@@ -1,6 +1,2 @@
[a.ping-functionality.html]
- [SVG anchor with ping attribute should send ping on click]
- expected: FAIL
-
- [SVG anchor with multiple ping URLs should send multiple pings]
- expected: FAIL
+ prefs: [browser.send_pings:true,browser.send_pings.max_per_link:2]