summaryrefslogtreecommitdiffstats
path: root/dom/xslt/tests/mochitest/test_bug1436040.html
diff options
context:
space:
mode:
Diffstat (limited to 'dom/xslt/tests/mochitest/test_bug1436040.html')
-rw-r--r--dom/xslt/tests/mochitest/test_bug1436040.html54
1 files changed, 54 insertions, 0 deletions
diff --git a/dom/xslt/tests/mochitest/test_bug1436040.html b/dom/xslt/tests/mochitest/test_bug1436040.html
new file mode 100644
index 0000000000..df17e75779
--- /dev/null
+++ b/dom/xslt/tests/mochitest/test_bug1436040.html
@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Test for xslt-param PIs</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+async_test(t => {
+ let iframe = document.createElement('iframe');
+ let src = `<?xml version="1.0"?>
+ <?xslt-param name="param" value="true"?>
+ <?xml-stylesheet type="text/xml" href="#bug"?>
+ <doc>
+ <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" id="bug">
+ <xsl:output method="html"/>
+ <xsl:param name="param">false</xsl:param>
+ <xsl:template match="/">
+ <xsl:element name="script">parent.postMessage({test: 1, result: <xsl:value-of select="$param"/>}, "*");</xsl:element>
+ </xsl:template>
+ </xsl:stylesheet>
+ </doc>`;
+ iframe.src = "data:text/xml," + encodeURIComponent(src);
+ self.addEventListener("message", t.step_func_done(({data: {test, result}}) => {
+ if (test == 1) {
+ assert_true(result, "The stylesheet param's value should be set by the xslt-param PI.");
+ }
+ }));
+ document.body.appendChild(iframe);
+}, "Test for xslt-param PIs");
+async_test(t => {
+ let iframe = document.createElement('iframe');
+ let src = `<?xml version="1.0"?>
+ <?xslt-param-namespace prefix="foo" namespace="foonamespace"?>
+ <?xslt-param name="param" select="//foo:default"?>
+ <?xml-stylesheet type="text/xml" href="#bug"?>
+ <doc>
+ <default xmlns="foonamespace">true</default>
+ <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" id="bug">
+ <xsl:output method="html"/>
+ <xsl:param name="param">false</xsl:param>
+ <xsl:template match="/">
+ <xsl:element name="script">parent.postMessage({test: 2, result: <xsl:value-of select="$param"/>}, "*");</xsl:element>
+ </xsl:template>
+ </xsl:stylesheet>
+ </doc>`;
+ iframe.src = "data:text/xml," + encodeURIComponent(src);
+ self.addEventListener("message", t.step_func_done(({data: {test, result}}) => {
+ if (test == 2) {
+ assert_true(result, "xslt-param-namespace should have set the right namespace");
+ }
+ }));
+ document.body.appendChild(iframe);
+}, "Test for xslt-param PIs");
+</script>