diff options
Diffstat (limited to 'dom/xslt')
-rw-r--r-- | dom/xslt/tests/mochitest/mochitest.toml | 2 | ||||
-rw-r--r-- | dom/xslt/tests/mochitest/test_parameter_conversion.html | 49 | ||||
-rw-r--r-- | dom/xslt/xpath/XPathEvaluator.cpp | 1 | ||||
-rw-r--r-- | dom/xslt/xslt/txEXSLTFunctions.cpp | 5 | ||||
-rw-r--r-- | dom/xslt/xslt/txMozillaTextOutput.cpp | 1 | ||||
-rw-r--r-- | dom/xslt/xslt/txMozillaXMLOutput.cpp | 1 | ||||
-rw-r--r-- | dom/xslt/xslt/txMozillaXSLTProcessor.cpp | 1 |
7 files changed, 53 insertions, 7 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> diff --git a/dom/xslt/xpath/XPathEvaluator.cpp b/dom/xslt/xpath/XPathEvaluator.cpp index 269ea98ff6..14889462fb 100644 --- a/dom/xslt/xpath/XPathEvaluator.cpp +++ b/dom/xslt/xpath/XPathEvaluator.cpp @@ -16,7 +16,6 @@ #include "mozilla/dom/XPathNSResolverBinding.h" #include "nsAtom.h" #include "nsCOMPtr.h" -#include "nsContentCID.h" #include "nsContentUtils.h" #include "nsDOMString.h" #include "nsError.h" diff --git a/dom/xslt/xslt/txEXSLTFunctions.cpp b/dom/xslt/xslt/txEXSLTFunctions.cpp index d4882d0b13..cb4f204019 100644 --- a/dom/xslt/xslt/txEXSLTFunctions.cpp +++ b/dom/xslt/xslt/txEXSLTFunctions.cpp @@ -23,7 +23,6 @@ #include "nsImportModule.h" #include "nsPrintfCString.h" #include "nsComponentManagerUtils.h" -#include "nsContentCID.h" #include "nsContentCreatorFunctions.h" #include "nsIContent.h" #include "txMozillaXMLOutput.h" @@ -189,8 +188,8 @@ struct txEXSLTFunctionDescriptor { int32_t mNamespaceID; }; -static EnumeratedArray<txEXSLTType, txEXSLTType::_LIMIT, - txEXSLTFunctionDescriptor> +static EnumeratedArray<txEXSLTType, txEXSLTFunctionDescriptor, + size_t(txEXSLTType::_LIMIT)> descriptTable; class txEXSLTFunctionCall : public FunctionCall { diff --git a/dom/xslt/xslt/txMozillaTextOutput.cpp b/dom/xslt/xslt/txMozillaTextOutput.cpp index 2104a0fd6b..01974bb17e 100644 --- a/dom/xslt/xslt/txMozillaTextOutput.cpp +++ b/dom/xslt/xslt/txMozillaTextOutput.cpp @@ -4,7 +4,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "txMozillaTextOutput.h" -#include "nsContentCID.h" #include "nsIContent.h" #include "mozilla/dom/Document.h" #include "nsIDocumentTransformer.h" diff --git a/dom/xslt/xslt/txMozillaXMLOutput.cpp b/dom/xslt/xslt/txMozillaXMLOutput.cpp index 4aa51d9928..3ef89d31a4 100644 --- a/dom/xslt/xslt/txMozillaXMLOutput.cpp +++ b/dom/xslt/xslt/txMozillaXMLOutput.cpp @@ -12,7 +12,6 @@ #include "nsIRefreshURI.h" #include "nsPIDOMWindow.h" #include "nsIContent.h" -#include "nsContentCID.h" #include "nsUnicharUtils.h" #include "nsGkAtoms.h" #include "txLog.h" diff --git a/dom/xslt/xslt/txMozillaXSLTProcessor.cpp b/dom/xslt/xslt/txMozillaXSLTProcessor.cpp index db4de439ef..c26aea1bb9 100644 --- a/dom/xslt/xslt/txMozillaXSLTProcessor.cpp +++ b/dom/xslt/xslt/txMozillaXSLTProcessor.cpp @@ -4,7 +4,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "txMozillaXSLTProcessor.h" -#include "nsContentCID.h" #include "nsError.h" #include "mozilla/dom/Element.h" #include "mozilla/dom/Document.h" |