commit bc601f5156d423a917d05ec5728d97efd6138197
parent 3c62d8a0480f3f483ad768c48d47d95a7ef59b90
Author: Luke Warlow <lwarlow@igalia.com>
Date: Thu, 9 Oct 2025 20:37:25 +0000
Bug 1992289 [wpt PR 55179] - WebKit export of https://bugs.webkit.org/show_bug.cgi?id=299958, a=testonly
Automatic update from web-platform-tests
WebKit export of https://bugs.webkit.org/show_bug.cgi?id=299958 (#55179)
--
wpt-commits: adfe054275b3cc9719b549384092811ec580f052
wpt-pr: 55179
Diffstat:
1 file changed, 18 insertions(+), 6 deletions(-)
diff --git a/testing/web-platform/tests/trusted-types/policy-without-return-value.sub.html b/testing/web-platform/tests/trusted-types/policy-without-return-value.sub.html
@@ -22,17 +22,28 @@ test(t => {
const doc = new DOMParser().parseFromString(
policy.createHTML("bla"), "text/html");
assert_equals(doc.body.textContent, "");
-}, "createHTML with a policy that returns undefined");
+}, "createHTML with a policy that returns undefined DOMParser");
+
+test(t => {
+ const policy = trustedTypes.createPolicy("emptyCreateHTML", {
+ "createHTML": _ => {},
+ });
+
+ const iframe = document.createElement("iframe");
+ iframe.srcdoc = policy.createHTML("bla");
+ assert_equals(iframe.srcdoc, "");
+ assert_true(iframe.hasAttribute('srcdoc'), "srcdoc attribute exists");
+}, "createHTML with a policy that returns undefined iframe.srcdoc");
test(t => {
const policy = trustedTypes.createPolicy("emptyCreateScript", {
"createScript": _ => {},
});
- const script = document.createElement("script");
- script.textContent = policy.createScript("bla");
- assert_equals(script.textContent, "");
-}, "createScript with a policy that returns undefined");
+ const div = document.createElement("div");
+ div.setAttribute('onload', policy.createScript("bla"));
+ assert_true(div.hasAttribute("onload"), "onload attribute exists");
+}, "createScript with a policy that returns undefined <div onload>");
test(t => {
const policy = trustedTypes.createPolicy("emptyCreateScriptURL", {
@@ -42,6 +53,7 @@ test(t => {
const script = document.createElement("script");
script.src = policy.createScriptURL("bla");
assert_equals(script.src, document.location.href);
-}, "createScriptURL with a policy that returns undefined");
+ assert_true(script.hasAttribute("src"), "src attribute exists");
+}, "createScriptURL with a policy that returns undefined script.src");
</script>
</body>