Bug 998282. Ensure cancellable_request.sjs massively overfills the default 100K media cache size.
This ensures a test can make such a request, receive the event that the
load has been suspended, and cancel the request, all before the load has
completed.
--- a/content/media/test/cancellable_request.sjs
+++ b/content/media/test/cancellable_request.sjs
@@ -78,17 +78,17 @@ function handleRequest(request, response
if (cancel) {
setState(cancel[1], "cancelled");
response.setStatusLine(request.httpVersion, 200, "OK");
response.write("Cancel approved!");
return;
}
var samples = [];
- for (var i = 0; i < 100000; ++i) {
+ for (var i = 0; i < 1000000; ++i) {
samples.push(0);
}
var bytes = buildWave(samples, 44100).join("");
var key = parseQuery(request, "key");
response.setHeader("Content-Type", "audio/x-wav");
response.setHeader("Content-Length", ""+bytes.length, false);
@@ -132,20 +132,20 @@ function handleRequest(request, response
}
if (start > 0) {
// Send all requested data
out.write(bytes.slice(start, end + 1), end + 1 - start);
return;
}
- // Write the first 120K of the Wave file. We know the cache size is set to
+ // Write the first 1.2M of the Wave file. We know the cache size is set to
// 100K so this will fill the cache and and cause a "suspend" event on
// the loading element.
- out.write(bytes, 120000);
+ out.write(bytes, 1200000);
response.processAsync();
// Now wait for the message to cancel this response
poll(function() {
if (getState(key[1]) != "cancelled") {
return false;
}
response.finish();