51 srv.registerPathHandler(
path, handlers[
path]);
68 response.setStatusLine(request.httpVersion, 500,
"handleSync fail");
73 do_throw(
"finish called on sync response");
80 response.setStatusLine(request.httpVersion, 200,
"handleSync pass");
87 do_check_eq(ch.responseStatusText,
"handleSync pass");
97 response.setStatusLine(request.httpVersion, 500,
"Old status line!");
98 response.setHeader(
"X-Foo",
"old value",
false);
100 response.processAsync();
102 response.setStatusLine(request.httpVersion, 200,
"New status line!");
103 response.setHeader(
"X-Foo",
"new value",
false);
109 response.setStatusLine(request.httpVersion, 500,
"Too late!");
110 do_throw(
"late setStatusLine didn't throw");
119 response.setHeader(
"X-Foo",
"late value",
false);
120 do_throw(
"late setHeader didn't throw");
129 response.bodyOutputStream;
130 do_throw(
"late bodyOutputStream get didn't throw");
139 response.write(
"fugly");
140 do_throw(
"late write() didn't throw");
152 do_check_eq(ch.responseStatusText,
"New status line!");
153 do_check_eq(ch.getResponseHeader(
"X-Foo"),
"new value");
171 response.processAsync();
173 response.setStatusLine(request.httpVersion, 200,
"Status line");
174 response.setHeader(
"X-Custom-Header",
"value",
false);
179 response.bodyOutputStream.write(body, body.length);
183 response.setStatusLine(request.httpVersion, 500,
"after body write");
184 do_throw(
"setStatusLine succeeded");
193 response.setHeader(
"X-Custom-Header",
"new 1",
false);
203 response.bodyOutputStream.write(body, body.length);
210 response.setStatusLine(request.httpVersion, 500,
"after finish");
219 response.setHeader(
"X-Custom-Header",
"new 2",
false);
228 response.write(
"EVIL");
243 var
now = startTime_handleAsync2 = Date.now();
244 dumpn(
"*** init_HandleAsync2: start time " + now);
249 var
now = Date.now();
250 dumpn(
"*** start_handleAsync2: onStartRequest time " + now +
", " +
251 (now - startTime_handleAsync2) +
"ms after start time");
256 do_check_eq(ch.getResponseHeader(
"X-Custom-Header"),
"value");
261 var
now = Date.now();
262 dumpn(
"*** stop_handleAsync2: onStopRequest time " + now +
", " +
263 (now - startTime_handleAsync2) +
"ms after header time");
278 response.setStatusLine(request.httpVersion, 200,
"Async Error");
279 response.setHeader(
"X-Foo",
"header value",
false);
281 response.processAsync();
286 throw "Monkey wrench!";
294 do_check_eq(ch.getResponseHeader(
"X-Foo"),
"header value");
300 do_check_true(ch.requestSucceeded);
323 for (var
i = 0;
i < 65536;
i++)
339 out.writeByteArray(data, data.length);
346 do_throw(
"error writing data: " + e);
361 .dispatch(writeData,
Ci.nsIThread.DISPATCH_NORMAL);
364 response.processAsync();
371 do_check_true(
data.every(
function(v) {
return v === 0; }));
do_check_eq(typeof PlacesUtils,"object")
function stop_handleAsync1(ch, cx, status, data)
function handleAsyncOrdering(request, response)
function init_handleAsync2(ch)
function runHttpTests(testArray, done)
function handleAsyncError(request, response)
function handleAsync2(request, response)
function stop_handleAsyncOrdering(ch, cx, status, data)
function handleAsync1(request, response)
const startToFinishedDelay
function start_handleAsync2(ch, cx)
function testComplete(srv)
function Test(path, initChannel, onStartRequest, onStopRequest)
function start_handleSync(ch, cx)
function stop_handleAsyncError(ch, cx, status, data)
var startTime_handleAsync2
function handleSync(request, response)
function stop_handleAsync2(ch, cx, status, data)
function start_handleAsyncError(ch, cx)
_getSelectedPageStyle s i
function callLater(msecs, callback)
function start_handleAsync1(ch, cx)
function isException(e, code)