parser/htmlparser/tests/mochitest/test_bug688580.html

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 <!DOCTYPE HTML>
     2 <html>
     3 <!--
     4 https://bugzilla.mozilla.org/show_bug.cgi?id=688580
     5 -->
     6 <head>
     7   <meta charset="utf-8">
     8   <title>Test for Bug 688580</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   <script type="application/javascript">
    13   /** Test for Bug 688580 **/
    15   // Expected order:
    16   // Test starting
    17   // readyState interactive
    18   // defer
    19   // DOMContentLoaded
    20   // readyState complete
    21   // load
    23   var state = "Test starting";
    24   var readyStateCall = 0;
    25   SimpleTest.waitForExplicitFinish();
    26   is(document.readyState, "loading", "Document should have been loading.");
    27   document.addEventListener("DOMContentLoaded", function () {
    28     is(document.readyState, "interactive", "readyState should be interactive during DOMContentLoaded.");
    29     is(state, "defer", "Bad state upon DOMContentLoaded");
    30     state = "DOMContentLoaded";
    31   });
    32   document.addEventListener("readystatechange", function () {
    33     readyStateCall++;
    34     if (readyStateCall == 1) {
    35       is(document.readyState, "interactive", "readyState should have changed to interactive.");
    36       is(state, "Test starting", "Bad state upon first readystatechange.");
    37       state = "readyState interactive";
    38     } else if (readyStateCall == 2) {
    39       is(document.readyState, "complete", "readyState should have changed to complete.");
    40       is(state, "DOMContentLoaded", "Bad state upon second readystatechange.");
    41       state = "readyState complete";
    42     } else {
    43       ok(false, "Too many readystatechanges");
    44     }
    45   });
    46   window.addEventListener("load", function () {
    47     is(document.readyState, "complete", "readyState should be complete during load.");
    48     is(state, "readyState complete", "Bad state upon load")
    49     state = "load";
    50     SimpleTest.finish();
    51   });
    52   </script>
    53   <script defer src="file_bug688580.js"></script>
    54 </head>
    55 <body>
    56 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=688580">Mozilla Bug 688580</a>
    57 <p id="display"></p>
    58 <div id="content" style="display: none">
    60 </div>
    61 <pre id="test">
    62 </pre>
    63 </body>
    64 </html>

mercurial