75 if (e !== err && e.result !== err)
89 },
Ci.nsIThread.DISPATCH_NORMAL);
99 response.seizePower();
100 response.write(
"Raw data!");
106 response.write(
"DO NOT WANT");
107 var
output = response.bodyOutputStream;
109 response.seizePower();
111 if (response.bodyOutputStream !== output)
112 response.write(
"bodyOutputStream changed!");
114 response.write(
"too-late passed");
120 response.seizePower();
121 checkException(
function() { response.setStatusLine(
"1.0", 500,
"ISE"); },
122 Cr.NS_ERROR_NOT_AVAILABLE,
123 "setStatusLine should throw not-available after seizePower");
124 checkException(
function() { response.setHeader(
"X-Fail",
"FAIL",
false); },
125 Cr.NS_ERROR_NOT_AVAILABLE,
126 "setHeader should throw not-available after seizePower");
128 Cr.NS_ERROR_NOT_AVAILABLE,
129 "processAsync should throw not-available after seizePower");
130 var out = response.bodyOutputStream;
131 var
data =
"exceptions test passed";
132 out.write(data, data.length);
133 response.seizePower();
137 Cr.NS_ERROR_UNEXPECTED,
138 "seizePower should throw unexpected after finish");
143 response.seizePower();
146 response.write(
"async seizure passed");
147 response.bodyOutputStream.close();
157 response.setStatusLine(request.httpVersion, 200,
"async seizure pass");
158 response.processAsync();
160 Cr.NS_ERROR_NOT_AVAILABLE,
161 "seizePower should throw not-available after processAsync");
170 if (request.queryString ===
"writeBefore")
171 response.write(
"ignore this");
172 else if (request.queryString ===
"writeBeforeEmpty")
174 else if (request.queryString !==
"")
175 throw "query string FAIL";
176 response.seizePower();
177 response.write(
"preparing to throw...");
178 throw "badness 10000";
183 response.seizePower();
184 response.write(
"should only ");
185 response.write(
"see this");
189 response.write(
"...and not this");
192 response.write(
"...or this");
197 throw "opening pitch of the ballgame";
202 response.seizePower();
203 response.write(
"should only see this");
210 throw "out the bum!";
221 data =
"GET /raw-data HTTP/1.0\r\n" +
230 data =
"GET /called-too-late HTTP/1.0\r\n" +
239 data =
"GET /exceptions HTTP/1.0\r\n" +
248 data =
"GET /async-seizure HTTP/1.0\r\n" +
257 data =
"GET /seize-after-async HTTP/1.0\r\n" +
266 data =
"GET /thrown-exception?writeBefore HTTP/1.0\r\n" +
275 data =
"GET /thrown-exception?writeBeforeEmpty HTTP/1.0\r\n" +
284 data =
"GET /thrown-exception HTTP/1.0\r\n" +
293 data =
"GET /asap-later-write HTTP/1.0\r\n" +
302 data =
"GET /asap-later-finish HTTP/1.0\r\n" +
do_check_eq(typeof PlacesUtils,"object")
function handleASAPLaterFinish(request, response)
function checkSeizeAfterAsync(data)
function handleASAPLaterWrite(request, response)
function checkThrownExceptionWriteBeforeEmpty(data)
function checkThrownException(data)
function checkRawData(data)
function checkThrownExceptionWriteBefore(data)
function handleAsyncSeizure(request, response)
function handleThrownException(request, response)
function checkAsyncSeizure(data)
function runRawTests(testArray, done)
function checkExceptions(data)
function handleSeizeAfterAsync(request, response)
function RawTest(host, port, data, responseCheck)
function checkASAPLaterFinish(data)
function callASAPLater(fun)
function testComplete(srv)
function checkException(fun, err, msg)
function checkASAPLaterWrite(data)
function handleRawData(request, response)
function callLater(msecs, callback)
function handleExceptions(request, response)
function LineIterator(data)
function handleTooLate(request, response)
function checkTooLate(data)