mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
0aea730d1e
CLOSED TREE Backed out changeset 73d0f6b58639 (bug 1117650) Backed out changeset 646b7dddf7c5 (bug 1117650) Backed out changeset eed379ade07e (bug 1117650)
47 lines
1.3 KiB
JavaScript
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");
|
|
}
|