test_bug1061864_2.xul 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?xml version="1.0"?>
  2. <?xml-stylesheet type="text/css" href="chrome://global/skin"?>
  3. <?xml-stylesheet type="text/css" href="/tests/SimpleTest/test.css"?>
  4. <!--
  5. https://bugzilla.mozilla.org/show_bug.cgi?id=1061864
  6. -->
  7. <window title="Mozilla Bug 1061864"
  8. xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" onload="RunTest();">
  9. <script type="application/javascript"
  10. src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
  11. <!-- test code goes here -->
  12. <script type="application/javascript">
  13. <![CDATA[
  14. /** Test for Bug 1061864 **/
  15. SimpleTest.waitForExplicitFinish();
  16. function RunTest()
  17. {
  18. // Test that the docshell prerendered flag will be correctly inherited in
  19. // prerendered documents.
  20. test(false, function() {
  21. test(true, function() {
  22. SimpleTest.finish();
  23. });
  24. });
  25. }
  26. function test(prerendered, callback) {
  27. var parentIframe = document.createElement("iframe");
  28. if (prerendered) {
  29. parentIframe.setIsPrerendered();
  30. }
  31. parentIframe.setAttribute("src", "1061864.html");
  32. parentIframe.onload = function() {
  33. var childIframe = parentIframe.contentDocument.getElementById("childiframe");
  34. var childDocShell = childIframe.frameLoader.docShell;
  35. is(childDocShell.isPrerendered, prerendered, "The docshell is" + (prerendered ? "" : " not") + " prerendered");
  36. callback();
  37. }
  38. document.documentElement.appendChild(parentIframe);
  39. }
  40. ]]>
  41. </script>
  42. <!-- test results are displayed in the html:body -->
  43. <body xmlns="http://www.w3.org/1999/xhtml">
  44. <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1061864"
  45. target="_blank">Mozilla Bug 1061864</a>
  46. </body>
  47. </window>