gecko/toolkit/webapps/tests/app.sjs
Marco Castelluccio 2982bfa483 Bug 981249 - Test app launch. r=myk
--HG--
rename : toolkit/webapps/tests/test_hosted.xul => toolkit/webapps/tests/test_hosted_launch.xul
rename : toolkit/webapps/tests/test_packaged.xul => toolkit/webapps/tests/test_packaged_launch.xul
2014-03-27 12:56:00 +01:00

34 lines
667 B
JavaScript

function getQuery(request) {
let query = {};
request.queryString.split('&').forEach(function(val) {
let [name, value] = val.split('=');
query[name] = unescape(value);
});
return query;
}
function handleRequest(request, response) {
response.setHeader("Cache-Control", "no-cache", false);
let query = getQuery(request);
if ("appreq" in query) {
response.setHeader("Content-Type", "text/plain", false);
response.write("Hello world!");
setState("appreq", "done");
return;
}
if ("testreq" in query) {
response.setHeader("Content-Type", "text/plain", false);
response.write(getState("appreq"));
return;
}
}