From 26a029d407be480d791972afb5975cf62c9360a6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 02:47:55 +0200 Subject: Adding upstream version 124.0.1. Signed-off-by: Daniel Baumann --- testing/web-platform/tests/dom/xslt/README.md | 11 + .../web-platform/tests/dom/xslt/externalScript.js | 1 + .../tests/dom/xslt/functions.tentative.window.js | 252 + .../dom/xslt/invalid-output-encoding-crash.html | 26 + .../tests/dom/xslt/large-cdata-ref.html | 13 + .../web-platform/tests/dom/xslt/large-cdata.html | 17 + .../tests/dom/xslt/resources/large_CDATA.xml | 156982 ++++++++++++++++++ .../tests/dom/xslt/resources/large_CDATA_ref.html | 119 + .../tests/dom/xslt/resources/xml2html.xsl | 25 + testing/web-platform/tests/dom/xslt/sort-ref.html | 10 + testing/web-platform/tests/dom/xslt/sort.html | 48 + .../tests/dom/xslt/strip-space-crash.xml | 33 + ...gment-on-node-from-inactive-document-crash.html | 11 + .../xslt/transformToFragment.tentative.window.js | 39 + 14 files changed, 157587 insertions(+) create mode 100644 testing/web-platform/tests/dom/xslt/README.md create mode 100644 testing/web-platform/tests/dom/xslt/externalScript.js create mode 100644 testing/web-platform/tests/dom/xslt/functions.tentative.window.js create mode 100644 testing/web-platform/tests/dom/xslt/invalid-output-encoding-crash.html create mode 100644 testing/web-platform/tests/dom/xslt/large-cdata-ref.html create mode 100644 testing/web-platform/tests/dom/xslt/large-cdata.html create mode 100644 testing/web-platform/tests/dom/xslt/resources/large_CDATA.xml create mode 100644 testing/web-platform/tests/dom/xslt/resources/large_CDATA_ref.html create mode 100644 testing/web-platform/tests/dom/xslt/resources/xml2html.xsl create mode 100644 testing/web-platform/tests/dom/xslt/sort-ref.html create mode 100644 testing/web-platform/tests/dom/xslt/sort.html create mode 100644 testing/web-platform/tests/dom/xslt/strip-space-crash.xml create mode 100644 testing/web-platform/tests/dom/xslt/transformToFragment-on-node-from-inactive-document-crash.html create mode 100644 testing/web-platform/tests/dom/xslt/transformToFragment.tentative.window.js (limited to 'testing/web-platform/tests/dom/xslt') diff --git a/testing/web-platform/tests/dom/xslt/README.md b/testing/web-platform/tests/dom/xslt/README.md new file mode 100644 index 0000000000..ac713ce179 --- /dev/null +++ b/testing/web-platform/tests/dom/xslt/README.md @@ -0,0 +1,11 @@ +# XSLT + +This directory contains tentative tests for [XSLT](https://dom.spec.whatwg.org/#xslt). + +See [whatwg/dom#181](https://github.com/whatwg/dom/issues/181) for getting XSLT +better specified. + +There are additional details on XSLT in HTML: +- [Interactions with XPath and XSLT](https://html.spec.whatwg.org/multipage/infrastructure.html#interactions-with-xpath-and-xslt) +- [Interaction of `script` elements and XSLT](https://html.spec.whatwg.org/multipage/scripting.html#scriptTagXSLT) (non-normative) +- [Interaction of `template` elements with XSLT and XPath](https://html.spec.whatwg.org/multipage/scripting.html#template-XSLT-XPath) (non-normative) diff --git a/testing/web-platform/tests/dom/xslt/externalScript.js b/testing/web-platform/tests/dom/xslt/externalScript.js new file mode 100644 index 0000000000..7a2bf36225 --- /dev/null +++ b/testing/web-platform/tests/dom/xslt/externalScript.js @@ -0,0 +1 @@ +window.externalScript = true; diff --git a/testing/web-platform/tests/dom/xslt/functions.tentative.window.js b/testing/web-platform/tests/dom/xslt/functions.tentative.window.js new file mode 100644 index 0000000000..81240022dc --- /dev/null +++ b/testing/web-platform/tests/dom/xslt/functions.tentative.window.js @@ -0,0 +1,252 @@ +const xslt_functions = [ + "QName", + "abs", + "accumulator-after", + "accumulator-before", + "adjust-date-to-timezone", + "adjust-dateTime-to-timezone", + "adjust-time-to-timezone", + "analyze-string", + "apply", + "available-environment-variables", + "available-system-properties", + "avg", + "base-uri", + "boolean", + "ceiling", + "codepoint-equal", + "codepoints-to-string", + "collation-key", + "collection", + "compare", + "concat", + "contains", + "contains-token", + "copy-of", + "count", + "current", + "current-date", + "current-dateTime", + "current-group", + "current-grouping-key", + "current-merge-group", + "current-merge-key", + "current-output-uri", + "current-time", + "data", + "dateTime", + "day-from-date", + "day-from-dateTime", + "days-from-duration", + "deep-equal", + "default-collation", + "default-language", + "distinct-values", + "doc", + "doc-available", + "document", + "document-uri", + "element-available", + "element-with-id", + "empty", + "encode-for-uri", + "ends-with", + "environment-variable", + "error", + "escape-html-uri", + "exactly-one", + "exists", + "false", + "filter", + "floor", + "fold-left", + "fold-right", + "for-each", + "for-each-pair", + "format-date", + "format-dateTime", + "format-integer", + "format-number", + "format-time", + "function-arity", + "function-available", + "function-lookup", + "function-name", + "generate-id", + "has-children", + "head", + "hours-from-dateTime", + "hours-from-duration", + "hours-from-time", + "id", + "idref", + "implicit-timezone", + "in-scope-prefixes", + "index-of", + "innermost", + "insert-before", + "iri-to-uri", + "json-doc", + "json-to-xml", + "key", + "lang", + "last", + "load-xquery-module", + "local-name", + "local-name-from-QName", + "lower-case", + "matches", + "max", + "min", + "minutes-from-dateTime", + "minutes-from-duration", + "minutes-from-time", + "month-from-date", + "month-from-dateTime", + "months-from-duration", + "name", + "namespace-uri", + "namespace-uri-for-prefix", + "namespace-uri-from-QName", + "nilled", + "node-name", + "normalize-space", + "normalize-unicode", + "not", + "number", + "one-or-more", + "outermost", + "parse-ietf-date", + "parse-json", + "parse-xml", + "parse-xml-fragment", + "path", + "position", + "prefix-from-QName", + "put", + "random-number-generator", + "regex-group", + "remove", + "replace", + "resolve-QName", + "resolve-uri", + "reverse", + "root", + "round", + "round-half-to-even", + "seconds-from-dateTime", + "seconds-from-duration", + "seconds-from-time", + "serialize", + "snapshot", + "sort", + "starts-with", + "static-base-uri", + "stream-available", + "string", + "string-join", + "string-length", + "string-to-codepoints", + "subsequence", + "substring", + "substring-after", + "substring-before", + "sum", + "system-property", + "tail", + "timezone-from-date", + "timezone-from-dateTime", + "timezone-from-time", + "tokenize", + "trace", + "transform", + "translate", + "true", + "type-available", + "unordered", + "unparsed-entity-public-id", + "unparsed-entity-uri", + "unparsed-text", + "unparsed-text-available", + "unparsed-text-lines", + "upper-case", + "uri-collection", + "xml-to-json", + "year-from-date", + "year-from-dateTime", + "years-from-duration", + "zero-or-one", +]; + +const xslt1_functions = [ + "boolean", + "ceiling", + "concat", + "contains", + "count", + "current", + "document", + "element-available", + "false", + "floor", + "format-number", + "function-available", + "generate-id", + "id", + "key", + "lang", + "last", + "local-name", + "name", + "namespace-uri", + "normalize-space", + "not", + "number", + "position", + "round", + "starts-with", + "string", + "string-length", + "substring", + "substring-after", + "substring-before", + "sum", + "system-property", + "translate", + "true", + "unparsed-entity-uri", +]; + +for (const fn of xslt_functions) { + test(() => { + const xsltSrc = ` + + + + +
available
+
+ +
unavailable
+
+
+
+
`; + + const processor = new XSLTProcessor(); + const parser = new DOMParser(); + processor.importStylesheet( + parser.parseFromString(xsltSrc, "application/xml") + ); + const output = processor.transformToFragment( + parser.parseFromString("", "application/xml"), + document + ); + + // Note we only expect functions defined in XSLT 1.0 to be defined. + assert_equals( + output.textContent.trim(), + xslt1_functions.indexOf(fn) >= 0 ? "available" : "unavailable" + ); + }, fn); +} diff --git a/testing/web-platform/tests/dom/xslt/invalid-output-encoding-crash.html b/testing/web-platform/tests/dom/xslt/invalid-output-encoding-crash.html new file mode 100644 index 0000000000..d84bb5b3c3 --- /dev/null +++ b/testing/web-platform/tests/dom/xslt/invalid-output-encoding-crash.html @@ -0,0 +1,26 @@ + + + + + + + + + diff --git a/testing/web-platform/tests/dom/xslt/large-cdata-ref.html b/testing/web-platform/tests/dom/xslt/large-cdata-ref.html new file mode 100644 index 0000000000..7f80540c5f --- /dev/null +++ b/testing/web-platform/tests/dom/xslt/large-cdata-ref.html @@ -0,0 +1,13 @@ + + + diff --git a/testing/web-platform/tests/dom/xslt/large-cdata.html b/testing/web-platform/tests/dom/xslt/large-cdata.html new file mode 100644 index 0000000000..9c83b731bd --- /dev/null +++ b/testing/web-platform/tests/dom/xslt/large-cdata.html @@ -0,0 +1,17 @@ + + + + + + + diff --git a/testing/web-platform/tests/dom/xslt/resources/large_CDATA.xml b/testing/web-platform/tests/dom/xslt/resources/large_CDATA.xml new file mode 100644 index 0000000000..9b3f5b9035 --- /dev/null +++ b/testing/web-platform/tests/dom/xslt/resources/large_CDATA.xml @@ -0,0 +1,156982 @@ + + + + + Empire Burlesque + Bob Dylan + USA + Columbia + 10.90 + 1985 + + + + + Hide your heart + Bonnie Tyler + UK + CBS Records + 9.90 + 1988 + + + + Greatest Hits + Dolly Parton + USA + RCA + 9.90 + 1982 + + + + Still got the blues + Gary Moore + UK + Virgin records + 10.20 + 1990 + + + Eros + Eros Ramazzotti + EU + BMG + 9.90 + 1997 + + + One night only + Bee Gees + UK + Polydor + 10.90 + 1998 + + + Sylvias Mother + Dr.Hook + UK + CBS + 8.10 + 1973 + + + Maggie May + Rod Stewart + UK + Pickwick + 8.50 + 1990 + + + Romanza + Andrea Bocelli + EU + Polydor + 10.80 + 1996 + + + When a man loves a woman + Percy Sledge + USA + Atlantic + 8.70 + 1987 + + + Black angel + Savage Rose + EU + Mega + 10.90 + 1995 + + + 1999 Grammy Nominees + Many + USA + Grammy + 10.20 + 1999 + + + For the good times + Kenny Rogers + UK + Mucik + 8.70 + 1995 + + + Big Willie style + Will Smith + USA + Columbia + 9.90 + 1997 + + + Tupelo Honey + Van Morrison + UK + Polydor + 8.20 + 1971 + + + Soulsville + Jorn Hoel + Norway + WEA + 7.90 + 1996 + + + The very best of + Cat Stevens + UK + Island + 8.90 + 1990 + + + Stop + Sam Brown + UK + A and M + 8.90 + 1988 + + + Bridge of Spies + T`Pau + UK + Siren + 7.90 + 1987 + + + Private Dancer + Tina Turner + UK + Capitol + 8.90 + 1983 + + + Midt om natten + Kim Larsen + EU + Medley + 7.80 + 1983 + + + Pavarotti Gala Concert + Luciano Pavarotti + UK + DECCA + 9.90 + 1991 + + + The dock of the bay + Otis Redding + USA + Stax Records + 7.90 + 1968 + + + Picture book + Simply Red + EU + Elektra + 7.20 + 1985 + + + Red + The Communards + UK + London + 7.80 + 1987 + + + Unchain my heart + Joe Cocker + USA + EMI + 8.20 + 1987 + + + diff --git a/testing/web-platform/tests/dom/xslt/resources/large_CDATA_ref.html b/testing/web-platform/tests/dom/xslt/resources/large_CDATA_ref.html new file mode 100644 index 0000000000..3c68a6fc53 --- /dev/null +++ b/testing/web-platform/tests/dom/xslt/resources/large_CDATA_ref.html @@ -0,0 +1,119 @@ + + +

My CD Collection

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
TitleArtist
Empire BurlesqueBob Dylan
Hide your heartBonnie Tyler
Greatest HitsDolly Parton
Still got the bluesGary Moore
ErosEros Ramazzotti
One night onlyBee Gees
Sylvias MotherDr.Hook
Maggie MayRod Stewart
RomanzaAndrea Bocelli
When a man loves a womanPercy Sledge
Black angelSavage Rose
1999 Grammy NomineesMany
For the good timesKenny Rogers
Big Willie styleWill Smith
Tupelo HoneyVan Morrison
SoulsvilleJorn Hoel
The very best ofCat Stevens
StopSam Brown
Bridge of SpiesT`Pau
Private DancerTina Turner
Midt om nattenKim Larsen
Pavarotti Gala ConcertLuciano Pavarotti
The dock of the bayOtis Redding
Picture bookSimply Red
RedThe Communards
Unchain my heartJoe Cocker
diff --git a/testing/web-platform/tests/dom/xslt/resources/xml2html.xsl b/testing/web-platform/tests/dom/xslt/resources/xml2html.xsl new file mode 100644 index 0000000000..07b967500f --- /dev/null +++ b/testing/web-platform/tests/dom/xslt/resources/xml2html.xsl @@ -0,0 +1,25 @@ + + + + + + +

My CD Collection

+ + + + + + + + + + + +
TitleArtist
+ + +
+ +
diff --git a/testing/web-platform/tests/dom/xslt/sort-ref.html b/testing/web-platform/tests/dom/xslt/sort-ref.html new file mode 100644 index 0000000000..163002d0d0 --- /dev/null +++ b/testing/web-platform/tests/dom/xslt/sort-ref.html @@ -0,0 +1,10 @@ + + + + +
+
1
+
2
+
3
+
7
+
diff --git a/testing/web-platform/tests/dom/xslt/sort.html b/testing/web-platform/tests/dom/xslt/sort.html new file mode 100644 index 0000000000..631c3edd6a --- /dev/null +++ b/testing/web-platform/tests/dom/xslt/sort.html @@ -0,0 +1,48 @@ + + + + +
+ + + + + + + diff --git a/testing/web-platform/tests/dom/xslt/strip-space-crash.xml b/testing/web-platform/tests/dom/xslt/strip-space-crash.xml new file mode 100644 index 0000000000..61a906a5e7 --- /dev/null +++ b/testing/web-platform/tests/dom/xslt/strip-space-crash.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/testing/web-platform/tests/dom/xslt/transformToFragment-on-node-from-inactive-document-crash.html b/testing/web-platform/tests/dom/xslt/transformToFragment-on-node-from-inactive-document-crash.html new file mode 100644 index 0000000000..38a62a0a9d --- /dev/null +++ b/testing/web-platform/tests/dom/xslt/transformToFragment-on-node-from-inactive-document-crash.html @@ -0,0 +1,11 @@ + + + + diff --git a/testing/web-platform/tests/dom/xslt/transformToFragment.tentative.window.js b/testing/web-platform/tests/dom/xslt/transformToFragment.tentative.window.js new file mode 100644 index 0000000000..7bb6a56855 --- /dev/null +++ b/testing/web-platform/tests/dom/xslt/transformToFragment.tentative.window.js @@ -0,0 +1,39 @@ +const cases = { + internal: '', + external: '', +}; + +const loaded = new Promise(resolve => { + window.addEventListener('load', resolve); +}); + +Object.entries(cases).forEach(([k, v]) => { + const xsltSrc = ` + + +
+ ${v} +
+
+
`; + + const processor = new XSLTProcessor(); + const parser = new DOMParser(); + processor.importStylesheet( + parser.parseFromString(xsltSrc, 'application/xml') + ); + document.body.appendChild( + processor.transformToFragment( + parser.parseFromString('', 'application/xml'), + document + ) + ); + + promise_test(async () => { + await loaded; + assert_true( + window[`${k}Script`], + 'script element from XSLTProcessor.transformToFragment() is evaluated' + ); + }, `${k} script`); +}) -- cgit v1.2.3