test_bug347174_xslp.html 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <!DOCTYPE HTML>
  2. <html>
  3. <!--
  4. https://bugzilla.mozilla.org/show_bug.cgi?id=347174
  5. -->
  6. <head>
  7. <title>Test for Bug 347174</title>
  8. <script type="text/javascript" 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=347174">Mozilla Bug 347174</a>
  13. <p id="display"></p>
  14. <div id="content" style="display: none">
  15. </div>
  16. <pre id="test">
  17. <script class="testbody" type="text/javascript">
  18. /** Test for Bug 347174 **/
  19. // verifies that documents created with createDocument are born in "complete" state
  20. // (so we don't accidentally leave them in "interactive" state)
  21. window.readyStateText = [];
  22. function xmlLoaded(e) {
  23. var xslDoc = document.implementation.createDocument("", "test", null);
  24. xslDoc.async=false;
  25. xslDoc.load("347174transform.xsl");
  26. var processor = new XSLTProcessor();
  27. processor.importStylesheet(xslDoc);
  28. window.transformedDoc = processor.transformToDocument(xmlDoc);
  29. showMessage("loaded: " + xmlDoc.readyState);
  30. is(xmlDoc.readyState, "complete", "XML document.readyState should be 'complete' after transform");
  31. SimpleTest.finish();
  32. }
  33. var xmlDoc = document.implementation.createDocument("", "test", null);
  34. showMessage("createDocument: " + xmlDoc.readyState);
  35. is(xmlDoc.readyState, "complete", "created document readyState should be 'complete' before being associated with a parser");
  36. xmlDoc.async=true;
  37. xmlDoc.addEventListener("load", xmlLoaded, false);
  38. xmlDoc.load("347174transformable.xml");
  39. showMessage("load called: " + xmlDoc.readyState);
  40. isnot(xmlDoc.readyState, "complete", "created document readyState should not be 'complete' after load called");
  41. function showMessage(msg) {
  42. window.readyStateText.push(msg);
  43. $("display").innerHTML = readyStateText.join("<br>");
  44. }
  45. SimpleTest.waitForExplicitFinish();
  46. </script>
  47. </pre>
  48. </body>
  49. </html>