diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:14:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:14:29 +0000 |
commit | fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8 (patch) | |
tree | 4c1ccaf5486d4f2009f9a338a98a83e886e29c97 /dom/xslt/tests/mochitest | |
parent | Releasing progress-linux version 124.0.1-1~progress7.99u1. (diff) | |
download | firefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.tar.xz firefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.zip |
Merging upstream version 125.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/xslt/tests/mochitest')
-rw-r--r-- | dom/xslt/tests/mochitest/mochitest.toml | 2 | ||||
-rw-r--r-- | dom/xslt/tests/mochitest/test_parameter_conversion.html | 49 |
2 files changed, 51 insertions, 0 deletions
diff --git a/dom/xslt/tests/mochitest/mochitest.toml b/dom/xslt/tests/mochitest/mochitest.toml index 70d313758c..e22783231a 100644 --- a/dom/xslt/tests/mochitest/mochitest.toml +++ b/dom/xslt/tests/mochitest/mochitest.toml @@ -54,4 +54,6 @@ support-files = ["file_metaRefresh.xml"] ["test_parameter.html"] +["test_parameter_conversion.html"] + ["test_sorting_invalid_lang.html"] diff --git a/dom/xslt/tests/mochitest/test_parameter_conversion.html b/dom/xslt/tests/mochitest/test_parameter_conversion.html new file mode 100644 index 0000000000..a0ea6acce2 --- /dev/null +++ b/dom/xslt/tests/mochitest/test_parameter_conversion.html @@ -0,0 +1,49 @@ +<!DOCTYPE HTML> +<html> +<head> + <title>Test for setParameter conversion to XSLT type</title> + <script src="/tests/SimpleTest/SimpleTest.js"></script> + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> +</head> +<body> +<p id="display"></p> +<div id="content" style="display: none"></div> +<pre id="test"> +<script> + let parser = new DOMParser(); + let xml = parser.parseFromString('<?xml version="1.0" encoding="utf-8" ?><root/>', "text/xml"); + let xslt = parser.parseFromString(`<?xml version="1.0" encoding="utf-8"?> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> +<xsl:param name="test" /> +<xsl:template match="/"> + <xsl:value-of select="$test" /> +</xsl:template> +</xsl:stylesheet>`, "text/xml"); + + let processor = new XSLTProcessor(); + processor.importStylesheet(xslt); + + let callbackCalled = false; + let param = { + [Symbol.toPrimitive](hint) { + callbackCalled = true; + processor.removeParameter(null, 'test'); + if (hint == 'string') { + return "Value"; + } + throw new Error("Not converting to string?"); + } + }; + + processor.setParameter(null, 'test', param); + ok(callbackCalled, "Parameter was converted during call to setParameter."); + is(processor.getParameter(null, 'test'), "Value", "processor.removeParameter during string conversion should have no effect."); + + callbackCalled = false; + processor.transformToDocument(xml); + ok(!callbackCalled, "Parameter was not converted during call to transformToDocument."); + is(processor.getParameter(null, 'test'), "Value", "processor.removeParameter during string conversion should have no effect."); +</script> +</pre> +</body> +</html> |