LibWeb/SVG: Implement the SVGAElement.referrerPolicy attribute

This commit is contained in:
Tim Ledbetter 2025-07-12 02:12:07 +01:00 committed by Jelle Raaijmakers
commit 31e8189f9f
Notes: github-actions[bot] 2025-07-12 09:06:49 +00:00
4 changed files with 19 additions and 6 deletions

View file

@ -1,4 +1,5 @@
#import <DOM/DOMTokenList.idl>
#import <Fetch/Request.idl>
#import <HTML/HTMLHyperlinkElementUtils.idl>
#import <SVG/SVGURIReference.idl>
@ -14,7 +15,7 @@ interface SVGAElement : SVGGraphicsElement {
[Reflect] attribute DOMString hreflang;
[Reflect] attribute DOMString type;
[FIXME] attribute DOMString referrerPolicy;
[Reflect=referrerpolicy, Enumerated=ReferrerPolicy] attribute DOMString referrerPolicy;
};

View file

@ -40,3 +40,10 @@ script referrerPolicy value after setting to null: ''
script referrerPolicy value after setting to "NO-REFERRER": 'no-referrer'
script referrerPolicy value after setting to "": ''
script referrerPolicy value after calling removeAttribute: ''
svg:a referrerPolicy initial value: ''
svg:a referrerPolicy value after setting to "invalid": ''
svg:a referrerPolicy value after setting to "no-referrer": 'no-referrer'
svg:a referrerPolicy value after setting to null: ''
svg:a referrerPolicy value after setting to "NO-REFERRER": 'no-referrer'
svg:a referrerPolicy value after setting to "": ''
svg:a referrerPolicy value after calling removeAttribute: ''

View file

@ -2,8 +2,8 @@ Harness status: OK
Found 1781 tests
940 Pass
841 Fail
942 Pass
839 Fail
Pass idl_test setup
Pass idl_test validation
Pass Partial interface Document: original interface defined
@ -1560,7 +1560,7 @@ Pass SVGAElement interface: attribute relList
Pass SVGAElement interface: attribute hreflang
Pass SVGAElement interface: attribute type
Fail SVGAElement interface: attribute text
Fail SVGAElement interface: attribute referrerPolicy
Pass SVGAElement interface: attribute referrerPolicy
Fail SVGAElement interface: attribute origin
Fail SVGAElement interface: attribute protocol
Fail SVGAElement interface: attribute username
@ -1582,7 +1582,7 @@ Pass SVGAElement interface: objects.a must inherit property "relList" with the p
Pass SVGAElement interface: objects.a must inherit property "hreflang" with the proper type
Pass SVGAElement interface: objects.a must inherit property "type" with the proper type
Fail SVGAElement interface: objects.a must inherit property "text" with the proper type
Fail SVGAElement interface: objects.a must inherit property "referrerPolicy" with the proper type
Pass SVGAElement interface: objects.a must inherit property "referrerPolicy" with the proper type
Fail SVGAElement interface: objects.a must inherit property "origin" with the proper type
Fail SVGAElement interface: objects.a must inherit property "protocol" with the proper type
Fail SVGAElement interface: objects.a must inherit property "username" with the proper type

View file

@ -2,8 +2,13 @@
<script src="../include.js"></script>
<script>
test(() => {
let elements = [];
for (const elementName of ["link", "a", "area", "img", "iframe", "script"]) {
const element = document.createElement(elementName);
elements.push([document.createElement(elementName), elementName]);
}
elements.push([document.createElementNS("http://www.w3.org/2000/svg", "a"), "svg:a"]);
for (const [element, elementName] of elements) {
println(`${elementName} referrerPolicy initial value: '${element.referrerPolicy}'`);
element.referrerPolicy = "invalid";
println(`${elementName} referrerPolicy value after setting to "invalid": '${element.referrerPolicy}'`);