summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/trusted-types/Node-multiple-arguments.tentative.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
commit6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch)
treea68f146d7fa01f0134297619fbe7e33db084e0aa /testing/web-platform/tests/trusted-types/Node-multiple-arguments.tentative.html
parentInitial commit. (diff)
downloadthunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.tar.xz
thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.zip
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/trusted-types/Node-multiple-arguments.tentative.html')
-rw-r--r--testing/web-platform/tests/trusted-types/Node-multiple-arguments.tentative.html66
1 files changed, 66 insertions, 0 deletions
diff --git a/testing/web-platform/tests/trusted-types/Node-multiple-arguments.tentative.html b/testing/web-platform/tests/trusted-types/Node-multiple-arguments.tentative.html
new file mode 100644
index 0000000000..64b04656d3
--- /dev/null
+++ b/testing/web-platform/tests/trusted-types/Node-multiple-arguments.tentative.html
@@ -0,0 +1,66 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ <script src="support/helper.sub.js"></script>
+</head>
+<body>
+<div id="container"></div>
+<script>
+ 'use strict';
+ const container = document.querySelector("#container");
+ const policy = window.trustedTypes.createPolicy("policy", {
+ createScript: t => t,
+ });
+ function stringify(arg) {
+ return "textContent" in Object.getPrototypeOf(arg) ? arg.textContent : arg.toString()
+ }
+
+ // This test case mirrors the block-Node-multiple-arguments case except
+ // that, because Trusted Types is not enabled, no exceptions should be
+ // thrown anywhere.
+ const targets = ["div", "script"];
+ const all_args = [
+ [ policy.createScript("'createScript';") ],
+ [ policy.createScript("'createScript #1';"), policy.createScript("'#2;'") ],
+ [ "'plain text';" ],
+ [ "'plain text #1';", "'plain text #2';" ],
+ [ document.createTextNode("'node';") ],
+ [ document.createTextNode("'node #1';"),
+ document.createTextNode("'node #2';") ],
+ [ "'mixed';", document.createTextNode("'node';") ],
+ [ "'mixed';", policy.createScript("'script';") ],
+ [ document.createTextNode("'node';"),
+ policy.createScript("'script';") ],
+ ];
+
+ for (const target of targets) {
+ for (const args of all_args) {
+
+ for (const setter of [container.replaceWith, container.after, container.before]) {
+ test(t => {
+ var outer = document.createElement(target);
+ container.appendChild(outer);
+ var inner = document.createElement("p");
+ outer.appendChild(inner);
+ setter.apply(inner, args);
+ assert_equals(outer.textContent, args.map(stringify).join(""));
+
+ }, `${setter.name}(${args.toString()}) on <${target}> should pass`);
+ }
+
+ for (const setter of [container.append, container.prepend]) {
+ test(t => {
+ let outer = document.createElement(target);
+ container.appendChild(outer);
+ setter.apply(outer, args);
+ assert_equals(outer.textContent, args.map(stringify).join(""));
+ }, `${setter.name}(${args.toString()}) on <${target}> should pass`);
+ }
+
+ }
+ }
+</script>
+</body>
+</html>