49 var sjsDir = do_get_file(
"data/sjs/");
50 srv.registerDirectory(
"/", sjsDir);
51 srv.registerContentType(
"sjs",
"sjs");
59 "pathHandlerPrivate2");
65 srv.stop(
function() { do_test_finished(); });
80 response.setHeader(
"Cache-Control",
"no-cache",
false);
82 response.setHeader(
"X-Old-Shared-Value",
srv.getSharedState(
"shared-value"),
84 response.setHeader(
"X-Old-Private-Value",
srv.getState(
"/path-handler",
"private-value"),
87 var privateValue, sharedValue;
91 privateValue =
"pathHandlerPrivate";
92 sharedValue =
"pathHandlerShared";
96 privateValue =
"pathHandlerPrivate2";
100 srv.setState(
"/path-handler",
"private-value", privateValue);
101 srv.setSharedState(
"shared-value", sharedValue);
103 response.setHeader(
"X-New-Private-Value", privateValue,
false);
104 response.setHeader(
"X-New-Shared-Value", sharedValue,
false);
118 function getHeader(
name)
122 return ch.getResponseHeader(
name);
126 if (e.result !==
Cr.NS_ERROR_NOT_AVAILABLE)
134 function expectValues(ch, oldShared, newShared, oldPrivate, newPrivate)
139 do_check_eq(getHeader(
"X-Old-Shared-Value"), oldShared);
140 do_check_eq(getHeader(
"X-New-Shared-Value"), newShared);
141 do_check_eq(getHeader(
"X-Old-Private-Value"), oldPrivate);
142 do_check_eq(getHeader(
"X-New-Private-Value"), newPrivate);
146 test =
new Test(
"http://localhost:4444/state1.sjs?" +
147 "newShared=newShared&newPrivate=newPrivate",
153 dumpn(
"XXX start_initial");
158 test =
new Test(
"http://localhost:4444/state1.sjs?" +
159 "newShared=newShared2&newPrivate=newPrivate2",
165 expectValues(ch,
"newShared",
"newShared2",
"newPrivate",
"newPrivate2");
169 test =
new Test(
"http://localhost:4444/state1.sjs?" +
170 "newShared=&newPrivate=newPrivate3",
176 expectValues(ch,
"newShared2",
"",
"newPrivate2",
"newPrivate3");
180 test =
new Test(
"http://localhost:4444/path-handler",
186 expectValues(ch,
"",
"pathHandlerShared",
"",
"pathHandlerPrivate");
190 test =
new Test(
"http://localhost:4444/path-handler",
197 "pathHandlerPrivate",
"pathHandlerPrivate2");
201 test =
new Test(
"http://localhost:4444/state2.sjs?" +
202 "newShared=newShared4&newPrivate=newPrivate4",
212 test =
new Test(
"http://localhost:4444/state2.sjs?" +
223 test =
new Test(
"http://localhost:4444/state2.sjs?" +
224 "newShared=newShared5&newPrivate=newPrivate5",
230 expectValues(ch,
"",
"newShared5",
"newPrivate4",
"newPrivate5");
234 test =
new Test(
"http://localhost:4444/state1.sjs?" +
235 "newShared=done!&newPrivate=",
241 expectValues(ch,
"newShared5",
"done!",
"newPrivate3",
"");
function start_set_remove_original(ch, cx)
do_check_eq(typeof PlacesUtils,"object")
function start_remove(ch, cx)
function runHttpTests(testArray, done)
function start_overwrite(ch, cx)
function start_other_initial(ch, cx)
function start_handler_again(ch, cx)
function getHeaderFunction(ch)
function start_initial(ch, cx)
function expectValues(ch, oldShared, newShared, oldPrivate, newPrivate)
function start_other_set_new(ch, cx)
function start_handler(ch, cx)
function start_other_remove_ignore(ch, cx)
function Test(path, initChannel, onStartRequest, onStopRequest)
function pathHandler(request, response)