gecko/dom/base/test/file_CrossSiteXHR_cache_server.sjs
Phil Ringnalda 0aea730d1e Back out 3 changesets (bug 1117650) for allowing an ASan mochitest-2 leak exactly like they allowed it on try
CLOSED TREE

Backed out changeset 73d0f6b58639 (bug 1117650)
Backed out changeset 646b7dddf7c5 (bug 1117650)
Backed out changeset eed379ade07e (bug 1117650)
2015-02-08 23:07:51 -08:00

47 lines
1.3 KiB
JavaScript

function handleRequest(request, response)
{
var query = {};
request.queryString.split('&').forEach(function (val) {
var [name, value] = val.split('=');
query[name] = unescape(value);
});
if ("setState" in query) {
setState("test/dom/base/test_CrossSiteXHR_cache:secData",
query.setState);
response.setHeader("Cache-Control", "no-cache", false);
response.setHeader("Content-Type", "text/plain", false);
response.write("hi");
return;
}
var isPreflight = request.method == "OPTIONS";
// Send response
secData =
eval(getState("test/dom/base/test_CrossSiteXHR_cache:secData"));
if (secData.allowOrigin)
response.setHeader("Access-Control-Allow-Origin", secData.allowOrigin);
if (isPreflight) {
if (secData.allowHeaders)
response.setHeader("Access-Control-Allow-Headers", secData.allowHeaders);
if (secData.allowMethods)
response.setHeader("Access-Control-Allow-Methods", secData.allowMethods);
if (secData.cacheTime)
response.setHeader("Access-Control-Max-Age", secData.cacheTime.toString());
return;
}
response.setHeader("Cache-Control", "no-cache", false);
response.setHeader("Content-Type", "application/xml", false);
response.write("<res>hello pass</res>\n");
}