dom/xslt/tests/mochitest/test_bug453441.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/xslt/tests/mochitest/test_bug453441.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,57 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=453441
     1.8 +-->
     1.9 +<head>
    1.10 +  <title>Test for Bug 453441</title>
    1.11 +  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.12 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
    1.13 +</head>
    1.14 +<body>
    1.15 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=453441">Mozilla Bug 453441</a>
    1.16 +<p id="display"></p>
    1.17 +<div id="content" style="display: none">
    1.18 +  
    1.19 +</div>
    1.20 +<pre id="test">
    1.21 +<script class="testbody" type="text/javascript">
    1.22 +
    1.23 +/** Test for Bug 453441 **/
    1.24 +
    1.25 +function tryImportStylesheet(xml, valid)
    1.26 +{
    1.27 +  var processor = new XSLTProcessor;
    1.28 +
    1.29 +  var xsltdoc = new DOMParser().parseFromString(xml, "text/xml");
    1.30 +  try
    1.31 +  {
    1.32 +    processor.importStylesheet(xsltdoc);
    1.33 +    ok(valid, "should be able to parse this XSLT stylesheet");
    1.34 +  }
    1.35 +  catch (e)
    1.36 +  {
    1.37 +    ok(!valid, "should not be able to parse this XSLT stylesheet");
    1.38 +  }
    1.39 +}
    1.40 +
    1.41 +tryImportStylesheet(
    1.42 +  '<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">\n\
    1.43 +  <xsl:template match="/">\n\
    1.44 +    <html xmlns="http://www.w3.org/1999/xhtml" xsl:version="1.0" />\n\
    1.45 +  </xsl:template>\n\
    1.46 +  </xsl:stylesheet>'
    1.47 +, true);
    1.48 +
    1.49 +tryImportStylesheet(
    1.50 +  '<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" />'
    1.51 +, false);
    1.52 +
    1.53 +tryImportStylesheet(
    1.54 +  '<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" />'
    1.55 +, false);
    1.56 +
    1.57 +</script>
    1.58 +</pre>
    1.59 +</body>
    1.60 +</html>

mercurial