summaryrefslogtreecommitdiffstats
path: root/dom/xslt/tests/mochitest
diff options
context:
space:
mode:
Diffstat (limited to 'dom/xslt/tests/mochitest')
-rw-r--r--dom/xslt/tests/mochitest/file_bug1135764.xml3
-rw-r--r--dom/xslt/tests/mochitest/file_bug1135764.xsl19
-rw-r--r--dom/xslt/tests/mochitest/mochitest.ini20
-rw-r--r--dom/xslt/tests/mochitest/test_bug1072116.html37
-rw-r--r--dom/xslt/tests/mochitest/test_bug1135764.html53
-rw-r--r--dom/xslt/tests/mochitest/test_bug319374.xhtml109
-rw-r--r--dom/xslt/tests/mochitest/test_bug427060.html49
-rw-r--r--dom/xslt/tests/mochitest/test_bug440974.html46
-rw-r--r--dom/xslt/tests/mochitest/test_bug453441.html57
-rw-r--r--dom/xslt/tests/mochitest/test_bug468208.html35
-rw-r--r--dom/xslt/tests/mochitest/test_bug511487.html59
-rw-r--r--dom/xslt/tests/mochitest/test_bug551412.html48
-rw-r--r--dom/xslt/tests/mochitest/test_bug551654.html49
-rw-r--r--dom/xslt/tests/mochitest/test_bug566629.html70
-rw-r--r--dom/xslt/tests/mochitest/test_bug566629.xhtml73
-rw-r--r--dom/xslt/tests/mochitest/test_bug603159.html54
-rw-r--r--dom/xslt/tests/mochitest/test_bug616774.html28
-rw-r--r--dom/xslt/tests/mochitest/test_bug667315.html46
-rw-r--r--dom/xslt/tests/mochitest/test_exslt_regex.html60
-rw-r--r--dom/xslt/tests/mochitest/test_parameter.html31
20 files changed, 946 insertions, 0 deletions
diff --git a/dom/xslt/tests/mochitest/file_bug1135764.xml b/dom/xslt/tests/mochitest/file_bug1135764.xml
new file mode 100644
index 000000000..b9da87e5e
--- /dev/null
+++ b/dom/xslt/tests/mochitest/file_bug1135764.xml
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?xml-stylesheet type="text/xsl" href="file_bug1135764.xsl"?>
+<root/>
diff --git a/dom/xslt/tests/mochitest/file_bug1135764.xsl b/dom/xslt/tests/mochitest/file_bug1135764.xsl
new file mode 100644
index 000000000..e739086cb
--- /dev/null
+++ b/dom/xslt/tests/mochitest/file_bug1135764.xsl
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+<xsl:output method="html"
+ indent="yes"
+ version="5.0"
+ doctype-system="about:legacy-compat"/>
+
+<xsl:template match="/">
+<html>
+<head>
+</head>
+ <body>
+ Some text
+ </body>
+</html>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/dom/xslt/tests/mochitest/mochitest.ini b/dom/xslt/tests/mochitest/mochitest.ini
new file mode 100644
index 000000000..53a6d001c
--- /dev/null
+++ b/dom/xslt/tests/mochitest/mochitest.ini
@@ -0,0 +1,20 @@
+[DEFAULT]
+
+[test_bug1072116.html]
+[test_bug319374.xhtml]
+[test_bug427060.html]
+[test_bug440974.html]
+[test_bug453441.html]
+[test_bug468208.html]
+[test_bug511487.html]
+[test_bug551412.html]
+[test_bug551654.html]
+[test_bug566629.html]
+[test_bug566629.xhtml]
+[test_bug603159.html]
+[test_bug616774.html]
+[test_bug667315.html]
+[test_bug1135764.html]
+support-files = file_bug1135764.xml file_bug1135764.xsl
+[test_exslt_regex.html]
+[test_parameter.html]
diff --git a/dom/xslt/tests/mochitest/test_bug1072116.html b/dom/xslt/tests/mochitest/test_bug1072116.html
new file mode 100644
index 000000000..2d0624725
--- /dev/null
+++ b/dom/xslt/tests/mochitest/test_bug1072116.html
@@ -0,0 +1,37 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1072116
+-->
+<head>
+ <title>Test for Bug 1072116</title>
+ <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1072116">Mozilla Bug 1072116</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 1072116 **/
+var attr = document.createAttribute("c");
+
+var xpathExpr = document.createExpression('a', null);
+
+var status = false;
+try {
+ xpathExpr.evaluate(attr, null, null, null, null);
+} catch(e) {
+ status = true;
+}
+
+ok(status, "Still alive \\o/");
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/xslt/tests/mochitest/test_bug1135764.html b/dom/xslt/tests/mochitest/test_bug1135764.html
new file mode 100644
index 000000000..5a7410e37
--- /dev/null
+++ b/dom/xslt/tests/mochitest/test_bug1135764.html
@@ -0,0 +1,53 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1135764
+-->
+<head>
+ <meta charset="utf-8">
+ <title>Test for Bug 1135764</title>
+ <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+ <script type="application/javascript">
+
+ /** Test for Bug 1135764 **/
+ SimpleTest.waitForExplicitFinish();
+ var counter = 0;
+ var startTimelineValue;
+
+ function waitATick() {
+ ++counter;
+ if (counter == 1) {
+ frames[0].requestAnimationFrame(waitATick);
+ return;
+ }
+ ok(frames[0].document.timeline.currentTime !== startTimelineValue,
+ "The timeline in an XSLT-transformed document should still advance");
+ SimpleTest.finish();
+ }
+ addLoadEvent(function() {
+ SpecialPowers.pushPrefEnv(
+ { "set": [[ "dom.animations-api.core.enabled", true]] },
+ function() {
+ var ifr = document.querySelector("iframe");
+ ifr.onload = function() {
+ startTimelineValue = frames[0].document.timeline.currentTime;
+ frames[0].requestAnimationFrame(waitATick);
+ }
+ ifr.src = "file_bug1135764.xml";
+ })
+ })
+ </script>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1135764">Mozilla Bug 1135764</a>
+<p id="display">
+ <iframe></iframe>
+</p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+</pre>
+</body>
+</html>
diff --git a/dom/xslt/tests/mochitest/test_bug319374.xhtml b/dom/xslt/tests/mochitest/test_bug319374.xhtml
new file mode 100644
index 000000000..2342b3447
--- /dev/null
+++ b/dom/xslt/tests/mochitest/test_bug319374.xhtml
@@ -0,0 +1,109 @@
+<?xml version="1.0"?>
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:xbl="http://www.mozilla.org/xbl">
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=319374
+-->
+<head>
+ <title>Test for Bug 319374</title>
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+ <xbl:bindings>
+ <xbl:binding id="test">
+ <xbl:content>
+ <span attr="attribute"><span></span></span><span> anon text </span><br/>
+ </xbl:content>
+ </xbl:binding>
+ </xbl:bindings>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=319374">Mozilla Bug 319374</a>
+<p id="display"></p>
+<div id="content"><span style="-moz-binding: url(#test)"/><span style="-moz-binding: url(#test)"/><span style="-moz-binding: url(#test)"/></div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+<![CDATA[
+
+/** Test for Bug 319374 **/
+
+ function testChangesInAnonymousTree() {
+ // Test 1: Make sure that modifying anonymous content doesn't
+ // cause non-anonymous XPath result to throw exceptions..
+ var counter = 0;
+ var error = null;
+ function getAnonymousNodes(e) {
+ return SpecialPowers.wrap(document).getAnonymousNodes(e);
+ }
+ try {
+ var xp = new XPathEvaluator();
+ var result = xp.evaluate("*",
+ document.getElementById('content'),
+ null,
+ XPathResult.UNORDERED_NODE_ITERATOR_TYPE,
+ null);
+ var res = null;
+ while (res = result.iterateNext()) {
+ ++counter;
+ var anon = getAnonymousNodes(res);
+ anon[0].removeChild(anon[0].firstChild); // Removing a child node
+ anon[0].removeAttribute("attr1"); // Removing an attribute
+ anon[1].firstChild.data = "anon text changed" // Modifying text data
+ }
+ } catch (e) {
+ error = e;
+ }
+ ok(!error, error);
+ ok(counter == 3, "XPathEvaluator should have found 3 elements.")
+
+ // Test 2: If the context node is in anonymous content, changing some
+ // other anonymous tree shouldn't cause XPath result to throw.
+ var anonAttr1 =
+ getAnonymousNodes(document.getElementById('content').
+ firstChild)[0].getAttributeNode('attr');
+ var anonAttr2 =
+ getAnonymousNodes(document.getElementById('content').
+ lastChild)[0].getAttributeNode('attr');
+ var resultAttr = null;
+ try {
+ var xp2 = SpecialPowers.wrap(xp).evaluate(".",
+ anonAttr1,
+ null,
+ XPathResult.UNORDERED_NODE_ITERATOR_TYPE,
+ null);
+ // Attribute changing in a different anonymous tree.
+ anonAttr2.value = "foo";
+ resultAttr = xp2.iterateNext();
+ ok(SpecialPowers.compare(resultAttr, anonAttr1), "XPathEvaluator returned wrong attribute!")
+ } catch (e) {
+ ok(false, e);
+ }
+
+ // Test 3: If the anonymous tree in which context node is in is modified,
+ // XPath result should throw when iterateNext() is called.
+ resultAttr = null;
+ try {
+ var xp3 = xp.evaluate(".",
+ anonAttr1,
+ null,
+ XPathResult.UNORDERED_NODE_ITERATOR_TYPE,
+ null);
+ // Attribute changing in the same anonymous tree.
+ anonAttr1.ownerElement.setAttribute("foo", "bar");
+ resultAttr = xp3.iterateNext();
+ ok(resultAttr == anonAttr1,
+ "XPathEvaluator should have thrown an exception!")
+ } catch (e) {
+ ok(true, e);
+ }
+
+ SimpleTest.finish();
+ }
+
+ SimpleTest.waitForExplicitFinish();
+ addLoadEvent(testChangesInAnonymousTree);
+]]>
+</script>
+</pre>
+</body>
+</html>
+
diff --git a/dom/xslt/tests/mochitest/test_bug427060.html b/dom/xslt/tests/mochitest/test_bug427060.html
new file mode 100644
index 000000000..89bcb5255
--- /dev/null
+++ b/dom/xslt/tests/mochitest/test_bug427060.html
@@ -0,0 +1,49 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=427060
+-->
+<head>
+ <title>Test for Bug 427060</title>
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=427060">Mozilla Bug 427060</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+/** Test for Bug 427060 **/
+
+var xmldoc, xsltdoc;
+
+xmldoc = new DOMParser().parseFromString('<opml version="1.0"><body></body></opml>', "text/xml");
+xsltdoc = new DOMParser().parseFromString('<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">\n\
+ <xsl:template match="/opml">\n\
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">\n\
+ <head>\n\
+ <base target="_blank"></base>\n\
+ </head>\n\
+ <body></body>\n\
+ </html>\n\
+ </xsl:template>\n\
+ </xsl:stylesheet>', "text/xml");
+
+var processor = new XSLTProcessor;
+processor.importStylesheet(xsltdoc);
+try
+{
+ var result = processor.transformToDocument(xmldoc);
+}
+catch (e)
+{
+}
+ok(result && result instanceof Document, "XSLT transform should have created a document");
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/xslt/tests/mochitest/test_bug440974.html b/dom/xslt/tests/mochitest/test_bug440974.html
new file mode 100644
index 000000000..33b73e6de
--- /dev/null
+++ b/dom/xslt/tests/mochitest/test_bug440974.html
@@ -0,0 +1,46 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=440974
+-->
+<head>
+ <title>Test for Bug 440974</title>
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=440974">Mozilla Bug 440974</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+/** Test for Bug 440974 **/
+
+function isTxResult(node)
+{
+ return node.namespaceURI == "http://www.mozilla.org/TransforMiix" &&
+ node.localName == "result";
+}
+
+var xmldoc, xsltdoc;
+
+xmldoc = new DOMParser().parseFromString('<items><item><id>1</id></item><item><id>2</id></item><item><id>3</id></item></items>', "text/xml");
+xsltdoc = new DOMParser().parseFromString('<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">\n\
+ <xsl:output method="xml" />\n\
+ <xsl:template match="item"><foo id="{id}"/></xsl:template>\n\
+ </xsl:stylesheet>', "text/xml");
+
+var processor = new XSLTProcessor;
+processor.importStylesheet(xsltdoc);
+var result = processor.transformToDocument(xmldoc);
+var resultElements = Array.prototype.filter.call(result.getElementsByTagName('*'), isTxResult);
+is(resultElements.length, 1, "there should be only one 'transformiix:result' element");
+is(resultElements[0], result.documentElement, "the 'transformiix:result' element should be the document element");
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/xslt/tests/mochitest/test_bug453441.html b/dom/xslt/tests/mochitest/test_bug453441.html
new file mode 100644
index 000000000..4decae56c
--- /dev/null
+++ b/dom/xslt/tests/mochitest/test_bug453441.html
@@ -0,0 +1,57 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=453441
+-->
+<head>
+ <title>Test for Bug 453441</title>
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=453441">Mozilla Bug 453441</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+/** Test for Bug 453441 **/
+
+function tryImportStylesheet(xml, valid)
+{
+ var processor = new XSLTProcessor;
+
+ var xsltdoc = new DOMParser().parseFromString(xml, "text/xml");
+ try
+ {
+ processor.importStylesheet(xsltdoc);
+ ok(valid, "should be able to parse this XSLT stylesheet");
+ }
+ catch (e)
+ {
+ ok(!valid, "should not be able to parse this XSLT stylesheet");
+ }
+}
+
+tryImportStylesheet(
+ '<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">\n\
+ <xsl:template match="/">\n\
+ <html xmlns="http://www.w3.org/1999/xhtml" xsl:version="1.0" />\n\
+ </xsl:template>\n\
+ </xsl:stylesheet>'
+, true);
+
+tryImportStylesheet(
+ '<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" />'
+, false);
+
+tryImportStylesheet(
+ '<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" />'
+, false);
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/xslt/tests/mochitest/test_bug468208.html b/dom/xslt/tests/mochitest/test_bug468208.html
new file mode 100644
index 000000000..3da0349be
--- /dev/null
+++ b/dom/xslt/tests/mochitest/test_bug468208.html
@@ -0,0 +1,35 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=468208
+-->
+<head>
+ <title>Test for Bug 468208</title>
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=468208">Mozilla Bug 468208</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+/** Test for Bug 468208 **/
+var xslt =
+ '<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">\n\
+ <xsl:strip-space elements="color"/>\n\
+ </xsl:stylesheet>'
+;
+var xsltdoc = new DOMParser().parseFromString(xslt, "text/xml");
+
+var processor = new XSLTProcessor;
+processor.importStylesheet(xsltdoc);
+ok(true, "XSLT shouldn't leak");
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/xslt/tests/mochitest/test_bug511487.html b/dom/xslt/tests/mochitest/test_bug511487.html
new file mode 100644
index 000000000..b5cd21cf6
--- /dev/null
+++ b/dom/xslt/tests/mochitest/test_bug511487.html
@@ -0,0 +1,59 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=511487
+-->
+<head>
+ <title>Test for Bug 511487</title>
+ <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=511487">Mozilla Bug 511487</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 511487 **/
+
+ var didTransform = false;
+ var processor = new XSLTProcessor();
+ var style =
+ '<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns="http://www.w3.org/1999/xhtml">' +
+ '<xsl:output method="xml" version="1.0" encoding="UTF-8" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" />' +
+ '<xsl:template match="wml">' +
+ '<html xmlns="http://www.w3.org/1999/xhtml">' +
+ '<head>' +
+ '<title>XSLT test</title>' +
+ '</head>' +
+ '<body onload="window.alert(this)">' +
+ '</body>' +
+ '</html>' +
+ '</xsl:template>' +
+ '</xsl:stylesheet>';
+ var styleDoc = new DOMParser().parseFromString (style, "text/xml");
+
+ var data =
+ '<?xml version="1.0"?>' +
+ '<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">' +
+ '<wml><card><p>paragraph</p></card></wml>';
+ var originalDoc = new DOMParser().parseFromString(data, "text/xml");
+
+ processor.importStylesheet(styleDoc);
+ try {
+ var transformedDocument = processor.transformToDocument(originalDoc);
+ didTransform = true;
+ } catch (e) {
+ ok(false, e);
+ }
+
+ ok(didTransform, "transformToDocument didn't succeed!");
+
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/xslt/tests/mochitest/test_bug551412.html b/dom/xslt/tests/mochitest/test_bug551412.html
new file mode 100644
index 000000000..c6f5e13e8
--- /dev/null
+++ b/dom/xslt/tests/mochitest/test_bug551412.html
@@ -0,0 +1,48 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=551412
+-->
+<head>
+ <title>Test for Bug 551412</title>
+ <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=551412">Mozilla Bug 551412</a>
+<p id="display"></p>
+<div id="content" style="display: none"></div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 551412 **/
+
+ var processor = new XSLTProcessor();
+ var style =
+ '<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" ' +
+ 'xmlns:exsl="http://exslt.org/common" ' +
+ 'version="1.0">' +
+ '<xsl:output method="html"/>' +
+ '<xsl:variable name="rtf">1 <b>2</b> 3</xsl:variable>' +
+ '<xsl:template match="/">' +
+ '<xsl:copy-of select="exsl:node-set($rtf)"/>' +
+ '</xsl:template>' +
+ '</xsl:stylesheet>';
+ var styleDoc = new DOMParser().parseFromString (style, "text/xml");
+
+ var data =
+ '<root/>';
+ var originalDoc = new DOMParser().parseFromString(data, "text/xml");
+
+ processor.importStylesheet(styleDoc);
+
+ var fragment = processor.transformToFragment(originalDoc, document);
+ var content = document.getElementById("content");
+ content.appendChild(fragment);
+ is(content.innerHTML, "1 <b>2</b> 3",
+ "Result of transform should be '1 <b>2</b> 3'");
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/xslt/tests/mochitest/test_bug551654.html b/dom/xslt/tests/mochitest/test_bug551654.html
new file mode 100644
index 000000000..a72fa41fa
--- /dev/null
+++ b/dom/xslt/tests/mochitest/test_bug551654.html
@@ -0,0 +1,49 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=551654
+-->
+<head>
+ <title>Test for Bug 551654</title>
+ <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=551654">Mozilla Bug 551654</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 551654 **/
+
+ var didTransform = false;
+ var processor = new XSLTProcessor();
+ var style =
+ '<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" ' +
+ 'xmlns:exsl="http://exslt.org/common" ' +
+ 'version="1.0">' +
+ '<xsl:output method="html"/>' +
+ '<xsl:template match="/">' +
+ '<xsl:copy-of select="exsl:node-set(42)"/>' +
+ '</xsl:template>' +
+ '</xsl:stylesheet>';
+ var styleDoc = new DOMParser().parseFromString (style, "text/xml");
+
+ var data =
+ '<root/>';
+ var originalDoc = new DOMParser().parseFromString(data, "text/xml");
+
+ processor.importStylesheet(styleDoc);
+ var fragment = processor.transformToFragment(originalDoc, document);
+ is(fragment.firstChild.nodeType, Node.TEXT_NODE,
+ "Result of transform should be a textnode");
+ is(fragment.firstChild.nodeValue, "42",
+ "Result of transform should be a textnode with value '42'");
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/xslt/tests/mochitest/test_bug566629.html b/dom/xslt/tests/mochitest/test_bug566629.html
new file mode 100644
index 000000000..7d66d212b
--- /dev/null
+++ b/dom/xslt/tests/mochitest/test_bug566629.html
@@ -0,0 +1,70 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=566629
+-->
+<head>
+ <title>Test for Bug 566629</title>
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=566629">Mozilla Bug 566629</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+/** Test for Bug 566629 **/
+
+var xsltdoc = new DOMParser().parseFromString(
+ '<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"\
+ xmlns:xhtml="http://www.w3.org/1999/xhtml">\
+ <xsl:template match="/">\
+ <xsl:value-of select="count(//body)"/>\
+ <xsl:text>,</xsl:text>\
+ <xsl:value-of select="count(//xhtml:body)"/>\
+ <xsl:text>,</xsl:text>\
+ <xsl:value-of select="count(//xsl:body)"/>\
+ <xsl:text>,</xsl:text>\
+ <xsl:value-of select="name(//body)"/>\
+ <xsl:text>,</xsl:text>\
+ <xsl:value-of select="local-name(//body)"/>\
+ </xsl:template>\
+ </xsl:stylesheet>',
+ "text/xml");
+
+var processor = new XSLTProcessor;
+processor.importStylesheet(xsltdoc);
+var result = processor.transformToFragment(document, document);
+ok(result instanceof DocumentFragment, "returned a docfragment");
+is(result.firstChild.nodeValue, "1,1,0,BODY,body",
+ "correct treatment of HTML elements in XSLT");
+
+is(document.evaluate("count(//body)", document, null, XPathResult.ANY_TYPE, null).numberValue,
+ 1, "namespace-less node-test");
+is(document.evaluate("count(//a:body)", document,
+ function() { return "http://www.w3.org/1999/xhtml" },
+ XPathResult.ANY_TYPE, null).numberValue,
+ 1, "with-namespace node-test");
+is(document.evaluate("count(//a:body)", document,
+ function() { return "foo" },
+ XPathResult.ANY_TYPE, null).numberValue,
+ 0, "wrong-namespace node-test");
+is(document.evaluate("//bODy", document, null, XPathResult.ANY_TYPE, null).iterateNext(),
+ document.body, "case insensitive matching");
+is(document.evaluate("count(//a:bODy)", document,
+ function() { return "http://www.w3.org/1999/xhtml" },
+ XPathResult.ANY_TYPE, null).numberValue,
+ 0, "with-namespace but wrong casing node-test");
+is(document.evaluate("name(//body)", document, null, XPathResult.ANY_TYPE, null).stringValue,
+ "BODY", "uppercase name() function");
+is(document.evaluate("local-name(//body)", document, null, XPathResult.ANY_TYPE, null).stringValue,
+ "body", "lowercase local-name() function");
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/xslt/tests/mochitest/test_bug566629.xhtml b/dom/xslt/tests/mochitest/test_bug566629.xhtml
new file mode 100644
index 000000000..e5fca2b58
--- /dev/null
+++ b/dom/xslt/tests/mochitest/test_bug566629.xhtml
@@ -0,0 +1,73 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=566629
+-->
+<head>
+ <title>Test for Bug 566629</title>
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=566629">Mozilla Bug 566629</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+<![CDATA[
+/** Test for Bug 566629 **/
+
+var xsltdoc = new DOMParser().parseFromString(
+ '<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"\
+ xmlns:xhtml="http://www.w3.org/1999/xhtml">\
+ <xsl:template match="/">\
+ <xsl:value-of select="count(//body)"/>\
+ <xsl:text>,</xsl:text>\
+ <xsl:value-of select="count(//xhtml:body)"/>\
+ <xsl:text>,</xsl:text>\
+ <xsl:value-of select="count(//xsl:body)"/>\
+ <xsl:text>,</xsl:text>\
+ <xsl:value-of select="name(//xhtml:body)"/>\
+ <xsl:text>,</xsl:text>\
+ <xsl:value-of select="local-name(//xhtml:body)"/>\
+ </xsl:template>\
+ </xsl:stylesheet>',
+ "text/xml");
+
+var processor = new XSLTProcessor;
+processor.importStylesheet(xsltdoc);
+var result = processor.transformToFragment(document, document);
+ok(result instanceof DocumentFragment, "returned a docfragment");
+is(result.firstChild.nodeValue, "0,1,0,body,body",
+ "correct treatment of HTML elements in XSLT");
+
+is(document.evaluate("count(//body)", document, null, XPathResult.ANY_TYPE, null).numberValue,
+ 0, "namespace-less node-test");
+is(document.evaluate("count(//a:body)", document,
+ function() { return "http://www.w3.org/1999/xhtml" },
+ XPathResult.ANY_TYPE, null).numberValue,
+ 1, "with-namespace node-test");
+is(document.evaluate("count(//a:body)", document,
+ function() { return "foo" },
+ XPathResult.ANY_TYPE, null).numberValue,
+ 0, "wrong-namespace node-test");
+is(document.evaluate("count(//a:bODy)", document,
+ function() { return "http://www.w3.org/1999/xhtml" },
+ XPathResult.ANY_TYPE, null).numberValue,
+ 0, "with-namespace wrong-casing node-test");
+is(document.evaluate("count(//bODy)", document, null, XPathResult.ANY_TYPE, null).numberValue,
+ 0, "without-namespace wrong-casing node-test");
+is(document.evaluate("name(//a:body)", document,
+ function() { return "http://www.w3.org/1999/xhtml" },
+ XPathResult.ANY_TYPE, null).stringValue,
+ "body", "name()");
+is(document.evaluate("local-name(//a:body)", document,
+ function() { return "http://www.w3.org/1999/xhtml" },
+ XPathResult.ANY_TYPE, null).stringValue,
+ "body", "local-name()");
+]]>
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/xslt/tests/mochitest/test_bug603159.html b/dom/xslt/tests/mochitest/test_bug603159.html
new file mode 100644
index 000000000..ac0191bd3
--- /dev/null
+++ b/dom/xslt/tests/mochitest/test_bug603159.html
@@ -0,0 +1,54 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=603159
+-->
+<head>
+ <title>Test for Bug 603159</title>
+ <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=603159">Mozilla Bug 603159</a>
+<p id="display"></p>
+<div id="content" style="display: none"></div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 603159 **/
+
+ var style =
+ '<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" ' +
+ 'xmlns:date="http://exslt.org/dates-and-times" '+
+ 'version="1.0">' +
+ '<xsl:output method="html"/>' +
+ '<xsl:template match="/">' +
+ '<xsl:value-of select="date:date-time()" /> ' +
+ '</xsl:template>' +
+ '</xsl:stylesheet>';
+ var styleDoc = new DOMParser().parseFromString (style, "text/xml");
+
+ var data = '<root/>';
+ var originalDoc = new DOMParser().parseFromString(data, "text/xml");
+
+ var processor = new XSLTProcessor();
+ processor.importStylesheet(styleDoc);
+
+ var fragment = processor.transformToFragment(originalDoc, document);
+ var content = document.getElementById("content");
+ content.appendChild(fragment);
+
+ // use Gecko's Date.parse to parse, then compare the milliseconds since epoch
+ var xslt_ms = Date.parse(content.innerHTML);
+ var now_ms = new Date().getTime();
+ var accepted_diff = 30 * 60 * 1000; // 30 minutes
+ var diff = Math.abs(now_ms - xslt_ms);
+
+ ok(diff < accepted_diff, "generated timestamp should be not more than "
+ + accepted_diff + " ms before 'now', but the difference was: " + diff);
+
+ content.innerHTML = '';
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/xslt/tests/mochitest/test_bug616774.html b/dom/xslt/tests/mochitest/test_bug616774.html
new file mode 100644
index 000000000..3578d1704
--- /dev/null
+++ b/dom/xslt/tests/mochitest/test_bug616774.html
@@ -0,0 +1,28 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=616774-->
+<head>
+ <title>Test for Bug 616774</title>
+ <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=616774">Mozilla Bug 616774</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+ 42
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+/** Test for Bug 616774 **/
+is(document.evaluate('- "8"', document, null, XPathResult.ANY_TYPE, null).numberValue, -8, "Negated string literal should evaluate to itself negated");
+is(document.evaluate('- - "999"', document, null, XPathResult.ANY_TYPE, null).numberValue, 999, "String literal should evaluate to itself");
+is(document.evaluate('- - id("content")', document, null, XPathResult.ANY_TYPE, null).numberValue, 42, "DOM element should evaluate to itself coerced to a number");
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/xslt/tests/mochitest/test_bug667315.html b/dom/xslt/tests/mochitest/test_bug667315.html
new file mode 100644
index 000000000..fc5baff77
--- /dev/null
+++ b/dom/xslt/tests/mochitest/test_bug667315.html
@@ -0,0 +1,46 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=667315
+-->
+<head>
+ <title>Test for Bug 667315</title>
+ <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=667315">Mozilla Bug 667315</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 667315 **/
+
+var style =
+ '<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" ' +
+ 'version="1.0">' +
+ '<xsl:variable name="var">' +
+ '<html><p>a</p></html>' +
+ '</xsl:variable>' +
+ '<xsl:template match="/">' +
+ '<xsl:copy-of select="$var" />' +
+ '</xsl:template>' +
+ '</xsl:stylesheet>';
+var styleDoc = new DOMParser().parseFromString (style, "text/xml");
+
+var data = '<root/>';
+var originalDoc = new DOMParser().parseFromString(data, "text/xml");
+
+var processor = new XSLTProcessor();
+processor.importStylesheet(styleDoc);
+
+var doc = processor.transformToDocument(originalDoc);
+ok(doc instanceof HTMLDocument, "should have switched to html output method");
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/xslt/tests/mochitest/test_exslt_regex.html b/dom/xslt/tests/mochitest/test_exslt_regex.html
new file mode 100644
index 000000000..f4e00f9d3
--- /dev/null
+++ b/dom/xslt/tests/mochitest/test_exslt_regex.html
@@ -0,0 +1,60 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+Test EXSLT Regular Expression Extension
+http://www.exslt.org/regexp/index.html
+-->
+<head>
+ <title>Test for EXSLT Regular Expression Extensions</title>
+ <script type="application/javascript" 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 type="application/javascript">
+ var tests = [
+ { descr: "Testing regexp:test",
+ expr: "regexp:test('XSLT is great', 'XSLT', '')",
+ expResult: "true" },
+
+ { descr: "Testing regexp:match",
+ expr: "regexp:match('XSLT is great', 'XSL.', '')[1]",
+ expResult: "XSLT" },
+
+ { descr: "Testing regexp:replace",
+ expr: "regexp:replace('Food is great', 'Fo.d', '', 'XSLT')",
+ expResult: "XSLT is great" }
+ ];
+
+ for (test of tests) {
+ var style =
+ '<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" ' +
+ 'xmlns:regexp="http://exslt.org/regular-expressions" '+
+ 'version="1.0">' +
+ '<xsl:output method="html"/>' +
+ '<xsl:template match="/">' +
+ '<xsl:value-of select="'+test.expr+'" /> ' +
+ '</xsl:template>' +
+ '</xsl:stylesheet>';
+ var styleDoc = new DOMParser().parseFromString (style, "text/xml");
+
+ var data = '<root/>';
+ var originalDoc = new DOMParser().parseFromString(data, "text/xml");
+
+ var processor = new XSLTProcessor();
+ processor.importStylesheet(styleDoc);
+
+ var fragment = processor.transformToFragment(originalDoc, document);
+ var content = document.getElementById("content");
+ content.appendChild(fragment);
+ is(content.innerHTML, test.expResult, test.descr);
+
+ content.innerHTML = '';
+ }
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/xslt/tests/mochitest/test_parameter.html b/dom/xslt/tests/mochitest/test_parameter.html
new file mode 100644
index 000000000..2430f75ec
--- /dev/null
+++ b/dom/xslt/tests/mochitest/test_parameter.html
@@ -0,0 +1,31 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Test for setParameter/getParameter</title>
+ <script type="text/javascript" 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>
+ var processor = new XSLTProcessor();
+
+ processor.setParameter(null, "test", "hello");
+ is(processor.getParameter(null, "test"), "hello", "null namespace works");
+
+ processor.setParameter("foo", "bar", "foobar");
+ is(processor.getParameter("foo", "bar"), "foobar", "non-null namespace works");
+
+ processor.setParameter(null, "test", 123);
+ is(processor.getParameter(null, "test"), 123, "number value works");
+
+ processor.removeParameter(null, "test");
+ is(processor.getParameter(null, "test"), null, "removeParameter works");
+
+ is(processor.getParameter(null, "not-here"), null, "nonexistant parameter");
+</script>
+</pre>
+</body>
+</html>