From 36d22d82aa202bb199967e9512281e9a53db42c9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 21:33:14 +0200 Subject: Adding upstream version 115.7.0esr. Signed-off-by: Daniel Baumann --- testing/web-platform/tests/sanitizer-api/META.yml | 5 + .../element-set-sanitized-html.https.html | 111 ++++++++++++++++ .../tests/sanitizer-api/idlharness.https.window.js | 12 ++ .../sanitizer-api/sanitizer-config.https.html | 90 +++++++++++++ .../sanitizer-api/sanitizer-insecure-context.html | 17 +++ .../tests/sanitizer-api/sanitizer-names.https.html | 147 +++++++++++++++++++++ .../sanitizer-query-config.https.html | 79 +++++++++++ .../sanitizer-sanitize.https.tentative.html | 76 +++++++++++ .../sanitizer-sanitizeFor.https.tentative.html | 101 ++++++++++++++ .../sanitizer-secure-context.https.html | 17 +++ .../sanitizer-api/sanitizer-unknown.https.html | 45 +++++++ .../tests/sanitizer-api/support/testcases.sub.js | 88 ++++++++++++ 12 files changed, 788 insertions(+) create mode 100644 testing/web-platform/tests/sanitizer-api/META.yml create mode 100644 testing/web-platform/tests/sanitizer-api/element-set-sanitized-html.https.html create mode 100644 testing/web-platform/tests/sanitizer-api/idlharness.https.window.js create mode 100644 testing/web-platform/tests/sanitizer-api/sanitizer-config.https.html create mode 100644 testing/web-platform/tests/sanitizer-api/sanitizer-insecure-context.html create mode 100644 testing/web-platform/tests/sanitizer-api/sanitizer-names.https.html create mode 100644 testing/web-platform/tests/sanitizer-api/sanitizer-query-config.https.html create mode 100644 testing/web-platform/tests/sanitizer-api/sanitizer-sanitize.https.tentative.html create mode 100644 testing/web-platform/tests/sanitizer-api/sanitizer-sanitizeFor.https.tentative.html create mode 100644 testing/web-platform/tests/sanitizer-api/sanitizer-secure-context.https.html create mode 100644 testing/web-platform/tests/sanitizer-api/sanitizer-unknown.https.html create mode 100644 testing/web-platform/tests/sanitizer-api/support/testcases.sub.js (limited to 'testing/web-platform/tests/sanitizer-api') diff --git a/testing/web-platform/tests/sanitizer-api/META.yml b/testing/web-platform/tests/sanitizer-api/META.yml new file mode 100644 index 0000000000..7ac32665e1 --- /dev/null +++ b/testing/web-platform/tests/sanitizer-api/META.yml @@ -0,0 +1,5 @@ +spec: https://wicg.github.io/sanitizer-api/ +suggested_reviewers: + - ivanlish + - mozfreddyb + - otherdaniel diff --git a/testing/web-platform/tests/sanitizer-api/element-set-sanitized-html.https.html b/testing/web-platform/tests/sanitizer-api/element-set-sanitized-html.https.html new file mode 100644 index 0000000000..560e9cd635 --- /dev/null +++ b/testing/web-platform/tests/sanitizer-api/element-set-sanitized-html.https.html @@ -0,0 +1,111 @@ + + + + + + + + + + + diff --git a/testing/web-platform/tests/sanitizer-api/idlharness.https.window.js b/testing/web-platform/tests/sanitizer-api/idlharness.https.window.js new file mode 100644 index 0000000000..384317b8e5 --- /dev/null +++ b/testing/web-platform/tests/sanitizer-api/idlharness.https.window.js @@ -0,0 +1,12 @@ +// META: script=/resources/WebIDLParser.js +// META: script=/resources/idlharness.js + +idl_test( + ['sanitizer-api.tentative'], + ['html'], + idl_array => { + idl_array.add_objects({ + Sanitizer: ['new Sanitizer({})'] + }); + } +); diff --git a/testing/web-platform/tests/sanitizer-api/sanitizer-config.https.html b/testing/web-platform/tests/sanitizer-api/sanitizer-config.https.html new file mode 100644 index 0000000000..f60e6c9c93 --- /dev/null +++ b/testing/web-platform/tests/sanitizer-api/sanitizer-config.https.html @@ -0,0 +1,90 @@ + + + + + + + + + + + diff --git a/testing/web-platform/tests/sanitizer-api/sanitizer-insecure-context.html b/testing/web-platform/tests/sanitizer-api/sanitizer-insecure-context.html new file mode 100644 index 0000000000..4b185fd3a7 --- /dev/null +++ b/testing/web-platform/tests/sanitizer-api/sanitizer-insecure-context.html @@ -0,0 +1,17 @@ + + + + + + + + + + diff --git a/testing/web-platform/tests/sanitizer-api/sanitizer-names.https.html b/testing/web-platform/tests/sanitizer-api/sanitizer-names.https.html new file mode 100644 index 0000000000..df5dd8549d --- /dev/null +++ b/testing/web-platform/tests/sanitizer-api/sanitizer-names.https.html @@ -0,0 +1,147 @@ + + + + + + + + + + diff --git a/testing/web-platform/tests/sanitizer-api/sanitizer-query-config.https.html b/testing/web-platform/tests/sanitizer-api/sanitizer-query-config.https.html new file mode 100644 index 0000000000..60cba2d618 --- /dev/null +++ b/testing/web-platform/tests/sanitizer-api/sanitizer-query-config.https.html @@ -0,0 +1,79 @@ + + + + + + + + + + diff --git a/testing/web-platform/tests/sanitizer-api/sanitizer-sanitize.https.tentative.html b/testing/web-platform/tests/sanitizer-api/sanitizer-sanitize.https.tentative.html new file mode 100644 index 0000000000..82eaeb4832 --- /dev/null +++ b/testing/web-platform/tests/sanitizer-api/sanitizer-sanitize.https.tentative.html @@ -0,0 +1,76 @@ + + + + + + + + + + + + diff --git a/testing/web-platform/tests/sanitizer-api/sanitizer-sanitizeFor.https.tentative.html b/testing/web-platform/tests/sanitizer-api/sanitizer-sanitizeFor.https.tentative.html new file mode 100644 index 0000000000..77ae0abb6b --- /dev/null +++ b/testing/web-platform/tests/sanitizer-api/sanitizer-sanitizeFor.https.tentative.html @@ -0,0 +1,101 @@ + + + + + + + + + + + + diff --git a/testing/web-platform/tests/sanitizer-api/sanitizer-secure-context.https.html b/testing/web-platform/tests/sanitizer-api/sanitizer-secure-context.https.html new file mode 100644 index 0000000000..0e04e04d16 --- /dev/null +++ b/testing/web-platform/tests/sanitizer-api/sanitizer-secure-context.https.html @@ -0,0 +1,17 @@ + + + + + + + + + + diff --git a/testing/web-platform/tests/sanitizer-api/sanitizer-unknown.https.html b/testing/web-platform/tests/sanitizer-api/sanitizer-unknown.https.html new file mode 100644 index 0000000000..03d7c6966d --- /dev/null +++ b/testing/web-platform/tests/sanitizer-api/sanitizer-unknown.https.html @@ -0,0 +1,45 @@ + + + + + + + + + + diff --git a/testing/web-platform/tests/sanitizer-api/support/testcases.sub.js b/testing/web-platform/tests/sanitizer-api/support/testcases.sub.js new file mode 100644 index 0000000000..9081ad2aa2 --- /dev/null +++ b/testing/web-platform/tests/sanitizer-api/support/testcases.sub.js @@ -0,0 +1,88 @@ +const testcases = [ + {config_input: {}, value: "test", result: "test", message: "string"}, + {config_input: {}, value: "bla", result: "bla", message: "html fragment"}, + {config_input: {}, value: "test", result: "test", message: "document"}, + {config_input: {}, value: "
test", result: "
test
", message: "html without close tag"}, + {config_input: {}, value: "", result: "

Click.

", message: "dropAttributes list {\"data-attribute-with-dashes\": [\"*\"]} with dom dataset js access"}, + {config_input: {allowAttributes: [{name: "id", elements: ["div"]}]}, value: "

P

DIV
", result: "

P

DIV
", message: "allowAttributes list {\"id\": [\"div\"]} with id attribute"}, + {config_input: {allowAttributes: [{name: "id", elements: "*"}]}, value: "

Click.

", result: "

Click.

", message: "allowAttributes list {\"id\": [\"*\"]} with id attribute and onclick scripts"}, + // {config_input: {allowAttributes: {"*": ["a"]}}, value: "Click.
div
", result: "Click.
div
", message: "allowAttributes list {\"*\": [\"a\"]} with style attribute"}, + {config_input: {dropAttributes: [{name: "style", elements: "*"}], allowAttributes: [{name: "style", elements: "*"}]}, value: "

Click.

", result: "

Click.

", message: "allowAttributes list has no influence to dropAttributes"}, + {config_input: {allowElements: ["template", "div"]}, value: "", result: "", message: "Template element"}, + {config_input: {}, value: "Click.", result: "Click.", message: "HTMLAnchorElement with javascript protocal"}, + {config_input: {}, value: "Click.", result: "Click.", message: "HTMLAnchorElement with javascript protocal start with space"}, + {config_input: {}, value: "Click.", result: "Click.", message: "HTMLAnchorElement"}, + {config_input: {}, value: "Click.", result: "Click.", message: "HTMLAreaElement with javascript protocal"}, + {config_input: {}, value: "Click.", result: "Click.", message: "HTMLAreaElement with javascript protocal start with space"}, + {config_input: {}, value: "Click.", result: "Click.", message: "HTMLAreaElement"}, + {config_input: {}, value: "
Click.
", result: "
Click.
", message: "HTMLFormElement with javascript action"}, + {config_input: {}, value: "
Click.
", result: "
Click.
", message: "HTMLFormElement with javascript action start with space"}, + {config_input: {}, value: "
Click.
", result: "
Click.
", message: "HTMLFormElement"}, + {config_input: {}, value: "Click.", result: "Click.", message: "HTMLInputElement with javascript formaction"}, + {config_input: {}, value: "Click.", result: "Click.", message: "HTMLInputElement with javascript formaction start with space"}, + {config_input: {}, value: "Click.", result: "Click.", message: "HTMLInputElement"}, + {config_input: {}, value: "", result: "", message: "HTMLButtonElement with javascript formaction"}, + {config_input: {}, value: "", result: "", message: "HTMLButtonElement with javascript formaction start with space"}, + {config_input: {}, value: "", result: "", message: "HTMLButtonElement"}, + {config_input: {}, value: "

Some text

Some more text

", result: "

Some text

Some more text

", message: "malformed HTML"}, + {config_input: {}, value: "

Some text

Some more text

", result: "

Some text

Some more text

", message: "HTML with comments; comments not allowed"}, + {config_input: {allowComments: true}, value: "

Some text

Some more text

", result: "

Some text

Some more text

", message: "HTML with comments; allowComments"}, + {config_input: {allowComments: false}, value: "

Some text

Some more text

", result: "

Some text

Some more text

", message: "HTML with comments; !allowComments"}, + {config_input: {}, value: "

commentintext

", result: "

commentintext

", message: "HTML with comments deeper in the tree"}, + {config_input: {allowComments: true}, value: "

commentintext

", result: "

commentintext

", message: "HTML with comments deeper in the tree, allowComments"}, + {config_input: {allowComments: false}, value: "

commentintext

", result: "

commentintext

", message: "HTML with comments deeper in the tree, !allowComments"}, + {config_input: {allowElements: ["svg"]}, value: "", result: "", message: "Unknown HTML names (HTMLUnknownElement instances) should not match elements parsed as non-HTML namespaces."}, + {config_input: {allowElements: ["div", "svg"]}, value: "
", result: "
", message: "Unknown HTML names (HTMLUnknownElement instances) should not match elements parsed as non-HTML namespaces when nested."}, + + // Case normalization (actually: lack of) + {config_input: {dropElements: ["I", "DL"]}, value: "
balabala
test
", result: "
balabala
test
", message: "dropElements list [\"I\", \"DL\"]}"}, + {config_input: {dropElements: ["i", "dl"]}, value: "
balabala
test
", result: "
balabala
", message: "dropElements list [\"i\", \"dl\"]}"}, + {config_input: {dropElements: ["i", "dl"]}, value: "
balabala
test
", result: "
balabala
", message: "dropElements list [\"i\", \"dl\"]} with uppercase HTML"}, + {config_input: {dropAttributes: [{name: "ID", elements: "*"}]}, value: "

Click.

", result: "

Click.

", message: "dropAttributes list {\"ID\": [\"*\"]} with id attribute"}, + {config_input: {dropAttributes: [{name: "ID", elements: "*"}]}, value: "

Click.

", result: "

Click.

", message: "dropAttributes list {\"ID\": [\"*\"]} with ID attribute"}, + {config_input: {dropAttributes: [{name: "id", elements: "*"}]}, value: "

Click.

", result: "

Click.

", message: "dropAttributes list {\"id\": [\"*\"]} with ID attribute"}, + + // allowUnknownMarkup for elements (with and without) + {config_input: {dropElements: [123, "test", "i", "custom-element"]}, value: "
balabalatest
tcustom-element", result: "
balabala
", message: "dropElements with unknown elements and without allowUnknownMarkup"}, + {config_input: {blockElements: [123, "test", "i", "custom-element"]}, value: "
balabalatest
tcustom-element", result: "
balabalatest
", message: "blockElements with unknown elements and without allowUnknownMarkup"}, + {config_input: {allowElements: ["p", "test"]}, value: "
test
p
tt

div

test", result: "testptt

div

", message: "allowElements with unknown elements and without allowUnknownMarkup"}, + {config_input: {dropElements: [123, "test", "i", "custom-element"], allowUnknownMarkup: true}, value: "
balabalatest
tcustom-element", result: "
balabala
", message: "dropElements with unknown elements and with allowUnknownMarkup"}, + {config_input: {blockElements: [123, "test", "i", "custom-element"], allowUnknownMarkup: true}, value: "
balabalatest
tcustom-element", result: "
balabalatest
t", message: "blockElements with unknown elements and with allowUnknownMarkup"}, + {config_input: {allowElements: ["p", "test"], allowUnknownMarkup: true}, value: "
test
p
tt

div

test
", result: "testptt

div

test", message: "allowElements with unknown elements and with allowUnknownMarkup"}, + + // allowUnknownMarkup for attributes (with and without) + {config_input: {allowAttributes: [{name: "hello", elements: "*"}, {name: "world", elements: ["b"]}]}, value: "
", result: "
", message: "allowAttributes unknown attributes and without allowUnknownMarkup"}, + {config_input: {allowAttributes: [{name: "hello", elements: "*"}, {name: "world", elements: ["b"]}], allowUnknownMarkup: true}, value: "
", result: "
", message: "allowAttributes unknown attributes and with allowUnknownMarkup"}, + {config_input: {dropAttributes: [{name: "hello", elements: "*"}, {name:"world", elements: ["b"]}]}, value: "
", result: "
", message: "dropAttributes unknown attributes and without allowUnknownMarkup"}, + {config_input: {dropAttributes: [{name: "hello", elements: "*"}, {name:"world", elements: ["b"]}], allowUnknownMarkup: true}, value: "
", result: "
", message: "dropAttributes unknown attributes and with allowUnknownMarkup"}, +]; -- cgit v1.2.3