test_bug703855.html 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <!DOCTYPE HTML>
  2. <html>
  3. <!--
  4. https://bugzilla.mozilla.org/show_bug.cgi?id=703855
  5. -->
  6. <head>
  7. <meta charset="utf-8">
  8. <title>Test for Bug 703855</title>
  9. <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
  10. <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
  11. </head>
  12. <body>
  13. <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=703855">Mozilla Bug 703855</a>
  14. <p id="display"></p>
  15. <div id="content" style="display: none">
  16. <iframe id="f" src="file_bug703855.html"></iframe>
  17. </div>
  18. <pre id="test">
  19. <script type="application/javascript">
  20. /** Test for Bug 703855 **/
  21. SimpleTest.waitForExplicitFinish();
  22. var timingAttributes = [
  23. 'connectEnd',
  24. 'connectStart',
  25. 'domComplete',
  26. 'domContentLoadedEventEnd',
  27. 'domContentLoadedEventStart',
  28. 'domInteractive',
  29. 'domLoading',
  30. 'domainLookupEnd',
  31. 'domainLookupStart',
  32. 'fetchStart',
  33. 'loadEventEnd',
  34. 'loadEventStart',
  35. 'navigationStart',
  36. 'redirectEnd',
  37. 'redirectStart',
  38. 'requestStart',
  39. 'responseEnd',
  40. 'responseStart',
  41. 'unloadEventEnd',
  42. 'unloadEventStart'
  43. ];
  44. var originalTiming = {};
  45. function runTest() {
  46. var timing = $("f").contentWindow.performance.timing;
  47. for (i in timingAttributes) {
  48. originalTiming[timingAttributes[i]] = timing[timingAttributes[i]];
  49. }
  50. var doc = $("f").contentDocument;
  51. doc.open();
  52. doc.write("<!DOCTYPE html>");
  53. doc.close();
  54. SimpleTest.executeSoon(function() {
  55. var newTiming = $("f").contentWindow.performance.timing;
  56. for (var i in timingAttributes) {
  57. is(timing[timingAttributes[i]], originalTiming[timingAttributes[i]],
  58. "document.open should not affect value of " + timingAttributes[i]);
  59. }
  60. SimpleTest.finish();
  61. });
  62. }
  63. addLoadEvent(function() {
  64. SimpleTest.executeSoon(runTest);
  65. });
  66. </script>
  67. </pre>
  68. </body>
  69. </html>