test_bug484396.html (1088B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=484396 5 --> 6 <head> 7 <title>Test for Bug 484396</title> 8 <script 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=484396">Mozilla Bug 484396</a> 13 <p id="display"></p> 14 <div id="content" style="display: none"> 15 16 </div> 17 <pre id="test"> 18 <script type="application/javascript"> 19 SimpleTest.waitForExplicitFinish(); 20 21 var msg = 'xhr.open() succeeds with empty url'; 22 var xhr = new XMLHttpRequest(); 23 24 try { 25 xhr.open('GET', ''); 26 ok(true, msg); 27 } catch (e) { 28 ok(false, msg); 29 } 30 31 xhr.onerror = function () { 32 ok(false, 'xhr.send() succeeds with empty url'); 33 } 34 35 xhr.onreadystatechange = function () { 36 if (4 == xhr.readyState) { 37 is(xhr.status, 200, 'xhr.status is 200 OK'); 38 ok(-1 < xhr.responseText.indexOf('Bug 484396'), 'xhr.responseText contains the calling page'); 39 40 SimpleTest.finish(); 41 } 42 }; 43 44 xhr.send(''); 45 </script> 46 </pre> 47 </body> 48 </html>