|
1 <!DOCTYPE HTML> |
|
2 <html> |
|
3 <!-- |
|
4 https://bugzilla.mozilla.org/show_bug.cgi?id=300992 |
|
5 --> |
|
6 <head> |
|
7 <title>Test for Bug 300992</title> |
|
8 <script type="application/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=300992">Mozilla Bug 300992</a> |
|
13 <p id="display"></p> |
|
14 <div id="content" style="display: none"> |
|
15 </div> |
|
16 <pre id="test"> |
|
17 <script type="application/javascript"> |
|
18 |
|
19 /** Test for Bug 300992 **/ |
|
20 SimpleTest.waitForExplicitFinish(); |
|
21 |
|
22 var i = 0; |
|
23 var states = ['loading', |
|
24 'interactive1', 'interactive2', |
|
25 'complete1', 'complete2']; |
|
26 |
|
27 is(document.readyState, states[i++], 'initial readyState'); |
|
28 document.onreadystatechange = function (event) { |
|
29 is(document.readyState + '1', states[i++], 'readystatechange event "on" handler'); |
|
30 }; |
|
31 document.addEventListener('readystatechange', function(event) { |
|
32 is(document.readyState + '2', states[i++], 'readystatechange event document listener'); |
|
33 }, false); |
|
34 window.addEventListener('readystatechange', function(event) { |
|
35 ok(false, 'window listener', 'readystatechange event should not bubble to window'); |
|
36 }, false); |
|
37 addLoadEvent(function() { |
|
38 is(i, states.length, 'readystatechange event count'); |
|
39 SimpleTest.finish(); |
|
40 }); |
|
41 |
|
42 </script> |
|
43 </pre> |
|
44 </body> |
|
45 </html> |