tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_bug604660.html (2097B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <!--
      4 https://bugzilla.mozilla.org/show_bug.cgi?id=604660
      5 -->
      6 <head>
      7  <title>Test for Bug 604660</title>
      8  <script src="/tests/SimpleTest/SimpleTest.js"></script>
      9  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
     10 </head>
     11 <body>
     12 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=604660">Mozilla Bug 604660</a>
     13 <script>
     14 SimpleTest.waitForExplicitFinish();
     15 var asyncState = false;
     16 var scriptState = 0;
     17 
     18 function scriptRan(num) {
     19  ++scriptState;
     20  is(scriptState, num, "Scripts ran in the wrong sequence.");
     21 }
     22 
     23 function asyncRan() {
     24  asyncState = true;
     25 }
     26 
     27 </script>
     28 <p id="display"><iframe src="file_bug604660-1.xml" onload="iframeloaded()";></iframe></p>
     29 <div id="content" style="display: none">
     30  
     31 </div>
     32 <pre id="test">
     33 <script class="testbody" type="text/javascript">
     34 
     35 var xlstProcessorState = false;
     36 
     37 function xsltProcessorCreatedScriptRan() {
     38  xlstProcessorState = true;
     39 }
     40 
     41 function iframeloaded() {
     42  ok(asyncState, "Async script should have run.");
     43  is(scriptState, 5, "Five scripts should have run.");
     44 
     45  var processor = new XSLTProcessor();
     46 
     47  var xhr = new XMLHttpRequest();
     48  xhr.onreadystatechange = function() {
     49    if (this.readyState == 4) {
     50      processor.importStylesheet(this.responseXML);
     51      xhr.onreadystatechange = function() {
     52        if (this.readyState == 4) {
     53          var doc = processor.transformToDocument(this.responseXML);
     54          var target = document.getElementById("display");
     55          target.appendChild(doc.documentElement.firstChild);
     56          ok(!xlstProcessorState, "Scripts created by transformToDocument should not run.");
     57 
     58          var fragment = processor.transformToFragment(this.responseXML, document);
     59          target.appendChild(fragment.firstChild.firstChild);
     60          ok(xlstProcessorState, "Scripts created by transformToFragment should run.");
     61 
     62          SimpleTest.finish();
     63        }
     64      }
     65      xhr.open("GET", "file_bug604660-5.xml");
     66      xhr.send();
     67    }
     68  }
     69  xhr.open("GET", "file_bug604660-6.xsl");
     70  xhr.send();
     71 }
     72 </script>
     73 </pre>
     74 </body>
     75 </html>