Bug 1942639 - Propagate --filter argument from desktop_unittest.py to runreftest...
[gecko.git] / dom / xslt / tests / mochitest / test_bug1436040.html
blobdf17e75779cc7efdaf8b51970f08a889cb508a44
1 <!DOCTYPE html>
2 <meta charset="utf-8">
3 <title>Test for xslt-param PIs</title>
4 <script src="/resources/testharness.js"></script>
5 <script src="/resources/testharnessreport.js"></script>
6 <div id="log"></div>
7 <script>
8 async_test(t => {
9 let iframe = document.createElement('iframe');
10 let src = `<?xml version="1.0"?>
11 <?xslt-param name="param" value="true"?>
12 <?xml-stylesheet type="text/xml" href="#bug"?>
13 <doc>
14 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" id="bug">
15 <xsl:output method="html"/>
16 <xsl:param name="param">false</xsl:param>
17 <xsl:template match="/">
18 <xsl:element name="script">parent.postMessage({test: 1, result: <xsl:value-of select="$param"/>}, "*");</xsl:element>
19 </xsl:template>
20 </xsl:stylesheet>
21 </doc>`;
22 iframe.src = "data:text/xml," + encodeURIComponent(src);
23 self.addEventListener("message", t.step_func_done(({data: {test, result}}) => {
24 if (test == 1) {
25 assert_true(result, "The stylesheet param's value should be set by the xslt-param PI.");
27 }));
28 document.body.appendChild(iframe);
29 }, "Test for xslt-param PIs");
30 async_test(t => {
31 let iframe = document.createElement('iframe');
32 let src = `<?xml version="1.0"?>
33 <?xslt-param-namespace prefix="foo" namespace="foonamespace"?>
34 <?xslt-param name="param" select="//foo:default"?>
35 <?xml-stylesheet type="text/xml" href="#bug"?>
36 <doc>
37 <default xmlns="foonamespace">true</default>
38 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" id="bug">
39 <xsl:output method="html"/>
40 <xsl:param name="param">false</xsl:param>
41 <xsl:template match="/">
42 <xsl:element name="script">parent.postMessage({test: 2, result: <xsl:value-of select="$param"/>}, "*");</xsl:element>
43 </xsl:template>
44 </xsl:stylesheet>
45 </doc>`;
46 iframe.src = "data:text/xml," + encodeURIComponent(src);
47 self.addEventListener("message", t.step_func_done(({data: {test, result}}) => {
48 if (test == 2) {
49 assert_true(result, "xslt-param-namespace should have set the right namespace");
51 }));
52 document.body.appendChild(iframe);
53 }, "Test for xslt-param PIs");
54 </script>