content/base/test/test_bug604660.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/content/base/test/test_bug604660.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,77 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=604660
     1.8 +-->
     1.9 +<head>
    1.10 +  <title>Test for Bug 604660</title>
    1.11 +  <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
    1.12 +  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.13 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
    1.14 +</head>
    1.15 +<body>
    1.16 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=604660">Mozilla Bug 604660</a>
    1.17 +<script>
    1.18 +SimpleTest.waitForExplicitFinish();
    1.19 +var asyncState = false;
    1.20 +var scriptState = 0;
    1.21 +
    1.22 +function scriptRan(num) {
    1.23 +  ++scriptState;
    1.24 +  is(scriptState, num, "Scripts ran in the wrong sequence.");
    1.25 +}
    1.26 +
    1.27 +function asyncRan() {
    1.28 +  asyncState = true;
    1.29 +}
    1.30 +
    1.31 +</script>
    1.32 +<p id="display"><iframe src="file_bug604660-1.xml" onload="iframeloaded()";></iframe></p>
    1.33 +<div id="content" style="display: none">
    1.34 +  
    1.35 +</div>
    1.36 +<pre id="test">
    1.37 +<script class="testbody" type="text/javascript">
    1.38 +
    1.39 +var xlstProcessorState = false;
    1.40 +
    1.41 +function xsltProcessorCreatedScriptRan() {
    1.42 +  xlstProcessorState = true;
    1.43 +}
    1.44 +
    1.45 +function iframeloaded() {
    1.46 +  ok(asyncState, "Async script should have run.");
    1.47 +  is(scriptState, 5, "Five scripts should have run.");
    1.48 +
    1.49 +  var processor = new XSLTProcessor();
    1.50 +
    1.51 +  var xhr = new XMLHttpRequest();
    1.52 +  xhr.onreadystatechange = function() {
    1.53 +    if (this.readyState == 4) {
    1.54 +      processor.importStylesheet(this.responseXML);
    1.55 +      xhr.onreadystatechange = function() {
    1.56 +        if (this.readyState == 4) {
    1.57 +          var doc = processor.transformToDocument(this.responseXML);
    1.58 +          var target = document.getElementById("display");
    1.59 +          target.appendChild(doc.documentElement.firstChild);
    1.60 +          ok(!xlstProcessorState, "Scripts created by transformToDocument should not run.");
    1.61 +
    1.62 +          var fragment = processor.transformToFragment(this.responseXML, document);
    1.63 +          target.appendChild(fragment.firstChild.firstChild);
    1.64 +          ok(xlstProcessorState, "Scripts created by transformToFragment should run.");
    1.65 +
    1.66 +          SimpleTest.finish();
    1.67 +        }
    1.68 +      }
    1.69 +      xhr.open("GET", "file_bug604660-5.xml");
    1.70 +      xhr.send();
    1.71 +    }
    1.72 +  }
    1.73 +  xhr.open("GET", "file_bug604660-6.xsl");
    1.74 +  xhr.send();
    1.75 +}
    1.76 +</script>
    1.77 +</pre>
    1.78 +</body>
    1.79 +</html>
    1.80 +

mercurial