From 65d3954e14869dd356174508072de02893d4a412 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Wang?= Date: Tue, 22 Oct 2024 22:33:56 +0000 Subject: [PATCH] Bug 1917783 - Add more WPT tests for elementNS/attrNs parameters of `getAttributeType`. r=smaug Note that this overlaps a bit with the following tests: - TrustedTypePolicyFactory-getAttributeType-namespace.html - TrustedTypePolicyFactory-getAttributeType-svg.html Differential Revision: https://phabricator.services.mozilla.com/D226130 --- ...cyFactory-getPropertyType.tentative.html.ini | 3 +++ ...PolicyFactory-getPropertyType.tentative.html | 17 +++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/testing/web-platform/meta/trusted-types/TrustedTypePolicyFactory-getPropertyType.tentative.html.ini b/testing/web-platform/meta/trusted-types/TrustedTypePolicyFactory-getPropertyType.tentative.html.ini index 0de236f6a79a8..ccfb73756e6d1 100644 --- a/testing/web-platform/meta/trusted-types/TrustedTypePolicyFactory-getPropertyType.tentative.html.ini +++ b/testing/web-platform/meta/trusted-types/TrustedTypePolicyFactory-getPropertyType.tentative.html.ini @@ -10,3 +10,6 @@ [ASCII case-insensitivity of tag name and attribute parameters] expected: FAIL + + [getAttributeType with explicit elementNs and attrNs parameters] + expected: FAIL diff --git a/testing/web-platform/tests/trusted-types/TrustedTypePolicyFactory-getPropertyType.tentative.html b/testing/web-platform/tests/trusted-types/TrustedTypePolicyFactory-getPropertyType.tentative.html index 40e355f6c451f..a19c685b52ab8 100644 --- a/testing/web-platform/tests/trusted-types/TrustedTypePolicyFactory-getPropertyType.tentative.html +++ b/testing/web-platform/tests/trusted-types/TrustedTypePolicyFactory-getPropertyType.tentative.html @@ -117,5 +117,22 @@ }); assert_equals(trustedTypes.getPropertyType("iframe", "srcdoc", NSURI_HTML.toUpperCase()), null, "case-sensitiveness"); }, "getPropertyType with an explicit elementNs parameter"); + + test(t => { + NSURI_ARRAY.forEach(elementNs => { + const emptyOrHTMLElementNs = (elementNs === NSURI_EMPTY || elementNs === NSURI_HTML); + NSURI_ARRAY.forEach(attrNs => { + const emptyAttrNs = (attrNs === NSURI_EMPTY); + assert_equals(trustedTypes.getAttributeType("iframe", "srcdoc", elementNs, attrNs), + emptyOrHTMLElementNs && emptyAttrNs ? "TrustedHTML" : null); + assert_equals(trustedTypes.getAttributeType("script", "src", elementNs, attrNs), + emptyOrHTMLElementNs && emptyAttrNs ? "TrustedScriptURL" : null); + assert_equals(trustedTypes.getAttributeType("script", "href", elementNs, attrNs), + elementNs === NSURI_SVG && (emptyAttrNs || attrNs === NSURI_XLINK) ? "TrustedScriptURL" : null); + }); + }); + assert_equals(trustedTypes.getAttributeType("script", "href", NSURI_SVG.toUpperCase(), NSURI_XLINK), null, "case-sensitiveness of elementNs"); + assert_equals(trustedTypes.getAttributeType("script", "href", NSURI_SVG, NSURI_XLINK.toUpperCase()), null, "case-sensitiveness of attrNs"); + }, "getAttributeType with explicit elementNs and attrNs parameters");