test_bug289714.html (1217B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=289714 5 --> 6 <head> 7 <title>Test for Bug 289714</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=289714">Mozilla Bug 289714</a> 13 <p id="display"></p> 14 <div id="content" style="display: none"> 15 16 </div> 17 <pre id="test"> 18 <script class="testbody" type="text/javascript"> 19 20 SimpleTest.waitForExplicitFinish(); 21 22 let xhr = new XMLHttpRequest(), 23 expectedResponseText = "<?xml version='1.0' encoding='shift-jis'?><xml>" + 24 (new Array(1 << 13)).join("こんにちは") + 25 "</xml>"; 26 xhr.open("GET", "bug289714.sjs"); 27 xhr.onprogress = function() { 28 let text = xhr.responseText; 29 is(text, expectedResponseText.substring(0, text.length), 30 "Data before OnStopRequest is decoded properly"); 31 xhr.onprogress = undefined; 32 } 33 xhr.onload = xhr.onerror = function() { 34 is(xhr.responseText, expectedResponseText, 35 "Final response is decoded properly"); 36 SimpleTest.finish(); 37 } 38 xhr.send(); 39 40 </script> 41 </pre> 42 </body> 43 </html>