test_EventSource_redirects.html (1334B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=716841 5 --> 6 <head> 7 <meta http-equiv='Content-Type' content='text/html; charset=utf-8'> 8 <title>Test for Bug 338583</title> 9 <script src="/tests/SimpleTest/SimpleTest.js"></script> 10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 11 12 </head> 13 <body bgColor=white> 14 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=716841">Mozilla Bug 716841</a> 15 <p id="display"></p> 16 <div id="content" style="display: none"> 17 18 </div> 19 <pre id="test"> 20 <script class="testbody" type="text/javascript"> 21 22 function doTest(test_id) { 23 source = new EventSource("eventsource_redirect.resource"); 24 ok(source.url == "http://mochi.test:8888/tests/dom/base/test/eventsource_redirect.resource", "Test failed."); 25 ok(source.readyState == 0 || source.readyState == 1, "Test failed."); 26 27 source.onopen = function (event) { 28 ok(true, "opened"); 29 }; 30 31 source.onmessage = function (event) { 32 ok(true, "event received"); 33 source.close(); 34 SimpleTest.finish(); 35 }; 36 37 source.onerror = function (event) { 38 ok(false, "received onError: " + event); 39 source.close(); 40 SimpleTest.finish(); 41 }; 42 43 } 44 45 SimpleTest.waitForExplicitFinish(); 46 addLoadEvent(doTest); 47 </script> 48 </pre> 49 50 </body> 51 </html>