author | Masatoshi Kimura <VYV03354@nifty.ne.jp> |
Wed, 26 Oct 2011 08:52:37 -0400 | |
changeset 79245 | 254bfb46c1008f327a33c7c8dec1775d54ad9c20 |
parent 79244 | e050ed22381c186dbfb6a84c8a2914c8a1cd946c |
child 79246 | 16a8d2ab5240d70ddcd920cfa9c446e6f7b666a5 |
child 79249 | beb93d0d59afae262c035afa349e22b6bdf899f6 |
push id | 21380 |
push user | bmo@edmorley.co.uk |
push date | Wed, 26 Oct 2011 23:31:27 +0000 |
treeherder | autoland@16a8d2ab5240 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | jonas |
bugs | 689008 |
milestone | 10.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/content/base/test/test_xhr_progressevents.html +++ b/content/base/test/test_xhr_progressevents.html @@ -116,82 +116,101 @@ function runTests() { { type: "blob", text: false, nodata: true }, { type: "document", text: true, nodata: true }, { type: "moz-json", text: true, nodata: true }, { type: "", text: true }, { type: "moz-chunked-text", text: true, chunked: true }, { type: "moz-chunked-arraybuffer", text: false, chunked: true }, ]; var responseType; + var fileExpectedResult = ""; + for (var i = 0; i < 65536; i++) { + fileExpectedResult += String.fromCharCode(i & 255); + } while (responseType = responseTypes.shift()) { let tests = [{ open: "Content-Type=text/plain", name: "simple test" }, { data: "hello world" }, { data: "\u0000\u0001\u0002\u0003" }, { data: longString }, { data: "x" }, { close: true }, { open: "Content-Type=text/plain&Content-Length=20", name: "with length", total: 20 }, // 5 bytes from the "ready" in the open step { data: "abcde" }, { data: "0123456789" }, { close: true }, - { open: "Content-Type=application/xml", data: "ready", name: "without length, as xml" }, + { open: "Content-Type=application/xml", name: "without length, as xml" }, { data: "<out>" }, { data: "text" }, { data: "</foo>invalid" }, { close: true }, { open: "Content-Type=text/plain;charset%3dutf-8", name: "utf8 data", encoded: true }, { data: utf8encode("räksmörgås"), utf16: "räksmörgås" }, { data: utf8encode("Å").substr(0,1), utf16: "" }, { data: utf8encode("Å").substr(1), utf16: "Å" }, { data: utf8encode("aöb").substr(0,2), utf16: "a" }, { data: utf8encode("aöb").substr(2), utf16: "öb" }, { data: utf8encode("a\u867Eb").substr(0,3), utf16: "a" }, { data: utf8encode("a\u867Eb").substr(3,1), utf16: "\u867E" }, { data: utf8encode("a\u867Eb").substr(4), utf16: "b" }, { close: true }, ]; + if (responseType.type === "blob") { + tests.push({ file: "file_XHR_binary2.bin", name: "cacheable data", total: 65536 }, + { close: true }, + { file: "file_XHR_binary2.bin", name: "cached data", total: 65536 }, + { close: true }); + } let testState = { index: 0 }; - + for (let i = 0; i < tests.length; ++i) { let test = tests[i]; testState.index++; - if ("open" in test) { + if ("open" in test || "file" in test) { log("opening " + testState.name); testState = { name: test.name + " for " + responseType.type, index: 0, pendingResult: "ready", pendingBytes: 5, receivedResult: "", receivedBytes: 0, total: test.total, encoded: test.encoded, nodata: responseType.nodata, chunked: responseType.chunked, - text: responseType.text }; + text: responseType.text, + file: test.file }; xhr.onreadystatechange = null; - xhr.open("POST", "progressserver.sjs?open&" + test.open); + if (testState.file) + xhr.open("GET", test.file); + else + xhr.open("POST", "progressserver.sjs?open&" + test.open); xhr.responseType = responseType.type; xhr.send("ready"); xhr.onreadystatechange = getEvent; let e = yield; is(e.type, "readystatechange", "should readystate to headers-received starting " + testState.name); is(xhr.readyState, xhr.HEADERS_RECEIVED, "should be in state HEADERS_RECEIVED starting " + testState.name); e = yield; is(e.type, "readystatechange", "should readystate to loading starting " + testState.name); is(xhr.readyState, xhr.LOADING, "should be in state LOADING starting " + testState.name); if (typeof testState.total == "undefined") delete testState.total; } - else if ("close" in test) { + if ("file" in test) { + testState.pendingBytes = testState.total; + testState.pendingResult = fileExpectedResult; + } + if ("close" in test) { log("closing"); - closeConn(); + if (!testState.file) + closeConn(); e = yield; is(e.type, "readystatechange", "should readystate to done closing " + testState.name); is(xhr.readyState, xhr.DONE, "should be in state DONE closing " + testState.name); log("readystate to 4"); if (responseType.chunked) { xhr.responseType; @@ -231,17 +250,17 @@ function runTests() { yield; is(reader.result, testState.pendingResult, "full response in blob for " + testState.name); } testState.name = ""; } - else { + if ("data" in test) { log("sending"); if (responseType.text) { testState.pendingResult += "utf16" in test ? test.utf16 : test.data; } else { testState.pendingResult += test.data; } testState.pendingBytes = test.data.length;